Advertisement
logicmoo

Untitled

Feb 19th, 2018
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.63 KB | None | 0 0
  1. ; -> is prolog's neck (we could reverse this to make N3 or any other form of logic
  2.  
  3. is_proved(Term, (Term : How)) <- is_given(Term,How).
  4. is_proved(Term, (Term : How)) <- pv(Term,How).
  5.  
  6. pv(B,P1 ^ P2) <- is_proved(A,P1), is_proved(A=>B,P2).
  7. pv(A,P1) <- is_proved(A & B,P1).
  8. pv(B,P1) <- is_proved(A & B,P1).
  9. pv(A & B,P1 ^ P2) <- is_proved(A,P1), is_proved(B,P2).
  10. pv(C,P1 ^ P2 ^ P3) <- is_proved(A v B,P1), is_proved(A=>C,P2), is_proved(B=>C,P3).
  11. pv(A v B,P1) <- is_proved(A,P1).
  12. pv(A v B,P1) <- is_proved(B,P1).
  13.  
  14. ; Database
  15. is_given(a,1).
  16. is_given(c,2).
  17. is_given(a=>b,3).
  18.  
  19. ; Query
  20.  
  21. ?- is_proved(b,R).
  22. R = b:(3:a=>b ^ a:1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement