I tried to write a program in Prolog and describe a family tree:
parents(uranus, gaia, rhea).
parents(uranus, gaia, cronus).
parents(cronus, rhea, zeus).
parents(cronus, rhea, hera).
parents(cronus, rhea, demeter).
parents(zeus, leto, artemis).
parents(zeus, leto, apollo).
parents(zeus, demeter, persephone).
man(uranus).
man(cronus).
man(zeus).
man(apollo).
man(artemis).
woman(gaia).
woman(rhea).
woman(leto).
woman(demeter).
woman(persephone).
woman(hera).
father(X,Y) :- parents(X,_,Y).
mother(X,Y) :- parents(_,X,Y).
parent(X,Y) :- father(X,Y); mother(X,Y).
son(S,P) :- man(S), father(P,S).
daughter(D,P) :- woman(D), mother(P, D).
siblings(A,B) :- (parents(P,_,A), parents(P,_,B), A\=B) ; (parents(_,P,A), parents(_,P,B), A\=B).
sister(X, Y) :- woman(X), ((parents(F,_,X)), (parents(F,_,Y)); ((parents(_,M,X)), (parents(_,M,Y)).
uncle(U,N) :- man(U), (siblings(U,M); siblings(U,F)), parents(M, F, N).
aunt(U,N) :- woman(U), (siblings(U,M); siblings(U,F)), parents(M, F, N).
grandparent(G,N) :- (parents(G,_,X), parents(X,_,N)); (parents(_,G,X), parents(_,X,N)).
grandpa(G,N) :- (parents(G,_,X), parents(X,_,N)); (parents(_,G,X), parents(_,X,N)), man(G).
grandma(G,N) :- (parents(G,_,X), parents(X,_,N)); (parents(_,G,X), parents(_,X,N)), woman(G).
The question is, I don't know if I did it right - especially the siblings, uncle, aunt, grandpa and grandma relations. Could somebody say if it's good or not? Thank you.