Hello I am a newbie to Prolog with basic question. I would like to know why these Prolog predicates daughter_of/2 and son_of/2 do not work as I want them to. For example, if I ask
16 ?- daughter_of(alice, X).
true.
(Why true? What predicate would I need to get Victoria and Albert?)
Thank you.
male(albert).
male(edward).
female(alice).
female(victoria).
parents(edward, victoria, albert).
parents(alice, victoria, albert).
sister_of(X,Y):-
female(X),
parents(X,M,F),
parents(Y,M,F).
brother_of(X,Y):-
male(X),
parents(X,M,F),
parents(Y,M,F).
daughter_of(X,Y):-
female(X),
parents(X,M,F).
son_of(X,_Y):-
male(X),
parents(X,M,F).
Ydoesn't appear anywhere in the body of yourdaughter_of(X, Y)predicate clause. - lurker