0% found this document useful (0 votes)
3 views4 pages

Lab 02

The document outlines a family tree using Prolog syntax, defining relationships such as parent, mother, father, grandmother, grandfather, sister, brother, aunty, uncle, cousin, and predecessor. It includes facts about individuals and their gender, as well as rules to determine familial connections. The relationships are established through a series of logical predicates based on the defined parent-child relationships.

Uploaded by

Tonmoy Sarkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Lab 02

The document outlines a family tree using Prolog syntax, defining relationships such as parent, mother, father, grandmother, grandfather, sister, brother, aunty, uncle, cousin, and predecessor. It includes facts about individuals and their gender, as well as rules to determine familial connections. The relationships are established through a series of logical predicates based on the defined parent-child relationships.

Uploaded by

Tonmoy Sarkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1. parent(jhon,mary).

2. parent(john,prince).
3. parent(mary,ana).
4. parent(mary,alex).
5. parent(prince,pat).
6. parent(prince,ally).
7. parent(alex,bob).
8. parent(ana,jim).
9. parent(pat,jim).
10. parent(ally,liz).
11. parent(jim,pam).
12. parent(jim,tom).
13. female(mary).
14. female(ana).
15. female(pat).
16. female(pam).
17. female(liz).
18. male(jhon).
19. male(alex).
20. male(bob).
21. male(ally).
22. male(jim).
23. male(prince).
24. male(tom).
25. male(pat).
26.
27. father(X,Y):-
28. male(X),
29. parent(X,Y).
30.
31. mother(X,Y):-
32. female(X),
33. parent(X,Y).
34.
35. grandmother(X,Z):-
36. female(X),
37. parent(X,Y),
38. parent(Y,Z).
39.
40. grandfather(X,Z):-
41. male(X),
42. parent(X,Y),
43. parent(Y,Z).
44.
45. sister(X,Z):-
46. female(X),
47. parent(Y,X),
48. parent(Y,Z),
49. X\=Z.
50.
51. brother(X,Z):-
52. male(X),
53. parent(Y,X),
54. parent(Y,Z),
55. X\=Z.
56.
57. aunty(X,Z):-
58. sister(X,Y),
59. parent(Y,Z).
60.
61. uncle(X,Z):-
62. brother(X,Y),
63. parent(Y,Z).
64.
65. cousin(X,Z):-
66. aunty(Y,X);
67. uncle(Y,X);
68. parent(Y,Z).
69.
70. predecessor(X,Z):-
71. parent(X,Z).
72.
73. predecessor(X,Z):-
74. parent(X,Y),
75. predecessor(Y,Z).

You might also like