Godel's Incompleteness Theorems

The limits of proof and why some truths can never be proven

The Limits of Proof

Can mathematics prove everything that is true?

In the early 1900s, mathematicians believed the answer was yes. David Hilbert, one of the greatest mathematicians of his time, championed a bold vision: to establish a complete and consistent foundation for all of mathematics. Every true statement would be provable. Every false statement would be disprovable. Mathematics would be a perfect, self-contained system.

In 1931, a 25-year-old Austrian logician named Kurt Godel published a paper that shattered this dream. He proved, with mathematical rigor, that Hilbert's program was impossible. Not difficult. Not impractical. Impossible.

Godel showed that any mathematical system powerful enough to express basic arithmetic must be either incomplete (unable to prove all truths) or inconsistent (able to prove contradictions). Since we certainly want consistency, incompleteness is unavoidable. There will always be true statements that cannot be proven.

This page will walk you through the actual construction, step by step. By the end, you will understand not just what Godel proved, but how he proved it.

Formal Systems: The Rules of the Game

Before we can understand what Godel proved, we need to understand what he was talking about: formal systems.

A formal system is like a game with very precise rules. It has three components:

  • Axioms: Starting truths we accept without proof. These are the foundation, the bedrock assumptions we build upon.
  • Inference rules: Logical rules that tell us how to derive new truths from existing ones. If we know A and we know "A implies B," we can conclude B.
  • Theorems: Statements we can prove by starting from axioms and applying inference rules step by step.

The power of formal systems is that proofs become mechanical. No intuition required, no leaps of faith. Just follow the rules.

Interactive: Proof Tree

Theorem
P → P

Click on nodes with arrows to expand and see how theorems derive from axioms

The tree above shows how a simple theorem is built from axioms. Each step follows strict logical rules. This mechanical nature is what makes formal systems powerful and what Godel exploited to prove his theorems.

For the rest of this page, we will work with a formal system called Peano Arithmetic (PA), which captures the basic properties of natural numbers: 0, 1, 2, 3, and so on, along with addition and multiplication.

The Liar's Paradox: A Dangerous Idea

To understand Godel's insight, we first need to meet an ancient troublemaker: the Liar's Paradox.

Consider this statement: "This statement is false."

Think about it carefully. Is it true or false?

  • If the statement is true, then what it says must be correct. But it says it's false. So it must be false.
  • If the statement is false, then what it says is wrong. But it says it's false, so if that's wrong, it must be true.

Neither answer works. The statement cannot be consistently assigned a truth value. It breaks logic itself.

Interactive: The Paradox Loop

"This statement is false"

?

The Liar's Paradox creates an infinite loop with no stable truth value

The Liar's Paradox has been known since ancient Greece, and philosophers have debated it for millennia. Most dismissed it as a curiosity, a trick of language. Godel saw something deeper: the power of self-reference.

But you cannot write "This statement is false" in the language of arithmetic. Numbers do not talk. So Godel needed a way to make arithmetic talk about itself.


Part I: Godel Numbering

Step 1: Assign Numbers to Symbols

The first step is to assign a unique number to every symbol in our formal language. This is arbitrary but must be consistent.

Godel's Symbol Assignments

SymbolCodeMeaning
~1not
2or
3if...then
4there exists
=5equals
06zero
s7successor
(8left paren
)9right paren
,10comma
+11plus
×12times
x13variable x
y17variable y
z19variable z

Variables are assigned prime numbers (13, 17, 19, ...) to ensure unique encoding. The number 17 for variable y will be important later.

Every symbol gets a number. The logical symbols get small numbers. Variables get prime numbers starting from 13 (we will see why primes matter soon).

With this assignment, any sequence of symbols becomes a sequence of numbers. For example:

  • The formula 0 = 0 becomes the sequence [6, 5, 6]
  • The formula s(0) = s(0) (meaning 1 = 1) becomes [7, 8, 6, 9, 5, 7, 8, 6, 9]

Step 2: Encode Sequences as Single Numbers

A sequence of numbers is not yet a single number. We need a way to encode any sequence as one unique number that we can later decode.

Godel used prime factorization. The Fundamental Theorem of Arithmetic tells us that every positive integer has a unique prime factorization. We exploit this:

To encode the sequence [a1,a2,a3,,an][a_1, a_2, a_3, \ldots, a_n], compute:

2a1×3a2×5a3×7a4××pnan2^{a_1} \times 3^{a_2} \times 5^{a_3} \times 7^{a_4} \times \ldots \times p_n^{a_n}

where pnp_n is the nn-th prime number.

For example, the formula 0 = 0 with symbol sequence [6, 5, 6] becomes:

26×35×56=64×243×15625=243,000,0002^6 \times 3^5 \times 5^6 = 64 \times 243 \times 15625 = 243{,}000{,}000

This number 243,000,000 is the Godel number of the formula "0 = 0".

Interactive: Formula Encoder

Step 1: Symbol Sequence
06
=5
06
[6, 5, 6]
Step 2: Prime Encoding
2^6 × 3^5 × 5^6
Godel Number:
243000000
 

Each formula maps to a unique number. The prime factorization guarantees we can decode it back.

Try encoding different formulas. Notice how each formula gets a unique Godel number. We can also go backwards: given 243,000,000, we can factor it to recover [6, 5, 6], then look up the symbols to get "0 = 0".

Why Primes?

Prime factorization is unique. If we used a different encoding (say, just concatenating digits), different formulas might get the same number, or we might not be able to decode unambiguously. Primes guarantee uniqueness.

Step 3: Arithmetic Can Talk About Syntax

Here is the key insight: once formulas are numbers, statements about formulas become statements about numbers.

Consider the metamathematical statement: "The first symbol of formula X is a tilde."

Since formulas are now Godel numbers, this becomes: "When you factor the number X, the exponent of 2 (the first prime) equals 1 (the code for tilde)."

This is a purely arithmetic statement. We can write it in the language of PA itself.

More powerfully, consider: "Formula X is provable in the system."

A proof is a sequence of formulas (each step in the proof). So a proof is a sequence of Godel numbers, which itself has a Godel number. "X is provable" means "there exists a number P that encodes a valid proof ending in X."

We can define an arithmetic predicate:

Provable(x)p[IsValidProof(p)EndsIn(p,x)]\text{Provable}(x) \equiv \exists p \, [\text{IsValidProof}(p) \land \text{EndsIn}(p, x)]

This is complicated to write out fully, but the crucial point is: it can be written in the language of arithmetic. The predicate Provable(x)\text{Provable}(x) is expressible as an arithmetic formula.


Part II: The Substitution Function

Step 4: Defining Substitution

Here is where things get clever. We need to define a function that takes:

  • The Godel number of a formula φ(y)\varphi(y) with a free variable yy
  • A number nn

And returns the Godel number of the formula φ(n)\varphi(n), where we have substituted the numeral for nn in place of the variable yy.

In Godel's original paper, the variable yy was assigned Godel number 17. So the substitution function is written:

Sub(m,17,n)\text{Sub}(m, 17, n)

This means: "Take the formula with Godel number mm, find every occurrence of the variable with code 17 (that is, yy), and replace it with the numeral representing nn. Return the Godel number of the resulting formula."

Interactive: Substitution Function

Step 1 of 5

Start with a formula P(y)

~Provable(y)
 

"The formula with Godel number y is not provable"

Step 5: Sub is Arithmetic

The function Sub(m,17,n)\text{Sub}(m, 17, n) looks complicated, but it is primitive recursive, meaning it can be computed by a definite algorithm using only basic operations. More importantly, it can be represented within arithmetic.

There exists an arithmetic formula sub(m,n,r)\text{sub}(m, n, r) such that:

sub(m,n,r) is true    r=Sub(m,17,n)\text{sub}(m, n, r) \text{ is true} \iff r = \text{Sub}(m, 17, n)

The formal system PA can "compute" substitution using only its own language. This is not magic; it is a consequence of the fact that primitive recursive functions can be expressed in arithmetic.


Part III: Constructing the Godel Sentence

Now we have all the pieces. Let us build the sentence that says "I am not provable."

Step 6: The Unprovability Predicate

Define a formula P(y)P(y) that says "the formula with Godel number yy is not provable":

P(y)¬Provable(y)P(y) \equiv \neg \text{Provable}(y)

This formula has one free variable, yy. Let the Godel number of this formula P(y)P(y) be pp.

Step 7: The Diagonalization

Now we apply the substitution function to create self-reference.

Consider: what happens if we substitute pp (the Godel number of P(y)P(y)) for the variable yy in the formula P(y)P(y) itself?

We get the formula P(p)P(p), which says:

"The formula with Godel number pp is not provable."

But wait. The formula with Godel number pp is P(y)P(y). So P(p)P(p) says:

"P(y)P(y) is not provable."

That is still not quite self-referential. We need to go one step further.

Step 8: The Godel Sentence G

Define GG as follows:

GP(Sub(p,17,p))G \equiv P(\text{Sub}(p, 17, p))

Unpacking this:

  • Start with the formula P(y)P(y), which has Godel number pp
  • Compute Sub(p,17,p)\text{Sub}(p, 17, p): substitute pp for yy in P(y)P(y), getting the formula P(p)P(p)
  • Let g=Sub(p,17,p)g = \text{Sub}(p, 17, p) be the Godel number of P(p)P(p)
  • Then GG is the formula P(g)P(g), which says "the formula with Godel number gg is not provable"

But gg is the Godel number of P(g)P(g) itself. So GG says:

"The formula with Godel number gg is not provable" where gg is the Godel number of this very formula.

In other words: G says "G is not provable."

Interactive: Constructing the Godel Sentence

Step 1 of 9

Define the unprovability predicate

P(y) ≡ ~Provable(y)

P(y) = "Formula with Godel number y is not provable"

Step 9: The Diagonal Lemma (Why This Works)

What we just did is an instance of the Diagonal Lemma, which states:

For any formula φ(x)\varphi(x) with one free variable, there exists a sentence GG such that the system proves: Gφ(G)G \leftrightarrow \varphi(\ulcorner G \urcorner)

where G\ulcorner G \urcorner denotes the Godel number of GG.

We applied this with φ(x)=¬Provable(x)\varphi(x) = \neg \text{Provable}(x), obtaining a sentence GG that is equivalent to ¬Provable(G)\neg \text{Provable}(\ulcorner G \urcorner).

The diagonal lemma is the formal heart of self-reference in arithmetic.


Part IV: The Incompleteness Argument

Step 10: Analyzing G

Now we have a sentence GG that says "G is not provable in PA." Let us think carefully about what this means.

Case 1: Suppose PA proves G.

If PA proves GG, then GG is provable. But GG says "G is not provable." So PA has proven a false statement. This means PA is inconsistent, it proves falsehoods.

Case 2: Suppose PA does not prove G.

If PA does not prove GG, then "G is not provable" is true. Since that is exactly what GG says, GG is a true statement. So we have a true statement that PA cannot prove.

Conclusion: If PA is consistent, then GG is true but unprovable.

Step 11: The First Incompleteness Theorem

We have just proven:

First Incompleteness Theorem: Any consistent formal system capable of expressing basic arithmetic contains true statements that cannot be proven within the system.

The system is incomplete. Not because we haven't worked hard enough, but because incompleteness is mathematically unavoidable.

The Escape Hatch That Isn't

You might think: "Just add G as a new axiom." You can do that. But then Godel's construction gives you a new unprovable statement GG' for the expanded system. The same trick works again. You can never escape. For any consistent system, there will always be truths beyond its reach.

Step 12: What About the Negation?

You might wonder: if PA cannot prove GG, can it prove ¬G\neg G (the negation of G)?

¬G\neg G says "G is provable." If PA proved ¬G\neg G, then PA would assert that GG is provable. But we established that GG is actually not provable (assuming consistency). So PA would be proving something false.

Therefore, if PA is consistent, it cannot prove ¬G\neg G either.

This means GG is independent of PA: neither GG nor ¬G\neg G is provable. The system cannot decide the truth of GG.


Part V: The Second Incompleteness Theorem

Step 13: Formalizing Consistency

A system is consistent if it does not prove a contradiction. We can express this:

Con(PA)¬Provable(0=1)\text{Con}(\text{PA}) \equiv \neg \text{Provable}(\ulcorner 0 = 1 \urcorner)

"PA is consistent" means "PA does not prove 0 = 1" (or any other obvious falsehood).

This is an arithmetic statement. The system can talk about its own consistency.

Step 14: Consistency Implies G

Look back at our argument. We showed:

If PA is consistent, then G is not provable.

This argument used only arithmetic reasoning, reasoning that PA itself can carry out. So PA can prove:

Con(PA)G\text{Con}(\text{PA}) \rightarrow G

Step 15: The Bootstrap Problem

Now suppose PA could prove its own consistency:

PACon(PA)\text{PA} \vdash \text{Con}(\text{PA})

Combined with Step 14, by modus ponens, PA would prove:

PAG\text{PA} \vdash G

But we showed that if PA is consistent, PA cannot prove G. Contradiction.

Interactive: The Consistency Problem

1
Step 1 of 8

Express consistency arithmetically

Con(PA) ≡ ~Provable(⌜0=1⌝)

"PA is consistent" means "PA does not prove 0=1"

Step 16: The Second Incompleteness Theorem

Second Incompleteness Theorem: No consistent formal system capable of expressing basic arithmetic can prove its own consistency.

A system cannot lift itself by its own bootstraps. To prove that PA is consistent, you need a stronger system, but that stronger system then cannot prove its own consistency.


What This Means

Godel's theorems are not about the limitations of human intelligence or the impracticality of certain proofs. They are about fundamental, unavoidable limits of formal reasoning.

For mathematics: There will always be truths that lie beyond any given proof system. Mathematics is not a closed book waiting to be read; it is an infinite landscape that no map can fully capture.

For computers: Godel's ideas led directly to the theory of computation. Alan Turing, inspired by Godel, proved that some problems are fundamentally undecidable. The Halting Problem, which asks whether a program will eventually stop, is the most famous example. The proof uses the same diagonal trick.

For philosophy: We cannot have a complete, consistent, self-verifying foundation for mathematics. Any foundation we choose will have truths it cannot reach and consistency it cannot prove. This is not a flaw to be fixed; it is the nature of formal systems.

Godel did not show that mathematics is broken. He showed that mathematics is deeper than any single formal system can capture. That is not a limitation. It is a kind of mathematical infinity.

Key Takeaways

  • Godel numbering assigns unique numbers to formulas, allowing arithmetic to talk about itself
  • The substitution function Sub(m,17,n)\text{Sub}(m, 17, n) computes the Godel number of a formula with a value substituted in
  • The Godel sentence GG is constructed via diagonalization: G=P(Sub(p,17,p))G = P(\text{Sub}(p, 17, p))
  • GG says "I am not provable," which is true but unprovable in any consistent system
  • The First Theorem: Consistent systems have true-but-unprovable statements
  • The Second Theorem: Consistent systems cannot prove their own consistency
  • These are structural limitations of formal systems, not human limitations