-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBible_Relation.pl
98 lines (76 loc) · 1.41 KB
/
Bible_Relation.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
% Fathers
father(terach, abraham).
father(terach, nachor).
father(terach, haran).
father(abraham, isaac).
father(haran, lot).
father(haran, milcah).
father(haran, yiscah).
% Mothers
mother(sarah, isaac).
% Males
male(terach).
male(abraham).
male(nachor).
male(haran).
male(isaac).
male(lot).
% Females
female(sarah).
female(milcah).
female(yiscah).
% Parent
parent(X, Y) :- father(X, Y).
parent(X, Y) :- mother(X, Y).
% Ancestor
ancestor(X, Y) :- parent(X, Y).
ancestor(X, Y) :- parent(Z, Y), ancestor(X, Z).
% Descendant
descendent(X, Y) :-
ancestor(Y, X).
% Uncle
uncle(X, Y) :-
parent(Z, Y),
brother(X, Z).
% Aunt
aunt(X, Y) :-
parent(Z, Y),
sister(X, Z).
% Brother
brother(X, Y) :-
male(X),
parent(Z, X),
parent(Z, Y).
% Sister
sister(X, Y) :-
female(X),
parent(Z, X),
parent(Z, Y).
% Married
married(X, Y) :-
mother(X, Z), father(Y, Z);
father(X, Z), mother(Y, Z).
% Cousin
cousin(X, Y) :-
parent(Z, X), parent(W, Y), brother(W, Z);
parent(Z, X), parent(W, Y), sister(W, Z).
% Brother In Law
brother_in_law(X, Y) :-
male(X),
brother(X, Z),
married(Z, Y).
% Sister In Law
sister_in_law(X,Y) :-
female(X),
sister(X, Z),
married(Z, Y).
% Mother In Law
mother_in_law(X,Y) :-
female(X),
mother(X, Z),
married(Z, Y).
% Father In Law
father_in_law(X, Y) :-
male(X),
father(X, Z),
married(Z, Y).