Skip to content
Small utility for parsing logic expressions and generating truth tables.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
truthy
.gitignore
LICENSE
README.md
setup.py

README.md

truthy

Small utility for parsing logic expressions and generating truth tables.

Symbols

Propositional variables are a sequence of one or more uppercase letters. Whitespace is ignored and parentheses can be used to disambiguate expressions manually.

Logical operators are:

  • and - &
  • biconditional - <->
  • conditional - ->
  • not - ~
  • or - v

Usage

$ echo '(A v B) -> B' | python -m truthy
((A v B) -> C)
+---+---+---+--+-----+---+----+----+----+
| A | B | C |  | ((A | v | B) | -> | C) |
+---+---+---+--+-----+---+----+----+----+
| T | T | T |  |  T  | T | T  | T  | T  |
| T | T | F |  |  T  | T | T  | F  | F  |
| T | F | T |  |  T  | T | F  | T  | T  |
| T | F | F |  |  T  | T | F  | F  | F  |
| F | T | T |  |  F  | T | T  | T  | T  |
| F | T | F |  |  F  | T | T  | F  | F  |
| F | F | T |  |  F  | F | F  | T  | T  |
| F | F | F |  |  F  | F | F  | T  | F  |
+---+---+---+--+-----+---+----+----+----+
You can’t perform that action at this time.