/* Filename: antest.pro Author: Br. David Carlson Date: December 17, 1999 This program creates a small set of facts and rules on who is the ancestor of whom. This program prints the complete set of who is an ancestor of whom when started with the goal: go. */ /* Note that ancestor(A, B) means that A is an ancestor of B. */ ancestor(bob, susan). ancestor(A, X) :- parent(A, X). ancestor(A, X) :- parent(A, C), ancestor(C, X). /* Note that parent(P, C) means that P is a parent of C. */ parent(fred, sally). parent(tina, sally). parent(sally, john). parent(sally, diane). parent(sam, bill). go :- ancestor(Anc, Off), write(Anc), write(' is an ancestor of '), write(Off), nl, fail. go.