Advertisement
logicmoo

Untitled

Jul 20th, 2015
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % this rule ...
  4.  
  5. :- kif_tell((   wearing(A,B)  => has(A,B)  )).
  6.  
  7. % has TO qualify argument types before canicalization
  8.  
  9. :-  kif_tell((argInst(has,1,A) & argInst(has,2,B) => (wearing(A,B) => has(A,B)))).
  10.  
  11. % Which produced this CODE:
  12. %
  13. %       has(A, B):-wearing(A, B), argInst(has, 1, A), argInst(has, 2, B).
  14. %
  15. %       not_wearing(A, B):- not_has(A, B), argInst(has, 1, A), argInst(has, 2, B).  % why are the last two litterals so important?
  16. %
  17. %       not_argInst(has, 1, A):- not_has(A, B), wearing(A, B), argInst(has, 2, B).   % notice we can disprove types
  18. %
  19. %       not_argInst(has, 2, A):- not_has(B, A), wearing(B, A), argInst(has, 1, B).
  20. %
  21.  
  22. :-kif_tell(has(A,B) => (argInst(has, 1, A) & argInst(has, 2, B))).
  23.  
  24. %         not_has(A, _):- not_argInst(has, 1, A).
  25. %
  26. %         argInst(has, 1, A):-has(A, _).
  27. %
  28. %         not_has(_, B)):- not_argInst(has, 2, B).
  29. %
  30. %         argInst(has, 2, A):-has(_, A).
  31.  
  32.  
  33.  
  34. :-kif_tell(has(A,B) =>  (kb_argInst(KB, has, 1, A) & kb_argInst(KB, has, 2, B))).
  35.  
  36. % BAD!
  37. %         (( not_has(A, _)):- not_kb_argInst( _BAD, has, 1, A)).
  38. %
  39. %          (kb_argInst( _BAD, has, 1, A):-has(A, _)).
  40. %
  41. %           (( not_has(_, A)):- not_kb_argInst( _BAD ,  has, 2, A)).
  42. %
  43. %            (kb_argInst( _BAD, has, 2, A):-has(_, A)).
  44.  
  45.  
  46. % GOOD! (the software does this FOR us but wanted TO show the singlton in the consequent on the conjuction)
  47.  
  48. :-kif_tell(   argInst(kb_argInst, 1 , KB) =>  (        has(A,B) =>  (kb_argInst(KB, has, 1, A) & kb_argInst(KB, has, 2, B)))).
  49.  
  50. %     (( not_argInst(kb_argInst, 1, KB)):-has(A, _),  not_kb_argInst(KB, has, 1, A)).
  51. %
  52. %     (( not_has(A, _)):-argInst(kb_argInst, 1, KB),  not_kb_argInst(KB, has, 1, A)).
  53. %
  54. %     (kb_argInst(KB, has, 1, A):- argInst(kb_argInst, 1, KB), has(A, _)).
  55. %
  56. %    (( not_argInst(kb_argInst, 1, KB)):-has(_, B),  not_kb_argInst(KB, has, 2, B)).
  57. %
  58. %     (( not_has(_, B)):-argInst(kb_argInst, 1, KB),  not_kb_argInst(KB, has, 2, B)).
  59. %
  60. %    (kb_argInst(KB, has, 2, B):-argInst(kb_argInst, 1, KB), has(_, B)).
  61.  
  62. % EVEN BETTER?
  63. :-kif_tell(   argInst(kb_argInst, 1 , KB) & argInst(has, 1 , A) & argInst(has, 2 , B) =>  (  has(A,B) =>  (kb_argInst(KB, has, 1, A) & kb_argInst(KB, has, 2, B)))).
  64.  
  65.  
  66. %   pfc_add= (not_has(A, B)):- not_kb_argInst(C, has, 1, A), argInst(has, 2, B), argInst(kb_argInst, 1, C), argInst(has, 1, A)).
  67. %
  68. %   pfc_add= (kb_argInst(C, has, 1, A):-has(A, B), argInst(has, 2, B), argInst(kb_argInst, 1, C), argInst(has, 1, A)).
  69. %
  70. %   pfc_add= (not_argInst(has, 2, A)):-has(B, A), not_kb_argInst(C, has, 1, B), argInst(kb_argInst, 1, C), argInst(has, 1, B)).
  71. %
  72. %   pfc_add= (not_argInst(kb_argInst, 1, A)):-has(B, C), not_kb_argInst(A, has, 1, B), argInst(has, 2, C), argInst(has, 1, B)).
  73. %
  74. %   pfc_add= (not_argInst(has, 1, A)):-has(A, B), not_kb_argInst(C, has, 1, A), argInst(has, 2, B), argInst(kb_argInst, 1, C)).
  75. %
  76. %   (not_has(C, A)):- not_kb_argInst(B, has, 2, A), argInst(has, 2, A), argInst(kb_argInst, 1, B), argInst(has, 1, C)).
  77. %
  78. %   (kb_argInst(B, has, 2, A):-has(C, A), argInst(has, 2, A), argInst(kb_argInst, 1, B), argInst(has, 1, C)).
  79. %
  80. %   (not_argInst(has, 2, A)):-has(C, A), not_kb_argInst(B, has, 2, A), argInst(kb_argInst, 1, B), argInst(has, 1, C)).
  81. %
  82. %   (not_argInst(kb_argInst, 1, A)):-has(C, B), not_kb_argInst(A, has, 2, B), argInst(has, 2, B), argInst(has, 1, C)).
  83. %
  84. %   (not_argInst(has, 1, A)):-has(A, B), not_kb_argInst(C, has, 2, B), argInst(has, 2, B), argInst(kb_argInst, 1, C)).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement