Put yourself back in the schoolroom. The teacher writes on the board the rules for adding, multiplying and taking powers of positive whole numbers, eleven of them:1
With them you can prove , and every other identity you were set as homework. A student at the back asks the obvious question. Do these rules settle every identity that is true of the positive whole numbers? If an equation between two expressions in , , , , and powers holds whatever numbers are put for the letters, can it always be derived from the eleven?
The question is Tarski’s, and it waited more than a decade for an answer. The answer is no. Here is an identity, found by Wilkie, in which , , and :
It is true for every pair of positive whole numbers and . The reason is a hidden common factor: and , so that is times , and in the same way is times . Both sides are then the same product, written in a different order. But the factor has a minus sign in it, and the eleven rules have no subtraction. The identity is true, and the rules cannot derive it.
How can anyone know that the rules cannot derive it? Not by trying and failing, since failing to find a derivation proves nothing. The way to show that something does not follow from rules is to exhibit a world in which the rules hold and the claim fails. For Wilkie’s identity the smallest such world has twelve elements, and its tables for addition, multiplication and powers obey all eleven rules. In 2026 a computer proved, with a SAT solver, that no smaller one exists.
Adding Wilkie’s identity to the board does not end the matter: no finite list of identities, however long, derives every true one. There is no last patch.
The schoolroom is a small version of a large hope. For two thousand years Euclid’s geometry was the model of knowledge: a few axioms, and every truth of the subject derived from them. In 1899 Hilbert rewrote the axioms of geometry so that every assumption was written down. He hoped for the same in arithmetic, the study of the counting numbers with addition and multiplication: axioms from which every truth about the numbers could be derived.
In the counting numbers every statement that can be written down is true or false: that is what the definition of truth in a structure says. Goldbach’s conjecture, that every even number greater than is a sum of two primes, can be written as one sentence of first-order logic. Nobody knows whether it is true or false. If there were axioms from which every true statement about the numbers could be derived, then Goldbach’s conjecture or its negation would be derivable, and settling it would be a matter of searching.
On 8 September 1930, in Königsberg, Hilbert gave an address that ended with the words Wir müssen wissen. Wir werden wissen. (We must know. We shall know.) They are on his grave. On the day before, at a round table at a conference in the same city, a young logician from Vienna, Kurt Gödel, had announced a theorem that showed the hope to be mistaken.
Two questions about theories and programs have been left open so far. They are the questions of this chapter. The first is about searching. The first-order procedure REFUTE (Theorem 7.63) certifies every entailment that holds, and runs for ever on some that do not. Is that a fault of the procedure, which a cleverer search would repair?
The second question is about describing. Even a perfect oracle for “does this follow from the theory?” tells us only what follows from the theory. What we wanted was what is true of the system it describes. The two agree only when the theory says everything about the system: can it always be chosen so? Call the two questions, about searching and about describing, the search gap and the specification gap.
This chapter shows that neither gap can be closed in general, and that one construction answers both questions: the rules by which programs run can be written down as sentences.
The plan has four steps. First, Section 8.1 makes the specification gap precise: a specification captures a structure when it proves exactly the sentences true there, and then a program can decide every question about the structure. Section 8.2 shows that every finite structure can be captured. Second, the search gap. Section 8.3 shows that no program decides whether a program halts, and writes the rules by which programs run as a theory, so that Section 8.4 can carry the result into logic: no program decides first-order validity. Third, the specification gap for the counting numbers. Section 8.5 shows that halting can be expressed in arithmetic, so no program decides arithmetic and no specification captures it, and Section 8.6, the first incompleteness theorem, names, for any sound specification, a true sentence that it does not prove. Fourth, a limit of specifications that does not depend on the structure we meant at all. Section 8.7, the second incompleteness theorem, shows that a consistent specification of arithmetic does not entail its own consistency: some sentences about a specification do not follow from it in first-order logic. The two optional sections prove in full that halting can be expressed (Section 8.8) and ask which infinite structures can be captured (Section 8.9).
8.1 Specifications
We describe a system, a structure , by a theory , and we want the sentences that follow from to be exactly the sentences true of . To say this precisely we need a name for the set of truths of , a condition that makes a theory usable, and a meaning for “exactly”. One fact then makes the question sharp: a theory that does the job lets a program decide the truths of .
Definition 8.1 (the theory of a structure). The theory of a structure is the set of everything true of it.
Formally, for a -structure ,
For every sentence , exactly one of and is in , since exactly when : a structure takes a side on every question its language can ask. That is what distinguishes a structure from a theory, which may leave a question open.
A theory has to be one that someone can use. That asks for one thing more than a set of sentences: a program that recognises its members. Until Section 8.3 makes the word exact, a program is anything that could be written in pseudocode: it takes an input, takes steps one at a time, and may or may not stop.
Definition 8.2 (specification). A specification is a theory that a checker can read: given any sentence, it can tell whether the sentence belongs to the theory.
Formally, let be a finite signature. Its sentences are then finite strings of symbols from a finite list, once each variable is written as followed by digits. A -theory is a specification if there is a program that, given a -sentence, always halts and says whether it is in .2
The examples are the sets one would naturally write down.
A finite set of sentences is a specification: the program compares the given sentence with each of them.
The equality axioms of a signature that contains (Definition 6.36 of Chapter 6 defines them for any signature) are a specification. They are (Eq1), which says that everything is equal to itself, and the instances of (Eq2), which say that equals may be put for equals in a formula. There are infinitely many instances, one for each formula, but a program recognises an instance by its shape.
In the same way, every finite set of sentences together with all the instances of finitely many schemas is a specification.
The definition asks for a program because a theory whose members nobody can recognise is no use as a specification. The point of a derivation from is that anyone can check it, and checking it includes checking that its open hypotheses are in .
The set is a set of sentences, and so “take all the true ones” looks like the best specification of there could be. Whether it is one depends on whether a program can recognise the true sentences. For the counting numbers it cannot, as Section 8.5 shows. “All the true ones” describes a set; it does not give a checker.
Definition 8.3 (captures). A specification captures a structure when what follows from it is exactly what is true of the structure.
Formally, a specification captures a -structure if, for every -sentence ,
The definition has two halves, of very different weight.
Only truths: if then . When this half is free, by the soundness of .
Every truth: if then . This is the half with content: it asks the theory to settle every question that the structure settles.
Remark 8.4 (two senses of “complete”). The second half is often called completeness of , and the word has been used before. The completeness of is a property of the proof system: whatever is true in every model of can be derived from . The second half of capturing is a property of the theory: whatever is true in the one structure we meant can be derived from . When every sentence true in is true in every model of , the completeness of gives the second half of capturing. The gap between the two senses is the specification gap.
To keep the two senses apart we say “captures”, and never “complete”, for the property of a theory.
Example 8.5 (the schoolroom). Take the signature with a constant and two-place function symbols , and , where is , and let be the positive integers with their usual operations. Let be the equality axioms together with the eleven identities on the board, each with in front of its variables. The set is a specification, and , so it proves only truths.
It does not prove every truth. Write for Wilkie’s identity with in front. The sentence is true in , and . The certificate is a structure: twelve elements, with tables for , , and , in which all eleven identities hold and Wilkie’s identity fails at one pair of elements , .3 Were provable from , the soundness of would make it true in that structure.
Remark 8.6 (at work: a counter-model found by a SAT solver). The twelve-element structure of the introduction, in which the eleven identities hold and Wilkie’s identity fails, consists of three tables of a hundred and forty-four entries each. Tables like these are not found by hand. The encoding has one propositional letter for each possible entry of each table, clauses saying that each entry has exactly one value, and clauses for the eleven laws and for the failure of the twelfth. In 2026 a SAT solver listed the smallest counter-models, and said “no” for eleven elements: about seventy-five thousand letters and four and a half million clauses. The “no” came with a checkable proof, megabytes long, which an independent program verified.4 Both kinds of certificate appear here: a structure, which anyone can check by plugging in, certifies that a sentence does not follow; a closed search, written down as a proof, certifies that no smaller structure does.
A specification that misses a truth does not show that no specification captures the structure. The identities true of the positive integers with , , and powers can be decided by a program.5 So the set of all of them is itself a specification, from which every true identity follows at once. What fails at school is every finite list, the eleven identities in particular. For the counting numbers, with , and the quantifiers, no specification at all will do, finite or infinite.
Proving that no specification will do means knowing what any specification can do. It can at least produce its theorems, one after another, because a derivation is a finite string that a checker can read.
Lemma 8.7 (a specification’s theorems can be listed). For every specification there is a program that runs for ever and prints sentences, such that the sentences it prints are exactly the sentences with .
Proof. A derivation of is a finite tree of formulas, and can be written out as a string of symbols. The program tries every string.
procedure LIST -- prints the theorems of Theta
for each string w, shortest first, then in alphabetical order:
if w is a derivation of NK,
each open hypothesis of w is in Theta,
and the conclusion of w is a sentence:
print the conclusion of w
Each test halts: a derivation is checked node by node against the finitely many rules and their side conditions, and membership of is asked of the program for . So every string is dealt with in finite time. A sentence with has a derivation, which is some string, and is printed when LIST reaches it. A sentence that is not derivable is never printed. □
Proofs are easy to check and hard to find, and a program that checks every candidate finds them all, eventually. The list says nothing about a sentence that is not on it, however long one waits, and that is the whole difficulty.
Theorem 8.8 (capturing makes truth decidable). If a specification captures a structure , there is a program that, given a sentence , always halts and says correctly whether .
Proof. The program waits for or its negation to be printed.
procedure DECIDE(phi) -- phi a sentence
for each theorem psi of Theta, as LIST prints them:
if psi is phi: answer yes
if psi is the negation of phi: answer no
It halts: either or , and proves every truth about , so one of the two is printed. Its answer is correct.
If is printed, then . Since captures , it proves only truths, so , and the answer is yes.
If is printed, then in the same way , and the answer is no.
□
A specification that captures a structure turns truth into computation. Read backwards, the theorem is a way to show that a structure cannot be captured:
The theorem has a converse, and together they say that capturing and deciding are the same thing.
Proposition 8.9 (capturing is deciding). A structure is captured by some specification if and only if some program, given a sentence , always halts and says correctly whether .
Proof. One direction is the theorem that capturing makes truth decidable. For the other, suppose a program decides the truths of . Then is a specification, and it captures .
Only truths. Whatever it proves is true, by the soundness of , since .
Every truth. Whatever is true is a member, and so is proved by the derivation consisting of that one hypothesis.
□
What a good specification adds is economy: a short list that a person can write, read and argue about, in place of the list of every truth.
Remark 8.10 (deciding with REFUTE). The program DECIDE searches through derivations, which is slow. The first-order procedure REFUTE (Theorem 7.63) does the same job faster. It stops on a clause set exactly when the set is unsatisfiable. So if a specification that captures can be written as a finite set of clauses, then for a sentence , REFUTE stops on exactly when , and on exactly when . Run it on both sets, taking a step of each run in turn. One of and is true in and, because captures , is entailed by . So one of the two runs must stop, and which one says whether .
8.2 Finite Structures
Finite structures are the one kind for which the specification gap can always be closed.
On a finite structure, the definition of truth is itself an algorithm: each quantifier runs through the domain, and a sentence with nested quantifiers on elements takes about cases. So the truths of a finite structure, for a finite signature, can be decided. A structure whose truths can be decided is captured by the set of all its truths, by the proposition that capturing is deciding, and so every finite structure can be captured.
That specification is the list of all the truths, which is infinite and of no use to anyone. This section shows that a finite list will do, and that it is the list one would write down anyway: give each element a name, and copy out the tables.
Definition 8.11 (the description of a finite structure). The description of a finite structure names each element and says, in sentences, everything its tables say.
Formally, let be a finite signature that contains , and let be a -structure with the finite domain that interprets as identity. Let be with a new constant for each element , and let be with each interpreted as , so that forgetting the new constants gives back : . The description of is the set of the following -sentences.
Distinctness: for each pair of different elements , , one sentence per pair.
Closure: .
The function tables: whenever , for each function symbol of (a constant of counting as a function symbol with no arguments).
The relation tables: if the tuple is in , and if it is not, for each relation symbol other than and each tuple of elements.
The description is finite, since the signature and the domain are. Together with the equality axioms for , it is therefore a specification.
Theorem 8.12 (finite structures can be captured). For every finite signature that contains and every finite -structure that interprets as identity, the equality axioms for , together with the description , capture .
In words: say who is there, that they are different, that there is nobody else, and every entry of every table; then everything true has been said.
Proof. Under the closure sentence every universal quantifier becomes a finite conjunction and every existential quantifier a finite disjunction, and what remains are entries of the tables. In detail, write for the equality axioms together with . Then : by construction, and satisfies the equality axioms since it interprets as identity. So proves only truths, by the soundness of . For the other half we show that, for every sentence ,
The proof is by induction on the number of connectives and quantifiers in . The induction can be on this number because writing a constant for a variable does not change it. Two facts about are used throughout.
Equality is symmetric and transitive: this follows from (Eq1) and (Eq2) (Exercise 6.8).
A derivation may replace a term by one it has proved equal to it: this is (Eq2).
First, every closed term is provably equal to the name of its value: , where is the value of in . The proof is by induction on .
A new constant . It is its own name, and is an instance of (Eq1).
A term , where is a function symbol of or a constant of (with ). The induction hypothesis gives for each , the function table gives , and (Eq2) joins them.
Now the cases of .
An atomic sentence . Replace each by the name of its value, by the fact just proved and (Eq2). The relation table contains the resulting sentence or its negation, according as makes it true or false. An equation goes the same way, to , which (Eq1) proves if is and distinctness refutes if not.
. It is false in , and , which is , has a derivation from nothing.
, , . The induction hypothesis settles and , and propositional reasoning in settles the compound as the satisfaction clause does. For instance, if is false in , then is true and false, so proves and , and with them .
, true in . Then each is true in , by the substitution lemma, and has fewer connectives and quantifiers than , so proves each of them. Take a variable not in . The closure sentence gives . In the case , (Eq2) turns into , so (E), applied to the cases, gives . Then (I) gives . The rule applies because occurs in no open hypothesis: all of them are sentences of . Finally, is with its bound variable renamed.
, false in . Then some is false, so proves . Suppose . Then (E) gives , which with gives by (E); and (I) discharges the supposition. So proves .
. The same two arguments with the roles exchanged: if it is true, one instance is proved and (I) finishes; if it is false, every instance is refuted, and the closure sentence refutes as it proved a true .
□
A -sentence is true in exactly when it is true in , so the specification proves exactly the -sentences true in .
The closure sentence is the one sentence with no counterpart for an infinite structure, since no finite list of names covers infinitely many elements. The other sentences of describe the elements that are there. The closure sentence says that there are no others, and so tells every model of it where the structure stops. Without it, a model of the remaining sentences may have an extra element, of which the tables say nothing. A sentence true in may then fail at the extra element (Exercise 8.5).
Example 8.13 (the company: a specification of Tuesday’s table). Harriet writes the specification that the theorem gives for the company on Tuesday, the structure of Chapter 6. She adds the names , , , and . The tables for and give six equations, the first of which is
Thorne, the chief executive, is her own boss, because is a function symbol and must give every person a value, Thorne included. The rest of the description is
the ten sentences of distinctness;
the closure sentence
the ten entries for and , such as and ;
the twenty-five entries for , one for each pair of people, such as and, the other way round, .
That is fifty-two sentences besides the equality axioms. Call the whole specification . By the theorem, a derivation from settles every question about Tuesday’s table that the company’s language can ask.
Example 8.14 (the company, cont’d: deciding by search). Harriet runs the procedure of Remark 8.10 on . The equality axioms go in as finitely many clauses, and the specification becomes sixty clauses.
Take for the sentence , that everybody earns less than their boss. The run with closes at level , on ground clauses, by forced moves alone, while the run with is still open. So the sentence is false: it fails at Thorne, who is her own boss. For the repaired sentence it is the other way round: the run with its negation closes at level , on ground clauses, after five decisions, and the sentence is true. Each run takes under a second.6
The cost of such a specification is plain. It is as long as the tables of the structure, since it is those tables. It captures that one structure and nothing else. When the system changes, by one new element or one changed entry, the specification is wrong and has to be written again. That is why a system that changes is described not by a table, which says everything about one state alone, but by a theory, which says what must be true of every table the system can produce.
For a system with infinitely many elements no table can be written, and only a theory is left. The rest of the chapter asks whether a theory can ever say everything.
8.3 Programs as Theories
The search gap asks about every procedure, not just about REFUTE. To answer it we need to say exactly what a procedure is, and Chapter 1 has already given an answer: a procedure is a combinator. A term built from and computes by being rewritten, and the theorem on Turing completeness (Theorem 1.18) says that combinators compute everything that any machine computes.7
The plan is short to state. Chapter 1’s four rules for a step, and its lemma on the shape of a normal form, can be written as a handful of first-order sentences, the same handful for every program. Then “the program halts” becomes “a certain sentence follows”. So whatever cannot be decided about programs cannot be decided about sentences either. Whether a program halts, as we show first, is one such thing. That no program decides it is the source of both of the chapter’s answers: Section 8.4 carries it into logic, and Section 8.5 into arithmetic.
The section takes seven things from Chapter 1, and needs nothing else from there.
Steps. A combinator steps by four rules: (), which takes to ; (), which takes to ; and () and (), which make a step in the function, or in the argument, a step of the whole application. The formula says that steps to . A run is a chain of steps, says that runs to , and a combinator that cannot step is in normal form.
The shape of a normal form (Lemma 1.7). A combinator is in normal form exactly when it is , , , or , where and are combinators in normal form.
One result at most (Corollary 1.8). A term runs to at most one normal form.
No step is a wrong turn (Corollary 1.9). If runs to a normal form , then every term that runs to also runs to .
The Monster. With and , which applies its argument to itself, the Monster is , that is, . It has no normal form: every run of it goes on for ever.
The numerals. With , the numeral of a number is given by and . The numeral of applies its first argument times to its second: runs to , with copies of .
Turing completeness (Theorem 1.18). The functions on numerals that combinators compute are exactly those that a Turing machine computes.
The booleans are recalled where they are used.
Programs
A program’s input is a combinator too, and the input for a number is its numeral. Chapter 1 wrote the numerals with a bar over the number. This chapter keeps the bar for the numerals of arithmetic, which are terms of first-order logic, and writes the numerals of the combinators with a bar beneath.
A program, in this chapter, is a combinator: a term built from and by application alone.
Definition 8.15 (halting). A combinator halts when some run of it ends.
Formally, a combinator halts if for some combinator in normal form. A program halts on the number if the combinator halts.
In words: a program halts on when, given the numeral of , it has a result. By the corollary of Chapter 1 that a term has at most one result (Corollary 1.8), the result is then unique.
Halting asks that some run ends, not that every run does. The combinator , with the Monster, halts: its step gives at once. But a run that keeps stepping inside never ends.8
Codes
We want a program to take another program as its input. Inputs are numbers, so we number the programs. A combinator is a finite string, and the string we number is the one with every application bracketed, as in the definition of terms in Chapter 1.
Definition 8.16 (the string of a combinator). The string of a combinator is the combinator written out with all its brackets.
Formally, is defined by recursion on the shape of :
For instance, is , and is .
Definition 8.17 (code). The code of a combinator is the number its string spells in base five.
Formally, the code of a combinator is the number whose digits in base are those of , read with for , for , for and for .
For instance, and . Different combinators have different strings, and so different codes. A program can compute the code of a combinator, and the combinator of a code. Base five is a choice: any numbering that a program can compute and undo would serve, and this one is the shortest to describe.
A program given a number as its input may want to ask what the program with that number does. Not every number is a code, so we let the others name a program too, one that never halts.
Definition 8.18 (the program with code ). Every number names a program: the combinator it is the code of, or a program that halts on no input if it is the code of none.
Formally, for a number , the program with code is
The second line is a convention, and any program that halts on no input would do as well. So for every combinator . The second line gives a program that halts on no input: steps to the Monster , which has no normal form, so by the corollary of Chapter 1 that no step is a wrong turn (Corollary 1.9) it has none either.
What a program cannot decide
We borrow one fact about programs from Chapter 1.
Fact 8.19 (programs are combinators). For every program written in pseudocode that takes a number as its input, there is a combinator such that, for every number , halts on exactly when the pseudocode halts on .9
The proof of the fact builds from the pseudocode by a fixed method, instruction by instruction, and we call this the translation of the pseudocode. Conversely, pseudocode can run a combinator step by step and read off its result; a combinator answers a yes-or-no question about and when runs to (yes) or (no), Chapter 1’s booleans. So a program may be given in either form. Pseudocode may also take a string as its input, such as a sentence or a derivation: a string over a finite list of symbols is read as a number in a large enough base, just as the string of a combinator is read as its code.
The first thing no program can do is the one that Chapter 1 left open: tell in advance whether a program halts.
Theorem 8.20 (halting is undecidable). No program, given numbers and , always halts and says correctly whether halts on .10
Proof. Suppose, for a contradiction, that a program does. Here is a program that uses it:
procedure P(e) -- e a number
if h says that prog(e) halts on e:
loop for ever
else: halt
By the fact that programs are combinators, has a translation, a combinator that halts on exactly the inputs on which halts. Let be its code, so that halts on exactly when does. Run on .
If halts on , then , given and , says so, and then loops for ever on .
If does not halt on , then says so, and then halts on .
Either way halts on exactly when it does not, which is impossible. So there is no such . □
Figure 8.1 draws the proof as a table. Row records, for each input , whether halts on (marked ) or runs for ever (marked ); the entries shown are made up, but every program has a row. The program runs down the diagonal and does the opposite of each entry it finds there. So its row differs from row in column , for every , and it is no row of the table. Yet has a code , and its row is row . At the entry in row and column , the two would have to differ from each other, which is the contradiction of the proof.
Computation as a theory
The halting theorem is about combinators. To carry it into logic, we write Chapter 1’s rules for a step as sentences. The sentences talk about combinators, so their signature has the constants and and a two-place function symbol for application. We write that symbol as application is written, by putting its two arguments side by side and grouping to the left, so that a combinator is also a closed term of the signature. A relation symbol will say that steps to , a relation symbol that is in normal form, and a relation symbol that halts. Call this signature : the constants and , the function symbol for application, the two-place relation symbol , and the one-place relation symbols and .
Definition 8.21 (the theory of computation). The theory of computation says, in first-order sentences, how a term steps, which terms are in normal form, and that a term halts when it is in normal form or steps to a term that halts.
Formally, the theory of computation is the set of the universal closures of the following formulas of .
Steps.
the rule ()
the rule ()
a step in the function, ()
a step in the argument, ()
Normal forms.
alone
alone
with one argument
with one argument
with two arguments
Halting.
a normal form halts
halting passes back
In words: the first group is Chapter 1’s four rules for a step, each bar read as an implication, so that a rule with nothing above the bar is a sentence on its own. The second group is the lemma on the shape of a normal form (Lemma 1.7), for combinators, read from right to left: a term of one of the shapes it lists, with its parts in normal form, is in normal form. The third says that a term halts if it is in normal form already, or if it steps to a term that halts.
For a combinator , write for the sentence , which says that halts.
The sentences for normal forms name five shapes. The obvious shortcut, , is left out, and for a good reason: it would make normal, since and are, and steps to . Two normal parts make a normal whole only when the whole is not a redex, and the three shapes that are applications, , and , are exactly the ways of avoiding one.
Two features of the definition are deliberate. The theory has no symbol for “runs to”: halting is passed back along a run one step at a time, which keeps every sentence short. And the theory is the same for every program. Only mentions , because every combinator runs by the same four rules: the program is the term, not a list of instructions.
Example 8.22 (the theory at work). The program , that is, , halts in two steps:
In any model of , its sentences force these lines, one by one:
The last line is , so . The first two lines are the run, the third recognises its result as a normal form, and the last three pass that result back to its start:
The main lemma of this section says that the sentences describe running in just the sense needed: a program halts exactly when follows from .
Lemma 8.23 (a program is a theory). For every combinator , the combinator halts if and only if .
In words: a program halts exactly when the sentence “it halts” follows from the sentences that describe computation.
Proof. The two directions use different structures.
If halts, follows. Let be a model of . Three facts about give the result.
If then , by induction on the rules that stack up to the step. A step by the rule () or () is an instance of the first or the second sentence for steps. A step by (), from to , follows by the third sentence from , which the induction hypothesis gives; () is the same with the fourth sentence.
If is a combinator in normal form then , by induction on . By the lemma on the shape of a normal form, is , , , or , with and in normal form; the induction hypothesis gives and , and the sentence for that shape gives .
Since halts, there is a run that ends in a normal form . Then , by the second fact and the first sentence for halting. And if , then , by the first fact and the second sentence for halting. Going back along the run from to gives , which is .
As was an arbitrary model of , .
If does not halt, does not follow. Let be the structure whose domain is the set of combinators, in which and mean themselves, application means application, and
Every closed term means itself in . Each sentence of is true in .
Steps. They are the four rules for a step.
Normal forms. They hold by the lemma on the shape of a normal form, read from right to left.
Halting. A combinator in normal form halts, by the run of no steps. If and halts, then halts, by the run that takes that step first.
Since does not halt, is false in . So .
□
Since is a set of sentences, the soundness and completeness of let us read the lemma with in place of : a program halts exactly when a derivation exists.
We call the structure of the second half the term structure. Its domain is the set of closed terms of and each of them means itself, as in the term structure of Chapter 6 (Definition 6.64), but its relations are chosen by what the combinators do, not by a set of sentences. It is a Herbrand structure, in the sense of Chapter 7, and it satisfies .
The first half of the proof shows that every model of makes true of each combinator that halts. It shows nothing about the other combinators, and such a structure may well be more generous: Exercise 8.8 has one in which every combinator halts. The term structure is the least generous, since it makes true of the combinators that halt and of nothing else. That is why the second half uses it.
Example 8.24 (the Monster as a theory). The Monster does not halt: it has no normal form (Chapter 1). So : the term structure is a model of and makes false. No derivation in leads from to .
The combinator contains the Monster and still halts. Three lines show that : , by the sentence at and ; , as in the example of the theory at work; and , by the second sentence for halting. The sentences never look inside .
When halts, the facts that establish follow its run step by step, and each of them is forced: it is the one literal left in an instance of a sentence of once the others are established (Example 8.22 lists them for ). So a procedure that sets forced literals, as DPLL does, can find them by itself. The sentences of , and the negation of , each have a clause form of one clause: drop the quantifiers and write each implication as a disjunction. Every one of these clauses has at most one positive literal: they are Horn clauses, the kind a logic program is made of (Remark 8.25). Give to the first-order procedure REFUTE (Theorem 7.63): by that theorem and the lemma that a program is a theory, it returns UNSAT exactly when halts, and on the Monster it runs for ever.
Remark 8.25 (at work: a logic program). The sentences of are, almost word for word, a program in Prolog, the logic programming language, with app for application:
step(app(app(k,X),Y), X).
step(app(app(app(s,X),Y),Z), app(app(X,Z),app(Y,Z))).
step(app(X,Y), app(X1,Y)) :- step(X,X1).
step(app(X,Y), app(X,Y1)) :- step(Y,Y1).
nf(k). nf(s). nf(app(k,X)) :- nf(X). nf(app(s,X)) :- nf(X).
nf(app(app(s,X),Y)) :- nf(X), nf(Y).
halts(X) :- nf(X).
halts(X) :- step(X,Y), halts(Y).
REFUTE itself is slow on these clauses. For , that is , it must reach level , because establishing uses the second sentence for halting at itself, a term of level . There are closed terms of level at most , and the sentence alone has more than three thousand million ground instances at that level. The levels grow fast because terms are trees. REFUTE-U, which chooses the instances by unification (Proposition 7.98), reaches the useful ones sooner: it closes in its second round, at level , though even there it grounds about clauses.11
Prolog answers a query by choosing instances by unification, much as REFUTE-U does, and it tries the clauses in the order written. In that order the first step it finds always takes the leftmost of the outermost redexes, so it answers true to halts(M) exactly when halts, and on the Monster it never answers. A logic program of eight lines is an interpreter for the combinators.
8.4 Undecidability of First-Order Logic
The lemma that a program is a theory turns a question about a program into a question about a sentence, by a map that a program can compute. That is all it takes to move the undecidability of halting from programs to logic, and so to settle the first of the chapter’s two questions, the search gap.
Theorem 8.26 (validity is undecidable). No program decides, for every sentence of the signature , whether it is valid, that is, true in every -structure.
Proof. Let be the conjunction of the finitely many sentences of . Given numbers and , let . The sentence is valid exactly when , and so, by the lemma that a program is a theory, exactly when halts on . A program can write the sentence down, given and : the conjunction is the same every time, and is . If a program decided validity, then running it on would decide whether halts on , which no program does. □
In words: no algorithm decides first-order logic, not even for the sentences that say something as plain as “this program stops”. The signature is small, and a larger one does not help: a program for a larger signature would decide, in particular, the sentences of , whose validity does not depend on symbols they do not mention.
The proof has a shape that fits any question about programs. To show that no program answers some question, show how a program could turn every question “does halt on ?” into a question of the new kind with the same answer. A program for the new question would then answer every halting question, and no program does. Such a map is called a reduction: the one here sent to , where . The hard part of each such proof is always the same, checking that the answers agree, and here it was the lemma that a program is a theory.
The same reduction gives the other forms of the question at once.
Corollary 8.27 (other forms of the question). No program decides, for every input of the following kinds, the question asked:
given a finite set of sentences and a sentence , whether , or equivalently whether ;
given a finite set of sentences, whether it is satisfiable;
given a finite set of clauses, whether it is satisfiable.
Proof. Each part is a reduction from halting. Given numbers and , let . In each case a program computes from and an input whose answer says whether halts on , and a program that answered the question would therefore decide halting.
(i). Take and , by the lemma that a program is a theory. The second form has the same answers as the first, by the soundness and completeness of .
(ii). The set is unsatisfiable exactly when , that is, exactly when halts on . So the answer “satisfiable” means “does not halt”.
(iii). The clause form of that set, one clause for each of its sentences, is unsatisfiable exactly when the set is.
□
In (i) the set never changes: the proof uses the same for every program. So there is one finite set of sentences whose consequences no program decides.
This settles the search gap. The first-order procedure certifies every entailment that holds, and may never answer for one that fails; the search gap asked whether a cleverer search could always stop, and part (iii) of the corollary says that none can.
The procedure REFUTE stops on every unsatisfiable clause set (Theorem 7.63), and so does REFUTE-U, which chooses its instances by unification (Proposition 7.98, from the optional Section 7.8; only its statement is used here). A procedure that also stopped on every satisfiable set would decide satisfiability, and there is no such procedure. Whatever a cleverer search gains, and unification gains a great deal, it cannot gain the other half of the answer. When the procedure runs for ever on a satisfiable set, that is not a defect of the procedure: no procedure could do better.
The valid sentences therefore form a set of a particular kind: one that has a semi-decision procedure (Definition 7.64), and so can be listed, but cannot be decided.12 They can be listed: negate every sentence, put each negation in clause form and run REFUTE on all of them at once, interleaving the runs; then print each sentence whose run closes. Every valid sentence is printed sooner or later. But they cannot be decided, by the theorem that validity is undecidable. The listing shows where the difficulty lies: a sentence that is not valid is never printed, and no amount of waiting tells it apart from one that has not been printed yet. Membership can be confirmed, and non-membership in general cannot.
Remark 8.28 (what remains decidable). None of this makes logic useless in practice. The theorem is precise about what it rules out. Many questions can still be decided.
Propositional logic is decided by
DPLL.Whether a finite set of sentences is satisfied by a structure with elements, for a given , is a propositional question, settled by a SAT solver.13
Many restricted languages have decision procedures of their own, and some of them close this chapter.
What no method does is decide every first-order question. The tools in use make one of three honest choices.
They restrict the language to a part that can be decided.
They accept a search that may not stop, as
REFUTEdoes.They keep a person in the loop, as the interactive provers built on type theory do.
8.5 Arithmetic as a Theory
The structure that the founders of modern logic most wanted to capture is the oldest one in mathematics: the counting numbers. We want to know whether some specification captures them. By the theorem that capturing makes truth decidable, it is enough to show that no program decides their truths, and the reduction that worked for validity works again, once halting can be expressed as a sentence about numbers. So what is left is to fix the language, and to express halting in it. The language is that of the counting numbers in Chapter 6, with equality added, since without it the language could not even say .
Definition 8.29 (the signature of arithmetic, with equality). In this chapter the signature of arithmetic contains , and the counting numbers interpret it as identity.
Formally, has the constant symbol , the one-place function symbol , the two-place function symbols and , and the two-place relation symbols and . The standard model of arithmetic , as the structure is traditionally called, has the domain , and interprets
as zero and as the successor, ;
and as addition and multiplication;
as less than and as identity.
The language has no symbol for , or for . It does not need one, since it can count.
Definition 8.30 (numeral). The numeral of a number is the term that counts up to it from .
Formally, for each number the numeral is the closed term of defined by recursion on :
So is , and in general has copies of . Its value in is , by induction on .
The structure cannot be written out as a table, since its domain is infinite: it can only be described by a theory.
The language is small, but it says a great deal. Write for , “ divides ”, and
With these abbreviations, the sentence says that there are infinitely many primes, which is true. The sentence
is Goldbach’s conjecture. A specification that captured would derive it or its negation, and the same holds for most open problems of number theory, which can be written in this language too.
The obvious candidate
Every course on arithmetic starts from the axioms of Peano arithmetic.
Definition 8.31 (Peano arithmetic). Peano arithmetic, , is the set of sentences of consisting of the equality axioms and the following sentences, each with in front of its free variables:
and ;
and ;
and ;
;
for every formula with a free variable , the induction axiom .
The first group describes the successor, the second and third say how and compute, and the fourth defines the order. The fifth is proof by induction, with one axiom for each property it might be applied to.
A program recognises an induction axiom by its shape, so is a specification, and . It proves a great deal: very nearly every theorem of elementary number theory that has ever been proved can be derived in it. The question is whether it, or anything like it, proves every true sentence.
Saying things about programs
To express halting we need to say what it is for a formula to express a relation between numbers. The notion is the plainest one there is.
Definition 8.32 (definable). A relation between numbers is definable if some formula of arithmetic is true of exactly the numbers that stand in it.
Formally, a set of -tuples of numbers is definable in if there is a formula of whose free variables are among such that, for all numbers ,
The even numbers are definable, by , and so are the primes and the pairs with .
Definability is a matter of truth in , and says nothing about proofs. A formula that defines a set is true of its members. Whether any specification can prove it true of them is a different question, about the specification. The notion that asks for proofs has a name of its own, representability, and the main line of this chapter never uses it. Section 8.7 needs two facts about what proves, and states them.
From now on a program is referred to by its code, and its input is a number. In this form halting is undecidable, by the theorem of Section 8.3: no program decides, given the numbers and , whether halts on .
Lemma 8.33 (halting is definable). There is a formula of such that, for all numbers and , halts on if and only if
The idea of the proof
The proof is in the optional Section 8.8, and here is how it goes. A halting run is finite: a list of combinators , where is the program applied to the numeral of its input and is in normal form. Each combinator is a string of the four symbols , , and , and so, read as in its code, a list of the digits to . So a halting run is a finite table of numbers, one row for each combinator.
The one idea of the proof is that a finite table of numbers can be packed into two numbers and , with the entry at position , counting from , the remainder of on division by . (A run needs a few such pairs, for the lengths of the rows as well as their digits; the sketch speaks of one.) A remainder is expressed by and : “ is the remainder of on division by ” is .
So can say: there are numbers , and whose table has, in its first row, the string of the program with code applied to the numeral of ; in each later row, the string of a combinator one step from the row before; and, in its last row, a normal form. One step replaces a stretch of the form by , or one of the form by , and a normal form has no such stretch. Each of those conditions talks only about digits at positions in the table, that is, about remainders, that is, about and .
Example 8.34 (a table in two numbers). The table with the single row is packed by and , with the divisors , and :
The remainders are the entries, in order. Section 8.8 proves that every finite table can be packed in this way.
Since halting is definable, the undecidability of halting moves from programs to the counting numbers by a reduction, as it moved to validity.
Theorem 8.35 (the truths of arithmetic are undecidable). No program decides, for every sentence of , whether .
Proof. The program halts on exactly when , and a program can write that sentence down, given and . A program that decided truth in would therefore decide halting, which no program does. □
Corollary 8.36 (nothing captures arithmetic). No specification captures . In particular, for every specification with , there is a sentence with and .
Proof. A specification that captured would make the truths of decidable, by the theorem that capturing makes truth decidable. But no program decides them, by the theorem that the truths of arithmetic are undecidable. If , then proves only truths, by the soundness of ; since it does not capture , it must miss a truth. □
So , the set of all true sentences of arithmetic, is not a specification: “take all the true ones” gives no checker. And , in particular, misses some truth.
The contrast with school algebra is now exact. The identities true of the positive integers, with , , and powers, can be decided, so they form a specification. Only the finite lists of them fail. For arithmetic, no list a program can read will do, and that is a theorem.
8.6 First Incompleteness Theorem
The corollary says that a specification of arithmetic misses a truth, and gives no idea which. We want to name one. The specification is assumed to tell the truth, and the sentence will come from a program that watches the specification at work.
Definition 8.37 (sound). A specification in is sound if implies , for every sentence .
Here the word names a property of a specification. It should not be confused with the soundness of , a property of the proof system: whatever derives from true premisses is true. The two are connected: by the soundness of , a specification is sound exactly when . In particular, is sound, and so is every specification obtained from it by adding true sentences.
The program waits for the specification to say that some program does not halt on its own code.
Definition 8.38 (the diagonal program). Let be a specification in . The diagonal program of is the following program. It uses the program LIST of Lemma 8.7, which lists the theorems of , and the formula of Lemma 8.33, which is true in of and exactly when halts on .
procedure D(e) -- e a number
for each theorem phi of Theta, as LIST prints them:
if phi is not H(e, e), e written as a numeral: halt
Its translation, given by the fact that programs are combinators, halts on exactly the inputs on which halts. We write , or when is clear, for the code of the translation.
In words: on the input , the program waits for to prove that does not halt on , and halts if that ever happens. The interesting input is the program’s own code.
Theorem 8.39 (the first incompleteness theorem). If is a sound specification in and is , the code of the translation of its diagonal program, then
Proof. Write for the diagonal program of . The program is the translation of , and halts on exactly the inputs on which halts, so the definability lemma says: halts on if and only if . Consider the run of on its own code . The three steps below show, in turn, that the run never ends, that the sentence is therefore true, and that does not prove it.
does not halt on . If it did, the listing of would have printed , so would prove it, and as is sound the sentence would be true. By the definability lemma, would then not halt on , contrary to the assumption.
So , by the definability lemma again, since does not halt on .
And does not prove it, because if it did, the listing would print it, and would halt on , which by the first step it does not.
□
The proof used three things: that is sound, that its theorems can be listed, and that halting is definable. It used no particular axioms of arithmetic, and no fact about what any specification proves, beyond what ’s own soundness gives.
Figure 8.2 draws the theorem. Among the sentences of , the theorems of a sound lie inside the truths. The sentence lies in the gap between them, and its negation is false, so proves neither. Adding the sentence to widens the theorems to take it in, but the wider specification is again sound and has its own diagonal program, whose sentence lies in the new gap. There is no last patch.
The theorem has two hypotheses on , that it is a specification and that it is sound. Both are needed, and an example shows each.
A specification. The set proves exactly the truths, so it leaves no truth unproved. No program lists it, since a listing would decide truth in by waiting for or , and no program decides truth in . So it is not a specification, and its diagonal program cannot be written.
Sound. A specification that contains a sentence and its negation proves every sentence, by (E) and (E), and so it proves . It is a specification, and not sound.
Remark 8.40 (what the theorem shows, and what it does not). The theorem is often quoted, and often quoted wrongly, so it is worth being exact.
It shows that no specification of arithmetic that tells the truth tells the whole truth. However the axioms are chosen, provided a checker can read them and they prove nothing false, some true sentence of arithmetic does not follow from them, and the proof says which.
It does not show that there are truths that nobody can know. The sentence was just proved true, here, by an argument that uses the soundness of , which cannot supply for itself.
Remark 8.41 (non-standard models). The theorem can also be read through structures. The sentence does not follow from , so by the completeness of some model of makes it false. In it is true, so is not , nor a copy of it: it satisfies every sentence of and still disagrees with about whether halts on its own code. Since is sound, its sentences are all true in ; a model of a set of truths about that is not a copy of is called a non-standard model.
The disagreement has to live somewhere. In the sentence is true, and it claims that a halting run exists. When contains one can show, though we do not here, that the numerals of behave exactly as the counting numbers do, so no numeral codes such a run. The run is coded by an element beyond every numeral, an element that no closed term names, and read in it is an infinitely long “run” that no machine performs.
Non-standard models are not only the price of incompleteness. Even , which leaves no truth unproved, has them. Add a new constant and, for every , the sentence . Every finite part of this set has a model, namely with read as a large enough number, so by compactness (Remark 6.66) the whole set has one, and in it names an element beyond every numeral. Forget , and the result satisfies every sentence true in without being a copy of . No set of first-order sentences pins the counting numbers down.14
Remark 8.42 (the sentence speaks about itself). Read in : it says that , run on , never halts. And , run on , halts exactly when proves . So the sentence says, of itself, “ does not prove me”. That is, in another dress, the sentence with which the incompleteness theorem was first proved. There, the self-reference was built inside arithmetic. Formulas were coded as numbers, and substituting a formula’s own number into it gave a sentence that says of itself that it is not provable. Here the self-reference costs nothing: it is run on its own code. The History says more.
Remark 8.43 (the diagonal). Every undecidability result of this chapter came from the same move, the one essential idea of the subject: apply a thing to its own description, and arrange for it to do the opposite of what it predicts about itself. The program of the halting theorem did this to a predictor of halting, and the program does it to a list of theorems.
The move is older than computers. It is the Monster of the first part of the course, the function that applies its argument to itself and then runs for ever. And the Monster turned out to be Richard’s paradox. The History collects four of its appearances in a table.
8.7 Second Incompleteness Theorem
The first incompleteness theorem measured a specification against the structure we meant: some truth about does not follow from it. This section finds a limit of another kind, which does not mention at all. Hilbert’s programme, the plan to secure mathematics by formal axioms, asked that the axioms should never contradict themselves, a property of derivations and not of truth, and that arithmetic should prove this about itself. We want to know whether a specification can. It cannot: a consistent specification that contains does not prove the sentence that says it is consistent, and so, by the completeness of , that sentence does not follow from it.
The route has two steps. The first theorem assumed that is sound, a strong assumption: to know that a theory proves nothing false about the counting numbers, one has to know which sentences about them are true, and that is what no specification can tell us. So we first replace soundness by consistency, at the cost of one fact about what proves. Then we carry the proof of the first theorem out inside , which is one more fact.
Consistency is the property of Definition 6.53: a set of sentences is consistent if . In words: the theory never leads to a contradiction. Equivalently, there is no sentence with both and , since (E) turns such a pair into and (E) turns into anything. The definition mentions derivations alone, and no structure.
A sound specification is consistent, since . The converse fails (Remark 8.51).
To trade soundness for consistency, we need one fact about what can prove: that it can check a finished calculation.
Fact 8.44 (true halting is provable). For all numbers and : if halts on , then .
The reason is that a halting run is a finite calculation. If the program halts, there are particular numbers , and that pack its run, and follows by (I) from the claim that these numbers do so. That claim comes down to a check of each of finitely many rows, and each check to facts about particular numbers, such as . A check is finite because every “for all” in can be written to range only over the numbers below a given one. The specification proves each such fact by calculating with its equations, as a pupil checks a long division. We take the details on loan.15
Theorem 8.45 (the first incompleteness theorem, from consistency). If is a consistent specification in with , and is , the code of the translation of its diagonal program, then
In words: for a specification that contains , consistency is enough in place of soundness.
Proof. Write for the diagonal program of . The program is the translation of , and halts on exactly the inputs on which halts, so both the definability lemma and the fact that true halting is provable may be applied to and . We show first that does not prove the sentence, and then that it is true.
does not prove . Suppose it did. Then the listing of prints the sentence, and halts on . By the fact that true halting is provable, proves , and so does , which contains . So proves a sentence and its negation, and therefore , which contradicts its consistency.
The sentence is true. The program halts on only if the listing prints , and by the first step it never does. So does not halt on , and by the definability lemma .
□
The proof shows the price of the weaker assumption. A consistent specification that is not sound might prove the false sentence , and nothing in the argument forbids it. So the theorem cannot say that leaves the question open either way.
Remark 8.46 (a question left open either way). A cleverer program does give a sentence that a consistent containing neither proves nor refutes. It searches the listing for a proof of a sentence and for a proof of its negation at once, and acts on whichever comes first. The argument is a little longer, and the main line does without it.16
Consistency as a sentence
Whether is consistent is a question about a program: the one that waits for .
Definition 8.47 (the consistency sentence). The consistency sentence of a specification says that the program that waits for a contradiction never stops.
Formally, let be a specification in , let be the program
procedure C(e) -- the input is ignored
for each theorem phi of Theta, as LIST prints them:
if phi is bottom: halt
and let be the code of its translation. The consistency sentence of is
The specification is consistent exactly when never halts, whatever its input, and so, by the definability lemma, exactly when . In words, says “ is consistent” in the language of arithmetic. The programme hoped for a derivation of such a sentence from axioms everyone accepts.
The definition asks for the translation of , and not for any combinator that halts on the same inputs. When is consistent, halts on no input, like every combinator that never halts. For some of those, such as the translation of “loop for ever”, proves that they never halt, and with such a code in place of the sentence would be provable. The sentence must speak of the program that actually searches the theorems of .
The second incompleteness theorem needs one more fact on loan, and of the facts the chapter borrows it is the longest to check. The proof of the first incompleteness theorem from consistency is an argument about numbers and programs. In particular it shows that if is consistent, then the diagonal program of does not halt on its own code . That argument can be carried out inside .
Fact 8.48 (arithmetic knows the first theorem). If is a specification in with , and is , the code of the translation of its diagonal program, then
Written with in place of “ is consistent”, the argument uses only the definitions of the programs and , the fact that true halting is provable, and the step from a sentence and its negation to . What has to be checked is that can prove each of these about the formula . That check is long and is omitted by most textbooks.17
Theorem 8.49 (the second incompleteness theorem). If is a consistent specification in with , then .
In words: a consistent specification of arithmetic cannot prove its own consistency.
Proof. Let be , and suppose . Since , the fact that arithmetic knows the first theorem gives , and (E) gives . That contradicts the first incompleteness theorem from consistency, since is a consistent specification with . So does not prove . □
By the completeness of , it follows that : some model of makes false. So this is a limit on what a specification entails, and not only on how well it fits .
Remark 8.50 (what this did to Hilbert’s programme). The programme asked for two things about arithmetic: axioms that prove every truth, and a proof, by means everyone accepts, that the axioms never lead to a contradiction. The first incompleteness theorem rules out the first of these. The second incompleteness theorem rules out the second, in the form in which it was intended. The means everyone accepts are, at the very most, those of , and the finitary reasoning the programme had in mind is usually taken to be far weaker. Even cannot prove its own consistency, let alone that of anything stronger. The consistency of is not in doubt: satisfies it. But that certificate is the structure itself, and the axioms cannot issue it for themselves.
Remark 8.51 (consistent but not sound). The specification is consistent, since it is sound. So, by the theorem, does not prove . It follows that together with is consistent. A derivation of from it would give, by (I), a derivation of from , and then, since is classical, one of , which the theorem rules out.
But with added is not sound, since says that is inconsistent, which is false. A consistent theory can believe something false about the numbers, and even something false about itself.
8.8 Defining Halting (optional)
This section is optional. It proves the lemma that halting is definable in , which the main line used with only a sketch of its proof, and it shows that the formula can be written with every universal quantifier bounded, the form the fact that true halting is provable needs. The main line uses these results, not their proofs.
The proof has two parts. The first is a fact about numbers: a finite sequence of numbers can be packed into two numbers, from which each entry is recovered as a remainder. The second lays the run out as a table of strings, one for each combinator of the run, and uses the packing to write a formula that says “there is a halting run”.
Each part comes down to one picture. The first: the list is stored in the single number , as its remainders on division by , and (), and any finite list can be stored in this way. The second: a step of a run copies most of one row of the table into the next, and changes one stretch of it (Figure 8.3). A reader who wants only the idea of the proof can stop here; the rest of the section checks that both pictures can be written as formulas of arithmetic.
Packing a sequence
Write for the remainder of on division by , for . The packing uses the function
called Gödel’s -function. One fact from elementary number theory is needed, and we prove it.
Lemma 8.52 (the Chinese remainder theorem). Suppose that
are positive integers, no two of which have a common factor greater than , and
are numbers with for each .
Then there is a number with for every .
In words: when the divisors share no factor, the remainders can be chosen independently of one another, and some number has all of them. (With the divisors and they cannot: no number leaves remainder on division by and on division by .)
Proof. The idea is to count: there are exactly as many numbers below the product of the as there are lists of remainders. Let , and send each number to its list of remainders . Two different numbers have different lists. For if the lists were equal, every would divide . Then their product would divide too. To see this, write as a product of powers of different primes. Take one of them, . The prime divides some , since a prime that divides a product divides one of its factors. It divides no other , so all factors of come from that one . So divides , and therefore divides . A number divisible by the powers of different primes is divisible by their product, by the uniqueness of factorisation into primes, so divides . But , so cannot divide . So the map is one-to-one. There are numbers below , and possible lists of remainders, so every list is the list of some , and in particular the list . □
Lemma 8.53 (packing a sequence). For every finite sequence of numbers there are numbers and such that for every .
In words: any finite list of numbers, however long, can be stored in two numbers, and read back one entry at a time by taking remainders.
Proof. Let be the largest of , let , and let for . We check the two hypotheses of the Chinese remainder theorem.
. We have , since for every number (for because ).
No two of the have a common factor. Suppose a prime divides and with . Then divides their difference . It does not divide : if it did, it would divide , which is a multiple of . It would also divide , and so their difference . So divides . But , so divides , and then divides after all, which is a contradiction.
The Chinese remainder theorem now gives with , which says . □
Example 8.54 (packing ). For the sequence the proof takes , and the divisors , , ; the Chinese remainder theorem gives , and indeed . The proof’s is generous: the smallest pair that packs the sequence is , .
The formula
The function is definable: exactly when makes true
since is .
When appears inside a formula as if it were a term, as in , the formula abbreviates one that says “there is a with and ”. Since is a function, nothing is lost.
These abbreviations bring in quantifiers. Every one of them, wherever it stands, can be bounded by , since a quotient or a remainder of is at most . Every other quantifier below ranges over the rows of a table or the positions in a row, and is bounded by the number of rows or the length of a row. Written so, has unbounded quantifiers only in its leading block of . That is the form needed by the fact that true halting is provable.
We write for , for , and and in the same way; and for . In a sum such as , the number stands for its numeral .
A run as a table
Let be a run. Row of its table is , written in the digits used for codes: for , for , for and for . The rows have different lengths, so the table is described by packed sequences of three kinds:
for the length of row , the digit at position of row , and the bracket count of row before position , where is a number at least as large as every length. The bracket count is the number of opening brackets among the first digits, less the number of closing ones.
The clause says that the numbers mean what was just said. It is the conjunction, for all , of:
;
for every , the digit is one of , , , ;
;
for every , the count goes up by one at a digit , down by one at a digit (written ), and stays the same at the others.
Stretches
A stretch of row is the part from a position up to, but not including, a position . In the string of a combinator, the stretches that are themselves strings of combinators are the strings of its parts. Call them the term stretches: a single or , or an opening bracket together with everything up to the closing bracket that matches it. The matching bracket is where the count first comes back to its value at :
A row is the string of a combinator exactly when it is one term stretch and every opening bracket in it opens a stretch made of two term stretches and a closing bracket:
where is : after the bracket at come two term stretches, from to and from to , and then a closing bracket.
Steps
A step rewrites one part of a combinator that is a redex, and leaves the rest alone. In the string, that is the replacement of one stretch:
| Redex | Row | Row |
|---|---|---|
Here , and are term stretches, and and are the rest of the row, unchanged. Figure 8.3 shows one step written this way, from to , with , , and . The new row is made of three copies from the old one, and nothing else.
Write , , and so on for their lengths, and for the position where the redex starts, which is . A redex at is then described by
A copy of a stretch is described by
which says that the digits of row from are those of row from . A step from row to row is
The three copies are , and , each put in its place in the new row. The formulas and are written in the same way from the line of the table above, with seven fixed digits in row , six in row , six copies (, , , twice and ), and the bound . This bound, like the last line of the formula, keeps every position inside the row, where the digits are fixed by . We do not write the formulas out here; Exercise 8.16 writes the first and lays out the second.
Let be , and let say that row has no redex:
Lemma 8.55 (a step is the replacement of a stretch). For all combinators and :
exactly when is obtained from by one of the two replacements of the table, with , and term stretches;
is in normal form exactly when has no stretch of either form in the column “Row ” of the table, with , and term stretches.
In words: a step can be done on the string, by cut and paste, without ever reading the combinator as a tree.
Proof. We show first that the term stretches of are exactly the strings of the parts of . Two facts about the bracket count are needed, both proved by induction on a combinator .
Along the count never falls below its value at the start of .
At the end of the count is back to that value, and, when is an application, it is not back to it any earlier.
The claim is proved by induction on . If is or , its string has one symbol and has one part. If is , its parts are itself and the parts of and of , and is an opening bracket, , and a closing bracket. The whole string is the string of , and it is a term stretch by the second fact. By the induction hypothesis, the term stretches that lie inside or inside are the strings of the parts of and . There are no other term stretches.
One that begins at the first bracket of ends where the count first comes back to its value at the start, which by the second fact is the end of . So it is the whole string.
One that begins with a bracket inside ends inside . Let be the count just before that bracket. By the first fact, is at least the count at the start of . After the bracket the count is , and at the end of it is back to . Since it moves by one at a time, it comes back to by then.
One that begins with a bracket inside ends inside , in the same way.
A term stretch that is a single or lies inside or , so the list is complete.
It follows that a stretch of either form in the column “Row ”, with , and term stretches, is exactly the string of a part of that is a redex. The two claims of the lemma follow.
(i). A step rewrites one part of that is a redex, by () or (). The rules () and () carry the rewriting out to the whole term, each putting back one pair of brackets around it and leaving the rest of the string as it was. So the string of the result is the string of with that stretch replaced, as in the table. Conversely, each replacement of the table rewrites the string of one redex part in this way, and so gives the string of the result of a step. Since different combinators have different strings, is that result.
(ii). A combinator is in normal form exactly when it has no part that is a redex.
□
The first row
The first row is the string of , where . It is an opening bracket, the digits of in base , the string of the numeral , and a closing bracket. By the definition of the numerals, the string of is
that is, copies of the fourteen symbols of , the ten of , and closing brackets: symbols in all. The digits of are read off by a fourth packed sequence: is the number that the first digits of spell in base . Let be of the conjunction of:
, , and ;
, , and for every ;
;
for each , , where is the digit of the symbol at position of , counting from ;
for each , , where is the digit of the symbol at position of ;
.
The first item fixes the outer brackets and asks the row to be the string of a combinator; the second and third say that positions to hold a term stretch whose digits spell ; the last three lay out the numeral.
The formula
Finally let be
In words: says that there is a table of rows whose first row is applied to the numeral of , whose later rows are each one step from the row before, and whose last row is in normal form.
Proof of the lemma that halting is definable. Let and be numbers.
If halts on , the formula is true. Then is the code of a combinator , since the program of every other number is , which halts on no input. Take a run that ends in a normal form. Let be the largest of the lengths of the strings , and pack the lengths, the digits, the bracket counts and the values of the first digits of by the packing lemma, in the orders stated. The resulting numbers make every clause true:
, by the choice of the sequences;
, by the string of ;
each , and , by the lemma that a step is the replacement of a stretch.
If the formula is true, halts on . Take numbers that make the clauses true for and . By and , row is the string of a combinator: an application whose function has the string spelled by the digits of , and whose argument is . So is the code of a combinator , and row is . By induction on , row is the string of a combinator with : for the step from to , the clause says that row is row with a stretch replaced as in the table. The stretch replaced is the string of a part of , and it is replaced by the string of a combinator, so row is the string of a combinator . By the lemma that a step is the replacement of a stretch, . By and the same lemma, is in normal form. So halts, which is what was to be shown.
□
The definitions of this section can be tested against the combinators themselves, and have been.18
8.9 Decidable Theories (optional)
This section is optional: nothing later depends on it. It asks which structures, other than finite ones, can be captured, and proves one case in full.
By the theorem that capturing makes truth decidable and its converse, a structure can be captured exactly when its truths can be decided. So the question becomes a search for decision procedures. The main tool for finding them is the following.
Definition 8.56 (quantifier elimination). A set of sentences admits quantifier elimination if for every formula there is a formula such that
has no quantifiers,
has no free variables other than those of , and
, where lists the free variables of .
In words: every question that can be asked, however many quantifiers it has, is equivalent under to one without any. When is a sentence, is a sentence without quantifiers, built from atomic sentences about the constants alone, and so it is often easy to settle.
The rationals with their order are an infinite structure that can be captured, by a short list of the properties of their order.
Definition 8.57 (dense linear order). The specification (for dense linear order) consists of the equality axioms for the signature and the following sentences.
Irreflexive: .
Transitive: .
Linear: .
Dense: .
No end points: and .
The rationals make every one of these sentences true.
Theorem 8.58 (a dense order is captured). The specification admits quantifier elimination, and it captures .
In words: an infinite structure can sometimes be captured by a handful of sentences. Six sentences and the equality axioms say everything true about the order of the rationals.
Proof. By the completeness of it is enough to work in an arbitrary structure that satisfies , so the equivalences below are claims about every such structure. We eliminate quantifiers by induction on . The connectives are immediate, is , and the only case with content is with already free of quantifiers. The case is settled in four moves.
Write in disjunctive normal form and move inside the disjunction, so that it remains to treat with literals .
Remove negations: is equivalent to , and to , by the order axioms; distribute again. Conjuncts that do not mention move outside the quantifier.
If is a conjunct, the conjunction is false. A conjunct can be dropped. If or is a conjunct for a variable other than , then is equivalent to .
What remains is , and it is equivalent to the conjunction of all . In one direction this is transitivity. In the other, take the largest and the smallest , which exist since the order is linear. By hypothesis the first is below the second, and density gives an between them. If there are no , or no , the absence of a least or greatest element gives , and the conjunction is empty and true.
For a sentence, the quantifier-free equivalent has no variables and no constants, so it is built from by the connectives and is provably true or provably false. So, for every sentence , the specification proves or proves . As satisfies , the specification proves only truths about , by soundness. So a true sentence is proved, since otherwise would be proved and true. Hence captures . □
The proof is an algorithm: each move rewrites a formula, and the rewriting ends. So it decides the truths of directly, without the listing of theorems.
Quantifier elimination reaches further than orders.
Remark 8.59 (addition without multiplication). The counting numbers with , , and but without can also be captured, by the axioms of that do not mention , with induction for the formulas of the smaller language. The proof is again by quantifier elimination, after one helpful addition: for each and , a symbol for “ leaves remainder on division by ”, a relation that can already be written with alone.19 The definable sets of numbers are then easy to describe: each is, beyond some point, periodic, like the even numbers.
Remark 8.60 (the real numbers). The real numbers with , , , and can be captured too, by the axioms of an ordered field in which every positive number has a square root and every polynomial of odd degree has a root. The proof is once more by quantifier elimination, now of polynomial inequalities.20 It follows that the sets of reals definable in one variable are finite unions of points and intervals. The counting numbers are not such a set, so they cannot be defined among the reals. The reals contain them, and yet are the tamer of the two.
Remark 8.61 (why multiplication is the dangerous addition). The three infinite structures of this section have one thing in common. In none of them can a finite sequence be packed into numbers and unpacked again by a formula. With and together on the counting numbers, the -function does exactly that, and with it every halting run is definable. The undecidability of arithmetic then follows from the definability lemma alone.
Even the simplest sentences of arithmetic are affected. No program decides whether a polynomial equation with integer coefficients has a solution in the counting numbers. That question is asked by a sentence whose only quantifiers are existential ones in front of an equation.
Figure 8.4 summarises the chapter’s answers.
| Structure or question | Captured? | Truths decidable? |
|---|---|---|
| a finite structure | yes, by its table | yes, by evaluation |
| propositional validity | (no structure) | yes, by DPLL |
| yes, by | yes, by quantifier elimination | |
| yes | yes, at great cost | |
| yes | yes, at great cost | |
| no | no | |
| first-order validity | (no structure) | no; listable by REFUTE |
History
The question of this chapter was asked as a programme. Hilbert’s Foundations of Geometry of 1899 set out axioms for Euclid’s geometry from which every theorem followed by logic alone, with nothing taken from the diagrams. In his address to the International Congress of Mathematicians in Paris in 1900, the second of his problems asked for a proof that the axioms of arithmetic (for Hilbert, those of the real numbers) are consistent.21 In the 1920s the request grew into Hilbert’s programme: to write the whole of mathematics in formal systems, and to prove, by elementary reasoning about finite strings of symbols, that those systems are consistent and that they settle every question.
The programme was answered in Königsberg in September 1930, at two meetings a day apart. On 7 September a conference on the epistemology of the exact sciences held a round-table discussion on the foundations of mathematics. There Kurt Gödel, aged twenty-four, remarked that there are true sentences of arithmetic that a consistent formal system cannot prove. Almost nobody took it in. John von Neumann did, and spoke with him afterwards. On 8 September Hilbert addressed the Society of German Scientists and Physicians in the same city, and closed with the words Wir müssen wissen. Wir werden wissen.22
Von Neumann, who had heard the first incompleteness theorem at Königsberg, found the second independently and wrote to Gödel on 20 November 1930 to say so. Gödel had announced both a few weeks earlier. The first was published in 1931, together with a sketch of the second.23
Gödel’s proof is not the one of this chapter. He coded formulas and derivations by numbers. He showed that the relation “ is the number of a derivation of the sentence with number ” can be expressed in the formal system itself, with its true instances provable there. Then, by substituting a formula’s own number into it, he built a sentence that says of itself that it is not derivable: the sentence of Remark 8.42, reached by coding instead of by a program. The general form of this step, the fixed-point lemma, was stated by Carnap in 1934.
From consistency alone Gödel’s argument shows that the sentence is not derivable; to show that its negation is not derivable either, he assumed -consistency, a condition between consistency and soundness. Rosser removed that assumption in 1936, by the cleverer sentence of Remark 8.46.24
The second theorem did not leave the consistency of arithmetic in doubt. In 1936 Gentzen, whose natural deduction this course uses, proved consistent by an induction longer than any that itself can carry out, as the second theorem says he must.25
Computation came next. In 1936 Church showed that no effectively calculable function decides whether a term of his -calculus has a normal form (Exercise 8.10 asks the same of the combinators, its cousin). In a short note of the same year he deduced that no mechanical procedure decides first-order provability, and so, by the completeness theorem, validity.26 Turing reached the same conclusion independently and by a different route, and the next year showed that his machines compute exactly the functions that Church’s calculus defines, the fact behind the Turing completeness of the combinators.27
The first of Turing’s papers defines his machines, proves by a diagonal argument that no machine decides whether a machine is “circle-free”, and deduces that none decides whether a machine ever prints a given symbol. In its eleventh section it writes, for each machine, a formula of first-order logic that is derivable exactly when the machine prints that symbol: an ancestor of the construction of Section 8.3, with machines in place of combinators and printing in place of halting. The paper does not state the undecidability of the halting problem, and does not use the word “halting”. The self-referential argument for halting in its now standard form is in Kleene’s Introduction to Metamathematics of 1952, and the name “halting problem” first appears in print in Davis’s Computability and Unsolvability of 1958. But Turing’s printing problem and the halting problem are equivalent, and the credit given to Turing is fair in substance if not in letter.28
What “formal system” meant was settled only by the machines. In 1963, and again in 1964, Gödel wrote that Turing’s analysis gave “a precise and unquestionably adequate definition of the general notion of formal system” (in 1964, “concept” in place of “notion”), and that the incompleteness theorems therefore hold for every consistent formal system that contains a little arithmetic.29
The decidable cases came first. Presburger showed in 1929 that the counting numbers with addition alone can be captured and decided. By 1930 Tarski had a decision procedure for the real numbers with addition and multiplication, though it was published only after the war. In 1974 it was shown that every procedure for Presburger’s structure is enormously expensive.30 The last word on the undecidable side came in 1970, when Matiyasevich completed the work of Davis, Putnam and Julia Robinson and answered the tenth of Hilbert’s problems of 1900: no procedure decides whether a polynomial equation with integer coefficients has a solution in whole numbers.31
The schoolroom problem has a history of its own. The eleven identities are in Dedekind’s Was sind und was sollen die Zahlen? of 1888. Tarski asked in the 1960s whether they derive every true identity; the question is in print in a paper of 1969 with Doner.32 Wilkie found his identity in 1981, and the paper describing it was published in 2000.33 Gurevič gave the first counter-model, with elements, in 1985, and proved in 1990 that no finite list of identities derives every true one.34 Smaller counter-models followed, down to the twelve-element ones of Burris and Yeats, who conjectured that twelve is the least. A computer search by Zhang in 2005 ruled out fewer than eleven.35 Meanwhile Macintyre had shown in 1981 that the set of all true identities is decidable.36 In 2026 Subercaseaux and Przybocki proved the conjecture with a SAT solver, as Remark 8.6 describes.37
Every undecidability result of the chapter is a diagonal argument, and the diagonal is older than all of them. Figure 8.5 lines up four of its appearances. Each starts from a list, applies each entry of the list to its own index, and twists the result, so that the twisted diagonal differs from every entry of the list. Figure 8.6 collects the dates.
| Who | The list | Each applied to itself | The twist | What follows |
|---|---|---|---|---|
| Cantor, 1891 | infinite sequences of s and s | the th digit of the th sequence | change it | the list misses a sequence |
| Russell, 1901 | all sets | is the set a member of itself? | take those that are not | the sets not members of themselves form no set |
| halting | all programs | does the program halt on its own code? | do the opposite | no program decides halting |
| the program | the theorems of | does say program does not halt on ? | halt exactly then | misses a truth |
| Who | When | What |
|---|---|---|
| Dedekind | 1888 | the eleven identities |
| Hilbert | 1899; 1900 | axioms for geometry; the consistency of arithmetic asked for |
| Presburger | 1929 | addition alone is decidable |
| Tarski | by 1930; 1948 | the real numbers are decidable |
| Gödel | 1930; 1931 | the incompleteness theorems |
| Church | 1936 | having a normal form is undecidable |
| Church; Turing | 1936 | first-order validity is undecidable |
| Rosser | 1936 | a sentence neither proved nor refuted, from consistency alone |
| Gentzen | 1936 | the consistency of , from outside it |
| Kleene; Davis | 1952; 1958 | the halting argument; the name |
| Matiyasevich | 1970 | polynomial equations are undecidable |
| Wilkie | 1981 | a true identity the eleven do not derive |
| Gurevič | 1985; 1990 | a counter-model; no finite list suffices |
| Subercaseaux, Przybocki | 2026 | the least counter-model has twelve elements |
Summary
A specification is a theory that a program can recognise. It captures a structure when the sentences that follow from it are exactly those true in the structure. If a specification captures a structure, a program decides the structure’s truths by listing theorems until the sentence or its negation appears. The converse holds too, so a structure can be captured exactly when its truths can be decided. Every finite structure in a finite signature, once each of its elements has a name, is captured by finitely many sentences and the equality axioms: name the elements, say that they are different and that there are no others, and copy the tables.
A program is a combinator, and no program decides whether a program halts: a predictor of halting, run against itself on its own code, would contradict itself. The rules by which combinators run can be written as a finite set of first-order sentences, the same for every program, from which “the program halts” follows exactly when it does. So first-order validity is undecidable, even for the consequences of that one set. The first-order procedure REFUTE certifies every entailment that holds and runs for ever on some that do not, and that is as good as any procedure can be.
Halting can also be expressed in arithmetic, so the truths about the counting numbers are undecidable, and no specification captures them. For each sound specification, the program that waits for it to say “this program does not halt on itself” gives a true sentence the specification does not prove. For a specification that contains Peano arithmetic, consistency is enough in place of soundness. And a consistent specification that contains Peano arithmetic cannot prove its own consistency; by completeness, it does not even entail it. The first theorem does not show that some truths can never be known: the true sentence it names was proved true, by an argument that uses the soundness the specification cannot supply for itself (Remark 8.40).
This part of the course began with the wish never to be surprised by a system one has specified. Its three chapters have said exactly where that wish can be met. For a system with finitely many elements, a finite list of sentences can say everything, and a program can check every claim. For a question in propositional logic, a solver can settle it, quickly in practice. For a first-order question, a search finds every proof there is, and may search for ever when there is none. For the counting numbers, the simplest infinite system there is, no specification says everything, and no program decides what is true. That is not a failure to know. It is a theorem, which is a way of knowing, and it is exactly what Hilbert’s “we shall know” turned out to mean.
Exercises
The exercises run from practice to proof.
Exercises 8.1 to 8.5 are about specifications and finite structures;
Exercises 8.6 to 8.11 are about programs as theories and reductions;
Exercises 8.12 to 8.14 are about arithmetic and the incompleteness theorems;
Exercises 8.15 to 8.17 go with the optional sections, and are optional too.
Exercise 8.1. Say which of the following sets of sentences are specifications, with a reason for each.
The eleven identities of Example 8.5, each with in front of its variables.
The induction axioms of .
The set of all sentences true in a structure with five elements.
The set of all sentences of true in .
The set of sentences of with fewer than a hundred symbols that are true in .
Exercise 8.2. Let , , , and .
Show that and .
Deduce that for all positive integers and .
Check that for every positive integer , so that every quantity in the argument is a positive integer. Which step of the argument cannot be imitated with the eleven identities, and why?
Exercise 8.3. Let be a structure whose truths are decided by a program. Prove in full that is a specification and that it captures . Which half of capturing uses the soundness of ?
Exercise 8.4. The structure has the domain , and its signature has three symbols.
A one-place function symbol , with , and .
A one-place relation symbol , true of alone.
The relation symbol , interpreted as identity.
Write the description of (Definition 8.11), and count its sentences.
The sentence is true in . Following the proof that finite structures can be captured, describe a derivation of it from the equality axioms and : which instances are proved, and how are they combined?
Exercise 8.5. Take the equality axioms and the description of Exercise 8.4, and remove the closure sentence. Find a model of what is left in which the sentence is false, although it is true in . What does the example show about the closure sentence?
Exercise 8.6. The combinator , that is, , halts. Write its run, and the lines that the sentences of force in any model of , as in Example 8.22. Which sentences for steps are used, and where?
Exercise 8.7. Let be a set of combinators that contains and and contains , and whenever it contains and . Show that contains every combinator in normal form. Show that the set of combinators in normal form is itself such a set. So it is the smallest one, which is why the term structure interprets by it.
Exercise 8.8. Let be the structure whose domain is the set of combinators, with , and application as in the term structure, in which , and are true of everything. Show that satisfies and makes true. Why does this not contradict the lemma that a program is a theory? Why does the proof of that lemma need the term structure, and not just any model of , to show that does not follow?
Exercise 8.9. Compute the code of . Which numbers below are codes, and of which combinators?
Exercise 8.10. Show that no program decides, given the code of a combinator , whether has a normal form. (This is, in effect, the first problem ever shown to be undecidable; the History tells the story.)
Exercise 8.11. Show that no program decides, given the code of a program, whether that program halts on the input . (Find a reduction: from and , compute the code of a program that ignores its input and does what the program does on .)
Exercise 8.12. Write in , using and as abbreviations and with every quantifier’s scope bracketed:
there are infinitely many pairs of primes that differ by ;
every number is the sum of four squares;
every number greater than is divisible by a prime.
Exercise 8.13. Let be a specification in and the code of the translation of its diagonal program.
Which step of the proof of the first incompleteness theorem fails if is not assumed sound?
Suppose that is sound, and let be with added. Show that is a sound specification. Does the first incompleteness theorem apply to , and with which sentence?
Exercise 8.14. Add a fifth row to the table of diagonal arguments in the History, for Cantor’s theorem that no function from a set to the set of its subsets is onto: the list, each applied to itself, the twist, and what follows.
Exercise 8.15. (Optional.) Find numbers and with equal to , , for , first by the method of the proof of the packing lemma, and then a smaller pair by trial.
Exercise 8.16. (Optional.) Write out the formula that Section 8.8 leaves to the reader, in the style of . Then say where, in row of an step, the six fixed digits stand, and where each of the six copies begins.
Exercise 8.17. (Optional.) Eliminate the quantifier from in , following the four moves of the proof, and simplify the result.
References
- Stanley Burris and Karen Yeats. The saga of the high school identities. Algebra Universalis, 52:325–342, 2004.
- Alonzo Church. A note on the Entscheidungsproblem. Journal of Symbolic Logic, 1(1):40–41, 1936a.
- Alonzo Church. An unsolvable problem of elementary number theory. American Journal of Mathematics, 58(2):345–363, 1936b.
- Haskell B. Curry and Robert Feys. Combinatory Logic, Volume I. North-Holland, Amsterdam, 1958.
- Martin Davis. Computability and Unsolvability. McGraw-Hill, New York, 1958.
- John W. Dawson Jr. Logical Dilemmas: The Life and Work of Kurt Gödel. A K Peters, Wellesley, MA, 1997.
- John Doner and Alfred Tarski. An extended arithmetic of ordinal numbers. Fundamenta Mathematicae, 65:95–127, 1969.
- Michael J. Fischer and Michael O. Rabin. Super-exponential complexity of Presburger arithmetic. In Complexity of Computation, volume 7 of SIAM–AMS Proceedings, pages 27–41. American Mathematical Society, 1974.
- Gerhard Gentzen. Die Widerspruchsfreiheit der reinen Zahlentheorie. Mathematische Annalen, 112:493–565, 1936.
- Alexander V. Gheorghiu. High school algebra and the limits of AI. Mathematics Today, 61(5), October 2025. Graham Hoare Prize 2025.
- Kurt Gödel. Über formal unentscheidbare Sätze der Principia Mathematica und verwandter Systeme I. Monatshefte für Mathematik und Physik, 38:173–198, 1931.
- Kurt Gödel. Collected Works, Volume I: Publications 1929–1936. Oxford University Press, Oxford, 1986. Edited by Solomon Feferman and others.
- R. Gurevič. Equational theory of positive numbers with exponentiation. Proceedings of the American Mathematical Society, 94:135–141, 1985.
- R. Gurevič. Equational theory of positive numbers with exponentiation is not finitely axiomatizable. Annals of Pure and Applied Logic, 49:1–30, 1990.
- Joel David Hamkins and Theodor Nenu. Did Turing prove the undecidability of the halting problem? arXiv:2407.00680v3, 2025.
- David Hilbert. Grundlagen der Geometrie. Teubner, Leipzig, 1899.
- David Hilbert. Mathematische Probleme. Lecture to the International Congress of Mathematicians, Paris. Published in Nachrichten der Königlichen Gesellschaft der Wissenschaften zu Göttingen, 253–297, 1900.
- David Hilbert. Naturerkennen und Logik. Die Naturwissenschaften, 18:959–963, 1930.
- Stephen Cole Kleene. Introduction to Metamathematics. North-Holland, Amsterdam, 1952.
- Angus Macintyre. The laws of exponentiation. In Model Theory and Arithmetic, volume 890 of Lecture Notes in Mathematics, pages 185–197. Springer, 1981.
- Yuri V. Matiyasevich. Enumerable sets are Diophantine. Soviet Mathematics Doklady, 11:354–357, 1970.
- Open Logic Project. The Open Logic Text. https://openlogicproject.org, 2026. Release 9620cc7, 12 July 2026. Licensed CC BY 4.0.
- Mojżesz Presburger. Über die Vollständigkeit eines gewissen Systems der Arithmetik ganzer Zahlen, in welchem die Addition als einzige Operation hervortritt. In Comptes Rendus du I Congrès des Mathématiciens des Pays Slaves, Warszawa 1929, pages 92–101, 1930.
- J. Barkley Rosser. Extensions of some theorems of Gödel and Church. Journal of Symbolic Logic, 1(3):87–91, 1936.
- Bernardo Subercaseaux and Benjamin Przybocki. A SAT attack on Tarski’s high school algebra problem. arXiv:2608.08421v2, 2026.
- Alfred Tarski. A Decision Method for Elementary Algebra and Geometry. University of California Press, Berkeley, second edition, 1951. First issued as a RAND report, 1948.
- Alan M. Turing. On computable numbers, with an application to the Entscheidungsproblem. Proceedings of the London Mathematical Society, s2-42(1):230–265, 1937a.
- Alan M. Turing. Computability and -definability. Journal of Symbolic Logic, 2(4):153–163, 1937b.
- Alex J. Wilkie. On exponentiation – a solution to Tarski’s high school algebra problem. Quaderni di Matematica, 6:107–129, 2000. Manuscript circulated 1981.
- Jian Zhang. Computer search for counterexamples to Wilkie’s identity. In Automated Deduction – CADE-20, volume 3632 of Lecture Notes in Computer Science, pages 441–451. Springer, 2005.
Notes
The story of this introduction, as far as Hilbert, is adapted from Gheorghiu (2025). ↩
Textbooks call such a set decidable, or recursive, and a theory with a decidable set of axioms axiomatizable. ↩
The structure is one of the family described in Subercaseaux and Przybocki (2026, §7), with particular values given to the cells that the template leaves as parameters; the script
inc_wilkie.pyin the course’s support folder checks the eleven identities in it and finds the one pair at which Wilkie’s identity fails. ↩Subercaseaux and Przybocki (2026). A lemma, checked in the same way, extends the “no” to fewer elements, and the encoding was verified in a proof assistant. Burris and Yeats had conjectured that is the least size; the History tells the rest of the story. ↩
Macintyre (1981); see Burris and Yeats (2004) for the history. ↩
The script
inc_checks.pyin the course’s support folder runs both. ↩Every program in any programming language can be written as a combinator, and the Church–Turing thesis says that every procedure that could be called mechanical can be too. So “no program” means “no combinator” throughout this chapter, and each “no program” is a theorem about combinators. ↩
The run that always takes the leftmost of the outermost redexes reaches the normal form whenever there is one, so a program halts exactly when that run ends. This is the normalisation theorem for the leftmost order, a theorem of combinatory logic that the course does not prove; it goes back to Curry and Feys (1958). No proof in this chapter depends on it: it explains why the Prolog program of Remark 8.25 gets the right answers. The definitions here are a choice, and other textbooks make others (other numerals, a result required to be a numeral, or -terms in place of combinators); none of them changes what can be computed. ↩
Theorem 1.18 states Turing completeness for the functions that combinators compute. The form used here, for programs that may run for ever, is the one proved with it, and it is what the Church–Turing thesis says of the pseudocode of this chapter. ↩
This is the fact usually called the undecidability of the halting problem. Most accounts credit it to Turing’s paper of 1936, which did not state it. The History tells the story. ↩
The counts are from the scripts
ks_checks.pyandks_refute.pyin the course’s support folder. ↩Textbooks call such a set computably enumerable, or semi-decidable. ↩
The encoding has one propositional letter for each possible entry of each table, and clauses saying that each entry has exactly one value and that the sentences hold. ↩
Skolem built the first such model in 1934. ↩
The fact is called the -completeness of arithmetic. It applies to written with every universal quantifier bounded, as it can be: the optional Section 8.8 shows how, and the main line uses only that it can be done. The fact then holds even for a fragment of without induction, and is proved in Open Logic Project (2026, §35.11). ↩
The trick is due to Rosser (1936); Gödel’s original theorem assumed a condition between consistency and soundness, called -consistency. ↩
The properties of provability involved are called the derivability conditions; Open Logic Project (2026, §37.6) states them and also takes them on faith. ↩
The script
ks_strings.pyin the course’s support folder checks that holds of exactly the strings of combinators, among all strings of at most nine symbols; that the term stretches are exactly the strings of the parts, for all combinators with at most five leaves; that the replacements of the table are exactly the steps, and a string with no redex stretch exactly a normal form, for all combinators with at most six leaves; and that the numeral of has the string . ↩Presburger (1930). The procedure is expensive: every decision procedure for this structure takes, on some sentences of length , a number of steps that grows like (Fischer and Rabin, 1974). ↩
Tarski (1951); the result was obtained by 1930. ↩
Hilbert (1930); the words are the epitaph on his grave in Göttingen. On the two days see Dawson Jr. (1997). ↩
Hamkins and Nenu (2025); Kleene (1952), p. 382; Davis (1958), p. 70. ↩
The note added in 1963 to the English translation of the 1931 paper, and the postscript of 1964 to his Princeton lectures of 1934; both are in Gödel (1986). ↩
Presburger (1930), Tarski (1951), Fischer and Rabin (1974). ↩