Skip to content

Small utility for parsing logic expressions and generating truth tables.

License

Notifications You must be signed in to change notification settings

mtomwing/truthy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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  |
+---+---+---+--+-----+---+----+----+----+

About

Small utility for parsing logic expressions and generating truth tables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages