% A sample database. % Percent-sign ('%') marks comments to end-of-line. % FACTS male(abe). male(homer). male(bart). parent(jackie,marge). parent(abe,homer). parent(mona,homer). parent(homer,bart). parent(marge,bart). parent(homer,lisa). parent(marge,lisa). % RULES father(Dad, Child) :- parent(Dad, Child), male(Dad). % Dad is the father of Child % if Dad is the parent of Child and Dad is male % Use meaningful variable names. Cf. % father(X, Y) :- parent(X, Y), male(X). % (You can use generic var names when representing a generic input.) % ":-" read as "if" % "," read as "and" %%%% Define grandparent: %%%% (What is the def'n in English, for "Old is a grandparent of Yng"?) %%%% %%%% Define grandfather: %%%% Define "ancestor": %%%% Cousin: %%%% Digress, in English: %%%% cousin, 2nd cousin, 3rd cousin; %%%% nth cousin m times removed. %%%% nthCousin: