
female(mary).
female(ann).
female(elaine).
female(sue).
female(jessica).

married(fred, mary).
married(peter, elaine).
married(tom, sue).
married(alfred, ann).

child(bob, fred).
child(bob, mary).
child(peter, fred).
child(peter, mary).
child(sue, fred).
child(sue, mary).

child(jane, tom).
child(jane, sue).

child(jessica, ann).
child(jessica, alfred).

child(paul, jerry).
child(paul, jane).

sibling(X, Y) :- child(X, Z), child(Y, Z).

sibling1(X, Y) :- child(X, Z), child(Y, Z), not(same(X,Y)).

same(X,X).

parent(X, Y) :- child(Y,X).

ancestor(X, Y) :- parent(X, Y).
ancestor(X, Y) :- parent(X, Z), ancestor(Z, Y).

grandchild(X, Z) :- child(X, Y), child(Y, Z).
