/* Example with a family tree */

father(bob, alice).
father(bob, peter).
mother(carol,peter).
mother(carol,alice).

sibling(X,Y) :- father(Z,X), mother(W,X),
	        father(Z,Y), mother(W,Y), X \= Y.

bobfather(X) :- father(bob,X).

grandfather(X,Y) :- father(X,Z), father(Z,Y).
grandfather(X,Y) :- father(X,Z), mother(Z,Y).

thereisafather :- father(X,Y).
thereisagrandfather :- grandfather(X,Y).