Rudolf Adamkovič Personal site


Negation

Define

A unary logical connective, denoted

\[\begin{equation*}
  \lnot P
\end{equation*}
\]

and read

“not \(P\)”,

that is ‘trueif and only if

\(P\) is ‘false’.

Note. \(\lnot \lnot P \equiv P\).

(Levin, 2021, sec. 0.2; Poole & Mackworth, 2017, sec. 5.1)

Name

Explore

Construct the truth table for the statement \(\lnot P\).

(define (boolean-product length)
  "Return a list of all Boolean sequences of LENGTH."
  (let more-rows ((row (- (expt 2 length) 1)))
    (if (< row 0) (list)
        (cons (let more-columns ((column (- length 1)))
                (if (< column 0) (list)
                    (cons (even? (quotient row (expt 2 column)))
                          (more-columns (- column 1)))))
              (more-rows (- row 1))))))
(define (truth-table procedure arity)
  "Return a truth table for PROCEDURE with ARITY."
  (map (lambda (inputs)
         (append inputs (list (apply procedure inputs))))
       (boolean-product arity)))
(define (org-truth-table procedure headers)
  (append (list (map (lambda (header)
                       (string-append "\\(" header "\\)"))
                     headers))
          (list (list))
          (list (append (list "/")
                        (make-list (- (length headers) 2) "")
                        (list "<")))
          (map (lambda (row)
                 (map (lambda (value)
                        (if value
                            "true"
                            "false"))
                      row))
               (truth-table procedure
                            (- (length headers)
                               1)))))
(org-truth-table not '("P" "\\lnot P"))
"Result (exception): {Exception #19 user \"undefined variable\" (truth-table) #<procedure org-truth-table 2> (#f . 18) #f}\nStack trace:\n  called from <anonymous> on line 800 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from <anonymous> on line 55 of file /Users/salutis/.emacs.d/elpa/geiser-chibi-20240521.2252/src/geiser/geiser.scm\n  called from <anonymous> on line 1187 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from <anonymous> on line 800 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from org-truth-table on line 18 bad source file: (#f . 18)\n  called from <anonymous> on line 800 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from call-with-current-continuation on line 827 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from <anonymous> on line 800 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from <anonymous> on line 279 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from <anonymous> on line 41 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/scheme/misc-macros.scm\n  called from <anonymous> on line 800 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from call-with-current-continuation on line 827 of file /opt/homebrew/Cellar/chibi-scheme/0.11/share/chibi/init-7.scm\n  called from geiser:eval on line 43 of file /Users/salutis/.emacs.d/elpa/geiser-chibi-20240521.2252/src/geiser/geiser.scm\n"


© 2024 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.