The document contains Prolog code that defines facts and rules about the gender, fathers, mothers, and siblings of biblical figures. It defines predicates to display all males, females, and sibling pairs, as well as find specific relationships like a person's father, son, grandfather, or mother. However, the code intended to display females does not work correctly.
3. mother(mary, jesus).
%Siblings
siblings(judah,[judah, reuben, simeon, levi, dan, naphtali, gad, asher, issachar, zebulun, dinah,
joseph, benjamin,]).
siblings(perez,[perez,zerah]).
%rules relations
son(X, Y) :- father(Y, X).
son(X,Y):-mother(Y,X).
%queries
displaysiblings:- format("The sibling pairs are:n"),forall(siblings(_,Y),writeln(Y)).%displays
the sibling pairs.
displaymales:- X = male,format("The males are:n"),forall(gender(X,Y),writeln(Y)).%displays
all males.
displayfemales:- Y = female,format("The females
are:n"),forall(gender(Y,X),writeln(X)).%displays all females.
findfather(X):-father(Y,X),format("~w is the father of ~w.",[Y,X]).%finds the father of a certain
male.
findson(X):-father(X,Y), siblings(Y,Z), format("~w are the sons of ~w",[Z,X]).%finds the son
of a certain male if they have siblings.
findson(X):-father(X,Y), format("~w is the son of ~w",[Y,X]).%finds the son of a certain male
if they dont have siblings.
findgfather(X):- father(Y, Z), father(Z, X),format('~w is the grandfather of ~w',[Y,X]).%finds
the grandfather of certain male.
findmother(X):-mother(Y,X),format("~w is the mother of ~w.",[Y,X]).%finds the mother of a
certain male.