2024-04-15 13:40:54 +02:00
|
|
|
:- discontiguous male/1, female/1, parent/2.
|
|
|
|
male(dicky).
|
|
|
|
male(randy).
|
|
|
|
male(mike).
|
|
|
|
male(don).
|
|
|
|
male(elmer).
|
|
|
|
female(anne).
|
|
|
|
female(rosie).
|
|
|
|
female(esther).
|
|
|
|
female(mildred).
|
|
|
|
female(greatgramma).
|
|
|
|
male(blair).
|
|
|
|
|
|
|
|
parent(don,randy).
|
|
|
|
parent(don,mike).
|
|
|
|
parent(don,anne).
|
|
|
|
parent(rosie,randy).
|
|
|
|
parent(rosie,mike).
|
|
|
|
parent(rosie,anne).
|
|
|
|
parent(elmer,don).
|
|
|
|
parent(mildred,don).
|
|
|
|
parent(esther,rosie).
|
|
|
|
parent(esther,dicky).
|
|
|
|
parent(greatgramma,esther).
|
|
|
|
parent(randy,blair).
|
2024-04-18 09:14:14 +02:00
|
|
|
parent(mike,juliet).
|
2024-04-15 13:40:54 +02:00
|
|
|
|
|
|
|
male(mel).
|
|
|
|
male(teo).
|
|
|
|
parent(melsr,mel).
|
|
|
|
parent(melsr,teo).
|
|
|
|
|
|
|
|
father(X,Y) :- male(X),parent(X,Y).
|
|
|
|
mother(X,Y) :- female(X),parent(X,Y).
|
2024-04-18 12:32:57 +02:00
|
|
|
son(X,Y) :- male(X),parent(Y,X).
|
|
|
|
dauther(X,Y) :- female(X),parent(Y,X).
|
|
|
|
uncle(X,Y) :- male(X),brother(X,Z),parent(Z,Y).
|
|
|
|
aunt(X,Y) :- female(X),sister(X,Z),parent(Z,Y).
|
|
|
|
|
|
|
|
grandmother(X,Y) :- mother(Z,Y),mother(X,Z).
|
|
|
|
grandmother(X,Y) :- father(Z,Y),mother(X,Z).
|
|
|
|
|
|
|
|
grandmother(X,Y) :- female(X),parent(Z,Y),parent(X,Z).
|
|
|
|
|
|
|
|
%grandfather
|
|
|
|
sister(X,Y) :- female(X),parent(Z,X),parent(Z,Y),X\=Y.
|
|
|
|
brother(X,Y) :- male(X),parent(Z,X),parent(Z,Y),X\=Y.
|
|
|
|
cousin(X,Y) :- uncle(Z,Y),parent(Z,X).
|
2024-05-06 13:28:29 +02:00
|
|
|
cousin(X,Y) :- aunt(Z,Y),parent(Z,X).
|
|
|
|
|
|
|
|
ancestor(X,Y) :- parent(X,Y).
|
|
|
|
ancestor(X,Y) :- parent(X,Z),ancestor(Z,Y).
|