Hedman. A First Course in Logic, 2004 (Oxford)
.pdf370 The incompleteness theorems
where each ai abbreviates the VN term code(l, m, k, i). Then ϕf (¯x, y) deﬁnes the function f . Moreover, if both ϕg and ϕh are Σ1 formulas, then, by its deﬁnition, so is ϕf . We have shown that the proposition holds for every primitive recursive function f .
To show that every recursive function is deﬁnable by a Σ1 formula, we must consider unbounded search. Suppose that f (x1, . . . , xn) is deﬁned as the least natural number y such that both h(x1, . . . , xn, y) = 0 and h(x1, . . . , xn, z) is deﬁned for all z < y. Then f is deﬁned by the Vf formula
z(z < y → w(ϕh(x1, . . . , xn, z, w) ¬(w = 0))) ϕh(x1, . . . , xn, y, 0).
Since the universal quantiﬁer is bounded, this formula is Σ1 provided that ϕh is.
Corollary 8.15 For any A Nk, A is recursive if and only if it is both Σ1 and Π1.
Proof If A is both Σ1 and Π1, then it is recursive by Corollary 7.55. Conversely, suppose that A is recursive. Then the function f (¯x) = s(χA(¯x)) is recursive where χA is the characteristic function of A. By the previous proposition, f is deﬁned by a Σ1 formula ϕf (¯x, y). Since f (¯a) = 2 if and only if a¯ A, the Σ1 formula ϕf (¯x, (1 + 1)) deﬁnes the set A. Moreover, the compliment of A is deﬁned by the Σ1 formula ϕf (¯x, 1). So A is Π1 as well as Σ1.
Corollary 8.16 If M = ΓN and N M , then any recursive subset of Nn is a deﬁnable subset of M .
Proof This follows immediately from Proposition 8.3 and Corollary 8.15.
8.3 G¨odel’s First Incompleteness theorem
We now prove that TN is undecidable. We show that there is no algorithm that determines whether or not a given VN sentence is true in TN . Suppose that ALG is an algorithm that takes VN sentences as input and outputs either “yes” or “no.” Further suppose that an output of “yes” means that TN ϕ. We show that the converse cannot be true. We show that there necessarily exists a VN  sentence β in TN for which ALG does not give the correct a rmative output of “yes.”
The key to our proof is on the ﬁrst page of this book (page xiii) where we ﬁnd the following English sentence:
Let n be the smallest natural number that cannot be deﬁned in fewer than 20 words.
The incompleteness theorems 
371 
To make this sentence more precise, let us only consider the words deﬁned in the
Oxford English Dictionary. Let A denote the sentence:
There exists a least natural number that cannot be deﬁned using at most twenty words from the Oxford English Dictionary.
The “A” is for “antinomy.” Since there are only ﬁnitely many words in the Oxford English Dictionary (contained in a mere ﬁnitely many volumes), there are only ﬁnitely many possible sentences having at most 20 words. It follows that the negation of A cannot be true. This negation entails that every number can be deﬁned in 20 words or less. On the other hand, A cannot be true. If A were true, then it would contradict itself since it contains fewer than 20 words.
So, in English, we can write sentences such as A so that neither A nor the negation of A is true. What prevents us from writing such sentences in ﬁrstorder logic? Of course, a VN sentence cannot refer to the Oxford English Dictionary. Let us attempt to modify the sentence A to obtain a sentence of ﬁrstorder logic. Instead of “words” let us count the number of symbols occuring in the VN sentence. The symbols include variables, the ﬁxed symbols of ﬁrstorder logic, and the set VN . The length of a VN formula is the number of symbols in the formula. For example, x(y + y = x) has length 9 (counting parentheses). Consider now the sentence:
The number n is deﬁnable by a VN formula ϕ(x) having length at most l.
We view this sentence as a formula, call it A (n, l), having free variables n and l. When we say that “n is deﬁnable by ϕ(x)” we mean that
N = ϕ(a) if and only if a = n.
We now prove that A (n, l) cannot be expressed in ﬁrstorder logic.
Proposition 8.17 There does not exist a VN formula ψ(x, y) such that:
N = ψ(n, l) if and only if
n is deﬁnable by a VN formula having length at most l.
Proof This follows from the elementary fact that TN is complete and consistent (by Theorem 2.86). Given any VN sentence ϕ, either ϕ or ¬ϕ is in TN . If there exists a formula ψ(x, y) as described in the proposition, then we can write a VN sentence ΨA that is neither true nor false in N. We now describe this sentence.
If ψ(x, y) is a VN formula, then so is ¬ψ(x, y) z(¬ψ(z, y) → w(x + w = z)). Let θ(x, y) denote this formula. This formula says that x is the least number not deﬁnable by a VN formula having length at most y.
372 The incompleteness theorems
Let l be the length of θ(x, y). Then θ(x, (1 + 1)) has length l + m · 4, where m is the number of occurences of the variable y in θ(x, y). Of course, m ≤ l. So the length of θ(x, (1 + 1)) is at most 5l. In general, for any VN term t, the length of θ(x, (t)) is at most (h + 2)l where h is the length of t (the “+ 2” is for the two parentheses around t).
Let tn be the VN term 1 + 1 + 1 + · · · + 1. This term has length 2n − 1.

n) · (tn) 




− 








n times 




Therefore, the term (t 
representing n2 has length 2(2n 

1) + 5 = 4n + 3. 
Let sn (the “square” of n) denote this VN term. It follows that the formula
θ(x, (sn)) has length at most (4n + 5)l. Let N be such that N 2 > (4N + 5)l.
√
That is, let N be any integer greater than 2l + 5l + 4l2. Let ΨA be the sentence
xθ(x, sN ).
Claim N does not model the sentence ¬ΨA.
Proof If N = ¬ΨA, then N = x¬θ(x, sN ). By the deﬁnition of θ, this means that there is no least number x such that ¬ψ(x, sN ) holds. By induction, ψ(x, sN ) holds for every nonnegative integer x. This means that every nonnegative integer is deﬁnable by a formula having length at most N 2. This is impossible since, up to equivalence, there are only ﬁnitely many VN formulas of length less than N 2. We must include the phrase “up to equivalence” because there are inﬁnitely many variables we may use. However, our choice of variables does not matter. Every VN formula having length at most N 2 is equivalent to a formula that uses only the following symbols:
x1, x2, . . . , xN2 , , , ¬, →, ↔, (, ), , , =, 0, 1, ·, and + .
Since this is a ﬁnite list of symbols, only ﬁnitely many formulas of length N 2 comprise these symbols.
Claim N does not model the sentence ΨA.
Proof The sentence ΨA asserts the existence of a least number x not deﬁnable by a formula of length less than N 2. But θ(x, sN ) is a formula of length at most (4N + 5)l < N 2 that deﬁnes x. So ΨA is contradictory.
Since TN is consistent, each of the two claims hold. Since TN is complete the proposition holds.
It may seem that our discussion regarding the sentence A has not accomplished much. We have established that this sentence is an antinomy and as such cannot be expressed as a VN sentence. Thus, we have provided no information beyond that contained in the ﬁrst paragraph of this book. However, we are now prepared to prove the G¨odel’s First Incompleteness theorem.
The incompleteness theorems 
373 
Theorem 8.18 TN is undecidable.
Proof Let ALG be an algorithm that halts in a ﬁnite number of steps and outputs either “yes” or “no” given any VN sentence as input. Suppose that, for any VN sentence ϕ, if ALG outputs “yes,” then TN ϕ. We demonstrate a
VN sentence β in TN for which ALG produces the incorrect output of “no.” Let n be an nonnegative integer. We say that n is ALGdeﬁnable by a
VN formula ϕ(x) if ALG outputs “yes” when given the sentence
x(ϕ(x) ↔ x = tn)
as input (where tn is the VN term representing n). Let R be the set of all (n, l) N2 such that n is ALGdeﬁnable by a formula ϕ(x) having length at most l.
Claim R is recursive.
Proof We show that the characteristic function χR(x, y) is computable and appeal to the Church–Turing thesis. To compute χR(n, l), given n and l, ﬁrst list every VN formula in one free variable having length at most l. If we only include formulas having variables among x, x1, x2, . . . , xl, then this list is ﬁnite. For each formula ϕ(x) in the list, run the algorithm ALG with the sentencex(ϕ(x) ↔ x = tn) as input. If the algorithm halts with output “yes” for some ϕ(x) in our list, then χR(n, l) = 1. Otherwise, if “no” is the output for each ϕ(x) in the list, χR(n, l) = 0.
We have described an algorithm that computes χR(x, y). We conclude that this function is recursive.
By Corollary 8.15, R is a deﬁnable subset of N. Let ψALG(x, y) be a VN formula that deﬁnes R. We now deﬁne a VN sentence ΨALG in a manner analogous to the deﬁnition of ΨA in the proof of Proposition 8.17. Let θALG(x, y) be the formula
¬ψALG(x, y) z(¬ψALG(z, y) → w(x + w = z))
saying that x is the least number not ALGdeﬁnable by a VN formula having
√
length at most y. Let N be greater than 2l + 5l + 4l2, where l is the length of θALG(x, y). Then N 2 is greater than the length of θALG(x, sN ), where sN is the VN term representing N 2 as (tN ) · (tN ).
Let ΨALG be the sentence xθALG(x, sN ). Since only ﬁnitely many numbers are ALGdeﬁnable by some VN formula having length at most N 2,
TN ΨALG.
So N = θALG(a, sN ) for some a N. Since it asserts that x is the least number such that ψALG(x, sN ) does not hold, the formula θALG(x, sN ) uniquely deﬁnes
374 
The incompleteness theorems 
a. So
TN x(θALG(x, sN ) ↔ x = ta).
Let β be the sentence x(θALG(x, sN ) ↔ x = ta). Suppose we execute ALG with input β. If the output is “yes,” then a is ALGdeﬁnable by the formula θALG(x, sN ) (by the deﬁnition of “ALGdeﬁnable”). Since the length of this formula is less than N 2 and a is not ALGdeﬁnable by such a formula, we conclude that the output must be “no.”
Thus we have demonstrated a formula β TN for which ALG returns the output “no.” Since ALG is an arbitrary algorithm, we conclude that TN is undecidable.
We make two comments regarding the above proof. First, note that this proof relies on the Church–Turing thesis. This is convenient, but by no means necessary. Since ALG is an arbitrary algorithm, it would be quite tedious to prove directly that R(x, y) is recursive. In the next two sections, we prove that TN is undecidable by an alternative proof that avoids the Church–Turing thesis. In fact, our “alternative proof” follows the original proof given by Kurt G¨odel. The above proof is due to George Boolos [5].
Secondly, note that the proof of Theorem 8.18 proves more than the statement of Theorem 8.18.
Theorem 8.19 (G¨odel’s First Incompleteness theorem) If T is a decidable theory containing ΓN , then T is incomplete.
Proof Repeat the proof of Theorem 8.18 using Corollary 8.16 where needed.
The proof of Theorem 8.18 also extends to certain theories that do not contain ΓN (for example, see Exercise 8.11).
8.4 G¨odel codes
In this section, we set the stage for the proof of G¨odel’s Second Incompleteness theorem. To each Vformula ϕ, we assign a natural number called the G¨odel code of ϕ. We let [ϕ] denote this natural number. G¨odel codes for formulas are analogous to the codes of T ++ programs deﬁned in Section 7.4 and are deﬁned in a similar manner.
We assign the odd natural numbers to symbols as follows:
( ) ¬ → 
↔ 
= + 
· 0 
1 x1 
x2 . . . 
1 3 5 7 9 11 
13 
15 17 19 21 
23 25 
27 29 
31 . . . 
Any ﬁnite string of symbols corresponds to a ﬁnite sequence of odd numbers. Suppose that s is the string of symbols corresponding to the numbers a1, . . . , ak.
The incompleteness theorems
We assign to this string the number [s] = 2a1 · 3a2 · 5a3 · · · · · pakk the (k)th prime number. This is the G¨odel code for s.
Given a natural number n, there are many decision problems we may consider.
•Is n the G¨odel code for a symbol?
•Is n the G¨odel code for a variable?
•Is n the G¨odel code for a VN term?
•Is n the G¨odel code for a VN formula?
•Is n the G¨odel code for a VN sentence in Skolem normal form?
We can decide the answers to these and other decision problems by factoring n. If n is odd, then it is the code for some symbol. The number n codes a string of symbols if and only if n is divisible by each of the ﬁrst k prime numbers (for some k) and is divisible by no other prime numbers. Such n must be even since it is divisible by the ﬁrst prime p1 = 2. If n codes a sequence a1, . . . , ak, then we can recover this sequence from the prime factorization of n. Since the factorization process is recursive, each of the above decision problems is decidable. By Corollary 8.15, the sets corresponding to these problems are deﬁnable subsets of N.
So there exist VN formulas var(x), term(x), and f orm(x) that deﬁne the set of G¨odel codes for variables, terms, and formulas. That is, N = f orm(n) if and only if n = [ϕ] for some VN formula ϕ. Moreover, we claim that these formulas are ∆0 (see Exercise 8.7). Likewise, there exist ∆0 VN formulas corresponding to rules of derivation from Section 3.1.
Example 8.20 Consider the (, )Introduction rule from Table 3.1. This rule states that if Γ ϕ, then Γ (ϕ). We deﬁne a Vformula ϕP I (x, y) such that
N = ϕP I (a, b) if and only if a = [ϕ] and b = [(ϕ)]
for some VN formula ϕ. Let ϕ0(x, y) be the VN formula that says there exists m such that x = 2a1 3a2 · · · pamm and y = 21 · 3a1 · · · pamm−1 pamm+1p3m+2 for some a1, . . . , am in N. Then
N = ϕ0(a, b) if and only if a = [s] and b = [(s)]
for some string of symbols s. Let ϕP I (x, y) be the formula f orm(x) ϕ0(x, y). By Exercise 8.7 f orm(x) is a ∆0 formula. It follows that ϕP I (x, y) is also ∆0.
Example 8.21 Consider the Introduction rule. We demonstrate a formula ϕ I (x, y, z) so that
N = ϕ I (a, b, c) if and only if a = [ϕ], b = [ψ], and c = [(ϕ) (ψ)]
376 
The incompleteness theorems 
for some VN formulas ϕ, ψ, and θ. Let ϕ1(a, b, c) be the VN formula expressing that, for some m and n,
a = 2a1 3a2 · · · pamm , b = 2b1 3b2 · · · pbnn , and
c = 2a1 3a2 · · · pamm p7m+1pbm1+2 · · · pbnn+m+1.
This formula says that c is the G¨odel code for the string of symbols formed by putting a (having code 7) between the symbols coded by a and those coded by b. When using Introduction, we must be careful to include parentheses where needed. Let ϕ I (x, y, z) be the VN formula
u v(ϕP I (x, u) ϕP I (y, v) ϕ0(u, v, z)).
We claim that this formula, although it is not ∆0, is equivalent to a ∆0 formula. By the deﬁnition of ϕP I (x, y), there is a primitive recursive function f (x) such that ϕP I (x, y) implies y < f (x). So ϕ I (x, y, z) is equivalent to the ∆0 formula
u v((u < f (x)) (v < f (y)) ϕP I (x, u) ϕP I (y, v) ϕ0(u, v, z)),
where, as usual, x < y abbreviates the VN formula z(x + z = y).
In a similar manner, many of the rules for derivations from Chapter 3 can be expressed with ∆0 formulas. Let Generic rule be any rule from Table 3.1 other than Elimination and →Introduction. There is a ∆0 formula ϕrule(x1, x2, y) such that N = ϕrule(a1, a2, b) if and only if both
•a1 = [ϕ1],a2 = [ϕ2], and b = [ψ] for some VN formulas ϕ1,ϕ2, and ψ, and
•the Generic rule states that if Γ ϕ1 and Γ ϕ2, then Γ ψ.
This applies not only to rules in Table 3.1, but also to the rules of Tables 3.2 and 3.3 as well as DeMorgan’s rules, the Contradiction rule, the Cut rule, Modus Ponens, Distributivity, and so forth.
Since VN can express rules for derivations, VN can express formal proofs. There are two rules from Table 3.1 that we have not considered. Since it contains Γ {ϕ} ψ in its premise, →Introduction does not have the same format as our Generic rule. The formula representing →Introduction is more complicated than the formulas for the other rules. Rather than dealing with this rule, we simply ignore it. For the same reason, we ignore Elimination. These rules are redundant. By Exercise 1.16, the rules mentioned in the previous paragraph form a complete set of rules for ﬁrstorder logic.
So we have a complete set of rules of derivation for ﬁrstorder logic and each rule is represented by a ∆0 formula. Since there are only ﬁnitely many rules in this set, there exists a VN formula Der(x, y, z) that says x, y, and z each code formulas and the formula coded by z can be derived from the formulas coded
The incompleteness theorems 
377 
by x and y by one of the rules in our set. This formula is the disjunction of the formulas corresponding to each of the rules. We have
N = Der(a, b, c) if and only if
•a, b, and c are the G¨odel codes for VN formulas ϕ, ψ, and θ, and
•θ follows from ϕ and ψ by Introduction or Distributivity orIntroduction. . . and so forth.
Since it is a disjunction of ∆0 formulas, Der(x, y, z) is also a ∆0 formula. For the remainder of this section, we exploit this fact and show that, for certain VN theories T , there exists a VN formula P rT (x) that says “x is the G¨odel code of a formula that can be formally derived from T .”
Deﬁnition 8.22 A set of VN sentences Γ is recursive if the set of G¨odel codes CΓ = {[ϕ]ϕ Γ} is a recursive subset of N. Likewise, Γ is said to be primitive recursive if CΓ is.
So a theory is recursive if and only if it is decidable. The set ΓN from Section 8.1 is clearly recursive. In fact, ΓN is primitive recursive.
Proposition 8.23 For any recursive set of VN sentences T , there exists a primitive recursive set of VN sentences T0 such that T ϕ if and only if T0 ϕ for any VN formula ϕ.
Proof The proof is known as Craig’s trick.
Let DT = {[ϕ]T ϕ}. If T is recursive, then DT is recursively enumerable. Let f (x) be a recursive function having DT as its range. Then the set of consequences of T can be enumerated as ϕ1, ϕ2, ϕ3, . . ., where, for each n N, f (n) = [ϕn].
Let T0 = {(ϕn) (ϕn) . . . (ϕn)n N}.





n 




times 

This is Craig’s trick. Clearly, T ϕ if and only if T0 ϕ. Moreover, we can determine whether or not a sentence ϕ is in T0 in a primitive recursive manner: ﬁrst count the number m of conjunctions in ϕ, and then compute f (1), . . ., f (m + 1). The formula ϕ is in T0 if and only if it is the conjunction of a formula having G¨odel code f (i) for some i = 1, . . . , m + 1. (Exercise 8.15 o ers a more explicit proof.)
We now deﬁne the formula P rT (x) for any recursive Vtheory T .
Proposition 8.24 For any recursive set of VN sentences T , there exists a VN formula P rT (x) such that N = P rT ([ϕ]) if and only if T ϕ.
378 
The incompleteness theorems 
Proof By the previous proposition, it su ces to prove this for primitive recursive T . Let ψT (x) be a ∆0 formula such that N = ψT ([ϕ]) if and only if ϕ T . We deﬁne a subset R of N2 inductively as follows:
(x, 1) R if and only if N = ψT (x),
(x, n + 1) R if and only if there exist y and z
such that (y, n) R, (z, n) R, and N = Der(y, z, x).
The set R is primitive recursive by its deﬁnition. By Exercise 8.6 (which can be extracted from our proof of Proposition 8.14), there exists a ∆0 VN formula DrT (x, n) that deﬁnes this set. So N = DrT ([ϕ], n) if and only if ϕ is a sentence that can be derived from T in at most n steps. Let P rT (x) be the formula
nDrT (x, n).
Now suppose that T is a recursive set of VN sentences that contains ΓN as a subset. In this case, we claim that T ϕ if and only if T P rT (tϕ), where tϕ is a VN term such that N = tϕ = [ϕ]. Essentially, this follows from the fact that ΓN is strong enough to express the coding process described earlier in this section. In particular, we use Proposition 8.3 to show that T ϕ implies T P rT (tϕ) in the following proposition. The converse is left as Exercise 8.17.
Notation 1 As in the proof of Proposition 8.17, we let tn denote the VN term
1 + 1 + 1 + · · · + 1 for each n N. For any VN formula ϕ, we let tϕ denote the
n times
VN term tn where n is the G¨odel code [ϕ] of ϕ.
Proposition 8.25 Let T be a recursive set of VN sentences such that ΓN T . For any VN sentence ϕ, if T ϕ, then T P rT (tϕ).
Proof Suppose that T ϕ. Then N = P rT ([ϕ]) by Proposition 8.24. By the deﬁnition of P rT (x), N = DrT ([ϕ], n) for some n N. It follows that N = DrT (tϕ, tn). Since DrT (x, y) is ∆0, we have T DrT (tϕ, tn) by Proposition 8.3. Finally, T P rT (tϕ) by Introduction.
Although T ϕ implies T P rT (tϕ), it is NOT ALWAYS TRUE that (†) T ϕ → P rT (tϕ).
This is the crux of incompleteness. Just because something is true does not mean that we can prove it is so. As we shall show in the next section, there necessarily exists a sentence γ such that the sentence γ → P rT (tγ ) cannot be derived from T . By the deﬁnition of P rT in Proposition 8.24, γ → P rT (tγ ) is a consequence of T . So γ → P rT (tγ ), like the sentence β from the previous section, is a true sentence that cannot be derived from T . Thus, the failure of (†) reasserts G¨odel’s First Incompleteness theorem. Moreover, this failure has implications regarding
The incompleteness theorems 
379 
the nature of provability from which we deduce G¨odel’s Second Incompleteness theorem.
Although it is not true in general, (†) does hold in certain cases. In particular, it holds whenever ϕ has the form P rT (tψ) for some VN sentence ψ.
Lemma 8.26 Let T be a recursive set of VN sentences such that ΓN T . Let ϕ be any VN sentence and let ρ be the sentence P rT (tϕ). Then T P rT (tϕ) →
P rT (tρ).
The proof of Lemma 8.26 is tedious and we omit it. We make some remarks regarding this proof at the end of this section.
Lemma 8.27 Let T be a recursive set of VN sentences such that ΓN T . If N = Der(a, b, c), then T (P rT (ta) P rT (tb)) → P rT (tc).
Proof Since N = Der(a, b, c), a, b, and c are the G¨odel codes for some Vformulas ϕ, ψ, and θ. Moreover, θ follows from ϕ and ψ by one of our rules of derivation. We see that
N = (P rT (ta) P rT (tb)) → P rT (tc).
The sentence (P rT (ta) P rT (tb)) → P rT (tc) is a 2 sentence in disguise, and so we cannot directly apply Proposition 8.3.
Instead, consider the formula
DrT (ta, x) DrT (tb, y) → DrT (tc, x + y + 1).
If we can derive this formula from T , then we can obtain the desired result byDistribution. We must show that
M = DrT (ta, x) DrT (tb, y) → DrT (tc, x + y + 1).
for each model M of T . This is certainly true if M happens to be N. However, M may contain “inﬁnite” elements (in the sense of Exercise 4.10). Moreover, since M may not be elementarily equivalent to N, these inﬁnite elements may behave di erently than the natural numbers. By compactness, M = DrT (ζ, η) for inﬁnite ζ and η in some model M of T . We must show that, even for these strange inﬁnite numbers, if M = DrT (ta, ζ) and M = DrT (tb, η), then M = DrT (tc, ζ + η + 1).
To see that this is the case, let us unravel the formula DrT (ta, x). In the proof of Proposition 8.24, this formula was deﬁned by primitive recursion from the formulas ψT (x) and Der(x, y, z). Recall that, in N, the formula ψT (x) deﬁnes the set of G¨odel codes for sentences in T . In M , this formula may hold for an element ζ which is inﬁnite and therefore is not the G¨odel code for any sentence.
Even 
so, 
the formula DrT (ta, x) asserts 
that there exists a sequence 
a1, . . . , ax 
so 
that ax = ta and, for each k 
= 1, . . . , x, either ψT (ak) or 