The Limits of Proof
Gödel, Turing, Tarski, Löb
Can a formal system for arithmetic prove every truth, prove itself consistent, and decide every question by machine?
In Königsberg, in September 1930, Hilbert says 'we must know, we will know', the day after Gödel has announced a theorem that says otherwise. The part builds the proof from the ground: a formal system to play by hand (MIU), Robinson's Q and Peano arithmetic axiom by axiom, the primitive recursive functions, and Master Sun's remainders, which become Gödel's β-function and let arithmetic talk about lists. Formulas become numbers, a program prints itself, and the diagonal lemma yields a sentence that says 'I am not provable'. The two incompleteness theorems follow, and the derivability conditions turn the second into a formula of the modal logic GL. The part then turns from proof to computation: Turing machines, busy beavers up to the five-state champion, the Church-Turing thesis and Rice's theorem, then independence in ordinary mathematics, Berry's paradox made exact, Tarski's theorem on truth and Löb's theorem. It ends with what the theorems do and do not say about minds, and with Gentzen's consistency proof.
What you need. School arithmetic and the idea of a proof. The modal reading of provability uses the box of Part 4.
- The calculation
- arithmetization
- The wall
- Gödel I and II, halting, Tarski, Löb
- Built toy
- Gödel numbering, a quine, Turing machines, busy beavers
What you will be able to do
Introductory
- Derive a small sum or product in Robinson's Q, naming the axiom used at each step.
- Compute the Gödel number of a short formula and decode a formula from its number.
- Run a small Turing machine by hand and say why no program computes the busy beaver numbers.
Advanced
- Code a finite list with the β-function, using the Chinese remainder theorem.
- State the diagonal lemma and derive the first incompleteness theorem from it, saying where consistency and where omega-consistency are used.
- Prove Rice's theorem by reduction from the halting problem.
Research
- Derive the second incompleteness theorem and Löb's theorem from the three derivability conditions, and state Solovay's theorem relating GL to provability in PA.
- Explain what Gentzen's proof assumes that PA cannot prove, and what Paris and Harrington's theorem shows about independence in ordinary mathematics.
Applied
- Explain why every program analyser must sometimes answer 'I don't know' or be wrong, and how abstraction lets a verifier live with Rice's theorem.
- Assess a claim that Gödel's theorem shows something about minds, law or physics, using the hypotheses the theorem actually has.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Introductory 19 min · Advanced 42 min · Research 54 min · Applied 24 min.
- 0Königsberg, 1930Introductory2 min
- 1Hilbert's programIntroductory2 min
- 2Arithmetic, axiom by axiomIntroductory3 min
- 3Recursive functionsAdvanced3 min
- 4An ancient theorem in a modern proofAdvanced2 min
- 5Gödel numberingIntroductory2 min
- 6Self-reference without paradoxAdvanced3 min
- 7The first incompleteness theoremAdvanced4 min
- 8The second incompleteness theoremResearch3 min
- 9Turing machinesIntroductory3 min
- 10Busy beaversIntroductory3 min
- 11The Church-Turing thesis, and RiceApplied3 min
- 12Independence in ordinary mathematicsResearch3 min
- 13Berry's paradox, made exactAdvanced3 min
- 14Tarski: truth is not definableAdvanced3 min
- 15Löb's theoremResearch2 min
- 16Minds and machinesApplied3 min
- 17Gentzen's answerResearch3 min
- Recap, problems, and where this comes backAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · 中文 · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film.
Königsberg, 1930Introductory2 min
Part 7 is about the limits of proof. On the eighth of September 1930, in Königsberg, David Hilbert ended a radio address with six words that are now on his gravestone: we must know, we will know. For the mathematician, he said, there is no ignorabimus: no question that must stay unanswered for ever.
The day before, at a round table in the same city, a twenty-four-year-old Kurt Gödel had quietly announced a theorem. Any consistent formal system strong enough for arithmetic contains true sentences that it cannot prove. Almost nobody reacted. John von Neumann did: he spoke with Gödel after the session, and within two months had found a second consequence himself, only to learn that Gödel had it already. At the heart of the proof is a sentence that says of itself: I am not provable.
Hilbert wanted three things. A formal system for mathematics that is complete, proving every truth; consistent, and provably so, by methods anyone would accept; and decidable, with a mechanical procedure that settles every question. Within six years, all three were gone. Gödel's first theorem took completeness; his second took the proof of consistency; and Alonzo Church and Alan Turing took decidability. This part builds all of it, with the Reasoner doing the coding, and lays a brick in the Wall: incompleteness, undecidability, the undefinability of truth, and Löb's theorem.
So: first Hilbert's program, and a formal system you can play by hand. Then arithmetic, axiom by axiom, the recursive functions it can express, and an ancient Chinese theorem that Gödel needed. Then the coding of formulas as numbers, programs that print themselves, and the diagonal lemma. Then the two incompleteness theorems, with their logic. Then Turing machines, and the busy beavers that mark the edge of the knowable. Then independence in ordinary mathematics, the Berry paradox made exact, Tarski's theorem on truth, and Löb's. And at the end, what the theorems do and do not say about minds, and the answer of Gerhard Gentzen.
What it establishes: Königsberg, 7–8 September 1930: Gödel's announcement and Hilbert's "we must know"; Hilbert's three wishes and who took each; the plan.
1Hilbert's programIntroductory2 min
Hilbert's answer to the paradoxes of Part 6 was a program, worked out with Paul Bernays and Wilhelm Ackermann through the 1920s. Write all of mathematics as a formal system: an alphabet, some axioms, and rules for turning strings into strings. A proof is then a finite list of strings, checkable by a clerk, or a machine. Mathematics itself becomes a game of symbols, played without regard to meaning. And facts about the game, such as that no proof ends in zero equals one, are to be proved by finite, concrete reasoning that even a sceptic of the infinite would accept. That is metamathematics.
Here is a formal system small enough to play by hand, from Douglas Hofstadter's book of 1979, Gödel, Escher, Bach. The alphabet is M, I and U. There is one axiom, MI, and four rules. Add U after a final I. Double everything after the M. Replace three I's by a U. Delete two U's. Applying the rules builds a tree of theorems: MII, MIU, MIIII, and so on. The puzzle: is MU a theorem? The Reasoner can search. Within seven steps it finds more than seventeen hundred theorems, and no MU. But a search, however long, can never show that MU will not turn up at step eight, or step eight million.
So step outside the system. Count the I's, and look at the remainder when you divide by three. The axiom has one I. Doubling turns a remainder of one into two, and two into one, never zero. Replacing three I's by a U leaves the remainder alone, and the other rules add or remove no I's at all. MU has no I's, a remainder of zero. So MU is not a theorem. The proof is not a derivation inside MIU. It is a short, finite argument about MIU. That was Hilbert's hope for all of mathematics: an invariant of the same kind, proving by finite means that no proof in the system ends in zero equals one.
What it establishes: formalism and metamathematics (Hilbert, Bernays, Ackermann; the Entscheidungsproblem, 1928); Hofstadter's MIU (1979); the mod-3 invariant: a proof about a system.; Computed on screen: MIU's theorems to depth 3 as a tree; 1,730 theorems within seven steps, none of them MU
2Arithmetic, axiom by axiomIntroductory3 min
To say anything about arithmetic, we need a formal system for it. Here is the weakest one that will do, from Raphael Robinson in 1950. Its language has zero, a successor symbol S for plus one, addition and multiplication. Three is S S S zero. Three axioms say how successor behaves: zero is not a successor, different numbers have different successors, and every other number is a successor. And four are the school definitions of addition and multiplication, by recursion on the second argument.
Watch Q compute. Two plus two: S S zero plus S S zero. Axiom five moves a successor outside, twice. Axiom four removes plus zero. What is left is S S S S zero: four. Two times two takes nine steps: axiom seven unpacks the multiplication into additions, axiom six removes times zero, and the additions run as before. In this way Q proves every true equation between numerals, and refutes every false one. That will matter: Gödel's argument needs only that the system can check computations.
Q can compute, but it cannot generalize. It cannot even prove that zero plus x is x for every x: there is a model of Q with two extra objects in which that fails. The missing ingredient is induction, from Dedekind in 1888 and Giuseppe Peano in 1889: if a property holds of zero, and passes from each number to the next, it holds of all. As a first-order schema, one axiom for each formula, added to Q, it gives Peano arithmetic, PA, in which almost all of number theory can be carried out. Gödel's theorems will apply to Q and to PA alike, and to every consistent system that extends them.
Even with induction, PA cannot say exactly which things are numbers. By the compactness theorem of Part 3, PA has models with extra elements, bigger than every numeral. Thoralf Skolem built the first in 1934. Every countable one looks like this: the true natural numbers first, and then, after all of them, block upon block of nonstandard numbers, each block a copy of the integers, the blocks themselves ordered like the rationals, densely and without end. Stanley Tennenbaum proved in 1959 that in none of these can addition or multiplication be computed: the strange models are not just strange, they are beyond any machine. This matters for what follows. When PA fails to prove a sentence, there is a model in which it is false, and that model may be one of these.
What it establishes: Robinson's Q (1950), axiom by axiom; Q computes; Q cannot prove ∀x (0 + x = x); induction (Dedekind 1888, Peano 1889) and PA; nonstandard models (Skolem 1934), Tennenbaum (1959).; Computed on screen: 2 + 2 = 4 in three steps and 2 × 2 = 4 in nine, each step an axiom of Q
3Recursive functionsAdvanced3 min
Which functions can arithmetic express? Gödel's answer in 1931 used what we now call the primitive recursive functions. Start from three simple kinds: the zero function, successor, and the projections that pick out one argument. Then close under two ways of building: composition, plugging functions into functions; and primitive recursion, defining the value at y plus one from the value at y. Addition, for instance, is a primitive recursion: x plus zero is x, and x plus y plus one is the successor of x plus y. As a tree, it is five combinators.
The Reasoner has these combinators as a small programming language. Multiplication is a recursion over addition; exponentiation a recursion over multiplication; then predecessor and factorial. Each is a tree built from the trees before it, and the Reasoner runs each one on its arguments, by nothing but zero, successor and recursion. Almost every function met in number theory, primes, remainders, the n-th prime, is primitive recursive.
But not every computable function is primitive recursive. Wilhelm Ackermann found one in 1928; this simpler version is Rózsa Péter's. Each row recurses on the row before it. Row one adds, row two doubles, row three is exponential. Row four is a tower: A of four and one is sixty-five thousand, five hundred and thirty-three, and A of four and two has nineteen thousand, seven hundred and twenty-nine digits. That is two to the sixty-five thousand five hundred and thirty-six, minus three: the size of stage six of the hierarchy in Part 6. Ackermann's function eventually outgrows every primitive recursive function. And there is a quicker proof that something is missing: the diagonal. List the primitive recursive functions; one plus the n-th function at n is computable, and differs from every function on the list. Capturing all computation will need Turing.
Here is what all this buys. A function is represented in Q by a formula when Q proves, for each input, the right output, and that no other output is right. Gödel showed that every primitive recursive function is representable; we now know the same for every computable function. The sentences that say a computation succeeds have a simple shape, there exists a y such that a checkable condition holds. They are called sigma one. And Q proves every true sigma one sentence. Whenever a computation halts, arithmetic can prove that it does. Hold on to that; it is half of Gödel's proof.
What it establishes: the five combinators; primitive recursion; Ackermann (1928) and Péter; the diagonal against the primitive recursive functions; representability and Σ₁-completeness.; Computed on screen: add, mul, exp, pred, fact as combinator trees, with sizes and values; A(m, n) for m ≤ 3, A(4, 1) = 65,533, A(4, 2) with 19,729 digits
4An ancient theorem in a modern proofAdvanced2 min
To express a recursion in arithmetic, Gödel faced a problem. Saying that y is x factorial means saying there is a list, one, one, two, six, and so on up to y, in which each term is the last one times the next number. But the language of arithmetic has zero, successor, plus and times. It has no lists. His solution was to code any finite list by just two numbers, using remainders, and the theorem that makes it work is one of the oldest in mathematics.
Around the year 400, the Mathematical Classic of Master Sun posed a puzzle. There are things whose number is unknown. Counted by threes, two are left over; by fives, three; by sevens, two. How many things are there? Mark the numbers that leave two by threes, three by fives, two by sevens. The first number marked in all three rows is twenty-three, and the pattern repeats every hundred and five. In general, if the moduli share no common factor, any remainders at all can be met at once. Qin Jiushao gave a general method in 1247; today it is called the Chinese remainder theorem.
Gödel turned the theorem into a coding device. His beta function takes two numbers c and d, and an index i, and returns the remainder of c on division by one plus i plus one times d. To code the list two, three, five, take d to be five factorial, a hundred and twenty. The moduli one hundred and twenty-one, two hundred and forty-one and three hundred and sixty-one share no factor, so the Chinese remainder theorem gives a number c with the right remainders. The Reasoner finds c, and checks: the remainders are two, three and five. So 'there is a list such that' becomes 'there are two numbers such that', and every recursion can be written with plus and times alone. A theorem from Master Sun sits inside the proof of incompleteness.
What it establishes: why recursion needs lists; Sunzi's problem (c. 400) and Qin Jiushao (1247): the Chinese remainder theorem; Gödel's β-function.; Computed on screen: 23 found by sieving; the list 2, 3, 5 coded as c = 5,482,512, d = 120, and decoded
5Gödel numberingIntroductory2 min
Gödel's second idea was to turn syntax into arithmetic. Give every symbol a number: odd numbers for the logical and arithmetical symbols, not, and, or, implies, the quantifiers, equals, brackets, zero, successor, plus, times; even numbers for the variables. The particular numbers do not matter. What matters is that the coding is mechanical, both ways.
Now code a whole formula. Take zero equals zero. Its symbols have codes twenty-one, fifteen, twenty-one. Make each code the exponent of a prime, in order: two to the twenty-one, times three to the fifteen, times five to the twenty-one. The product is a single number, about fourteen billion billion billion. Every formula gets a number this way. The law that x plus zero is x gets one with a hundred and fifteen digits.
Decoding is just factoring. Given a number, the Reasoner divides out two, three, five, and so on, and reads off the exponents. Eleven, two, seventeen, two, twenty-five: for all x, open bracket, x plus, and so on. Out comes the formula: for all x, x plus zero equals x. A proof is a list of formulas, so it too gets a number, with the formulas' numbers as exponents. These numbers are absurdly large. A two-line proof gets a number with about ten to the sixty-eight digits: written one digit to an atom, it would use up the atoms of a hundred billion suns. Nobody computes them. What matters is that the relations between them are arithmetic.
And so syntax becomes arithmetic. Being the code of a formula is a primitive recursive property of numbers: you can check it by factoring and looking. So is being the code of a proof of a given formula: check that each line is an axiom or follows by a rule. And provability, there exists a proof, is a sigma one formula, Prov of n. Write corner quotes around a formula for the numeral of its Gödel number. Arithmetic, which was supposed to be about numbers, can now talk about its own formulas and proofs. That is the opening Gödel needed.
What it establishes: codes for symbols; a formula as a product of prime powers; decoding by factoring; proofs as numbers; Form, Prf, Prov.; Computed on screen: ⌜0 = 0⌝ = 2²¹·3¹⁵·5²¹; ∀x(x + 0 = x) decoded from its 115-digit number; a two-line proof's number has about 10⁶⁸ digits
6Self-reference without paradoxAdvanced3 min
How can a sentence talk about itself? The naive way fails. To quote itself in full, a sentence would have to contain a copy of itself, which contains a copy of itself, and so on for ever, like a pair of facing mirrors. No finite sentence can do it. The trick that avoids the regress turns up first in a place you may not expect: in programs.
Here is a program in Python that prints its own source code. Programs like this are called quines. Run it, and it prints exactly itself; the Reasoner ran it, and compared. It has two halves. A template, s, with a hole in it. And an instruction: print the template, with the template's own quotation filled into the hole. The program never contains a copy of itself. It contains a description, and an instruction to apply the description to itself. That is the whole trick, and Stephen Kleene proved in 1938 that every programming language allows it: any program can be given access to its own code.
The philosopher W. V. O. Quine, after whom quines are named, made the same trick into a sentence in 1962. Take the phrase: yields falsehood when preceded by its quotation. Now precede it by its quotation. What does the sentence say? That a certain phrase, when preceded by its quotation, yields a falsehood. But that phrase, preceded by its quotation, is this very sentence; the Reasoner checks that too. So the sentence says of itself that it is false: a liar, built without the word this.
Inside arithmetic, the trick becomes the diagonal lemma, implicit in Gödel's paper and stated in general by Rudolf Carnap in 1934. For any property phi, there is a sentence D that Q proves equivalent to: phi holds of D's own code. The proof is the quine. Let diag of n be the code of the formula you get by putting n's own numeral into the formula coded by n. It is computable, so arithmetic can express it. Let psi of x say: phi holds of diag of x. Psi has some code, k. Put k into psi: that is D. Diag of k is the code of D itself, so D says that phi holds of D. No regress: D contains a description of itself, and arithmetic does the copying. In English, with phi as 'is unprovable', the sentence reads like this, and the Reasoner checks that diagonalizing the quoted template gives the sentence back.
What it establishes: the regress of naive self-reference; quines and Kleene's recursion theorem (1938); Quine's sentence (1962); the diagonal lemma (Gödel 1931, Carnap 1934), proved.; Computed on screen: a Python quine run and compared; Quine's sentence and a Gödel-style sentence checked to refer to themselves
7The first incompleteness theoremAdvanced4 min
Now the theorem. Apply the diagonal lemma to the property of not being provable. It gives a sentence G that PA proves equivalent to: G is not provable. G says, of itself, I am not provable. Not 'I am false', which would be the liar. Provability is a precise, arithmetical property, so G is a perfectly good sentence about numbers: in the end, a claim that a certain polynomial equation has no solution.
Suppose PA is consistent. Could it prove G? If it did, some number m would code that proof. Checking that m codes a proof of G is a computation, a true sigma one fact, so PA proves it. So PA proves that G is provable, which is equivalent to not G. PA would prove both G and its negation. So a consistent PA does not prove G. Could it prove not G? Then PA proves that some number codes a proof of G. But we just saw that no number does, and PA can check each one: it proves 'zero is not a proof of G', 'one is not', and so on, for every number. A theory like that says 'there is one', and denies every candidate. Gödel called it omega-inconsistent. So if PA is consistent it cannot prove G, and if it is omega-consistent it cannot refute G. G is undecidable.
In 1936 Barkley Rosser removed the need for omega-consistency, with a cleverer sentence. R says: for any proof of me, there is a shorter proof of my negation. A race between proofs, which a merely consistent theory can neither win nor lose. The result, in its modern form: any consistent theory that contains Q, and whose axioms can be listed by a program, is incomplete. Some sentence is neither provable nor refutable in it. Adding G as a new axiom does not help: the new theory has its own Gödel sentence.
And there is a twist. G says that G is not provable. If PA is consistent, G is not provable. So what G says is so: G is true, in the natural numbers. Truth in arithmetic outruns provability in PA, and in any system like it. Two cautions. The argument that G is true assumes that PA is consistent. And by the completeness theorem of Part 3, since PA does not prove G, there are other models of PA, with nonstandard numbers, in which G is false: in them, some nonstandard number codes a 'proof' of G.
How ordinary is Gödel's sentence, in the end? Hilbert's tenth problem, of 1900, asked for a procedure to decide whether a polynomial equation with integer coefficients has a solution in whole numbers. x squared minus two y squared equals one has one: three and two. x squared plus y squared equals three has none. In 1970 Yuri Matiyasevich, completing work of Martin Davis, Hilary Putnam and Julia Robinson, proved that every set a program can list is the set of solutions of some polynomial. So Gödel's sentence is equivalent to the claim that a certain polynomial equation has no solution: a statement any number theorist can read. And Hilbert's tenth problem is unsolvable, since a procedure for polynomials would decide halting.
What it establishes: G ↔ ¬Prov(⌜G⌝); the proof, with ω-consistency; Rosser (1936); G is true; Hilbert's tenth problem and MRDP (1970).
8The second incompleteness theoremResearch3 min
The second theorem comes almost for free. Write Con of PA for the sentence that zero equals one is not provable: PA is consistent. The first half of the last chapter was an argument: if PA is consistent, then G is not provable. That argument is itself elementary arithmetic, so PA can carry it out. PA proves: if PA is consistent, then G is not provable, which is to say, then G. So if PA proved its own consistency, it would prove G, which it cannot. A consistent theory containing PA cannot prove its own consistency. And since Hilbert's finitary methods can all be formalized in PA, a finitary proof that PA is consistent is impossible.
What exactly must provability satisfy for this to go through? David Hilbert and Paul Bernays isolated the conditions in 1939, and Martin Löb simplified them in 1955. First: whatever PA proves, it proves to be provable. Second: provability is closed under modus ponens. Third: PA can prove the first condition about itself. Any notion of provability with these three properties falls under the second theorem. And they should look familiar.
Read the box of modal logic as 'PA proves'. The first condition is the rule of necessitation; the second is axiom K; the third is axiom four. Add Löb's axiom, which we met in Part 4 and will prove in Chapter 15, and you have the logic GL, which Robert Solovay showed in 1976 is exactly the logic of provability in PA. The second incompleteness theorem becomes a modal formula: if not box falsum, then not box not box falsum. If PA is consistent, it does not prove that it is. The Reasoner checks it on every finite GL frame, every irreflexive transitive relation, with up to four worlds: two hundred and forty-two frames, and it holds at every world.
This is the seventh brick in the Wall. The dream: a complete, consistent theory of arithmetic that proves its own consistency. The wall: Gödel's two theorems, joined in this part by Turing's halting problem, Tarski's theorem on truth and Löb's theorem, which share one diagonal argument. What it forces: truth outruns proof, and certainty about our foundations cannot come from the foundations alone.
What it establishes: Con(PA); PA ⊢ Con → G; Gödel II; the derivability conditions (Hilbert–Bernays 1939, Löb 1955); GL; the Wall's seventh brick.; Computed on screen: ¬□⊥ → ¬□¬□⊥ on all 242 finite GL frames with up to four worlds
9Turing machinesIntroductory3 min
In 1936 Alan Turing, aged twenty-four, asked what it is to compute by following rules. He imagined a human computer, a clerk, and stripped the work down. Paper becomes a tape of squares, each blank or marked. The clerk has finitely many states of mind. At each step the clerk looks at one square, may change its mark, moves one square left or right, and changes state, by a rule that depends only on the current state and the symbol seen. That is a Turing machine. The same year Alonzo Church, with the lambda calculus, and Emil Post, with his workers in boxes, gave other definitions. All of them turned out to define exactly the same functions.
Here is a machine with two states, A and B, as a table of four rules. Start on a blank tape in state A. A reads zero: write one, move right, go to B. B reads zero: write one, move left, back to A. And so on, step by step. After six steps it reaches the halting rule and stops, leaving four ones on the tape. Keep that number in mind: no machine with two states does better.
A run can be drawn as a single picture: one column of tape per step, with time running from left to right. This is a four-state machine found by Allen Brady. Its head sweeps back and forth, building a growing block of ones, in a hundred and seven steps, before it halts with thirteen ones on the tape. No four-state machine leaves more, or runs longer and still halts: that was proved in 1983.
Turing's deepest observation was the next one. A machine's table can itself be written on a tape, as a string of symbols. And there is a single universal machine U which, given the description of any machine M and an input x, does whatever M would do on x. Programs are data. Every computer since has been built on that idea. It is also where the trouble starts. A machine can be asked questions about machines, including itself, and the diagonal is waiting. Part 3 used it to show that no machine decides which machines halt; the next chapter measures how badly.
What it establishes: Turing's analysis of the human computer (1936); Church, Post; a two-state machine run; space–time diagrams; the universal machine.; Computed on screen: the two-state champion step by step; Brady's four-state machine, all 107 steps
10Busy beaversIntroductory3 min
In 1962 Tibor Radó turned the halting problem into a game. Among all machines with n states, started on a blank tape, find the one that runs longest and then halts. Its number of steps is the busy beaver number, BB of n. It is a perfectly definite number for each n, yet no program computes it. If one did, you could decide halting: run any n-state machine for BB of n steps, and if it has not stopped by then, it never will. So BB grows faster than every computable function, faster than Ackermann's, faster than anything you can write down a program for.
For two states, the Reasoner can play the game outright. Each of the four rules has twelve choices, so there are twenty thousand, seven hundred and thirty-six machines. Run each for fifty steps, and nine thousand, seven hundred and eighty-four of them halt. The longest halting run is six steps; the most ones, four: the machine of the last chapter. But this is where the difficulty lives. A machine still running at step fifty might halt at step fifty-one. To know the champion, you must prove of every other machine that it never halts. For two states that is easy: each one visibly loops.
Here are the champions, each simulated by the Reasoner. One state: one step. Two states: six. Three: twenty-one, found by Shen Lin and Radó. Four: a hundred and seven, Brady's machine. Five: forty-seven million, one hundred and seventy-six thousand, eight hundred and seventy steps. The machine was found in 1989 by Heiner Marxen and Jürgen Buntrock; that nothing beats it was proved only in 2024, by an online collaboration, the Busy Beaver Challenge, which classified every five-state machine and checked the proof in the Coq proof assistant. The Reasoner runs the champion in a few seconds, and it halts, leaving four thousand and ninety-eight ones. Six states: a machine found in 2022 runs for more steps than a tower of fifteen tens. The true value is unknown.
Beyond five states, the busy beaver runs into open mathematics. Among the six-state machines are some, nicknamed cryptids, whose halting turns on Collatz-like problems no one can solve. Small machines can be built that halt if and only if Goldbach's conjecture is false, or the Riemann hypothesis. And in 2016 Adam Yedidia and Scott Aaronson built a machine with seven thousand, nine hundred and eighteen states that halts if and only if ZFC is inconsistent. By Gödel's second theorem, ZFC cannot prove that it never halts, so ZFC cannot determine that busy beaver number. Later work has brought the bound below seven hundred and fifty states. Each value of BB is a definite number, and each is a theorem, until, somewhere between six and seven hundred and fifty, the theorems run out.
What it establishes: Radó's busy beaver (1962); why BB is uncomputable; the champions; bbchallenge (2024); cryptids, Goldbach and Riemann machines; Yedidia–Aaronson (2016) and the ZFC frontier.; Computed on screen: all 20,736 two-state machines run: 9,784 halt, at most 6 steps and 4 ones; the champions for 2–5 states, with BB(5) = 47,176,870 and 4,098 ones
11The Church-Turing thesis, and RiceApplied3 min
Why believe that Turing caught the right notion? Because every serious attempt to define mechanical computation has produced exactly the same class of functions: Turing's machines, Church's lambda calculus, the recursive functions of Gödel, Herbrand and Kleene, Post's systems, register machines, even a one-dimensional cellular automaton called Rule 110, and every programming language ever built. The Church-Turing thesis says that this class is the right one: whatever a human can compute by following rules, a Turing machine can compute. It is not a theorem, because 'compute by following rules' is not a mathematical notion. It is a claim about the fit between a definition and an idea, and the evidence for it is overwhelming.
The thesis is often stretched. Here is what it does not say. It does not say that the mind is a Turing machine: it is about a clerk following rules, not about everything a mind can do. That question comes back in Chapter 16, and in Part 30. It does not say that every physical process is computable. That is a different claim, about physics, which Robin Gandy analysed in 1980, and which might be false. And it says nothing about speed. Quantum computers compute no function a Turing machine cannot, but Peter Shor showed in 1994 that they could factor numbers far faster than any known classical method.
The halting problem is the first of an endless family. Henry Rice proved in 1953 that every non-trivial property of what a program does, as opposed to how its text looks, is undecidable. The proof is one line. Given a machine M and an input x, build a new program that first runs M on x, and then, if that ever finishes, behaves like some program that has the property. The new program has the property exactly when M halts on x. So a decider for the property would decide halting. Does this program ever print hello? Does it compute the squaring function? Is it malware? No algorithm answers any of these for all programs. Every bug finder must sometimes say 'I don't know', or be wrong, which is why the model checkers of Part 4 work with abstractions.
What it establishes: the convergence of definitions; the Church–Turing thesis; what it does not say (Gandy 1980, Shor 1994); Rice's theorem (1953).
12Independence in ordinary mathematicsResearch3 min
For forty years after Gödel, a doubt remained. The undecidable sentences were about proofs and codes: artificial, a logician's curiosity. Would a mathematician asking an ordinary question ever meet one? Part 6 has already shown two that they would: Goodstein's sequences and the hydra, true statements about numbers that PA cannot prove. The first such example came from a theorem about colouring.
Frank Ramsey proved his theorem in a paper of 1930, while working on a case of Hilbert's decision problem. Its simplest case is a puzzle about a party. Among any six people, must there be three who all know each other, or three who are all strangers? Draw people as points, and colour each pair red for friends, blue for strangers. With five people you can avoid both: a red pentagon and a blue pentagram have no one-coloured triangle. The Reasoner finds all twelve such colourings among the thousand and twenty-four. With six people you cannot. The Reasoner tries all thirty-two thousand, seven hundred and sixty-eight colourings, and every one contains a red or a blue triangle. The Ramsey number R three three is six. Ramsey's theorem says the same for any sizes and any number of colours: complete disorder is impossible.
In 1977 Jeff Paris and Leo Harrington found the first natural example. The finite Ramsey theorem says: for any sizes, there is an N so large that however you colour the subsets of one to N, some big set is all one colour. PA proves this easily. Now add one innocent condition: the one-coloured set must be large, meaning it has at least as many elements as its smallest element. The strengthened statement is still true; it follows from Ramsey's theorem for infinite sets. But PA cannot prove it. The N it requires grows faster than any function that PA can prove is defined everywhere, the way Goodstein's sequences outrun every function PA knows.
The list has grown. Goodstein and the hydra, from Part 6. The Paris-Harrington principle. Harvey Friedman showed that a finite form of Kruskal's theorem about trees cannot be proved even in much stronger systems, and it yields a number, TREE of three, so large that Graham's number is nothing beside it. The graph minor theorem of Neil Robertson and Paul Seymour, a pillar of modern graph theory, is unprovable in a still stronger system. Incompleteness reaches ordinary combinatorics. And in every case the proof that the statement is true uses infinite objects, or ordinals beyond what the weaker system can reach.
What it establishes: Ramsey (1930) and R(3,3) = 6; Paris–Harrington (1977); Kruskal and TREE(3) (Friedman); the graph minor theorem.; Computed on screen: all 1,024 colourings of K₅ (12 without a one-coloured triangle) and all 32,768 of K₆ (none)
13Berry's paradox, made exactAdvanced3 min
In 1906 Bertrand Russell published a paradox he credited to G. G. Berry, a librarian at the Bodleian in Oxford. Consider the smallest number not definable in under sixty letters. Only finitely many phrases have under sixty letters, so only finitely many numbers are defined by them, and some numbers escape. There is a smallest. But the phrase we just used defines it, and has under sixty letters. Contradiction. The trouble is the word 'definable', applied to the language it is used in.
The Reasoner can make the paradox precise for a toy language. Its names are expressions built from the digits one to nine with plus, times and power, written in postfix, so no brackets are needed. The Reasoner finds the shortest name of every number. Here are the numbers up to three hundred, coloured by the length of their shortest name. A hundred needs five symbols: four times five squared. Seven hundred and twenty-nine needs only three: three to the sixth. A thousand is eight times five cubed. The least number with no name of three symbols is nineteen. With five symbols, ninety-two; with seven, two hundred and thirty-nine. There is no paradox here, because the phrase 'the least number with no name of seven symbols' is not an expression of the toy language. It is said in ours. The paradox returns only when a language tries to talk about definability in itself, which is exactly what arithmetic, with Gödel's coding, can almost do.
Gregory Chaitin made Berry's paradox into a theorem in 1974. The Kolmogorov complexity of a string is the length of the shortest program that prints it. A random string has complexity about its own length: there is no shorter description. Chaitin's theorem: for any consistent theory, there is a number L such that the theory cannot prove, of any particular string, that its complexity exceeds L, even though all but finitely many strings do. The proof is Berry's. If the theory could prove such facts, a short program could search through its proofs for a string of complexity above L, and print it. But that program has length less than L, so it would be a short description of a string with no short description.
Chaitin went on to define a single number that packs in the whole halting problem. Omega is the probability that a randomly chosen program halts. Knowing its first n bits would let you decide the halting of every program up to length n. So any theory can determine only finitely many of its bits. Chaitin described the rest as mathematical facts that are true for no reason. A caution from Torkel Franzén: they are true for no reason that the theory can supply, which is the same lesson as Gödel's, in the language of information.
What it establishes: Berry's paradox (Russell 1906); a toy language and its shortest names; Kolmogorov complexity; Chaitin's theorem (1974); Ω (1975) and Franzén's caution.; Computed on screen: the shortest names of 1–300; the least numbers with no name of 3, 5, 7 symbols: 19, 92, 239
14Tarski: truth is not definableAdvanced3 min
In 1933 Alfred Tarski proved a theorem that is shorter than Gödel's, and in a sense deeper. Suppose arithmetic had a formula, True of x, that is true of exactly the codes of the true sentences: for every sentence A, True of A's code if and only if A. That is Tarski's Convention T, from Part 3. Apply the diagonal lemma to not True. It gives a sentence L equivalent to 'L is not true'. That is the liar, now as a sentence of arithmetic. With Convention T, L holds if and only if L does not. So there is no such formula. Arithmetical truth cannot be defined in arithmetic.
Tarski's theorem forbids a truth predicate for the whole language. It allows partial ones. Here is the Reasoner's truth predicate for bounded sentences, where every quantifier is limited: for all x below ten, there is a y below ten. Such a quantifier is only a long 'and', or a long 'or', so a finite search decides it. Every number below ten has a partner summing to nine: true. Two has a whole square root: false. Every number below thirty is even or odd: true. There is a prime between ninety and a hundred: true, it is ninety-seven. Truth for bounded sentences is computable, and arithmetic can define it. So can it define truth for sigma one sentences, 'a witness exists', and for sigma two, and for each fixed level. What it cannot do is define truth for every level at once. The hierarchy of partial truth predicates has no top.
Put the two theorems side by side. Provability is definable in arithmetic, and the liar built from it is Gödel's sentence: not a paradox, but a theorem about what can be proved. Truth is not definable, and the liar built from it is a contradiction. So provability and truth must differ, which is a second proof of incompleteness, and the cleanest. Tarski's way out was a hierarchy: truth for one language can be defined, but only in a richer metalanguage. Whether a language can after all hold its own truth predicate, and at what price, is the subject of Part 8.
What it establishes: the undefinability of truth (1933); partial truth predicates; truth and proof apart.; Computed on screen: four bounded sentences decided by the Reasoner's Δ₀ truth predicate
15Löb's theoremResearch2 min
Gödel's sentence says 'I am not provable'. In 1952 Leon Henkin asked about its opposite. Take a sentence H that says 'I am provable'. Is H provable? Either answer looks consistent. If H is provable, it is true; if it is not, it is false. Nothing seems to decide. In 1955 Martin Löb answered: H is provable. And he proved much more.
Löb's theorem: if PA proves 'if A is provable, then A', then PA proves A. The proof is nine lines, using the three derivability conditions. First, the diagonal lemma gives a sentence L that says: if I am provable, then A. Apply the conditions: if L is provable, then so is 'if L is provable then A', and so, since provable things are provably provable, A is provable. Now use the hypothesis that provability of A gives A: if L is provable, then A. But that is L itself. So L is proved, hence provable, hence A. Take A to be a contradiction, and Löb's theorem is Gödel's second theorem. Take A to be Henkin's sentence, and it answers Henkin: H is provable. PA believes 'if I prove A, then A' only for the A it already proves.
Provability logic, the GL of Part 4, now pays off. Gödel's sentence is a fixed point: p if and only if not box p. GL solves it. The solution is not box falsum: Gödel's sentence is equivalent to the statement that PA is consistent. Henkin's sentence, p if and only if box p, has the solution truth itself: it is equivalent to a tautology, which is why it is provable. And the solutions are unique: any two Gödel sentences are provably equivalent. The Reasoner checks each of these on all two hundred and forty-two finite GL frames with up to four worlds. Dick de Jongh and Giovanni Sambin proved that every such equation has a unique solution, and Robert Solovay that GL captures exactly what PA can prove about its own provability.
What it establishes: Henkin's question (1952); Löb's theorem (1955) in nine lines; Gödel II as a corollary; the fixed points of GL (de Jongh, Sambin), Solovay (1976).; Computed on screen: Gödel's and Henkin's fixed points and their uniqueness, on all 242 finite GL frames
16Minds and machinesApplied3 min
Do Gödel's theorems show that the human mind is not a machine? Two famous arguments say so. The philosopher J. R. Lucas in 1961, and the physicist Roger Penrose in two books, in 1989 and 1994. Suppose my mathematical reasoning were captured by some formal system F. F cannot prove its own Gödel sentence. But I can see that the Gödel sentence is true. So I can do something F cannot, and I am not F. Since F was arbitrary, I am no machine at all.
The argument can be laid out as a Price List. Three claims. Mechanism: our mathematical knowledge is what some formal system F proves. We can know that F is consistent. And F is in fact consistent. Hold fixed Gödel's second theorem, and the three are inconsistent: if we knew F's consistency, F would prove it. Lucas and Penrose deny mechanism. Most logicians, from Paul Benacerraf in 1967 to Hilary Putnam and Solomon Feferman, deny the second claim: we have no way to know that the system that captures our own reasoning is consistent. We might be such a machine, and not know which one. And one can deny the third. Turing said in 1947 that if a machine is expected to be infallible, it cannot also be intelligent. Human mathematicians are not infallible either.
Gödel's own view was more careful. In his Gibbs lecture of 1951 he argued for a disjunction: either the human mind infinitely surpasses the powers of any finite machine, or there are absolutely unsolvable mathematical problems. The theorems prove this much, and no more. Gödel leaned towards the first, a mind beyond machines, but he never claimed his theorems proved it.
Few theorems have been quoted as widely, or as wrongly. The logician Torkel Franzén wrote a whole book on the misuses. Gödel did not prove that nothing can be known for certain: PA proves every true sigma one sentence, and almost all ordinary mathematics is untouched. He did not prove that every system of thought is incomplete: only consistent, listable formal systems that contain enough arithmetic. He did not show that some truths are unknowable: each Gödel sentence is provable in a stronger system. The theorem concerns one system at a time. And he did not show that mathematics is inconsistent. The theorems assume consistency, and say only that a system cannot prove it from within.
What it establishes: Lucas (1961) and Penrose (1989, 1994); Price List: minds and machines (Benacerraf 1967, Putnam, Feferman; Turing 1947); Gödel's disjunction (1951); Franzén's misuses (2005).; Computed on screen: the MUS {M, K, C} and its three corrections
17Gentzen's answerResearch3 min
Gödel's second theorem says that PA cannot prove its own consistency. It does not say that nothing can. In 1936 Gerhard Gentzen gave a proof. He assigned to every proof in PA an ordinal below epsilon zero, the ordinal of Part 6. Then he showed that any proof of zero equals one could be transformed into another proof of zero equals one, with a smaller ordinal. Since ordinals cannot decrease for ever, there is no proof of zero equals one. The proof is finitary, except for one principle: induction along the ordinals up to epsilon zero. That principle is not provable in PA, as Gentzen showed in 1943, so there is no conflict with Gödel. The consistency of arithmetic rests on something slightly beyond arithmetic.
Gentzen's idea became a research program, ordinal analysis. Each theory is measured by the least ordinal along which it cannot prove induction. For weak systems it is omega to the omega; for PA, epsilon zero; for stronger systems, ordinals with names like Gamma zero, studied by Feferman and Schütte, and the Bachmann-Howard ordinal, and beyond, still being charted. The natural independent statements of Chapter 12 sit exactly here: Goodstein's theorem, the hydra, and Paris-Harrington all need induction up to epsilon zero, which is why PA cannot prove them.
There is a further twist, from Harvey Friedman in the 1970s, developed by Stephen Simpson. Instead of asking what follows from the axioms, ask which axioms a theorem needs. Work over a weak base, RCA zero, which says only that computable sets exist; it proves the intermediate value theorem. Add that every infinite binary tree has an infinite path, and you get WKL zero, which is equivalent, over the base, to the Heine-Borel theorem, and to Gödel's completeness theorem of Part 3. Arithmetical comprehension is equivalent to the Bolzano-Weierstrass theorem; transfinite recursion, to the comparability of well-orders; and the strongest of the five, to the Cantor-Bendixson theorem. The surprise is how few levels there are. Almost every theorem of classical mathematics is provable in one of these five systems, or equivalent to one: the theorem proves the axiom back.
So what became of Hilbert's program? Completeness, a finitary consistency proof, and a decision procedure were all shown impossible. What survived is subtler and richer: proofs of consistency relative to other systems, ordinal analysis, and the program of reverse mathematics begun by Harvey Friedman and Stephen Simpson, which asks, for each ordinary theorem, exactly which axioms it needs. The limits of proof are not a ruin. They are a map of what proof can reach.
What it establishes: Gentzen's consistency proof (1936) and its ε₀; ordinal analysis; reverse mathematics and the Big Five (Friedman, Simpson); what became of Hilbert's program.
Recap, problems, and where this comes backAll tracks2 min
Let's gather what we built. Hilbert's program, and a toy formal system whose limits we proved from outside. Arithmetic, axiom by axiom; the recursive functions it can express; and Master Sun's remainders, which let it talk about lists. Formulas as numbers, programs that print themselves, and the diagonal lemma. The two incompleteness theorems, and the modal logic that captures them. Turing machines, and the busy beavers that mark the edge of the knowable. Independence in ordinary mathematics, Berry's paradox made exact, and the theorems of Tarski and Löb. And what the theorems do, and do not, say about minds, and Gentzen's way of trusting arithmetic after all.
The Reasoner has a module for arithmetic. It runs Robinson's Q, builds recursive functions, solves Master Sun's problem and codes lists with Gödel's beta, numbers and unnumbers formulas, runs a quine and checks the diagonal sentence, simulates Turing machines up to the five-state champion, and checks provability logic on finite frames. Its tests compare it with the published values: the busy beaver numbers, the Ramsey number, and Sunzi's twenty-three. And the Wall has its seventh brick.
Six problems, with full solutions in this part's notes. A puzzle in MIU, a derivation in Q, a Chinese remainder problem with its beta code, the formalized first theorem, an application of Rice, and an essay on minds and machines. Pause here, and try them.
Where this comes back. The liar, and the theories of truth built to survive it, in Part 8. What mathematics is about, after Gödel, in Part 9. Minds and machines again in Part 30. Kolmogorov complexity becomes a theory of induction in Part 15. Löb's theorem returns at the very end, in Part 42, as an obstacle for agents that must trust their own reasoning. And computation in physics, in Part 26. Next, Part 8: the liar.
The books and papers this part follows are on screen, and in the notes. Thanks for watching.
Where it goes next. The liar and the theories of truth built to survive it are Part 8; what mathematics is about after Gödel is Part 9. Kolmogorov complexity becomes a theory of induction in Part 15, computation meets physics in Part 26, minds and machines return in Part 30, and Löb's theorem returns in Part 42 as an obstacle for agents that must trust their own reasoning.
Key results
The part's results in one place, for revision.
Try it
Lab 7 · Busy beavers, the β-function and provability logic, computed
Run all 20,736 two-state Turing machines and compare the longest halting run with the published busy beaver number; code a random list with Gödel's β-function; and check on every finite GL frame with up to four worlds that Löb's axiom and the second incompleteness theorem hold while reflection fails.
python -m videos.philosophy.labs 7
needs numpy, scipy, matplotlib · download lab07.py ·
source on GitHubtwo-state machines 20,736 (12 choices for each of 4 rules: 12^4 = 20,736)
halt within 50 steps 9,784 still running: 10,952
longest halting run, most ones 6 steps, 4 ones (Radó 1962: 6, 4)
champions for 2, 3, 4 states 6, 21, 107 steps; 4, 5, 13 ones (as published)
the list [7, 6, 3, 3, 0] d = 5,040, c has 21 digits; β(c, d, i) gives back [7, 6, 3, 3, 0]
Gödel number of ∀x(x+0=x) 115 digits, decoded back to ∀x(x+0=x)
Löb's axiom, Gödel II as a formula valid on all 242 GL frames with at most 4 worlds
reflection, []p -> p fails on frame number 1: soundness is not provable
Six steps is the most any halting two-state machine takes, but the search alone cannot show that the 10,952 machines still running never halt: that needs a proof for each, which is why BB is not computable.
The code (91 lines; it asserts its own result)
"""Lab 7: run every two-state Turing machine, check the champions, and test Löb's axiom on every small GL frame."""
import numpy as np
from videos.coursekit import labs
from explainer.philosophy.reasoner import arith
TITLE = "Busy beavers, the β-function and provability logic, computed"
GOAL = ("Run all 20,736 two-state Turing machines and compare the longest halting run with the published busy beaver "
"number; code a random list with Gödel's β-function; and check on every finite GL frame with up to four "
"worlds that Löb's axiom and the second incompleteness theorem hold while reflection fails.")
TASKS = [
"Raise CAP from 50 to 200. Does any further machine halt? Explain why that is evidence and not yet a proof.",
"Run arith.CHAMPIONS[5] with arith.run_tm_fast and confirm 47,176,870 steps and 4,098 ones (a few seconds).",
"Check the formula '[]p -> [][]p' with arith.gl_valid, then '[][]p -> []p'. Which one does GL prove, and why?",
]
CAP = 50
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
# every two-state machine, run from a blank tape
halt_steps, running = [], 0
for tm in arith.all_machines(2):
r = arith.run_tm(tm, CAP)
if r["halted"]:
halt_steps.append(r["steps"])
else:
running += 1
halt_steps = np.array(halt_steps)
total = len(halt_steps) + running
search = arith.busy_beaver_search(2, CAP)
lab.row("two-state machines", f"{total:,} (12 choices for each of 4 rules: 12^4 = {12 ** 4:,})")
lab.row(f"halt within {CAP} steps", f"{len(halt_steps):,} still running: {running:,}")
lab.row("longest halting run, most ones", f"{search['max_steps']} steps, {search['max_ones']} ones (Radó 1962: 6, 4)")
assert total == 12 ** 4 == search["machines"] and len(halt_steps) == search["halting"] == 9784
assert halt_steps.max() == search["max_steps"] == 6 and search["max_ones"] == 4
# the champions, simulated
published = {2: (6, 4), 3: (21, 5), 4: (107, 13)}
for n, (steps, ones) in published.items():
r = arith.run_tm(arith.parse_tm(arith.CHAMPIONS[n]))
assert r["halted"] and (r["steps"], r["ones"]) == (steps, ones), n
lab.row("champions for 2, 3, 4 states", "6, 21, 107 steps; 4, 5, 13 ones (as published)")
# Gödel's beta function on a random list, and a formula numbered and decoded
seq = [int(a) for a in rng.integers(0, 12, size=int(rng.integers(3, 6)))]
c, d = arith.beta_code(seq)
decoded = [arith.beta(c, d, i) for i in range(len(seq))]
assert decoded == seq
moduli = [1 + (i + 1) * d for i in range(len(seq))]
assert all(np.gcd(a, b) == 1 for i, a in enumerate(moduli) for b in moduli[i + 1:]), "pairwise coprime moduli"
lab.row(f"the list {seq}", f"d = {d:,}, c has {len(str(c))} digits; β(c, d, i) gives back {decoded}")
formula = "∀x(x+0=x)"
g = arith.godel_number(formula)
assert arith.godel_decode(g) == formula and arith.godel_number("0=0") == 2 ** 21 * 3 ** 15 * 5 ** 21
lab.row(f"Gödel number of {formula}", f"{len(str(g))} digits, decoded back to {arith.godel_decode(g)}")
# provability logic on every finite GL frame with up to four worlds
verdict = {k: arith.gl_valid(arith.GL_FACTS[k]) for k in ("lob", "second", "reflection")}
assert verdict["lob"] == (True, 242) and verdict["second"] == (True, 242) and not verdict["reflection"][0]
lab.row("Löb's axiom, Gödel II as a formula", f"valid on all {verdict['lob'][1]} GL frames with at most 4 worlds")
lab.row("reflection, []p -> p", f"fails on frame number {verdict['reflection'][1]}: soundness is not provable")
lab.note = ("Six steps is the most any halting two-state machine takes, but the search alone cannot show that the "
f"{running:,} machines still running never halt: that needs a proof for each, which is why BB is not "
"computable.")
fig, ax = labs.figure(2, size=(11, 4.4))
from matplotlib.colors import ListedColormap
counts = np.bincount(halt_steps, minlength=8)[1:8]
ax[0].bar(np.arange(1, 8), counts, color=labs.BLUE, label="machines halting at exactly this step")
for k, v in enumerate(counts, start=1):
ax[0].text(k, v + 80, f"{v:,}", ha="center", color=labs.INK, fontsize=9)
ax[0].annotate("BB(2) = 6: the last step\nat which any machine halts", xy=(6, counts[5] + 350), xytext=(4.6, counts.max() * 0.55),
color=labs.GOLD, ha="center", arrowprops=dict(arrowstyle="->", color=labs.GOLD))
ax[0].set_axisbelow(True)
ax[0].set(title=f"All {total:,} two-state machines: when the halting ones halt", xlabel="step at which the machine halts",
ylabel="machines", ylim=(0, counts.max() * 1.25))
ax[0].legend(loc="upper right")
rows = arith.space_time(arith.CHAMPIONS[4], 107)
grid = np.array([r[0] for r in rows], dtype=float)
ax[1].imshow(grid, aspect="auto", cmap=ListedColormap([labs.PANEL, labs.GOLD]), interpolation="nearest", vmin=0, vmax=1,
extent=(-0.5, grid.shape[1] - 0.5, len(rows) - 0.5, -0.5))
ax[1].plot([r[1] for r in rows], np.arange(len(rows)), color=labs.BLUE, lw=1.2, label="the head")
ax[1].grid(False)
ax[1].set(title="Brady's four-state champion: 107 steps, 13 ones", xlabel="tape cell", ylabel="step")
ax[1].legend(loc="lower left")
lab.fig = fig
return lab
Now change it
- Raise CAP from 50 to 200. Does any further machine halt? Explain why that is evidence and not yet a proof.
- Run arith.CHAMPIONS[5] with arith.run_tm_fast and confirm 47,176,870 steps and 4,098 ones (a few seconds).
- Check the formula '[]p -> [][]p' with arith.gl_valid, then '[][]p -> []p'. Which one does GL prove, and why?
Problems, with solutions
Try each problem before opening its solution.
-
MIU. Derive
MIIIII' (five I's) in MIU; then show thatMUIIIU` is not a theorem.Solution
MI →(2) MII →(2) MIIII →(2) MIIIIIIII →(1) MIIIIIIIIU →(3) MIIIIIUU →(4) MIIIII. (The Reasoner's breadth-first search finds this six-step derivation.) MUIIIU has three I's, a multiple of three, so the invariant of Chapter 1 rules it out. In fact a string Mx is a theorem exactly when its number of I's is not a multiple of three.
-
1 × 2 = 2 in Q. Using \(Q\)'s axioms only, derive \(1 \times 2 = 2\), naming the axiom at each step.
Solution
S0 × SS0 = (S0 × S0) + S0 (Q7) = ((S0 × 0) + S0) + S0 (Q7) = (0 + S0) + S0 (Q6) = S(0 + 0) + S0 (Q5) = S0 + S0 (Q4) = S(S0 + 0) (Q5) = SS0 (Q4). Seven steps; the Reasoner's
q_stepsgives the same. -
Remainders. Find the least \(x\) with \(x \equiv 1 \pmod 4\), \(x \equiv 2 \pmod 5\), \(x \equiv 3 \pmod 7\); then code the list \(1, 2, 3\) with \(\beta\).
Solution
x ≡ 1 (mod 4), x ≡ 2 (mod 5), x ≡ 3 (mod 7): x = 17 (and 17 + 140k). To code 1, 2, 3 with β, take s = 3, d = 3! = 6; the moduli 1 + d = 7, 1 + 2d = 13, 1 + 3d = 19 are pairwise coprime, and the Chinese remainder theorem gives c = 288: 288 mod 7 = 1, 288 mod 13 = 2, 288 mod 19 = 3.
-
PA ⊢ Con(PA) → G. Prove from the derivability conditions that \(\mathrm{PA} \vdash \mathrm{Con}(\mathrm{PA}) \to G\).
Solution
Write □ for Prov. G ↔ ¬□G gives PA ⊢ G → ¬□G, so by D1 and D2, PA ⊢ □G → □¬□G. By D3, PA ⊢ □G → □□G. Together, PA ⊢ □G → □(□G ∧ ¬□G), and since □G ∧ ¬□G → ⊥ is provable, D1 and D2 give PA ⊢ □G → □⊥. Contraposing: PA ⊢ ¬□⊥ → ¬□G, that is, Con(PA) → G.
-
Equivalence is undecidable. Use Rice's theorem to show that no program decides whether two programs compute the same function.
Solution
Fix any program P₀. "Computes the same function as P₀" is a property of what a program does, and it is non-trivial (P₀ has it; a program computing a different function does not). By Rice's theorem it is undecidable. A decider for "do P and Q compute the same function?" would decide it, by taking Q = P₀; so there is none.
-
(Essay) Minds and machines. (Essay) Does Gödel's theorem show that minds are not machines? Defend an answer against Lucas or against Benacerraf.
Solution
A strong answer uses Chapter 16's Price List. For Lucas: say what grounds our knowledge that our own system is consistent, given that we have believed inconsistent things before (naive set theory, Part 6). For Benacerraf: say whether we could be a machine we cannot identify, and whether that is a coherent picture of mathematical knowledge. Either way, note Gödel's disjunction: the theorems leave open both a mind beyond machines and absolutely unsolvable problems.
Notes and sources
Sources
Books: Smith, An Introduction to Gödel's Theorems (2nd ed., 2013); Boolos, Burgess and Jeffrey, Computability and Logic (5th ed., 2007), chs. 15–18; Boolos, The Logic of Provability (1993); Franzén, Gödel's Theorem: An Incomplete Guide to Its Use and Abuse (2005); Hofstadter, Gödel, Escher, Bach (1979); Simpson, Subsystems of Second Order Arithmetic (1999); Li and Vitányi, An Introduction to Kolmogorov Complexity and Its Applications (3rd ed., 2008); Kaye, Models of Peano Arithmetic (1991); Davis (ed.), The Undecidable (1965).
Papers and texts: Sunzi Suanjing (c. 400); Qin Jiushao, Shushu Jiuzhang (1247); Dedekind (1888); Peano (1889); Hilbert, "Mathematical problems" (1900), "On the infinite" (1926) and the Königsberg address (1930); Russell (1906); Hilbert and Ackermann (1928); Ackermann (1928); Ramsey (1930); Gödel (1931; Gibbs lecture 1951); Tarski (1933); Carnap (1934); Skolem (1934); Péter (1935); Turing (1936; 1947 lecture); Church (1936); Post (1936); Rosser (1936); Gentzen (1936, 1943); Kleene (1938); Hilbert and Bernays, Grundlagen der Mathematik II (1939); Robinson (1950); Henkin (1952); Rice (1953); Löb (1955); Tennenbaum (1959); Lucas, "Minds, machines and Gödel" (1961); Radó (1962); Quine, "The ways of paradox" (1962); Lin and Radó (1965); Kolmogorov (1965); Benacerraf, "God, the Devil, and Gödel" (1967); Matiyasevich (1970); Chaitin (1974, 1975); de Jongh (1975) and Sambin (1976); Solovay (1976); Paris and Harrington (1977); Gandy (1980); Kirby and Paris (1982); Brady (1983); Marxen and Buntrock (1989); Penrose (1989, 1994); Shor (1994); Robertson and Seymour (2004); Cook (2004); Yedidia and Aaronson (2016); Aaronson, "The busy beaver frontier" (2020); the Busy Beaver Challenge (2024).
About this partfrom its README
Part 7 of Philosophy, Built (series plan, syllabus): Gödel, Turing, Tarski and Löb. Hilbert's program and a formal system to play (MIU); Robinson's Q and Peano arithmetic, axiom by axiom, and their nonstandard models; primitive recursion and Ackermann's function; the Chinese remainder theorem, from Master Sun to Gödel's β-function; Gödel numbering; quines, Quine's sentence and the diagonal lemma; the first incompleteness theorem, Rosser's sentence, the truth of G and Hilbert's tenth problem; the second theorem, the derivability conditions and the logic GL; Turing machines and busy beavers to BB(5); the Church–Turing thesis and Rice's theorem; Ramsey, Paris–Harrington and natural independence; Berry's paradox, Chaitin and Ω; Tarski's undefinability of truth and the definability of partial truth; Löb's theorem and the fixed points of provability logic; Lucas, Penrose and Gödel's disjunction; Gentzen's consistency proof, ordinal analysis and reverse mathematics. Its brick in the Wall is "Gödel": incompleteness, undecidability, undefinability and Löb, one diagonal argument. Its Price List is minds and machines: mechanism, knowledge of our own consistency, and consistency itself.
Every derivation, code, number, run and check on screen is computed by the Reasoner's arithmetic module
(explainer/philosophy/reasoner/arith.py: Robinson's Q as a rewriting system, primitive recursive combinators and
Ackermann's function, the Chinese remainder theorem and Gödel's β-function, Gödel numbering both ways, a quine and the
diagonal sentence checked, Hofstadter's MIU, a Turing-machine simulator fast enough for the five-state champion, an
exhaustive two-state busy beaver search, R(3,3) by brute force, shortest names in a toy language, a truth predicate for
bounded sentences, and provability logic on every finite GL frame), tested in tests/philosophy/test_arith.py and
cached by compute.py.
Chapter notes
| # | Scene | What it establishes | Computed on screen |
|---|---|---|---|
| 0 | Hook |
Königsberg, 7–8 September 1930: Gödel's announcement and Hilbert's "we must know"; Hilbert's three wishes and who took each; the plan. | — |
| 1 | Program |
formalism and metamathematics (Hilbert, Bernays, Ackermann; the Entscheidungsproblem, 1928); Hofstadter's MIU (1979); the mod-3 invariant: a proof about a system. | MIU's theorems to depth 3 as a tree; 1,730 theorems within seven steps, none of them MU |
| 2 | Arith |
Robinson's Q (1950), axiom by axiom; Q computes; Q cannot prove ∀x (0 + x = x); induction (Dedekind 1888, Peano 1889) and PA; nonstandard models (Skolem 1934), Tennenbaum (1959). | 2 + 2 = 4 in three steps and 2 × 2 = 4 in nine, each step an axiom of Q |
| 3 | Recursion |
the five combinators; primitive recursion; Ackermann (1928) and Péter; the diagonal against the primitive recursive functions; representability and Σ₁-completeness. | add, mul, exp, pred, fact as combinator trees, with sizes and values; A(m, n) for m ≤ 3, A(4, 1) = 65,533, A(4, 2) with 19,729 digits |
| 4 | Beta |
why recursion needs lists; Sunzi's problem (c. 400) and Qin Jiushao (1247): the Chinese remainder theorem; Gödel's β-function. | 23 found by sieving; the list 2, 3, 5 coded as c = 5,482,512, d = 120, and decoded |
| 5 | Numbering |
codes for symbols; a formula as a product of prime powers; decoding by factoring; proofs as numbers; Form, Prf, Prov. | ⌜0 = 0⌝ = 2²¹·3¹⁵·5²¹; ∀x(x + 0 = x) decoded from its 115-digit number; a two-line proof's number has about 10⁶⁸ digits |
| 6 | Diagonal |
the regress of naive self-reference; quines and Kleene's recursion theorem (1938); Quine's sentence (1962); the diagonal lemma (Gödel 1931, Carnap 1934), proved. | a Python quine run and compared; Quine's sentence and a Gödel-style sentence checked to refer to themselves |
| 7 | First |
G ↔ ¬Prov(⌜G⌝); the proof, with ω-consistency; Rosser (1936); G is true; Hilbert's tenth problem and MRDP (1970). | — |
| 8 | Second |
Con(PA); PA ⊢ Con → G; Gödel II; the derivability conditions (Hilbert–Bernays 1939, Löb 1955); GL; the Wall's seventh brick. | ¬□⊥ → ¬□¬□⊥ on all 242 finite GL frames with up to four worlds |
| 9 | Turing |
Turing's analysis of the human computer (1936); Church, Post; a two-state machine run; space–time diagrams; the universal machine. | the two-state champion step by step; Brady's four-state machine, all 107 steps |
| 10 | Beavers |
Radó's busy beaver (1962); why BB is uncomputable; the champions; bbchallenge (2024); cryptids, Goldbach and Riemann machines; Yedidia–Aaronson (2016) and the ZFC frontier. | all 20,736 two-state machines run: 9,784 halt, at most 6 steps and 4 ones; the champions for 2–5 states, with BB(5) = 47,176,870 and 4,098 ones |
| 11 | Thesis |
the convergence of definitions; the Church–Turing thesis; what it does not say (Gandy 1980, Shor 1994); Rice's theorem (1953). | — |
| 12 | Ramsey |
Ramsey (1930) and R(3,3) = 6; Paris–Harrington (1977); Kruskal and TREE(3) (Friedman); the graph minor theorem. | all 1,024 colourings of K₅ (12 without a one-coloured triangle) and all 32,768 of K₆ (none) |
| 13 | Berry |
Berry's paradox (Russell 1906); a toy language and its shortest names; Kolmogorov complexity; Chaitin's theorem (1974); Ω (1975) and Franzén's caution. | the shortest names of 1–300; the least numbers with no name of 3, 5, 7 symbols: 19, 92, 239 |
| 14 | Tarski |
the undefinability of truth (1933); partial truth predicates; truth and proof apart. | four bounded sentences decided by the Reasoner's Δ₀ truth predicate |
| 15 | Lob |
Henkin's question (1952); Löb's theorem (1955) in nine lines; Gödel II as a corollary; the fixed points of GL (de Jongh, Sambin), Solovay (1976). | Gödel's and Henkin's fixed points and their uniqueness, on all 242 finite GL frames |
| 16 | Minds |
Lucas (1961) and Penrose (1989, 1994); Price List: minds and machines (Benacerraf 1967, Putnam, Feferman; Turing 1947); Gödel's disjunction (1951); Franzén's misuses (2005). | the MUS {M, K, C} and its three corrections |
| 17 | Gentzen |
Gentzen's consistency proof (1936) and its ε₀; ordinal analysis; reverse mathematics and the Big Five (Friedman, Simpson); what became of Hilbert's program. | — |
| 18 | Outro |
recap; the Reasoner's arithmetic module; the Wall; problems; payoffs; references. | — |
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hilbert's program (1921–28): finitary consistency proofs; the Entscheidungsproblem.
- Robinson's Q and Peano arithmetic, axiom by axiom.
- Representability: primitive recursive functions, Σ₁ formulas, β-function coding (sketch).
- Gödel numbering: a formula becomes a number. Built: it encodes and decodes a proof, live.
- The diagonal lemma, with the quine as its program-level twin. Built: a Python quine and a self-describing sentence.
- The first incompleteness theorem: G ↔ ¬Prov(⌜G⌝), proved; Rosser's improvement.
- The second incompleteness theorem: Con(PA) is unprovable in PA; the Hilbert–Bernays derivability conditions.
- Turing machines (1936): built, with a busy-beaver champion running on screen.
- The halting problem by diagonalization; Rice's theorem; the Church–Turing thesis (and what it does and doesn't say).
- Busy beavers: BB(4) = 107 steps; BB(5) = 47,176,870, proved by the bbchallenge collaboration in Coq (2024). BB(n) eventually escapes ZFC (Yedidia and Aaronson 2016; later improvements).
- Natural independence: Goodstein's theorem and the hydra (Kirby–Paris 1982; the sequences are computed in Part 6), Ramsey's R(3,3) = 6 by brute force, Paris–Harrington.
- Chaitin's Ω and incompleteness from information (the Berry paradox formalized).
- Tarski's undefinability of truth (1933/36), proved from the diagonal lemma (bridge to Part 8).
- Löb's theorem (1955) and provability logic GL; Solovay's completeness (1976). GL is checked on finite
irreflexive transitive trees with
reasoner.modal. - Consequences claimed and contested: Lucas–Penrose on minds vs machines and the standard replies (Benacerraf, Feferman, Shapiro); Franzén's catalogue of misuses.
- Proof theory's answer: Gentzen's consistency proof of PA by induction to ε₀ (Part 6's spiral); ordinal analysis.
- Recap and Problems.
Built: reasoner.arith (Robinson's Q as a rewriting system, Gödel numbering, quines, a Turing-machine simulator,
small busy beavers, R(3,3) by brute force).
Wall: Gödel I and II; the halting problem; Tarski; Löb.
Visuals: the diagonal lemma as a loop of mirrors; the Turing tape; the busy beavers' space–time diagrams;
GL's frames as finite trees.
References: Smith, An Introduction to Gödel's Theorems; Boolos–Burgess–Jeffrey chs. 15–18; Boolos, The Logic of
Provability; Franzén, Gödel's Theorem: An Incomplete Guide; Aaronson, "The Busy Beaver Frontier" (2020).
中文讲义
本讲的中文部分(与英文版对应)。
习题与解答
-
MIU。 在MIU中推出
MIIIII(五个I); 再证明MUIIIU不是定理。解答
MI →(2) MII →(2) MIIII →(2) MIIIIIIII →(1) MIIIIIIIIU →(3) MIIIIIUU →(4) MIIIII。(推理机的广度优先搜索找到了这个 六步推导。)MUIIIU有三个I,是3的倍数,所以第1章的不变量排除了它。事实上,一个串Mx是定理,恰好当其中I的个数不是3的倍数。
-
在Q中推出1 × 2 = 2。 只用\(Q\)的公理推出\(1 \times 2 = 2\), 每一步注明所用公理。
解答
S0 × SS0 = (S0 × S0) + S0(Q7)= ((S0 × 0) + S0) + S0(Q7)= (0 + S0) + S0(Q6)= S(0 + 0) + S0(Q5)= S0 + S0(Q4)= S(S0 + 0)(Q5)= SS0(Q4)。共七步;推理机的
q_steps给出同样的结果。 -
余数。 求满足\(x \equiv 1 \pmod 4\)、 \(x \equiv 2 \pmod 5\)、 \(x \equiv 3 \pmod 7\)的最小\(x\); 再用\(\beta\)编码列表\(1, 2, 3\)。
解答
x ≡ 1 (mod 4),x ≡ 2 (mod 5),x ≡ 3 (mod 7):x = 17(以及17 + 140k)。要用β编码1, 2, 3,取s = 3,d = 3! = 6; 模数1 + d = 7、1 + 2d = 13、1 + 3d = 19两两互素,中国剩余定理给出c = 288:288 mod 7 = 1,288 mod 13 = 2,288 mod 19 = 3。
-
PA ⊢ Con(PA) → G。 由可推导性条件证明\(\mathrm{PA} \vdash \mathrm{Con}(\mathrm{PA}) \to G\)。
解答
把Prov写成□。由G ↔ ¬□G得PA ⊢ G → ¬□G,于是由D1和D2,PA ⊢ □G → □¬□G。由D3,PA ⊢ □G → □□G。 合起来,PA ⊢ □G → □(□G ∧ ¬□G);而□G ∧ ¬□G → ⊥是可证的,所以由D1和D2得PA ⊢ □G → □⊥。取逆否:PA ⊢ ¬□⊥ → ¬□G,即 Con(PA) → G。
-
等价性不可判定。 用赖斯定理证明:没有程序能判定两个程序是否计算同一个函数。
解答
固定任一程序P₀。“与P₀计算同一个函数”是关于程序做什么的性质,而且是非平凡的(P₀有,计算别的函数的程序没有)。 由赖斯定理,它不可判定。一个判定“P与Q是否计算同一个函数”的程序,取Q = P₀就能判定它;所以这样的程序不存在。
-
(论述题)心灵与机器。
解答
好的回答利用第16章的代价清单。若站在卢卡斯一边:要说明我们凭什么知道自己的系统是一致的,毕竟我们以前就相信 过不一致的东西(朴素集合论,第6部分)。若站在贝纳塞拉夫一边:要说明我们是否可能是一台自己无法辨认的机器,以及这是否是一幅融贯的数学 知识图景。无论哪种,都要注意哥德尔的析取:这些定理既没有排除超越机器的心灵,也没有排除绝对不可解的问题。
Build the film
python -m videos.philosophy.philosophy7.compute # the part's numbers, into .cache/philosophy7
python tools/build.py philosophy7 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py philosophy7 Hook # one chapter, silent, with a contact sheet
Scenes: videos/philosophy/philosophy7. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.philosophy.philosophy7.compute # every computed item (about ten seconds; cached in .cache/philosophy7)
python tools/build.py philosophy7 -q l # 480p preview
python tools/build.py philosophy7 # 1080p30 -> renders/philosophy7.mp4
python tools/qa_scene.py philosophy7 Beavers # one chapter, silent, with a contact sheet