parent(X,Y) :- mother(X,Y). parent(X,Y) :- father(X,Y). sibling(X,Y) :- mother(M,X),mother(M,Y),father(D,X),father(D,Y),X \== Y. haschildren(X) :- parent(X,_). grandparent(X,Y) :- parent(X,M),parent(M,Y). cousin(X,Y) :- parent(A,X),parent(B,Y),sibling(A,B).