A statement that is always ‘`true`’.

Compute whether a given molecular statement is a tautology.

- ‘
`scheme/tautology?`’Search truth tables for the absence of ‘

`FALSE`’ to identify tautologies.Builds on ‘

`scheme/truth-table`’.<<scheme/truth-table>> (define (tautology? procedure arity) (not (member #f (map (lambda (row) (car (reverse row))) (truth-table procedure arity)))))

<<scheme/tautology?>> (unless (tautology? (lambda (p) (or p #t)) 1) (raise #f)) (unless (tautology? (lambda (p q) (or p q #t)) 2) (raise #f)) (unless (tautology? (lambda (p q r) (or p q r #t)) 3) (raise #f)) (when (tautology? (lambda (p) (or p)) 1) (raise #f)) (when (tautology? (lambda (p q) (or p q)) 2) (raise #f)) (when (tautology? (lambda (p q r) (or p q r)) 3) (raise #f)) "tests passed"

tests passed

© 2024 Rudolf Adamkovič under GNU General Public License version 3.

Made with Emacs and secret alien technologies of yesteryear.