View source with raw comments or as raw
    1% { ancestor(bob,sam,[bob,jill,sam]), ... } x2
    2%-parent(bob,Y) :- not father(bob,Y), not mother(bob,Y), not new(bob).
    3%-parent(ted,Z).
    4test(X) :- not test2(X, Y).
    5test(X) :- test([]).
    6test(X).
    7test2(X, Y) :- Y \= 1, not test3(X).
    8test2(X, 1) :- not test3(X).
    9test3(X) :- not test(X).
   10
   11male(bob).
   12male(bo).
   13male(ben).
   14
   15female(may).
   16female(jill).
   17female(sam).
   18
   19father(bob,jill).
   20father(bob,bo).
   21father(ben,sam).
   22
   23mother(may,jill).
   24mother(may,bo).
   25mother(jill,sam).
   26
   27parent(X,Y) :- father(X,Y).
   28parent(X,Y) :- mother(X,Y).
   29
   30% Get lineage from X to Y
   31ancestor(X,Y,[X,Y]) :- parent(X,Y).
   32ancestor(X,Y,[X|T]) :- parent(X,Z),ancestor(Z,Y,T).
   33
   34arith(Z) :- Z is 2 ** 2.2.
   35
   36?- ancestor(bob,sam,X), arith(Z).