Untitled
unknown
prolog
2 years ago
1.0 kB
13
Indexable
mother(X,Y):- /* mother of X is Y */ parent(X,Y), female(Y). father(X,Y):- /* father of X is Y */ parent(X,Y), male(Y). husbandwife(X,Y) :- /* X is a husband of Y wife */ father(Z,X), mother(Z,Y), X \= Y. sibling(X,Y) :- /* X is a sibling of Y */ father(X,Z), father(Y,Z), X \= Y. grandfather(X,Y):- /* X is grandfather of Y */ parent(Y,Z), parent(Z,X), male(X). grandmother(X,Y):- parent(Y,Z), parent(Z,X), female(X). aunt(X,Y):- /* X is an aunt of Y */ parent(Y,Z), sibling(X,Z), female(X). uncle(X,Y):- /* X is an uncle of Y */ parent(Y,Z), sibling(X,Z), male(X). cousinbrother(X,Y):- /* X is cousin brother of Y */ parent(X,Z), parent(Y,W), sibling(Z,W), male(X). cousinsister(X,Y):- /* X is cousin sister of Y */ parent(X,Z), parent(Y,W), sibling(Z,W), female(X). cousin(X,Y):- /* X is cousin of Y */ parent(X,Z), parent(Y,W), sibling(Z,W).
Editor is loading...