Gödel's Incompleteness Theorems
Statement
First Incompleteness Theorem (Gödel 1931): Let be a consistent formal system extending Peano Arithmetic (or any sufficiently strong recursive axiomatization of arithmetic). Then there exists a sentence such that
- (T cannot prove ), and
- (T cannot refute ).
The sentence encodes "this sentence is not provable in " via Gödel numbering. It is true in the standard model but unprovable in .
Second Incompleteness Theorem: If is consistent and extends PA, then (T cannot prove its own consistency).
Visualization
Gödel numbering sketch: Assign each symbol, formula, and proof a unique natural number:
Symbol encoding:
¬ → 1, ∧ → 2, ∨ → 3, ∀ → 4, ∃ → 5
= → 6, 0 → 7, S → 8, + → 9, · → 10
Formula "0 = 0" → codes for "0", "=", "0" → Gödel number via prime powers:
⌈0 = 0⌉ = 2^7 · 3^6 · 5^7 = some large integer n
Proof encoding: sequence of formula codes → single Gödel number ⌈π⌉
The diagonal construction:
- The predicate — " is the Gödel number of a proof of the formula numbered " — is representable in PA.
- is a formula of arithmetic.
- The diagonalization lemma yields a sentence with .
- If , then , so — contradiction with consistency.
- If , then is false, meaning has a proof of — again a contradiction.
- Therefore and : is undecidable.
Proof Sketch
- Representability. Every computable (recursive) function and relation is representable in PA: there is a formula such that iff .
- Gödel numbering. Encode formulas and proofs as natural numbers. The predicate — " codes a -proof of " — is primitive recursive, hence representable.
- Diagonalization lemma. For any formula , there exists with . Apply this to .
- Unprovability. The resulting is true in (the system is consistent, so no proof of exists) but cannot prove it.
- Second theorem. The proof of (4) is formalizable inside : . Since , we get .
Connections
Gödel's First Incompleteness Theorem is closely related to the Halting Problem — both use diagonalization to construct a self-referential statement that escapes a formal system. The Completeness TheoremGödel's Completeness TheoremA first-order sentence is provable from a theory iff it holds in every model of that theory.Read more → (a separate earlier result) says every valid sentence has a proof; Incompleteness says some true sentences are not valid consequences of alone. Löwenheim–Skolem TheoremLöwenheim–Skolem TheoremA first-order theory with an infinite model has models of every infinite cardinality.Read more → and Compactness Theorem (FOL)Compactness Theorem (FOL)A first-order theory has a model if and only if every finite subset has a model.Read more → complete the picture of what first-order logic can and cannot express.
Lean4 Proof
import Mathlib.ModelTheory.Satisfiability
open FirstOrder Language
/-- A consistent theory that is `IsComplete` decides every sentence:
for every φ, either T ⊢ φ or T ⊢ ¬φ (but not both).
Incompleteness says PA and ZFC are NOT IsComplete in this sense
when interpreted over the standard model. -/
/-- Well-definedness of consistency: a theory is consistent iff it does not
prove False. Mathlib: `Theory.IsConsistent`. -/
example {L : Language} (T : L.Theory) : T.IsConsistent ↔ ¬T.IsSatisfiedBy (∅ : Type) := by
exact Theory.isConsistent_iff
/-- Gödel's diagonalization: for any formula ψ(x), there is a sentence φ
such that φ ↔ ψ(⌈φ⌉) is provable in PA.
In Mathlib the machinery lives in `FirstOrder.Arithmetic`; here we state
the auxiliary consistency witness: if T is consistent it has a model,
in which the Gödel sentence is true. -/
theorem consistent_has_model {L : Language} {T : L.Theory} (hT : T.IsConsistent) :
∃ (M : Type) (_ : L.Structure M) (_ : Nonempty M), T.ModelType.IsEmpty = False := by
obtain ⟨M, hM⟩ := hT.nonempty_model
exact ⟨M, inferInstance, inferInstance, (not_isEmpty_iff.mpr ⟨hM⟩).elim⟩