Advertisement
logicmoo

KB-modeling

Jul 30th, 2017
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. my-minus-one(N,M) <->  (N > 1)  &  (M = N-1)
  4.  
  5. % Lits in KBs are considered true
  6. consistent(kb) <-> min-lits(1, kb)
  7.  
  8. exactly-N-lits(1,kb) <->
  9. (exists kb logsent.  
  10.     (   true-in(logsent,kb)
  11.       & ~(exists other-logsent.
  12.            (  true-in(other-logsent,kb)
  13.              & ~equiv(kb,other-logsent,logsent)))))
  14.  
  15. exactly-N-lits(2,kb) <->
  16. (exists kb logsent1 logsent2.
  17.   (  true-in(logsent1,kb)
  18.    & true-in(logsent2,kb)
  19.    & ~equiv(kb,logsent1,logsent2)  
  20.    & ~ (exists other-logsent.
  21.          (  true-in(other-logsent,kb)
  22.           & ~equiv(kb,other-logsent,logsent1)
  23.           & ~equiv(kb,other-logsent,logsent2)))))
  24.  
  25. exactly-N-lits(N,kb) <->
  26.    range-lits(N,N,kb)  
  27.  
  28.  
  29. range-lits(N,M,kb) <->
  30.  (exists kb.
  31.   ( min-lits(N,kb)
  32.     & max-lits(M,kb)))
  33.  
  34. min-lits(1,kb) <->
  35.  (exists kb logsent1.
  36.      (true-in(logsent1,kb)))
  37.  
  38. min-lits(2,kb) <->
  39.  (exists kb logsent1 logsent2.
  40.    (  true-in(logsent1,kb)
  41.     & true-in(logsent2,kb)
  42.     & ~equiv(kb,logsent1,logsent2)))
  43.  
  44. max-lits(2,kb) <->  
  45. (exists kb logsent1 logsent2.
  46.    (  true-in(logsent1,kb)
  47.     & true-in(logsent2,kb)
  48.     &  ~(exists other-logsent.
  49.           (  true-in(other-logsent,kb)
  50.             & ~equiv(kb,other-logsent,logsent1)
  51.             & ~equiv(kb,other-logsent,logsent2)))))
  52.  
  53. % exists a kb with no lits?
  54. exactly-N-lits(0,kb) <->
  55.   (exists kb
  56.      ~(exists logsent1. true-in(logsent1,kb)))
  57.  
  58. max-lits(1,kb) <->
  59.  exactly-N-lits(0,kb) v exactly-N-lits(1,kb)
  60.  
  61. difference_at_least_1_truths(kb1,kb2) <->
  62.   (exists logsent. (true-in(logsent,kb1) -> ~true-in(logsent,kb2)))
  63.  
  64. disjoint_truths(kb1,kb2) <->
  65.   ~(exists logsent. (true-in(logsent,kb1) & true-in(logsent,kb2)))
  66.  
  67. subset_truths(kb1,kb2) <->
  68.     (forall logsent.
  69.       true-in(logsent,kb1) -> true-in(logsent,kb2) )
  70.  
  71. union_s_v2(kb1,kb2,kb) <->
  72.  (forall logsent.
  73.    (true-in(logsent,kb) <->
  74.        (true-in(logsent,kb1) v true-in(logsent,kb2))))
  75.  
  76. union_truths(kb1,kb2,kb) <->
  77.   (exists scratchpad.
  78.       union_truths(kb1,kb2,scratchpad)
  79.      & ~difference_at_least_1_truths(kb,scratchpad))
  80.  
  81.  
  82. union-disjoint_truths(kb1,kb2,kb) <->
  83.    (   union_truths(kb1,kb2,kb)
  84.      & disjoint_truths(kb1,kb2))
  85.  
  86.  
  87. min-lits(4,kb) <->
  88.   (exists kb1 kb2.
  89.      min-lits(2,kb1)
  90.    & min-lits(2,kb2)
  91.    & union-disjoint_truths(kb1,kb2))
  92.  
  93. min-lits(N,kb) <->
  94.   (exists kb1 kb2.
  95.      min-lits(1,kb1)
  96.    & min-lits(M,kb2)
  97.    & consistent(kb2)
  98.    & union-disjoint_truths(kb1,kb2)
  99.    & my-minus-one(N,M))
  100.  
  101.  
  102. max-lits(N,kb) <->
  103.   (exists kb1 kb2.
  104.      max-lits(1,kb1)
  105.    & max-lits(M,kb2)
  106.    & consistent(kb2)
  107.    & union-disjoint_truths(kb1,kb2)
  108.    & my-minus-one(N,M))
  109.  
  110.  
  111. equal_v1_truths(kb1,kb2) <->
  112.    ( ~difference_at_least_1_truths(kb1,kb2)
  113.      & ~difference_at_least_1_truths(kb2,kb1)
  114.      & consistent(kb1)
  115.      & consistent(kb2))
  116.  
  117. equal_v2_truths(kb1,kb2) <->
  118.  ( consistent(kb1)
  119.    & (forall logsent.
  120.       (true-in(logsent,kb1) <-> true-in(logsent,kb2))))
  121.  
  122.  
  123. % v1: lameness
  124. equiv_v1(kb,logsent1,logsent2) <->
  125.   true-in(logsent1,kb) <->   true-in(logsent2,kb)
  126.  
  127. % v2  logsent2 and logsent2 logically "imply" each other in the kb.
  128. equiv_v2(kb,logsent1,logsent2) <->
  129.   true-in((logsent1 <-> logsent2),kb)
  130.  
  131. % v3 the actual semantics implemented based that both logical sentences use the same proof
  132. equiv(kb,logsent1,logsent2) <->
  133.   equiv_v4(kb,logsent1,logsent2) v equiv_v2(kb,logsent1,logsent2)
  134.  
  135. % v4 sameness (current implementation in LogicMOO )
  136. equiv_v4(kb,x,x) <->
  137.  (forall x. (exists kb.
  138.   true-in(x,kb)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement