On this page
Arithmetic is about numbers, so how can it say anything about proofs? Kurt Gödel's answer, in his 1931 paper Über formal unentscheidbare Sätze der Principia Mathematica und verwandter Systeme I, was to give every formula and every proof its own whole number.
What is Gödel numbering?
Gödel numbering is a way of assigning natural numbers to the terms, formulas and proofs of a formal theory, as the Stanford Encyclopedia of Philosophy's supplement on Gödel numbering describes it. The essential requirement is that it is effective: a purely mechanical routine takes you from an expression to its number and back again.
It works in two steps. First, every basic symbol gets a fixed symbol number. The supplement's example table for arithmetic:
0 gets 1, and the successor mark ′ (read it as “the next number after”) gets 2
+ gets 3, × gets 4, = gets 5
the brackets ( and ) get 6 and 7
“implies” (→) gets 8, “not” (¬) gets 9, “for all” (∀) gets 10
the variable xᵢ gets 11 + i
Second, a string of symbol numbers is packed into one number with prime powers: the first symbol number becomes the exponent of 2, the second the exponent of 3, the third the exponent of 5, and so on. The supplement notes that this prime-power method is the one Gödel himself used, and gives the example that the sequence 3, 1, 2 is coded as 2³ × 3¹ × 5² = 600.
How do you encode a formula as 2^a · 3^b · 5^c?
Take the formula 0 = 0.
Read the symbols in order: 0, =, 0.
Replace each by its symbol number: 1, 5, 1.
Use them as exponents of the primes 2, 3, 5, in that order: 2¹ × 3⁵ × 5¹.
Multiply: 2 × 243 × 5 = 2430.
So the Gödel number of 0 = 0 is 2430 under this table, the same worked example the supplement gives. Another table gives another number; what matters is that the table stays fixed.
How do you decode a Gödel number by factoring?
Go the other way by dividing out each prime as many times as it goes.
2430 ÷ 2 = 1215, and 1215 is odd, so 2 appears once: exponent 1.
1215 ÷ 3 = 405, then 135, 45, 15 and 5: five divisions, exponent 5.
5 ÷ 5 = 1: exponent 1, and nothing is left.
The exponents 1, 5, 1 read back as 0, =, 0. Decoding can never give two answers because of the fundamental theorem of arithmetic: every natural number greater than 1 is a product of primes in exactly one way, up to order, as the Stanford supplement states. That uniqueness is not automatic in every number system: see a number system where 6 factors into primes two different ways.
The supplement also notes that a symbol number of 0 would cause complications: 7⁰ equals 1, so such a symbol at the end of a string would vanish from the code.
Can you try encoding and decoding yourself?
Encode ¬0 = 0 (symbol numbers 9, 1, 5, 1).
Encode 0′ = 0′.
Decode 600 and say whether it is a formula.
Answers: 1. 2⁹ × 3¹ × 5⁵ × 7¹ = 33,600,000. 2. 2¹ × 3² × 5⁵ × 7¹ × 11² = 47,643,750. 3. 600 = 2³ × 3¹ × 5² gives 3, 1, 2, which spells + 0 ′: a string of symbols, not a formula.
Why does Gödel numbering let arithmetic talk about its own proofs?
A proof is a finite sequence of formulas, so it gets a number too, as section 2.3 of the Stanford Encyclopedia of Philosophy entry on Gödel's incompleteness theorems explains. One way: code each formula, then code the list of codes with prime powers again. A two-line list whose lines were both 0 = 0 would then get 2²⁴³⁰ × 3²⁴³⁰, which is 6²⁴³⁰, a number with 1,891 digits.
Once formulas are numbers, operations on formulas become functions on numbers. The entry describes a function neg that sends the Gödel number of a formula A to the Gödel number of ¬A, a formula Fmla(x) that is true exactly when x is the Gödel number of a well-formed formula, and a relation “x is the Gödel number of a proof of the formula with Gödel number y”, written Prf(x, y). Saying “y is provable” then becomes “there is a number x with Prf(x, y)”, an ordinary statement about whole numbers.
That is the whole trick: a question about proofs becomes a question in arithmetic, which a theory of arithmetic can ask about itself.
What role does it play in the incompleteness theorem?
The first incompleteness theorem, as the Stanford Encyclopedia of Philosophy states it, says that any consistent formal system in which a certain amount of arithmetic can be carried out has statements in its language that can be neither proved nor disproved in it. Using Gödel numbering, one builds a sentence G for a system F such that it can be shown, even inside F, that G is true if and only if G is not provable in F. If F is consistent, G is not provable in F.
You will often hear that G “says of itself that it is not provable”; the entry advises taking that with a grain of salt.
The second incompleteness theorem goes further: such a system cannot prove its own consistency, assuming it is consistent. The self-referential construction of G is a cousin of Turing's diagonal proof that the halting problem is undecidable, and showing G is unprovable is a proof by contradiction.
If prime factorisation or proof by contradiction still feels shaky, the Fermi Concept Library covers every concept in mathematics and computing, and the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.
Next step: write a four-symbol formula of your own, encode it, swap numbers with a friend and decode theirs by factoring.



