-
Notifications
You must be signed in to change notification settings - Fork 0
/
FILE3.PRO
33 lines (28 loc) · 1.98 KB
/
FILE3.PRO
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
/*person("Bill", "male").
person("John", "male").
person("Pam", "female").
person(Name, Gender)*/
/*
father("Bill","John").
father("Pam"."Bill").
father(person("Bill","male"),person("John","male")).
father(person("Pam","female"),person("Bill","male")).*/
parent(person("Bill","male"),person("John","male")).
parent(person("Pam","female"),person("Bill","male")).
parent(person("Pam","female"),person("Jane","female")).
parent(person("Jane","female"),person("Joe","male")).
/*grandFather(Person,GrandFather):-
father(Father,GrandFather),
father(Person,Father).*/
grandFather(Person,TheGrandFather):-
parent(Person,ParentOfPerson),
father(ParentOfPerson,TheGrandFather).
/*1st version
father(P,F):-
parent(P,F),
F=person(_,"male"). %Line2*/
/*2nd version*/
father(P,person(Name,"male")):-
parent(P,person(Name,"male")).
ancestor(Person, Ancestor) :- parent(Person, Ancestor).
ancestor(Person, Ancestor) :- parent(Person, P1), ancestor(P1, Ancestor).