Advertisement
logicmoo

LBASE/IKL/MELD/Common Logic Fun

Oct 5th, 2017
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 5.17 KB | None | 0 0
  1. ;; (setf (readtable-case *readtable*) :preserve )
  2. ;; (logicmoo::require '((if 2) (iff 2) (not 1) (and) (or) (ist)(mtHybrid)(subContextOf) (forall 2) (exists 2) (exactly 3)(atleast 3)(atmost 3)))
  3.  
  4. ;; (let ((*print-pretty* t)) (format t "~%~S " '(
  5.  
  6.  
  7. (ModalHelperFunction AssertedFor)
  8. (ModalHelperFunction PossibleFor)
  9. (ModalHelperFunction FalsifiedFor)
  10. (ModalHelperFunction FallaciousFor)
  11. (ModalHelperFunction UnknownFor)
  12. (ModalHelperFunction AskableFrom)
  13. (ModalHelperFunction AnswerableFrom)
  14.  
  15. (forall ((ModalHelperFunction mhf))
  16.   (UniqueObjectDesignatingFunction mhf ModalContext HelperContext))
  17.  
  18. (forall (odf domain range)
  19.  (if
  20.   (UniqueObjectDesignatingFunction odf domain range)
  21.   (forall ((domain term))
  22.    (exists ((range denotes))
  23.     (and
  24.      (= denotes (odf term))
  25.  
  26.     ;; forces all odf results to be unique
  27.      (forall (other-term)
  28.        (if (= (odf other-term) denotes)
  29.       (= term other-term))))
  30.  
  31.     ;; forces all odfs to have at max one result
  32.      (forall (other-denotes)
  33.        (if (= other-denotes (odf term))
  34.        (= other-denotes denotes)))))))
  35.  
  36.  
  37. ;; a testing mt
  38. (ModalContext TestMt)
  39.  
  40. ;; Funny little set of ist/2 assertions
  41. (forall (MT S)
  42.   (if
  43.    (ModalContext MT)
  44.    (and
  45.  
  46.  ;; at least 1/2 are redundant logically
  47.  ;; But sometimes it is nice to see them
  48.  
  49.     (if (ist (AssertedFor MT) S)
  50.         (ist (ProvenFor MT) S))
  51.  
  52.     (if (ist (ProvenFor MT) S)
  53.      (and
  54.       (not (ist (FalsifiedFor MT) S))
  55.            (ist (PossibleFor MT) S)
  56.       (not (ist (UnknownFor MT) S))))
  57.  
  58.     (if (not (ist (AssertedFor MT) S))
  59.      (or (ist (PossibleFor MT) S)
  60.          (ist (FalsifiedFor MT) S)
  61.          (ist (FallaciousFor MT) S)))
  62.  
  63.  
  64.     (if (not (ist (FallaciousFor MT) S))
  65.      (or (ist (UnknownFor MT) S)
  66.          (ist (FalsifiedFor MT) S)
  67.          (ist (ProvenFor MT) S)))
  68.  
  69.     (if (and
  70.         (not (ist (UnknownFor MT) S))
  71.     (not (ist (FallaciousFor MT) S)))
  72.      (or (ist (ProvenFor MT) S)
  73.          (ist (FalsifiedFor MT) S)))
  74.  
  75.     (if (not (ist (FalsifiedFor MT) S))
  76.      (or (ist (FallaciousFor MT) S)
  77.          (ist (UnknownFor MT) S)
  78.          (ist (ProvenFor MT) S)))
  79.  
  80.     (iff (ist (AnswerableFrom MT) S)
  81.       (and   (ist (AskableFrom MT) S)
  82.            (not (ist (UnknownFor MT) S))))
  83.  
  84.     (if (ist (AnswerableFrom MT) S)
  85.      (or (ist (ProvenFor MT) S)
  86.          (ist (FalsifiedFor MT) S)))
  87.  
  88.     (iff  (ist (AskableFrom MT) S)
  89.      (not (ist (FallaciousFor MT) S)))
  90.  
  91.  
  92.     (if (ist (AskableFrom MT) S)
  93.      (or (ist (ProvenFor MT) S)
  94.          (ist (UnknownFor MT) S)
  95.          (ist (FalsifiedFor MT) S)))
  96.  
  97.     (not
  98.      (and (ist (AskableFrom MT) S)
  99.          (ist (FallaciousFor MT) S)))
  100.  
  101.     (if
  102.      (ist (FallaciousFor MT) S)
  103.      (not
  104.       (or (ist (FalsifiedFor MT) S)
  105.           (ist (ProvenFor MT) S)
  106.           (ist (UnknownFor MT) S)
  107.           (ist (PossibleFor MT) S))))      
  108.  
  109.     (if
  110.      (and (ist (ProvenFor MT) S)
  111.          (ist (FalsifiedFor MT) S))
  112.      (ist (FallaciousFor MT) S))
  113.  
  114.  
  115.     (if
  116.       (ist (ProvenFor MT) S)
  117.       (not
  118.        (or (ist (FalsifiedFor MT) S)
  119.            (ist (FallaciousFor MT) S))))
  120.  
  121.     (if (ist (ProvenFor MT) S)
  122.      (and (not (ist (UnknownFor MT) S))
  123.           (not (ist (FalsifiedFor MT) S))
  124.           (not (ist (FallaciousFor MT) S))))
  125.  
  126.     (if (ist (ProvenFor MT) S)
  127.         (ist (PossibleFor MT) S))
  128.  
  129.     (if (ist (PossibleFor MT) S)
  130.      (and (not (ist (FalsifiedFor MT) S))
  131.           (not (ist (FallaciousFor MT) S))))
  132.  
  133.     (if (not (ist (ProvenFor MT) S))
  134.      (or (ist (FalsifiedFor MT) S)
  135.          (ist (FallaciousFor MT) S)
  136.          (ist (PossibleFor MT) S)))
  137.  
  138.     (iff (ist (FalsifiedFor MT) S)
  139.      (and
  140.       (not (ist (ProvenFor MT) S))
  141.       (not (ist (PossibleFor MT) S))
  142.       (not (ist (UnknownFor MT) S))))
  143.  
  144.     (if (not (ist (PossibleFor MT) S))
  145.      (or (ist (FalsifiedFor MT) S)
  146.          (ist (FallaciousFor MT) S)))
  147.  
  148.     (if (ist (PossibleFor MT) S)
  149.      (and (not (ist (FalsifiedFor MT) S))
  150.           (not (ist (FallaciousFor MT) S))))
  151.  
  152.     (if (ist (UnknownFor MT) S)
  153.      (and
  154.       (not (ist (ProvenFor MT) S))
  155.            (ist (PossibleFor MT) S)
  156.       (not (ist (AssertedFor MT) S))
  157.       (not (ist (FalsifiedFor MT) S))))
  158.  
  159.  ;; subcontext inheritance
  160.  (forall (SUBCTX)
  161.     (if
  162.      (subContextOf SUBCTX MT)
  163.      (and
  164.  
  165.         (if (ist (ProvenFor MT) S)
  166.         (ist (ProvenFor SUBCTX) S))
  167.  
  168.         (if (ist (AskableFrom MT) S)
  169.         (ist (AskableFrom SUBCTX) S))
  170.  
  171.         (if (ist (FalsifiedFor MT) S)
  172.         (ist (FalsifiedFor SUBCTX) S)))))
  173.  
  174. )))
  175.  
  176.  
  177. ;; Unrelated but other fun stuff
  178.  
  179. ;; sentence instance ?
  180. (forall (mgu lgu)
  181.  (exists (tmp-ctx)
  182.   (if
  183.     (if
  184.      (ist tmp-ctx mgu)
  185.      (ist tmp-ctx lgu))))
  186.   (prop-instance-of-prop lgu mgu))
  187.  
  188.  
  189.  
  190. ;; some sentence unifier ?
  191. (forall (sent1 sent2)
  192.  (exists (tmp-ctx)
  193.   (if
  194.    (and
  195.     (subContextOf tmp-ctx LogicalEquivAxiomsMt)
  196.     (iff
  197.      (ist tmp-ctx sent1)
  198.      (ist tmp-ctx sent2)))
  199.   (sents-unify sent1 sent2))))
  200.  
  201. ;; some sentence unifier ?
  202. (forall (sent1 sent2)
  203.  (exists (tmp-ctx)
  204.   (if
  205.    (and
  206.     (subContextOf tmp-ctx LogicalEquivAxiomsMt)
  207.     (ist tmp-ctx (iff sent1 sent2)))
  208.   (sents-unify sent1 sent2))))
  209.  
  210. ;; )))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement