% Predicates for handling family relations ships. % male, female, parent are taken as fundamental father(X,Y):-parent(X,Y), male(X). mother(X,Y):-parent(X,Y),female(X). sister(X,Y):-parent(Z,X),parent(Z,Y),female(X),X\=Y. brother(X,Y):-parent(Z,X),parent(Z,Y),male(X),X\=Y. sibling(X,Y):-sister(X,Y). sibling(X,Y):-brother(X,Y). grandparent(X,Y):-parent(X,Z),parent(Z,Y). grandfather(X,Y):-male(X),grandparent(X,Y). grandmother(X,Y):-female(X),grandparent(X,Y). grandchild(X,Y):-grandparent(Y,X). child(X,Y):-parent(Y,X). son(X,Y):-child(X,Y),male(X). daughter(X,Y):-child(X,Y),female(X). uncle(X,Y):-brother(X,P),parent(P,Y). aunt(X,Y):-sister(X,P),parent(P,Y). grandson(X,Y):-son(X,P),child(P,Y). granddaughter(X,Y):-daughter(X,P),child(P).