fork download
  1. :- discontiguous male/1, female/1, parent/2.
  2. male(dicky).
  3. male(randy).
  4. male(mike).
  5. male(don).
  6. male(elmer).
  7. female(anne).
  8. female(rosie).
  9. female(esther).
  10. female(mildred).
  11. female(greatgramma).
  12. male(blair).
  13. male(god).
  14. female(god).
  15.  
  16. parent(don,randy).
  17. parent(don,mike).
  18. parent(don,anne).
  19. parent(rosie,randy).
  20. parent(rosie,mike).
  21. parent(rosie,anne).
  22. parent(elmer,don).
  23. parent(mildred,don).
  24. parent(esther,rosie).
  25. parent(esther,dicky).
  26. parent(greatgramma,esther).
  27. parent(randy,blair).
  28.  
  29. male(mel).
  30. male(teo).
  31. parent(melsr,mel).
  32. parent(melsr,teo).
  33.  
  34. american(anne).
  35. american(X) :- ancestor(X,anne).
  36. american(X) :- ancestor(anne,X).
  37. relation(X,Y) :- ancestor(A,X), ancestor(A,Y).
  38.  
  39. father(X,Y) :- male(X),parent(X,Y).
  40. father(god, _) :- male(god).
  41. mother(X,Y) :- female(X),parent(X,Y).
  42. son(X,Y) :- male(X),parent(Y,X).
  43. daughter(X,Y) :- female(X),parent(Y,X).
  44. grandfather(X,Y) :- male(X),parent(X,Somebody),parent(Somebody,Y).
  45. aunt(X,Y) :- female(X),sister(X,Mom),mother(Mom,Y).
  46. aunt(X,Y) :- female(X),sister(X,Dad),father(Dad,Y).
  47. sister(X,Y) :- female(X),parent(Par,X),parent(Par,Y), X \= Y.
  48. uncle(X,Y) :- brother(X,Par),parent(Par,Y).
  49. cousin(X,Y) :- uncle(Unc , X),father(Unc,Y).
  50. ancestor(X,Y) :- parent(X,Y).
  51. ancestor(X,Y) :- parent(X,Somebody),ancestor(Somebody,Y).
  52. brother(X,Y) :- male(X),parent(Somebody,X),parent(Somebody,Y), X \= Y.
Success #stdin #stdout 0.01s 9988KB
stdin
Standard input is empty
stdout
GNU Prolog 1.4.5 (64 bits)
Compiled Feb  5 2017, 10:30:08 with gcc
By Daniel Diaz
Copyright (C) 1999-2016 Daniel Diaz
| ?-