Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. is_zero(zero_int).
  2. is_pos(pos_int).
  3. is_neg(neg_int).
  4. is_int(zero_int). is_int(pos_int). is_int(neg_int).
  5.  
  6. gt(X,Y,Z) :- is_neg(X), + is_neg(Y), is_false(Z).
  7. gt(X,Y,Z) :- + is_neg(X), is_neg(Y), is_true(Z).
  8. gt(X,Y,Z) :- is_zero(X), is_zero(Y), is_false(Z).
  9. gt(X,Y,Z) :- is_pos(X), is_pos(Y), is_bool(Z).
  10. gt(X,Y,Z) :- is_neg(X), is_neg(Y), is_bool(Z).
  11. ...
  12.  
  13. is_int((_,zero_int)). is_int((_,pos_int)). is_int((_,neg_int)).
  14. is_pos((_,pos_int)).
  15. is_zero((_,zero_int)).
  16. is_neg((_,neg_int)).
  17.  
  18. gt((L1,_),(L1,_),(L3,Z)) :- is_false((L3,Z)).
  19. gt(X,Y,Z) :- is_pos(X), + is_pos(Y), is_true(Z).
  20.  
  21. ?- gt(X,Y,Z).
  22. X = (_17376, _17378),
  23. Y = (_17376, _17384),
  24. Z = (_17388, bot) ; # bot is just my false wrapped in the same way
  25. false.
  26. %% I would expect it to find some satisfying binding.
  27.  
  28. ?- gt(X,(L2,zero_int),Z).
  29. X = (L2, _17802),
  30. Z = (_17806, bot) ;
  31. X = (_17800, pos_int),
  32. Z = (_17806, top). # top is just my true wrapped in the same way
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement