Skip to content
LeanLearn

Logic Lab

Build any propositional formula and explore its truth table, its syntax tree, whether it is a tautology, and how it compares with another formula. Every result is computed with the exact two-valued semantics.

Use letters for statements and ¬ ∧ ∨ → ↔ (or ~ & | -> <->). Example: P ∧ Q → P

Truth table

PQQ → PP → Q → P
T (true)T (true)T (true)T (true)
T (true)F (false)T (true)T (true)
F (false)T (true)F (false)T (true)
F (false)F (false)T (true)T (true)
Tautology: true in every row

In Lean: (P Q : Prop) → P → Q → P

Syntax tree

P → Q → P

Switches

Value in this situation: True

A complete truth table checks every possible situation, so for propositional logic it is a proof. It does not extend to claims about infinitely many objects.

Natural deduction

p1 : P → Q⊢ ¬Q → ¬PLean: (P Q : Prop) (p1 : P → Q) : ¬Q → ¬P
1 open · 0 invalid
  • openGoal: ¬Q → ¬P

Compare two formulas

Use letters for statements and ¬ ∧ ∨ → ↔ (or ~ & | -> <->). Example: P ∧ Q → P

Use letters for statements and ¬ ∧ ∨ → ↔ (or ~ & | -> <->). Example: P ∧ Q → P

Equivalent: they agree in every row

PQP → Q¬Q → ¬Psame?
T (true)T (true)T (true)T (true)✓
T (true)F (false)F (false)F (false)✓
F (false)T (true)T (true)T (true)✓
F (false)F (false)T (true)T (true)✓