Open Logic Sample
Open Logic Sample
Logic
Text
1 Sets 3
1.1 Extensionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Subsets and Power Sets . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Some Important Sets . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Unions and Intersections . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Pairs, Tuples, Cartesian Products . . . . . . . . . . . . . . . . . . 9
1.6 Russell’s Paradox . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2 Relations 13
2.1 Relations as Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2 Special Properties of Relations . . . . . . . . . . . . . . . . . . . 15
2.3 Equivalence Relations . . . . . . . . . . . . . . . . . . . . . . . . 16
2.4 Orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.5 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.6 Operations on Relations . . . . . . . . . . . . . . . . . . . . . . . 20
3 Functions 21
3.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2 Kinds of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.3 Functions as Relations . . . . . . . . . . . . . . . . . . . . . . . . 25
3.4 Inverses of Functions . . . . . . . . . . . . . . . . . . . . . . . . 26
3.5 Composition of Functions . . . . . . . . . . . . . . . . . . . . . . 28
3.6 Partial Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
i
C ONTENTS
4.8 Equinumerosity . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.9 Sets of Different Sizes, and Cantor’s Theorem . . . . . . . . . . 44
4.10 The Notion of Size, and Schröder-Bernstein . . . . . . . . . . . 45
II First-order Logic 47
ii
Contents
iii
C ONTENTS
13 Undecidability 185
13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
13.2 Enumerating Turing Machines . . . . . . . . . . . . . . . . . . . 187
13.3 Universal Turing Machines . . . . . . . . . . . . . . . . . . . . . 189
13.4 The Halting Problem . . . . . . . . . . . . . . . . . . . . . . . . . 191
13.5 The Decision Problem . . . . . . . . . . . . . . . . . . . . . . . . 192
13.6 Representing Turing Machines . . . . . . . . . . . . . . . . . . . 193
13.7 Verifying the Representation . . . . . . . . . . . . . . . . . . . . 196
13.8 The Decision Problem is Unsolvable . . . . . . . . . . . . . . . . 201
13.9 Trakhtenbrot’s Theorem . . . . . . . . . . . . . . . . . . . . . . . 202
iv
Contents
17 Representability in Q 261
17.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
17.2 Functions Representable in Q are Computable . . . . . . . . . . 263
17.3 The Beta Function Lemma . . . . . . . . . . . . . . . . . . . . . 264
17.4 Simulating Primitive Recursion . . . . . . . . . . . . . . . . . . 267
17.5 Basic Functions are Representable in Q . . . . . . . . . . . . . . 268
17.6 Composition is Representable in Q . . . . . . . . . . . . . . . . 271
17.7 Regular Minimization is Representable in Q . . . . . . . . . . . 272
17.8 Computable Functions are Representable in Q . . . . . . . . . . 275
17.9 Representing Relations . . . . . . . . . . . . . . . . . . . . . . . 276
17.10 Undecidability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
v
C ONTENTS
V Methods 295
A Proofs 297
A.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
A.2 Starting a Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
A.3 Using Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
A.4 Inference Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . 300
A.5 An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
A.6 Another Example . . . . . . . . . . . . . . . . . . . . . . . . . . 309
A.7 Proof by Contradiction . . . . . . . . . . . . . . . . . . . . . . . 310
A.8 Reading Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
A.9 I Can’t Do It! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
A.10 Other Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
B Induction 319
B.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
B.2 Induction on N . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
B.3 Strong Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
B.4 Inductive Definitions . . . . . . . . . . . . . . . . . . . . . . . . 323
B.5 Structural Induction . . . . . . . . . . . . . . . . . . . . . . . . . 325
B.6 Relations and Functions . . . . . . . . . . . . . . . . . . . . . . . 326
C Biographies 331
C.1 Georg Cantor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
C.2 Alonzo Church . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
C.3 Gerhard Gentzen . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
C.4 Kurt Gödel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
C.5 Emmy Noether . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
C.6 Rózsa Péter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
C.7 Julia Robinson . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
C.8 Bertrand Russell . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
C.9 Alfred Tarski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
C.10 Alan Turing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
C.11 Ernst Zermelo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
D Problems 345
Bibliography 365
vi
Part I
1
Chapter 1
Sets
1.1 Extensionality
A set is a collection of objects, considered as a single object. The objects making
up the set are called elements or members of the set. If x is an element of a set A,
we write x ∈ A; if not, we write x ∈ / A. The set which has no elements is
called the empty set and denoted “∅”.
It does not matter how we specify the set, or how we order its elements, or
indeed how many times we count its elements. All that matters are what its
elements are. We codify this in the following principle.
Definition 1.1 (Extensionality). If A and B are sets, then A = B iff every ele-
ment of A is also an element of B, and vice versa.
{ a, a, b} = { a, b} = {b, a}.
This delivers on the point that, when we consider sets, we don’t care about
the order of their elements, or how many times they are specified.
Example 1.2. Whenever you have a bunch of objects, you can collect them
together in a set. The set of Richard’s siblings, for instance, is a set that con-
tains one person, and we could write it as S = {Ruth}. The set of positive
integers less than 4 is {1, 2, 3}, but it can also be written as {3, 2, 1} or even as
{1, 2, 1, 2, 3}. These are all the same set, by extensionality. For every element
of {1, 2, 3} is also an element of {3, 2, 1} (and of {1, 2, 1, 2, 3}), and vice versa.
Frequently we’ll specify a set by some property that its elements share.
We’ll use the following shorthand notation for that: { x | ϕ( x )}, where the
3
1. S ETS
ϕ( x ) stands for the property that x has to have in order to be counted among
the elements of the set.
S = { x | x is a sibling of Richard}.
Example 1.4. A number is called perfect iff it is equal to the sum of its proper
divisors (i.e., numbers that evenly divide it but aren’t identical to the number).
For instance, 6 is perfect because its proper divisors are 1, 2, and 3, and 6 =
1 + 2 + 3. In fact, 6 is the only positive integer less than 10 that is perfect. So,
using extensionality, we can say:
We read the notation on the right as “the set of x’s such that x is perfect and
0 ≤ x ≤ 10”. The identity here confirms that, when we consider sets, we don’t
care about how they are specified. And, more generally, extensionality guar-
antees that there is always only one set of x’s such that ϕ( x ). So, extensionality
justifies calling { x | ϕ( x )} the set of x’s such that ϕ( x ).
Extensionality gives us a way for showing that sets are identical: to show
that A = B, show that whenever x ∈ A then also x ∈ B, and whenever y ∈ B
then also y ∈ A.
Example 1.6. Every set is a subset of itself, and ∅ is a subset of every set. The
set of even numbers is a subset of the set of natural numbers. Also, { a, b} ⊆
{ a, b, c}. But { a, b, e} is not a subset of { a, b, c}.
Example 1.7. The number 2 is an element of the set of integers, whereas the
set of even numbers is a subset of the set of integers. However, a set may hap-
pen to both be an element and a subset of some other set, e.g., {0} ∈ {0, {0}}
and also {0} ⊆ {0, {0}}.
4
1.2. Subsets and Power Sets
Definition 1.10 (Power Set). The set consisting of all subsets of a set A is called
the power set of A, written ℘( A).
℘( A) = { B | B ⊆ A}
Example 1.11. What are all the possible subsets of { a, b, c}? They are: ∅,
{ a}, {b}, {c}, { a, b}, { a, c}, {b, c}, { a, b, c}. The set of all these subsets is
℘({ a, b, c}):
℘({ a, b, c}) = {∅, { a}, {b}, {c}, { a, b}, {b, c}, { a, c}, { a, b, c}}
5
1. S ETS
N = {0, 1, 2, 3, . . .}
the set of natural numbers
Z = {. . . , −2, −1, 0, 1, 2, . . .}
the set of integers
Q= {m/n | m, n ∈ Z and n ̸= 0}
the set of rationals
R = (−∞, ∞)
the set of real numbers (the continuum)
These are all infinite sets, that is, they each have infinitely many elements.
As we move through these sets, we are adding more numbers to our stock.
Indeed, it should be clear that N ⊆ Z ⊆ Q ⊆ R: after all, every natural
number is an integer; every integer is a rational; and every rational is a real.
Equally, it should be clear that N ⊊ Z ⊊ Q, since −1 is an integer but not
a natural number, and 1/2 is rational but not integer. It is less obvious that
Q ⊊ R, i.e., that there are some real numbers which are not rational.
We’ll sometimes also use the set of positive integers Z+ = {1, 2, 3, . . . } and
the set containing just the first two natural numbers B = {0, 1}.
Example 1.14 (Infinite sequences). For any set A we may also consider the
set Aω of infinite sequences of elements of A. An infinite sequence a1 a2 a3 a4 . . .
consists of a one-way infinite list of objects, each one of which is an element
of A.
6
1.4. Unions and Intersections
Figure 1.1: The union A ∪ B of two sets is set of elements of A together with
those of B.
can mention sets we’ve already defined. So for instance, if A and B are sets,
the set { x | x ∈ A ∨ x ∈ B} consists of all those objects which are elements
of either A or B, i.e., it’s the set that combines the elements of A and B. We
can visualize this as in Figure 1.1, where the highlighted area indicates the
elements of the two sets A and B together.
This operation on sets—combining them—is very useful and common,
and so we give it a formal name and a symbol.
Definition 1.15 (Union). The union of two sets A and B, written A ∪ B, is the
set of all things which are elements of A, B, or both.
A ∪ B = { x | x ∈ A ∨ x ∈ B}
Example 1.16. Since the multiplicity of elements doesn’t matter, the union of
two sets which have an element in common contains that element only once,
e.g., { a, b, c} ∪ { a, 0, 1} = { a, b, c, 0, 1}.
The union of a set and one of its subsets is just the bigger set: { a, b, c} ∪
{ a} = { a, b, c}.
The union of a set with the empty set is identical to the set: { a, b, c} ∪ ∅ =
{ a, b, c}.
A ∩ B = { x | x ∈ A & x ∈ B}
Two sets are called disjoint if their intersection is empty. This means they have
no elements in common.
7
1. S ETS
Figure 1.2: The intersection A ∩ B of two sets is the set of elements they have
in common.
We can also form the union or intersection of more than two sets. An
elegant way of dealing with this in general is the following: suppose you
collect all the sets you want to form the union (or intersection) of into a single
set. Then we can define the union of all our original sets as the set of all objects
which belong to at least one element of the set, and the intersection as the set
of all objects which belong to every element of the set.
S
Definition 1.19. If A is a set of sets, then A is the set of elements of elements
of A:
[
A = { x | x belongs to an element of A}, i.e.,
= { x | there is a B ∈ A so that x ∈ B}
T
Definition 1.20. If A is a set of sets, then A is the set of objects which all
elements of A have in common:
\
A = { x | x belongs to every element of A}, i.e.,
= { x | for all B ∈ A, x ∈ B}
and A = { a}.
T
8
1.5. Pairs, Tuples, Cartesian Products
Figure 1.3: The difference A \ B of two sets is the set of those elements of A
which are not also elements of B.
When we have an index of sets, i.e., some set I such that we are considering
Ai for each i ∈ I, we may also use these abbreviations:
[ [
Ai = { Ai | i ∈ I }
i∈ I
\ \
Ai = { Ai | i ∈ I }
i∈ I
Finally, we may want to think about the set of all elements in A which are
not in B. We can depict this as in Figure 1.3.
Definition 1.22 (Difference). The set difference A \ B is the set of all elements
of A which are not also elements of B, i.e.,
A \ B = { x | x ∈ A and x ∈
/ B }.
9
1. S ETS
We can define ordered pairs in set theory using the Wiener–Kuratowski defi-
nition.
Definition 1.24 (Cartesian product). Given sets A and B, their Cartesian prod-
uct A × B is defined by
A × B = {⟨ x, y⟩ | x ∈ A and y ∈ B}.
Example 1.25. If A = {0, 1}, and B = {1, a, b}, then their product is
A × B = {⟨0, 1⟩, ⟨0, a⟩, ⟨0, b⟩, ⟨1, 1⟩, ⟨1, a⟩, ⟨1, b⟩}.
A1 = A
A k +1 = A k × A
Bx1 = {⟨ x1 , y1 ⟩ ⟨ x1 , y2 ⟩ ... ⟨ x1 , ym ⟩}
Bx2 = {⟨ x2 , y1 ⟩ ⟨ x2 , y2 ⟩ ... ⟨ x2 , ym ⟩}
.. ..
. .
Bx n = {⟨ xn , y1 ⟩ ⟨ xn , y2 ⟩ . . . ⟨ xn , ym ⟩}
Since the xi are all different, and the y j are all different, no two of the pairs in
this grid are the same, and there are n · m of them.
10
1.6. Russell’s Paradox
A ∗ = { ∅ } ∪ A ∪ A2 ∪ A3 ∪ . . .
R = {x | x ∈
/ x}
Proof. If R = { x | x ∈
/ x } exists, then R ∈ R iff R ∈
/ R, which is a contradic-
tion.
Let’s run through this proof more slowly. If R exists, it makes sense to ask
whether R ∈ R or not. Suppose that indeed R ∈ R. Now, R was defined as
the set of all sets that are not elements of themselves. So, if R ∈ R, then R does
not itself have R’s defining property. But only sets that have this property are
in R, hence, R cannot be an element of R, i.e., R ∈ / R. But R can’t both be and
not be an element of R, so we have a contradiction.
11
1. S ETS
12
Chapter 2
Relations
13
2. R ELATIONS
We have put the diagonal, here, in bold, since the subset of N2 consisting of
the pairs lying on the diagonal, i.e.,
is the identity relation on N. (Since the identity relation is popular, let’s define
Id A = {⟨ x, x ⟩ | x ∈ A} for any set A.) The subset of all pairs lying above the
diagonal, i.e.,
L = {⟨0, 1⟩, ⟨0, 2⟩, . . . , ⟨1, 2⟩, ⟨1, 3⟩, . . . , ⟨2, 3⟩, ⟨2, 4⟩, . . .},
is the less than relation, i.e., Lnm iff n < m. The subset of pairs below the
diagonal, i.e.,
G = {⟨1, 0⟩, ⟨2, 0⟩, ⟨2, 1⟩, ⟨3, 0⟩, ⟨3, 1⟩, ⟨3, 2⟩, . . . },
is the greater than relation, i.e., Gnm iff n > m. The union of L with I, which
we might call K = L ∪ I, is the less than or equal to relation: Knm iff n ≤ m.
Similarly, H = G ∪ I is the greater than or equal to relation. These relations L, G,
K, and H are special kinds of relations called orders. L and G have the property
that no number bears L or G to itself (i.e., for all n, neither Lnn nor Gnn).
Relations with this property are called irreflexive, and, if they also happen to
be orders, they are called strict orders.
Although orders and identity are important and natural relations, it should
be emphasized that according to our definition any subset of A2 is a relation
on A, regardless of how unnatural or contrived it seems. In particular, ∅ is a
relation on any set (the empty relation, which no pair of elements bears), and
A2 itself is a relation on A as well (one which every pair bears), called the
universal relation. But also something like E = {⟨n, m⟩ | n > 5 or m × n ≥ 34}
counts as a relation.
14
2.2. Special Properties of Relations
15
2. R ELATIONS
Proof. For the left-to-right direction, suppose Rxy, and let z ∈ [ x ] R . By defi-
nition, then, Rxz. Since R is an equivalence relation, Ryz. (Spelling this out:
as Rxy and R is symmetric we have Ryx, and as Rxz and R is transitive we
have Ryz.) So z ∈ [y] R . Generalising, [ x ] R ⊆ [y] R . But exactly similarly,
[y] R ⊆ [ x ] R . So [ x ] R = [y] R , by extensionality.
For the right-to-left direction, suppose [ x ] R = [y] R . Since R is reflexive,
Ryy, so y ∈ [y] R . Thus also y ∈ [ x ] R by the assumption that [ x ] R = [y] R . So
Rxy.
16
2.4. Orders
2.4 Orders
Many of our comparisons involve describing some objects as being “less than”,
“equal to”, or “greater than” other objects, in a certain respect. These involve
order relations. But there are different kinds of order relations. For instance,
some require that any two objects be comparable, others don’t. Some include
identity (like ≤) and some exclude it (like <). It will help us to have a taxon-
omy here.
Definition 2.16 (Linear order). A partial order which is also connected is called
a total order or linear order.
Example 2.17. Every linear order is also a partial order, and every partial or-
der is also a preorder, but the converses don’t hold. The universal relation
on A is a preorder, since it is reflexive and transitive. But, if A has more than
one element, the universal relation is not anti-symmetric, and so not a partial
order.
Definition 2.22 (Strict linear order). A strict order which is also connected is
called a strict total order or strict linear order.
17
2. R ELATIONS
Example 2.23. ≤ is the linear order corresponding to the strict linear order <.
⊆ is the partial order corresponding to the strict order ⊊.
Any strict order R on A can be turned into a partial order by adding the
diagonal Id A , i.e., adding all the pairs ⟨ x, x ⟩. (This is called the reflexive closure
of R.) Conversely, starting from a partial order, one can get a strict order by
removing Id A . These next two results make this precise.
The following simple result establishes that strict linear orders satisfy an
extensionality-like property:
Proof. Suppose (∀ x ∈ A)( x < a ≡ x < b). If a < b, then a < a, contradicting
the fact that < is irreflexive; so a ≮ b. Exactly similarly, b ≮ a. So a = b, as <
is connected.
18
2.5. Graphs
2.5 Graphs
Example 2.28. The graph ⟨V, E⟩ with V = {1, 2, 3, 4} and E = {⟨1, 1⟩, ⟨1, 2⟩,
⟨1, 3⟩, ⟨2, 3⟩} looks like this:
1 2 4
19
2. R ELATIONS
This is a different graph than ⟨V ′ , E⟩ with V ′ = {1, 2, 3}, which looks like this:
1 2
R1 = R and Rn+1 = Rn | R.
The reflexive transitive closure of R is R∗ = R+ ∪ Id A .
20
Chapter 3
Functions
3.1 Basics
A function is a map which sends each element of a given set to a specific ele-
ment in some (other) given set. For instance, the operation of adding 1 defines
a function: each number n is mapped to a unique number n + 1.
More generally, functions may take pairs, triples, etc., as inputs and re-
turn some kind of output. Many functions are familiar to us from basic arith-
metic. For instance, addition and multiplication are functions. They take in
two numbers and return a third.
In this mathematical, abstract sense, a function is a black box: what matters
is only what output is paired with what input, not the method for calculating
the output.
The diagram in Figure 3.1 may help to think about functions. The ellipse
on the left represents the function’s domain; the ellipse on the right represents
the function’s codomain; and an arrow points from an argument in the domain
to the corresponding value in the codomain.
Example 3.2. Multiplication takes pairs of natural numbers as inputs and maps
them to natural numbers as outputs, so goes from N × N (the domain) to N
(the codomain). As it turns out, the range is also N, since every n ∈ N is
n × 1.
21
3. F UNCTIONS
Example 3.4. The relation that pairs each student in a class with their final
grade is a function—no student can get two different final grades in the same
class. The relation that pairs each student in a class with their parents is not a
function: students can have zero, or two, or more parents.
We can define functions by specifying in some precise way what the value
of the function is for every possible argument. Different ways of doing this are
by giving a formula, describing a method for computing the value, or listing
the values for each argument. However functions are defined, we must make
sure that for each argument we specify one, and only one, value.
22
3.2. Kinds of Functions
Figure 3.2: A surjective function has every element of the codomain as a value.
if ∀ x f ( x ) = g( x ), then f = g
Example 3.7. We can also define functions by cases. For instance, we could
define h : N → N by
(
x
if x is even
h( x ) = 2x+1
2 if x is odd.
Since every natural number is either even or odd, the output of this function
will always be a natural number. Just remember that if you define a function
by cases, every possible input must fall into exactly one case. In some cases,
this will require a proof that the cases are exhaustive and exclusive.
(∀y ∈ B)(∃ x ∈ A) f ( x ) = y.
If you want to show that f is a surjection, then you need to show that every
object in f ’s codomain is the value of f ( x ) for some input x.
23
3. F UNCTIONS
Figure 3.3: An injective function never maps two different arguments to the
same value.
Note that any function induces a surjection. After all, given a function
f : A → B, let f ′ : A → ran( f ) be defined by f ′ ( x ) = f ( x ). Since ran( f ) is
defined as { f ( x ) ∈ B | x ∈ A}, this function f ′ is guaranteed to be a surjection
Now, any function maps each possible input to a unique output. But there
are also functions which never map different inputs to the same outputs. Such
functions are called injective, and can be pictured as in Figure 3.3.
Definition 3.9 (Injective function). A function f : A → B is injective iff for
each y ∈ B there is at most one x ∈ A such that f ( x ) = y. We call such a
function an injection from A to B.
If you want to show that f is an injection, you need to show that for any
elements x and y of f ’s domain, if f ( x ) = f (y), then x = y.
Example 3.10. The constant function f : N → N given by f ( x ) = 1 is neither
injective, nor surjective.
The identity function f : N → N given by f ( x ) = x is both injective and
surjective.
The successor function f : N → N given by f ( x ) = x + 1 is injective but
not surjective.
The function f : N → N defined by:
(
x
if x is even
f ( x ) = 2x+1
2 if x is odd.
is surjective, but not injective.
Often enough, we want to consider functions which are both injective and
surjective. We call such functions bijective. They look like the function pic-
tured in Figure 3.4. Bijections are also sometimes called one-to-one correspon-
dences, since they uniquely pair elements of the codomain with elements of
the domain.
Definition 3.11 (Bijection). A function f : A → B is bijective iff it is both sur-
jective and injective. We call such a function a bijection from A to B (or be-
tween A and B).
24
3.3. Functions as Relations
Figure 3.4: A bijective function uniquely pairs the elements of the codomain
with those of the domain.
R f = {⟨ x, y⟩ | f ( x ) = y}.
Proof. Suppose there is a y such that Rxy. If there were another z ̸= y such
that Rxz, the condition on R would be violated. Hence, if there is a y such that
Rxy, this y is unique, and so f is well-defined. Obviously, R f = R.
25
3. F UNCTIONS
It follows from these definitions that ran( f ) = f [dom( f )], for any func-
tion f . These notions are exactly as one would expect, given the definitions
in section 2.6 and our identification of functions with relations. But two other
operations—inverses and relative products—require a little more detail. We
will provide that in section 3.4 and section 3.5.
But the scare quotes around “defined by” (and “the”) suggest that this is not
a definition. At least, it will not always work, with complete generality. For,
in order for this definition to specify a function, there has to be one and only
one x such that f ( x ) = y—the output of g has to be uniquely specified. More-
over, it has to be specified for every y ∈ B. If there are x1 and x2 ∈ A with
x1 ̸= x2 but f ( x1 ) = f ( x2 ), then g(y) would not be uniquely specified for
y = f ( x1 ) = f ( x2 ). And if there is no x at all such that f ( x ) = y, then g(y) is
26
3.4. Inverses of Functions
not specified at all. In other words, for g to be defined, f must be both injective
and surjective.
Let’s go slowly. We’ll divide the question into two: Given a function f : A →
B, when is there a function g : B → A so that g( f ( x )) = x? Such a g “undoes”
what f does, and is called a left inverse of f . Secondly, when is there a function
h : B → A so that f (h(y)) = y? Such an h is called a right inverse of f — f
“undoes” what h does.
It is defined for all y ∈ B, since for each such y ∈ ran( f ) there is exactly one
x ∈ A such that f ( x ) = y. By definition, if y = f ( x ), then g(y) = x, i.e.,
g( f ( x )) = x.
By combining the ideas in the previous proof, we now get that every bijec-
tion has an inverse, i.e., there is a single function which is both a left and right
inverse of f .
of h requires that we choose a single x from each of these sets. That this is always possible is
actually not obvious—the possibility of making these choices is simply assumed as an axiom.
In other words, this proposition assumes the so-called Axiom of Choice, an issue we will gloss
over. However, in many specific cases, e.g., when A = N or is finite, or when f is bijective, the
Axiom of Choice is not required. (In the particular case when f is bijective, for each y ∈ B the set
{ x | f ( x ) = y} has exactly one element, so that there is no choice to make.)
27
3. F UNCTIONS
Proof. Exercise.
Proposition 3.19. Show that if f : A → B has a left inverse g and a right inverse h,
then h = g.
Proof. Exercise.
28
3.6. Partial Functions
Proposition 3.27. Suppose R ⊆ A × B has the property that whenever Rxy and
Rxy′ then y = y′ . Then R is the graph of the partial function f : X → 7 Y defined by:
if there is a y such that Rxy, then f ( x ) = y, otherwise f ( x ) ↑. If R is also serial, i.e.,
for each x ∈ X there is a y ∈ Y such that Rxy, then f is total.
Proof. Suppose there is a y such that Rxy. If there were another y′ ̸= y such
that Rxy′ , the condition on R would be violated. Hence, if there is a y such
that Rxy, that y is unique, and so f is well-defined. Obviously, R f = R and f
is total if R is serial.
29
Chapter 4
4.1 Introduction
When Georg Cantor developed set theory in the 1870s, one of his aims was
to make palatable the idea of an infinite collection—an actual infinity, as the
medievals would say. A key part of this was his treatment of the size of dif-
ferent sets. If a, b and c are all distinct, then the set { a, b, c} is intuitively larger
than { a, b}. But what about infinite sets? Are they all as large as each other?
It turns out that they are not.
The first important idea here is that of an enumeration. We can list every
finite set by listing all its elements. For some infinite sets, we can also list
all their elements if we allow the list itself to be infinite. Such sets are called
countable. Cantor’s surprising result, which we will fully understand by the
end of this chapter, was that some infinite sets are not countable.
31
4. T HE S IZE OF S ETS
The last argument shows that in order to get a good handle on enumer-
ations and countable sets and to prove things about them, we need a more
precise definition. The following provides it.
Let’s convince ourselves that the formal definition and the informal defini-
tion using a possibly infinite list are equivalent. First, any surjective function
from Z+ to a set A enumerates A. Such a function determines an enumeration
as defined informally above: the list f (1), f (2), f (3), . . . . Since f is surjective,
every element of A is guaranteed to be the value of f (n) for some n ∈ Z+ .
32
4.2. Enumerations and Countable Sets
Hence, every element of A appears at some finite position in the list. Since the
function may not be injective, the list may be redundant, but that is acceptable
(as noted above).
On the other hand, given a list that enumerates all elements of A, we can
define a surjective function f : Z+ → A by letting f (n) be the nth element
of the list, or the final element of the list if there is no nth element. The only
case where this does not produce a surjective function is when A is empty,
and hence the list is empty. So, every non-empty list determines a surjective
function f : Z+ → A.
Definition 4.4. A set A is countable iff it is empty or has an enumeration.
Example 4.5. A function enumerating the positive integers (Z+ ) is simply the
identity function given by f (n) = n. A function enumerating the natural
numbers N is the function g(n) = n − 1.
−⌈ 02 ⌉ ⌈ 12 ⌉ −⌈ 22 ⌉ ⌈ 32 ⌉ −⌈ 42 ⌉ ⌈ 52 ⌉ −⌈ 62 ⌉ . . .
0 1 −1 2 −2 3 ...
You can also think of f as defined by cases as follows:
0
if n = 1
f (n) = n/2 if n is even
−(n − 1)/2 if n is odd and > 1
33
4. T HE S IZE OF S ETS
Proof. We define the function g recursively: Let g(1) = f (1). If g(i ) has al-
ready been defined, let g(i + 1) be the first value of f (1), f (2), . . . not already
among g(1), . . . , g(i ), if there is one. If A has just n elements, then g(1), . . . ,
g(n) are all defined, and so we have defined a function g : {1, . . . , n} → A. If
A has infinitely many elements, then for any i there must be an element of A
in the enumeration f (1), f (2), . . . , which is not already among g(1), . . . , g(i ).
In this case we have defined a function g : Z+ → A.
The function g is surjective, since any element of A is among f (1), f (2), . . .
(since f is surjective) and so will eventually be a value of g(i ) for some i. It is
also injective, since if there were j < i such that g( j) = g(i ), then g(i ) would
already be among g(1), . . . , g(i − 1), contrary to how we defined g.
34
4.3. Cantor’s Zig-Zag Method
N × N = {⟨n, m⟩ | n, m ∈ N}
0 1 2 3 ...
0 ⟨0, 0⟩ ⟨0, 1⟩ ⟨0, 2⟩ ⟨0, 3⟩ ...
1 ⟨1, 0⟩ ⟨1, 1⟩ ⟨1, 2⟩ ⟨1, 3⟩ ...
2 ⟨2, 0⟩ ⟨2, 1⟩ ⟨2, 2⟩ ⟨2, 3⟩ ...
3 ⟨3, 0⟩ ⟨3, 1⟩ ⟨3, 2⟩ ⟨3, 3⟩ ...
.. .. .. .. .. ..
. . . . . .
Clearly, every ordered pair in N × N will appear exactly once in the array.
In particular, ⟨n, m⟩ will appear in the nth row and mth column. But how
do we organize the elements of such an array into a “one-dimensional” list?
The pattern in the array below demonstrates one way to do this (although of
course there are many other options):
0 1 2 3 4 ...
0 0 1 3 6 10 ...
1 2 4 7 11 ... ...
2 5 8 12 ... ... ...
3 9 13 ... ... ... ...
4 14 ... ... ... ... ...
.. .. .. .. .. ..
. . . . . ... .
⟨0, 0⟩, ⟨0, 1⟩, ⟨1, 0⟩, ⟨0, 2⟩, ⟨1, 1⟩, ⟨2, 0⟩, ⟨0, 3⟩, ⟨1, 2⟩, ⟨2, 1⟩, ⟨3, 0⟩, . . .
This technique also generalises rather nicely. For example, we can use it to
enumerate the set of ordered triples of natural numbers, i.e.:
N × N × N = {⟨n, m, k⟩ | n, m, k ∈ N}
35
4. T HE S IZE OF S ETS
N3 = (N × N) × N = {⟨⟨n, m⟩, k⟩ | n, m, k ∈ N}
and thus we can enumerate N3 with an array by labelling one axis with the
enumeration of N, and the other axis with the enumeration of N2 :
0 1 2 3 ...
⟨0, 0⟩ ⟨0, 0, 0⟩ ⟨0, 0, 1⟩ ⟨0, 0, 2⟩ ⟨0, 0, 3⟩ ...
⟨0, 1⟩ ⟨0, 1, 0⟩ ⟨0, 1, 1⟩ ⟨0, 1, 2⟩ ⟨0, 1, 3⟩ ...
⟨1, 0⟩ ⟨1, 0, 0⟩ ⟨1, 0, 1⟩ ⟨1, 0, 2⟩ ⟨1, 0, 3⟩ ...
⟨0, 2⟩ ⟨0, 2, 0⟩ ⟨0, 2, 1⟩ ⟨0, 2, 2⟩ ⟨0, 2, 3⟩ ...
.. .. .. .. .. ..
. . . . . .
Thus, by using a method like Cantor’s zig-zag method, we may similarly ob-
tain an enumeration of N3 . And we can keep going, obtaining enumerations
of Nn for any natural number n. So, we have:
This would enable us to calculate exactly where ⟨n, m⟩ will occur in our enu-
meration.
In fact, we can define g directly by making two observations. First: if the
nth row and mth column contains value v, then the (n + 1)st row and (m − 1)st
column contains value v + 1. Second: the first row of our enumeration con-
sists of the triangular numbers, starting with 0, 1, 3, 6, etc. The kth triangular
number is the sum of the natural numbers < k, which can be computed as
k (k + 1)/2. Putting these two observations together, consider this function:
(n + m + 1)(n + m)
g(n, m) = +n
2
We often just write g(n, m) rather that g(⟨n, m⟩), since it is easier on the eyes.
This tells you first to determine the (n + m)th triangle number, and then add
36
4.5. An Alternative Pairing Function
n to it. And it populates the array in exactly the way we would like. So in
particular, the pair ⟨1, 2⟩ is sent to 4×2 3 + 1 = 7.
This function g is the inverse of an enumeration of a set of pairs. Such
functions are called pairing functions.
We can use pairing functions to encode, e.g., pairs of natural numbers; or,
in other words, we can represent each pair of elements using a single number.
Using the inverse of the pairing function, we can decode the number, i.e., find
out which pair it represents.
There are other enumerations of N2 that make it easier to figure out what their
inverses are. Here is one. Instead of visualizing the enumeration in an array,
start with the list of positive integers associated with (initially) empty spaces.
Imagine filling these spaces successively with pairs ⟨n, m⟩ as follows. Starting
with the pairs that have 0 in the first place (i.e., pairs ⟨0, m⟩), put the first (i.e.,
⟨0, 0⟩) in the first empty place, then skip an empty space, put the second (i.e.,
⟨0, 2⟩) in the next empty place, skip one again, and so forth. The (incomplete)
beginning of our enumeration now looks like this
1 2 3 4 5 6 7 8 9 10 ...
Repeat this with pairs ⟨1, m⟩ for the place that still remain empty, again skip-
ping every other empty place:
1 2 3 4 5 6 7 8 9 10 ...
Enter pairs ⟨2, m⟩, ⟨2, m⟩, etc., in the same way. Our completed enumeration
thus starts like this:
1 2 3 4 5 6 7 8 9 10 ...
⟨0, 0⟩ ⟨1, 0⟩ ⟨0, 1⟩ ⟨2, 0⟩ ⟨0, 2⟩ ⟨1, 1⟩ ⟨0, 3⟩ ⟨3, 0⟩ ⟨0, 4⟩ ⟨1, 2⟩ ...
37
4. T HE S IZE OF S ETS
0 1 2 3 4 5 ...
0 1 3 5 7 9 11 ...
1 2 6 10 14 18 ... ...
2 4 12 20 28 ... ... ...
3 8 24 40 ... ... ... ...
4 16 48 ... ... ... ... ...
5 32 ... ... ... ... ... ...
.. .. .. .. .. .. .. ..
. . . . . . . .
We can see that the pairs in row 0 are in the odd numbered places of our
enumeration, i.e., pair ⟨0, m⟩ is in place 2m + 1; pairs in the second row, ⟨1, m⟩,
are in places whose number is the double of an odd number, specifically, 2 ·
(2m + 1); pairs in the third row, ⟨2, m⟩, are in places whose number is four
times an odd number, 4 · (2m + 1); and so on. The factors of (2m + 1) for
each row, 1, 2, 4, 8, . . . , are exactly the powers of 2: 1 = 20 , 2 = 21 , 4 = 22 ,
8 = 23 , . . . In fact, the relevant exponent is always the first member of the pair
in question. Thus, for pair ⟨n, m⟩ the factor is 2n . This gives us the general
formula: 2n · (2m + 1). However, this is a mapping of pairs to positive integers,
i.e., ⟨0, 0⟩ has position 1. If we want to begin at position 0 we must subtract 1
from the result. This gives us:
h(n, m) = 2n (2m + 1) − 1
j(n, m) = 2n 3m
is an injective function N2 → N.
38
4.6. Uncountable Sets
We may arrange this list, and the elements of each sequence si in it, in an
array:
1 2 3 4 ...
1 s 1 ( 1 ) s1 (2) s1 (3) s1 (4) . . .
2 s2 (1) s 2 ( 2 ) s2 (3) s2 (4) . . .
3 s3 (1) s3 (2) s 3 ( 3 ) s3 (4) . . .
4 s4 (1) s4 (2) s4 (3) s 4 ( 4 ) . . .
.. .. .. .. .. ..
. . . . . .
The labels down the side give the number of the sequence in the list s1 , s2 , . . . ;
the numbers across the top label the elements of the individual sequences. For
instance, s1 (1) is a name for whatever number, a 0 or a 1, is the first element
in the sequence s1 , and so on.
39
4. T HE S IZE OF S ETS
Now we construct an infinite sequence, s, of 0’s and 1’s which cannot pos-
sibly be on this list. The definition of s will depend on the list s1 , s2 , . . . .
Any infinite list of infinite sequences of 0’s and 1’s gives rise to an infinite
sequence s which is guaranteed to not appear on the list.
To define s, we specify what all its elements are, i.e., we specify s(n) for all
n ∈ Z+ . We do this by reading down the diagonal of the array above (hence
the name “diagonal method”) and then changing every 1 to a 0 and every 0 to
a 1. More abstractly, we define s(n) to be 0 or 1 according to whether the n-th
element of the diagonal, sn (n), is 1 or 0.
(
1 if sn (n) = 0
s(n) =
0 if sn (n) = 1.
If you like formulas better than definitions by cases, you could also define
s ( n ) = 1 − s n ( n ).
Clearly s is an infinite sequence of 0’s and 1’s, since it is just the mirror
sequence to the sequence of 0’s and 1’s that appear on the diagonal of our
array. So s is an element of Bω . But it cannot be on the list s1 , s2 , . . . Why not?
It can’t be the first sequence in the list, s1 , because it differs from s1 in the
first element. Whatever s1 (1) is, we defined s(1) to be the opposite. It can’t be
the second sequence in the list, because s differs from s2 in the second element:
if s2 (2) is 0, s(2) is 1, and vice versa. And so on.
More precisely: if s were on the list, there would be some k so that s = sk .
Two sequences are identical iff they agree at every place, i.e., for any n, s(n) =
sk (n). So in particular, taking n = k as a special case, s(k) = sk (k) would
have to hold. sk (k) is either 0 or 1. If it is 0 then s(k ) must be 1—that’s how
we defined s. But if sk (k ) = 1 then, again because of the way we defined s,
s(k) = 0. In either case s(k) ̸= sk (k ).
We started by assuming that there is a list of elements of Bω , s1 , s2 , . . .
From this list we constructed a sequence s which we proved cannot be on the
list. But it definitely is a sequence of 0’s and 1’s if all the si are sequences of
0’s and 1’s, i.e., s ∈ Bω . This shows in particular that there can be no list of
all elements of Bω , since for any such list we could also construct a sequence s
guaranteed to not be on the list, so the assumption that there is a list of all
sequences in Bω leads to a contradiction.
40
4.7. Reduction
Proof. We proceed in the same way, by showing that for every list of subsets
of Z+ there is a subset of Z+ which cannot be on the list. Suppose the follow-
ing is a given list of subsets of Z+ :
Z1 , Z2 , Z3 , . . .
Z = { n ∈ Z+ | n ∈
/ Zn }
Z is clearly a set of positive integers, since by assumption each Zn is, and thus
Z ∈ ℘(Z+ ). But Z cannot be on the list. To show this, we’ll establish that for
each k ∈ Z+ , Z ̸= Zk .
So let k ∈ Z+ be arbitrary. We’ve defined Z so that for any n ∈ Z+ , n ∈ Z
/ Zn . In particular, taking n = k, k ∈ Z iff k ∈
iff n ∈ / Zk . But this shows that
Z ̸= Zk , since k is an element of one but not the other, and so Z and Zk have
different elements. Since k was arbitrary, Z is not on the list Z1 , Z2 , . . .
The preceding proof did not mention a diagonal, but you can think of it
as involving a diagonal if you picture it this way: Imagine the sets Z1 , Z2 , . . . ,
written in an array, where each element j ∈ Zi is listed in the j-th column.
Say the first four sets on that list are {1, 2, 3, . . . }, {2, 4, 6, . . . }, {1, 2, 5}, and
{3, 4, 5, . . . }. Then the array would begin with
Z1 = {1, 2, 3, 4, 5, 6, ...}
Z2 ={ 2, 4, 6, ...}
Z3 = { 1, 2, 5 }
Z4 ={ 3, 4, 5, 6, ...}
.. ..
. .
Then Z is the set obtained by going down the diagonal, leaving out any num-
bers that appear along the diagonal and include those j where the array has a
gap in the j-th row/column. In the above case, we would leave out 1 and 2,
include 3, leave out 4, etc.
4.7 Reduction
We showed ℘(Z+ ) to be uncountable by a diagonalization argument. We
already had a proof that Bω , the set of all infinite sequences of 0s and 1s, is
uncountable. Here’s another way we can prove that ℘(Z+ ) is uncountable:
Show that if ℘(Z+ ) is countable then Bω is also countable. Since we know Bω
is not countable, ℘(Z+ ) can’t be either. This is called reducing one problem
to another—in this case, we reduce the problem of enumerating Bω to the
problem of enumerating ℘(Z+ ). A solution to the latter—an enumeration of
℘(Z+ )—would yield a solution to the former—an enumeration of Bω .
41
4. T HE S IZE OF S ETS
Proof of Theorem 4.18 by reduction. Suppose that ℘(Z+ ) were countable, and
thus that there is an enumeration of it, Z1 , Z2 , Z3 , . . .
Define the function f : ℘(Z+ ) → Bω by letting f ( Z ) be the sequence sk
such that sk (n) = 1 iff n ∈ Z, and sk (n) = 0 otherwise. This clearly defines
a function, since whenever Z ⊆ Z+ , any n ∈ Z+ either is an element of Z or
isn’t. For instance, the set 2Z+ = {2, 4, 6, . . . } of positive even numbers gets
mapped to the sequence 010101 . . . , the empty set gets mapped to 0000 . . .
and the set Z+ itself to 1111 . . . .
It also is surjective: Every sequence of 0s and 1s corresponds to some set of
positive integers, namely the one which has as its members those integers cor-
responding to the places where the sequence has 1s. More precisely, suppose
s ∈ Bω . Define Z ⊆ Z+ by:
Z = { n ∈ Z+ | s ( n ) = 1 }
f ( Z1 ), f ( Z2 ), f ( Z3 ), . . .
It is easy to be confused about the direction the reduction goes in. For
instance, a surjective function g : Bω → B does not establish that B is uncount-
able. (Consider g : Bω → B defined by g(s) = s(1), the function that maps
a sequence of 0’s and 1’s to its first element. It is surjective, because some se-
quences start with 0 and some start with 1. But B is finite.) Note also that the
function f must be surjective, or otherwise the argument does not go through:
f ( x1 ), f ( x2 ), . . . would then not be guaranteed to include all the elements of B.
For instance,
h(n) = 000
| {z. . . 0}
n 0’s
42
4.8. Equinumerosity
4.8 Equinumerosity
We have an intuitive notion of “size” of sets, which works fine for finite sets.
But what about infinite sets? If we want to come up with a formal way of
comparing the sizes of two sets of any size, it is a good idea to start by defining
when sets are the same size. Here is Frege:
If a waiter wants to be sure that he has laid exactly as many knives
as plates on the table, he does not need to count either of them, if
he simply lays a knife to the right of each plate, so that every knife
on the table lies to the right of some plate. The plates and knives
are thus uniquely correlated to each other, and indeed through that
same spatial relationship. (Frege, 1884, §70)
The insight of this passage can be brought out through a formal definition:
Definition 4.19. A is equinumerous with B, written A ≈ B, iff there is a bijec-
tion f : A → B.
43
4. T HE S IZE OF S ETS
It is clear that this is a reflexive and transitive relation, but that it is not
symmetric (this is left as an exercise). We can also introduce a notion, which
states that one set is (strictly) smaller than another.
A = {x ∈ A | x ∈
/ g( x )}.
44
4.10. The Notion of Size, and Schröder-Bernstein
x ∈ A, x ∈ g( x ) iff x ∈
/ A, and so g( x ) ̸= A. In other words, A cannot be in
the range of g, contradicting the assumption that g is surjective.
It’s instructive to compare the proof of Theorem 4.24 to that of Theorem 4.18.
There we showed that for any list Z1 , Z2 , . . . , of subsets of Z+ one can con-
struct a set Z of numbers guaranteed not to be on the list. It was guaranteed
not to be on the list because, for every n ∈ Z+ , n ∈ Zn iff n ∈ / Z. This way,
there is always some number that is an element of one of Zn or Z but not the
other. We follow the same idea here, except the indices n are now elements
of A instead of Z+ . The set B is defined so that it is different from g( x ) for
each x ∈ A, because x ∈ g( x ) iff x ∈ / B. Again, there is always an element
of A which is an element of one of g( x ) and B but not the other. And just as Z
therefore cannot be on the list Z1 , Z2 , . . . , B cannot be in the range of g.
The proof is also worth comparing with the proof of Russell’s Paradox,
Theorem 1.29. Indeed, Cantor’s Theorem was the inspiration for Russell’s
own paradox.
1 For more on the history, see e.g., Potter (2004, pp. 165–6).
45
Part II
First-order Logic
47
Chapter 5
49
5. I NTRODUCTION TO F IRST-O RDER L OGIC
M ⊨ φ) for sentences φ and structures M. Once this is done, we can also give
precise definitions of the other semantical terms such as “follows from” or “is
logically true.” These definitions will make it possible to settle, again with
mathematical precision, whether, e.g., ∀ x ( φ( x ) ⊃ ψ( x )), ∃ x φ( x ) ⊨ ∃ x ψ( x ).
The answer will, of course, be “yes.” If you’ve already been trained to symbol-
ize sentences of English in first-order logic, you will recognize this as, e.g., the
symbolizations of, say, “All ants are insects, there are ants, therefore there are
insects.” That is obviously a valid argument, and so our mathematical model
of “follows from” for our formal language should give the same answer.
Another topic you probably remember from your first introduction to for-
mal logic is that there are derivations. If you have taken a first formal logic
course, your instructor will have made you practice finding such derivations,
perhaps even a derivation that shows that the above entailment holds. There
are many different ways to give derivations: you may have done something
called “natural deduction” or “truth trees,” but there are many others. The
purpose of derivation systems is to provide tools using which the logicians’
questions above can be answered: e.g., a natural deduction derivation in which
∀ x ( φ( x ) ⊃ ψ( x )) and ∃ x φ( x ) are premises and ∃ x ψ( x ) is the conclusion (last
line) verifies that ∃ x ψ( x ) logically follows from ∀ x ( φ( x ) ⊃ ψ( x )) and ∃ x φ( x ).
But why is that? On the face of it, derivation systems have nothing to do
with semantics: giving a formal derivation merely involves arranging sym-
bols in certain rule-governed ways; they don’t mention “cases” or “true in” at
all. The connection between derivation systems and semantics has to be estab-
lished by a meta-logical investigation. What’s needed is a mathematical proof,
e.g., that a formal derivation of ∃ x ψ( x ) from premises ∀ x ( φ( x ) ⊃ ψ( x )) and
∃ x φ( x ) is possible, if, and only if, ∀ x ( φ( x ) ⊃ ψ( x )) and ∃ x φ( x ) together en-
tail ∃ x ψ( x ). Before this can be done, however, a lot of painstaking work has
to be carried out to get the definitions of syntax and semantics correct.
5.2 Syntax
We first must make precise what strings of symbols count as sentences of first-
order logic. We’ll do this later; for now we’ll just proceed by example. The
basic building blocks—the vocabulary—of first-order logic divides into two
parts. The first part is the symbols we use to say specific things or to pick out
specific things. We pick out things using constant symbols, and we say stuff
about the things we pick out using predicate symbols. E.g, we might use a as
a constant symbol to pick out a single thing, and then say something about
it using the sentence P (a). If you have meanings for “a” and “P ” in mind,
you can read P (a) as a sentence of English (and you probably have done so
when you first learned formal logic). Once you have such simple sentences
of first-order logic, you can build more complex ones using the second part
of the vocabulary: the logical symbols (connectives and quantifiers). So, for
50
5.3. Formulae
5.3 Formulae
Here is the approach we will use to rigorously specify sentences of first-order
logic and to deal with the issues arising from the use of variables. We first
define a different set of expressions: formulae. Once we’ve done that, we can
consider the role variables play in them—and on the basis of some other ideas,
namely those of “free” and “bound” variables, we can define what a sentence
is (namely, a formula without free variables). We do this not just because it
makes the definition of “sentence” more manageable, but also because it will
be crucial to the way we define the semantic notion of satisfaction.
Let’s define “formula” for a simple first-order language, one containing
only a single predicate symbol P and a single constant symbol a, and only the
logical symbols ∼, &, and ∃. Our full definitions will be much more general:
we’ll allow infinitely many predicate symbols and constant symbols. In fact,
we will also consider function symbols which can be combined with constant
symbols and variables to form “terms.” For now, a and the variables will be
our only terms. We do need infinitely many variables. We’ll officially use the
symbols v0 , v1 , . . . , as variables.
51
5. I NTRODUCTION TO F IRST-O RDER L OGIC
(1) tells us that P (a) and P (vi ) are formulae, for any i ∈ N. These are the
so-called atomic formulae. They give us something to start from. The other
clauses give us ways of forming new formulae from ones we have already
formed. So for instance, by (2), we get that ∼P (v2 ) is a formula, since P (v2 )
is already a formula by (1). Then, by (4), we get that ∃v2 ∼P (v2 ) is another
formula, and so on. (5) tells us that only strings we can form in this way count
as formulae. In particular, ∃v0 P (a) and ∃v0 ∃v0 P (a) do count as formulae,
and (∼P (a)) does not, because of the extraneous outer parentheses.
This way of defining formulae is called an inductive definition, and it allows
us to prove things about formulae using a version of proof by induction called
structural induction. These are discussed in a general way in appendix B.4 and
appendix B.5, which you should review before delving into the proofs later
on. Basically, the idea is that if you want to give a proof that something is true
for all formulae, you show first that it is true for the atomic formulae, and then
that if it’s true for any formula φ (and ψ), it’s also true for ∼ φ, ( φ & ψ), and
∃ x φ. For instance, this proves that it’s true for ∃v2 ∼P (v2 ): from the first part
you know that it’s true for the atomic formula P (v2 ). Then you get that it’s
true for ∼P (v2 ) by the second part, and then again that it’s true for ∃v2 ∼P (v2 )
itself. Since all formulae are inductively generated from atomic formulae, this
works for any of them.
5.4 Satisfaction
We can already skip ahead to the semantics of first-order logic once we know
what formulae are: here, the basic definition is that of a structure. For our
simple language, a structure M has just three components: a non-empty set
|M| called the domain, what a picks out in M, and what P is true of in M.
The object picked out by a is denoted aM and the set of things P is true of
by P M . A structure M consists of just these three things: |M|, aM ∈ |M|
and P M ⊆ |M|. The general case will be more complicated, since there will
be many predicate symbols and constant symbols, the constant symbols can
have more than one place, and there will also be function symbols.
This is enough to give a definition of satisfaction for formulae that don’t
contain variables. The idea is to give an inductive definition that mirrors the
way we have defined formulae. We specify when an atomic formula is satis-
fied in M, and then when, e.g., ∼ φ is satisfied in M on the basis of whether or
not φ is satisfied in M. E.g., we could define:
52
5.4. Satisfaction
Let’s say that |M| = {0, 1, 2}, aM = 1, and P M = {1, 2}. This definition
would tell us that P (a) is satisfied in M (since aM = 1 ∈ {1, 2} = P M ). It tells
us further that ∼P (a) is not satisfied in M, and that in turn ∼∼P (a) is and
(∼P (a) & P (a)) is not satisfied, and so on.
The trouble comes when we want to give a definition for the quantifiers:
we’d like to say something like, “∃v0 P (v0 ) is satisfied iff P (v0 ) is satisfied.”
But the structure M doesn’t tell us what to do about variables. What we ac-
tually want to say is that P (v0 ) is satisfied for some value of v0 . To make this
precise we need a way to assign elements of |M| not just to a but also to v0 . To
this end, we introduce variable assignments. A variable assignment is simply
a function s that maps variables to elements of |M| (in our example, to one
of 1, 2, or 3). Since we don’t know beforehand which variables might appear
in a formula we can’t limit which variables s assigns values to. The simple
solution is to require that s assigns values to all variables v0 , v1 , . . . We’ll just
use only the ones we need.
Instead of defining satisfaction of formulae just relative to a structure, we’ll
define it relative to a structure M and a variable assignment s, and write M, s ⊨
φ for short. Our definition will now include an additional clause to deal with
atomic formulae containing variables:
1. M, s ⊨ P (a) iff aM ∈ P M .
3. M, s ⊨ ∼ φ iff not M, s ⊨ φ.
Ok, this solves one problem: we can now say when M satisfies P (v0 ) for the
value s(v0 ). To get the definition right for ∃v0 P (v0 ) we have to do one more
thing: We want to have that M, s ⊨ ∃v0 P (v0 ) iff M, s′ ⊨ P (v0 ) for some way
s′ of assigning a value to v0 . But the value assigned to v0 does not necessarily
have to be the value that s(v0 ) picks out. We’ll introduce a notation for that:
if m ∈ |M|, then we let s[m/v0 ] be the assignment that is just like s (for all
variables other than v0 ), except to v0 it assigns m. Now our definition can be:
Does it work out? Let’s say we let s(vi ) = 0 for all i ∈ N. M, s ⊨ ∃v0 P (v0 ) iff
there is an m ∈ |M| so that M, s[m/v0 ] ⊨ P (v0 ). And there is: we can choose
m = 1 or m = 2. Note that this is true even if the value s(v0 ) assigned to v0 by
s itself—in this case, 0—doesn’t do the job. We have M, s[1/v0 ] ⊨ P (v0 ) but
not M, s ⊨ P (v0 ).
53
5. I NTRODUCTION TO F IRST-O RDER L OGIC
If this looks confusing and cumbersome: it is. But the added complexity is
required to give a precise, inductive definition of satisfaction for all formulae,
and we need something like it to precisely define the semantic notions. There
are other ways of doing it, but they are all equally (in)elegant.
5.5 Sentences
Ok, now we have a (sketch of a) definition of satisfaction (“true in”) for struc-
tures and formulae. But it needs this additional bit—a variable assignment—
and what we wanted is a definition of sentences. How do we get rid of as-
signments, and what are sentences?
You probably remember a discussion in your first introduction to formal
logic about the relation between variables and quantifiers. A quantifier is al-
ways followed by a variable, and then in the part of the sentence to which that
quantifier applies (its “scope”), we understand that the variable is “bound”
by that quantifier. In formulae it was not required that every variable has a
matching quantifier, and variables without matching quantifiers are “free” or
“unbound.” We will take sentences to be all those formulae that have no free
variables.
Again, the intuitive idea of when an occurrence of a variable in a formula φ
is bound, which quantifier binds it, and when it is free, is not difficult to get.
You may have learned a method for testing this, perhaps involving counting
parentheses. We have to insist on a precise definition—and because we have
defined formulae by induction, we can give a definition of the free and bound
occurrences of a variable x in a formula φ also by induction. E.g., it might look
like this for our simplified language:
54
5.6. Semantic Notions
5.7 Substitution
We’ll discuss an example to illustrate how things hang together, and how the
development of syntax and semantics lays the foundation for our more ad-
vanced investigations later. Our derivation systems should let us derive P (a)
from ∀v0 P (v0 ). Maybe we even want to state this as a rule of inference. How-
ever, to do so, we must be able to state it in the most general terms: not just
for P , a, and v0 , but for any formula φ, and term t, and variable x. (Recall
that constant symbols are terms, but we’ll consider also more complicated
terms built from constant symbols and function symbols.) So we want to be
able to say something like, “whenever you have derived ∀ x φ( x ) you are jus-
tified in inferring φ(t)—the result of removing ∀ x and replacing x by t.” But
what exactly does “replacing x by t” mean? What is the relation between φ( x )
and φ(t)? Does this always work?
55
5. I NTRODUCTION TO F IRST-O RDER L OGIC
∀ v0 P ( v 0 , v0 )
∀v0 ∀v1 ∀v2 ((P (v0 , v1 ) & P (v1 , v2 )) ⊃ P (v0 , v2 ))
These sentences are just the symbolizations of “for any x, Rxx” (R is reflexive)
and “whenever Rxy and Ryz then also Rxz” (R is transitive). We see that
a structure M is a model of these two sentences Γ iff R (i.e., P M ), is a preorder
on A (i.e., |M|). In other words, the models of Γ are exactly the preorders. Any
property of all preorders that can be expressed in the first-order language with
56
5.9. Soundness and Completeness
57
5. I NTRODUCTION TO F IRST-O RDER L OGIC
58
Chapter 6
6.1 Introduction
In order to develop the theory and metatheory of first-order logic, we must
first define the syntax and semantics of its expressions. The expressions of
first-order logic are terms and formulae. Terms are formed from variables,
constant symbols, and function symbols. Formulae, in turn, are formed from
predicate symbols together with terms (these form the smallest, “atomic” for-
mulae), and then from atomic formulae we can form more complex ones us-
ing logical connectives and quantifiers. There are many different ways to set
down the formation rules; we give just one possible one. Other systems will
chose different symbols, will select different sets of connectives as primitive,
will use parentheses differently (or even not at all, as in the case of so-called
Polish notation). What all approaches have in common, though, is that the
formation rules define the set of terms and formulae inductively. If done prop-
erly, every expression can result essentially in only one way according to the
formation rules. The inductive definition resulting in expressions that are
uniquely readable means we can give meanings to these expressions using the
same method—inductive definition.
59
6. S YNTAX OF F IRST-O RDER L OGIC
1. Logical symbols
Most of our definitions and results will be formulated for the full standard
language of first-order logic. However, depending on the application, we may
also restrict the language to only a few predicate symbols, constant symbols,
and function symbols.
Example 6.2. The language of set theory L Z contains only the single two-
place predicate symbol ∈.
Example 6.3. The language of orders L≤ contains only the two-place predi-
cate symbol ≤.
Again, these are conventions: officially, these are just aliases, e.g., <, ∈,
and ≤ are aliases for A20 , 0 for c0 , ′ for f01 , + for f02 , × for f12 .
In addition to the primitive connectives and quantifiers introduced above,
we also use the following defined symbols: ≡ (biconditional), truth ⊤
A defined symbol is not officially part of the language, but is introduced
as an informal abbreviation: it allows us to abbreviate formulas which would,
60
6.3. Terms and Formulae
if we only used primitive symbols, get quite long. This is obviously an ad-
vantage. The bigger advantage, however, is that proofs become shorter. If a
symbol is primitive, it has to be treated separately in proofs. The more primi-
tive symbols, therefore, the longer our proofs.
You may be familiar with different terminology and symbols than the ones
we use above. Logic texts (and teachers) commonly use ∼, ¬, or ! for “nega-
tion”, ∧, ·, or & for “conjunction”. Commonly used symbols for the “condi-
tional” or “implication” are →, ⇒, and ⊃. Symbols for “biconditional,” “bi-
implication,” or “(material) equivalence” are ↔, ⇔, and ≡. The ⊥ symbol is
variously called “falsity,” “falsum,”, “absurdity,” or “bottom.” The ⊤ symbol
is variously called “truth,” “verum,” or “top.”
It is conventional to use lower case letters (e.g., a, b, c) from the begin-
ning of the Latin alphabet for constant symbols (sometimes called names),
and lower case letters from the end (e.g., x, y, z) for variables. Quantifiers
combine with variables, e.g., x; notational variations include ∀ x, (∀ x ), ( x ),
Πx, x for the universal quantifier and ∃ x, (∃ x ), ( Ex ), Σx, x for the existen-
V W
tial quantifier.
We might treat all the propositional operators and both quantifiers as prim-
itive symbols of the language. We might instead choose a smaller stock of
primitive symbols and treat the other logical operators as defined. “Truth
functionally complete” sets of Boolean operators include {∼, ∨}, {∼, &}, and
{∼, ⊃}—these can be combined with either quantifier for an expressively
complete first-order language.
You may be familiar with two other logical operators: the Sheffer stroke |
(named after Henry Sheffer), and Peirce’s arrow ↓, also known as Quine’s
dagger. When given their usual readings of “nand” and “nor” (respectively),
these operators are truth functionally complete by themselves.
61
6. S YNTAX OF F IRST-O RDER L OGIC
The constant symbols appear in our specification of the language and the
terms as a separate category of symbols, but they could instead have been in-
cluded as zero-place function symbols. We could then do without the second
clause in the definition of terms. We just have to understand f (t1 , . . . , tn ) as
just f by itself if n = 0.
Definition 6.5 (Formulas). The set of formulae Frm(L) of the language L is
defined inductively as follows:
1. ⊥ is an atomic formula.
2. If R is an n-place predicate symbol of L and t1 , . . . , tn are terms of L,
then R(t1 , . . . , tn ) is an atomic formula.
3. If t1 and t2 are terms of L, then =(t1 , t2 ) is an atomic formula.
4. If φ is a formula, then ∼ φ is a formula.
5. If φ and ψ are formulae, then ( φ & ψ) is a formula.
6. If φ and ψ are formulae, then ( φ ∨ ψ) is a formula.
7. If φ and ψ are formulae, then ( φ ⊃ ψ) is a formula.
8. If φ is a formula and x is a variable, then ∀ x φ is a formula.
9. If φ is a formula and x is a variable, then ∃ x φ is a formula.
10. Nothing else is a formula.
The definitions of the set of terms and that of formulae are inductive defini-
tions. Essentially, we construct the set of formulae in infinitely many stages. In
the initial stage, we pronounce all atomic formulas to be formulas; this corre-
sponds to the first few cases of the definition, i.e., the cases for ⊥, R(t1 , . . . , tn )
and =(t1 , t2 ). “Atomic formula” thus means any formula of this form.
The other cases of the definition give rules for constructing new formu-
lae out of formulae already constructed. At the second stage, we can use
them to construct formulae out of atomic formulae. At the third stage, we
construct new formulas from the atomic formulas and those obtained in the
second stage, and so on. A formula is anything that is eventually constructed
at such a stage, and nothing else.
By convention, we write = between its arguments and leave out the paren-
theses: t1 = t2 is an abbreviation for =(t1 , t2 ). Moreover, ∼=(t1 , t2 ) is abbre-
viated as t1 ̸= t2 . When writing a formula (ψ ∗ χ) constructed from ψ, χ
using a two-place connective ∗, we will often leave out the outermost pair of
parentheses and write simply ψ ∗ χ.
Some logic texts require that the variable x must occur in φ in order for
∃ x φ and ∀ x φ to count as formulae. Nothing bad happens if you don’t require
this, and it makes things easier.
62
6.3. Terms and Formulae
1. ⊤ abbreviates ∼⊥.
(assuming t1 , . . . , tn are terms of L), then P holds for every term in Trm(L).
63
6. S YNTAX OF F IRST-O RDER L OGIC
(assuming φ and ψ are formulae of L), then P holds for all formulas in Frm(L).
1. We take θ to be φ and θ ⊃ θ to be ψ.
2. We take φ to be θ ⊃ θ and ψ is θ.
Lemma 6.10. The number of left and right parentheses in a formula φ are equal.
64
6.4. Unique Readability
7. φ ≡ ∃ x ψ: Similarly.
Proof. Exercise.
Proposition 6.13. If φ is an atomic formula, then it satisfies one, and only one of the
following conditions.
1. φ ≡ ⊥.
Proof. Exercise.
65
6. S YNTAX OF F IRST-O RDER L OGIC
Proposition 6.14 (Unique Readability). Every formula satisfies one, and only one
of the following conditions.
1. φ is atomic.
6. φ is of the form ∀ x ψ.
7. φ is of the form ∃ x ψ.
Moreover, in each case ψ, or ψ and χ, are uniquely determined. This means that, e.g.,
there are no different pairs ψ, χ and ψ′ , χ′ so that φ is both of the form (ψ ⊃ χ) and
( ψ ′ ⊃ χ ′ ).
Proof. The formation rules require that if a formula is not atomic, it must start
with an opening parenthesis (, ∼, or a quantifier. On the other hand, every
formula that starts with one of the following symbols must be atomic: a pred-
icate symbol, a function symbol, a constant symbol, ⊥.
So we really only have to show that if φ is of the form (ψ ∗ χ) and also of
the form (ψ′ ∗′ χ′ ), then ψ ≡ ψ′ , χ ≡ χ′ , and ∗ = ∗′ .
So suppose both φ ≡ (ψ ∗ χ) and φ ≡ (ψ′ ∗′ χ′ ). Then either ψ ≡ ψ′ or not.
If it is, clearly ∗ = ∗′ and χ ≡ χ′ , since they then are substrings of φ that begin
in the same place and are of the same length. The other case is ψ ̸≡ ψ′ . Since
ψ and ψ′ are both substrings of φ that begin at the same place, one must be a
proper prefix of the other. But this is impossible by Lemma 6.12.
66
6.6. Subformulae
In each case, we intend the specific indicated occurrence of the main oper-
ator in the formula. For instance, since the formula ((θ ⊃ α) ⊃ (α ⊃ θ )) is of
the form (ψ ⊃ χ) where ψ is (θ ⊃ α) and χ is (α ⊃ θ ), the second occurrence
of ⊃ is the main operator.
This is a recursive definition of a function which maps all non-atomic for-
mulae to their main operator occurrence. Because of the way formulae are de-
fined inductively, every formula φ satisfies one of the cases in Definition 6.15.
This guarantees that for each non-atomic formula φ a main operator exists.
Because each formula satisfies only one of these conditions, and because the
smaller formulae from which φ is constructed are uniquely determined in
each case, the main operator occurrence of φ is unique, and so we have de-
fined a function.
We call formulae by the names in Table 6.1 depending on which symbol
their main operator is. Recall, however, that defined operators do not officially
appear in formulae. They are just abbreviations, so officially they cannot be
the main operator of a formula. In proofs about all formulae they therefore do
not have to be treated separately.
Main operator Type of formula Example
none atomic (formula) ⊥, R ( t1 , . . . , t n ), t1 = t2
∼ negation ∼φ
& conjunction ( φ & ψ)
∨ disjunction ( φ ∨ ψ)
⊃ conditional ( φ ⊃ ψ)
≡ biconditional ( φ ≡ ψ)
∀ universal (formula) ∀x φ
∃ existential (formula) ∃x φ
Table 6.1: Main operator and names of formulae
6.6 Subformulae
It is often useful to talk about the formulae that “make up” a given formula.
We call these its subformulae. Any formula counts as a subformula of itself; a
subformula of φ other than φ itself is a proper subformula.
67
6. S YNTAX OF F IRST-O RDER L OGIC
68
6.7. Formation Sequences
Example 6.22. For any first-order language L, all L-formulae are L-strings,
but not conversely. For example,
)(v0 ⊃ ∃
1. φi ≡ ∼ φ j .
2. φi ≡ ( φ j & φk ).
3. φi ≡ ( φ j ∨ φk ).
69
6. S YNTAX OF F IRST-O RDER L OGIC
4. φi ≡ ( φ j ⊃ φk ).
5. φi ≡ ∀ x φ j .
6. φi ≡ ∃ x φ j .
When it is necessary to distinguish, we will refer to formation sequences for
formulas as formula formation sequences.
Example 6.26.
⟨A10 (v0 ), A11 (c1 ), (A11 (c1 ) & A10 (v0 )), ∃v0 (A11 (c1 ) & A10 (v0 ))⟩
⟨A10 (v0 ), A11 (c1 ), (A11 (c1 ) & A10 (v0 )), A11 (c1 ),
∀v1 A10 (v0 ), ∃v0 (A11 (c1 ) & A10 (v0 ))⟩.
As can be seen from the second example, formation sequences may contain
“junk”: formulae which are redundant or do not contribute to the construc-
tion.
We can also prove the converse. This is important because it shows that
our two ways of defining formulas are equivalent: they give the same results.
It also means that we can prove theorems about formulas by using ordinary
induction on the length of formation sequences.
70
6.7. Formation Sequences
Proof. Exercise.
Theorem 6.29. Frm(L) is the set of all L-strings φ such that there exists a formula
formation sequence for φ.
Proof. Let F be the set of all strings of symbols in the language L that have a
formation sequence. We have seen in Proposition 6.27 that Frm(L) ⊆ F, so
now we prove the converse.
Suppose φ has a formation sequence ⟨ φ0 , . . . , φn ⟩. We prove that φ ∈
Frm(L) by strong induction on n. Our induction hypothesis is that every
string of symbols with a formation sequence of length m < n is in Frm(L). By
the definition of a formation sequence, either φ ≡ φn is atomic or there must
exist j, k < n such that one of the following is the case:
1. φ ≡ ∼ φ j .
2. φ ≡ ( φ j & φk ).
3. φ ≡ ( φ j ∨ φk ).
4. φ ≡ ( φ j ⊃ φk ).
5. φ ≡ ∀ x φ j .
6. φ ≡ ∃ x φ j .
Now we reason by cases. If φ is atomic then φn ∈ Frm(L0 ). Suppose in-
stead that φ ≡ ( φ j & φk ). By Lemma 6.28, ⟨ φ0 , . . . , φ j ⟩ and ⟨ φ0 , . . . , φk ⟩ are
formation sequences for φ j and φk , respectively. Since these are proper ini-
tial subsequences of the formation sequence for φ, they both have length less
than n. Therefore by the induction hypothesis, φ j and φk are in Frm(L0 ), and
by the definition of a formula, so is ( φ j & φk ). The other cases follow by par-
allel reasoning.
Formation sequences for terms have similar properties to those for formu-
lae.
Proposition 6.30. Trm(L) is the set of all L-strings t such that there exists a term
formation sequence for t.
Proof. Exercise.
There are two types of “junk” that can appear in formation sequences: re-
peated elements, and elements that are irrelevant to the construction of the
formation or term. We can eliminate both by looking at minimal formation
sequences.
71
6. S YNTAX OF F IRST-O RDER L OGIC
Note that a formula or term can have more than one minimal formation
sequence, but they will contain exactly the same strings.
1. ψ is a sub-formula of φ.
Proof. Exercise.
72
6.9. Substitution
θ
z }| {
∀v0 (A10 (v0 ) ⊃ A20 (v0 , v1 )) ⊃ ∃v1 (A21 (v0 , v1 ) ∨ ∀v0 ∼A11 (v0 ))
| {z } | {z }
ψ χ
ψ is the scope of the first ∀v0 , χ is the scope of ∃v1 , and θ is the scope of
the second ∀v0 . The first ∀v0 binds the occurrences of v0 in ψ, ∃v1 binds the
occurrence of v1 in χ, and the second ∀v0 binds the occurrence of v0 in θ. The
first occurrence of v1 and the fourth occurrence of v0 are free in φ. The last
occurrence of v0 is free in θ, but bound in χ and φ.
6.9 Substitution
Definition 6.38 (Substitution in a term). We define s[t/x ], the result of sub-
stituting t for every occurrence of x in s, recursively:
1. s ≡ c: s[t/x ] is just s.
3. s ≡ x: s[t/x ] is t.
Example 6.40.
73
6. S YNTAX OF F IRST-O RDER L OGIC
1. φ ≡ ⊥: φ[t/x ] is ⊥.
Note that substitution may be vacuous: If x does not occur in φ at all, then
φ[t/x ] is just φ.
The restriction that t must be free for x in φ is necessary to exclude cases
like the following. If φ ≡ ∃y x < y and t ≡ y, then φ[t/x ] would be ∃y y <
y. In this case the free variable y is “captured” by the quantifier ∃y upon
substitution, and that is undesirable. For instance, we would like it to be the
case that whenever ∀ x ψ holds, so does ψ[t/x ]. But consider ∀ x ∃y x < y (here
ψ is ∃y x < y). It is a sentence that is true about, e.g., the natural numbers:
for every number x there is a number y greater than it. If we allowed y as a
possible substitution for x, we would end up with ψ[y/x ] ≡ ∃y y < y, which
is false. We prevent this by requiring that none of the free variables in t would
end up being bound by a quantifier in φ.
We often use the following convention to avoid cumbersome notation: If
φ is a formula which may contain the variable x free, we also write φ( x ) to
indicate this. When it is clear which φ and x we have in mind, and t is a term
(assumed to be free for x in φ( x )), then we write φ(t) as short for φ[t/x ]. So
for instance, we might say, “we call φ(t) an instance of ∀ x φ( x ).” By this we
mean that if φ is any formula, x a variable, and t a term that’s free for x in φ,
then φ[t/x ] is an instance of ∀ x φ.
74
Chapter 7
7.1 Introduction
75
7. S EMANTICS OF F IRST-O RDER L OGIC
1. |N| = N
2. 0N = 0
76
7.3. Covered Structures for First-order Languages
However, there are many other possible structures for L A . For instance,
we might take as the domain the set Z of integers instead of N, and define the
interpretations of 0, ′, +, ×, < accordingly. But we can also define structures
for L A which have nothing even remotely to do with numbers.
Example 7.3. A structure M for the language L Z of set theory requires just a
set and a single-two place relation. So technically, e.g., the set of people plus
the relation “x is older than y” could be used as a structure for L Z , as well as
N together with n ≥ m for n, m ∈ N.
A particularly interesting structure for L Z in which the elements of the
domain are actually sets, and the interpretation of ∈ actually is the relation “x
is an element of y” is the structure HF of hereditarily finite sets:
Example 7.6. Let L be the language with constant symbols zer o, one, tw o,
. . . , the binary predicate symbol <, and the binary function symbols + and
×. Then a structure M for L is the one with domain |M| = {0, 1, 2, . . .} and
77
7. S EMANTICS OF F IRST-O RDER L OGIC
to 5, and similarly for the binary function symbol ×. Hence, the value of
f our is just 4, and the value of ×(tw o, +(thr ee, z er o )) (or in infix notation,
tw o × (thr ee + z er o )) is
78
7.4. Satisfaction of a Formula in a Structure
name elements of the domain. For this we define the value of terms induc-
tively. For constant symbols and variables the value is just as the structure or
the variable assignment specifies it; for more complex terms it is computed
recursively using the functions the structure assigns to the function symbols.
1. t ≡ c: ValM M
s (t) = c .
2. t ≡ x: ValM
s ( t ) = s ( x ).
3. t ≡ f (t1 , . . . , tn ):
ValM M M M
s ( t ) = f (Vals ( t1 ), . . . , Vals ( tn )).
1. φ ≡ ⊥: M, s ⊭ φ.
3. φ ≡ t1 = t2 : M, s ⊨ φ iff ValM M
s ( t1 ) = Vals ( t2 ).
4. φ ≡ ∼ψ: M, s ⊨ φ iff M, s ⊭ ψ.
79
7. S EMANTICS OF F IRST-O RDER L OGIC
The variable assignments are important in the last two clauses. We cannot
define satisfaction of ∀ x ψ( x ) by “for all m ∈ |M|, M ⊨ ψ(m).” We cannot
define satisfaction of ∃ x ψ( x ) by “for at least one m ∈ |M|, M ⊨ ψ(m).” The
reason is that if m ∈ |M|, it is not a symbol of the language, and so ψ(m) is
not a formula (that is, ψ[m/x ] is undefined). We also cannot assume that we
have constant symbols or terms available that name every element of M, since
there is nothing in the definition of structures that requires it. In the standard
language, the set of constant symbols is countably infinite, so if |M| is not
countable there aren’t even enough constant symbols to name every object.
We solve this problem by introducing variable assignments, which allow
us to link variables directly with elements of the domain. Then instead of
saying that, e.g., ∃ x ψ( x ) is satisfied in M iff for at least one m ∈ |M|, we say
it is satisfied in M relative to s iff ψ( x ) is satisfied relative to s[m/x ] for at least
one m ∈ |M|.
1. |M| = {1, 2, 3, 4}
2. aM = 1
3. bM = 2
4. f M ( x, y) = x + y if x + y ≤ 3 and = 3 otherwise.
ValM M M M
s ( f ( a, b )) = f (Vals ( a ), Vals ( b )).
ValM M
s ( f ( a, b )) = f (1, 2) = 1 + 2 = 3.
80
7.4. Satisfaction of a Formula in a Structure
ValM M M M M
s ( f ( f ( a, b ), a )) = f (Vals ( f ( a, b )), Vals ( a )) = f (3, 1) = 3,
ValM M M M M
s ( f ( f ( a, b ), x )) = f (Vals ( f ( a, b )), Vals ( x )) = f (3, 1) = 3,
M, s ⊨ R(b, x ) ∨ R( x, b) iff
M, s ⊨ R(b, x ) or M, s ⊨ R( x, b)
s1 = s[1/x ], s2 = s[2/x ],
s3 = s[3/x ], s4 = s[4/x ].
So, e.g., s2 ( x ) = 2 and s2 (y) = s(y) = 1 for all variables y other than x. These
are all the x-variants of s for the structure M, since |M| = {1, 2, 3, 4}. Note, in
particular, that s1 = s (s is always an x-variant of itself).
To determine if an existentially quantified formula ∃ x φ( x ) is satisfied, we
have to determine if M, s[m/x ] ⊨ φ( x ) for at least one m ∈ |M|. So,
M, s ⊨ ∃ x ( R(b, x ) ∨ R( x, b)),
81
7. S EMANTICS OF F IRST-O RDER L OGIC
since M, s[1/x ] ⊨ R(b, x ) ∨ R( x, b) (s[3/x ] would also fit the bill). But,
M, s ⊨ ∀ x ( R( x, a) ⊃ R( a, x )),
M, s ⊭ ∀ x ( R( a, x ) ⊃ R( x, a))
∀ x ( R( a, x ) ⊃ ∃y R( x, y)).
M, s ⊨ ∀ x ( R( a, x ) ⊃ ∃y R( x, y)).
M, s ⊭ ∃ x ( R( a, x ) & ∀y R( x, y)).
82
7.5. Variable Assignments
Proof. By induction on the complexity of t. For the base case, t can be a con-
stant symbol or one of the variables x1 , . . . , xn . If t = c, then ValM s1 ( t ) = c
M =
ValM
s2 ( t ). If t = xi , s1 ( xi ) = s2 ( xi ) by the hypothesis of the proposition, and so
ValM M
s1 ( t ) = s1 ( xi ) = s2 ( xi ) = Vals2 ( t ).
For the inductive step, assume that t = f (t1 , . . . , tk ) and that the claim
holds for t1 , . . . , tk . Then
ValM M
s1 ( t ) = Vals1 ( f ( t1 , . . . , tk ))
= f M (ValM M
s1 ( t1 ), . . . , Vals1 ( tk )).
ValM M
s1 ( t ) = Vals1 ( f ( t1 , . . . , tk ))
= f M (ValM M
s1 ( t1 ), . . . , Vals1 ( tk ))
= f M (ValM M
s2 ( t1 ), . . . , Vals2 ( tk ))
= ValM M
s2 ( f ( t1 , . . . , tk )) = Vals2 ( t ).
Proof. We use induction on the complexity of φ. For the base case, where φ is
atomic, φ can be: ⊥, R(t1 , . . . , tk ) for a k-place predicate R and terms t1 , . . . , tk ,
or t1 = t2 for terms t1 and t2 . In the latter two cases, we only demonstrate
the forward direction of the biconditional, since the proof of the reverse is
symmetrical.
83
7. S EMANTICS OF F IRST-O RDER L OGIC
1. φ ≡ ⊥: both M, s1 ⊭ φ and M, s2 ⊭ φ.
⟨ValM M M
s1 ( t1 ), . . . , Vals1 ( tk )⟩ ∈ R .
For i = 1, . . . , k, ValM M
s1 ( ti ) = Vals2 ( ti ) by Proposition 7.13. So we also
have ⟨ValM M M
s2 ( ti ), . . . , Vals2 ( tk )⟩ ∈ R , and hence M, s2 ⊨ φ.
ValM M
s2 ( t1 ) = Vals1 ( t1 ) (by Proposition 7.13)
= ValM
s1 ( t 2 ) (since M, s1 ⊨ t1 = t2 )
= ValM
s2 ( t 2 ) (by Proposition 7.13),
so M, s2 ⊨ t1 = t2 .
3. φ ≡ ψ ∨ χ: if M, s1 ⊨ φ, then M, s1 ⊨ ψ or M, s1 ⊨ χ. By induction
hypothesis, M, s2 ⊨ ψ or M, s2 ⊨ χ, so M, s2 ⊨ φ.
4. φ ≡ ψ ⊃ χ: exercise.
6. φ ≡ ∀ x ψ: exercise.
84
7.5. Variable Assignments
Proof. Exercise.
Proof. Exercise.
85
7. S EMANTICS OF F IRST-O RDER L OGIC
7.6 Extensionality
Extensionality, sometimes called relevance, can be expressed informally as fol-
lows: the only factors that bear upon the satisfaction of formula φ in a struc-
ture M relative to a variable assignment s, are the size of the domain and the
assignments made by M and s to the elements of the language that actually
appear in φ.
One immediate consequence of extensionality is that where two struc-
tures M and M′ agree on all the elements of the language appearing in a sen-
tence φ and have the same domain, M and M′ must also agree on whether or
not φ itself is true.
M
Proof. First prove (by induction on t) that for every term, Vals 1 (t) = ValM
s ( t ).
2
Then prove the proposition by induction on φ, making use of the claim just
proved for the induction basis (where φ is atomic).
Proof. By induction on t.
86
7.7. Semantic Notions
′
ValM
s ( t [ t /x ]) =
′ ′
= ValM
s ( f ( t1 [ t /x ], . . . , tn [ t /x ]))
by definition of t[t′ /x ]
′ ′
= f M (ValM M
s ( t1 [ t /x ]), . . . , Vals ( tn [ t /x ]))
by definition of ValM
s ( f ( . . . ))
= f M (ValM (t ), . . . , ValM
s[ValM (t′ )/x ] 1
(t ))
s[ValM (t′ )/x ] n
s s
by induction hypothesis
= ValM
s[ValM (t′ )/x ]
(t) by definition of ValM
s[ValM (t′ )/x ]
( f (. . . ))
s s
Proof. Exercise.
The point of Propositions 7.22 and 7.23 is the following. Suppose we have
a term t or a formula φ and some term t′ , and we want to know the value
of t[t′ /x ] or whether or not φ[t′ /x ] is satisfied in a structure M relative to
a variable assignment s. Then we can either perform the substitution first
and then consider the value or satisfaction relative to M and s, or we can first
determine the value m = ValM ′ ′
s ( t ) of t in M relative to s, change the variable
assignment to s[m/x ] and then consider the value of t in M and s[m/x ], or
whether M, s[m/x ] ⊨ φ. Propositions 7.22 and 7.23 guarantee that the answer
will be the same, whichever way we do it.
87
7. S EMANTICS OF F IRST-O RDER L OGIC
Proof. For the forward direction, let φ be valid, and let Γ be a set of sentences.
Let M be a structure so that M ⊨ Γ. Since φ is valid, M ⊨ φ, hence Γ ⊨ φ.
For the contrapositive of the reverse direction, let φ be invalid, so there is
a structure M with M ⊭ φ. When Γ = {⊤}, since ⊤ is valid, M ⊨ Γ. Hence,
there is a structure M so that M ⊨ Γ but M ⊭ φ, hence Γ does not entail φ.
Proof. For the forward direction, suppose Γ ⊨ φ and suppose to the contrary
that there is a structure M so that M ⊨ Γ ∪ {∼ φ}. Since M ⊨ Γ and Γ ⊨ φ,
M ⊨ φ. Also, since M ⊨ Γ ∪ {∼ φ}, M ⊨ ∼ φ, so we have both M ⊨ φ and
M ⊭ φ, a contradiction. Hence, there can be no such structure M, so Γ ∪ {∼ φ}
is unsatisfiable.
For the reverse direction, suppose Γ ∪ {∼ φ} is unsatisfiable. So for every
structure M, either M ⊭ Γ or M ⊨ φ. Hence, for every structure M with M ⊨ Γ,
M ⊨ φ, so Γ ⊨ φ.
Proposition 7.31. Let M be a structure, and φ( x ) a formula with one free variable x,
and t a closed term. Then:
1. φ(t) ⊨ ∃ x φ( x )
2. ∀ x φ( x ) ⊨ φ(t)
88
7.7. Semantic Notions
2. Exercise.
89
Chapter 8
8.1 Introduction
The development of the axiomatic method is a significant achievement in the
history of science, and is of special importance in the history of mathemat-
ics. An axiomatic development of a field involves the clarification of many
questions: What is the field about? What are the most fundamental concepts?
How are they related? Can all the concepts of the field be defined in terms of
these fundamental concepts? What laws do, and must, these concepts obey?
The axiomatic method and logic were made for each other. Formal logic
provides the tools for formulating axiomatic theories, for proving theorems
from the axioms of the theory in a precisely specified way, for studying the
properties of all systems satisfying the axioms in a systematic way.
91
8. T HEORIES AND T HEIR M ODELS
2. We may fail in this respect because there are M such that M ⊨ Γ, but M
is not one of the structures we intend. This may lead us to add axioms
which are not true in M.
3. If we are successful at least in the respect that Γ is true in all the intended
structures, then a sentence φ is true in all intended structures whenever
Γ ⊨ φ. Thus we can use logical tools (such as derivation methods) to
show that sentences are true in all intended structures simply by show-
ing that they are entailed by the axioms.
92
8.2. Expressing Properties of Structures
93
8. T HEORIES AND T HEIR M ODELS
Example 8.7. The theory of pure sets plays an important role in the founda-
tions (and in the philosophy) of mathematics. A set is pure if all its elements
are also pure sets. The empty set counts therefore as pure, but a set that has
something as an element that is not a set would not be pure. So the pure sets
are those that are formed just from the empty set and no “urelements,” i.e.,
objects that are not themselves sets.
The following might be considered as an axiom system for a theory of pure
sets:
∃ x ∼∃y y ∈ x
∀ x ∀y (∀z(z ∈ x ≡ z ∈ y) ⊃ x = y)
∀ x ∀y ∃z ∀u (u ∈ z ≡ (u = x ∨ u = y))
∀ x ∃y ∀z (z ∈ y ≡ ∃u (z ∈ u & u ∈ x ))
94
8.3. Examples of First-Order Theories
∃ x ∀y (y ∈ x ≡ φ(y))
The first axiom says that there is a set with no elements (i.e., ∅ exists); the
second says that sets are extensional; the third that for any sets X and Y, the
set { X, Y } exists; the fourth that for any set X, the set ∪ X exists, where ∪ X is
the union of all the elements of X.
The sentences mentioned last are collectively called the naive comprehension
scheme. It essentially says that for every φ( x ), the set { x | φ( x )} exists—so
at first glance a true, useful, and perhaps even necessary axiom. It is called
“naive” because, as it turns out, it makes this theory unsatisfiable: if you take
φ(y) to be ∼y ∈ y, you get the sentence
∃ x ∀y (y ∈ x ≡ ∼y ∈ y)
∀ x P ( x, x )
∀ x ∀y ((P ( x, y) & P (y, x )) ⊃ x = y)
∀ x ∀y ∀z ((P ( x, y) & P (y, z)) ⊃ P ( x, z))
Moreover, any two objects have a mereological sum (an object that has these
two objects as parts, and is minimal in this respect).
These are only some of the basic principles of parthood considered by meta-
physicians. Further principles, however, quickly become hard to formulate or
write down without first introducing some defined relations. For instance,
95
8. T HEORIES AND T HEIR M ODELS
Note that we have to involve variable assignments here: we can’t just say “Rab
iff M ⊨ A20 ( a, b)” because a and b are not symbols of our language: they are
elements of |M|.
Since we don’t just have atomic formulae, but can combine them using the
logical connectives and the quantifiers, more complex formulae can define
other relations which aren’t directly built into M. We’re interested in how to
do that, and specifically, which relations we can define in a structure.
This idea is not just interesting in specific structures, but generally when-
ever we use a language to describe an intended model or models, i.e., when
we consider theories. These theories often only contain a few predicate sym-
bols as basic symbols, but in the domain they are used to describe often many
96
8.5. The Theory of Sets
other relations play an important role. If these other relations can be system-
atically expressed by the relations that interpret the basic predicate symbols
of the language, we say we can define them in the language.
∀z (z ∈ x ⊃ z ∈ y)
97
8. T HEORIES AND T HEIR M ODELS
example, to express the fact that ∅ is a subset of every set, we could write
∃ x (∼∃y y ∈ x & ∀z x ⊆ z)
∀u ((u ∈ x ∨ u ∈ y) ≡ u ∈ z)
∀u (u ⊆ x ≡ u ∈ y)
since the elements of X ∪ Y are exactly the sets that are either elements of X or
elements of Y, and the elements of ℘( X ) are exactly the subsets of X. However,
this doesn’t allow us to use x ∪ y or ℘( x ) as if they were terms: we can only
use the entire formulae that define the relations X ∪ Y = Z and ℘( X ) = Y.
In fact, we do not know that these relations are ever satisfied, i.e., we do not
know that unions and power sets always exist. For instance, the sentence
∀ x ∃y ℘( x ) = y is another axiom of ZFC (the power set axiom).
Now what about talk of ordered pairs or functions? Here we have to ex-
plain how we can think of ordered pairs and functions as special kinds of sets.
One way to define the ordered pair ⟨ x, y⟩ is as the set {{ x }, { x, y}}. But like
before, we cannot introduce a function symbol that names this set; we can
only define the relation ⟨ x, y⟩ = z, i.e., {{ x }, { x, y}} = z:
∀u (u ∈ z ≡ (∀v (v ∈ u ≡ v = x ) ∨ ∀v (v ∈ u ≡ (v = x ∨ v = y))))
This says that the elements u of z are exactly those sets which either have x
as its only element or have x and y as its only elements (in other words, those
sets that are either identical to { x } or identical to { x, y}). Once we have this,
we can say further things, e.g., that X × Y = Z:
98
8.6. Expressing the Size of Structures
φ ≥ n ≡ ∃ x1 ∃ x2 . . . ∃ x n
( x1 ̸ = x2 & x1 ̸ = x3 & x1 ̸ = x4 & · · · & x1 ̸ = x n &
x2 ̸ = x3 & x2 ̸ = x4 & · · · & x2 ̸ = x n &
..
.
x n −1 ̸ = x n )
99
8. T HEORIES AND T HEIR M ODELS
φ = n ≡ ∃ x1 ∃ x2 . . . ∃ x n
( x1 ̸ = x2 & x1 ̸ = x3 & x1 ̸ = x4 & · · · & x1 ̸ = x n &
x2 ̸ = x3 & x2 ̸ = x4 & · · · & x2 ̸ = x n &
..
.
x n −1 ̸ = x n &
∀y (y = x1 ∨ · · · ∨ y = xn ))
{ φ ≥1 , φ ≥2 , φ ≥3 , . . . } .
100
Chapter 9
Natural Deduction
9.1 Introduction
Logics commonly have both a semantics and a derivation system. The seman-
tics concerns concepts such as truth, satisfiability, validity, and entailment.
The purpose of derivation systems is to provide a purely syntactic method
of establishing entailment and validity. They are purely syntactic in the sense
that a derivation in such a system is a finite syntactic object, usually a sequence
(or other finite arrangement) of sentences or formulae. Good derivation sys-
tems have the property that any given sequence or arrangement of sentences
or formulae can be verified mechanically to be “correct.”
The simplest (and historically first) derivation systems for first-order logic
were axiomatic. A sequence of formulae counts as a derivation in such a sys-
tem if each individual formula in it is either among a fixed set of “axioms”
or follows from formulae coming before it in the sequence by one of a fixed
number of “inference rules”—and it can be mechanically verified if a formula
is an axiom and whether it follows correctly from other formulae by one of the
inference rules. Axiomatic derivation systems are easy to describe—and also
easy to handle meta-theoretically—but derivations in them are hard to read
and understand, and are also hard to produce.
Other derivation systems have been developed with the aim of making it
easier to construct derivations or easier to understand derivations once they
are complete. Examples are natural deduction, truth trees, also known as
tableaux proofs, and the sequent calculus. Some derivation systems are de-
signed especially with mechanization in mind, e.g., the resolution method is
easy to implement in software (but its derivations are essentially impossible
to understand). Most of these other derivation systems represent derivations
as trees of formulae rather than sequences. This makes it easier to see which
parts of a derivation depend on which other parts.
So for a given logic, such as first-order logic, the different derivation sys-
tems will give different explications of what it is for a sentence to be a theorem
101
9. N ATURAL D EDUCTION
and what it means for a sentence to be derivable from some others. However
that is done (via axiomatic derivations, natural deductions, sequent deriva-
tions, truth trees, resolution refutations), we want these relations to match the
semantic notions of validity and entailment. Let’s write ⊢ φ for “φ is a theo-
rem” and “Γ ⊢ φ” for “φ is derivable from Γ.” However ⊢ is defined, we want
it to match up with ⊨, that is:
1. ⊢ φ if and only if ⊨ φ
2. Γ ⊢ φ if and only if Γ ⊨ φ
The “only if” direction of the above is called soundness. A derivation system is
sound if derivability guarantees entailment (or validity). Every decent deriva-
tion system has to be sound; unsound derivation systems are not useful at all.
After all, the entire purpose of a derivation is to provide a syntactic guarantee
of validity or entailment. We’ll prove soundness for the derivation systems
we present.
The converse “if” direction is also important: it is called completeness. A
complete derivation system is strong enough to show that φ is a theorem
whenever φ is valid, and that Γ ⊢ φ whenever Γ ⊨ φ. Completeness is harder
to establish, and some logics have no complete derivation systems. First-order
logic does. Kurt Gödel was the first one to prove completeness for a derivation
system of first-order logic in his 1929 dissertation.
Another concept that is connected to derivation systems is that of consis-
tency. A set of sentences is called inconsistent if anything whatsoever can be
derived from it, and consistent otherwise. Inconsistency is the syntactic coun-
terpart to unsatisfiablity: like unsatisfiable sets, inconsistent sets of sentences
do not make good theories, they are defective in a fundamental way. Con-
sistent sets of sentences may not be true or useful, but at least they pass that
minimal threshold of logical usefulness. For different derivation systems the
specific definition of consistency of sets of sentences might differ, but like ⊢,
we want consistency to coincide with its semantic counterpart, satisfiability.
We want it to always be the case that Γ is consistent if and only if it is satis-
fiable. Here, the “if” direction amounts to completeness (consistency guaran-
tees satisfiability), and the “only if” direction amounts to soundness (satisfi-
ability guarantees consistency). In fact, for classical first-order logic, the two
versions of soundness and completeness are equivalent.
102
9.2. Natural Deduction
[ φ & ψ ]1
φ &Elim
1 ⊃Intro
( φ & ψ) ⊃ φ
The label 1 indicates that the assumption φ & ψ is discharged at the ⊃Intro
inference.
103
9. N ATURAL D EDUCTION
104
9.4. Propositional Rules
φ&ψ
φ &Elim
φ ψ
&Intro
φ&ψ φ&ψ
&Elim
ψ
Rules for ∨
φ [ φ]n [ψ]n
∨Intro
φ∨ψ
ψ
∨Intro φ∨ψ χ χ
φ∨ψ n ∨Elim
χ
Rules for ⊃
[ φ]n
φ⊃ψ φ
⊃Elim
ψ
ψ
n ⊃Intro
φ⊃ψ
Rules for ∼
[ φ]n
∼φ φ
∼Elim
⊥
⊥
∼ φ ∼Intro
n
Rules for ⊥
105
9. N ATURAL D EDUCTION
[∼ φ]n
⊥ ⊥
φ I
n
⊥ ⊥
φ C
Note that ∼Intro and ⊥C are very similar: The difference is that ∼Intro derives
a negated sentence ∼ φ but ⊥C a positive sentence φ.
Whenever a rule indicates that some assumption may be discharged, we
take this to be a permission, but not a requirement. E.g., in the ⊃Intro rule, we
may discharge any number of assumptions of the form φ in the derivation of
the premise ψ, including zero.
9.5 Derivations
We’ve said what an assumption is, and we’ve given the rules of inference.
Derivations in natural deduction are inductively generated from these: each
derivation either is an assumption on its own, or consists of one, two, or three
derivations followed by a correct inference.
3. Every sentence in the tree except the sentence φ at the bottom is a premise
of a correct application of an inference rule whose conclusion stands di-
rectly below that sentence in the tree.
We then say that φ is the conclusion of the derivation and Γ its undischarged
assumptions.
If a derivation of φ from Γ exists, we say that φ is derivable from Γ, or in
symbols: Γ ⊢ φ. If there is a derivation of φ in which every assumption is
discharged, we write ⊢ φ.
Example 9.3. Every assumption on its own is a derivation. So, e.g., φ by itself
is a derivation, and so is ψ by itself. We can obtain a new derivation from
these by applying, say, the &Intro rule,
φ ψ
&Intro
φ&ψ
106
9.6. Examples of Derivations
These rules are meant to be general: we can replace the φ and ψ in it with any
sentences, e.g., by χ and θ. Then the conclusion would be χ & θ, and so
χ θ
&Intro
χ&θ
θ χ
&Intro
θ&χ
[ χ ]1 θ χ [ θ ]1
&Intro &Intro
χ&θ χ&θ
1 ⊃Intro 1 ⊃Intro
χ ⊃ (χ & θ ) θ ⊃ (χ & θ )
ψ
1 ⊃Intro
φ⊃ψ
( φ & ψ) ⊃ φ
Next, we need to figure out what kind of inference could result in a sen-
tence of this form. The main operator of the conclusion is ⊃, so we’ll try to
arrive at the conclusion using the ⊃Intro rule. It is best to write down the as-
sumptions involved and label the inference rules as you progress, so it is easy
to see whether all assumptions have been discharged at the end of the proof.
107
9. N ATURAL D EDUCTION
[ φ & ψ ]1
φ
1 ⊃Intro
( φ & ψ) ⊃ φ
We now need to fill in the steps from the assumption φ & ψ to φ. Since we
only have one connective to deal with, &, we must use the & elim rule. This
gives us the following proof:
[ φ & ψ ]1
φ &Elim
1 ⊃Intro
( φ & ψ) ⊃ φ
(∼ φ ∨ ψ) ⊃ ( φ ⊃ ψ)
To find a logical rule that could give us this conclusion, we look at the logical
connectives in the conclusion: ∼, ∨, and ⊃. We only care at the moment about
the first occurrence of ⊃ because it is the main operator of the sentence in the
end-sequent, while ∼, ∨ and the second occurrence of ⊃ are inside the scope
of another connective, so we will take care of those later. We therefore start
with the ⊃Intro rule. A correct application must look like this:
[∼ φ ∨ ψ]1
φ⊃ψ
1 ⊃Intro
(∼ φ ∨ ψ) ⊃ ( φ ⊃ ψ)
This leaves us with two possibilities to continue. Either we can keep working
from the bottom up and look for another application of the ⊃Intro rule, or we
can work from the top down and apply a ∨Elim rule. Let us apply the latter.
We will use the assumption ∼ φ ∨ ψ as the leftmost premise of ∨Elim. For a
valid application of ∨Elim, the other two premises must be identical to the
conclusion φ ⊃ ψ, but each may be derived in turn from another assumption,
namely one of the two disjuncts of ∼ φ ∨ ψ. So our derivation will look like
this:
108
9.6. Examples of Derivations
[∼ φ]2 [ ψ ]2
[∼ φ]2 , [ φ]3 [ ψ ]2 , [ φ ]4
ψ ψ
3 ⊃Intro 4 ⊃Intro
[∼ φ ∨ ψ]1 φ⊃ψ φ⊃ψ
2
φ⊃ψ
∨Elim
1 ⊃Intro
(∼ φ ∨ ψ) ⊃ ( φ ⊃ ψ)
For the two missing parts of the derivation, we need derivations of ψ from
∼ φ and φ in the middle, and from φ and ψ on the left. Let’s take the former
first. ∼ φ and φ are the two premises of ∼Elim:
[∼ φ]2 [ φ ]3
∼Elim
⊥
[ ψ ]2 , [ φ ]4
[∼ φ]2 [ φ ]3
⊥Intro
⊥ ⊥
I
ψ ψ
3 ⊃Intro 4 ⊃Intro
[∼ φ ∨ ψ]1 φ⊃ψ φ⊃ψ
2
φ⊃ψ
∨Elim
1 ⊃Intro
(∼ φ ∨ ψ) ⊃ ( φ ⊃ ψ)
Let’s now look at the rightmost branch. Here it’s important to realize that
the definition of derivation allows assumptions to be discharged but does not re-
quire them to be. In other words, if we can derive ψ from one of the assump-
tions φ and ψ without using the other, that’s ok. And to derive ψ from ψ is
trivial: ψ by itself is such a derivation, and no inferences are needed. So we
can simply delete the assumption φ.
109
9. N ATURAL D EDUCTION
[∼ φ]2 [ φ ]3
∼Elim
⊥ ⊥
I
ψ [ ψ ]2
3 ⊃Intro ⊃Intro
[∼ φ ∨ ψ]1 φ⊃ψ φ⊃ψ
2
φ⊃ψ
∨Elim
1 ⊃Intro
(∼ φ ∨ ψ) ⊃ ( φ ⊃ ψ)
Note that in the finished derivation, the rightmost ⊃Intro inference does not
actually discharge any assumptions.
Example 9.6. So far we have not needed the ⊥C rule. It is special in that it al-
lows us to discharge an assumption that isn’t a sub-formula of the conclusion
of the rule. It is closely related to the ⊥ I rule. In fact, the ⊥ I rule is a special
case of the ⊥C rule—there is a logic called “intuitionistic logic” in which only
⊥ I is allowed. The ⊥C rule is a last resort when nothing else works. For in-
stance, suppose we want to derive φ ∨ ∼ φ. Our usual strategy would be to
attempt to derive φ ∨ ∼ φ using ∨Intro. But this would require us to derive
either φ or ∼ φ from no assumptions, and this can’t be done. ⊥C to the rescue!
[∼( φ ∨ ∼ φ)]1
1
⊥ ⊥C
φ ∨ ∼φ
∼φ φ
∼Elim
1
⊥ ⊥C
φ ∨ ∼φ
⊥
2
∼ φ ∼Intro φ
∼Elim
1
⊥ ⊥C
φ ∨ ∼φ
110
9.7. Quantifier Rules
[ φ ]2 [∼( φ ∨ ∼ φ)]1
[∼( φ ∨ ∼ φ)]1 φ ∨ ∼ φ ∨Intro
∼Elim
⊥
2
∼φ ∼ Intro φ
∼Elim
1
⊥ ⊥C
φ ∨ ∼φ
[ φ ]2 [∼ φ]3
[∼( φ ∨ ∼ φ)]1 φ ∨ ∼φ ∨ Intro [∼( φ ∨ ∼ φ)] 1 φ ∨ ∼ φ ∨Intro
∼Elim ∼Elim
⊥ ⊥ ⊥
2
∼φ ∼ Intro 3
φ C
∼Elim
1
⊥ ⊥C
φ ∨ ∼φ
Rules for ∀
φ( a) ∀ x φ( x )
∀Intro ∀Elim
∀ x φ( x ) φ(t)
In the rules for ∀, t is a closed term (a term that does not contain any variables),
and a is a constant symbol which does not occur in the conclusion ∀ x φ( x ), or
in any assumption which is undischarged in the derivation ending with the
premise φ( a). We call a the eigenvariable of the ∀Intro inference.1
Rules for ∃
[φ( a)]n
φ(t)
∃Intro
∃ x φ( x )
∃ x φ( x ) χ
n
χ ∃Elim
1 We use the term “eigenvariable” even though a in the above rule is a constant. This has
historical reasons.
111
9. N ATURAL D EDUCTION
Again, t is a closed term, and a is a constant which does not occur in the
premise ∃ x φ( x ), in the conclusion χ, or any assumption which is undischarged
in the derivations ending with the two premises (other than the assumptions
φ( a)). We call a the eigenvariable of the ∃Elim inference.
The condition that an eigenvariable neither occur in the premises nor in
any assumption that is undischarged in the derivations leading to the premises
for the ∀Intro or ∃Elim inference is called the eigenvariable condition.
Recall the convention that when φ is a formula with the variable x free, we
indicate this by writing φ( x ). In the same context, φ(t) then is short for φ[t/x ].
So we could also write the ∃Intro rule as:
φ[t/x ]
∃Intro
∃x φ
Note that t may already occur in φ, e.g., φ might be P (t, x ). Thus, inferring
∃ x P (t, x ) from P (t, t) is a correct application of ∃Intro—you may “replace”
one or more, and not necessarily all, occurrences of t in the premise by the
bound variable x. However, the eigenvariable conditions in ∀Intro and ∃Elim
require that the constant symbol a does not occur in φ. So, you cannot cor-
rectly infer ∀ x P ( a, x ) from P ( a, a) using ∀Intro.
In ∃Intro and ∀Elim there are no restrictions, and the term t can be any-
thing, so we do not have to worry about any conditions. On the other hand,
in the ∃Elim and ∀Intro rules, the eigenvariable condition requires that the
constant symbol a does not occur anywhere in the conclusion or in an undis-
charged assumption. The condition is necessary to ensure that the system
is sound, i.e., only derives sentences from undischarged assumptions from
which they follow. Without this condition, the following would be allowed:
[ φ( a)]1
*∀Intro
∃ x φ( x ) ∀ x φ( x )
∃Elim
∀ x φ( x )
However, ∃ x φ( x ) ⊭ ∀ x φ( x ).
As the elimination rules for quantifiers only allow substituting closed terms
for variables, it follows that any formula that can be derived from a set of sen-
tences is itself a sentence.
112
9.8. Derivations with Quantifiers
∃ x ∼ φ( x ) ⊃ ∼∀ x φ( x )
We start by writing down what it would take to justify that last step using the
⊃Intro rule.
[∃ x ∼ φ( x )]1
∼∀ x φ( x )
1 ⊃Intro
∃ x ∼ φ( x ) ⊃ ∼∀ x φ( x )
[∼ φ( a)]2
[∃ x ∼ φ( x )]1 ∼∀ x φ( x )
2 ∃Elim
∼∀ x φ( x )
1 ⊃Intro
∃ x ∼ φ( x ) ⊃ ∼∀ x φ( x )
In order to derive ∼∀ x φ( x ), we will attempt to use the ∼Intro rule: this re-
quires that we derive a contradiction, possibly using ∀ x φ( x ) as an additional
assumption. Of course, this contradiction may involve the assumption ∼ φ( a)
which will be discharged by the ∃Elim inference. We can set it up as follows:
[∼ φ( a)]2 , [∀ x φ( x )]3
⊥
3 ∼Intro
[∃ x ∼ φ( x )]1 ∼∀ x φ( x )
2 ∃Elim
∼∀ x φ( x )
1 ⊃Intro
∃ x ∼ φ( x ) ⊃ ∼∀ x φ( x )
It looks like we are close to getting a contradiction. The easiest rule to apply is
the ∀Elim, which has no eigenvariable conditions. Since we can use any term
we want to replace the universally quantified x, it makes the most sense to
continue using a so we can reach a contradiction.
113
9. N ATURAL D EDUCTION
[∀ x φ( x )]3
∀Elim
[∼ φ( a)]2 φ( a)
∼Elim
⊥
1
3 ∼Intro
[∃ x ∼ φ( x )] ∼∀ x φ( x )
2 ∃Elim
∼∀ x φ( x )
1 ⊃Intro
∃ x ∼ φ( x ) ⊃ ∼∀ x φ( x )
∃ x χ( x, b)
We have two premises to work with. To use the first, i.e., try to find
a derivation of ∃ x χ( x, b) from ∃ x ( φ( x ) & ψ( x )) we would use the ∃Elim rule.
Since it has an eigenvariable condition, we will apply that rule first. We get
the following:
[ φ( a) & ψ( a)]1
∃ x ( φ( x ) & ψ( x )) ∃ x χ( x, b)
1 ∃Elim
∃ x χ( x, b)
The two assumptions we are working with share ψ. It may be useful at this
point to apply &Elim to separate out ψ( a).
[ φ( a) & ψ( a)]1
&Elim
ψ( a)
∃ x ( φ( x ) & ψ( x )) ∃ x χ( x, b)
1 ∃Elim
∃ x χ( x, b)
114
9.8. Derivations with Quantifiers
∃ x ( φ( x ) & ψ( x )) ∃ x χ( x, b)
1 ∃Elim
∃ x χ( x, b)
We are so close! One application of ∃Intro and we have reached our goal.
Since we ensured at each step that the eigenvariable conditions were not vio-
lated, we can be confident that this is a correct derivation.
∼∀ x φ( x )
The last line of the derivation is a negation, so let’s try using ∼Intro. This will
require that we figure out how to derive a contradiction.
[∀ x φ( x )]1
⊥
1 ∼Intro
∼∀ x φ( x )
So far so good. We can use ∀Elim but it’s not obvious if that will help us get
to our goal. Instead, let’s use one of our assumptions. ∀ x φ( x ) ⊃ ∃y ψ(y)
together with ∀ x φ( x ) will allow us to use the ⊃Elim rule.
115
9. N ATURAL D EDUCTION
∀ x φ( x ) ⊃ ∃y ψ(y) [∀ x φ( x )]1
⊃Elim
∃y ψ(y)
⊥
1 ∼Intro
∼∀ x φ( x )
We now have one final assumption to work with, and it looks like this will
help us reach a contradiction by using ∼Elim.
∀ x φ( x ) ⊃ ∃y ψ(y) [∀ x φ( x )]1
⊃Elim
∼∃y ψ(y) ∃y ψ(y)
∼Elim
⊥
1 ∼Intro
∼∀ x φ( x )
116
9.9. Proof-Theoretic Notions
∆, [ φ]1
δ1 Γ
δ0
ψ
1 ⊃Intro
φ⊃ψ φ
⊃Elim
ψ
1. Γ is inconsistent.
Proof. Exercise.
117
9. N ATURAL D EDUCTION
Γ, [∼ φ]1
δ1
1
⊥ ⊥
φ C
118
9.11. Derivability and the Propositional Connectives
δ
∼φ φ
∼Elim
⊥
Since ∼ φ ∈ Γ, all undischarged assumptions are in Γ, this shows that Γ ⊢ ⊥.
Γ, [∼ φ]2 Γ, [ φ]1
δ2 δ1
⊥ ⊥
2
∼∼ φ ∼Intro 1
∼ φ ∼Intro
∼Elim
⊥
Since the assumptions φ and ∼ φ are discharged, this is a derivation of ⊥
from Γ alone. Hence Γ is inconsistent.
2. φ, ψ ⊢ φ & ψ.
φ&ψ φ&ψ
&Elim &Elim
φ ψ
2. We can derive:
φ ψ
&Intro
φ&ψ
119
9. N ATURAL D EDUCTION
2. Both φ ⊢ φ ∨ ψ and ψ ⊢ φ ∨ ψ.
∼φ [ φ ]1 ∼ψ [ ψ ]1
∼Elim ∼Elim
φ∨ψ ⊥ ⊥
1 ∨Elim
⊥
φ ψ
∨Intro ∨Intro
φ∨ψ φ∨ψ
Proposition 9.24. 1. φ, φ ⊃ ψ ⊢ ψ.
2. Both ∼ φ ⊢ φ ⊃ ψ and ψ ⊢ φ ⊃ ψ.
φ⊃ψ φ
⊃Elim
ψ
∼φ [ φ ]1
∼Elim
⊥ ⊥
I
ψ ψ
1 ⊃Intro ⊃Intro
φ⊃ψ φ⊃ψ
Note that ⊃Intro may, but does not have to, discharge the assumption φ.
120
9.13. Soundness
2. ∀ x φ( x ) ⊢ φ(t).
φ(t)
∃Intro
∃ x φ( x )
∀ x φ( x )
∀Elim
φ(t)
9.13 Soundness
A derivation system, such as natural deduction, is sound if it cannot derive
things that do not actually follow. Soundness is thus a kind of guaranteed
safety property for derivation systems. Depending on which proof theoretic
property is in question, we would like to know for instance, that
121
9. N ATURAL D EDUCTION
inferences, and there are no inferences. So, any structure M that satisfies all of
the undischarged assumptions of the proof also satisfies φ.
Now for the inductive step. Suppose that δ contains n inferences. The
premise(s) of the lowermost inference are derived using sub-derivations, each
of which contains fewer than n inferences. We assume the induction hypothe-
sis: The premises of the lowermost inference follow from the undischarged as-
sumptions of the sub-derivations ending in those premises. We have to show
that the conclusion φ follows from the undischarged assumptions of the entire
proof.
We distinguish cases according to the type of the lowermost inference.
First, we consider the possible inferences with only one premise.
1. Suppose that the last inference is ∼Intro: The derivation has the form
Γ, [ φ]n
δ1
⊥
∼ φ ∼Intro
n
2. The last inference is &Elim: There are two variants: φ or ψ may be in-
ferred from the premise φ & ψ. Consider the first case. The derivation δ
looks like this:
Γ
δ1
φ&ψ
φ &Elim
3. The last inference is ∨Intro: There are two variants: φ ∨ ψ may be in-
ferred from the premise φ or the premise ψ. Consider the first case. The
derivation has the form
122
9.13. Soundness
Γ
δ1
φ
∨Intro
φ∨ψ
Γ, [ φ]n
δ1
ψ
n ⊃Intro
φ⊃ψ
Γ
δ1
⊥ ⊥
φ I
123
9. N ATURAL D EDUCTION
Γ
δ1
φ( a)
∀Intro
∀ x φ( x )
Now let’s consider the possible inferences with several premises: ∨Elim,
&Intro, ⊃Elim, and ∃Elim.
1. The last inference is &Intro. φ & ψ is inferred from the premises φ and ψ
and δ has the form
Γ1 Γ2
δ1 δ2
φ ψ
&Intro
φ&ψ
124
9.14. Derivations with Identity predicate
Γ1 Γ2
δ1 δ2
φ⊃ψ φ
⊃Elim
ψ
t1 = t2 φ ( t1 )
=Elim
φ ( t2 )
=Intro
t=t
t1 = t2 φ ( t2 )
=Elim
φ ( t1 )
In the above rules, t, t1 , and t2 are closed terms. The =Intro rule allows us
to derive any identity statement of the form t = t outright, from no assump-
tions.
125
9. N ATURAL D EDUCTION
∀ x ∀y (( φ( x ) & φ(y)) ⊃ x = y)
∃ x ∀y ( φ(y) ⊃ y = x )
a=b
1 ⊃Intro
(( φ( a) & φ(b)) ⊃ a = b)
∀Intro
∀y (( φ( a) & φ(y)) ⊃ a = y)
∀Intro
∀ x ∀y (( φ( x ) & φ(y)) ⊃ x = y)
We’ll now have to use the main assumption: since it is an existential formula,
we use ∃Elim to derive the intermediary conclusion a = b.
∃ x ∀y ( φ(y) ⊃ y = x ) a=b
2 ∃Elim
a=b
1 ⊃Intro
(( φ( a) & φ(b)) ⊃ a = b)
∀Intro
∀y (( φ( a) & φ(y)) ⊃ a = y)
∀Intro
∀ x ∀y (( φ( x ) & φ(y)) ⊃ x = y)
126
9.15. Soundness with Identity predicate
Proof. Any formula of the form t = t is valid, since for every structure M,
M ⊨ t = t. (Note that we assume the term t to be closed, i.e., it contains no
variables, so variable assignments are irrelevant).
Suppose the last inference in a derivation is =Elim, i.e., the derivation has
the following form:
Γ1 Γ2
δ1 δ2
t1 = t2 φ ( t1 )
=Elim
φ ( t2 )
127
Chapter 10
10.1 Introduction
The completeness theorem is one of the most fundamental results about logic.
It comes in two formulations, the equivalence of which we’ll prove. In its first
formulation it says something fundamental about the relationship between
semantic consequence and our derivation system: if a sentence φ follows from
some sentences Γ, then there is also a derivation that establishes Γ ⊢ φ. Thus,
the derivation system is as strong as it can possibly be without proving things
that don’t actually follow.
In its second formulation, it can be stated as a model existence result: ev-
ery consistent set of sentences is satisfiable. Consistency is a proof-theoretic
notion: it says that our derivation system is unable to produce certain deriva-
tions. But who’s to say that just because there are no derivations of a certain
sort from Γ, it’s guaranteed that there is a structure M? Before the complete-
ness theorem was first proved—in fact before we had the derivation systems
we now do—the great German mathematician David Hilbert held the view
that consistency of mathematical theories guarantees the existence of the ob-
jects they are about. He put it as follows in a letter to Gottlob Frege:
129
10. T HE C OMPLETENESS T HEOREM
130
10.2. Outline of the Proof
φ ∨ ψ ∈ Γ, then we will have to make at least one of them true, i.e., proceed as
if one of them was in Γ.
This suggests the following idea: we add additional formulae to Γ so as to
(a) keep the resulting set consistent and (b) make sure that for every possible
atomic sentence φ, either φ is in the resulting set, or ∼ φ is, and (c) such that,
whenever φ & ψ is in the set, so are both φ and ψ, if φ ∨ ψ is in the set, at least
one of φ or ψ is also, etc. We keep doing this (potentially forever). Call the set
of all formulae so added Γ∗ . Then our construction above would provide us
with a structure M for which we could prove, by induction, that it satisfies all
sentences in Γ∗ , and hence also all sentence in Γ since Γ ⊆ Γ∗ . It turns out that
guaranteeing (a) and (b) is enough. A set of sentences for which (b) holds is
called complete. So our task will be to extend the consistent set Γ to a consistent
and complete set Γ∗ .
There is one wrinkle in this plan: if ∃ x φ( x ) ∈ Γ we would hope to be able
to pick some constant symbol c and add φ(c) in this process. But how do we
know we can always do that? Perhaps we only have a few constant symbols
in our language, and for each one of them we have ∼ φ(c) ∈ Γ. We can’t also
add φ(c), since this would make the set inconsistent, and we wouldn’t know
whether M has to make φ(c) or ∼ φ(c) true. Moreover, it might happen that Γ
contains only sentences in a language that has no constant symbols at all (e.g.,
the language of set theory).
The solution to this problem is to simply add infinitely many constants at
the beginning, plus sentences that connect them with the quantifiers in the
right way. (Of course, we have to verify that this cannot introduce an incon-
sistency.)
Our original construction works well if we only have constant symbols in
the atomic sentences. But the language might also contain function symbols.
In that case, it might be tricky to find the right functions on N to assign to
these function symbols to make everything work. So here’s another trick: in-
stead of using i to interpret ci , just take the set of constant symbols itself as
the domain. Then M can assign every constant symbol to itself: ciM = ci . But
why not go all the way: let |M| be all terms of the language! If we do this,
there is an obvious assignment of functions (that take terms as arguments and
have terms as values) to function symbols: we assign to the function sym-
bol fin the function which, given n terms t1 , . . . , tn as input, produces the term
fin (t1 , . . . , tn ) as value.
The last piece of the puzzle is what to do with =. The predicate symbol =
has a fixed interpretation: M ⊨ t = t′ iff ValM (t) = ValM (t′ ). Now if we set
things up so that the value of a term t is t itself, then this structure will make
no sentence of the form t = t′ true unless t and t′ are one and the same term.
And of course this is a problem, since basically every interesting theory in a
language with function symbols will have as theorems sentences t = t′ where
t and t′ are not the same term (e.g., in theories of arithmetic: (0 + 0) = 0). To
131
10. T HE C OMPLETENESS T HEOREM
solve this problem, we change the domain of M: instead of using terms as the
objects in |M|, we use sets of terms, and each set is so that it contains all those
terms which the sentences in Γ require to be equal. So, e.g., if Γ is a theory of
arithmetic, one of these sets will contain: 0, (0 + 0), (0 × 0), etc. This will be
the set we assign to 0, and it will turn out that this set is also the value of all
the terms in it, e.g., also of (0 + 0). Therefore, the sentence (0 + 0) = 0 will be
true in this revised structure.
So here’s what we’ll do. First we investigate the properties of complete
consistent sets, in particular we prove that a complete consistent set contains
φ & ψ iff it contains both φ and ψ, φ ∨ ψ iff it contains at least one of them,
etc. (Proposition 10.2). Then we define and investigate “saturated” sets of
sentences. A saturated set is one which contains conditionals that link each
quantified sentence to instances of it (Definition 10.5). We show that any con-
sistent set Γ can always be extended to a saturated set Γ′ (Lemma 10.6). If a set
is consistent, saturated, and complete it also has the property that it contains
∃ x φ( x ) iff it contains φ(t) for some closed term t and ∀ x φ( x ) iff it contains
φ(t) for all closed terms t (Proposition 10.7). We’ll then take the saturated con-
sistent set Γ′ and show that it can be extended to a saturated, consistent, and
complete set Γ∗ (Lemma 10.8). This set Γ∗ is what we’ll use to define our term
model M(Γ∗ ). The term model has the set of closed terms as its domain, and
the interpretation of its predicate symbols is given by the atomic sentences
in Γ∗ (Definition 10.9). We’ll use the properties of saturated, complete con-
sistent sets to show that indeed M(Γ∗ ) ⊨ φ iff φ ∈ Γ∗ (Lemma 10.12), and
thus in particular, M(Γ∗ ) ⊨ Γ. Finally, we’ll consider how to define a term
model if Γ contains = as well (Definition 10.16) and show that it satisfies Γ∗
(Lemma 10.19).
132
10.4. Henkin Expansion
all those in Γ) true. The proof of this latter fact requires that ∼ φ ∈ Γ∗ iff
φ∈ / Γ∗ , ( φ ∨ ψ) ∈ Γ∗ iff φ ∈ Γ∗ or ψ ∈ Γ∗ , etc.
In what follows, we will often tacitly use the properties of reflexivity, mono-
tonicity, and transitivity of ⊢ (see section 9.9).
1. If Γ ⊢ φ, then φ ∈ Γ.
3. φ ∨ ψ ∈ Γ iff either φ ∈ Γ or ψ ∈ Γ.
4. φ ⊃ ψ ∈ Γ iff either φ ∈
/ Γ or ψ ∈ Γ.
Proof. Let us suppose for all of the following that Γ is complete and consistent.
1. If Γ ⊢ φ, then φ ∈ Γ.
Suppose that Γ ⊢ φ. Suppose to the contrary that φ ∈ / Γ. Since Γ is com-
plete, ∼ φ ∈ Γ. By Proposition 9.20, Γ is inconsistent. This contradicts the
assumption that Γ is consistent. Hence, it cannot be the case that φ ∈ / Γ,
so φ ∈ Γ.
4. Exercise.
133
10. T HE C OMPLETENESS T HEOREM
The following definition will be used in the proof of the next theorem.
Lemma 10.6. Every consistent set Γ can be extended to a saturated consistent set Γ′ .
Γ0 = Γ
Γ n +1 = Γ n ∪ { θ n }
134
10.5. Lindenbaum’s Lemma
We’ll now show that complete, consistent sets which are saturated have the
property that it contains a universally quantified sentence iff it contains all its
instances and it contains an existentially quantified sentence iff it contains at
least one instance. We’ll use this to show that the structure we’ll generate from
a complete, consistent, saturated set makes all its quantified sentences true.
135
10. T HE C OMPLETENESS T HEOREM
Let Γ∗ = n≥0 Γn .
S
complete.
136
10.6. Construction of a Model
Proof. The proof is by induction on t, where the base case, when t is a con-
stant symbol, follows directly from the definition of the term model. For the
∗
induction step assume t1 , . . . , tn are closed terms such that ValM(Γ ) (ti ) = ti
and that f is an n-ary function symbol. Then
∗ ∗ ∗
ValM(Γ ) ( f (t1 , . . . , tn )) = f M(Γ ) (ValM(Γ ) (t1 ), . . . , ValM(Γ ) (tn ))
∗
∗
= f M( Γ ) ( t 1 , . . . , t n )
= f ( t1 , . . . , t n ),
2. Exercise.
Lemma 10.12 (Truth Lemma). Suppose φ does not contain =. Then M(Γ∗ ) ⊨ φ
iff φ ∈ Γ∗ .
137
10. T HE C OMPLETENESS T HEOREM
6. φ ≡ ψ ⊃ χ: exercise.
7. φ ≡ ∀ x ψ( x ): exercise.
10.7 Identity
The construction of the term model given in the preceding section is enough
to establish completeness for first-order logic for sets Γ that do not contain =.
The term model satisfies every φ ∈ Γ∗ which does not contain = (and hence
all φ ∈ Γ). It does not work, however, if = is present. The reason is that Γ∗
then may contain a sentence t = t′ , but in the term model the value of any
term is that term itself. Hence, if t and t′ are different terms, their values in
the term model—i.e., t and t′ , respectively—are different, and so t = t′ is false.
We can fix this, however, using a construction known as “factoring.”
t ≈ t′ iff t = t′ ∈ Γ∗
138
10.7. Identity
1. ≈ is reflexive.
2. ≈ is symmetric.
3. ≈ is transitive.
2. If Γ∗ ⊢ t = t′ then Γ∗ ⊢ t′ = t.
4. If Γ∗ ⊢ t = t′ , then
for every n-place function symbol f and closed terms t1 , . . . , ti−1 , ti+1 ,
. . . , tn .
Definition 10.16. Let M = M(Γ∗ ) be the term model for Γ∗ from Defini-
tion 10.9. Then M/≈ is the following structure:
1. |M/≈ | = Trm(L)/≈ .
139
10. T HE C OMPLETENESS T HEOREM
2. cM/≈ = [c]≈
Note that we have defined f M/≈ and RM/≈ for elements of Trm(L)/≈ by
referring to them as [t]≈ , i.e., via representatives t ∈ [t]≈ . We have to make sure
that these definitions do not depend on the choice of these representatives, i.e.,
that for some other choices t′ which determine the same equivalence classes
([t]≈ = [t′ ]≈ ), the definitions yield the same result. For instance, if R is a one-
place predicate symbol, the last clause of the definition says that [t]≈ ∈ RM/≈
iff M ⊨ R(t). If for some other term t′ with t ≈ t′ , M ⊭ R(t), then the definition
would require [t′ ]≈ ∈ / RM/≈ . If t ≈ t′ , then [t]≈ = [t′ ]≈ , but we can’t have both
[t]≈ ∈ R M/ ≈ and [t]≈ ∈/ RM/≈ . However, Proposition 10.14 guarantees that
this cannot happen.
Proposition 10.17. M/≈ is well defined, i.e., if t1 , . . . , tn , t1′ , . . . , t′n are closed terms,
and ti ≈ ti′ then
and
As in the case of the term model, before proving the truth lemma we need
the following lemma.
Proof. By induction on φ, just as in the proof of Lemma 10.12. The only case
that needs additional attention is when φ ≡ t = t′ .
140
10.8. The Completeness Theorem
Note that while M(Γ∗ ) is always countable and infinite, M/≈ may be fi-
nite, since it may turn out that there are only finitely many classes [t]≈ . This is
to be expected, since Γ may contain sentences which require any structure in
which they are true to be finite. For instance, ∀ x ∀y x = y is a consistent sen-
tence, but is satisfied only in structures with a domain that contains exactly
one element.
Corollary 10.21 (Completeness Theorem, Second Version). For all Γ and sen-
tences φ: if Γ ⊨ φ then Γ ⊢ φ.
Proof. Note that the Γ’s in Corollary 10.21 and Theorem 10.20 are universally
quantified. To make sure we do not confuse ourselves, let us restate Theo-
rem 10.20 using a different variable: for any set of sentences ∆, if ∆ is consis-
tent, it is satisfiable. By contraposition, if ∆ is not satisfiable, then ∆ is incon-
sistent. We will use this to prove the corollary.
Suppose that Γ ⊨ φ. Then Γ ∪ {∼ φ} is unsatisfiable by Proposition 7.28.
Taking Γ ∪ {∼ φ} as our ∆, the previous version of Theorem 10.20 gives us that
Γ ∪ {∼ φ} is inconsistent. By Proposition 9.19, Γ ⊢ φ.
141
10. T HE C OMPLETENESS T HEOREM
be ruled out: there are no unsatisfiable infinite sets of sentences each finite
subset of which is satisfiable. Like the completeness theorem, it has a version
related to entailment: if an infinite set of sentences entails something, already
a finite subset does.
Theorem 10.23 (Compactness Theorem). The following hold for any sentences Γ
and φ:
∆ = {c ̸= t | t ∈ Trm(L)}.
142
10.10. A Direct Proof of the Compactness Theorem
obvious interpretations. Γ is the set of all sentences of L true about the rational
numbers. Of course, in Q (and even in R), there are no numbers r which are
greater than 0 but less than 1/k for all k ∈ Z+ . Such a number, if it existed,
would be an infinitesimal: non-zero, but infinitely small. The compactness
theorem can be used to show that there are models of Γ in which infinitesimals
exist. We do not have a function symbol for division in our language (division
by zero is undefined, and function symbols have to be interpreted by total
functions). However, we can still express that r < 1/k, since this is the case iff
r · k < 1. Now let c be a new constant symbol and let ∆ be
{ 0 < c } ∪ { c × k < 1 | k ∈ Z+ }
(where k = (1 + (1 + · · · + (1 + 1) . . . )) with k 1’s). For any finite subset ∆0
of ∆ there is a K such that for all the sentences c × k < 1 in ∆0 have k <
′
K. If we expand Q to Q′ with cQ = 1/K we have that Q′ ⊨ Γ0 ∪ ∆0 for
any finite Γ0 ⊆ Γ, and so Γ ∪ ∆ is finitely satisfiable (Exercise: prove this in
detail). By compactness, Γ ∪ ∆ is satisfiable. Any model S of Γ ∪ ∆ contains
an infinitesimal, namely cS .
Example 10.26. We know that first-order logic with identity predicate can ex-
press that the size of the domain must have some minimal size: The sen-
tence φ≥n (which says “there are at least n distinct objects”) is true only in
structures where |M| has at least n objects. So if we take
∆ = { φ ≥ n | n ≥ 1}
then any model of ∆ must be infinite. Thus, we can guarantee that a theory
only has infinite models by adding ∆ to it: the models of Γ ∪ ∆ are all and only
the infinite models of Γ.
So first-order logic can express infinitude. The compactness theorem shows
that it cannot express finitude, however. For suppose some set of sentences Λ
were satisfied in all and only finite structures. Then ∆ ∪ Λ is finitely satisfiable.
Why? Suppose ∆′ ∪ Λ′ ⊆ ∆ ∪ Λ is finite with ∆′ ⊆ ∆ and Λ′ ⊆ Λ. Let n be the
largest number such that φ≥n ∈ ∆′ . Λ, being satisfied in all finite structures,
has a model M with finitely many but ≥ n elements. But then M ⊨ ∆′ ∪ Λ′ .
By compactness, ∆ ∪ Λ has an infinite model, contradicting the assumption
that Λ is satisfied only in finite structures.
143
10. T HE C OMPLETENESS T HEOREM
We can use the same method to show that a finitely satisfiable set of sen-
tences is satisfiable. We just have to prove the corresponding versions of
the results leading to the truth lemma where we replace “consistent” with
“finitely satisfiable.”
2. ( φ ∨ ψ) ∈ Γ iff either φ ∈ Γ or ψ ∈ Γ.
3. ( φ ⊃ ψ) ∈ Γ iff either φ ∈
/ Γ or ψ ∈ Γ.
Lemma 10.28. Every finitely satisfiable set Γ can be extended to a saturated finitely
satisfiable set Γ′ .
Lemma 10.30. Every finitely satisfiable set Γ can be extended to a complete and
finitely satisfiable set Γ∗ .
144
10.11. The Löwenheim–Skolem Theorem
145
Chapter 11
11.1 Overview
First-order logic is not the only system of logic of interest: there are many ex-
tensions and variations of first-order logic. A logic typically consists of the
formal specification of a language, usually, but not always, a deductive sys-
tem, and usually, but not always, an intended semantics. But the technical use
of the term raises an obvious question: what do logics that are not first-order
logic have to do with the word “logic,” used in the intuitive or philosophical
sense? All of the systems described below are designed to model reasoning of
some form or another; can we say what makes them logical?
No easy answers are forthcoming. The word “logic” is used in different
ways and in different contexts, and the notion, like that of “truth,” has been
analyzed from numerous philosophical stances. For example, one might take
the goal of logical reasoning to be the determination of which statements are
necessarily true, true a priori, true independent of the interpretation of the
nonlogical terms, true by virtue of their form, or true by linguistic convention;
and each of these conceptions requires a good deal of clarification. Even if one
restricts one’s attention to the kind of logic used in mathematics, there is little
agreement as to its scope. For example, in the Principia Mathematica, Russell
and Whitehead tried to develop mathematics on the basis of logic, in the logi-
cist tradition begun by Frege. Their system of logic was a form of higher-type
logic similar to the one described below. In the end they were forced to intro-
duce axioms which, by most standards, do not seem purely logical (notably,
the axiom of infinity, and the axiom of reducibility), but one might nonetheless
hold that some forms of higher-order reasoning should be accepted as logical.
In contrast, Quine, whose ontology does not admit “propositions” as legiti-
mate objects of discourse, argues that second-order and higher-order logic are
really manifestations of set theory in sheep’s clothing; in other words, systems
involving quantification over predicates are not purely logical.
For now, it is best to leave such philosophical issues for a rainy day, and
147
11. B EYOND F IRST- ORDER L OGIC
148
11.3. Second-Order logic
∀ x1 . . . ∀ xk ( R( x1 , . . . , xk ) ≡ S( x1 , . . . , xk )).
The rules for second-order logic simply extend the quantifier rules to the
new second order variables. Here, however, one has to be a little bit careful
to explain how these variables interact with the predicate symbols of L, and
with formulae of L more generally. At the bare minimum, relation variables
count as terms, so one has inferences of the form
φ( R) ⊢ ∃ R φ( R)
But if L is the language of arithmetic with a constant relation symbol <, one
would also expect the following inference to be valid:
x < y ⊢ ∃ R R( x, y)
φ ( x1 , . . . , x k ) ⊢ ∃ R R ( x1 , . . . , x k )
where φ[λ⃗x. ψ(⃗x )/R] denotes the result of replacing every atomic formula of
the form Rt1 , . . . , tk in φ by ψ(t1 , . . . , tk ). This last rule is equivalent to having
a comprehension schema, i.e., an axiom of the form
∃ R ∀ x1 , . . . , xk ( φ( x1 , . . . , xk ) ≡ R( x1 , . . . , xk )),
149
11. B EYOND F IRST- ORDER L OGIC
one for each formula φ in the second-order language, in which R is not a free
variable. (Exercise: show that if R is allowed to occur in φ, this schema is
inconsistent!)
When logicians refer to the “axioms of second-order logic” they usually
mean the minimal extension of first-order logic by second-order quantifier
rules together with the comprehension schema. But it is often interesting to
study weaker subsystems of these axioms and rules. For example, note that
in its full generality the axiom schema of comprehension is impredicative: it
allows one to assert the existence of a relation R( x1 , . . . , xk ) that is “defined”
by a formula with second-order quantifiers; and these quantifiers range over
the set of all such relations—a set which includes R itself! Around the turn of
the twentieth century, a common reaction to Russell’s paradox was to lay the
blame on such definitions, and to avoid them in developing the foundations
of mathematics. If one prohibits the use of second-order quantifiers in the
formula φ, one has a predicative form of comprehension, which is somewhat
weaker.
From the semantic point of view, one can think of a second-order structure
as consisting of a first-order structure for the language, coupled with a set of
relations on the domain over which the second-order quantifiers range (more
precisely, for each k there is a set of relations of arity k). Of course, if com-
prehension is included in the derivation system, then we have the added re-
quirement that there are enough relations in the “second-order part” to satisfy
the comprehension axioms—otherwise the derivation system is not sound!
One easy way to ensure that there are enough relations around is to take the
second-order part to consist of all the relations on the first-order part. Such
a structure is called full, and, in a sense, is really the “intended structure” for
the language. If we restrict our attention to full structures we have what is
known as the full second-order semantics. In that case, specifying a structure
boils down to specifying the first-order part, since the contents of the second-
order part follow from that implicitly.
To summarize, there is some ambiguity when talking about second-order
logic. In terms of the derivation system, one might have in mind either
150
11.3. Second-Order logic
When logicians do not specify the derivation system or the semantics they
have in mind, they are usually referring to the second item on each list. The
advantage to using this semantics is that, as we will see, it gives us categorical
descriptions of many natural mathematical structures; at the same time, the
derivation system is quite strong, and sound for this semantics. The drawback
is that the derivation system is not complete for the semantics; in fact, no effec-
tively given derivation system is complete for the full second-order semantics.
On the other hand, we will see that the derivation system is complete for the
weakened semantics; this implies that if a sentence is not provable, then there
is some structure, not necessarily the full one, in which it is false.
The language of second-order logic is quite rich. One can identify unary
relations with subsets of the domain, and so in particular you can quantify
over these sets; for example, one can express induction for the natural num-
bers with a single axiom
If one takes the language of arithmetic to have symbols 0, ′, +, × and <, one
can add the following axioms to describe their behavior:
1. ∀ x ∼ x ′ = 0
2. ∀ x ∀y (s( x ) = s(y) ⊃ x = y)
3. ∀ x ( x + 0) = x
4. ∀ x ∀y ( x + y′ ) = ( x + y)′
5. ∀ x ( x × 0) = 0
6. ∀ x ∀y ( x × y′ ) = (( x × y) + x )
7. ∀ x ∀y ( x < y ≡ ∃z y = ( x + z′ ))
It is not difficult to show that these axioms, together with the axiom of induc-
tion above, provide a categorical description of the structure N, the standard
model of arithmetic, provided we are using the full second-order semantics.
Given any structure M in which these axioms are true, define a function f
from N to the domain of M using ordinary recursion on N, so that f (0) = 0M
and f ( x + 1) = ′M ( f ( x )). Using ordinary induction on N and the fact that ax-
ioms (1) and (2) hold in M, we see that f is injective. To see that f is surjective,
let P be the set of elements of |M| that are in the range of f . Since M is full, P is
in the second-order domain. By the construction of f , we know that 0M is in P,
and that P is closed under ′M . The fact that the induction axiom holds in M
151
11. B EYOND F IRST- ORDER L OGIC
(in particular, for P) guarantees that P is equal to the entire first-order domain
of M. This shows that f is a bijection. Showing that f is a homomorphism is
no more difficult, using ordinary induction on N repeatedly.
In set-theoretic terms, a function is just a special kind of relation; for ex-
ample, a unary function f can be identified with a binary relation R satisfying
∀ x ∃!y R( x, y). As a result, one can quantify over functions too. Using the full
semantics, one can then define the class of infinite structures to be the class of
structures M for which there is an injective function from the domain of M to
a proper subset of itself:
The negation of this sentence then defines the class of finite structures.
In addition, one can define the class of well-orderings, by adding the fol-
lowing to the definition of a linear ordering:
This asserts that every non-empty set has a least element, modulo the iden-
tification of “set” with “one-place relation”. For another example, one can
express the notion of connectedness for graphs, by saying that there is no non-
trivial separation of the vertices into disconnected parts:
For yet another example, you might try as an exercise to define the class of
finite structures whose domain has even size. More strikingly, one can pro-
vide a categorical description of the real numbers as a complete ordered field
containing the rationals.
In short, second-order logic is much more expressive than first-order logic.
That’s the good news; now for the bad. We have already mentioned that there
is no effective derivation system that is complete for the full second-order
semantics. For better or for worse, many of the properties of first-order logic
are absent, including compactness and the Löwenheim–Skolem theorems.
On the other hand, if one is willing to give up the full second-order se-
mantics in terms of the weaker one, then the minimal second-order derivation
system is complete for this semantics. In other words, if we read ⊢ as “proves
in the minimal system” and ⊨ as “logically implies in the weaker semantics”,
we can show that whenever Γ ⊨ φ then Γ ⊢ φ. If one wants to include spe-
cific comprehension axioms in the derivation system, one has to restrict the
semantics to second-order structures that satisfy these axioms: for example, if
∆ consists of a set of comprehension axioms (possibly all of them), we have
that if Γ ∪ ∆ ⊨ φ, then Γ ∪ ∆ ⊢ φ. In particular, if φ is not provable using
the comprehension axioms we are considering, then there is a model of ∼ φ in
which these comprehension axioms nonetheless hold.
152
11.4. Higher-Order logic
The easiest way to see that the completeness theorem holds for the weaker
semantics is to think of second-order logic as a many-sorted logic, as follows.
One sort is interpreted as the ordinary “first-order” domain, and then for each
k we have a domain of “relations of arity k.” We take the language to have
built-in relation symbols “tr ue k ( R, x1 , . . . , xk )” which is meant to assert that
R holds of x1 , . . . , xk , where R is a variable of the sort “k-ary relation” and x1 ,
. . . , xk are objects of the first-order sort.
With this identification, the weak second-order semantics is essentially the
usual semantics for many-sorted logic; and we have already observed that
many-sorted logic can be embedded in first-order logic. Modulo the trans-
lations back and forth, then, the weaker conception of second-order logic is
really a form of first-order logic in disguise, where the domain contains both
“objects” and “relations” governed by the appropriate axioms.
Think of types as syntactic “labels,” which classify the objects we want in our
domain; σ → τ describes those objects that are functions which take objects
of type σ to objects of type τ. For example, we might want to have a type Ω
of truth values, “true” and “false,” and a type N of natural numbers. In that
case, you can think of objects of type N → Ω as unary relations, or subsets
of N; objects of type N → N are functions from natural numbers to natu-
ral numbers; and objects of type (N → N) → N are “functionals,” that is,
higher-type functions that take functions to numbers.
As in the case of second-order logic, one can think of higher-order logic as
a kind of many-sorted logic, where there is a sort for each type of object we
want to consider. But it is usually clearer just to define the syntax of higher-
type logic from the ground up. For example, we can define a set of finite types
inductively, as follows:
1. N is a finite type.
153
11. B EYOND F IRST- ORDER L OGIC
2. 0 is a term of type N
Rst (0) = s
Rst ( x + 1) = t( x, Rst ( x )),
⟨s, t⟩ denotes the pair whose first component is s and whose second compo-
nent is t, and p1 (s) and p2 (s) denote the first and second elements (“projec-
tions”) of s. Finally, λx. s denotes the function f defined by
f (x) = s
154
11.5. Intuitionistic Logic
can get rid of complex formulae entirely, replacing them with terms of type Ω!
The proof system can then be modified accordingly. The result is essentially
the simple theory of types set forth by Alonzo Church in the 1930s.
As in the case of second-order logic, there are different versions of higher-
type semantics that one might want to use. In the full version, variables of
type σ → τ range over the set of all functions from the objects of type σ to
objects of type τ. As you might expect, this semantics is too strong to ad-
mit a complete, effective derivation system. But one can consider a weaker
semantics, in which a structure consists of sets of elements Tτ for each type
τ, together with appropriate operations for application, projection, etc. If the
details are carried out correctly, one can obtain completeness theorems for the
kinds of derivation systems described above.
Higher-type logic is attractive because it provides a framework in which
we can embed a good deal of mathematics in a natural way: starting with N,
one can define real numbers, continuous functions, and so on. It is also partic-
ularly attractive in the context of intuitionistic logic, since the types have clear
“constructive” interpretations. In fact, one can develop constructive versions
of higher-type semantics (based on intuitionistic, rather than classical logic)
that clarify these constructive interpretations quite nicely, and are, in many
ways, more interesting than the classical counterparts.
155
11. B EYOND F IRST- ORDER L OGIC
power, and get a rational result. The following theorem answers this in the
affirmative:
Theorem 11.1. There are irrational numbers a and b such that ab is rational.
√ √2 √
Proof. Consider 2 . If this is rational, we are done: we can let a = b = 2.
Otherwise, it is irrational. Then we have
√ √2 √ √ √2· √2 √ 2
( 2 ) 2= 2 = 2 = 2,
√
√ 2 √
which is certainly rational. So, in this case, let a be 2 , and let b be 2.
Does this constitute a valid proof? Most mathematicians feel that it does.
But again, there is something a little bit unsatisfying here: we have proved the
existence of a pair of real numbers with a certain property, without being able
to say which pair of numbers it is. It is possible to prove the √
same result, but in
such a way that the pair a, b is given in the proof: take a = 3 and b = log3 4.
Then
√ log 4
ab = 3 3 = 31/2·log3 4 = (3log3 4 )1/2 = 41/2 = 2,
since 3log3 x = x.
Intuitionistic logic is designed to model a kind of reasoning where moves
like the one in the first proof are disallowed. Proving the existence of an x
satisfying φ( x ) means that you have to give a specific x, and a proof that it
satisfies φ, like in the second proof. Proving that φ or ψ holds requires that
you can prove one or the other.
Formally speaking, intuitionistic first-order logic is what you get if you
restrict a derivation system for first-order logic in a certain way. Similarly,
there are intuitionistic versions of second-order or higher-order logic. From
the mathematical point of view, these are just formal deductive systems, but,
as already noted, they are intended to model a kind of mathematical reason-
ing. One can take this to be the kind of reasoning that is justified on a cer-
tain philosophical view of mathematics (such as Brouwer’s intuitionism); one
can take it to be a kind of mathematical reasoning which is more “concrete”
and satisfying (along the lines of Bishop’s constructivism); and one can argue
about whether or not the formal description captures the informal motiva-
tion. But whatever philosophical positions we may hold, we can study intu-
itionistic logic as a formally presented logic; and for whatever reasons, many
mathematical logicians find it interesting to do so.
There is an informal constructive interpretation of the intuitionist connec-
tives, usually known as the BHK interpretation (named after Brouwer, Heyt-
ing, and Kolmogorov). It runs as follows: a proof of φ & ψ consists of a proof
of φ paired with a proof of ψ; a proof of φ ∨ ψ consists of either a proof of φ,
or a proof of ψ, where we have explicit information as to which is the case;
156
11.5. Intuitionistic Logic
1. (∼ φ ⊃ ⊥) ⊃ φ.
2. φ ∨ ∼ φ
3. ∼∼ φ ⊃ φ
Obtaining instances of one schema from either of the others is a good exercise
in intuitionistic logic.
The first deductive systems for intuitionistic propositional logic, put forth
as formalizations of Brouwer’s intuitionism, are due, independently, to Kol-
mogorov, Glivenko, and Heyting. The first formalization of intuitionistic first-
order logic (and parts of intuitionist mathematics) is due to Heyting. Though
a number of classically valid schemata are not intuitionistically valid, many
are.
The double-negation translation describes an important relationship between
classical and intuitionist logic. It is defined inductively follows (think of φ N
as the “intuitionist” translation of the classical formula φ):
( φ ∨ ψ) N ≡ ∼∼( φ N ∨ ψ N )
( φ ⊃ ψ) N ≡ ( φ N ⊃ ψ N )
(∀ x φ) N ≡ ∀ x φ N
(∃ x φ) N ≡ ∼∼∃ x φ N
157
11. B EYOND F IRST- ORDER L OGIC
2. M, w ⊮ ⊥.
158
11.6. Modal Logics
4. M, w ⊩ ( φ ∨ ψ) iff M, w ⊩ φ or M, w ⊩ ψ.
159
11. B EYOND F IRST- ORDER L OGIC
One would like to augment logic with rules and axioms dealing with modal-
ity. For example, the system S4 consists of the ordinary axioms and rules of
propositional logic, together with the following axioms:
□( φ ⊃ ψ) ⊃ (□φ ⊃ □ψ)
□φ ⊃ φ
□φ ⊃ □□φ
♢φ ⊃ □♢φ
Variations of these axioms may be suitable for different applications; for ex-
ample, S5 is usually taken to characterize the notion of logical necessity. And
the nice thing is that one can usually find a semantics for which the derivation
system is sound and complete by restricting the accessibility relation in the
Kripke structures in natural ways. For example, S4 corresponds to the class
of Kripke structures in which the accessibility relation is reflexive and transi-
tive. S5 corresponds to the class of Kripke structures in which the accessibility
relation is universal, which is to say that every world is accessible from every
other; so □φ holds if and only if φ holds in every world.
160
11.7. Other Logics
161
Part III
Turing Machines
163
Chapter 12
12.1 Introduction
What does it mean for a function, say, from N to N to be computable? Among
the first answers, and the most well known one, is that a function is com-
putable if it can be computed by a Turing machine. This notion was set out
by Alan Turing in 1936. Turing machines are an example of a model of compu-
tation—they are a mathematically precise way of defining the idea of a “com-
putational procedure.” What exactly that means is debated, but it is widely
agreed that Turing machines are one way of specifying computational proce-
dures. Even though the term “Turing machine” evokes the image of a physi-
cal machine with moving parts, strictly speaking a Turing machine is a purely
mathematical construct, and as such it idealizes the idea of a computational
procedure. For instance, we place no restriction on either the time or memory
requirements of a Turing machine: Turing machines can compute something
even if the computation would require more storage space or more steps than
there are atoms in the universe.
It is perhaps best to think of a Turing machine as a program for a spe-
cial kind of imaginary mechanism. This mechanism consists of a tape and a
read-write head. In our version of Turing machines, the tape is infinite in one
direction (to the right), and it is divided into squares, each of which may con-
tain a symbol from a finite alphabet. Such alphabets can contain any number of
different symbols, but we will mainly make do with three: ▷, 0, and 1. When
the mechanism is started, the tape is empty (i.e., each square contains the sym-
bol 0) except for the leftmost square, which contains ▷, and a finite number of
squares which contain the input. At any time, the mechanism is in one of a
finite number of states. At the outset, the head scans the leftmost square and
in a specified initial state. At each step of the mechanism’s run, the content
of the square currently scanned together with the state the mechanism is in
and the Turing machine program determine what happens next. The Turing
machine program is given by a partial function which takes as input a state q
165
12. T URING M ACHINE C OMPUTATIONS
2. A proof of the equivalence of two definitions (in case the new definition
has a greater intuitive appeal).
166
12.2. Representing Turing Machines
Our goal is to try to define the notion of computability “in principle,” i.e.,
without taking into account practical limitations of time and space. Of course,
with the broadest definition of computability in place, one can then go on
to consider computation with bounded resources; this forms the heart of the
subject known as “computational complexity.”
0, 1, R
start q0 q1
Recall that the Turing machine has a read/write head and a tape with the
input written on it. The instruction can be read as if reading a 0 in state q0 , write
a 1, move right, and move to state q1 . This is equivalent to the transition function
mapping ⟨q0 , 0⟩ to ⟨q1 , 1, R⟩.
Example 12.1. Even Machine: The following Turing machine halts if, and only
if, there are an even number of 1’s on the tape (under the assumption that all
167
12. T URING M ACHINE C OMPUTATIONS
0, 0, R
1, 1, R
start q0 q1
1, 1, R
The above machine halts only when the input is an even number of strokes.
Otherwise, the machine (theoretically) continues to operate indefinitely. For
any machine and input, it is possible to trace through the configurations of the
machine in order to determine the output. We will give a formal definition
of configurations later. For now, we can intuitively think of configurations
as a series of diagrams showing the state of the machine at any point in time
during operation. Configurations show the content of the tape, the state of the
machine and the location of the read/write head.
Let us trace through the configurations of the even machine if it is started
with an input of four 1’s. In this case, we expect that the machine will halt.
We will then run the machine on an input of three 1’s, where the machine will
run forever.
The machine starts in state q0 , scanning the leftmost 1. We can represent
the initial state of the machine as follows:
▷10 1110 . . .
The above configuration is straightforward. As can be seen, the machine starts
in state one, scanning the leftmost 1. This is represented by a subscript of the
state name on the first 1. The applicable instruction at this point is δ(q0 , 1) =
⟨q1 , 1, R⟩, and so the machine moves right on the tape and changes to state q1 .
▷111 110 . . .
Since the machine is now in state q1 scanning a 1, we have to “follow” the
instruction δ(q1 , 1) = ⟨q0 , 1, R⟩. This results in the configuration
▷1110 10 . . .
As the machine continues, the rules are applied again in the same order, re-
sulting in the following two configurations:
▷11111 0 . . .
168
12.2. Representing Turing Machines
▷111100 . . .
The machine is now in state q0 scanning a 0. Based on the transition diagram,
we can easily see that there is no instruction to be carried out, and thus the
machine has halted. This means that the input has been accepted.
Suppose next we start the machine with an input of three 1’s. The first few
configurations are similar, as the same instructions are carried out, with only
a small difference of the tape input:
▷10 110 . . .
▷111 10 . . .
▷1110 0 . . .
▷11101 . . .
The machine has now traversed past all the 1’s, and is reading a 0 in state q1 .
As shown in the diagram, there is an instruction of the form δ(q1 , 0) = ⟨q1 , 0, R⟩.
Since the tape is filled with 0 indefinitely to the right, the machine will con-
tinue to execute this instruction forever, staying in state q1 and moving ever
further to the right. The machine will never halt, and does not accept the
input.
It is important to note that not all machines will halt. If halting means that
the machine runs out of instructions to execute, then we can create a machine
that never halts simply by ensuring that there is an outgoing arrow for each
symbol at each state. The even machine can be modified to run indefinitely
by adding an instruction for scanning a 0 at q0 .
Example 12.2.
0, 0, R 0, 0, R
1, 1, R
start q0 q1
1, 1, R
169
12. T URING M ACHINE C OMPUTATIONS
1, 1, R 1, 1, R
1, 0, R 0, 0, R
start q0 q1 q2
0, 0, R 0, 1, R
q5 q4 q3
0, 0, L 1, 1, L
1, 1, L 1, 1, L 0, 1, L
Example 12.3. The machine table for the even machine is:
0 1 ▷
q0 1, q1 , R
q1 0, q1 , R 1, q0 , R
So far we have only considered machines that read and accept input. How-
ever, Turing machines have the capacity to both read and write. An example
of such a machine (although there are many, many examples) is a doubler. A
doubler, when started with a block of n 1’s on the tape, outputs a block of 2n
1’s.
170
12.3. Turing Machines
3. an initial state q0 ∈ Q,
We assume that the tape is infinite in one direction only. For this reason
it is useful to designate a special symbol ▷ as a marker for the left end of the
tape. This makes it easier for Turing machine programs to tell when they’re
“in danger” of running off the tape. We could assume that this symbol is never
overwritten, i.e., that δ(q, ▷) = ⟨q′ , ▷, x ⟩ if δ(q, ▷) is defined. Some textbooks
do this, we do not. You can simply be careful when constructing your Turing
machine that it never overwrites ▷. Moreover, there are cases where allowing
such overwriting provides some convenient flexibility.
Example 12.6. Even Machine: The even machine is formally the quadruple
⟨ Q, Σ, q0 , δ⟩ where
Q = { q0 , q1 }
Σ = {▷, 0, 1},
δ(q0 , 1) = ⟨q1 , 1, R⟩,
δ(q1 , 1) = ⟨q0 , 1, R⟩,
δ(q1 , 0) = ⟨q1 , 0, R⟩.
171
12. T URING M ACHINE C OMPUTATIONS
3. q ∈ Q
Intuitively, the sequence C is the content of the tape (symbols of all squares
from the leftmost square to the last non-blank or previously visited square),
m is the number of the square the read/write head is scanning (beginning
with 0 being the number of the leftmost square), and q is the current state of
the machine.
172
12.5. Unary Representation of Numbers
Example 12.12. Addition: Let’s build a machine that computes the function
f (n, m) = n + m. This requires a machine that starts with two blocks of 1’s of
length n and m on the tape, and halts with one block consisting of n + m 1’s.
The two input blocks of 1’s are separated by a 0, so one method would be to
write a stroke on the square containing the 0, and erase the last 1.
173
12. T URING M ACHINE C OMPUTATIONS
1, 1, R 1, 1, R 1, 0, N
0, 1, N 0, 0, L
start q0 q1 q2
1, 1, R 1, 1, L
0, 1, L
q2 q3
q6
0, 0, R 0, 0, L
R
1,
0, 0, 1, R
1, 1, R q1 q4
q7 1, 1, R
1, 0, R 1, 1, L
0, 0, L
start q0 q5
0, 1, R
q8 1, 0, N
1, 1, L
Example 12.13. The machine in Figure 12.4 computes the function f ( x ) = 2x.
Instead of erasing the input and writing two 1’s at the far right for every 1 in
the input as the machine from Example 12.4 does, this machine adds a single 1
to the right for every 1 in the input. It has to keep track of where the input
ends, so it leaves a 0 between the input and the added strokes, which it fills
with a 1 at the very end. And we have to “remember” where we are in the
input, so we temporarily replace a 1 in the input block by a 0.
174
12.5. Unary Representation of Numbers
0, 0, R 1, 1, R
0, 0, R 1, 1, R
start q6 q7 q8
0, 0, L 0, ▷, L
1, 0, L
q11 q10 q9 1, 1, L
0, 0, R
1,
▷, ▷, R
0,
L
1, 1, R
0, 1, R ▷, 0, N
q12 q13 q14
0, 0, R
move the doubled block of strokes to the far left of the tape. The machine
in Figure 12.5 does just this last part: started on a tape consisting of a block
of 0’s followed by a block of 1’s (and the head positioned anywhere in the
block of 0’s), it erases the 1’s one at a time and writes them at the beginning
of the tape. In order to be able to tell when it is done, it first marks the end
of the block of 1’s with a ▷ symbol, which gets deleted at the end. We’ve
started numbering the states at q6 , so they can be added to the doubler ma-
chine. All you’ll need is an additional instruction δ(q0 , 0) = ⟨q6 , 0, N ⟩, i.e., an
arrow from q0 to q6 labelled 0, 0, N. (There is one subtle problem: the resulting
machine does not work for input x = 0. We’ll leave this as an exercise.)
2. M does not halt at all, or with an output that is not a single block of 1’s
if f (n1 , . . . , nk ) is undefined.
175
12. T URING M ACHINE C OMPUTATIONS
Example 12.16. Halting States. To elucidate this concept, let us begin with an
alteration of the even machine. Instead of having the machine halt in state q0 if
the input is even, we can add an instruction to send the machine into a halting
state.
0, 0, R
1, 1, R
start q0 q1
1, 1, R
0, 0, N
Let us further expand the example. When the machine determines that the
input is odd, it never halts. We can alter the machine to include a reject state
by replacing the looping instruction with an instruction to go to a reject state r.
1, 1, R
start q0 q1
1, 1, R
0, 0, N 0, 0, N
h r
176
12.7. Disciplined Machines
advantages. The definition of halting used so far in this chapter makes the
proof of the Halting Problem intuitive and easy to demonstrate. For this rea-
son, we continue with our original definition.
We have already discussed that any Turing machine can be changed into
one with the same behavior but with a designated halting state. This is done
simply by adding a new state h, and adding an instruction δ(q, σ ) = ⟨h, σ, N ⟩
for any pair ⟨q, σ⟩ where the original δ is undefined. It is true, although te-
dious to prove, that any Turing machine M can be turned into a disciplined
Turing machine M′ which halts on the same inputs and produces the same
output. For instance, if the Turing machine halts and is not on square 1, we
can add some instructions to make the head move left until it finds the tape-
end marker, then move one square to the right, then halt. We’ll leave you to
think about how the other conditions can be dealt with.
Example 12.18. In Figure 12.6, we turn the addition machine from Example 12.12
into a disciplined machine.
Proposition 12.19. For every Turing machine M, there is a disciplined Turing ma-
chine M′ which halts with output O if M halts with output O, and does not halt if
M does not halt. In particular, any function f : Nn → N computable by a Turing
machine is also computable by a disciplined Turing machine.
177
12. T URING M ACHINE C OMPUTATIONS
0, 1, N
start q0 q1
0, 0, L
1, 1, R 1, 1, R
q2
1, 1, L
1, 0, L
h q3
▷, ▷, R
The examples of Turing machines we have seen so far have been fairly simple
in nature. But in fact, any problem that can be solved with any modern pro-
gramming language can also be solved with Turing machines. To build more
complex Turing machines, it is important to convince ourselves that we can
combine them, so we can build machines to solve more complex problems by
breaking the procedure into simpler parts. If we can find a natural way to
break a complex problem down into constituent parts, we can tackle the prob-
lem in several stages, creating several simple Turing machines and combining
them into one machine that can solve the problem. This point is especially
important when tackling the Halting Problem in the next section.
How do we combine Turing machines M = ⟨ Q, Σ, q0 , δ⟩ and M′ = ⟨ Q′ , Σ′ , q0′ , δ′ ⟩?
We now use the configuration of the tape after M has halted as the input con-
figuration of a run of machine M′ . To get a single Turing machine M ⌢ M′
that does this, do the following:
178
12.8. Combining Turing Machines
δ(q, σ)
if q ∈ Q
δ′′ (q, σ ) = δ′ (q, σ ) if q ∈ Q′
′
⟨q0 , σ, N ⟩ if q ∈ Q and δ(q, σ) is undefined
Note that unless the machine M is disciplined, we don’t know where the
tape head is when M halts, so the halting configuration of M need not have
the head scanning square 1. When combining machines, it’s important to keep
this in mind.
1, 1, R 1, 1, R 1, 0, N
0, 1, N 0, 0, L
start q0 q1 q2
179
12. T URING M ACHINE C OMPUTATIONS
machine.
1, 1, R 1, 1, R
0, 1, N 0, 0, L
start q0 q1 q2
1, 0, L
1, 1, L q3
▷, ▷, R
q4
180
12.9. Variants of Turing Machines
1, 1, R 1, 1, R
0, 1, N 0, 0, L
start q0 q1 q2
1, 0, L
1, 1, L q3
1, 1, R 1, 1, R
▷, ▷, R
1, 0, R 0, 0, R
q4 q5 q6
0, 0, R 0, 1, R
q9 q8 q7
0, 0, L 1, 1, L
1, 1, L 1, 1, L 0, 1, L
181
12. T URING M ACHINE C OMPUTATIONS
and is supposed to move left. According to our definition, it just stays put
instead of “falling off”, but we could have defined it so that it halts when that
happens. This definition is also equivalent: we could simulate the behavior
of a Turing machine that halts when it attempts to move left from square 0
by deleting every transition δ(q, ▷) = ⟨q′ , σ, L⟩—then instead of attempting to
move left on ▷ the machine halts.1
There are also different ways of representing numbers (and hence the input-
output function computed by a Turing machine): we use unary representa-
tion, but you can also use binary representation. This requires two symbols in
addition to 0 and ▷.
Now here is an interesting fact: none of these variations matters as to
which functions are Turing computable. If a function is Turing computable ac-
cording to one definition, it is Turing computable according to all of them.
We won’t go into the details of verifying this. Here’s just one example:
we gain no additional computing power by allowing a tape that is infinite
in both directions, or multiple tapes. The reason is, roughly, that a Turing
machine with a single one-way infinite tape can simulate multiple or two-way
infinite tapes. E.g., using additional states and instructions, we can “translate”
a program for a machine with multiple tapes or two-way infinite tape into
one with a single one-way infinite tape. The translated machine can use the
even squares for the squares of tape 1 (or the “positive” squares of a two-way
infinite tape) and the odd squares for the squares of tape 2 (or the “negative”
squares).
other than square 0 (see Example 12.14). We can get around that by adding a second ▷′ symbol to
use instead for such a purpose.
182
12.10. The Church–Turing Thesis
183
Chapter 13
Undecidability
13.1 Introduction
It might seem obvious that not every function, even every arithmetical func-
tion, can be computable. There are just too many, whose behavior is too
complicated. Functions defined from the decay of radioactive particles, for
instance, or other chaotic or random behavior. Suppose we start counting 1-
second intervals from a given time, and define the function f (n) as the num-
ber of particles in the universe that decay in the n-th 1-second interval after
that initial moment. This seems like a candidate for a function we cannot ever
hope to compute.
But it is one thing to not be able to imagine how one would compute such
functions, and quite another to actually prove that they are uncomputable.
In fact, even functions that seem hopelessly complicated may, in an abstract
sense, be computable. For instance, suppose the universe is finite in time—
some day, in the very distant future the universe will contract into a single
point, as some cosmological theories predict. Then there is only a finite (but
incredibly large) number of seconds from that initial moment for which f (n)
is defined. And any function which is defined for only finitely many inputs is
computable: we could list the outputs in one big table, or code it in one very
big Turing machine state transition diagram.
We are often interested in special cases of functions whose values give the
answers to yes/no questions. For instance, the question “is n a prime num-
ber?” is associated with the function
(
1 if n is prime
isprime(n) =
0 otherwise.
We say that a yes/no question can be effectively decided, if the associated 1/0-
valued function is effectively computable.
To prove mathematically that there are functions which cannot be effec-
tively computed, or problems that cannot effectively decided, it is essential to
185
13. U NDECIDABILITY
fix a specific model of computation, and show that there are functions it can-
not compute or problems it cannot decide. We can show, for instance, that not
every function can be computed by Turing machines, and not every problem
can be decided by Turing machines. We can then appeal to the Church–Turing
thesis to conclude that not only are Turing machines not powerful enough to
compute every function, but no effective procedure can.
The key to proving such negative results is the fact that we can assign
numbers to Turing machines themselves. The easiest way to do this is to enu-
merate them, perhaps by fixing a specific way to write down Turing machines
and their programs, and then listing them in a systematic fashion. Once we
see that this can be done, then the existence of Turing-uncomputable func-
tions follows by simple cardinality considerations: the set of functions from
N to N (in fact, even just from N to {0, 1}) are uncountable, but since we can
enumerate all the Turing machines, the set of Turing-computable functions is
only countably infinite.
We can also define specific functions and problems which we can prove
to be uncomputable and undecidable, respectively. One such problem is the
so-called Halting Problem. Turing machines can be finitely described by list-
ing their instructions. Such a description of a Turing machine, i.e., a Turing
machine program, can of course be used as input to another Turing machine.
So we can consider Turing machines that decide questions about other Tur-
ing machines. One particularly interesting question is this: “Does the given
Turing machine eventually halt when started on input n?” It would be nice if
there were a Turing machine that could decide this question: think of it as a
quality-control Turing machine which ensures that Turing machines don’t get
caught in infinite loops and such. The interesting fact, which Turing proved,
is that there cannot be such a Turing machine. There cannot be a single Turing
machine which, when started on input consisting of a description of a Turing
machine M and some number n, will always halt with either output 1 or 0
according to whether M machine would have halted when started on input n
or not.
186
13.2. Enumerating Turing Machines
0, 0, R
1, 1, R
start q0 q1
1, 1, R
0, 0, R
A, A, R
start s h
A, A, R
187
13. U NDECIDABILITY
2, 2, R
3, 3, R
start 1 2
3, 3, R
We wanted to show that the set of Turing machines is countable, and with
the above considerations in mind, it is enough to show that the set of stan-
dard Turing machines is countable. Suppose we are given a standard Turing
machine M = ⟨ Q, Σ, q0 , δ⟩. How could we describe it using a finite string of
positive integers? We’ll first list the number of states, the states themselves,
the number of symbols, the symbols themselves, and the starting state. (Re-
member, all of these are positive integers, since M is a standard machine.)
What about δ? The set of possible arguments, i.e., pairs ⟨q, σ ⟩, is finite, since
Q and Σ are finite. So the information in δ is simply the finite list of all 5-
tuples ⟨q, σ, q′ , σ′ , d⟩ where δ(q, σ) = ⟨q′ , σ′ , D ⟩, and d is a number that codes
the direction D (say, 1 for L, 2 for R, and 3 for N).
In this way, every standard Turing machine can be described by a finite list
of positive integers, i.e., as a sequence s M ∈ (Z+ )∗ . For instance, the standard
Even machine is coded by the sequence
Σ δ(2,2)=⟨2,2,R⟩
z }| { z }| {
2, 1, 2 , 3, 1, 2, 3, 1, 1, 3, 2, 3, 2 , 2, 2, 2, 2, 2 , 2, 3, 1, 3, 2 .
|{z} | {z } | {z }
Q δ(1,3)=⟨2,3,R⟩ δ(2,3)=⟨1,3,R⟩
Theorem 13.1. There are functions from N to N which are not Turing computable.
Proof. We know that the set of finite sequences of positive integers (Z+ )∗ is
countable (problem 4.7). This gives us that the set of descriptions of standard
Turing machines, as a subset of (Z+ )∗ , is itself enumerable. Every Turing
computable function N to N is computed by some (in fact, many) Turing ma-
chines. By renaming its states and symbols to positive integers (in particular,
▷ as 1, 0 as 2, and 1 as 3) we can see that every Turing computable function is
computed by a standard Turing machine. This means that the set of all Turing
computable functions from N to N is also enumerable.
On the other hand, the set of all functions from N to N is not countable
(problem 4.21). If all functions were computable by some Turing machine,
we could enumerate the set of all functions by listing all the descriptions of
188
13.3. Universal Turing Machines
Turing machines that compute them. So there are some functions that are not
Turing computable.
Definition 13.2. If M is the eth Turing machine (in our fixed enumeration), we
say that e is an index of M. We write Me for the eth Turing machine.
A machine may have more than one index, e.g., two descriptions of M
may differ in the order in which we list its instructions, and these different
descriptions will have different indices.
Importantly, it is possible to give the enumeration of Turing machine de-
scriptions in such a way that we can effectively compute the description of M
from its index, and to effectively compute an index of a machine M from its
description. By the Church–Turing thesis, it is then possible to find a Turing
machine which recovers the description of the Turing machine with index e
and writes the corresponding description on its tape as output. The descrip-
tion would be a sequence of blocks of 1’s (representing the positive integers in
the sequence describing Me ).
Given this, it now becomes natural to ask: what functions of Turing ma-
chine indices are themselves computable by Turing machines? What proper-
ties of Turing machine indices can be decided by Turing machines? An ex-
ample: the function that maps an index e to the number of states the Turing
machine with index e has, is computable by a Turing machine. Here’s what
such a Turing machine would do: started on a tape containing a single block
of e 1’s, it would first decode e into its description. The description is now
represented by a sequence of blocks of 1’s on the tape. Since the first element
in this sequence is the number of states. So all that has to be done now is to
erase everything but the first block of 1’s and then halt.
A remarkable result is the following:
189
13. U NDECIDABILITY
1. Find the number k of the “current head position” (at the beginning,
that’s 1),
2. Move to the kth block in the “tape” to see what the “symbol” there is,
4. Move back to the kth block on the “tape” and replace the “symbol” there
with the code number of the symbol Me would write,
5. Move the head to where it records the current “state” and replace the
number there with the number of the new state,
6. Move to the place where it records the “tape position” and erase a 1 or
add a 1 (if the instruction says to move left or right, respectively).
7. Repeat.2
2 We’re glossing over some subtle difficulties here. E.g., U may need some extra space when
it increases the counter where it keeps track of the “current head position”—in that case it will
have to move the entire “tape” to the right.
190
13.4. The Halting Problem
If Me started on input n never halts, then U also never halts, so its output is
undefined.
If in step (3) it turns out that the description of Me contains no instruction
for the current “state”/“symbol” pair, then Me would halt. If this happens, U
erases the part of its tape to the left of the “tape.” For each block of three 1’s
(representing a 1 on Me ’s tape), it writes a 1 on the left end of its own tape, and
successively erases the “tape.” When this is done, U’s tape contains a single
block of 1’s of length m.
If U encounters something other than a block of three 1’s on the “tape,” it
immediately halts. Since U’s tape in this case does not contain a single block
of 1’s, its output is not a natural number, i.e., f (e, n) is undefined in this case.
Definition 13.5 (Halting problem). The Halting Problem is the problem of de-
termining (for any e, n) whether the Turing machine Me halts for an input of n
strokes.
191
13. U NDECIDABILITY
2. Now suppose Me does not halt for an input of e 1s. Then s(e) = 0, and
S, when started on input e, halts with a blank tape. J, when started on
a blank tape, immediately halts. Again, Me does what S followed by J
would do, so Me must halt for an input of e 1’s.
192
13.6. Representing Turing Machines
In order to establish this important negative result, we prove that the de-
cision problem cannot be solved by a Turing machine. That is, we show that
there is no Turing machine which, whenever it is started on a tape that con-
tains a first-order sentence, eventually halts and outputs either 1 or 0 depend-
ing on whether the sentence is valid or not. By the Church–Turing thesis,
every function which is computable is Turing computable. So if this “validity
function” were effectively computable at all, it would be Turing computable.
If it isn’t Turing computable, then, it also cannot be effectively computable.
Our strategy for proving that the decision problem is unsolvable is to re-
duce the halting problem to it. This means the following: We have proved that
the function h(e, w) that halts with output 1 if the Turing machine described
by e halts on input w and outputs 0 otherwise, is not Turing computable. We
will show that if there were a Turing machine that decides validity of first-
order sentences, then there is also Turing machine that computes h. Since h
cannot be computed by a Turing machine, there cannot be a Turing machine
that decides validity either.
The first step in this strategy is to show that for every input w and a Turing
machine M, we can effectively describe a sentence τ ( M, w) representing the
instruction set of M and the input w and a sentence α( M, w) expressing “M
eventually halts” such that:
The bulk of our proof will consist in describing these sentences τ ( M, w) and α( M, w)
and in verifying that τ ( M, w) ⊃ α( M, w) is valid iff M halts on input w.
193
13. U NDECIDABILITY
For each number n there is a canonical term n, the numeral for n, which
represents it in L M . 0 is 0, 1 is 0′ , 2 is 0′′ , and so on. More formally:
0=0
n + 1 = n′
The term 0, i.e., 0 names the leftmost position on the tape as well as the time
before the first execution step (the initial configuration). The term 1, i.e., 0′
names the square to the right of the leftmost square, and the time after the
first execution step, and so on.
We also introduce a predicate symbol < to express both the ordering of
tape positions (when it means “to the left of”) and execution steps (then it
means “before”).
Once we have the language in place, we list the “axioms” of τ ( M, w), i.e.,
the sentences which, taken together, describe the behavior of M when run on
input w. There will be sentences which lay down conditions on 0, ′, and <,
sentences that describes the input configuration, and sentences that describe
what the configuration of M is after it executes a particular instruction.
3. A constant symbol 0
a) A sentence that says that every number is less than its successor:
∀x x < x′
194
13.6. Representing Turing Machines
∀ x (k < x ⊃ S0 ( x, 0))
195
13. U NDECIDABILITY
special case is covered by the second conjunction: it says that if, af-
ter y steps, the machine is scanning square 0 in state qi and square 0
contains symbol σ, then after y + 1 steps it’s still scanning square 0,
is now in state q j , the symbol on square 0 is σ′ , and the squares
other than square 0 contain the same symbols they contained ofter
y steps.
c) For every instruction δ(qi , σ) = ⟨q j , σ′ , N ⟩, the sentence:
Let τ ( M, w) be the conjunction of all the above sentences for Turing machine M
and input w.
In order to express that M eventually halts, we have to find a sentence that
says “after some number of steps, the transition function will be undefined.”
Let X be the set of all pairs ⟨q, σ ⟩ such that δ(q, σ ) is undefined. Let α( M, w)
then be the sentence
_
∃ x ∃y ( (Qq ( x, y) & Sσ ( x, y)))
⟨q,σ⟩∈ X
∃ x ∃y Qh ( x, y)
Proof. Exercise.
196
13.7. Verifying the Representation
Qq (m, n) & Sσ0 (0, n) & · · · & Sσk (k, n) & ∀ x (k < x ⊃ S0 ( x, n))
Proof. Suppose that M halts for input w after n steps. There is some state q,
square m, and symbol σ such that:
197
13. U NDECIDABILITY
as ⟨q′ , σ′ ⟩ ∈ X.
W
since Qq′ (m, n) & Sσ′ (m, n) ⊨ ⟨q,σ⟩∈ X (Qq ( m, n ) & Sσ ( m, n )),
Lemma 13.13. For each n, if M has not halted after n steps, τ ( M, w) ⊨ χ( M, w, n).
1. δ(q, σ ) = ⟨q′ , σ′ , R⟩
2. δ(q, σ ) = ⟨q′ , σ′ , L⟩
3. δ(q, σ ) = ⟨q′ , σ′ , N ⟩
198
13.7. Verifying the Representation
We now get
199
13. U NDECIDABILITY
Proof. By Lemma 13.13, we know that, for any time n, the description χ( M, w, n)
of the configuration of M at time n is entailed by τ ( M, w). Suppose M halts af-
ter k steps. At that point, it will be scanning square m, for some m ∈ N. Then
χ( M, w, k) describes a halting configuration of M, i.e., it contains as conjuncts
both Qq (m, k ) and Sσ (m, k ) with δ(q, σ ) undefined. Thus, by Lemma 13.12,
χ( M, w, k) ⊨ α( M, w). But since τ ( M, w) ⊨ χ( M, w, k), we have τ ( M, w) ⊨
α( M, w) and therefore τ ( M, w) ⊃ α( M, w) is valid.
200
13.8. The Decision Problem is Unsolvable
Proof. Suppose the decision problem were solvable, i.e., suppose there were
a Turing machine D. Then we could solve the halting problem as follows.
We construct a Turing machine E that, given as input the number e of Turing
machine Me and input w, computes the corresponding sentence τ ( Me , w) ⊃
α( Me , w) and halts, scanning the leftmost square on the tape. The machine
E ⌢ D would then, given input e and w, first compute τ ( Me , w) ⊃ α( Me , w)
and then run the decision problem machine D on that input. D halts with out-
put 1 iff τ ( Me , w) ⊃ α( Me , w) is valid and outputs 0 otherwise. By Lemma 13.15
and Lemma 13.14, τ ( Me , w) ⊃ α( Me , w) is valid iff Me halts on input w. Thus,
E ⌢ D, given input e and w halts with output 1 iff Me halts on input w and
halts with output 0 otherwise. In other words, E ⌢ D would solve the halting
problem. But we know, by Theorem 13.8, that no such Turing machine can
exist.
201
13. U NDECIDABILITY
Proof. All possible derivations of first-order logic can be generated, one after
another, by an effective algorithm. The machine E does this, and when it finds
a derivation that shows that ⊢ ψ, it halts with output 1. By the soundness
theorem, if E halts with output 1, it’s because ⊨ ψ. By the completeness the-
orem, if ⊨ ψ there is a derivation that shows that ⊢ ψ. Since E systematically
generates all possible derivations, it will eventually find one that shows ⊢ ψ,
so will eventually halt with output 1.
202
13.9. Trakhtenbrot’s Theorem
ψ ( y ) ≡ ∀ x ( x < y ⊃ x ̸ = y ).
203
13. U NDECIDABILITY
As you can see, the sentences describing the transitions of M are the
same as the corresponding sentence in τ ( M, w), except we add ψ(y′ ) at
the end. ψ(y′ ) ensures that the number y′ of the “next” configuration is
different from all previous numbers 0, 0′ , . . . .
Let τ ′ ( M, w) be the conjunction of all the above sentences for Turing ma-
chine M and input w.
M′ = {0, . . . , n},
(
M′ x + 1 if x < n
′ (x) =
n otherwise,
′
⟨ x, y⟩ ∈ <M iff x < y or x = y = n,
where n = max(k, len(w)) and k is the least number such that M started on
input w has halted after k steps. We leave the verification that M′ ⊨ τ ′ ( M, w) &
E( M, w) as an exercise.
Proof. Suppose there were a Turing machine F that decides the finite satisfi-
ability problem. Then given any Turing machine M and input w, we could
compute the sentence τ ′ ( M, w) & α( M, w), and use F to decide if it has a finite
model. By Lemmata 13.19 and 13.20, it does iff M started on input w halts. So
we could use F to solve the halting problem, which we know is unsolvable.
204
13.9. Trakhtenbrot’s Theorem
Corollary 13.22. There can be no derivation system that is sound and complete for
finite validity, i.e., a derivation system which has ⊢ ψ iff M ⊨ ψ for every finite
structure M.
Proof. Exercise.
205
Part IV
207
Chapter 14
Introduction to Incompleteness
209
14. I NTRODUCTION TO I NCOMPLETENESS
Basic Laws of Arithmetic, Frege set out to show that all of arithmetic could be
derived in his Begriffsschrift from purely logical assumption. Unfortunately,
these assumptions turned out to be inconsistent, as Russell showed in 1902.
But setting aside the inconsistent axiom, Frege more or less invented mod-
ern logic singlehandedly, a startling achievement. Quantificational logic was
also developed independently by algebraically-minded thinkers after Boole,
including Peirce and Schröder.
Let us now turn to developments in the foundations of mathematics. Of
course, since logic plays an important role in mathematics, there is a good deal
of interaction with the developments just described. For example, Frege de-
veloped his logic with the explicit purpose of showing that all of mathematics
could be based solely on his logical framework; in particular, he wished to
show that mathematics consists of a priori analytic truths instead of, as Kant
had maintained, a priori synthetic ones.
Many take the birth of mathematics proper to have occurred with the
Greeks. Euclid’s Elements, written around 300 B.C., is already a mature rep-
resentative of Greek mathematics, with its emphasis on rigor and precision.
The definitions and proofs in Euclid’s Elements survive more or less intact
in high school geometry textbooks today (to the extent that geometry is still
taught in high schools). This model of mathematical reasoning has been held
to be a paradigm for rigorous argumentation not only in mathematics but in
branches of philosophy as well. (Spinoza even presented moral and religious
arguments in the Euclidean style, which is strange to see!)
Calculus was invented by Newton and Leibniz in the seventeenth century.
(A fierce priority dispute raged for centuries, but most scholars today hold
that the two developments were for the most part independent.) Calculus in-
volves reasoning about, for example, infinite sums of infinitely small quanti-
ties; these features fueled criticism by Bishop Berkeley, who argued that belief
in God was no less rational than the mathematics of his time. The methods of
calculus were widely used in the eighteenth century, for example by Leonhard
Euler, who used calculations involving infinite sums with dramatic results.
In the nineteenth century, mathematicians tried to address Berkeley’s crit-
icisms by putting calculus on a firmer foundation. Efforts by Cauchy, Weier-
strass, Bolzano, and others led to our contemporary definitions of limits, con-
tinuity, differentiation, and integration in terms of “epsilons and deltas,” in
other words, devoid of any reference to infinitesimals. Later in the century,
mathematicians tried to push further, and explain all aspects of calculus, in-
cluding the real numbers themselves, in terms of the natural numbers. (Kro-
necker: “God created the whole numbers, all else is the work of man.”) In
1872, Dedekind wrote “Continuity and the irrational numbers,” where he
showed how to “construct” the real numbers as sets of rational numbers (which,
as you know, can be viewed as pairs of natural numbers); in 1888 he wrote
“Was sind und was sollen die Zahlen” (roughly, “What are the natural num-
210
14.1. Historical Background
bers, and what should they be?”) which aimed to explain the natural numbers
in purely “logical” terms. In 1887 Kronecker wrote “Über den Zahlbegriff”
(“On the concept of number”) where he spoke of representing all mathemati-
cal object in terms of the integers; in 1889 Giuseppe Peano gave formal, sym-
bolic axioms for the natural numbers.
The end of the nineteenth century also brought a new boldness in dealing
with the infinite. Before then, infinitary objects and structures (like the set of
natural numbers) were treated gingerly; “infinitely many” was understood
as “as many as you want,” and “approaches in the limit” was understood as
“gets as close as you want.” But Georg Cantor showed that it was possible to
take the infinite at face value. Work by Cantor, Dedekind, and others help to
introduce the general set-theoretic understanding of mathematics that is now
widely accepted.
This brings us to twentieth century developments in logic and founda-
tions. In 1902 Russell discovered the paradox in Frege’s logical system. In 1904
Zermelo proved Cantor’s well-ordering principle, using the so-called “axiom
of choice”; the legitimacy of this axiom prompted a good deal of debate. Be-
tween 1910 and 1913 the three volumes of Russell and Whitehead’s Principia
Mathematica appeared, extending the Fregean program of establishing mathe-
matics on logical grounds. Unfortunately, Russell and Whitehead were forced
to adopt two principles that seemed hard to justify as purely logical: an axiom
of infinity and an axiom of “reducibility.” In the 1900’s Poincaré criticized the
use of “impredicative definitions” in mathematics, and in the 1910’s Brouwer
began proposing to refound all of mathematics in an “intuitionistic” basis,
which avoided the use of the law of the excluded middle (φ ∨ ∼ φ).
Strange days indeed! The program of reducing all of mathematics to logic
is now referred to as “logicism,” and is commonly viewed as having failed,
due to the difficulties mentioned above. The program of developing mathe-
matics in terms of intuitionistic mental constructions is called “intuitionism,”
and is viewed as posing overly severe restrictions on everyday mathemat-
ics. Around the turn of the century, David Hilbert, one of the most influen-
tial mathematicians of all time, was a strong supporter of the new, abstract
methods introduced by Cantor and Dedekind: “no one will drive us from the
paradise that Cantor has created for us.” At the same time, he was sensitive
to foundational criticisms of these new methods (oddly enough, now called
“classical”). He proposed a way of having one’s cake and eating it too:
2. Use safe, “finitary” methods to prove that these formal deductive sys-
tems are consistent.
Hilbert’s work went a long way toward accomplishing the first goal. In
1899, he had done this for geometry in his celebrated book Foundations of ge-
211
14. I NTRODUCTION TO I NCOMPLETENESS
212
14.2. Definitions
can be proved in them. It also makes sense to develop less restricted methods
of proof for establishing the consistency of these systems, and to find ways to
measure how hard it is to prove their consistency. Since Gödel showed that
(almost) every formal system has questions it cannot settle, it makes sense to
look for “interesting” questions a given formal system cannot settle, and to
figure out how strong a formal system has to be to settle them. To the present
day, logicians have been pursuing these questions in a new mathematical dis-
cipline, the theory of proofs.
14.2 Definitions
In order to carry out Hilbert’s project of formalizing mathematics and show-
ing that such a formalization is consistent and complete, the first order of busi-
ness would be that of picking a language, logical framework, and a system of
axioms. For our purposes, let us suppose that mathematics can be formalized
in a first-order language, i.e., that there is some set of constant symbols, func-
tion symbols, and predicate symbols which, together with the connectives and
quantifiers of first-order logic, allow us to express the claims of mathematics.
Most people agree that such a language exists: the language of set theory, in
which ∈ is the only non-logical symbol. That such a simple language is so
expressive is of course a very implausible claim at first sight, and it took a
lot of work to establish that practically of all mathematics can be expressed
in this very austere vocabulary. To keep things simple, for now, let’s restrict
our discussion to arithmetic, so the part of mathematics that just deals with
the natural numbers N. The natural language in which to express facts of
arithmetic is L A . L A contains a single two-place predicate symbol <, a sin-
gle constant symbol 0, one one-place function symbol ′, and two two-place
function symbols + and ×.
There are two easy ways to specify theories. One is as the set of sentences
true in some structure. For instance, consider the structure for L A in which
the domain is N and all non-logical symbols are interpreted as you would
expect.
1. |N| = N
2. 0N = 0
213
14. I NTRODUCTION TO I NCOMPLETENESS
214
14.2. Definitions
Q = { φ | { Q1 , . . . , Q8 } ⊨ φ }.
Definition 14.7. A theory Γ is complete iff for every sentence φ in its language,
either Γ ⊨ φ or Γ ⊨ ∼ φ.
215
14. I NTRODUCTION TO I NCOMPLETENESS
φ(0, y1 , . . . , yn ) & ∀ x ( φ( x, y1 , . . . , yn ) ⊃ φ( x ′ , y1 , . . . , yn ))
Definition 14.11. A set X is called computably enumerable (c.e. for short) iff it
is empty or it has a computable enumeration.
216
14.3. Overview of Incompleteness Results
217
14. I NTRODUCTION TO I NCOMPLETENESS
tary,” means, which would defend classical mathematics against the chal-
lenges of intuitionism. Gödel’s incompleteness theorems showed that these
goals cannot be achieved.
Gödel’s first incompleteness theorem showed that a version of Russell and
Whitehead’s Principia Mathematica is not complete. But the proof was actu-
ally very general and applies to a wide variety of theories. This means that it
wasn’t just that Principia Mathematica did not manage to completely capture
mathematics, but that no acceptable theory does. It took a while to isolate
the features of theories that suffice for the incompleteness theorems to apply,
and to generalize Gödel’s proof to apply make it depend only on these fea-
tures. But we are now in a position to state a very general version of the first
incompleteness theorem for theories in the language L A of arithmetic.
To say that Γ is not complete is to say that for at least one sentence φ,
Γ ⊬ φ and Γ ⊬ ∼ φ. Such a sentence is called independent (of Γ). We can in
fact relatively quickly prove that there must be independent sentences. But
the power of Gödel’s proof of the theorem lies in the fact that it exhibits a
specific example of such an independent sentence. The intriguing construction
produces a sentence γΓ , called a Gödel sentence for Γ, which is unprovable
because in Γ, γΓ is equivalent to the claim that γΓ is unprovable in Γ. It does
so constructively, i.e., given an axiomatization of Γ and a description of the
derivation system, the proof gives a method for actually writing down γΓ .
The construction in Gödel’s proof requires that we find a way to express
in L A the properties of and operations on terms and formulae of L A itself.
These include properties such as “φ is a sentence,” “δ is a derivation of φ,”
and operations such as φ[t/x ]. This way must (a) express these properties
and relations via a “coding” of symbols and sequences thereof (which is what
terms, formulae, derivations, etc. are) as natural numbers (which is what L A
can talk about). It must (b) do this in such a way that Γ will prove the relevant
facts, so we must show that these properties are coded by decidable properties
of natural numbers and the operations correspond to computable functions on
natural numbers. This is called “arithmetization of syntax.”
Before we investigate how syntax can be arithmetized, however, we will
consider the condition that Γ is “strong enough,” i.e., represents all com-
putable functions and decidable relations. This requires that we give a precise
definition of “computable.” This can be done in a number of ways, e.g., via
the model of Turing machines, or as those functions computable by programs
in some general-purpose programming language. Since our aim is to repre-
sent these functions and relations in a theory in the language L A , however, it
is best to pick a simple definition of computability of just numerical functions.
This is the notion of recursive function. So we will first discuss the recursive
218
14.4. Undecidability and Incompleteness
functions. We will then show that Q already represents all recursive functions
and relations. This will allow us to apply the incompleteness theorem to spe-
cific theories such as Q and PA, since we will have established that these are
examples of theories that are “strong enough.”
The end result of the arithmetization of syntax is a formula ProvΓ ( x ) which,
via the coding of formulae as numbers, expresses provability from the axioms
of Γ. Specifically, if φ is coded by the number n, and Γ ⊢ φ, then Γ ⊢ ProvΓ (n).
This “provability predicate” for Γ allows us also to express, in a certain sense,
the consistency of Γ as a sentence of L A : let the “consistency statement” for Γ
be the sentence ∼ProvΓ (n), where we take n to be the code of a contradiction,
e.g., of ⊥. The second incompleteness theorem states that consistent axioma-
tizable theories also do not prove their own consistency statements. The con-
ditions required for this theorem to apply are a bit more stringent than just
that the theory represents all computable functions and decidable relations,
but we will show that PA satisfies them.
D = {n | Γ ⊢ ∼ φn (n)}
219
14. I NTRODUCTION TO I NCOMPLETENESS
The preceding theorem shows that no consistent theory that represents all
decidable relations can be decidable. We will show that Q does represent all
decidable relations; this means that all theories that include Q, such as PA and
TA, also do, and hence also are not decidable. (Since all these theories are true
in the standard model, they are all consistent.)
We can also use this result to obtain a weak version of the first incomplete-
ness theorem. Any theory that is axiomatizable and complete is decidable.
Consistent theories that are axiomatizable and represent all decidable proper-
ties then cannot be complete.
220
14.4. Undecidability and Incompleteness
221
Chapter 15
Recursive Functions
15.1 Introduction
In order to develop a mathematical theory of computability, one has to, first
of all, develop a model of computability. We now think of computability as the
kind of thing that computers do, and computers work with symbols. But at
the beginning of the development of theories of computability, the paradig-
matic example of computation was numerical computation. Mathematicians
were always interested in number-theoretic functions, i.e., functions f : Nn →
N that can be computed. So it is not surprising that at the beginning of the
theory of computability, it was such functions that were studied. The most
familiar examples of computable numerical functions, such as addition, mul-
tiplication, exponentiation (of natural numbers) share an interesting feature:
they can be defined recursively. It is thus quite natural to attempt a general
definition of computable function on the basis of recursive definitions. Among
the many possible ways to define number-theoretic functions recursively, one
particularly simple pattern of definition here becomes central: so-called prim-
itive recursion.
In addition to computable functions, we might be interested in computable
sets and relations. A set is computable if we can compute the answer to
whether or not a given number is an element of the set, and a relation is com-
putable iff we can compute whether or not a tuple ⟨n1 , . . . , nk ⟩ is an element
of the relation. By considering the characteristic function of a set or relation,
discussion of computable sets and relations can be subsumed under that of
computable functions. Thus we can define primitive recursive relations as
well, e.g., the relation “n evenly divides m” is a primitive recursive relation.
Primitive recursive functions—those that can be defined using just primi-
tive recursion—are not, however, the only computable number-theoretic func-
tions. Many generalizations of primitive recursion have been considered, but
the most powerful and widely-accepted additional way of computing func-
tions is by unbounded search. This leads to the definition of partial recur-
223
15. R ECURSIVE F UNCTIONS
h (0) = 1
h ( x + 1) = 2 · h ( x )
If we already know how to multiply, then these equations give us the infor-
mation required for (a) and (b) above. By successively applying the second
equation, we get that
h(1) = 2 · h(0) = 2,
h(2) = 2 · h(1) = 2 · 2,
h(3) = 2 · h(2) = 2 · 2 · 2,
..
.
224
15.2. Primitive Recursion
We can define even more fundamental functions like addition and mul-
tiplication by primitive recursion. In these cases, however, the functions in
question are 2-place. We fix one of the argument places, and use the other for
the recursion. E.g, to define add( x, y) we can fix x and define the value first
for y = 0 and then for y + 1 in terms of y. Since x is fixed, it will appear on the
left and on the right side of the defining equations.
add( x, 0) = x
add( x, y + 1) = add( x, y) + 1
These equations specify the value of add for all x and y. To find add(2, 3), for
instance, we apply the defining equations for x = 2, using the first to find
add(2, 0) = 2, then using the second to successively find add(2, 1) = 2 + 1 =
3, add(2, 2) = 3 + 1 = 4, add(2, 3) = 4 + 1 = 5.
In the definition of add we used + on the right-hand-side of the second
equation, but only to add 1. In other words, we used the successor func-
tion succ(z) = z + 1 and applied it to the previous value add( x, y) to define
add( x, y + 1). So we can think of the recursive definition as given in terms of
a single function which we apply to the previous value. However, it doesn’t
hurt—and sometimes is necessary—to allow the function to depend not just
on the previous value but also on x and y. Consider:
mult( x, 0) = 0
mult( x, y + 1) = add(mult( x, y), x )
mult(2, 0) = 0
mult(2, 1) = mult(2, 0 + 1) = add(mult(2, 0), 2) = add(0, 2) = 2
mult(2, 2) = mult(2, 1 + 1) = add(mult(2, 1), 2) = add(2, 2) = 4
mult(2, 3) = mult(2, 2 + 1) = add(mult(2, 2), 2) = add(4, 2) = 6
225
15. R ECURSIVE F UNCTIONS
h ( x 0 , . . . , x k −1 , 0 ) = f ( x 0 , . . . , x k −1 )
h( x0 , . . . , xk−1 , y + 1) = g( x0 , . . . , xk−1 , y, h( x0 , . . . , xk−1 , y))
add( x0 , 0) = f ( x0 ) = x0
add( x0 , y + 1) = g( x0 , y, add( x0 , y)) = succ(add( x0 , y))
mult( x0 , 0) = f ( x0 ) = 0
mult( x0 , y + 1) = g( x0 , y, mult( x0 , y)) = add(mult( x0 , y), x0 )
15.3 Composition
If f and g are two one-place functions of natural numbers, we can compose
them: h( x ) = g( f ( x )). The new function h( x ) is then defined by composition
from the functions f and g. We’d like to generalize this to functions of more
than one argument.
Here’s one way of doing this: suppose f is a k-place function, and g0 , . . . ,
gk−1 are k functions which are all n-place. Then we can define a new n-place
function h as follows:
Pin ( x0 , . . . , xn−1 ) = xi
The functions Pik are called projection functions: Pin is an n-place function. Then
g can be defined by
g( x, y, z) = succ( P23 ( x, y, z)).
226
15.4. Primitive Recursion Functions
h( x, y) = f ( x, g( x, x, y), y).
h( x, y) = f ( P02 ( x, y), g( P02 ( x, y), P02 ( x, y), P12 ( x, y)), P12 ( x, y)).
h ( x 0 , . . . , x k −1 , 0 ) = f ( x 0 , . . . , x k −1 )
h( x0 , . . . , xk−1 , y + 1) = g( x0 , . . . , xk−1 , y, h( x0 , . . . , xk−1 , y))
227
15. R ECURSIVE F UNCTIONS
Pin ( x0 , . . . , xn−1 ) = xi ,
for each natural number n and i < n, we will include among the primitive
recursive functions the function zero( x ) = 0.
Definition 15.3. The set of primitive recursive functions is the set of functions
from Nn to N, defined inductively by the following clauses:
Put more concisely, the set of primitive recursive functions is the smallest
set containing zero, succ, and the projection functions Pjn , and which is closed
under composition and primitive recursion.
Another way of describing the set of primitive recursive functions is by
defining it in terms of “stages.” Let S0 denote the set of starting functions:
zero, succ, and the projections. These are the primitive recursive functions of
stage 0. Once a stage Si has been defined, let Si+1 be the set of all functions
you get by applying a single instance of composition or primitive recursion to
functions already in Si . Then
[
S= Si
i ∈N
228
15.4. Primitive Recursion Functions
add( x0 , 0) = f ( x0 ) = x0
add( x0 , y + 1) = g( x0 , y, add( x0 , y)) = succ(add( x0 , y))
Since succ and P23 count as primitive recursive functions, g does as well, since
it can be defined by composition from primitive recursive functions.
Proof. Exercise.
Example 15.6. Here’s our very first example of a primitive recursive defini-
tion:
h (0) = 1
h ( y + 1) = 2 · h ( y ).
This function cannot fit into the form required by Definition 15.1, since k = 0.
The definition also involves the constants 1 and 2. To get around the first
problem, let’s introduce a dummy argument and define the function h′ :
h ′ ( x0 , 0) = f ( x0 ) = 1
h′ ( x0 , y + 1) = g( x0 , y, h′ ( x0 , y)) = 2 · h′ ( x0 , y).
g( x0 , y, z) = g′ ( P23 ( x0 , y, z))
229
15. R ECURSIVE F UNCTIONS
and
add( x0 , 0) = P01 ( x0 ) = x0
add( x0 , y + 1) = succ( P23 ( x0 , y, add( x0 , y))) = add( x0 , y) + 1
Here the role of f is played by P01 , and the role of g is played by succ( P23 ( x0 , y, z)),
which is assigned the notation Comp1,3 [succ, P23 ] as it is the result of defining
a function by composition from the 1-ary function succ and the 3-ary func-
tion P23 . With this setup, we can denote the addition function by
Having these notations sometimes proves useful, e.g., when enumerating prim-
itive recursive functions.
h(⃗x, 0) = f (⃗x )
h(⃗x, y + 1) = g(⃗x, y, h(⃗x, y))
230
15.7. Examples of Primitive Recursive Functions
and suppose the functions f and g are computable. (We use ⃗x to abbreviate x0 ,
. . . , xk−1 .) Then h(⃗x, 0) can obviously be computed, since it is just f (⃗x ) which
we assume is computable. h(⃗x, 1) can then also be computed, since 1 = 0 + 1
and so h(⃗x, 1) is just
Thus, to compute h(⃗x, y) in general, successively compute h(⃗x, 0), h(⃗x, 1), . . . ,
until we reach h(⃗x, y).
Thus, a primitive recursive definition yields a new computable function if
the functions f and g are computable. Composition of functions also results
in a computable function if the functions f and gi are computable.
Since the basic functions zero, succ, and Pin are computable, and compo-
sition and primitive recursion yield computable functions from computable
functions, this means that every primitive recursive function is computable.
exp( x, 0) = 1
exp( x, y + 1) = mult( x, exp( x, y)).
231
15. R ECURSIVE F UNCTIONS
exp( x, 0) = f ( x )
exp( x, y + 1) = g( x, y, exp( x, y)).
where
f ( x ) = succ(zero( x )) = 1
g( x, y, z) = mult( P03 ( x, y, z), P23 ( x, y, z)) = x · z
is primitive recursive.
pred(0) = 0 and
pred(y + 1) = y.
This is almost a primitive recursive definition. It does not, strictly speaking, fit
into the pattern of definition by primitive recursion, since that pattern requires
at least one extra argument x. It is also odd in that it does not actually use
pred(y) in the definition of pred(y + 1). But we can first define pred′ ( x, y) by
pred′ ( x, 0) = zero( x ) = 0,
pred′ ( x, y + 1) = P13 ( x, y, pred′ ( x, y)) = y.
and then define pred from it by composition, e.g., as pred( x ) = pred′ (zero( x ), P01 ( x )).
fac(0) = 1
fac(y + 1) = fac(y) · (y + 1).
232
15.7. Examples of Primitive Recursive Functions
h( x, 0) = const1 ( x )
h( x, y + 1) = g( x, y, h( x, y))
where g( x, y, z) = mult( P23 ( x, y, z), succ( P13 ( x, y, z))) and then let
From now on we’ll be a bit more laissez-faire and not give the official defini-
tions by composition and primitive recursion.
is primitive recursive.
Proof. We have:
x −̇ 0 = x
x −̇ (y + 1) = pred( x −̇ y)
max( x, y) = x + (y −̇ x ).
Proof. Exercise.
Proposition 15.14. The set of primitive recursive functions is closed under the fol-
lowing two operations:
233
15. R ECURSIVE F UNCTIONS
Proof. For example, finite sums are defined recursively by the equations
g(⃗x, 0) = f (⃗x, 0)
g(⃗x, y + 1) = g(⃗x, y) + f (⃗x, y + 1).
χIsZero (0) = 1,
χIsZero ( x + 1) = 0.
It should be clear that one can compose relations with other primitive re-
cursive functions. So the following are also primitive recursive:
Proposition 15.16. The set of primitive recursive relations is closed under Boolean
operations, that is, if P(⃗x ) and Q(⃗x ) are primitive recursive, so are
1. ∼ P(⃗x )
234
15.8. Primitive Recursive Relations
3. P(⃗x ) ∨ Q(⃗x )
4. P(⃗x ) ⊃ Q(⃗x )
Proof. Suppose P(⃗x ) and Q(⃗x ) are primitive recursive, i.e., their characteristic
functions χ P and χQ are. We have to show that the characteristic functions of
∼ P(⃗x ), etc., are also primitive recursive.
(
0 if χ P (⃗x ) = 1
χ∼ P (⃗x ) =
1 otherwise
We can define χ P&Q (⃗x ) as χ P (⃗x ) · χQ (⃗x ) or as min(χ P (⃗x ), χQ (⃗x )). Similarly,
Proposition 15.17. The set of primitive recursive relations is closed under bounded
quantification, i.e., if R(⃗x, z) is a primitive recursive relation, then so are the relations
(∀z < y) R(⃗x, z) holds of ⃗x and y if and only if R(⃗x, z) holds for every z less than y,
and similarly for (∃z < y) R(⃗x, z).
Proof. By convention, we take (∀z < 0) R(⃗x, z) to be true (for the trivial reason
that there are no z less than 0) and (∃z < 0) R(⃗x, z) to be false. A bounded
universal quantifier functions just like a finite product or iterated minimum,
i.e., if P(⃗x, y) ⇔ (∀z < y) R(⃗x, z) then χ P (⃗x, y) can be defined by
χ P (⃗x, 0) = 1
χ P (⃗x, y + 1) = min(χ P (⃗x, y), χ R (⃗x, y))).
235
15. R ECURSIVE F UNCTIONS
cond(0, y, z) = y,
cond( x + 1, y, z) = z.
One can use this to justify definitions of primitive recursive functions by cases
from primitive recursive relations:
Proposition 15.18. If g0 (⃗x ), . . . , gm (⃗x ) are primitive recursive functions, and R0 (⃗x ),
. . . , Rm−1 (⃗x ) are primitive recursive relations, then the function f defined by
g0 (⃗x ) if R0 (⃗x )
g1 (⃗x ) if R1 (⃗x ) and not R0 (⃗x )
.
f (⃗x ) = ..
gm−1 (⃗x ) if Rm−1 (⃗x ) and none of the previous hold
gm (⃗x ) otherwise
For m greater than 1, one can just compose definitions of this form.
236
15.10. Primes
Proof. Note than there can be no z < 0 such that R(⃗x, z) since there is no z < 0
at all. So m R (⃗x, 0) = 0.
In case the bound is of the form y + 1 we have three cases:
1. There is a z < y such that R(⃗x, z), in which case m R (⃗x, y + 1) = m R (⃗x, y).
2. There is no such z < y but R(⃗x, y) holds, then m R (⃗x, y + 1) = y.
3. There is no z < y + 1 such that R(⃗x, z), then m R (⃗z, y + 1) = y + 1.
So we can define m R (⃗x, 0) by primitive recursion as follows:
m R (⃗x, 0) = 0
m R (⃗x, y)
if m R (⃗x, y) ̸= y
m R (⃗x, y + 1) = y if m R (⃗x, y) = y and R(⃗x, y)
y+1 otherwise.
15.10 Primes
Bounded quantification and bounded minimization provide us with a good
deal of machinery to show that natural functions and relations are primitive
recursive. For example, consider the relation “x divides y”, written x | y. The
relation x | y holds if division of y by x is possible without remainder, i.e.,
if y is an integer multiple of x. (If it doesn’t hold, i.e., the remainder when
dividing x by y is > 0, we write x ∤ y.) In other words, x | y iff for some z,
x · z = y. Obviously, any such z, if it exists, must be ≤ y. So, we have that
x | y iff for some z ≤ y, x · z = y. We can define the relation x | y by bounded
existential quantification from = and multiplication by
x | y ⇔ (∃z ≤ y) ( x · z) = y.
237
15. R ECURSIVE F UNCTIONS
p (0) = 2
p( x + 1) = nextPrime( p( x ))
Since nextPrime( x ) is the least y such that y > x and y is prime, it can be
easily computed by unbounded search. But it can also be defined by bounded
minimization, thanks to a result due to Euclid: there is always a prime number
between x and x ! + 1.
This shows, that nextPrime( x ) and hence p( x ) are (not just computable but)
primitive recursive.
(If you’re curious, here’s a quick proof of Euclid’s theorem. Suppose pn
is the largest prime ≤ x and consider the product p = p0 · p1 · · · · · pn of all
primes ≤ x. Either p + 1 is prime or there is a prime between x and p + 1.
Why? Suppose p + 1 is not prime. Then some prime number q | p + 1 where
q < p + 1. None of the primes ≤ x divide p + 1. (By definition of p, each
of the primes pi ≤ x divides p, i.e., with remainder 0. So, each of the primes
pi ≤ x divides p + 1 with remainder 1, and so pi ∤ p + 1.) Hence, q is a prime
> x and < p + 1. And p ≤ x !, so there is a prime > x and ≤ x ! + 1.)
15.11 Sequences
The set of primitive recursive functions is remarkably robust. But we will be
able to do even more once we have developed a adequate means of handling
sequences. We will identify finite sequences of natural numbers with natural
numbers in the following way: the sequence ⟨ a0 , a1 , a2 , . . . , ak ⟩ corresponds to
the number
a +1 a +1 a +1
p00 · p11 · p2a2 +1 · · · · · pkk .
We add one to the exponents to guarantee that, for example, the sequences
⟨2, 7, 3⟩ and ⟨2, 7, 3, 0, 0⟩ have distinct numeric codes. We can take both 0 and 1
to code the empty sequence; for concreteness, let Λ denote 0.
The reason that this coding of sequences works is the so-called Fundamen-
tal Theorem of Arithmetic: every natural number n ≥ 2 can be written in one
and only one way in the form
a a a
n = p00 · p11 · · · · · pkk
238
15.11. Sequences
Proposition 15.20. The function len(s), which returns the length of the sequence s,
is primitive recursive.
We can use bounded minimization, since there is only one i that satisfies R(s, i )
when s is a code of a sequence, and if i exists it is less than s itself.
Proposition 15.21. The function append(s, a), which returns the result of append-
ing a to the sequence s, is primitive recursive.
Proposition 15.22. The function element(s, i ), which returns the ith element of s
(where the initial element is called the 0th), or 0 if i is greater than or equal to the
length of s, is primitive recursive.
Proof. Note that a is the ith element of s iff pia+1 is the largest power of pi that
divides s, i.e., pia+1 | s but pia+2 ∤ s. So:
(
0 if i ≥ len(s)
element(s, i ) =
(min a < s) ( pia+2 ∤ s) otherwise.
239
15. R ECURSIVE F UNCTIONS
Instead of using the official names for the functions defined above, we
introduce a more compact notation. We will use (s)i instead of element(s, i ),
and ⟨s0 , . . . , sk ⟩ to abbreviate
append(append(. . . append(Λ, s0 ) . . . ), sk ).
Proposition 15.23. The function concat(s, t), which concatenates two sequences, is
primitive recursive.
concat(⟨ a0 , . . . , ak ⟩, ⟨b0 , . . . , bl ⟩) = ⟨ a0 , . . . , ak , b0 , . . . , bl ⟩.
hconcat(s, t, 0) = s
hconcat(s, t, n + 1) = append(hconcat(s, t, n), (t)n )
then the numeric code of the sequence s described above is at most sequenceBound( x, k).
Having such a bound on sequences gives us a way of defining new func-
tions using bounded search. For example, we can define concat using bounded
search. All we need to do is write down a primitive recursive specification of
the object (number of the concatenated sequence) we are looking for, and a
bound on how far to look. The following works:
240
15.12. Trees
Proof. Exercise.
15.12 Trees
Sometimes it is useful to represent trees as natural numbers, just like we can
represent sequences by numbers and properties of and operations on them by
primitive recursive relations and functions on their codes. We’ll use sequences
and their codes to do this. A tree can be either a single node (possibly with a
label) or else a node (possibly with a label) connected to a number of subtrees.
The node is called the root of the tree, and the subtrees it is connected to its
immediate subtrees.
We code trees recursively as a sequence ⟨k, d1 , . . . , dk ⟩, where k is the num-
ber of immediate subtrees and d1 , . . . , dk the codes of the immediate subtrees.
If the nodes have labels, they can be included after the immediate subtrees. So
a tree consisting just of a single node with label l would be coded by ⟨0, l ⟩, and
a tree consisting of a root (labelled l1 ) connected to two single nodes (labelled
l2 , l3 ) would be coded by ⟨2, ⟨0, l2 ⟩, ⟨0, l3 ⟩, l1 ⟩.
Proposition 15.25. The function SubtreeSeq(t), which returns the code of a se-
quence the elements of which are the codes of all subtrees of the tree with code t, is
primitive recursive.
g(s, 0) = f ((s)0 )
g(s, k + 1) = g(s, k) ⌢ f ((s)k+1 )
For instance, if s is a sequence of trees, then h(s) = gISubtrees (s, len(s)) gives
the sequence of the immediate subtrees of the elements of s. We can use it to
define hSubtreeSeq by
hSubtreeSeq(t, 0) = ⟨t⟩
hSubtreeSeq(t, n + 1) = hSubtreeSeq(t, n) ⌢ h(hSubtreeSeq(t, n)).
241
15. R ECURSIVE F UNCTIONS
The maximum level of subtrees in a tree coded by t, i.e., the maximum dis-
tance between the root and a leaf node, is bounded by the code t. So a se-
quence of codes of all subtrees of the tree coded by t is given by hSubtreeSeq(t, t).
h0 (⃗x, 0) = f 0 (⃗x )
h1 (⃗x, 0) = f 1 (⃗x )
h0 (⃗x, y + 1) = g0 (⃗x, y, h0 (⃗x, y), h1 (⃗x, y))
h1 (⃗x, y + 1) = g1 (⃗x, y, h0 (⃗x, y), h1 (⃗x, y))
h(⃗x, 0) = f (⃗x )
h(⃗x, y + 1) = g(⃗x, y, ⟨h(⃗x, 0), . . . , h(⃗x, y)⟩).
with the understanding that the last argument to g is just the empty sequence
when y is 0. In either formulation, the idea is that in computing the “successor
step,” the function h can make use of the entire sequence of values computed
so far. This is known as a course-of-values recursion. For a particular example,
it can be used to justify the following type of definition:
(
g(⃗x, y, h(⃗x, k(⃗x, y))) if k (⃗x, y) < y
h(⃗x, y) =
f (⃗x ) otherwise
h(⃗x, 0) = f (⃗x )
h(⃗x, y + 1) = g(⃗x, y, h(k (⃗x ), y))
242
15.14. Non-Primitive Recursive Functions
h( x ) = g( x, x ) + 1
= f x ( x ) + 1.
g0 ( x )= x+1
gn+1 ( x ) = gnx ( x )
You can confirm that each function gn is primitive recursive. Each successive
function grows much faster than the one before; g1 ( x ) is equal to 2x, g2 ( x ) is
equal to 2x · x, and g3 ( x ) grows roughly like an exponential stack of x 2’s. The
Ackermann–Péter function is essentially the function G ( x ) = gx ( x ), and one
can show that this grows faster than any primitive recursive function.
Let us return to the issue of enumerating the primitive recursive functions.
Remember that we have assigned symbolic notations to each primitive recur-
sive function; so it suffices to enumerate notations. We can assign a natural
number #( F ) to each notation F, recursively, as follows:
#(0) = ⟨0⟩
#( S ) = ⟨1⟩
#( Pin ) = ⟨2, n, i ⟩
#(Compk,l [ H, G0 , . . . , Gk−1 ]) = ⟨3, k, l, #( H ), #( G0 ), . . . , #( Gk−1 )⟩
#(Recl [ G, H ]) = ⟨4, l, #( G ), #( H )⟩
Here we are using the fact that every sequence of numbers can be viewed as
a natural number, using the codes from the last section. The upshot is that
every code is assigned a natural number. Of course, some sequences (and
hence some numbers) do not correspond to notations; but we can let f i be the
unary primitive recursive function with notation coded as i, if i codes such a
243
15. R ECURSIVE F UNCTIONS
notation; and the constant 0 function otherwise. The net result is that we have
an explicit way of enumerating the unary primitive recursive functions.
(In fact, some functions, like the constant zero function, will appear more
than once on the list. This is not just an artifact of our coding, but also a result
of the fact that the constant zero function has more than one notation. We will
later see that one can not computably avoid these repetitions; for example,
there is no computable function that decides whether or not a given notation
represents the constant zero function.)
We can now take the function g( x, y) to be given by f x (y), where f x refers
to the enumeration we have just described. How do we know that g( x, y) is
computable? Intuitively, this is clear: to compute g( x, y), first “unpack” x, and
see if it is a notation for a unary function. If it is, compute the value of that
function on input y.
You may already be convinced that (with some work!) one can write
a program (say, in Java or C++) that does this; and now we can appeal to
the Church–Turing thesis, which says that anything that, intuitively, is com-
putable can be computed by a Turing machine.
Of course, a more direct way to show that g( x, y) is computable is to de-
scribe a Turing machine that computes it, explicitly. This would, in particular,
avoid the Church–Turing thesis and appeals to intuition. Soon we will have
built up enough machinery to show that g( x, y) is computable, appealing to a
model of computation that can be simulated on a Turing machine: namely, the
recursive functions.
244
15.15. Partial Recursive Functions
2. Add something to the definition, so that some new partial functions are
included.
The first is easy. As before, we will start with zero, successor, and projec-
tions, and close under composition and primitive recursion. The only differ-
ence is that we have to modify the definitions of composition and primitive
recursion to allow for the possibility that some of the terms in the definition
are not defined. If f and g are partial functions, we will write f ( x ) ↓ to mean
that f is defined at x, i.e., x is in the domain of f ; and f ( x ) ↑ to mean the
opposite, i.e., that f is not defined at x. We will use f ( x ) ≃ g( x ) to mean that
either f ( x ) and g( x ) are both undefined, or they are both defined and equal.
We will use these notations for more complicated terms as well. We will adopt
the convention that if h and g0 , . . . , gk all are partial functions, then
h( g0 (⃗x ), . . . , gk (⃗x ))
the least x such that f (0, ⃗z), f (1, ⃗z), . . . , f ( x, ⃗z) are all defined, and
f ( x, ⃗z) = 0, if such an x exists
245
15. R ECURSIVE F UNCTIONS
Definition 15.26. The set of partial recursive functions is the smallest set of par-
tial functions from the natural numbers to the natural numbers (of various
arities) containing zero, successor, and projections, and closed under compo-
sition, primitive recursion, and unbounded search.
Definition 15.27. The set of recursive functions is the set of partial recursive
functions that are total.
for every x.
The proof of the normal form theorem is involved, but the basic idea is
simple. Every partial recursive function has an index e, intuitively, a number
coding its program or definition. If f ( x ) ↓, the computation can be recorded
systematically and coded by some number s, and the fact that s codes the
computation of f on input x can be checked primitive recursively using only
x and the definition e. Consequently, the relation T, “the function with index e
has a computation for input x, and s codes this computation,” is primitive
recursive. Given the full record of the computation s, the “upshot” of s is the
value of f ( x ), and it can be obtained from s primitive recursively as well.
The normal form theorem shows that only a single unbounded search is
required for the definition of any partial recursive function. Basically, we can
search through all numbers until we find one that codes a computation of
the function with index e for input x. We can use the numbers e as “names”
of partial recursive functions, and write φe for the function f defined by the
equation in the theorem. Note that any partial recursive function can have
more than one index—in fact, every partial recursive function has infinitely
many indices.
246
15.17. The Halting Problem
is not computable.
In the context of partial recursive functions, the role of the specification
of a program may be played by the index e given in Kleene’s normal form
theorem. If f is a partial recursive function, any e for which the equation in
the normal form theorem holds, is an index of f . Given a number e, the normal
form theorem states that
Note that h(e, x ) = 0 if φe ( x ) ↑, but also when e is not the index of a partial
recursive function at all.
247
15. R ECURSIVE F UNCTIONS
1. If h(ed , ed ) = 1 then φed (ed ) ↓. But φed ≃ d, and d(ed ) is defined iff
h(ed , ed ) = 0. So h(ed , ed ) ̸= 1.
The upshot is that ed cannot, after all, be the index of a partial recursive func-
tion. But if h were partial recursive, d would be too, and so our definition of
ed as an index of it would be admissible. We must conclude that h cannot be
partial recursive.
Definition 15.30. The set of general recursive functions is the smallest set of
functions from the natural numbers to the natural numbers (of various ari-
ties) containing zero, successor, and projections, and closed under composi-
tion, primitive recursion, and unbounded search applied to regular functions.
248
Chapter 16
Arithmetization of Syntax
16.1 Introduction
In order to connect computability and logic, we need a way to talk about the
objects of logic (symbols, terms, formulae, derivations), operations on them,
and their properties and relations, in a way amenable to computational treat-
ment. We can do this directly, by considering computable functions and re-
lations on symbols, sequences of symbols, and other objects built from them.
Since the objects of logical syntax are all finite and built from a countable sets
of symbols, this is possible for some models of computation. But other models
of computation—such as the recursive functions—-are restricted to numbers,
their relations and functions. Moreover, ultimately we also want to be able to
deal with syntax within certain theories, specifically, in theories formulated in
the language of arithmetic. In these cases it is necessary to arithmetize syntax,
i.e., to represent syntactic objects, operations on them, and their relations, as
numbers, arithmetical functions, and arithmetical relations, respectively. The
idea, which goes back to Leibniz, is to assign numbers to syntactic objects.
It is relatively straightforward to assign numbers to symbols as their “codes.”
Some symbols pose a bit of a challenge, since, e.g., there are infinitely many
variables, and even infinitely many function symbols of each arity n. But of
course it’s possible to assign numbers to symbols systematically in such a way
that, say, v2 and v3 are assigned different codes. Sequences of symbols (such
as terms and formulae) are a bigger challenge. But if we can deal with se-
quences of numbers purely arithmetically (e.g., by the powers-of-primes cod-
ing of sequences), we can extend the coding of individual symbols to coding
of sequences of symbols, and then further to sequences or other arrangements
of formulae, such as derivations. This extended coding is called “Gödel num-
bering.” Every term, formula, and derivation is assigned a Gödel number.
By coding sequences of symbols as sequences of their codes, and by chos-
ing a system of coding sequences that can be dealt with using computable
functions, we can then also deal with Gödel numbers using computable func-
249
16. A RITHMETIZATION OF S YNTAX
tions. In practice, all the relevant functions will be primitive recursive. For
instance, computing the length of a sequence and computing the i-th element
of a sequence from the code of the sequence are both primitive recursive. If
the number coding the sequence is, e.g., the Gödel number of a formula φ,
we immediately see that the length of a formula and the (code of the) i-th
symbol in a formula can also be computed from the Gödel number of φ. It
is a bit harder to prove that, e.g., the property of being the Gödel number of
a correctly formed term or of a correct derivation is primitive recursive. It
is nevertheless possible, because the sequences of interest (terms, formulae,
derivations) are inductively defined.
As an example, consider the operation of substitution. If φ is a formula,
x a variable, and t a term, then φ[t/x ] is the result of replacing every free
occurrence of x in φ by t. Now suppose we have assigned Gödel numbers to φ,
x, t—say, k, l, and m, respectively. The same scheme assigns a Gödel number
to φ[t/x ], say, n. This mapping—of k, l, and m to n—is the arithmetical analog
of the substitution operation. When the substitution operation maps φ, x, t to
φ[t/x ], the arithmetized substitution functions maps the Gödel numbers k, l,
m to the Gödel number n. We will see that this function is primitive recursive.
Arithmetization of syntax is not just of abstract interest, although it was
originally a non-trivial insight that languages like the language of arithmetic,
which do not come with mechanisms for “talking about” languages can, after
all, formalize complex properties of expressions. It is then just a small step to
ask what a theory in this language, such as Peano arithmetic, can prove about
its own language (including, e.g., whether sentences are provable or true).
This leads us to the famous limitative theorems of Gödel (about unprovability)
and Tarski (the undefinability of truth). But the trick of arithmetizing syntax
is also important in order to prove some important results in computability
theory, e.g., about the computational power of theories or the relationship be-
tween different models of computability. The arithmetization of syntax serves
as a model for arithmetizing other objects and properties. For instance, it is
similarly possible to arithmetize configurations and computations (say, of Tur-
ing machines). This makes it possible to simulate computations in one model
(e.g., Turing machines) in another (e.g., recursive functions).
⊥ ∼ ∨ & ⊃ ∀ ∃ = ( ) ,
together with countable sets of variables and constant symbols, and countable
sets of function symbols and predicate symbols of arbitrary arity. We can as-
sign codes to each of these symbols in such a way that every symbol is assigned
a unique number as its code, and no two different symbols are assigned the
250
16.2. Coding Symbols
same number. We know that this is possible since the set of all symbols is
countable and so there is a bijection between it and the set of natural num-
bers. But we want to make sure that we can recover the symbol (as well as
some information about it, e.g., the arity of a function symbol) from its code
in a computable way. There are many possible ways of doing this, of course.
Here is one such way, which uses primitive recursive functions. (Recall that
⟨n0 , . . . , nk ⟩ is the number coding the sequence of numbers n0 , . . . , nk .)
⊥ ∼ ∨ & ⊃ ∀
⟨0, 0⟩ ⟨0, 1⟩ ⟨0, 2⟩ ⟨0, 3⟩ ⟨0, 4⟩ ⟨0, 5⟩
∃ = ( ) ,
⟨0, 6⟩ ⟨0, 7⟩ ⟨0, 8⟩ ⟨0, 9⟩ ⟨0, 10⟩
1. Fn( x, n) iff x is the code of fin for some i, i.e., x is the code of an n-ary function
symbol.
2. Pred( x, n) iff x is the code of Pin for some i or x is the code of = and n = 2,
i.e., x is the code of an n-ary predicate symbol.
Note that codes and Gödel numbers are different things. For instance, the
variable v5 has a code cv5 = ⟨1, 5⟩ = 22 · 36 . But the variable v5 considered as
a term is also a sequence of symbols (of length 1). The Gödel number # v5 # of the
2 6
term v5 is ⟨cv5 ⟩ = 2cv5 +1 = 22 ·3 +1 .
251
16. A RITHMETIZATION OF S YNTAX
where pi is the i-th prime (starting with p0 = 2). So for instance, the formula
v0 = 0, or, more explicitly, =(v0 , c0 ), has the Gödel number
Here, c= is ⟨0, 7⟩ = 20+1 · 37+1 , cv0 is ⟨1, 0⟩ = 21+1 · 30+1 , etc. So # = (v0 , c0 )# is
Proposition 16.5. The relations Term( x ) and ClTerm( x ) which hold iff x is the
Gödel number of a term or a closed term, respectively, are primitive recursive.
1. si is a variable v j , or
2. si is a constant symbol c j , or
252
16.4. Coding Formulae
2. Const((y)i ), or
(y)i = # f jn (# ⌢ flatten(z) ⌢ # )# ,
num(0) = # 0#
num(n + 1) = # ′(# ⌢ num(n) ⌢ # )# .
Proof. The number x is the Gödel number of an atomic formula iff one of the
following holds:
253
16. A RITHMETIZATION OF S YNTAX
1. There are n, j < x, and z < x such that for each i < n, Term((z)i ) and
x=
# n #
P j ( ⌢ flatten(z) ⌢ # )# .
3. x = # ⊥# .
Proposition 16.8. The relation Frm( x ) which holds iff x is the Gödel number of
a formula is primitive recursive.
Proposition 16.9. The relation FreeOcc( x, z, i ), which holds iff the i-th symbol of
the formula with Gödel number x is a free occurrence of the variable with Gödel num-
ber z, is primitive recursive.
Proof. Exercise.
Proposition 16.10. The property Sent( x ) which holds iff x is the Gödel number of
a sentence is primitive recursive.
16.5 Substitution
Recall that substitution is the operation of replacing all free occurrences of
a variable u in a formula φ by a term t, written φ[t/u]. This operation, when
carried out on Gödel numbers of variables, formulae, and terms, is primitive
recursive.
254
16.6. Derivations in Natural Deduction
hSubst( x, y, z, 0) = Λ
hSubst( x, y, z, i + 1) =
(
hSubst( x, y, z, i ) ⌢ y if FreeOcc( x, z, i )
append(hSubst( x, y, z, i ), ( x )i ) otherwise.
Proposition 16.12. The relation FreeFor( x, y, z), which holds iff the term with Gödel
number y is free for the variable with Gödel number z in the formula with Gödel num-
ber x, is primitive recursive.
Proof. Exercise.
⟨1, # δ1 # , # φ# , n, k⟩,
⟨2, # δ1 # , # δ2 # , # φ# , n, k⟩, or
⟨3, # δ1 # , # δ2 # , # δ3 # , # φ# , n, k⟩,
255
16. A RITHMETIZATION OF S YNTAX
[ φ & ψ ]1
φ &Elim
1 ⊃Intro
( φ & ψ) ⊃ φ
The Gödel number of the assumption would be d0 = ⟨0, # φ & ψ# , 1⟩. The
Gödel number of the derivation ending in the conclusion of &Elim would
be d1 = ⟨1, d0 , # φ# , 0, 2⟩ (1 since &Elim has one premise, the Gödel num-
ber of conclusion φ, 0 because no assumption is discharged, and 2 is the
number coding &Elim). The Gödel number of the entire derivation then is
⟨1, d1 , # (( φ & ψ) ⊃ φ)# , 1, 5⟩, i.e.,
⟨1, ⟨1, ⟨0, # ( φ & ψ)# , 1⟩, # φ# , 0, 2⟩, # (( φ & ψ) ⊃ φ)# , 1, 5⟩.
2. All assumptions in δ with label n are of the form φ (i.e., we can discharge the
assumption φ using label n in δ).
Proof. We have to show that the corresponding relations between Gödel num-
bers of formulae and Gödel numbers of derivations are primitive recursive.
256
16.6. Derivations in Natural Deduction
1. We want to show that Assum( x, d, n), which holds if x is the Gödel num-
ber of an assumption of the derivation with Gödel number d labelled n,
is primitive recursive. This is the case if the derivation with Gödel num-
ber ⟨0, x, n⟩ is a sub-derivation of d. Note that the way we code deriva-
tions is a special case of the coding of trees introduced in section 15.12,
so the primitive recursive function SubtreeSeq(d) gives a sequence of
Gödel numbers of all sub-derivations of d (of length a most d). So we
can define
Assum( x, d, n) ⇔ (∃i < d) (SubtreeSeq(d))i = ⟨0, x, n⟩.
Proposition 16.16. The property Correct(d) which holds iff the last inference in the
derivation δ with Gödel number d is correct, is primitive recursive.
Proof. Here we have to show that for each rule of inference R the relation
FollowsByR (d) is primitive recursive, where FollowsByR (d) holds iff d is the
Gödel number of derivation δ, and the end-formula of δ follows by a correct
application of R from the immediate sub-derivations of δ.
A simple case is that of the &Intro rule. If δ ends in a correct &Intro infer-
ence, it looks like this:
δ1 δ2
φ ψ
&Intro
φ&ψ
Then the Gödel number d of δ is ⟨2, d1 , d2 , # ( φ & ψ)# , 0, k⟩ where EndFmla(d1 ) =
# #
φ , EndFmla(d2 ) = # ψ# , n = 0, and k = 1. So we can define FollowsBy&Intro (d)
as
257
16. A RITHMETIZATION OF S YNTAX
For a more complicated example, FollowsBy⊃Intro (d) holds iff the end-
formula of δ is of the form ( φ ⊃ ψ), where the end-formula of δ1 is ψ, and
any assumption in δ labelled n is of the form φ. We can express this primitive
recursively by
( d )0 = 1 &
(∃ a < d) (Discharge( a, (d)1 , DischargeLabel(d)) &
EndFmla(d) = (# (# ⌢ a ⌢ # ⊃# ⌢ EndFmla((d)1 ) ⌢ # )# ))
Sent(EndFmla(d)) &
(LastRule(d) = 1 & FollowsBy&Intro (d)) ∨ · · · ∨
(LastRule(d) = 16 & FollowsBy=Elim (d)) ∨
(∃n < d) (∃ x < d) (d = ⟨0, x, n⟩).
The first line ensures that the end-formula of d is a sentence. The last line
covers the case where d is just an assumption.
Proposition 16.17. The relation Deriv(d) which holds if d is the Gödel number of a
correct derivation δ, is primitive recursive.
Proposition 16.18. The relation OpenAssum(z, d) that holds if z is the Gödel num-
ber of an undischarged assumption φ of the derivation δ with Gödel number d, is
primitive recursive.
258
16.6. Derivations in Natural Deduction
259
Chapter 17
Representability in Q
17.1 Introduction
The incompleteness theorems apply to theories in which basic facts about
computable functions can be expressed and proved. We will describe a very
minimal such theory called “Q” (or, sometimes, “Robinson’s Q,” after Raphael
Robinson). We will say what it means for a function to be representable in Q,
and then we will prove the following:
A function is representable in Q if and only if it is computable.
For one thing, this provides us with another model of computability. But we
will also use it to show that the set { φ | Q ⊢ φ} is not decidable, by reducing
the halting problem to it. By the time we are done, we will have proved much
stronger things than this.
The language of Q is the language of arithmetic; Q consists of the fol-
lowing axioms (to be used in conjunction with the other axioms and rules of
first-order logic with identity predicate):
∀ x ∀y ( x ′ = y′ ⊃ x = y) (Q1 )
∀ x 0 ̸= x′ (Q2 )
∀ x ( x = 0 ∨ ∃y x = y′ ) (Q3 )
∀ x ( x + 0) = x (Q4 )
∀ x ∀y ( x + y′ ) = ( x + y)′ (Q5 )
∀ x ( x × 0) = 0 (Q6 )
∀ x ∀y ( x × y′ ) = (( x × y) + x ) (Q7 )
∀ x ∀y ( x < y ≡ ∃z (z′ + x ) = y) (Q8 )
For each natural number n, define the numeral n to be the term 0′′...′ where
there are n tick marks in all. So, 0 is the constant symbol 0 by itself, 1 is 0′ , 2 is
0′′ , etc.
261
17. R EPRESENTABILITY IN Q
Using instances of the induction schema, one can prove much more from the
axioms of PA than from those of Q. In fact, it takes a good deal of work to
find “natural” statements about the natural numbers that can’t be proved in
Peano arithmetic!
1. φ f (n0 , . . . , nk , m)
2. ∀y ( φ f (n0 , . . . , nk , y) ⊃ m = y).
There are other ways of stating the definition; for example, we could equiv-
alently require that Q proves ∀y ( φ f (n0 , . . . , nk , y) ≡ y = m).
There are two directions to proving the theorem. The left-to-right direction
is fairly straightforward once arithmetization of syntax is in place. The other
direction requires more work. Here is the basic idea: we pick “general recur-
sive” as a way of making “computable” precise, and show that every general
recursive function is representable in Q. Recall that a function is general re-
cursive if it can be defined from zero, the successor function succ, and the
projection functions Pin , using composition, primitive recursion, and regular
minimization. So one way of showing that every general recursive function is
representable in Q is to show that the basic functions are representable, and
whenever some functions are representable, then so are the functions defined
from them using composition, primitive recursion, and regular minimization.
262
17.2. Functions Representable in Q are Computable
In other words, we might show that the basic functions are representable, and
that the representable functions are “closed under” composition, primitive
recursion, and regular minimization. This guarantees that every general re-
cursive function is representable.
It turns out that the step where we would show that representable func-
tions are closed under primitive recursion is hard. In order to avoid this step,
we show first that in fact we can do without primitive recursion. That is, we
show that every general recursive function can be defined from basic func-
tions using composition and regular minimization alone. To do this, we show
that primitive recursion can actually be done by a specific regular minimiza-
tion. However, for this to work, we have to add some additional basic func-
tions: addition, multiplication, and the characteristic function of the identity
relation χ= . Then, we can prove the theorem by showing that all of these basic
functions are representable in Q, and the representable functions are closed
under composition and regular minimization.
Proof. The “if” part is Definition 17.1(1). The “only if” part is seen as follows:
Suppose Q ⊢ φ f (n0 , . . . , nk , m) but m ̸= f (n0 , . . . , nk ). Let l = f (n0 , . . . , nk ).
By Definition 17.1(1), Q ⊢ φ f (n0 , . . . , nk , l ). By Definition 17.1(2), ∀y ( φ f (n0 , . . . , nk , y) ⊃
l = y). Using logic and the assumption that Q ⊢ φ f (n0 , . . . , nk , m), we get that
Q ⊢ l = m. On the other hand, by Lemma 17.14, Q ⊢ l ̸= m. So Q is incon-
sistent. But that is impossible, since Q is satisfied by the standard model (see
Definition 14.2), N ⊨ Q, and satisfiable theories are always consistent by the
Soundness Theorem (Corollary 9.29).
Proof. Let’s first give the intuitive idea for why this is true. To compute f , we
do the following. List all the possible derivations δ in the language of arith-
metic. This is possible to do mechanically. For each one, check if it is a deriva-
tion of a formula of the form φ f (n0 , . . . , nk , m) (the formula representing f in Q
from Lemma 17.3). If it is, m = f (n0 , . . . , nk ) by Lemma 17.3, and we’ve found
the value of f . The search terminates because Q ⊢ φ f (n0 , . . . , nk , f (n0 , . . . , nk )),
so eventually we find a δ of the right sort.
263
17. R EPRESENTABILITY IN Q
A ( n0 , . . . , n k , m ) =
Subst(Subst(. . . Subst(# φ f # , num(n0 ), # x0 # ),
. . . ), num(nk ), # xk # ), num(m), # y# )
This looks complicated, but it’s just the function A(n0 , . . . , nk , m) = # φ f (n0 , . . . , nk , m)# .
Now, consider the relation R(n0 , . . . , nk , s) which holds if (s)0 is the Gödel
number of a derivation from Q of φ f (n0 , . . . , nk , (s)1 ):
R ( n0 , . . . , n k , s ) iff PrfQ ((s)0 , A(n0 , . . . , nk , (s)1 ))
If we can find an s such that R(n0 , . . . , nk , s) hold, we have found a pair of
numbers—(s)0 and (s1 )—such that (s)0 is the Gödel number of a derivation
of A f (n0 , . . . , nk , (s)1 ). So looking for s is like looking for the pair d and m
in the informal proof. And a computable function that “looks for” such an
s can be defined by regular minimization. Note that R is regular: for ev-
ery n0 , . . . , nk , there is a derivation δ of Q ⊢ φ f (n0 , . . . , nk , f (n0 , . . . , nk )), so
R(n0 , . . . , nk , s) holds for s = ⟨# δ# , f (n0 , . . . , nk )⟩. So, we can write f as
f (n0 , . . . , nk ) = (µs R(n0 , . . . , nk , s))1 .
264
17.3. The Beta Function Lemma
Definition 17.6. Two natural numbers a and b are relatively prime iff their great-
est common divisor is 1; in other words, they have no other divisors in com-
mon.
z ≡ y0 mod x0
z ≡ y1 mod x1
..
.
z ≡ yn mod xn .
j = max(n, y0 , . . . , yn ) + 1,
265
17. R EPRESENTABILITY IN Q
and let
x0 = 1 + j !
x1 = 1 + 2 · j !
x2 = 1 + 3 · j !
..
.
x n = 1 + ( n + 1) · j !
To see that (1) is true, note that if p is a prime number and p | xi and p | xk ,
then p | 1 + (i + 1) j ! and p | 1 + (k + 1) j !. But then p divides their difference,
(1 + (i + 1) j !) − (1 + (k + 1) j !) = (i − k) j !.
not( x ) = χ= ( x, 0)
(min x ≤ z) R( x, y) = µx ( R( x, y) ∨ x = z)
(∃ x ≤ z) R( x, y) ⇔ R((min x ≤ z) R( x, y), y)
We can then show that all of the following are also definable without primitive
recursion:
266
17.4. Simulating Primitive Recursion
Now define
j = max(n, a0 , . . . , an ) + 1,
d0 ≡ a i mod (1 + (i + 1)d1 )
ai = rem(1 + (i + 1)d1 , d0 ).
β(d, i ) = β∗ (d0 , d1 , i )
= rem(1 + (i + 1)d1 , d0 )
= ai
which is what we need. This completes the proof of the β-function lemma.
h(⃗x, 0) = f (⃗x )
h(⃗x, y + 1) = g(⃗x, y, h(⃗x, y)).
We need to show that h can be defined from f and g using just composition
and regular minimization, using the basic functions and functions defined
from them using composition and regular minimization (such as β).
267
17. R EPRESENTABILITY IN Q
Lemma 17.9. If h can be defined from f and g using primitive recursion, it can be
defined from f , g, the functions zero, succ, Pin , add, mult, χ= , using composition
and regular minimization.
Proof. First, define an auxiliary function ĥ(⃗x, y) which returns the least num-
ber d such that d codes a sequence which satisfies
where now (d)i is short for β(d, i ). In other words, ĥ returns the sequence
⟨h(⃗x, 0), h(⃗x, 1), . . . , h(⃗x, y)⟩. We can write ĥ as
ĥ(⃗x, y) = µd ( β(d, 0) = f (⃗x ) & (∀i < y) β(d, i + 1) = g(⃗x, i, β(d, i )).
n + m = n + m and
∀y ((n + m) = y ⊃ y = n + m).
268
17.5. Basic Functions are Representable in Q
is represented in Q by
Note that the lemma does not say much: in essence it says that Q can
prove that different numerals denote different objects. For example, Q proves
0′′ ̸= 0′′′ . But showing that this holds in general requires some care. Note also
that although we are using induction, it is induction outside of Q.
Proof of Proposition 17.13. If n = m, then n and m are the same term, and
χ= (n, m) = 1. But Q ⊢ (n = m & 1 = 1), so it proves φ= (n, m, 1). If n ̸= m,
then χ= (n, m) = 0. By Lemma 17.14, Q ⊢ n ̸= m and so also (n ̸= m & 0 = 0).
Thus Q ⊢ φ= (n, m, 0).
For the second part, we also have two cases. If n = m, we have to show
that Q ⊢ ∀y ( φ= (n, m, y) ⊃ y = 1). Arguing informally, suppose φ= (n, m, y),
i.e.,
( n = n & y = 1) ∨ ( n ̸ = n & y = 0)
The left disjunct implies y = 1 by logic; the right contradicts n = n which is
provable by logic.
269
17. R EPRESENTABILITY IN Q
( n = m & y = 1) ∨ ( n ̸ = m & y = 0)
Lemma 17.16. Q ⊢ (n + m) = n + m
Q ⊢ (n + m) = n + m,
we can replace the left side with n + m and get n + m = y, for arbitrary y.
Proof. Exercise.
Lemma 17.18. Q ⊢ (n × m) = n · m
Proof. Exercise.
270
17.6. Composition is Representable in Q
Recall that we use × for the function symbol of the language of arith-
metic, and · for the ordinary multiplication operation on numbers. So · can
appear between expressions for numbers (such as in m · n) while × appears
only between terms of the language of arithmetic (such as in (m × n)). Even
more confusingly, + is used for both the function symbol and the addition
operation. When it appears between terms—e.g., in (n + m)—it is the 2-place
function symbol of the language of arithmetic, and when it appears between
numbers—e.g., in n + m—it is the addition operation. This includes the case
n + m: this is the standard numeral corresponding to the number n + m.
h( x0 , . . . , xl −1 ) = f ( g0 ( x0 , . . . , xl −1 ), . . . , gk−1 ( x0 , . . . , xl −1 )).
Q ⊢ φ g (n, k )
Q ⊢ φ f (k, m)
271
17. R EPRESENTABILITY IN Q
Q ⊢ ∀y ( φ g (n, y) ⊃ y = k )
Q ⊢ ∀z ( φ f (k, z) ⊃ z = m)
since φ f represents f . Using just a little bit of logic, we can show that also
The same idea works in the more complex case where f and gi have arity
greater than 1.
∃ y 0 . . . ∃ y k − 1 ( φ g0 ( x 0 , . . . , x l − 1 , y 0 ) & · · · &
!A gk−1 ( x0 , . . . , xl −1 , yk−1 ) & φ f (y0 , . . . , yk−1 , z))
represents
h( x0 , . . . , xl −1 ) = f ( g0 ( x0 , . . . , xl −1 ), . . . , gk−1 ( x0 , . . . , xl −1 )).
Proof. Exercise.
272
17.7. Regular Minimization is Representable in Q
Lemma 17.22. For every constant symbol a and every natural number n,
Q ⊢ ( a′ + n) = ( a + n)′ .
Q ⊢ ( a ′ + 0) = a ′ by axiom Q4 (17.1)
Q ⊢ ( a + 0) = a by axiom Q4 (17.2)
′ ′
Q ⊢ ( a + 0) = a by eq. (17.2) (17.3)
′ ′
Q ⊢ ( a + 0) = ( a + 0) by eq. (17.1) and eq. (17.3)
It is again worth mentioning that this is weaker than saying that Q proves
∀ x ∀y ( x ′ + y) = ( x + y)′ . Although this sentence is true in N, Q does not
prove it.
Proof. We give the proof informally (i.e., only giving hints as to how to con-
struct the formal derivation).
We have to prove ∼ a < 0 for an arbitrary a. By the definition of <, we
need to prove ∼∃y (y′ + a) = 0 in Q. We’ll assume ∃y (y′ + a) = 0 and prove a
contradiction. Suppose (b′ + a) = 0. Using Q3 , we have that a = 0 ∨ ∃y a = y′ .
We distinguish cases.
Case 1: a = 0 holds. From (b′ + a) = 0, we have (b′ + 0) = 0. By axiom Q4
of Q, we have (b′ + 0) = b′ , and hence b′ = 0. But by axiom Q2 we also have
b′ ̸= 0, a contradiction.
Case 2: For some c, a = c′ . But then we have (b′ + c′ ) = 0. By axiom Q5 ,
we have (b′ + c)′ = 0, again contradicting axiom Q2 .
Q ⊢ ∀ x ( x < n + 1 ⊃ ( x = 0 ∨ · · · ∨ x = n)).
273
17. R EPRESENTABILITY IN Q
m′ ≡ m + 1, (c′ + m + 1) = a. By Q8 , m + 1 < a.
274
17.8. Computable Functions are Representable in Q
Q ⊢ φ g (m, n, 0).
Q ⊢ ∼ φ g (k, n, 0).
We get that
Proof. For definiteness, and using the Church–Turing Thesis, let’s say that a
function is computable iff it is general recursive. The general recursive func-
tions are those which can be defined from the zero function zero, the successor
275
17. R EPRESENTABILITY IN Q
function succ, and the projection function Pin using composition, primitive re-
cursion, and regular minimization. By Lemma 17.9, any function h that can
be defined from f and g can also be defined using composition and regular
minimization from f , g, and zero, succ, Pin , add, mult, χ= . Consequently, a
function is general recursive iff it can be defined from zero, succ, Pin , add,
mult, χ= using composition and regular minimization.
We’ve furthermore shown that the basic functions in question are rep-
resentable in Q (Propositions 17.10 to 17.13, 17.15 and 17.17), and that any
function defined from representable functions by composition or regular min-
imization (Proposition 17.21, Proposition 17.26) is also representable. Thus
every general recursive function is representable in Q.
276
17.10. Undecidability
17.10 Undecidability
We call a theory T undecidable if there is no computational procedure which, af-
ter finitely many steps and unfailingly, provides a correct answer to the ques-
tion “does T prove φ?” for any sentence φ in the language of T. So Q would
be decidable iff there were a computational procedure which decides, given a
sentence φ in the language of arithmetic, whether Q ⊢ φ or not. We can make
this more precise by asking: Is the relation ProvQ (y), which holds of y iff y is
the Gödel number of a sentence provable in Q, recursive? The answer is: no.
Theorem 17.30. Q is undecidable, i.e., the relation
ProvQ (y) ⇔ Sent(y) & ∃ x PrfQ ( x, y)
is not recursive.
Proof. Suppose it were. Then we could solve the halting problem as follows:
Given e and n, we know that φe (n) ↓ iff there is an s such that T (e, n, s), where
T is Kleene’s predicate from Theorem 15.28. Since T is primitive recursive it
is representable in Q by a formula ψT , that is, Q ⊢ ψT (e, n, s) iff T (e, n, s). If
Q ⊢ ψT (e, n, s) then also Q ⊢ ∃y ψT (e, n, y). If no such s exists, then Q ⊢
∼ψT (e, n, s) for every s. But Q is ω-consistent, i.e., if Q ⊢ ∼ φ(n) for every n ∈
N, then Q ⊬ ∃y φ(y). We know this because the axioms of Q are true in the
standard model N. So, Q ⊬ ∃y ψT (e, n, y). In other words, Q ⊢ ∃y ψT (e, n, y)
iff there is an s such that T (e, n, s), i.e., iff φe (n) ↓. From e and n we can
compute # ∃y ψT (e, n, y)# , let g(e, n) be the primitive recursive function which
does that. So (
1 if ProvQ ( g(e, n))
h(e, n) =
0 otherwise.
This would show that h is recursive if ProvQ is. But h is not recursive, by
Theorem 15.29, so ProvQ cannot be either.
277
Chapter 18
18.1 Introduction
279
18. I NCOMPLETENESS AND P ROVABILITY
Lemma 18.1. Let T be any theory extending Q, and let ψ( x ) be any formula with
only the variable x free. Then there is a sentence φ such that T ⊢ φ ≡ ψ(⌜φ⌝).
The lemma asserts that given any property ψ( x ), there is a sentence φ that
asserts “ψ( x ) is true of me,” and T “knows” this.
How can we construct such a sentence? Consider the following version of
the Epimenides paradox, due to Quine:
But what happens when one takes the phrase “yields falsehood when pre-
ceded by its quotation,” and precedes it with a quoted version of itself? Then
one has the original sentence! In short, the sentence asserts that it is false.
280
18.2. The Fixed-Point Lemma
it can derive ψ(di ag (⌜ψ(di ag ( x ))⌝)) ≡ ψ(⌜φ⌝). But the left hand side is, by
definition, φ.
Of course, di ag will in general not be a function symbol of T, and cer-
tainly is not one of Q. But, since diag is computable, it is representable in Q
by some formula θdiag ( x, y). So instead of writing ψ(di ag ( x )) we can write
281
18. I NCOMPLETENESS AND P ROVABILITY
∃y (θdiag ( x, y) & ψ(y)). Otherwise, the proof sketched above goes through,
and in fact, it goes through already in Q.
Lemma 18.2. Let ψ( x ) be any formula with one free variable x. Then there is a
sentence φ such that Q ⊢ φ ≡ ψ(⌜φ⌝).
Proof. Given ψ( x ), let α( x ) be the formula ∃y (θdiag ( x, y) & ψ(y)) and let φ be
its diagonalization, i.e., the formula α(⌜α( x )⌝).
Since θdiag represents diag, and diag(# α( x )# ) = # φ# , Q can derive
Consider such a y. Since θdiag (⌜α( x )⌝, y), by eq. (18.2), y = ⌜φ⌝. So, from ψ(y)
we have ψ(⌜φ⌝).
Now suppose ψ(⌜φ⌝). By eq. (18.1), we have
It follows that
You should compare this to the proof of the fixed-point lemma in com-
putability theory. The difference is that here we want to define a statement in
terms of itself, whereas there we wanted to define a function in terms of itself;
this difference aside, it is really the same idea.
282
18.3. The First Incompleteness Theorem
and only if x is the Gödel number of a derivation of the formula with Gödel
number y in T. In fact, for the particular theory that Gödel had in mind, Gödel
was able to show that this relation is primitive recursive, using the list of 45
functions and relations in his paper. The 45th relation, xBy, is just PrfT ( x, y)
for his particular choice of T. Remember that where Gödel uses the word
“recursive” in his paper, we would now use the phrase “primitive recursive.”
Since PrfT ( x, y) is computable, it is representable in T. We will use Prf T ( x, y)
to refer to the formula that represents it. Let Prov T (y) be the formula ∃ x Prf T ( x, y).
This describes the 46th relation, Bew(y), on Gödel’s list. As Gödel notes, this
is the only relation that “cannot be asserted to be recursive.” What he proba-
bly meant is this: from the definition, it is not clear that it is computable; and
later developments, in fact, show that it isn’t.
Let T be an axiomatizable theory containing Q. Then PrfT ( x, y) is decid-
able, hence representable in Q by a formula Prf T ( x, y). Let Prov T (y) be the
formula we described above. By the fixed-point lemma, there is a formula γT
such that Q (and hence T) derives
Proof. Suppose T derives γT . Then there is a derivation, and so, for some
number m, the relation PrfT (m, # γT # ) holds. But then Q derives the sentence
Prf T (m, ⌜γT ⌝). So Q derives ∃ x Prf T ( x, ⌜γT ⌝), which is, by definition, Prov T (⌜γT ⌝).
By eq. (18.3), Q derives ∼γT , and since T extends Q, so does T. We have
shown that if T derives γT , then it also derives ∼γT , and hence it would be
inconsistent.
Note that every ω-consistent theory is also consistent. This follows simply
from the fact that if T is inconsistent, then T ⊢ φ for every φ. In particular, if T
is inconsistent, it derives both ∼ φ(n) for every n and also derives ∃ x φ( x ). So,
if T is inconsistent, it is ω-inconsistent. By contraposition, if T is ω-consistent,
it must be consistent.
283
18. I NCOMPLETENESS AND P ROVABILITY
no derivation of γT in T, Q derives
∼Prf T (0, ⌜γT ⌝), ∼Prf T (1, ⌜γT ⌝), ∼Prf T (2, ⌜γT ⌝), . . .
and so does T. On the other hand, by eq. (18.3), ∼γT is equivalent to ∃ x Prf T ( x, ⌜γT ⌝).
So T is ω-inconsistent.
Proof. Recall that Prov T (y) is defined as ∃ x Prf T ( x, y), where Prf T ( x, y) repre-
sents the decidable relation which holds iff x is the Gödel number of a deriva-
tion of the sentence with Gödel number y. The relation that holds between x
and y if x is the Gödel number of a refutation of the sentence with Gödel num-
ber y is also decidable. Let not( x ) be the primitive recursive function which
does the following: if x is the code of a formula φ, not( x ) is a code of ∼ φ.
Then RefT ( x, y) holds iff PrfT ( x, not(y)). Let Ref T ( x, y) represent it. Then, if
T ⊢ ∼ φ and δ is a corresponding derivation, Q ⊢ Ref T (⌜δ⌝, ⌜φ⌝). We define
RProv T (y) as
284
18.4. Rosser’s Theorem
but that’s just RProv T (⌜ρ T ⌝). By eq. (18.4), Q ⊢ ∼ρ T . Since T extends Q, also
T ⊢ ∼ρ T . We’ve assumed that T ⊢ ρ T , so T would be inconsistent, contrary to
the assumption of the theorem.
Now, let’s show that T ⊬ ∼ρ T . Again, suppose it did, and suppose n is
the Gödel number of a derivation of ∼ρ T . Then RefT (n, # ρ T # ) holds, and since
Ref T represents RefT in Q, Q ⊢ Ref T (n, ⌜ρ T ⌝). We’ll again show that T would
then be inconsistent because it would also derive ρ T . Since
is logically equivalent to
We argue informally using logic, making use of facts about what Q derives.
Suppose x is arbitrary and Prf T ( x, ⌜ρ T ⌝). We already know that T ⊬ ρ T , and
so for every k, Q ⊢ ∼Prf T (k, ⌜ρ T ⌝). Thus, for every k it follows that x ̸= k.
In particular, we have (a) that x ̸= n. We also have ∼( x = 0 ∨ x = 1 ∨
· · · ∨ x = n − 1) and so by Lemma 17.24, (b) ∼( x < n). By Lemma 17.25,
n < x. Since Q ⊢ Ref T (n, ⌜ρ T ⌝), we have n < x & Ref T (n, ⌜ρ T ⌝), and from that
∃z (z < x & Ref T (z, ⌜ρ T ⌝)). Since x was arbitrary we get, as required, that
285
18. I NCOMPLETENESS AND P ROVABILITY
for every formula φ. Notice that this is really a schema, which is to say, in-
finitely many axioms (and it turns out that PA is not finitely axiomatizable).
But since one can effectively determine whether or not a string of symbols is
an instance of an induction axiom, the set of axioms for PA is computable. PA
is a much more robust theory than Q. For example, one can easily prove that
addition and multiplication are commutative, using induction in the usual
way. In fact, most finitary number-theoretic and combinatorial arguments can
be carried out in PA.
Since PA is computably axiomatized, the derivability predicate PrfPA ( x, y)
is computable and hence represented in Q (and so, in PA). As before, we will
take Prf PA ( x, y) to denote the formula representing the relation. Let ProvPA (y)
be the formula ∃ x PrfPA ( x, y), which, intuitively says, “y is derivable from the
axioms of PA.” The reason we need a little bit more than the axioms of Q is
we need to know that the theory we are using is strong enough to derive a
few basic facts about this derivability predicate. In fact, what we need are the
following facts:
286
18.7. The Second Incompleteness Theorem
The only way to verify that these three properties hold is to describe the for-
mula ProvPA (y) carefully and use the axioms of PA to describe the relevant
formal derivations. Conditions (1) and (2) are easy; it is really condition (3)
that requires work. (Think about what kind of work it entails . . . ) Carrying
out the details would be tedious and uninteresting, so here we will ask you
to take it on faith that PA has the three properties listed above. A reasonable
choice of ProvPA (y) will also satisfy
287
18. I NCOMPLETENESS AND P ROVABILITY
To make the argument more precise, we will let γPA be the Gödel sentence
for PA and use the derivability conditions (P1)–(P3) to show that PA derives
ConPA ⊃ γPA . This will show that PA doesn’t derive ConPA . Here is a sketch
of the proof, in PA. (For simplicity, we drop the PA subscripts.)
!G ≡ ∼Prov(⌜γ⌝) (18.5)
γ is a Gödel sentence
!G ⊃ ∼Prov(⌜γ⌝) (18.6)
from eq. (18.5)
!G ⊃ (Prov(⌜γ⌝) ⊃ ⊥) (18.7)
from eq. (18.6) by logic
Prov(⌜γ ⊃ (Prov(⌜γ⌝) ⊃ ⊥)⌝) (18.8)
by from eq. (18.7) by condition P1
Prov(⌜γ⌝) ⊃ Prov(⌜(Prov(⌜γ⌝) ⊃ ⊥)⌝) (18.9)
from eq. (18.8) by condition P2
Prov(⌜γ⌝) ⊃ (Prov(⌜Prov(⌜γ⌝)⌝) ⊃ Prov(⌜⊥⌝)) (18.10)
from eq. (18.9) by condition P2 and logic
Prov(⌜γ⌝) ⊃ Prov(⌜Prov(⌜γ⌝)⌝) (18.11)
by P3
Prov(⌜γ⌝) ⊃ Prov(⌜⊥⌝) (18.12)
from eq. (18.10) and eq. (18.11) by logic
Con ⊃ ∼Prov(⌜γ⌝) (18.13)
contraposition of eq. (18.12) and Con ≡ ∼Prov(⌜⊥⌝)
Con ⊃ γ
from eq. (18.5) and eq. (18.13) by logic
The use of logic in the above just elementary facts from propositional logic,
e.g., eq. (18.7) uses ⊢ ∼ φ ≡ ( φ ⊃ ⊥) and eq. (18.12) uses φ ⊃ (ψ ⊃ χ), φ ⊃
ψ ⊢ φ ⊃ χ. The use of condition P2 in eq. (18.9) and eq. (18.10) relies on
instances of P2, Prov(⌜φ ⊃ ψ⌝) ⊃ (Prov(⌜φ⌝) ⊃ Prov(⌜ψ⌝)). In the first one,
φ ≡ γ and ψ ≡ Prov(⌜γ⌝) ⊃ ⊥; in the second, φ ≡ Prov(⌜G⌝) and ψ ≡ ⊥.
The more abstract version of the second incompleteness theorem is as fol-
lows:
Theorem 18.9. Let T be any consistent, axiomatized theory extending Q and let
Prov T (y) be any formula satisfying derivability conditions P1–P3 for T. Then T
does not derive ConT .
The moral of the story is that no “reasonable” consistent theory for math-
ematics can derive its own consistency statement. Suppose T is a theory of
288
18.8. Löb’s Theorem
T ⊢ Prov T (⌜δ⌝) ≡ δ.
If it were derivable, T ⊢ Prov T (⌜δ⌝) by condition (1), but the same conclusion
follows if we apply modus ponens to the equivalence above. Hence, we don’t
get that T is inconsistent, at least not by the same argument as in the case of
the Gödel sentence. This of course does not show that T does derive δ.
We can make headway on this question if we generalize it a bit. The left-to-
right direction of the fixed point equivalence, Prov T (⌜δ⌝) ⊃ δ, is an instance
of a general schema called a reflection principle: Prov T (⌜φ⌝) ⊃ φ. It is called
that because it expresses, in a sense, that T can “reflect” about what it can
derive; basically it says, “If T can derive φ, then φ is true,” for any φ. This is
true for sound theories only, of course, and this suggests that theories will in
general not derive every instance of it. So which instances can a theory (strong
enough, and satisfying the derivability conditions) derive? Certainly all those
where φ itself is derivable. And that’s it, as the next result shows.
Theorem 18.10. Let T be an axiomatizable theory extending Q, and suppose Prov T (y)
is a formula satisfying conditions P1–P3 from section 18.7. If T derives Prov T (⌜φ⌝) ⊃
φ, then in fact T derives φ.
289
18. I NCOMPLETENESS AND P ROVABILITY
The heuristic for the proof of Löb’s theorem is a clever proof that Santa
Claus exists. (If you don’t like that conclusion, you are free to substitute any
other conclusion you would like.) Here it is:
2. Suppose X is true.
3. Then what it says holds; i.e., we have: if X is true, then Santa Claus
exists.
4. Since we are assuming X is true, we can conclude that Santa Claus exists,
by modus ponens from (2) and (3).
5. We have succeeded in deriving (4), “Santa Claus exists,” from the as-
sumption (2), “X is true.” By conditional proof, we have shown: “If X is
true, then Santa Claus exists.”
A formalization of this idea, replacing “is true” with “is derivable,” and “Santa
Claus exists” with φ, yields the proof of Löb’s theorem. The trick is to apply
the fixed-point lemma to the formula Prov T (y) ⊃ φ. The fixed point of that
corresponds to the sentence X in the preceding sketch.
Proof of Theorem 18.10. Suppose φ is a sentence such that T derives Prov T (⌜φ⌝) ⊃
φ. Let ψ(y) be the formula Prov T (y) ⊃ φ, and use the fixed-point lemma to
find a sentence θ such that T derives θ ≡ ψ(⌜θ⌝). Then each of the following
290
18.8. Löb’s Theorem
is derivable in T:
!D ≡ (Prov T (⌜θ⌝) ⊃ φ) (18.14)
θ is a fixed point of ψ(y)
!D ⊃ (Prov T (⌜θ⌝) ⊃ φ) (18.15)
from eq. (18.14)
Prov T (⌜θ ⊃ (Prov T (⌜θ⌝) ⊃ φ)⌝) (18.16)
from eq. (18.15) by condition P1
Prov T (⌜θ⌝) ⊃ Prov T (⌜Prov T (⌜θ⌝) ⊃ φ⌝) (18.17)
from eq. (18.16) using condition P2
Prov T (⌜θ⌝) ⊃ (Prov T (⌜Prov T (⌜θ⌝)⌝) ⊃ Prov T (⌜φ⌝)) (18.18)
from eq. (18.17) using P2 again
Prov T (⌜θ⌝) ⊃ Prov T (⌜Prov T (⌜θ⌝)⌝) (18.19)
by derivability condition P3
Prov T (⌜θ⌝) ⊃ Prov T (⌜φ⌝) (18.20)
from eq. (18.18) and eq. (18.19)
Prov T (⌜φ⌝) ⊃ φ (18.21)
by assumption of the theorem
Prov T (⌜θ⌝) ⊃ φ (18.22)
from eq. (18.20) and eq. (18.21)
(Prov T (⌜θ⌝) ⊃ φ) ⊃ θ (18.23)
from eq. (18.14)
!D (18.24)
from eq. (18.22) and eq. (18.23)
Prov T (⌜θ⌝) (18.25)
from eq. (18.24) by condition P1
!A from eq. (18.21) and eq. (18.25)
With Löb’s theorem in hand, there is a short proof of the second incom-
pleteness theorem (for theories having a derivability predicate satisfying con-
ditions P1–P3): if T ⊢ Prov T (⌜⊥⌝) ⊃ ⊥, then T ⊢ ⊥. If T is consistent, T ⊬ ⊥.
So, T ⊬ Prov T (⌜⊥⌝) ⊃ ⊥, i.e., T ⊬ ConT . We can also apply it to show that δ,
the fixed point of Prov T ( x ), is derivable. For since
T ⊢ Prov T (⌜δ⌝) ≡ δ
in particular
T ⊢ Prov T (⌜δ⌝) ⊃ δ
and so by Löb’s theorem, T ⊢ δ.
291
18. I NCOMPLETENESS AND P ROVABILITY
Now one can ask, is the converse also true? That is, is every relation defin-
able in N computable? The answer is no. For example:
Lemma 18.13. The halting relation is definable in N.
so ∃s θ T (z, x, s) defines H in N.
negative.
Theorem 18.14. The set of true sentences of arithmetic is not definable in arithmetic.
292
18.9. The Undefinability of Truth
However, for any language strong enough to represent the diagonal function,
and any linguistic predicate T ( x ), we can construct a sentence X satisfying
“X if and only if not T (‘X’).” Given that we do not want a truth predicate
to declare some sentences to be both true and false, Tarski concluded that
one cannot specify a truth predicate for all sentences in a language without,
somehow, stepping outside the bounds of the language. In other words, a the
truth predicate for a language cannot be defined in the language itself.
293
Part V
Methods
295
Appendix A
Proofs
A.1 Introduction
Based on your experiences in introductory logic, you might be comfortable
with a derivation system—probably a natural deduction or Fitch style deriva-
tion system, or perhaps a proof-tree system. You probably remember doing
proofs in these systems, either proving a formula or show that a given argu-
ment is valid. In order to do this, you applied the rules of the system un-
til you got the desired end result. In reasoning about logic, we also prove
things, but in most cases we are not using a derivation system. In fact, most
of the proofs we consider are done in English (perhaps, with some symbolic
language thrown in) rather than entirely in the language of first-order logic.
When constructing such proofs, you might at first be at a loss—how do I prove
something without a derivation system? How do I start? How do I know if
my proof is correct?
Before attempting a proof, it’s important to know what a proof is and how
to construct one. As implied by the name, a proof is meant to show that some-
thing is true. You might think of this in terms of a dialogue—someone asks
you if something is true, say, if every prime other than two is an odd number.
To answer “yes” is not enough; they might want to know why. In this case,
you’d give them a proof.
In everyday discourse, it might be enough to gesture at an answer, or give
an incomplete answer. In logic and mathematics, however, we want rigorous
proof—we want to show that something is true beyond any doubt. This means
that every step in our proof must be justified, and the justification must be
cogent (i.e., the assumption you’re using is actually assumed in the statement
of the theorem you’re proving, the definitions you apply must be correctly
applied, the justifications appealed to must be correct inferences, etc.).
Usually, we’re proving some statement. We call the statements we’re prov-
ing by various names: propositions, theorems, lemmas, or corollaries. A
proposition is a basic proof-worthy statement: important enough to record,
297
A. P ROOFS
but perhaps not particularly deep nor applied often. A theorem is a signifi-
cant, important proposition. Its proof often is broken into several steps, and
sometimes it is named after the person who first proved it (e.g., Cantor’s The-
orem, the Löwenheim–Skolem theorem) or after the fact it concerns (e.g., the
completeness theorem). A lemma is a proposition or theorem that is used
in the proof of a more important result. Confusingly, sometimes lemmas are
important results in themselves, and also named after the person who intro-
duced them (e.g., Zorn’s Lemma). A corollary is a result that easily follows
from another one.
A statement to be proved often contains assumptions that clarify which
kinds of things we’re proving something about. It might begin with “Let φ
be a formula of the form ψ ⊃ χ” or “Suppose Γ ⊢ φ” or something of the
sort. These are hypotheses of the proposition, theorem, or lemma, and you may
assume these to be true in your proof. They restrict what we’re proving, and
also introduce some names for the objects we’re talking about. For instance, if
your proposition begins with “Let φ be a formula of the form ψ ⊃ χ,” you’re
proving something about all formulas of a certain sort only (namely, condi-
tionals), and it’s understood that ψ ⊃ χ is an arbitrary conditional that your
proof will talk about.
298
A.3. Using Definitions
In order to even start the proof, we need to know what it means for two sets
to be identical; i.e., we need to know what the “=” in that equation means for
sets. Sets are defined to be identical whenever they have the same elements.
So the definition we have to unpack is:
and the same set, even though we use different letters for it on the left and the right side. But the
ways in which that set is picked out may be different, and that makes the definition non-trivial.
299
A. P ROOFS
Within the proof we are dealing with set-theoretic notions such as union,
and so we must also know the meanings of the symbol ∪ in order to under-
stand how the proof should proceed. And sometimes, unpacking the defini-
tion gives rise to further definitions to unpack. For instance, A ∪ B is defined
as {z | z ∈ A or z ∈ B}. So if you want to prove that x ∈ A ∪ B, unpacking
the definition of ∪ tells you that you have to prove x ∈ {z | z ∈ A or z ∈ B}.
Now you also have to remember that x ∈ {z | . . . z . . .} iff . . . x . . . . So, further
unpacking the definition of the {z | . . . z . . .} notation, what you have to show
is: x ∈ A or x ∈ B. So, “every element of A ∪ B is also an element of B ∪ A”
really means: “for every x, if x ∈ A or x ∈ B, then x ∈ B or x ∈ A.” If we fully
unpack the definitions in the proposition, we see that what we have to show
is this:
Proposition A.3. For any sets A and B: (a) for every x, if x ∈ A or x ∈ B, then
x ∈ B or x ∈ A, and (b) for every x, if x ∈ B or x ∈ A, then x ∈ A or x ∈ B.
300
A.4. Inference Patterns
Using a Conjunction
Perhaps the simplest inference pattern is that of drawing as conclusion one of
the conjuncts of a conjunction. In other words: if we have assumed or already
proved that p and q, then we’re entitled to infer that p (and also that q). This is
such a basic inference that it is often not mentioned. For instance, once we’ve
unpacked the definition of D = E we’ve established that every element of D is
an element of E and vice versa. From this we can conclude that every element
of E is an element of D (that’s the “vice versa” part).
Proving a Conjunction
Sometimes what you’ll be asked to prove will have the form of a conjunc-
tion; you will be asked to “prove p and q.” In this case, you simply have
to do two things: prove p, and then prove q. You could divide your proof
into two sections, and for clarity, label them. When you’re making your first
notes, you might write “(1) Prove p” at the top of the page, and “(2) Prove q”
in the middle of the page. (Of course, you might not be explicitly asked to
prove a conjunction but find that your proof requires that you prove a con-
junction. For instance, if you’re asked to prove that D = E you will find that,
after unpacking the definition of =, you have to prove: every element of D is
an element of E and every element of E is an element of D).
Proving a Disjunction
When what you are proving takes the form of a disjunction (i.e., it is an state-
ment of the form “p or q”), it is enough to show that one of the disjuncts is true.
However, it basically never happens that either disjunct just follows from the
assumptions of your theorem. More often, the assumptions of your theorem
301
A. P ROOFS
are themselves disjunctive, or you’re showing that all things of a certain kind
have one of two properties, but some of the things have the one and others
have the other property. This is where proof by cases is useful (see below).
Conditional Proof
Many theorems you will encounter are in conditional form (i.e., show that if
p holds, then q is also true). These cases are nice and easy to set up—simply
assume the antecedent of the conditional (in this case, p) and prove the con-
clusion q from it. So if your theorem reads, “If p then q,” you start your proof
with “assume p” and at the end you should have proved q.
Conditionals may be stated in different ways. So instead of “If p then q,”
a theorem may state that “p only if q,” “q if p,” or “q, provided p.” These all
mean the same and require assuming p and proving q from that assumption.
Recall that a biconditional (“p if and only if (iff) q”) is really two conditionals
put together: if p then q, and if q then p. All you have to do, then, is two
instances of conditional proof: one for the first conditional and another one
for the second. Sometimes, however, it is possible to prove an “iff” statement
by chaining together a bunch of other “iff” statements so that you start with
“p” an end with “q”—but in that case you have to make sure that each step
really is an “iff.”
Universal Claims
Using a universal claim is simple: if something is true for anything, it’s true
for each particular thing. So if, say, the hypothesis of your proof is A ⊆ B, that
means (unpacking the definition of ⊆), that, for every x ∈ A, x ∈ B. Thus, if
you already know that z ∈ A, you can conclude z ∈ B.
Proving a universal claim may seem a little bit tricky. Usually these state-
ments take the following form: “If x has P, then it has Q” or “All Ps are Qs.”
Of course, it might not fit this form perfectly, and it takes a bit of practice to
figure out what you’re asked to prove exactly. But: we often have to prove
that all objects with some property have a certain other property.
The way to prove a universal claim is to introduce names or variables, for
the things that have the one property and then show that they also have the
other property. We might put this by saying that to prove something for all Ps
you have to prove it for an arbitrary P. And the name introduced is a name
for an arbitrary P. We typically use single letters as these names for arbitrary
things, and the letters usually follow conventions: e.g., we use n for natural
numbers, φ for formulae, A for sets, f for functions, etc.
The trick is to maintain generality throughout the proof. You start by as-
suming that an arbitrary object (“x”) has the property P, and show (based only
on definitions or what you are allowed to assume) that x has the property Q.
Because you have not stipulated what x is specifically, other that it has the
302
A.4. Inference Patterns
property P, then you can assert that everything with P has the property Q. In
short, x is a stand-in for all things with property P.
Proof by Cases
Suppose you have a disjunction as an assumption or as an already established
conclusion—you have assumed or proved that p or q is true. You want to
prove r. You do this in two steps: first you assume that p is true, and prove r,
then you assume that q is true and prove r again. This works because we
assume or know that one of the two alternatives holds. The two steps establish
that either one is sufficient for the truth of r. (If both are true, we have not one
but two reasons for why r is true. It is not necessary to separately prove that
r is true assuming both p and q.) To indicate what we’re doing, we announce
that we “distinguish cases.” For instance, suppose we know that x ∈ B ∪ C.
B ∪ C is defined as { x | x ∈ B or x ∈ C }. In other words, by definition, x ∈ B
or x ∈ C. We would prove that x ∈ A from this by first assuming that x ∈ B,
and proving x ∈ A from this assumption, and then assume x ∈ C, and again
prove x ∈ A from this. You would write “We distinguish cases” under the
assumption, then “Case (1): x ∈ B” underneath, and “Case (2): x ∈ C halfway
down the page. Then you’d proceed to fill in the top half and the bottom half
of the page.
Proof by cases is especially useful if what you’re proving is itself disjunc-
tive. Here’s a simple example:
303
A. P ROOFS
Since x ∈ A, A ̸= ∅.
have to go into all this detail when you write down your own proofs.
304
A.4. Inference Patterns
Let a ∈ A.
305
A. P ROOFS
It’s maybe good practice to keep bound variables like “x” separate from
hypothetical names like a, like we did. In practice, however, we often don’t
and just use x, like so:
However, when you do this, you have to be extra careful that you use different
x’s and y’s for different existential claims. For instance, the following is not a
correct proof of “If A ̸= ∅ and B ̸= ∅ then A ∩ B ̸= ∅” (which is not true).
Can you spot where the incorrect step occurs and explain why the result does
not hold?
A.5 An Example
Our first example is the following simple fact about unions and intersections
of sets. It will illustrate unpacking definitions, proofs of conjunctions, of uni-
versal claims, and proof by cases.
306
A.5. An Example
This completes the first case of the proof by cases. Now we want
to derive the conclusion in the second case, where z ∈ B ∩ C.
Again, we are working with the intersection of two sets. Let’s ap-
ply the definition of ∩:
307
A. P ROOFS
308
A.6. Another Example
Now for the second case, z ∈ B. Here we’ll unpack the second ∪
and do another proof-by-cases:
Case 2: Suppose that z ∈ B. Since z ∈ A ∪ C, either z ∈ A or z ∈ C. We
distinguish cases further:
Case 2a: z ∈ A. Then, again, z ∈ A ∪ ( B ∩ C ).
Ok, this was a bit weird. We didn’t actually need the assumption
that z ∈ B for this case, but that’s ok.
Case 2b: z ∈ C. Then z ∈ B and z ∈ C, so z ∈ B ∩ C, and consequently,
z ∈ A ∪ ( B ∩ C ).
This concludes both proofs-by-cases and so we’re done with the
second half.
So, if z ∈ ( A ∪ B) ∩ ( A ∪ C ) then z ∈ A ∪ ( B ∩ C ).
309
A. P ROOFS
Here we’ve used the fact recorded earlier which followed from the
hypothesis of the proposition that A ⊆ C. The first case is com-
plete, and we turn to the second case, z ∈ (C \ A). Recall that
C \ A denotes the difference of the two sets, i.e., the set of all ele-
ments of C which are not elements of A. But any element of C not
in A is in particular an element of C.
Great, we’ve proved the first direction. Now for the second direc-
tion. Here we prove that C ⊆ A ∪ (C \ A). So we assume that
z ∈ C and prove that z ∈ A ∪ (C \ A).
Either z ∈ A or z ∈
/ A. In the former case, z ∈ A ∪ (C \ A). In the latter case,
z ∈ C and z ∈
/ A, so z ∈ C \ A. But then z ∈ A ∪ (C \ A).
310
A.7. Proof by Contradiction
A has no elements iff it’s not the case that there is an x such that x ∈ A.
Since A ⊆ B, x ∈ B.
311
A. P ROOFS
312
A.7. Proof by Contradiction
313
A. P ROOFS
A ∩ ( A ∪ B) = A
This is the first half of the proof of the identity: it establishes that if an
arbitrary z is an element of the left side, it is also an element of the right, i.e.,
A ∩ ( A ∪ B) ⊆ A. Assume that z ∈ A ∩ ( A ∪ B). Since z is an element of
the intersection of two sets iff it is an element of both sets, we can conclude
that z ∈ A and also z ∈ A ∪ B. In particular, z ∈ A, which is what we
wanted to show. Since that’s all that has to be done for the first half, we know
that the rest of the proof must be a proof of the second half, i.e., a proof that
A ⊆ A ∩ ( A ∪ B ).
314
A.9. I Can’t Do It!
315
A. P ROOFS
3. Ask for help. You have many resources available to you—your instructor
and teaching assistant are there for you and want you to succeed. They
should be able to help you work out a problem and identify where in
the process you’re struggling.
4. Take a break. If you’re stuck, it might be because you’ve been staring at the
problem for too long. Take a short break, have a cup of tea, or work on
a different problem for a while, then return to the problem with a fresh
mind. Sleep on it.
Notice how these strategies require that you’ve started to work on the
proof well in advance? If you’ve started the proof at 2am the day before it’s
due, these might not be so helpful.
This might sound like doom and gloom, but solving a proof is a challenge
that pays off in the end. Some people do this as a career—so there must be
something to enjoy about it. Like basically everything, solving problems and
doing proofs is something that requires practice. You might see classmates
who find this easy: they’ve probably just had lots of practice already. Try not
to give in too easily.
If you do run out of time (or patience) on a particular problem: that’s ok. It
doesn’t mean you’re stupid or that you will never get it. Find out (from your
instructor or another student) how it is done, and identify where you went
wrong or got stuck, so you can avoid doing that the next time you encounter
a similar issue. Then try to do it without looking at the solution. And next
time, start (and ask for help) earlier.
Motivational Videos
Feel like you have no motivation to do your homework? Feeling down? These
videos might help!
• https://www.youtube.com/watch?v=ZXsQAXx_ao0
316
A.10. Other Resources
• https://www.youtube.com/watch?v=BQ4yd2W50No
• https://www.youtube.com/watch?v=StTqXEQ2l-Y
317
Appendix B
Induction
B.1 Introduction
Induction is an important proof technique which is used, in different forms,
in almost all areas of logic, theoretical computer science, and mathematics. It
is needed to prove many of the results in logic.
Induction is often contrasted with deduction, and characterized as the in-
ference from the particular to the general. For instance, if we observe many
green emeralds, and nothing that we would call an emerald that’s not green,
we might conclude that all emeralds are green. This is an inductive infer-
ence, in that it proceeds from many particular cases (this emerald is green,
that emerald is green, etc.) to a general claim (all emeralds are green). Math-
ematical induction is also an inference that concludes a general claim, but it is
of a very different kind than this “simple induction.”
Very roughly, an inductive proof in mathematics concludes that all math-
ematical objects of a certain sort have a certain property. In the simplest case,
the mathematical objects an inductive proof is concerned with are natural
numbers. In that case an inductive proof is used to establish that all natural
numbers have some property, and it does this by showing that
Induction on natural numbers can then also often be used to prove general
claims about mathematical objects that can be assigned numbers. For instance,
finite sets each have a finite number n of elements, and if we can use induction
to show that every number n has the property “all finite sets of size n are . . . ”
then we will have shown something about all finite sets.
Induction can also be generalized to mathematical objects that are induc-
tively defined. For instance, expressions of a formal language such as those of
first-order logic are defined inductively. Structural induction is a way to prove
319
B. I NDUCTION
B.2 Induction on N
In its simplest form, induction is a technique used to prove results for all nat-
ural numbers. It uses the fact that by starting from 0 and repeatedly adding 1
we eventually reach every natural number. So to prove that something is true
for every number, we can (1) establish that it is true for 0 and (2) show that
whenever it is true for a number n, it is also true for the next number n + 1. If
we abbreviate “number n has property P” by P(n) (and “number k has prop-
erty P” by P(k), etc.), then a proof by induction that P(n) for all n ∈ N consists
of:
1. a proof of P(0), and
Proof. Let P(n) be the claim: “It is possible to throw any number between n
and 6n using n dice.” To use induction, we prove:
1. The induction basis P(1), i.e., with just one die, you can throw any num-
ber between 1 and 6.
320
B.2. Induction on N
(1) Is proved by inspecting a 6-sided die. It has all 6 sides, and every num-
ber between 1 and 6 shows up one on of the sides. So it is possible to throw
any number between 1 and 6 using a single die.
To prove (2), we assume the antecedent of the conditional, i.e., P(k ). This
assumption is called the inductive hypothesis. We use it to prove P(k + 1). The
hard part is to find a way of thinking about the possible values of a throw of
k + 1 dice in terms of the possible values of throws of k dice plus of throws of
the extra k + 1-st die—this is what we have to do, though, if we want to use
the inductive hypothesis.
The inductive hypothesis says we can get any number between k and 6k
using k dice. If we throw a 1 with our (k + 1)-st die, this adds 1 to the total.
So we can throw any value between k + 1 and 6k + 1 by throwing k dice and
then rolling a 1 with the (k + 1)-st die. What’s left? The values 6k + 2 through
6k + 6. We can get these by rolling k 6s and then a number between 2 and 6
with our (k + 1)-st die. Together, this means that with k + 1 dice we can throw
any of the numbers between k + 1 and 6(k + 1), i.e., we’ve proved P(k + 1)
using the assumption P(k), the inductive hypothesis.
s0 = 0
s n +1 = s n + ( n + 1 )
s0 = 0,
s1 = s0 + 1 = 1,
s2 = s1 + 2 = 1+2 = 3
s3 = s2 + 3 = 1 + 2 + 3 = 6, etc.
Proof. We have to prove (1) that s0 = 0 · (0 + 1)/2 and (2) if sk = k(k + 1)/2
then sk+1 = (k + 1)(k + 2)/2. (1) is obvious. To prove (2), we assume the
inductive hypothesis: sk = k (k + 1)/2. Using it, we have to show that sk+1 =
(k + 1)(k + 2)/2.
321
B. I NDUCTION
k ( k + 1)
s k +1 = + ( k + 1) =
2
k ( k + 1) 2( k + 1)
= + =
2 2
k ( k + 1) + 2( k + 1)
= =
2
(k + 2)(k + 1)
= .
2
The important lesson here is that if you’re proving something about some
inductively defined sequence an , induction is the obvious way to go. And
even if it isn’t (as in the case of the possibilities of dice throws), you can use
induction if you can somehow relate the case for k + 1 to the case for k.
322
B.4. Inductive Definitions
This variant is useful if establishing the claim for k can’t be made to just
rely on the claim for k − 1 but may require the assumption that it is true for
one or more l < k.
Definition B.3 (Nice terms). The set of nice terms is inductively defined as fol-
lows:
This definition tells us that something counts as a nice term iff it can be
constructed according to the two conditions (1) and (2) in some finite number
of steps. In the first step, we construct all nice terms just consisting of letters
by themselves, i.e.,
a, b, c, d
In the second step, we apply (2) to the terms we’ve constructed. We’ll get
for all combinations of two letters. In the third step, we apply (2) again, to any
two nice terms we’ve constructed so far. We get new nice term such as [a ◦ [a ◦
323
B. I NDUCTION
Proposition B.4. For any n, the number of [ in a nice term of length n is < n/2.
Proof. To prove this result by (strong) induction, we have to show that the
following conditional claim is true:
If for every l < k, any nice term of length l has < l/2 [’s, then any
nice term of length k has < k/2 [’s.
To show this conditional, assume that its antecedent is true, i.e., assume that
for any l < k, nice terms of length l contain < l/2 [’s. We call this assumption
the inductive hypothesis. We want to show the same is true for nice terms of
length k.
So suppose t is a nice term of length k. Because nice terms are inductively
defined, we have two cases: (1) t is a letter by itself, or (2) t is [s1 ◦ s2 ] for some
nice terms s1 and s2 .
2. t is [s1 ◦ s2 ] for some nice terms s1 and s2 . Let’s let l1 be the length of s1
and l2 be the length of s2 . Then the length k of t is l1 + l2 + 3 (the lengths
of s1 and s2 plus three symbols [, ◦, ]). Since l1 + l2 + 3 is always greater
than l1 , l1 < k. Similarly, l2 < k. That means that the induction hypothe-
sis applies to the terms s1 and s2 : the number m1 of [ in s1 is < l1 /2, and
the number m2 of [ in s2 is < l2 /2.
324
B.5. Structural Induction
l1 l l + l2 + 2 l + l2 + 3
m1 + m2 + 1 < + 2 +1 = 1 < 1 = k/2.
2 2 2 2
In each case, we’ve shown that the number of [ in t is < k/2 (on the basis of
the inductive hypothesis). By strong induction, the proposition follows.
o (s1 , s2 ) =[s1 ◦ s2 ]
You can even think of the natural numbers N themselves as being given by an
inductive definition: the initial object is 0, and the operation is the successor
function x + 1.
In order to prove something about all elements of an inductively defined
set, i.e., that every element of the set has a property P, we must:
2. Prove that for each operation o, if the arguments have P, so does the
result.
For instance, in order to prove something about all nice terms, we would
prove that it is true about all letters, and that it is true about [s1 ◦ s2 ] provided
it is true of s1 and s2 individually.
Proposition B.5. The number of [ equals the number of ] in any nice term t.
Proof. We use structural induction. Nice terms are inductively defined, with
letters as initial objects and the operation o for constructing new nice terms
out of old ones.
1. The claim is true for every letter, since the number of [ in a letter by itself
is 0 and the number of ] in it is also 0.
325
B. I NDUCTION
Proof. By induction on t:
1. t is a letter by itself: Then t has no proper initial segments.
326
B.6. Relations and Functions
This definition, for instance, will tell us that a ⊑ [b ◦ a]. For (2) says that
a ⊑ [b ◦ a] iff a = [b ◦ a], or a ⊑ b, or a ⊑ a. The first two are false: a
clearly isn’t identical to [b ◦ a], and by (1), a ⊑ b iff a = b, which is also false.
However, also by (1), a ⊑ a iff a = a, which is true.
It’s important to note that the success of this definition depends on a fact
that we haven’t proved yet: every nice term t is either a letter by itself, or there
are uniquely determined nice terms s1 and s2 such that t = [s1 ◦ s2 ]. “Uniquely
determined” here means that if t = [s1 ◦ s2 ] it isn’t also = [r1 ◦ r2 ] with s1 ̸= r1
or s2 ̸= r2 . If this were the case, then clause (2) may come in conflict with
itself: reading t2 as [s1 ◦ s2 ] we might get t1 ⊑ t2 , but if we read t2 as [r1 ◦ r2 ]
we might get not t1 ⊑ t2 . Before we prove that this can’t happen, let’s look at
an example where it can happen.
Definition B.8. Define bracketless terms inductively by
1. Every letter is a bracketless term.
2. If s1 and s2 are bracketless terms, then s1 ◦ s2 is a bracketless term.
3. Nothing else is a bracketless term.
s1 = b and s2 = a ◦ b.
r1 = b ◦ a and r2 = b.
327
B. I NDUCTION
We can also define functions inductively: e.g., we can define the function f
that maps any nice term to the maximum depth of nested [. . . ] in it as follows:
Definition B.10. The depth of a nice term, f (t), is defined inductively as fol-
lows: (
0 if t is a letter
f (t) =
max( f (s1 ), f (s2 )) + 1 if t = [s1 ◦ s2 ].
For instance
f ([a ◦ b]) = max( f (a), f (b)) + 1 =
= max(0, 0) + 1 = 1, and
f ([[a ◦ b] ◦ c]) = max( f ([a ◦ b]), f (c)) + 1 =
= max(1, 0) + 1 = 2.
Here, of course, we assume that s1 an s2 are nice terms, and make use
of the fact that every nice term is either a letter or of the form [s1 ◦ s2 ]. It
is again important that it can be of this form in only one way. To see why,
consider again the bracketless terms we defined earlier. The corresponding
“definition” would be:
(
0 if t is a letter
g(t) =
max( g(s1 ), g(s2 )) + 1 if t = s1 ◦ s2 .
Now consider the bracketless term a ◦ b ◦ c ◦ d. It can be read in more than
one way, e.g., as s1 ◦ s2 with
s1 = a and s2 = b ◦ c ◦ d,
or as r1 ◦ r2 with
r1 = a ◦ b and r2 = c ◦ d.
Calculating g according to the first way of reading it would give
g(s1 ◦ s2 ) = max( g(a), g(b ◦ c ◦ d)) + 1 =
= max(0, 2) + 1 = 3
328
B.6. Relations and Functions
329
Appendix C
Biographies
331
C. B IOGRAPHIES
Further Reading For full biographies of Cantor, see Dauben (1990) and Grattan-
Guinness (1971). Cantor’s radical views are also described in the BBC Radio 4
program A Brief History of Mathematics (du Sautoy, 2014). If you’d like to hear
about Cantor’s theories in rap form, see Rose (2012).
Further Reading For a brief biography of Church, see Enderton (2019). Church’s
original writings on the lambda calculus and the Entscheidungsproblem (Church’s
Thesis) are Church (1936a,b). Aspray (1984) records an interview with Church
332
C.3. Gerhard Gentzen
about the Princeton mathematics community in the 1930s. Church wrote a se-
ries of book reviews of the Journal of Symbolic Logic from 1936 until 1979. They
are all archived on John MacFarlane’s website (MacFarlane, 2015).
333
C. B IOGRAPHIES
334
C.5. Emmy Noether
Study in Princeton, New Jersey. Despite his introversion and eccentric nature,
Gödel’s time at Princeton was collaborative and fruitful. He published essays
in set theory, philosophy and physics. Notably, he struck up a particularly
strong friendship with his colleague at the IAS, Albert Einstein.
In his later years, Gödel’s mental health deteriorated. His wife’s hospi-
talization in 1977 meant she was no longer able to cook his meals for him.
Having suffered from mental health issues throughout his life, he succumbed
to paranoia. Deathly afraid of being poisoned, Gödel refused to eat. He died
of starvation on January 14, 1978, in Princeton.
335
C. B IOGRAPHIES
Further Reading For a biography of Noether, see Dick (1981). The Perime-
ter Institute for Theoretical Physics has their lectures on Noether’s life and
influence available online (Institute, 2015). If you’re tired of reading, Stuff You
Missed in History Class has a podcast on Noether’s life and influence (Frey and
Wilson, 2015). The collected works of Noether are available in the original
German (Jacobson, 1983).
336
C.6. Rózsa Péter
Rózsa Péter was born Rósza Politzer, in Budapest, Hungary, on February 17,
1905. She is best known for her work on recursive functions, which was es-
sential for the creation of the field of recursion theory.
Péter was raised during harsh polit-
ical times—WWI raged when she was
a teenager—but was able to attend the
affluent Maria Terezia Girls’ School in
Budapest, from where she graduated
in 1922. She then studied at Pázmány
Péter University (later renamed Loránd
Eötvös University) in Budapest. She
began studying chemistry at the insis-
tence of her father, but later switched
to mathematics, and graduated in 1927.
Although she had the credentials to
teach high school mathematics, the eco-
nomic situation at the time was dire as
the Great Depression affected the world
economy. During this time, Péter took
Figure C.6: Rózsa Péter
odd jobs as a tutor and private teacher
of mathematics. She eventually returned to university to take up graduate
studies in mathematics. She had originally planned to work in number the-
ory, but after finding out that her results had already been proven, she almost
gave up on mathematics altogether. She was encouraged to work on Gödel’s
incompleteness theorems, and unknowingly proved several of his results in
different ways. This restored her confidence, and Péter went on to write her
first papers on recursion theory, inspired by David Hilbert’s foundational pro-
gram. She received her PhD in 1935, and in 1937 she became an editor for the
Journal of Symbolic Logic.
Péter’s early papers are widely credited as founding contributions to the
field of recursive function theory. In Péter (1935a), she investigated the rela-
tionship between different kinds of recursion. In Péter (1935b), she showed
that a certain recursively defined function is not primitive recursive. This
simplified an earlier result due to Wilhelm Ackermann. Péter’s simplified
function is what’s now often called the Ackermann function—and sometimes,
more properly, the Ackermann–Péter function. She wrote the first book on re-
cursive function theory (Péter, 1951).
Despite the importance and influence of her work, Péter did not obtain a
full-time teaching position until 1945. During the Nazi occupation of Hungary
during World War II, Péter was not allowed to teach due to anti-Semitic laws.
In 1944 the government created a Jewish ghetto in Budapest; the ghetto was
cut off from the rest of the city and attended by armed guards. Péter was
forced to live in the ghetto until 1945 when it was liberated. She then went on
337
C. B IOGRAPHIES
to teach at the Budapest Teachers Training College, and from 1955 onward at
Eötvös Loránd University. She was the first female Hungarian mathematician
to become an Academic Doctor of Mathematics, and the first woman to be
elected to the Hungarian Academy of Sciences.
Péter was known as a passionate teacher of mathematics, who preferred
to explore the nature and beauty of mathematical problems with her students
rather than to merely lecture. As a result, she was affectionately called “Aunt
Rosa” by her students. Péter died in 1977 at the age of 71.
Further Reading For more biographical reading, see (O’Connor and Robert-
son, 2014) and (Andrásfai, 1986). Tamassy (1994) conducted a brief interview
with Péter. For a fun read about mathematics, see Péter’s book Playing With
Infinity (Péter, 2010).
338
C.7. Julia Robinson
there was substantial scar tissue build up on her heart due to the rheumatic
fever she suffered as a child. Due to the severity of the scar tissue, the doctor
predicted that she would not live past forty and she was advised not to have
children (Reid, 1986, 13).
Robinson was depressed for a long time, but eventually decided to con-
tinue studying mathematics. She returned to Berkeley and completed her PhD
in 1948 under the supervision of Alfred Tarski. The first-order theory of the
real numbers had been shown to be decidable by Tarski, and from Gödel’s
work it followed that the first-order theory of the natural numbers is unde-
cidable. It was a major open problem whether the first-order theory of the
rationals is decidable or not. In her thesis (1949), Robinson proved that it was
not.
Interested in decision problems, Robinson next attempted to find a solu-
tion to Hilbert’s tenth problem. This problem was one of a famous list of
23 mathematical problems posed by David Hilbert in 1900. The tenth prob-
lem asks whether there is an algorithm that will answer, in a finite amount of
time, whether or not a polynomial equation with integer coefficients, such as
3x2 − 2y + 3 = 0, has a solution in the integers. Such questions are known as
Diophantine problems. After some initial successes, Robinson joined forces with
Martin Davis and Hilary Putnam, who were also working on the problem.
They succeeded in showing that exponential Diophantine problems (where
the unknowns may also appear as exponents) are undecidable, and showed
that a certain conjecture (later called “J.R.”) implies that Hilbert’s tenth prob-
lem is undecidable (Davis et al., 1961). Robinson continued to work on the
problem throughout the 1960s. In 1970, the young Russian mathematician
Yuri Matijasevich finally proved the J.R. hypothesis. The combined result
is now called the Matijasevich–Robinson–Davis–Putnam theorem, or MRDP
theorem for short. Matijasevich and Robinson became friends and collabo-
rated on several papers. In a letter to Matijasevich, Robinson once wrote that
“actually I am very pleased that working together (thousands of miles apart)
we are obviously making more progress than either one of us could alone”
(Matijasevich, 1992, 45).
Robinson was the first female president of the American Mathematical So-
ciety, and the first woman to be elected to the National Academy of Science.
She died on July 30, 1985 at the age of 65 after being diagnosed with leukemia.
339
C. B IOGRAPHIES
with Robinson, and her influence on his work, see (Matijasevich, 1992).
340
C.9. Alfred Tarski
341
C. B IOGRAPHIES
Tarski could not return. His wife and children remained in Poland until the
end of the war, but were then able to emigrate to the United States as well.
Tarski taught at Harvard, the College of the City of New York, and the Insti-
tute for Advanced Study at Princeton, and finally the University of California,
Berkeley. There he founded the multidisciplinary program in Logic and the
Methodology of Science. Tarski died on October 26, 1983 at the age of 82.
Further Reading For more on Tarski’s life, see the biography Alfred Tarski:
Life and Logic (Feferman and Feferman, 2004). Tarski’s seminal works on logi-
cal consequence and truth are available in English in (Corcoran, 1983). All of
Tarski’s original works have been collected into a four volume series, (Tarski,
1981).
342
C.11. Ernst Zermelo
the team the ability to crack the code by creating a de-crypting machine called
a “bombe.” His ideas also helped in the creation of the world’s first pro-
grammable electronic computer, the Colossus, also used at Bletchley park to
break the German Lorenz cypher.
Turing was gay. Nevertheless, in 1942 he proposed to Joan Clarke, one
of his teammates at Bletchley Park, but later broke off the engagement and
confessed to her that he was homosexual. He had several lovers throughout
his lifetime, although homosexual acts were then criminal offences in the UK.
In 1952, Turing’s house was burgled by a friend of his lover at the time, and
when filing a police report, Turing admitted to having a homosexual relation-
ship, under the impression that the government was on their way to legalizing
homosexual acts. This was not true, and he was charged with gross indecency.
Instead of going to prison, Turing opted for a hormone treatment that reduced
libido. Turing was found dead on June 8, 1954, of a cyanide overdose—most
likely suicide. He was given a royal pardon by Queen Elizabeth II in 2013.
343
C. B IOGRAPHIES
344
Appendix D
Problems
Problem 1.8. Using Definition 1.23, prove that ⟨ a, b⟩ = ⟨c, d⟩ iff both a = c
and b = d.
Problem 2.2. Give examples of relations that are (a) reflexive and symmetric
but not transitive, (b) reflexive and anti-symmetric, (c) anti-symmetric, transi-
tive, but not reflexive, and (d) reflexive, symmetric, and transitive. Do not use
relations on numbers or sets.
345
D. P ROBLEMS
Problem 3.3. Prove Proposition 3.18. You have to define f −1 , show that it
is a function, and show that it is an inverse of f , i.e., f −1 ( f ( x )) = x and
f ( f −1 (y)) = y for all x ∈ A and y ∈ B.
346
Problem 4.3. Show that if B ⊆ A and A is countable, so is B. To do this,
suppose there is a surjective function f : Z+ → A. Define a surjective func-
tion g : Z+ → B and prove that it is surjective. What happens if B = ∅?
Problem 4.7. Show that (Z+ )∗ is countable. You may assume problem 4.6.
Problem 4.8. Give an enumeration of the set of all non-negative rational num-
bers.
Problem 4.9. Show that Q is countable. Recall that any rational number can
be written as a fraction z/m with z ∈ Z, m ∈ N+ .
Problem 4.11. Recall from your introductory logic course that each possible
truth table expresses a truth function. In other words, the truth functions are
all functions from Bk → B for some k. Prove that the set of all truth functions
is enumerable.
Problem 4.12. Show that the set of all finite subsets of an arbitrary infinite
countable set is countable.
Problem 4.14. Show that the countable union of countable sets is countable.
That is, whenever A1 , A2 , . . . are sets, and each Ai is countable, then the union
S∞
i =1 Ai of all of them is also countable. [NB: this is hard!]
347
D. P ROBLEMS
Problem 4.20. Show that the set of all sets of pairs of positive integers is un-
countable by a reduction argument.
Problem 4.22. Show that Nω , the set of infinite sequences of natural numbers,
is uncountable by a reduction argument.
Problem 4.23. Let P be the set of functions from the set of positive integers
to the set {0}, and let Q be the set of partial functions from the set of positive
integers to the set {0}. Show that P is countable and Q is not. (Hint: reduce
the problem of enumerating Bω to enumerating Q).
Problem 4.24. Let S be the set of all surjective functions from the set of posi-
tive integers to the set {0,1}, i.e., S consists of all surjective f : Z+ → B. Show
that S is uncountable.
Problem 4.25. Show that the set R of all real numbers is uncountable.
348
Problems for Chapter 6
Problem 6.1. Prove Lemma 6.8.
Problem 6.4. Prove Proposition 6.13 (Hint: Formulate and prove a version of
Lemma 6.12 for terms.)
Problem 6.8. Prove Proposition 6.30. Hint: use a similar strategy to that used
in the proof of Theorem 6.29.
Problem 7.2. Let L = {c, f , A} with one constant symbol, one one-place func-
tion symbol and one two-place predicate symbol, and let the structure M be
given by
1. |M| = {1, 2, 3}
2. cM = 3
349
D. P ROBLEMS
1. φ ≡ ⊥: not M ||= φ.
3. φ ≡ d1 = d2 : M ||= φ iff dM M
1 = d2 .
8. φ ≡ ∀ x ψ: M ||= φ iff for all a ∈ |M|, M[ a/c] ||= ψ[c/x ], if c does not
occur in ψ.
Problem 7.7. Suppose that f is a function symbol not in φ( x, y). Show that
there is a structure M such that M ⊨ ∀ x ∃y φ( x, y) iff there is an M′ such that
M′ ⊨ ∀ x φ( x, f ( x )).
(This problem is a special case of what’s known as Skolem’s Theorem;
∀ x φ( x, f ( x )) is called a Skolem normal form of ∀ x ∃y φ( x, y).)
350
2. Show that Γ ∪ { φ} ⊨ ⊥ iff Γ ⊨ ∼ φ.
1. n is between i and j;
Problem 8.2. Suppose the formula φ(v1 , v2 ) expresses the relation R ⊆ |M|2
in a structure M. Find formulas that express the following relations:
Problem 8.3. Let L be the language containing a 2-place predicate symbol <
only (no other constant symbols, function symbols or predicate symbols—
except of course =). Let N be the structure such that |N| = N, and <N =
{⟨n, m⟩ | n < m}. Prove the following:
1. {0} is definable in N;
2. {1} is definable in N;
3. {2} is definable in N;
∃y ∀ x ( x ∈ y ≡ x ∈
/ x ) ⊢ ⊥.
351
D. P ROBLEMS
2. φ ∨ (ψ ∨ χ) ⊢ ( φ ∨ ψ) ∨ χ.
3. φ ⊃ (ψ ⊃ χ) ⊢ ψ ⊃ ( φ ⊃ χ).
4. φ ⊢ ∼∼ φ.
1. ( φ ∨ ψ) ⊃ χ ⊢ φ ⊃ χ.
2. ( φ ⊃ χ) & (ψ ⊃ χ) ⊢ ( φ ∨ ψ) ⊃ χ.
3. ⊢ ∼( φ & ∼ φ).
4. ψ ⊃ φ ⊢ ∼ φ ⊃ ∼ψ.
5. ⊢ ( φ ⊃ ∼ φ) ⊃ ∼ φ.
6. ⊢ ∼( φ ⊃ ψ) ⊃ ∼ψ.
7. φ ⊃ χ ⊢ ∼( φ & ∼χ).
8. φ & ∼χ ⊢ ∼( φ ⊃ χ).
9. φ ∨ ψ, ∼ψ ⊢ φ.
1. ∼( φ ⊃ ψ) ⊢ φ.
2. ∼( φ & ψ) ⊢ ∼ φ ∨ ∼ψ.
3. φ ⊃ ψ ⊢ ∼ φ ∨ ψ.
4. ⊢ ∼∼ φ ⊃ φ.
5. φ ⊃ ψ, ∼ φ ⊃ ψ ⊢ ψ.
6. ( φ & ψ) ⊃ χ ⊢ ( φ ⊃ χ) ∨ (ψ ⊃ χ).
7. ( φ ⊃ ψ) ⊃ φ ⊢ φ.
352
8. ⊢ ( φ ⊃ ψ) ∨ (ψ ⊃ χ).
3. ∀ x ( φ( x ) ⊃ ψ) ⊢ ∃y φ(y) ⊃ ψ.
4. ∀ x ∼ φ( x ) ⊢ ∼∃ x φ( x ).
5. ⊢ ∼∃ x φ( x ) ⊃ ∀ x ∼ φ( x ).
1. ⊢ ∼∀ x φ( x ) ⊃ ∃ x ∼ φ( x ).
2. (∀ x φ( x ) ⊃ ψ) ⊢ ∃y ( φ(y) ⊃ ψ).
3. ⊢ ∃ x ( φ( x ) ⊃ ∀y φ(y)).
Problem 9.9. Prove that = is both symmetric and transitive, i.e., give deriva-
tions of ∀ x ∀y ( x = y ⊃ y = x ) and ∀ x ∀y ∀z(( x = y & y = z) ⊃ x = z)
1. ∀ x ∀y (( x = y & φ( x )) ⊃ φ(y))
353
D. P ROBLEMS
Problem 10.6. Use Corollary 10.21 to prove Theorem 10.20, thus showing that
the two formulations of the completeness theorem are equivalent.
Problem 10.7. In order for a derivation system to be complete, its rules must
be strong enough to prove every unsatisfiable set inconsistent. Which of the
rules of derivation were necessary to prove completeness? Are any of these
rules not used anywhere in the proof? In order to answer these questions,
make a list or diagram that shows which of the rules of derivation were used
in which results that lead up to the proof of Theorem 10.20. Be sure to note
any tacit uses of rules in these proofs.
Problem 10.11. Prove Lemma 10.28. (Hint: The crucial step is to show that if
Γn is finitely satisfiable, so is Γn ∪ {θn }, without any appeal to derivations or
consistency.)
Problem 10.13. Prove Lemma 10.30. (Hint: the crucial step is to show that if
Γn is finitely satisfiable, then either Γn ∪ { φn } or Γn ∪ {∼ φn } is finitely satisfi-
able.)
Problem 10.14. Write out the complete proof of the Truth Lemma (Lemma 10.12)
in the version required for the proof of Theorem 10.31.
354
Problems for Chapter 12
Problem 12.1. Choose an arbitrary input and trace through the configurations
of the doubler machine in Example 12.4.
Problem 12.6. Give a definition for when a Turing machine M computes the
function f : Nk → Nm .
Problem 12.7. Trace through the configurations of the machine from Exam-
ple 12.12 for input ⟨3, 2⟩. What happens if the machine computes 0 + 0?
Problem 12.9. Subtraction: Design a Turing machine that when given an input
of two non-empty strings of strokes of length n and m, where n > m, computes
the function f (n, m) = n − m.
355
D. P ROBLEMS
Problem 13.2. The Three Halting (3-Halt) problem is the problem of giving a
decision procedure to determine whether or not an arbitrarily chosen Turing
Machine halts for an input of three 1’s on an otherwise blank tape. Prove that
the 3-Halt problem is unsolvable.
Problem 13.3. Show that if the halting problem is solvable for Turing machine
and input pairs Me and n where e ̸= n, then it is also solvable for the cases
where e = n.
Problem 13.4. We proved that the halting problem is unsolvable if the input
is a number e, which identifies a Turing machine Me via an enumeration of all
Turing machines. What if we allow the description of Turing machines from
section 13.2 directly as input? Can there be a Turing machine which decides
the halting problem but takes as input descriptions of Turing machines rather
than indices? Explain why or why not.
356
Problem 13.5. Show that the partial function s′ is defined as
(
′ 1 if machine Me halts for input e
s (e) =
undefined if machine Me does not halt for input e
is Turing computable.
Problem 13.8. Give a derivation of Sσi (i, n′ ) from Sσi (i, n) and φ(m, n) (as-
suming i ̸= m, i.e., either i < m or m < i).
′
Problem 13.9. Give a derivation of ∀ x (k < x ⊃ S0 ( x, n′ )) from ∀ x (k < x ⊃
S0 ( x, n′ )), ∀ x x < x ′ , and ∀ x ∀y ∀z (( x < y & y < z) ⊃ x < z).)
Problem 13.10. Let M be a Turing machine with the single state q0 and single
′′ ′
instruction δ(q0 , 0) = ⟨q, 0, N ⟩. Let |M′′ | = {0, 1, 2}, ′M (0) = ′M (1) = 1 and
′′ ′′ ′′ M′′ M′′
′M (2) = 2, and <M = {⟨0, 1⟩, ⟨1, 1⟩, ⟨2, 2⟩}. Define QM q0 , S0 , and S▷
so that τ ( M, Λ) and α( M, Λ) become true and explain why they are. Hint:
Observe that δ(q0 , ▷) is undefined. Ensure that
357
D. P ROBLEMS
is primitive recursive.
Problem 15.5. Show that integer division d( x, y) = ⌊ x/y⌋ (i.e., division, where
you disregard everything after the decimal point) is primitive recursive. When
y = 0, we stipulate d( x, y) = 0. Give an explicit definition of d using primitive
recursion and composition.
Problem 15.6. Show that the three place relation x ≡ y mod n (congruence
modulo n) is primitive recursive.
Problem 15.7. Suppose R(⃗x, z) is primitive recursive. Define the function m′R (⃗x, y)
which returns the least z less than y such that R(⃗x, z) holds, if there is one, and
0 otherwise, by primitive recursion from χ R .
Problem 15.8. Define integer division d( x, y) using bounded minimization.
Problem 15.9. Show that there is a primitive recursive function sconcat(s)
with the property that
sconcat(⟨s0 , . . . , sk ⟩) = s0 ⌢ . . . ⌢ sk .
Problem 15.10. Show that there is a primitive recursive function tail(s) with
the property that
tail(Λ) = 0 and
tail(⟨s0 , . . . , sk ⟩) = ⟨s1 , . . . , sk ⟩.
Problem 15.11. Prove Proposition 15.24.
Problem 15.12. The definition of hSubtreeSeq in the proof of Proposition 15.25
in general includes repetitions. Give an alternative definition which guaran-
tees that the code of a subtree occurs only once in the resulting list.
Problem 15.13. Define the remainder function r ( x, y) by course-of-values re-
cursion. (If x, y are natural numbers and y > 0, r ( x, y) is the number less
than y such that x = z × y + r ( x, y) for some z. For definiteness, let’s say that
if y = 0, r ( x, 0) = 0.)
358
Problems for Chapter 16
Problem 16.1. Show that the function flatten(z), which turns the sequence
⟨# t1 # , . . . , # tn # ⟩ into # t1 , . . . , tn # , is primitive recursive.
Problem 16.2. Give a detailed proof of Proposition 16.8 along the lines of the
first proof of Proposition 16.5.
Problem 16.3. Prove Proposition 16.9. You may make use of the fact that any
substring of a formula which is a formula is a sub-formula of it.
1. FollowsBy⊃Elim (d),
2. FollowsBy=Elim (d),
3. FollowsBy∨Elim (d),
4. FollowsBy∀Intro (d).
For the last one, you will have to also show that you can test primitive recur-
sively if the last inference of the derivation with Gödel number d satisfies the
eigenvariable condition, i.e., the eigenvariable a of the ∀Intro inference occurs
neither in the end-formula of d nor in an open assumption of d. You may use
the primitive recursive predicate OpenAssum from Proposition 16.18 for this.
Problem 17.5. Using the proofs of Proposition 17.20 and Proposition 17.20 as
a guide, carry out the proof of Proposition 17.21 in detail.
359
D. P ROBLEMS
Problem 18.2. Every ω-consistent theory is consistent. Show that the con-
verse does not hold, i.e., that there are consistent but ω-inconsistent theories.
Do this by showing that Q ∪ {∼γQ } is consistent but ω-inconsistent.
Problem 18.3. Two sets A and B of natural numbers are said to be computably
inseparable if there is no decidable set X such that A ⊆ X and B ⊆ X (X is the
complement, N \ X, of X). Let T be a consistent axiomatizable extension of
Q. Suppose A is the set of Gödel numbers of sentences provable in T and B
the set of Gödel numbers of sentences refutable in T. Prove that A and B are
computably inseparable.
2. T ⊢ φ ⊃ Prov T (⌜φ⌝).
4. T ⊢ Prov T (⌜φ⌝) ⊃ φ
Problem 18.7. Suppose you are asked to prove that A ∩ B ̸= ∅. Unpack all
the definitions occurring here, i.e., restate this in a way that does not mention
“∩”, “=”, or “∅”.
360
Problem 18.10. Define the set of supernice terms by
Problem 18.11. Prove by structural induction that no nice term starts with ].
Problem 18.12. Give an inductive definition of the function l, where l (t) is the
number of symbols in the nice term t.
Problem 18.13. Prove by structural induction on nice terms t that f (t) < l (t)
(where l (t) is the number of symbols in t and f (t) is the depth of t as defined
in Definition B.10).
361
Photo Credits
Georg Cantor, p. 331: Portrait of Georg Cantor by Otto Zeth courtesy of the
Universitätsarchiv, Martin-Luther Universität Halle–Wittenberg. UAHW Rep. 40-
VI, Nr. 3 Bild 102.
Alonzo Church, p. 332: Portrait of Alonzo Church, undated, photogra-
pher unknown. Alonzo Church Papers; 1924–1995, (C0948) Box 60, Folder 3.
Manuscripts Division, Department of Rare Books and Special Collections, Prince-
ton University Library. © Princeton University. The Open Logic Project has
obtained permission to use this image for inclusion in non-commercial OLP-
derived materials. Permission from Princeton University is required for any
other use.
Gerhard Gentzen, p. 333: Portrait of Gerhard Gentzen playing ping-pong
courtesy of Ekhart Mentzler-Trott.
Kurt Gödel, p. 334: Portrait of Kurt Gödel, ca. 1925, photographer un-
known. From the Shelby White and Leon Levy Archives Center, Institute for
Advanced Study, Princeton, NJ, USA, on deposit at Princeton University Li-
brary, Manuscript Division, Department of Rare Books and Special Collec-
tions, Kurt Gödel Papers, (C0282), Box 14b, #110000. The Open Logic Project
has obtained permission from the Institute’s Archives Center to use this image
for inclusion in non-commercial OLP-derived materials. Permission from the
Archives Center is required for any other use.
Emmy Noether, p. 336: Portrait of Emmy Noether, ca. 1922, courtesy of the
Abteilung für Handschriften und Seltene Drucke, Niedersächsische Staats-
und Universitätsbibliothek Göttingen, Cod. Ms. D. Hilbert 754, Bl. 14 Nr. 73.
Restored from an original scan by Joel Fuller.
Rózsa Péter, p. 337: Portrait of Rózsa Péter, undated, photographer un-
known. Courtesy of Béla Andrásfai.
Julia Robinson, p. 338: Portrait of Julia Robinson, unknown photographer,
courtesy of Neil D. Reid. The Open Logic Project has obtained permission to
use this image for inclusion in non-commercial OLP-derived materials. Per-
mission is required for any other use.
Bertrand Russell, p. 340: Portrait of Bertrand Russell, ca. 1907, courtesy of
the William Ready Division of Archives and Research Collections, McMaster
University Library. Bertrand Russell Archives, Box 2, f. 4.
363
P HOTO C REDITS
Alfred Tarski, p. 341: Passport photo of Alfred Tarski, 1939. Cropped and
restored from a scan of Tarski’s passport by Joel Fuller. Original courtesy
of Bancroft Library, University of California, Berkeley. Alfred Tarski Papers,
Banc MSS 84/49. The Open Logic Project has obtained permission to use this
image for inclusion in non-commercial OLP-derived materials. Permission
from Bancroft Library is required for any other use.
Alan Turing, p. 342: Portrait of Alan Mathison Turing by Elliott & Fry, 29
March 1951, NPG x82217, © National Portrait Gallery, London. Used under a
Creative Commons BY-NC-ND 3.0 license.
Ernst Zermelo, p. 344: Portrait of Ernst Zermelo, ca. 1922, courtesy of the
Abteilung für Handschriften und Seltene Drucke, Niedersächsische Staats-
und Universitätsbibliothek Göttingen, Cod. Ms. D. Hilbert 754, Bl. 6 Nr. 25.
364
Bibliography
Andrásfai, Béla. 1986. Rózsa (Rosa) Péter. Periodica Polytechnica Electrical Engi-
neering 30(2-3): 139–145. URL http://www.pp.bme.hu/ee/article/view/
4651.
Csicsery, George. 2016. Zala films: Julia Robinson and Hilbert’s tenth problem.
URL http://www.zalafilms.com/films/juliarobinson.html.
Dauben, Joseph. 1990. Georg Cantor: His Mathematics and Philosophy of the Infi-
nite. Princeton: Princeton University Press.
Davis, Martin, Hilary Putnam, and Julia Robinson. 1961. The decision prob-
lem for exponential Diophantine equations. Annals of Mathematics 74(3):
425–436. URL http://www.jstor.org/stable/1970289.
365
B IBLIOGRAPHY
Duncan, Arlene. 2015. The Bertrand Russell Research Centre. URL http:
//russell.mcmaster.ca/.
Enderton, Herbert B. 2019. Alonzo Church: Life and Work. In The Collected
Works of Alonzo Church, eds. Tyler Burge and Herbert B. Enderton. Cam-
bridge, MA: MIT Press.
Feferman, Anita and Solomon Feferman. 2004. Alfred Tarski: Life and Logic.
Cambridge: Cambridge University Press.
Frege, Gottlob. 1884. Die Grundlagen der Arithmetik: Eine logisch mathematische
Untersuchung über den Begriff der Zahl. Breslau: Wilhelm Koebner. Transla-
tion in Frege (1953).
Frey, Holly and Tracy V. Wilson. 2015. Stuff you missed in history class:
Emmy Noether, mathematics trailblazer. URL https://www.iheart.
com/podcast/stuff-you-missed-in-history-cl-21124503/episode/
emmy-noether-mathematics-trailblazer-30207491/. Podcast audio.
366
Bibliography
Gödel, Kurt. 1929. Über die Vollständigkeit des Logikkalküls [On the com-
pleteness of the calculus of logic]. Dissertation, Universität Wien. Reprinted
and translated in Feferman et al. (1986), pp. 60–101.
Gödel, Kurt. 1931. über formal unentscheidbare Sätze der Principia Mathe-
matica und verwandter Systeme I [On formally undecidable propositions
of Principia Mathematica and related systems I]. Monatshefte für Mathematik
und Physik 38: 173–198. Reprinted and translated in Feferman et al. (1986),
pp. 144–195.
Institute, Perimeter. 2015. Emmy Noether: Her life, work, and influence. URL
https://www.youtube.com/watch?v=tNNyAyMRsgE. Video Lecture.
Irvine, Andrew David. 2015. Sound clips of Bertrand Russell speaking. URL
http://plato.stanford.edu/entries/russell/russell-soundclips.
html.
John Dawson, Jr. 1997. Logical Dilemmas: The Life and Work of Kurt Gödel. Boca
Raton: CRC Press.
367
B IBLIOGRAPHY
Menzler-Trott, Eckart. 2007. Logic’s Lost Genius: The Life of Gerhard Gentzen.
Providence: American Mathematical Society.
O’Connor, John J. and Edmund F. Robertson. 2014. Rózsa Péter. URL http:
//www-groups.dcs.st-and.ac.uk/~history/Biographies/Peter.html.
Péter, Rózsa. 1935a. Über den Zusammenhang der verschiedenen Begriffe der
rekursiven Funktion. Mathematische Annalen 110: 612–632.
Potter, Michael. 2004. Set Theory and its Philosophy. Oxford: Oxford University
Press.
Reid, Constance. 1986. The autobiography of Julia Robinson. The College Math-
ematics Journal 17: 3–21.
368
Bibliography
Robinson, Julia. 1996. The Collected Works of Julia Robinson. Providence: Amer-
ican Mathematical Society.
Solow, Daniel. 2013. How to Read and Do Proofs. Hoboken, NJ: Wiley.
Steinhart, Eric. 2018. More Precisely: The Math You Need to Do Philosophy. Pe-
terborough, ON: Broadview, 2nd ed.
Sykes, Christopher. 1992. BBC Horizon: The strange life and death of Dr. Tur-
ing. URL https://www.youtube.com/watch?v=gyusnGbBSHE.
369
B IBLIOGRAPHY
Takeuti, Gaisi, Nicholas Passell, and Mariko Yasugi. 2003. Memoirs of a Proof
Theorist: Gödel and Other Logicians. Singapore: World Scientific.
Tamassy, Istvan. 1994. Interview with Róza Péter. Modern Logic 4(3): 277–280.
Tarski, Alfred. 1981. The Collected Works of Alfred Tarski, vol. I–IV. Basel:
Birkhäuser.
Zermelo, Ernst. 1904. Beweis, daß jede Menge wohlgeordnet werden kann.
Mathematische Annalen 59: 514–516. English translation in (Ebbinghaus
et al., 2010, pp. 115–119).
370