Playground Documentation Challenges Full Docs

Boolean Logic

Propositional logic fundamentals

Overview

This example shows how to set up boolean logic in Formall and prove basic theorems like the law of excluded middle, De Morgan's laws, and double negation.

Basic Setup

Boolean setup

Complete boolean logic foundation

▶ Run

Law of Excluded Middle

For any proposition P, either P is true or not(P) is true:

Excluded middle

Proof that P ∨ ¬P is always true

▶ Run

Double Negation

not(not(P)) = P for any proposition:

Double negation

Proof that ¬¬P ↔ P

▶ Run

De Morgan's Laws

not(and(P, Q)) = or(not(P), not(Q)):

De Morgan

Proof of ¬(P ∧ Q) ↔ (¬P ∨ ¬Q) by case analysis

▶ Run

Tips for Boolean Proofs

  • Case analysis — use nested if to cover all combinations
  • Contradiction — assume the opposite and derive false and true for the same expression
  • Substitution — proofs with nested angle brackets chain substitutions
ℹ
For boolean types with only two values, proofs often reduce to checking all 2ⁿ cases.