Propositional Logic Expression Evaluator
This is a simple-minded Propositional Calculus expression evaluator written using
PLY
that can be used to generate
the truth table for an expression. The operators provided are
- ! (not),
- & (and),
- | (or), and
- → (implies). In the textbox below, type -> instead of →
Use parentheses to control the order of evaluation. Otherwise, you might get funny results.
Variables begin with a letter followed by 0 or more alphanumeric characters.
There is currently minimal type checking in place, so incorrect
expressions will generate an error that gives little clue about
what went wrong.
Examples
- a & b → a — a straightforward implication.
- a & (a → b) → b — application of modus ponens.
- (a | b) → a — is this a tautology? why or why not?
- (a & b) | (b & c) | (a & c) — use the truth table to rewrite the expression in CNF.
- (p → (q → r)) & (q → (r → s)) → (p → (q → s)) — Prove a specific instance of a general inference rule.
- ((a → b) → (b → c)) → (a → c) — why isn't this valid?
Type your expression and click submit