fork download
  1. :- initialization(main).
  2. main :-
  3. grandmother(X,sazae),
  4. write(X), nl, fail,
  5. halt.
  6.  
  7. parent(namihei,sazae).
  8. parent(namihei,katuo).
  9. parent(namihei,wakame).
  10. parent(fune,sazae).
  11. parent(fune,katuo).
  12. parent(masuo,tara).
  13. parent(sazae,tara).
  14. parent(umi,namihei).
  15.  
  16. male(namihei).
  17. male(katuo).
  18. male(masuo).
  19. male(tara).
  20. female(fune).
  21. female(wakame).
  22. female(sazae).
  23. female(umi).
  24.  
  25. child(X, Y) :- parent(Y, X).
  26.  
  27. mother(X,Y):-parent(X,Y), female(X).
  28. sister(X,Y):-
  29. parent(Z,X),
  30. parent(Z,Y),
  31. female(X), X\=Y.
  32.  
  33. father(X,Y):-parent(X,Y), male(X).
  34. brother(X,Y):-
  35. parent(Z,X),
  36. parent(Z,Y),
  37. male(X), X\=Y.
  38.  
  39. grandmother(X,Y):-
  40. female(X),
  41. parent(X,Z),
  42. parent(Z,Y).
  43.  
  44.  
Success #stdin #stdout #stderr 0.01s 5280KB
stdin
Standard input is empty
stdout
umi
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
| ?- 
stderr
warning: /home/euu4UV/prog.pl:1: user directive failed