Guest User

Untitled

a guest
Oct 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. left(a,b).
  2. left(c,i).
  3. left(i,j).
  4. right(k,j).
  5.  
  6. line1:a,b line2: c,i,j,k.
  7.  
  8. nextto(X,Y):- left(X,Y);left(Y,X);right(X,Y);right(Y,X).
  9. sameline(X,Y):- nextto(X,Y).
  10. sameline(X,Y):- nextto(X,Z),sameline(Z,Y).
  11.  
  12. ?- sameline(a,c)
  13.  
  14. ancestor(X,Y) :- parent(X,Y).
  15. ancestor(X,Y) :- parent(X,Z),ancestor(Z,Y).
Add Comment
Please, Sign In to add comment