Bible relationships - back to content


		parent(abraham,ismael).
		parent(abraham,isaac).
		parent(isaac,esau).
		parent(isaac,iacob).

?- parent(abraham,X). /* The children of Abraham */ X = ismael Y = isaac yes ?- parent(abraham,_). /* Did Abraham have children? */ yes ?- parent(Father,esau). /* The father of Esau? */ Father = isaac ?- parent(F,S). /* All the pairs father-son from the data base */ F = abraham S = ismael ... ?- parent(abraham,X),parent(X,Grandson). /* Is Abraham grandfather? */ X = isaac Grandson = esau X = isaac Grandson = iacob no
?- grandfather(abraham,iacob). yes ?- grandfather(abraham,Grandson). Grandson = esau Grandson = iacob no grandfather(B,N):- parent(B,P),parent(P,N).
?- brother(esau,iacob). yes brother(F1,F2):- parent(P,F1),parent(P,F2),not F1=F2.
?- descendent(abraham,esau). yes descendent(X,Y):- parent(X,Y). descendent(X,Y):- parent(X,Z),descendent(Z,Y).