(defun if-then-truth-table () (list (if nil nil) (if nil t) (if t nil) (if t t))) (defun if-then-else-truth-table () (list (if nil nil) (if nil t) (if t nil) (if t t))) (defun if-then-else-truth-table () (list (if nil nil nil) (if nil nil t) (if nil t nil) (if nil t t) (if t nil nil) (if t nil t) (if t t nil) (if t t t))) (defun if-then-else-equiv-truth-table () (list (if-then-else nil nil nil) (if-then-else nil nil t) (if-then-else nil t nil) (if-then-else nil t t) (if-then-else t nil nil) (if-then-else t nil t) (if-then-else t t nil) (if-then-else t t t))) (defun and-truth-table () (list (and nil nil) (and nil t) (and t nil) (and t t))) (defun or-truth-table () (list (or nil nil) (or nil t) (or t nil) (or t t))) (defun if-then-else-t-truth-table () (list (if nil nil t) (if nil t t) (if t nil t) (if t t t))) (defun implies-truth-table () (list (implies nil nil) (implies nil t) (implies t nil) (implies t t))) (defun iff-truth-table () (list (iff nil nil) (iff nil t) (iff t nil) (iff t t))) (defun implies (p q) (if p q t)) (defun iff (p q) (and (implies p q) (implies q p))) (defun if-then-else (p q r) (or (and p q) (and (not p) r))) (defun test-truth-tables () (interactive) ; if-then should be === and (if (equal (if-then-truth-table) (and-truth-table)) (princ "if-then === and") (princ "if-then NOT === and") ) (terpri) ; if-then-else should be === if-then-else-equiv (if (equal (if-then-else-truth-table) (if-then-else-equiv-truth-table)) (princ "if-then-else === if-then-else-equiv") (princ "if-then-else NOT === if-then-else-equiv") ) (terpri) ; if-then-else-t should be === implies (if (equal (if-then-else-t-truth-table) (implies-truth-table)) (princ "if-then-else-t === implies") (princ "if-then-else-t NOT === implies") ) )