parent_of(bill, list(jim, list(albert, empty))).
parent_of(jane, list(jim, list(albert, empty))).
parent_of(jim, list(alice, list(fred, list(john, empty)))).

male(bill).
male(jim).
male(albert).
male(fred).
male(john).

female(jane).
female(alice).

father_of(F, Ch):-
	parent_of(F, List), member(Ch, List), male(F).

grandfather_of(Gf, Gc):-
	parent_of(Gf, List1), member(Ch, List1),
	parent_of(Ch, List2), member(Gc, List2),
	male(Gf).

member(X, list(X, _)).
member(X, list(_, Others)):-member(X, Others).

