2024-09-03 18:25:54 -07:00
|
|
|
|
# Truth Table
|
|
|
|
|
This is a simple truth table generator. For more information about truth tables,
|
|
|
|
|
please see the [relevant Wikipedia article][1].
|
|
|
|
|
|
|
|
|
|
[1]: https://en.wikipedia.org/wiki/Truth_table
|
|
|
|
|
|
2024-09-04 03:16:05 -07:00
|
|
|
|
To build, just run `make`. You will need SBCL, ASDF, and Quicklisp. Quicklisp is
|
|
|
|
|
used to load `uiop` and `with-user-abort`.
|
2024-09-03 18:25:54 -07:00
|
|
|
|
|
|
|
|
|
The format of the input propositions is fairly free-form. The above Wikipedia
|
|
|
|
|
article has some information about their format, as well as possible symbols for
|
|
|
|
|
operators. You can also take a look at the table near the top of
|
2024-09-04 03:16:05 -07:00
|
|
|
|
`parse.lisp` for all the variations supported by this program.
|
2024-09-03 18:25:54 -07:00
|
|
|
|
|
|
|
|
|
Here is the help output from the program:
|
|
|
|
|
```text
|
|
|
|
|
usage: truth-table [options] <propositions...>
|
|
|
|
|
|
|
|
|
|
-h, --help print this message, then exit
|
|
|
|
|
-f, --format=<arg> specify the output format (*unicode*, ascii, or latex)
|
|
|
|
|
-s, --subexps include sub-expressions in the output table
|
|
|
|
|
-n, --no-vars do not include variables in the output table
|
|
|
|
|
-m, --multi-char allow multi-character variable names
|
|
|
|
|
-i, --no-implicit do not use implicit 'and' operations
|
|
|
|
|
|
|
|
|
|
The choice surrounded by '*' is the default. Arguments to long
|
|
|
|
|
options are also required for their short variant.
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Here is an example truth table:
|
|
|
|
|
```text
|
|
|
|
|
$ truth-table '(a /\ b) -> ~b'
|
|
|
|
|
|
|
|
|
|
┌───┬───┬────────────┐
|
|
|
|
|
│ a │ b │ a ∧ b → ¬b │
|
|
|
|
|
├───┼───┼────────────┤
|
|
|
|
|
│ ⊤ │ ⊤ │ ⊥ │
|
|
|
|
|
│ ⊤ │ ⊥ │ ⊤ │
|
|
|
|
|
│ ⊥ │ ⊤ │ ⊤ │
|
|
|
|
|
│ ⊥ │ ⊥ │ ⊤ │
|
|
|
|
|
└───┴───┴────────────┘
|
|
|
|
|
```
|