fork download
  1. domains
  2. s=symbol
  3. predicates
  4. man(s)
  5. woman(s)
  6. parent(s,s)
  7. mother(s,s)
  8. sister(s,s)
  9. hasSister(s)
  10. clauses
  11. man(john)
  12. man(bob)
  13. woman(ann)
  14.  
  15. % фактов родителя столько, сколько вершин в дереве.
  16. parent(john,bob)
  17.  
  18. mother(X,Y):-woman(X),parent(X,Y).
  19. sister(X,Y):-woman(X),parent(Z,Y),parent(Z,Y),not(X=Y).
  20. sister2(X,Y):-woman(X,parent(Z1,X),parent(Z1,Y),not(X=Y),paretn(Z2,X),parent(Z2,X),not(Z1=Z2).
  21. hasSister(X):-sister(X,_). % анонимная переменная — просто проверяем значение.
  22.  
  23. parent(ann,bob)
  24.  
  25. Goal: hasSister(bob)
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.pl:2:2: syntax error: . or operator expected after expression
prog.pl:18:1: syntax error: . or operator expected after expression
prog.pl:20:94: syntax error: , or ) expected
prog.pl:25:1: syntax error: . or operator expected after expression
	4 error(s)
compilation failed
stdout
Standard output is empty