Re: where do I think wrong

"Richard A. O'Keefe" <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 15/03/2014, at 12:03 AM, Kilian Evang wrote:
>>>    half_or_full_siblings(X, Y) :-
>>>>        (   same_father(X, Y),
>>>> 	    X \== Y
>>>> 	;   same_mother(X, Y),
>>>> 	    \+ same_father(X, Y)
>>>> 	).
> 
> Because you don't usually want to say that a person is his or her own
> sibling.
> 
> What I don't understand is why the X \== Y is only in the first
> or-branch. IMHO it should also be in the second.

It would be utterly pointless in the second clause.
It is subsumed by the \+ same_father(X, Y) test;
you certainly have the same father as yourself!

same_father(X, Y)
 -- X and Y are paternal half siblings, full siblings,
    or the same person
X \== Y
    X and Y are not the same person

same_mother(X, Y)
 -- X and Y are maternal half siblings, full siblings,
    or the same person
\+ same_father(X, Y)
    X and Y are not full siblings and not the same person.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.