From 4b317645586c2cde90a92cd44256d55342e55baa Mon Sep 17 00:00:00 2001 From: Sven Vogel Date: Thu, 29 Jun 2023 12:52:29 +0000 Subject: [PATCH] Add Parents.pro --- Parents.pro | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Parents.pro diff --git a/Parents.pro b/Parents.pro new file mode 100644 index 0000000..dada0d2 --- /dev/null +++ b/Parents.pro @@ -0,0 +1,54 @@ +% create parent relation ship +parent(adam, kain). +parent(eva, kain). +parent(adam, abel). +parent(eva, abel). +parent(adam, seth). +parent(eva, seth). +parent(sara, peter). +parent(abel, peter). +parent(sara, gunter). +parent(abel, gunter). +parent(seth, garfield). +parent(hela, garfield). + +parent(bor, odin). +parent(odin, thor). +parent(odin, loki). + +% create sex relation ship +male(adam). +male(peter). +male(gunter). +male(kain). +male(abel). +female(eva). +female(hela). +female(sara). + +male(odin). +male(thor). +male(loki). +female(loki). + +father(F,C):-parent(F,C),male(F). +mother(M,C):-parent(M,C),female(M). + +grandparent(G, C):-parent(P,C),parent(G,P). +grandfather(G, C):-parent(P,C),parent(G,P),male(G). +grandmother(G, C):-parent(P,C),parent(G,P),female(G). + +related(A,A). +related(A,B):-parent(A,B). +related(A,B):-parent(P,A),related(P,B). + +% if A and B are siblings +siblings(A,B):-parent(P,A),parent(P,B). +% true if S is the a sister of A +sister(A,S):-siblings(A,S),female(S). +% true if B is the a brother of A +brother(A,B):-siblings(A,B),male(B). + +aunt(A,B):-parent(P,B),sister(A,P). +uncle(A,B):-parent(P,B),brother(A,P). +