Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. predicates
  2.  
  3. father(symbol,symbol)
  4. mother(symbol,symbol)
  5. male(symbol)
  6. female(symbol)
  7. sister(symbol,symbol)
  8. brother(symbol,symbol)
  9. uncle(symbol,symbol)
  10. wife(symbol,symbol)
  11. aunty(symbol,symbol)
  12. bhabhi(symbol,symbol)
  13. cousin(symbol,symbol)
  14. nephew(symbol,symbol)
  15. grand_son(symbol,symbol)
  16. grand_duaghter(symbol,symbol)
  17.  
  18. clauses
  19.  
  20. sister(X,Y) :- father(X,A),father(Y,A),female(Y).
  21.  
  22. father(dhanjiBhai,vithhaldas).
  23. father(chuniBhai,vithhaldas).
  24. father(harshad,dhanjibhai).
  25. father(darshan,dhanjibhai).
  26. father(nilam,dhanjibhai).
  27. father(kiran,dhanjibhai).
  28. father(kamleshbhai,chunibhai).
  29.  
  30. mother(harshad,prabhaben).
  31. mother(X,Y) :- father(X,Z),wife(Y,Z).
  32.  
  33. brother(X,Y) :- father(X,A),father(Y,A),male(X).
  34.  
  35. % brother(X,Y) :- brother(Y,X).
  36.  
  37. male(harshad).
  38. male(darshan).
  39. male(dhanjibhai).
  40. male(chunibhai).
  41.  
  42. female(nilam).
  43. female(kiran).
  44. female(prabhaben).
  45. female(nimishaben).
  46. female(kokilaben).
  47.  
  48. wife(prabhaben,dhanjibhai).
  49. wife(nimishaben,kamleshbhai).
  50. Wife(kokilaben,chunibhai).
  51.  
  52.  
  53. grand_son(X,Y) :- father(A,Y),father(X,A),male(X).
  54. grand_duaghter(X,Y) :- father(A,Y),father(X,A),female(Y).
  55.  
  56. uncle(X,Y) :- father(X,Z),brother(Y,Z).
  57.  
  58. aunty(X,Y) :- wife(Y,Z),
  59. brother(Z,W),
  60. father(X,W).
  61.  
  62. bhabhi(X,Y) :- wife(X,Z),cousin(Y,Z),female(X).
  63.  
  64.  
  65. cousin(X,Y) :- father(X,A),father(Y,B),brother(A,B).
  66.  
  67. nephew(X,Y) :- wife(Y,A),brother(A,B),father(X,B),male(X).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement