:- module(_,_,[sr/bfall]).

% The classic family database:

father_of(john, peter).
father_of(john, mary).
father_of(peter, michael). 

mother_of(mary, david).
mother_of(jill, john).

grandfather_of(L,M) :-
    father_of(L,N),
    father_of(N,M).
grandfather_of(X,Y) :-
    father_of(X,Z),
    mother_of(Z,Y).  

% Some queries:
%
% ?- father_of(john,peter).
% ?- father_of(john,david).
% ?- father_of(john,X).
% ?- grandfather_of(X,michael).
% ?- grandfather_of(X,Y).
% ?- grandfather_of(X,X).
