-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1.pl
More file actions
52 lines (41 loc) · 630 Bytes
/
1.pl
File metadata and controls
52 lines (41 loc) · 630 Bytes
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
parent(pam,bob).
parent(tom,bob).
parent(tom,liz).
parent(bob,ann).
parent(bob,pat).
parent(pat,jim).
female(pam).
female(liz).
female(pat).
female(ann).
male(tom).
male(bob).
male(jim).
offspring(Y,X) :-
parent(X,Y).
mother(X,Y) :-
parent(X,Y),
female(X).
grandparent(X,Z):-
parent(X,Y),
parent(Y,Z).
sister(X,Y) :-
parent(Z,X),
parent(Z,Y),
X \= Y,
female(X).
happy(X) :-
parent(X,_).
hastwochildren(X) :-
parent(X,Y),
sister(Y,_).
grandchild(X,Y) :-
grandparent(Y,Z).
aunt(X,Z) :-
parent(Y,Z),
sister(X,Y).
predecessor(X,Z) :-
parent(X,Z).
predecessor(X,Z) :-
parent(X,Y),
pedecessor(Y,Z).