Resolution for Propositional Calculus[file resolv.lsp]

; rep.: p ->  q is (~p v q) or  ((not p) q) .
; example: (resolve '((not p) q) '(r (not q)))

(defun resolve (ca cb)
  (let (tmp)
    (if (setq tmp (resolver ca cb))
        (unless (resolver cb ca) tmp)
        (resolver cb ca)) ))

; resolve neg. of ca with pos of cb:

(defun resolver (ca cb)
  (let (pairs)
    (dolist (lit ca)
      (if (and (consp lit)
               (eq (car lit) 'not)
               (member (cadr lit) cb))
          (push lit pairs)) )
    (if (and pairs (null (cdr pairs)))
        (or (union (remove (car pairs) ca)
                   (remove (cadar pairs) cb)
                   :test #'equal)
            'box)) ))

Contents    Page-10    Prev    Next    Page+10    Index