OL Sets and Computation
OL Sets and Computation
Computation
An Open Introduction to
Metalogic
F21
Sets, Logic, Computation
The Open Logic Project
Instigator
Richard Zach, University of Calgary
Editorial Board
Aldo Antonelli,† University of California, Davis
Andrew Arana, Université de Lorraine
Jeremy Avigad, Carnegie Mellon University
Tim Button, University College London
Walter Dean, University of Warwick
Gillian Russell, Dianoia Institute of Philosophy
Nicole Wyatt, University of Calgary
Audrey Yap, University of Victoria
Contributors
Samara Burns, Columbia University
Dana Hägg, University of Calgary
Zesen Qian, Carnegie Mellon University
Sets, Logic, Computation
An Open Introduction to Metalogic
Fall 2021
The Open Logic Project would like to acknowledge the gener-
ous support of the Taylor Institute of Teaching and Learning of
the University of Calgary, and the Alberta Open Educational Re-
sources (ABOER) Initiative, which is made possible through an
investment from the Alberta government.
1 Sets 2
1.1 Extensionality . . . . . . . . . . . . . . . . . . . . 2
1.2 Subsets and Power Sets . . . . . . . . . . . . . . . 4
1.3 Some Important Sets . . . . . . . . . . . . . . . . 5
1.4 Unions and Intersections . . . . . . . . . . . . . . 6
1.5 Pairs, Tuples, Cartesian Products . . . . . . . . . 10
1.6 Russell’s Paradox . . . . . . . . . . . . . . . . . . 12
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2 Relations 16
2.1 Relations as Sets . . . . . . . . . . . . . . . . . . 16
2.2 Special Properties of Relations . . . . . . . . . . . 18
2.3 Equivalence Relations . . . . . . . . . . . . . . . 20
2.4 Orders . . . . . . . . . . . . . . . . . . . . . . . . 21
2.5 Graphs . . . . . . . . . . . . . . . . . . . . . . . . 24
2.6 Operations on Relations . . . . . . . . . . . . . . 26
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 28
v
CONTENTS vi
3 Functions 29
3.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 Kinds of Functions . . . . . . . . . . . . . . . . . 32
3.3 Functions as Relations . . . . . . . . . . . . . . . 34
3.4 Inverses of Functions . . . . . . . . . . . . . . . . 36
3.5 Composition of Functions . . . . . . . . . . . . . 38
3.6 Partial Functions . . . . . . . . . . . . . . . . . . 40
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 41
II First-order Logic 69
15 Undecidability 288
15.1 Introduction . . . . . . . . . . . . . . . . . . . . . 288
15.2 Enumerating Turing Machines . . . . . . . . . . . 290
15.3 Universal Turing Machines . . . . . . . . . . . . . 293
15.4 The Halting Problem . . . . . . . . . . . . . . . . 296
15.5 The Decision Problem . . . . . . . . . . . . . . . 299
15.6 Representing Turing Machines . . . . . . . . . . . 300
15.7 Verifying the Representation . . . . . . . . . . . . 304
15.8 The Decision Problem is Unsolvable . . . . . . . 310
15.9 Trakthenbrot’s Theorem . . . . . . . . . . . . . . 312
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 317
A Proofs 321
A.1 Introduction . . . . . . . . . . . . . . . . . . . . . 321
A.2 Starting a Proof . . . . . . . . . . . . . . . . . . . 323
A.3 Using Definitions . . . . . . . . . . . . . . . . . . 323
A.4 Inference Patterns . . . . . . . . . . . . . . . . . . 326
A.5 An Example . . . . . . . . . . . . . . . . . . . . . 334
A.6 Another Example . . . . . . . . . . . . . . . . . . 338
A.7 Proof by Contradiction . . . . . . . . . . . . . . . 340
A.8 Reading Proofs . . . . . . . . . . . . . . . . . . . 345
A.9 I Can’t Do It! . . . . . . . . . . . . . . . . . . . . 347
A.10 Other Resources . . . . . . . . . . . . . . . . . . 349
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 350
CONTENTS xi
B Induction 351
B.1 Introduction . . . . . . . . . . . . . . . . . . . . . 351
B.2 Induction on N . . . . . . . . . . . . . . . . . . . 352
B.3 Strong Induction . . . . . . . . . . . . . . . . . . 355
B.4 Inductive Definitions . . . . . . . . . . . . . . . . 356
B.5 Structural Induction . . . . . . . . . . . . . . . . 359
B.6 Relations and Functions . . . . . . . . . . . . . . 361
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 365
C Biographies 366
C.1 Georg Cantor . . . . . . . . . . . . . . . . . . . . 366
C.2 Alonzo Church . . . . . . . . . . . . . . . . . . . 367
C.3 Gerhard Gentzen . . . . . . . . . . . . . . . . . . 368
C.4 Kurt Gödel . . . . . . . . . . . . . . . . . . . . . . 370
C.5 Emmy Noether . . . . . . . . . . . . . . . . . . . 372
C.6 Bertrand Russell . . . . . . . . . . . . . . . . . . . 374
C.7 Alfred Tarski . . . . . . . . . . . . . . . . . . . . 376
C.8 Alan Turing . . . . . . . . . . . . . . . . . . . . . 377
C.9 Ernst Zermelo . . . . . . . . . . . . . . . . . . . . 379
Glossary 382
Bibliography 391
xiii
PREFACE xiv
shorthand symbols for these, and think through the general prop-
erties of sets, relations, and functions. If you are not used to think-
ing mathematically and to formulating mathematical proofs, then
think of the first part on set theory as a training ground: all the
basic definitions will be given, and we’ll give increasingly compli-
cated proofs using them. Note that understanding these proofs—
and being able to find and formulate them yourself—is perhaps
more important than understanding the results, especially in the
first part. If mathematical thinking is new to you, it is important
that you think through the examples and problems.
In the first part we will establish one important result, how-
ever. This result—Cantor’s theorem—relies on one of the most
striking examples of conceptual analysis to be found anywhere
in the sciences, namely, Cantor’s analysis of infinity. Infinity has
puzzled mathematicians and philosophers alike for centuries. Un-
til Cantor, no-one knew how to properly think about it. Many
people even considered it a mistake to think about it at all, and
believed that the notion of an infinite collection itself was incoher-
ent. Cantor made infinity into a subject we can coherently work
with, and developed an entire theory of infinite collections—and
infinite numbers with which we can measure the sizes of infinite
collections. He showed that there are different levels of infinity.
This theory of “transfinite” numbers is beautiful and intricate,
and we won’t get very far into it; but we will be able to show
that there are different levels of infinity, specifically, that there
are “countable” and “uncountable” levels of infinity. This result
has important applications, but it is also really the kind of result
that any self-respecting mathematician, computer scientist, and
philosopher should know.
In part II, we turn to first-order logic. We will define the lan-
guage of first-order logic and its semantics, i.e., what first-order
structures are and when a sentence of first-order logic is true in a
structure. This will enable us to do two important things: (1) We
can define, with mathematical precision, when a sentence is a
logical consequence of another. (2) We can also consider how
the relations that make up a first-order structure are described—
PREFACE xvi
Sets,
Relations,
Functions
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.
2
CHAPTER 1. SETS 3
℘(A) = {B : B ⊆ A}
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)
CHAPTER 1. SETS 6
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 num-
bers B = {0, 1}.
Figure 1.1: The union A ∪ B of two sets is set of elements of A together with
those of B.
Figure 1.2: The intersection A ∩ B of two sets is the set of elements they have in
common.
A ∩ B = {x : x ∈ A ∧ x ∈ B }
least one element of the set, and the intersection as the set of all
objects which belong to every element of the set.
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.
A \ B = {x : x ∈ A and x ∉ B }.
A × B = {⟨x, y⟩ : x ∈ A and y ∈ B }.
A1 = A
Ak +1 = Ak × A
Bx 1 = {⟨x 1 , y 1 ⟩ ⟨x 1 , y 2 ⟩ . . . ⟨x 1 , y m ⟩}
Bx 2 = {⟨x 2 , y 1 ⟩ ⟨x 2 , y 2 ⟩ . . . ⟨x 2 , y m ⟩}
.. ..
. .
Bxn = {⟨x n , y 1 ⟩ ⟨x n , y 2 ⟩ . . . ⟨x n , y m ⟩}
Since the x i 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.□
A∗ = {∅} ∪ A ∪ A2 ∪ A3 ∪ . . .
R = {x : x ∉ x }
Summary
A set is a collection of objects, the elements of the set. We write
x ∈ A if x is an element of A. Sets are extensional—they are
completely determined by their elements. Sets are specified by
listing the elements explicitly or by giving a property the ele-
ments share (abstraction). Extensionality means that the order
or way of listing or specifying the elements of a set doesn’t mat-
ter. To prove that A and B are the same set (A = B) one has to
prove that every element of X is an element of Y and vice versa.
Important sets include the natural (N), integer (Z), rational
(Q), and real (R) numbers, but also strings (X ∗ ) and infinite
sequences (X 𝜔 ) of objects. A is a subset of B, A ⊆ B, if every
element of A is also one of B. The collection of all subsets of
a set B is itself a set, the power set ℘(B) of B. We can form
the union A ∪ B and intersection A ∩ B of sets. An ordered
pair ⟨x, y⟩ consists of two objects x and y, but in that specific
order. The pairs ⟨x, y⟩ and ⟨y,x⟩ are different pairs (unless x = y).
The set of all pairs ⟨x, y⟩ where x ∈ A and y ∈ B is called the
Cartesian product A × B of A and B. We write A2 for A × A; so
for instance N2 is the set of pairs of natural numbers.
CHAPTER 1. SETS 15
Problems
Problem 1.1. Prove that there is at most one empty set, i.e.,
show that if A and B are sets without elements, then A = B.
Relations
2.1 Relations as Sets
In section 1.3, we mentioned some important sets: N, Z, Q, R.
You will no doubt remember some interesting relations between
the elements of some of these sets. For instance, each of these sets
has a completely standard order relation on it. There is also the
relation is identical with that every object bears to itself and to no
other thing. There are many more interesting relations that we’ll
encounter, and even more possible relations. Before we review
them, though, we will start by pointing out that we can look at
relations as a special sort of set.
For this, recall two things from section 1.5. First, recall the
notion of a ordered pair: given a and b, we can form ⟨a,b⟩. Im-
portantly, the order of elements does matter here. So if a ≠ b
then ⟨a,b⟩ ≠ ⟨b,a⟩. (Contrast this with unordered pairs, i.e., 2-
element sets, where {a,b } = {b,a}.) Second, recall the notion of
a Cartesian product: if A and B are sets, then we can form A × B,
the set of all pairs ⟨x, y⟩ with x ∈ A and y ∈ B. In particular,
A2 = A × A is the set of all ordered pairs from A.
Now we will consider a particular relation on a set: the <-
relation on the set N of natural numbers. Consider the set of all
pairs of numbers ⟨n,m⟩ where n < m, i.e.,
16
CHAPTER 2. RELATIONS 17
L = {⟨0, 1⟩, ⟨0, 2⟩, . . . , ⟨1, 2⟩, ⟨1, 3⟩, . . . , ⟨2, 3⟩, ⟨2, 4⟩, . . .},
CHAPTER 2. RELATIONS 18
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⟩, . . . },
2.4 Orders
Many of our comparisons involve describing some objects as be-
ing “less than”, “equal to”, or “greater than” other objects, in a
certain respect. These involve order relations. But there are differ-
ent 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
taxonomy here.
CHAPTER 2. RELATIONS 22
2.5 Graphs
A graph is a diagram in which points—called “nodes” or “ver-
tices” (plural of “vertex”)—are connected by edges. Graphs are
a ubiquitous tool in discrete mathematics and in computer sci-
ence. They are incredibly useful for representing, and visualizing,
relationships and structures, from concrete things like networks
of various kinds to abstract structures such as the possible out-
comes of decisions. There are many different kinds of graphs in
CHAPTER 2. RELATIONS 25
1 2 4
3
CHAPTER 2. RELATIONS 26
1 2
Summary
A relation R on a set A is a way of relating elements of A. We
write Rxy if the relation holds between x and y. Formally, we can
consider R as the sets of pairs ⟨x, y⟩ ∈ A2 such that Rxy. Being
less than, greater than, equal to, evenly dividing, being the same
length as, a subset of, and the same size as are all important
examples of relations (on sets of numbers, strings, or of sets).
Graphs are a general way of visually representing relations. But
a graph can also be seen as a binary relation (the edge relation)
together with the underlying set of vertices.
Some relations share certain features which makes them espe-
cially interesting or useful. A relation R is reflexive if everything
is R-related to itself; symmetric, if with Rxy also Ryx holds for
any x and y; and transitive if Rxy and Ryz guarantees Rxz . Re-
lations that have all three of these properties are equivalence
relations. A relation is anti-symmetric if Rxy and Ryx guaran-
tees x = y. Partial orders are those relations that are reflexive,
anti-symmetric, and transitive. A linear order is any partial or-
der which satisfies that for any x and y, either Rxy or x = y or
Ryx. (Generally, a relation with this property is connected).
Since relations are sets (of pairs), they can be operated on as
sets (e.g., we can form the union and intersection of relations).
We can also chain them together (relative product R | S ). If we
CHAPTER 2. RELATIONS 28
Problems
Problem 2.1. List the elements of the relation ⊆ on the set
℘({a,b,c }).
Functions
3.1 Basics
A function is a map which sends each element of a given set to a
specific element in some (other) given set. For instance, the op-
eration 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 in-
puts and returns some kind of output. Many functions are fa-
miliar to us from basic arithmetic. For instance, addition and
multiplication are functions. They take in two numbers and re-
turn 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.
29
CHAPTER 3. FUNCTIONS 30
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.
method for computing the value, or listing the values for each
argument. However functions are defined, we must make sure
that for each argment we specify one, and only one, value.
Example 3.5. Let f : N → N be defined such that f (x) = x + 1.
This is a definition that specifies f as a function which takes in
natural numbers and outputs natural numbers. It tells us that,
given a natural number x, f will output its successor x + 1. In
this case, the codomain N is not the range of f , since the natural
number 0 is not the successor of any natural number. The range
of f is the set of all positive integers, Z+ .
Example 3.6. Let g : N → N be defined such that g (x) = x +2−1.
This tells us that g is a function which takes in natural numbers
and outputs natural numbers. Given a natural number n, g will
output the predecessor of the successor of the successor of x, i.e.,
x + 1.
We just considered two functions, f and g , with different def-
initions. However, these are the same function. After all, for any
natural number n, we have that f (n) = n + 1 = n + 2 − 1 = g (n).
Otherwise put: our definitions for f and g specify the same map-
ping by means of different equations. Implicitly, then, we are
relying upon a principle of extensionality for functions,
if ∀x f (x) = g (x), then f = g
provided that f and g share the same domain and codomain.
Example 3.7. We can also define functions by cases. For in-
stance, we could define h : N → N by
{︄
x
2 if x is even
h (x) = x+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.
CHAPTER 3. FUNCTIONS 32
Figure 3.2: A surjective function has every element of the codomain as a value.
Figure 3.3: An injective function never maps two different arguments to the
same value.
Figure 3.4: A bijective function uniquely pairs the elements of the codomain
with those of the domain.
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. Moreover, it has to
be specified for every y ∈ B. If there are x 1 and x 2 ∈ A with
x 1 ≠ x 2 but f (x 1 ) = f (x 2 ), then g (y) would not be uniquely
specified for y = f (x 1 ) = f (x 2 ). And if there is no x at all such
that f (x) = y, then g (y) is 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
CHAPTER 3. FUNCTIONS 37
Proof. Exercise. □
Proof. Exercise. □
Summary
A function f : A → B maps every element of the domain A to a
unique element of the codomain B. If x ∈ A, we call the y that f
maps x to the value f (x) of f for argument x. If A is a set of
pairs, we can think of the function f as taking two arguments.
The range ran( f ) of f is the subset of B that consists of all the
values of f .
If ran( f ) = B then f is called surjective. The value f (x) is
unique in that f maps x to only one f (x), never more than one.
If f (x) is also unique in the sense that no two different arguments
are mapped to the same value, f is called injective. Functions
which are both injective and surjective are called bijective.
Bijective functions have a unique inverse function f −1 . Func-
tions can also be chained together: the function (g ◦ f ) is the
composition of f with g . Compositions of injective functions are
injective, and of surjective functions are surjective, and ( f −1 ◦ f )
is the identity function.
If we relax the requirement that f must have a value for every
x ∈ A, we get the notion of a partial functions. If f : A → ↦ B
is partial, we say f (x) is defined, f (x) ↓ if f has a value for
argument x, and otherwise we say that f (x) is undefined, f (x) ↑.
Any (partial) function f is associated with the graph R f of f ,
the relation that holds iff f (x) = y.
Problems
Problem 3.1. Show that if f : A → B has a left inverse g , then
f is injective.
43
CHAPTER 4. THE SIZE OF SETS 44
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.
−⌈ 20 ⌉ ⌈ 21 ⌉ −⌈ 22 ⌉ ⌈ 23 ⌉ −⌈ 42 ⌉ ⌈ 25 ⌉ −⌈ 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
⎩
CHAPTER 4. THE SIZE OF SETS 47
N × N = {⟨n,m⟩ : n,m ∈ N}
CHAPTER 4. THE SIZE OF SETS 49
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⟩ ...
.. .. .. .. .. ..
. . . . . .
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⟩, . . .
N × N × N = {⟨n,m,k ⟩ : n,m,k ∈ N}
N3 = (N × N) × N = {⟨⟨n,m⟩,k ⟩ : n,m,k ∈ N}
(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 subtract n from it. And it populates the array
in exactly the way we would like. So in particular, the pair ⟨1, 2⟩
is sent to 4×3
2 + 1 = 7.
This function g is the inverse of an enumeration of a set of
pairs. Such functions are called pairing functions.
Repeat this with pairs ⟨1,m⟩ for the place that still remain empty,
again skipping 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⟩ ...
ment:
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.
Let’s call the j -th element of the i -th sequence in this list si ( j ).
Then the i -th sequence si is
1 2 3 4 ...
1 s1 (1) s 1 (2) s1 (3) s 1 (4) ...
2 s 2 (1) s2 (2) s2 (3) s 2 (4) ...
3 s 3 (1) s 3 (2) s3 (3) s 3 (4) ...
4 s 4 (1) s 4 (2) s4 (3) s4 (4) ...
.. .. .. .. .. ..
. . . . . .
The labels down the side give the number of the sequence in the
list s 1 , s 2 , . . . ; the numbers across the top label the elements of the
individual sequences. For instance, s 1 (1) is a name for whatever
number, a 0 or a 1, is the first element in the sequence s 1 , and so
on.
Now we construct an infinite sequence, s , of 0’s and 1’s which
cannot possibly be on this list. The definition of s will depend on
the list s 1 , s 2 , . . . . 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 spec-
ify 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.
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
CHAPTER 4. THE SIZE OF SETS 57
Z 1 ,Z 2 ,Z 3 , . . .
Z = {n ∈ Z+ : n ∉ Z n } □
Z1 = {1, 2, 3, 4, 5, 6, . . . }
Z2 = { 2, 4, 6, . . . }
Z3 = {1, 2, 5 }
Z4 = { 3, 4, 5, 6, . . . }
.. ..
. .
4.7 Reduction
We showed ℘(Z+ ) to be uncountable by a diagonalization argu-
ment. 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 count-
able 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𝜔 .
How do we reduce the problem of enumerating a set B to
that of enumerating a set A? We provide a way of turning an
enumeration of A into an enumeration of B. The easiest way to
do that is to define a surjective function f : A → B. If x 1 , x 2 , . . .
enumerates A, then f (x 1 ), f (x 2 ), . . . would enumerate B. In our
case, we are looking for a surjective function f : ℘(Z+ ) → B𝜔 .
f (Z 1 ), f (Z 2 ), f (Z 3 ), . . .
h (n) = 000 . . . 0
⏞ˉˉˉˉ⏟⏟ˉˉˉˉ⏞
n 0’s
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:
A = {x ∈ A : x ∉ g (x)}.
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 Z 1 , Z 2 , . . . , 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 in-
spiration for Russell’s own paradox.
Summary
The size of a set A can be measured by a natural number if the set
is finite, and sizes can be compared by comparing these numbers.
If sets are infinite, things are more complicated. The first level of
infinity is that of countably infinite sets. A set A is countable
if its elements can be arranged in an enumeration, a one-way
infinite list, i.e., when there is a surjective function f : Z+ → A. It
is countably infinite if it is countable but not finite. Cantor’s zig-
zag method shows that the sets of pairs of elements of countably
infinite sets is also countable; and this can be used to show that
even the set of rational numbers Q is countable.
There are, however, infinite sets that are not countable: these
sets are called uncountable. There are two ways of showing that
a set is uncountable: directly, using a diagonal argument, or
by reduction. To give a diagonal argument, we assume that the
set A in question is countable, and use a hypothetical enumera-
tion to define an element of A which, by the very way we define
it, is guaranteed to be different from every element in the enu-
meration. So the enumeration can’t be an enumeration of all
of A after all, and we’ve shown that no enumeration of A can
exist. A reduction shows that A is uncountable by associating
every element of A with an element of some known uncountable
set B in a surjective way. If this is possible, than a hypothetical
enumeration of A would yield an enumeration of B. Since B is
uncountable, no enumeration of A can exist.
In general, infinite sets can be compared sizewise: A and
B are the same size, or equinumerous, if there is a bijection
between them. We can also define that A is no larger than B
(A ⪯ B) if there is an injective function from A to B. By the
Schröder-Bernstein Theorem, this in fact provides a sizewise or-
der of infinite sets. Finally, Cantor’s theorem says that for any
CHAPTER 4. THE SIZE OF SETS 65
Problems
Problem 4.1. Define an enumeration of the positive squares 1,
4, 9, 16, . . .
Problem 4.12. Show that the set of all finite subsets of an arbi-
trary infinite countable set is countable.
Problem 4.20. Show that the set of all sets of pairs of positive
integers is uncountable by a reduction argument.
Problem 4.23. Let P be the set of functions from the set of posi-
tive 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 enumerat-
ing B𝜔 to enumerating Q ).
Problem 4.25. Show that the set R of all real numbers is un-
countable.
First-order
Logic
69
CHAPTER 5
Introduction to
First-Order
Logic
5.1 First-Order Logic
You are probably familiar with first-order logic from your first in-
troduction to formal logic.1 You may know it as “quantificational
logic” or “predicate logic.” First-order logic, first of all, is a for-
mal language. That means, it has a certain vocabulary, and its
expressions are strings from this vocabulary. But not every string
is permitted. There are different kinds of permitted expressions:
terms, formulas, and sentences. We are mainly interested in sen-
tences of first-order logic: they provide us with a formal analogue
of sentences of English, and about them we can ask the questions
a logician typically is interested in. For instance:
70
CHAPTER 5. INTRODUCTION TO FIRST-ORDER LOGIC 71
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 spe-
cific 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 sen-
tences of first-order logic, you can build more complex ones using
the second part of the vocabulary: the logical symbols (connec-
tives and quantifiers). So, for instance, we can form expressions
like (P (a) ∧ Q(b)) or ∃x P (x).
In order to provide the precise definitions of semantics and
the rules of our derivation systems required for rigorous meta-
CHAPTER 5. INTRODUCTION TO FIRST-ORDER LOGIC 73
5.3 Formulas
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: formu-
las. 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 be-
cause 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 con-
stant symbol a, and only the logical symbols ¬, ∧, and ∃. Our
full definitions will be much more general: we’ll allow infinitely
CHAPTER 5. INTRODUCTION TO FIRST-ORDER LOGIC 74
(1) tell us that P (a) and P (vi ) are formulas, for any i ∈ N.
These are the so-called atomic formulas. They give us something
to start from. The other clauses give us ways of forming new
formulas from ones we have already formed. So for instance, we
get that ¬P (v2 ) is a formula, since P (v2 ) is already a formula by
(1), and then 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 formulas. In particular, ∃v0 P (a) and ∃v0 ∃v0 P (a) do count as
formulas, and (¬P (a)) does not.
This way of defining formulas is called an inductive definition,
and it allows us to prove things about formulas 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 formulas you show first that it is true for the atomic
formulas, and then that if it’s true for any formula A (and B),
it’s also true for ¬A, (A ∧ B), and ∃x A. For instance, this proves
that it’s true for ∃v2 ¬P (v2 ): from the first part you know that
CHAPTER 5. INTRODUCTION TO FIRST-ORDER LOGIC 75
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 formulas are inductively generated
from atomic formulas, 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 formulas 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 formulas
that don’t contain variables. The idea is to give an inductive
definition that mirrors the way we have defined formulas. We
specify when an atomic formula is satisfied in M, and then when,
e.g., ¬A is satisfied in M on the basis of whether or not A is
satisfied in M. E.g., we could define:
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 that ¬¬P (a) is and (¬P (a) ∧ P (a)) is not
satisfied, and so on.
CHAPTER 5. INTRODUCTION TO FIRST-ORDER LOGIC 76
Ok, this solves one problem: we can now say when M satis-
fies 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 nota-
tion 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 ).
If this looks confusing and cumbersome: it is. But the added
complexity is required to give a precise, inductive definition of
satisfaction for all formulas, 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 structures and formulas. But it needs this additional bit—
a variable assignment—and what we wanted is a definition of
sentences. How do we get rid of assignments, and what are sen-
tences?
You probably remember a discussion in your first introduction
to formal logic about the relation between variables and quanti-
fiers. A quantifier is always 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
formulas 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 formulas
that have no free variables.
Again, the intuitive idea of when an occurrence of a variable
in a formula A 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 for-
mulas by induction, we can give a definition of the free and bound
CHAPTER 5. INTRODUCTION TO FIRST-ORDER LOGIC 78
5.7 Substitution
We’ll discuss an example to illustrate how things hang together,
and how the development of syntax and semantics lays the foun-
dation for our more advanced 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. However, 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 A, and term t , and variable x. (Re-
call that constant symbols are terms, but we’ll consider also more
complicated terms built from constant symbols and function sym-
bols.) So we want to be able to say something like, “whenever
you have derived ∀x A(x) you are justified in inferring A(t )—the
result of removing ∀x and replacing x by t .” But what exactly
CHAPTER 5. INTRODUCTION TO FIRST-ORDER LOGIC 80
∀v0 P (v0 , v0 )
∀v0 ∀v1 ∀v2 ((P (v0 , v1 ) ∧ P (v1 , v2 )) → P (v0 , v2 ))
Syntax of
First-Order
Logic
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 expres-
sions. The expressions of first-order logic are terms and formulas.
Terms are formed from variables, constant symbols, and function
symbols. Formulas, in turn, are formed from predicate symbols
together with terms (these form the smallest, “atomic” formu-
las), and then from atomic formulas we can form more complex
ones using 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 se-
lect 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 formulas induc-
tively. If done properly, every expression can result essentially
84
CHAPTER 6. SYNTAX OF FIRST-ORDER LOGIC 85
1. Logical symbols
1. ⊥ is an atomic formula.
1. ⊤ abbreviates ¬⊥.
2. A ↔ B abbreviates (A → B) ∧ (B → A).
CHAPTER 6. SYNTAX OF FIRST-ORDER LOGIC 90
1. We take D to be A and D → D to be B.
2. We take A to be D → D and B is D.
Let l (A) be the number of left parentheses, and r (A) the num-
ber of right parentheses in A, and l (t ) and r (t ) similarly the num-
ber of left and right parentheses in a term t . We leave the proof
that for any term t , l (t ) = r (t ) as an exercise.
7. A ≡ ∃x B: Similarly. □
Proof. Exercise. □
CHAPTER 6. SYNTAX OF FIRST-ORDER LOGIC 93
1. A ≡ ⊥.
Proof. Exercise. □
1. A is atomic.
3. A is of the form (B ∧ C ).
4. A is of the form (B ∨ C ).
5. A is of the form (B → C ).
6. A is of the form ∀x B.
7. A is of the form ∃x B.
6.6 Subformulas
It is often useful to talk about the formulas that “make up” a
given formula. We call these its subformulas. Any formula counts
as a subformula of itself; a subformula of A other than A itself is
a proper subformula.
B is the scope of the first ∀v0 , C is the scope of ∃v1 , and D is the
scope of the second ∀v0 . The first ∀v0 binds the occurrences of v0
in B, ∃v1 the occurrence of v1 in C , and the second ∀v0 binds the
occurrence of v0 in D. The first occurrence of v1 and the fourth
occurrence of v0 are free in A. The last occurrence of v0 is free
in D, but bound in C and A.
6.8 Substitution
CHAPTER 6. SYNTAX OF FIRST-ORDER LOGIC 99
1. s ≡ c : s [t /x] is just s .
3. s ≡ x: s [t /x] is t .
Example 6.24.
1. A ≡ ⊥: A[t /x] is ⊥.
Summary
A first-order language consists of constant, function, and
predicate symbols. Function and constant symbols take a speci-
fied number of arguments. In the language of arithmetic, e.g.,
we have a single constant symbol 0, one 1-place function sym-
bol ′, two 2-place function symbols + and ×, and one 2-place
predicate symbol <. From variables and constant and function
symbols we form the terms of a language. From the terms of
a language together with its predicate symbols, as well as the
identity symbol =, we form the atomic formulas. And in turn
from them, using the logical connectives ¬, ∨, ∧, →, ↔ and the
quantifiers ∀ and ∃ we form its formulas. Since we are careful to
always include necessary parentheses in the process of forming
terms and formulas, there is always exactly one way of reading a
formula. This makes it possible to define things by induction on
the structure of formulas.
Occurrences of variables in formulas are sometimes governed
by a corresponding quantifier: if a variable occurs in the scope
of a quantifier it is considered bound, otherwise free. These
concepts all have inductive definitions, and we also inductively
define the operation of substitution of a term for a variable in
a formula. Formulas without free variable occurrences are called
sentences.
Problems
Problem 6.1. Prove Lemma 6.10.
Semantics of
First-Order
Logic
7.1 Introduction
Giving the meaning of expressions is the domain of semantics.
The central concept in semantics is that of satisfaction in a struc-
ture. A structure gives meaning to the building blocks of the
language: a domain is a non-empty set of objects. The quanti-
fiers are interpreted as ranging over this domain, constant sym-
bols are assigned elements in the domain, function symbols are
assigned functions from the domain to itself, and predicate sym-
bols are assigned relations on the domain. The domain together
with assignments to the basic vocabulary constitutes a structure.
Variables may appear in formulas, and in order to give a seman-
tics, we also have to assign elements of the domain to them—this
is a variable assignment. The satisfaction relation, finally, brings
these together. A formula may be satisfied in a structure M rela-
tive to a variable assignment s , written as M,s ⊨ A. This relation
is also defined by induction on the structure of A, using the truth
102
CHAPTER 7. SEMANTICS OF FIRST-ORDER LOGIC 103
1. |N| = N
2. 0N = 0
ValM (t ) = f M
(ValM (t1 ), . . . , ValM (tn )).
1. t ≡ c : ValsM (t ) = c M .
2. t ≡ x: ValsM (t ) = s (x).
3. t ≡ f (t1 , . . . ,tn ):
ValsM (t ) = f M
(ValsM (t1 ), . . . , ValsM (tn )).
1. A ≡ ⊥: M,s ⊭ A.
CHAPTER 7. SEMANTICS OF FIRST-ORDER LOGIC 109
1. |M| = {1, 2, 3, 4}
2. a M = 1
3. b M = 2
4. f M (x, y) = x + y if x + y ≤ 3 and = 3 otherwise.
5. R M = {⟨1, 1⟩, ⟨1, 2⟩, ⟨2, 3⟩, ⟨2, 4⟩}
The function s (x) = 1 that assigns 1 ∈ |M| to every variable is a
variable assignment for M.
Then
ValsM ( f (a,b)) = f M
(ValsM (a), ValsM (b)).
ValsM ( f (a,b)) = f M
(1, 2) = 1 + 2 = 3.
ValsM ( f ( f (a,b),a)) = f M
(ValsM ( f (a,b)), ValsM (a)) = f M
(3, 1) = 3,
since 3 + 1 > 3. Since s (x) = 1 and ValsM (x) = s (x), we also have
ValsM ( f ( f (a,b),x)) = f M
(ValsM ( f (a,b)), ValsM (x)) = f M
(3, 1) = 3,
An atomic formula R (t1 ,t2 ) is satisfied if the tuple of values of
its arguments, i.e., ⟨ValsM (t1 ), ValsM (t2 )⟩, is an element of R M . So,
e.g., we have M,s ⊨ R (b, f (a,b)) since ⟨ValM (b), ValM ( f (a,b))⟩ =
⟨2, 3⟩ ∈ R M , but M,s ⊭ R (x, f (a,b)) since ⟨1, 3⟩ ∉ R M [s ].
To determine if a non-atomic formula A is satisfied, you apply
the clauses in the inductive definition that applies to the main con-
nective. For instance, the main connective in R (a,a) → (R (b,x) ∨
R (x,b) is the →, and
M,s ⊨ R (a,a) → (R (b,x) ∨ R (x,b)) iff
M,s ⊭ R (a,a) or M,s ⊨ R (b,x) ∨ R (x,b)
CHAPTER 7. SEMANTICS OF FIRST-ORDER LOGIC 111
s 1 = s [1/x], s2 = s [2/x],
s 3 = s [3/x], s4 = s [4/x].
So, e.g., s 2 (x) = 2 and s 2 (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 s 1 = s (s is always an
x-variant of itself).
To determine if an existentially quantified formula ∃x A(x) is
satisfied, we have to determine if M,s [m/x] ⊨ A(x) for at least
one m ∈ |M|. So,
since M,s [1/x] ⊨ R (b,x) ∨ R (x,b) (s [3/x] would also fit the bill).
But,
M,s ⊭ ∃x (R (b,x) ∧ R (x,b))
since, whichever m ∈ |M| we pick, M,s [m/x] ⊭ R (b,x) ∧ R (x,b).
To determine if a universally quantified formula ∀x A(x) is
satisfied, we have to determine if M,s [m/x] ⊨ A(x) for all m ∈
|M|. So,
M,s ⊨ ∀x (R (x,a) → R (a,x)),
since M,s [m/x] ⊨ R (x,a) → R (a,x) for all m ∈ |M|. For m = 1,
we have M,s [1/x] ⊨ R (a,x) so the consequent is true; for m = 2,
CHAPTER 7. SEMANTICS OF FIRST-ORDER LOGIC 112
Since M,s [3/x] ⊭ R (a,x) and M,s [4/x] ⊭ R (a,x), the inter-
esting cases where we have to worry about the consequent of
the conditional are only m = 1 and = 2. Does M,s [1/x] ⊨
∃y R (x, y) hold? It does if there is at least one n ∈ |M| so
that M,s [1/x] [n/y] ⊨ R (x, y). In fact, if we take n = 1, we
have s [1/x] [n/y] = s [1/y] = s . Since s (x) = 1, s (y) = 1, and
⟨1, 1⟩ ∈ R M , the answer is yes.
To determine if M,s [2/x] ⊨ ∃y R (x, y), we have to look
at the variable assignments s [2/x] [n/y]. Here, for n = 1,
this assignment is s 2 = s [2/x], which does not satisfy R (x, y)
(s 2 (x) = 2, s 2 (y) = 1, and ⟨2, 1⟩ ∉ R M ). However, consider
s [2/x] [3/y] = s 2 [3/y]. M,s 2 [3/y] ⊨ R (x, y) since ⟨2, 3⟩ ∈ R M ,
and so M,s 2 ⊨ ∃y R (x, y).
So, for all n ∈ |M|, either M,s [m/x] ⊭ R (a,x) (if m = 3, 4) or
M,s [m/x] ⊨ ∃y R (x, y) (if m = 1, 2), and so
so M,s 2 ⊨ t1 = t2 .
Now assume M,s 1 ⊨ B iff M,s 2 ⊨ B for all formulas B less com-
plex than A. The induction step proceeds by cases determined by
the main operator of A. In each case, we only demonstrate the
forward direction of the biconditional; the proof of the reverse
direction is symmetrical. In all cases except those for the quanti-
fiers, we apply the induction hypothesis to sub-formulas B of A.
The free variables of B are among those of A. Thus, if s 1 and s 2
agree on the free variables of A, they also agree on those of B,
and the induction hypothesis applies to B.
2. A ≡ B ∧ C : exercise.
4. A ≡ B → C : exercise.
6. A ≡ ∀x B: exercise.
Proof. Exercise. □
Proof. Exercise. □
7.6 Extensionality
Extensionality, sometimes called relevance, can be expressed in-
formally as follows: the only factors that bears upon the satisfac-
tion of formula A in a structure M relative to a variable assign-
ment 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 A.
One immediate consequence of extensionality is that where
two structures M and M ′ agree on all the elements of the lan-
guage appearing in a sentence A and have the same domain, M
and M ′ must also agree on whether or not A itself is true.
CHAPTER 7. SEMANTICS OF FIRST-ORDER LOGIC 117
Proof. By induction on t .
by induction hypothesis
= ValsM[ValM (t ′)/x ] (t ) by definition of ValsM[ValM (t ′)/x ] ( f (. . . )) □
s s
1. A(t ) ⊨ ∃x A(x)
CHAPTER 7. SEMANTICS OF FIRST-ORDER LOGIC 121
2. ∀x A(x) ⊨ A(t )
2. Exercise. □
Summary
The semantics for a first-order language is given by a structure
for that language. It consists of a domain and elements of that
domain are assigned to each constant symbol. Function symbols
are interpreted by functions and relation symbols by relation on
the domain. A function from the set of variables to the domain
is a variable assignment. The relation of satisfaction relates
structures, variable assignments and formulas; M,s ⊨ A is defined
by induction on the structure of A. M,s ⊨ A only depends on
the interpretation of the symbols actually occurring in A, and in
particular does not depend on s if A contains no free variables.
So if A is a sentence, M ⊨ A if M,s ⊨ A for any (or all) s .
The satisfaction relation is the basis for all semantic notions.
A sentence is valid, ⊨ A, if it is satisfied in every structure. A
sentence A is entailed by set of sentences 𝛤, 𝛤 ⊨ A, iff M ⊨ A for
all M which satisfy every sentence in 𝛤. A set 𝛤 is satisfiable iff
there is some structure that satisfies every sentence in 𝛤, other-
wise unsatisfiable. These notions are interrelated, e.g., 𝛤 ⊨ A iff
𝛤 ∪ {¬A} is unsatisfiable.
Problems
Problem 7.1. Is N, the standard model of arithmetic, covered?
Explain.
CHAPTER 7. SEMANTICS OF FIRST-ORDER LOGIC 122
1. |M| = {1, 2, 3}
2. c M = 3
1. A ≡ ⊥: not M ||= A.
Theories and
Their Models
8.1 Introduction
The development of the axiomatic method is a significant
achievement in the history of science, and is of special impor-
tance in the history of mathematics. 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 theo-
ries, 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.
124
CHAPTER 8. THEORIES AND THEIR MODELS 125
{ ∀x x ≤ x,
∀x ∀y ((x ≤ y ∧ y ≤ x) → x = y),
∀x ∀y ∀z ((x ≤ y ∧ y ≤ z ) → x ≤ z ) }
∀x ¬x < x,
∀x ∀y ((x < y ∨ y < x) ∨ x = y),
∀x ∀y ∀z ((x < y ∧ y < z ) → x < z )
∀x (x · 1) = x
∀x ∀y ∀z (x · (y · z )) = ((x · y) · z )
∀x ∃y (x · y) = 1
∀x ∀y (x ′ = y ′ → x = y)
∀x 0 ≠ x ′
∀x (x + 0) = x
∀x ∀y (x + y ′) = (x + y) ′
∀x (x × 0) = 0
∀x ∀y (x × y ′) = ((x × y) + x)
∀x ∀y (x < y ↔ ∃z (z ′ + x) = y))
Since there are infinitely many sentences of the latter form, this
axiom system is infinite. The latter form is called the induction
schema. (Actually, the induction schema is a bit more complicated
than we let on here.)
The last axiom is an explicit definition of <.
∃x ∀y (y ∈ x ↔ A(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 A(x), the
set {x : A(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 A(y) to be ¬y ∈ y,
you get the sentence
∃x ∀y (y ∈ x ↔ ¬y ∈ y)
CHAPTER 8. THEORIES AND THEIR MODELS 130
∀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 )),
the < relation. This means that the predicate symbol < is actually
superfluous in the language of arithmetic; it can be defined.
∀z (z ∈ x → z ∈ y)
∃x (¬∃y y ∈ x ∧ ∀z x ⊆ z )
∀u ((u ∈ x ∨ u ∈ y) ↔ u ∈ z )
∀u (u ⊆ x ↔ u ∈ y)
CHAPTER 8. THEORIES AND THEIR MODELS 134
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
formulas 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 explain 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 :
∀z (z ∈ Z ↔ ∃x ∃y (x ∈ X ∧ y ∈ Y ∧ ⟨x, y⟩ = z ))
∀u (u ∈ f → ∃x ∃y (x ∈ X ∧ y ∈ Y ∧ ⟨x, y⟩ = u)) ∧
∀x (x ∈ X → (∃y (y ∈ Y ∧ maps( f ,x, y)) ∧
(∀y ∀y ′ ((maps( f ,x, y) ∧ maps( f ,x, y ′)) → y = y ′)))
CHAPTER 8. THEORIES AND THEIR MODELS 135
f : X → Y ∧ ∀x ∀x ′ ((x ∈ X ∧ x ′ ∈ X ∧
∃y (maps( f ,x, y) ∧ maps( f ,x ′, y))) → x = x ′)
One might think that set theory requires another axiom that
guarantees the existence of a set for every defining property. If
A(x) is a formula of set theory with the variable x free, we can
consider the sentence
∃y ∀x (x ∈ y ↔ A(x)).
This sentence states that there is a set y whose elements are all
and only those x that satisfy A(x). This schema is called the
“comprehension principle.” It looks very useful; unfortunately it
is inconsistent. Take A(x) ≡ ¬x ∈ x, then the comprehension
principle states
∃y ∀x (x ∈ y ↔ x ∉ x),
i.e., it states the existence of a set of all sets that are not elements
of themselves. No such set can exist—this is Russell’s Paradox.
ZFC, in fact, contains a restricted—and consistent—version of
this principle, the separation principle:
∀z ∃y ∀x (x ∈ y ↔ (x ∈ z ∧ A(x)).
CHAPTER 8. THEORIES AND THEIR MODELS 136
A ≥n ≡ ∃x 1 ∃x 2 . . . ∃x n
(x 1 ≠ x 2 ∧ x 1 ≠ x 3 ∧ x 1 ≠ x 4 ∧ · · · ∧ x 1 ≠ x n ∧
x2 ≠ x3 ∧ x2 ≠ x4 ∧ · · · ∧ x2 ≠ xn ∧
..
.
x n−1 ≠ x n )
A=n ≡ ∃x 1 ∃x 2 . . . ∃x n
(x 1 ≠ x 2 ∧ x 1 ≠ x 3 ∧ x 1 ≠ x 4 ∧ · · · ∧ x 1 ≠ x n ∧
x2 ≠ x3 ∧ x2 ≠ x4 ∧ · · · ∧ x2 ≠ xn ∧
..
.
x n−1 ≠ x n ∧
∀y (y = x 1 ∨ · · · ∨ y = x n ))
{A ≥1 ,A ≥2 ,A ≥3 , . . . }.
Summary
Sets of sentences in a sense describe the structures in which they
are jointly true; these structures are their models. Conversely, if
we start with a structure or set of structures, we might be inter-
ested in the set of sentences they are models of, this is the theory
of the structure or set of structures. Any such set of sentences has
the property that every sentence entailed by them is already in
the set; they are closed. More generally, we call a set 𝛤 a theory
if it is closed under entailment, and say 𝛤 is axiomatized by 𝛥
is 𝛤 consists of all sentences entailed by 𝛥.
Mathematics yields many examples of theories, e.g., the the-
ories of linear orders, of groups, or theories of arithmetic, e.g.,
the theory axiomatized by Peano’s axioms. But there are many
examples of important theories in other disciplines as well, e.g.,
relational databases may be thought of as theories, and meta-
physics concerns itself with theories of parthood which can be
axiomatized.
One significant question when setting up a theory for study is
whether its language is expressive enough to allow us to formu-
late everything we want the theory to talk about, and another is
whether it is strong enough to prove what we want it to prove. To
express a relation we need a formula with the requisite number
CHAPTER 8. THEORIES AND THEIR MODELS 138
Problems
Problem 8.1. Find formulas in LA which define the following
relations:
1. n is between i and j ;
1. the inverse R −1 of R;
1. {0} is definable in N;
2. {1} is definable in N;
CHAPTER 8. THEORIES AND THEIR MODELS 139
3. {2} is definable in N;
∃y ∀x (x ∈ y ↔ x ∉ x) ⊢ ⊥.
Derivation
Systems
9.1 Introduction
Logics commonly have both a semantics and a derivation system.
The semantics concerns concepts such as truth, satisfiability, va-
lidity, 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 formulas. Good
derivation systems have the property that any given sequence or
arrangement of sentences or formulas can be verified mechani-
cally to be “correct.”
The simplest (and historically first) derivation systems for
first-order logic were axiomatic. A sequence of formulas counts
as a derivation in such a system if each individual formula in it
is either among a fixed set of “axioms” or follows from formulas
coming before it in the sequence by one of a fixed number of “in-
ference rules”—and it can be mechanically verified if a formula
is an axiom and whether it follows correctly from other formulas
by one of the inference rules. Axiomatic derivation systems are
easy to describe—and also easy to handle meta-theoretically—
140
CHAPTER 9. DERIVATION SYSTEMS 141
1. ⊢ A if and only if ⊨ A
2. 𝛤 ⊢ A if and only if 𝛤 ⊨ A
A1 , . . . ,Am ⇒ B 1 , . . . ,Bm ,
9.4 Tableaux
While many derivation systems operate with arrangements of sen-
tences, tableaux operate with signed formulas. A signed formula
is a pair consisting of a truth value sign (T or F) and a sentence
T A or F A.
CHAPTER 9. DERIVATION SYSTEMS 146
{F A, T B 1 , . . . , T Bn }
1. F (A ∧ B) → A Assumption
2. TA ∧B →F 1
3. FA →F 1
4. TA →T 2
5. TB →T 2
⊗
{T B 1 , . . . , T Bn }
CHAPTER 9. DERIVATION SYSTEMS 147
for some Bi ∈ 𝛤.
Tableaux were invented in the 1950s independently by Ev-
ert Beth and Jaakko Hintikka, and simplified and popularized
by Raymond Smullyan. They are very easy to use, since con-
structing a tableau is a very systematic procedure. Because of
the systematic nature of tableaux, they also lend themselves to
implementation by computer. However, a tableau is often hard
to read and their connection to proofs are sometimes not easy to
see. The approach is also quite general, and many different logics
have tableau systems. Tableaux also help us to find structures that
satisfy given (sets of) sentences: if the set is satisfiable, it won’t
have a closed tableau, i.e., any tableau will have an open branch.
The satisfying structure can be “read off” an open branch, pro-
vided every rule it is possible to apply has been applied on that
branch. There is also a very close connection to the sequent cal-
culus: essentially, a closed tableau is a condensed derivation in
the sequent calculus, written upside-down.
The Sequent
Calculus
10.1 Rules and Derivations
For the following, let 𝛤, 𝛥, 𝛱 , 𝛬 represent finite sequences of sen-
tences.
(A1 ∧ · · · ∧ Am ) → (B 1 ∨ · · · ∨ Bn )
holds. There are two special cases: where 𝛤 is empty and when
𝛥 is empty. When 𝛤 is empty, i.e., m = 0, ⇒ 𝛥 holds iff B 1 ∨· · ·∨
150
CHAPTER 10. THE SEQUENT CALCULUS 151
1. A ⇒ A
2. ⊥ ⇒
Rules for ∧
CHAPTER 10. THE SEQUENT CALCULUS 152
A, 𝛤 ⇒ 𝛥
∧L
A ∧ B, 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,A 𝛤 ⇒ 𝛥,B
∧R
B, 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,A ∧ B
∧L
A ∧ B, 𝛤 ⇒ 𝛥
Rules for ∨
𝛤 ⇒ 𝛥,A
∨R
A, 𝛤 ⇒ 𝛥 B, 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,A ∨ B
∨L
A ∨ B, 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,B
∨R
𝛤 ⇒ 𝛥,A ∨ B
Rules for →
𝛤 ⇒ 𝛥,A B, 𝛱 ⇒ 𝛬 A, 𝛤 ⇒ 𝛥,B
→L →R
A → B, 𝛤, 𝛱 ⇒ 𝛥, 𝛬 𝛤 ⇒ 𝛥,A → B
Rules for ∃
A(a), 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,A(t )
∃L ∃R
∃x A(x), 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥, ∃x A(x)
CHAPTER 10. THE SEQUENT CALCULUS 153
Weakening
𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥
WL WR
A, 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,A
CHAPTER 10. THE SEQUENT CALCULUS 154
Contraction
A,A, 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,A,A
CL CR
A, 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,A
Exchange
𝛤,A,B, 𝛱 ⇒ 𝛥 𝛤 ⇒ 𝛥,A,B, 𝛬
XL XR
𝛤,B,A, 𝛱 ⇒ 𝛥 𝛤 ⇒ 𝛥,B,A, 𝛬
𝛤 ⇒ 𝛥,A A, 𝛱 ⇒ 𝛬
Cut
𝛤, 𝛱 ⇒ 𝛥, 𝛬
10.5 Derivations
We’ve said what an initial sequent looks like, and we’ve given
the rules of inference. Derivations in the sequent calculus are
inductively generated from these: each derivation either is an
initial sequent on its own, or consists of one or two derivations
followed by an inference.
We can now apply another rule, say XL, which allows us to switch
two sentences on the left. So, the following is also a correct
derivation:
C ⇒C
WL
D,C ⇒ C
XL
C ,D ⇒ C
D ⇒ D
WL
C ,D ⇒ D
In our case, the premises must match the last sequents of the
derivations ending in the premises. That means that 𝛤 is C ,D, 𝛥
is empty, A is C and B is D. So the conclusion, if the inference
should be correct, is C ,D ⇒ C ∧ D.
C ⇒C
WL
D,C ⇒ C D ⇒ D
XL WL
C ,D ⇒ C C ,D ⇒ D
∧R
C ,D ⇒ C ∧ D
A∧B ⇒ A
There are two options for what could have been the upper sequent
of the ∧L inference: we could have an upper sequent of A ⇒ A,
or of B ⇒ A. Clearly, A ⇒ A is an initial sequent (which is a
good thing), while B ⇒ A is not derivable in general. We fill in
the upper sequent:
A ⇒ A
∧L
A∧B ⇒ A
¬A ∨ B ⇒ A → B
A, ¬A ∨ B ⇒ B
→R
¬A ∨ B ⇒ A → B
CHAPTER 10. THE SEQUENT CALCULUS 158
¬A,A ⇒ B B,A ⇒ B
∨L
¬A ∨ B,A ⇒ B
XR
A, ¬A ∨ B ⇒ B
→R
¬A ∨ B ⇒ A→B
A ⇒ A
WR
A ⇒ A,B B ⇒ B
XR WL
A ⇒ B,A A,B ⇒ B
¬L XL
¬A,A ⇒ B B,A ⇒ B
∨L
¬A ∨ B,A ⇒ B
XR
A, ¬A ∨ B ⇒ B
→R
¬A ∨ B ⇒ A→B
¬A ∨ ¬B ⇒ ¬(A ∧ B)
A ∧ B, ¬A ∨ ¬B ⇒
¬R
¬A ∨ ¬B ⇒ ¬(A ∧ B)
A, ¬A ∨ ¬B ⇒
∧L
A ∧ B, ¬A ∨ ¬B ⇒
¬R
¬A ∨ ¬B ⇒ ¬(A ∧ B)
?
A ⇒ A A ⇒ B
¬L ¬L
¬A,A ⇒ ¬B,A ⇒
∨L
¬A ∨ ¬B,A ⇒
XL
A, ¬A ∨ ¬B ⇒
∧L
A ∧ B, ¬A ∨ ¬B ⇒
¬R
¬A ∨ ¬B ⇒ ¬(A ∧ B)
The top of the right branch cannot be reduced any further, and
it cannot be brought by way of structural inferences to an initial
sequent, so this is not the right path to take. So clearly, it was a
mistake to apply the ∧L rule above. Going back to what we had
before and carrying out the ∨L rule instead, we get
¬A,A ∧ B ⇒ ¬B,A ∧ B ⇒
∨L
¬A ∨ ¬B,A ∧ B ⇒
XL
A ∧ B, ¬A ∨ ¬B ⇒
¬R
¬A ∨ ¬B ⇒ ¬(A ∧ B)
(We could have carried out the ∧ rules lower than the ¬ rules in
these steps and still obtained a correct derivation).
A ⇒
¬R
⇒ A ⇒ ¬A
∨R ∨R
⇒ A ∨ ¬A ⇒ A ∨ ¬A
CHAPTER 10. THE SEQUENT CALCULUS 161
⇒ A ∨ ¬A,A
∨R
⇒ A ∨ ¬A,A ∨ ¬A
CR
⇒ A ∨ ¬A
Now we can apply ∨R a second time, and also get ¬A, which
leads to a complete derivation.
A ⇒ A
¬R
⇒ A, ¬A
∨R
⇒ A,A ∨ ¬A
XR
⇒ A ∨ ¬A,A
∨R
⇒ A ∨ ¬A,A ∨ ¬A
CR
⇒ A ∨ ¬A
∀x A(x) ⇒ A(a)
¬L
¬A(a),∀x A(x) ⇒
XL
∀x A(x), ¬A(a) ⇒
¬R
¬A(a) ⇒ ¬∀xA(x)
∃L
∃x¬A(x) ⇒ ¬∀xA(x)
At this point, our only option is to carry out the ∀L rule. Since
this rule is not subject to the eigenvariable restriction, we’re in the
clear. Remember, we want to try and obtain an initial sequent (of
the form A(a) ⇒ A(a)), so we should choose a as our argument
for A when we apply the rule.
A(a) ⇒ A(a)
∀L
∀x A(x) ⇒ A(a)
¬L
¬A(a),∀x A(x) ⇒
XL
∀x A(x), ¬A(a) ⇒
¬R
¬A(a) ⇒ ¬∀x A(x)
∃L
∃x ¬A(x) ⇒ ¬∀x A(x)
It is important, especially when dealing with quantifiers, to dou-
ble check at this point that the eigenvariable condition has not
been violated. Since the only rule we applied that is subject to
the eigenvariable condition was ∃L, and the eigenvariable a does
not occur in its lower sequent (the end-sequent), this is a correct
derivation.
CHAPTER 10. THE SEQUENT CALCULUS 163
B,B,C ⇒ A
CL
B,C ⇒ A
XL
C ,B ⇒ A
WL
C ,C ,B ⇒ A
From now on we’ll say that if 𝛤0 is a finite set of sentences then
𝛤0 ⇒ A is any sequent where the antecedent is a sequence of
CHAPTER 10. THE SEQUENT CALCULUS 164
𝜋0 𝜋1
𝛤0 ⇒ A A, 𝛥0 ⇒ B
Cut
𝛤0 , 𝛥0 ⇒ B
Since 𝛤0 ∪ 𝛥0 ⊆ 𝛤 ∪ 𝛥, this shows 𝛤 ∪ 𝛥 ⊢ B. □
Proof. Exercise. □
𝜋0 𝜋1
𝛤0 ⇒ A A, 𝛤1 ⇒
Cut
𝛤0 , 𝛤1 ⇒
CHAPTER 10. THE SEQUENT CALCULUS 166
𝜋1
A ⇒ A
¬R
⇒ A, ¬A ¬A, 𝛤 ⇒
Cut
𝛤 ⇒ A □
A ⇒ A
𝜋 ¬L
¬A,A ⇒
XL
𝛤0 ⇒ A A, ¬A ⇒
Cut
𝛤, ¬A ⇒
𝜋0
𝜋1
A, 𝛤0 ⇒
¬R
𝛤0 ⇒ ¬A ¬A, 𝛤1 ⇒
Cut
𝛤0 , 𝛤1 ⇒
2. A,B ⊢ A ∧ B.
A ⇒ A B ⇒ B
∧L ∧L
A∧B ⇒ A A∧B ⇒ B
A ⇒ A B ⇒ B
∧R
A,B ⇒ A ∧ B □
2. Both A ⊢ A ∨ B and B ⊢ A ∨ B.
A ⇒ A B ⇒ B
¬L ¬L
¬A,A ⇒ ¬B,B ⇒
A, ¬A, ¬B ⇒ B, ¬A, ¬B ⇒
∨L
A ∨ B, ¬A, ¬B ⇒
A ⇒ A B ⇒ B
∨R ∨R
A ⇒ A∨B B ⇒ A∨B □
2. Both ¬A ⊢ A → B and B ⊢ A → B.
A ⇒ A B ⇒ B
→L
A → B,A ⇒ B
A ⇒ A
¬L
¬A,A ⇒
XL
A, ¬A ⇒ B ⇒ B
WR WL
A, ¬A ⇒ B A,B ⇒ B
→R →R
¬A ⇒ A→B B ⇒ A→B □
2. ∀x A(x) ⊢ A(t ).
A(t ) ⇒ A(t )
∃R
A(t ) ⇒ ∃x A(x)
A(t ) ⇒ A(t )
∀L
∀x A(x) ⇒ A(t ) □
10.12 Soundness
A derivation system, such as the sequent calculus, is sound if
it cannot derive things that do not actually hold. 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
𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥
WL WR
A, 𝛤 ⇒ 𝛥 𝛤 ⇒ 𝛥,A
𝛤 ⇒ 𝛥,A
¬L
¬A, 𝛤 ⇒ 𝛥
A, 𝛤 ⇒ 𝛥
∧L
A ∧ B, 𝛤 ⇒ 𝛥
𝛤 ⇒ 𝛥,A
∨R
𝛤 ⇒ 𝛥,A ∨ B
A, 𝛤 ⇒ 𝛥,B
→R
𝛤 ⇒ 𝛥,A → B
A(t ), 𝛤 ⇒ 𝛥
∀L
∀x A(x), 𝛤 ⇒ 𝛥
𝛤 ⇒ 𝛥,A(a)
∀R
𝛤 ⇒ 𝛥,∀x A(x)
𝛤 ⇒ 𝛥,A A, 𝛱 ⇒ 𝛬
Cut
𝛤, 𝛱 ⇒ 𝛥, 𝛬
𝛤 ⇒ 𝛥,A 𝛤 ⇒ 𝛥,B
∧R
𝛤 ⇒ 𝛥,A ∧ B
𝛤 ⇒ 𝛥,A B, 𝛱 ⇒ 𝛬
→L
A → B, 𝛤, 𝛱 ⇒ 𝛥, 𝛬
t1 = t2 , 𝛤 ⇒ 𝛥,A(t1 ) t1 = t2 , 𝛤 ⇒ 𝛥,A(t2 )
= =
t1 = t2 , 𝛤 ⇒ 𝛥,A(t2 ) t1 = t2 , 𝛤 ⇒ 𝛥,A(t1 )
Summary
Proof systems provide purely syntactic methods for characteriz-
ing consequence and compatibility between sentences. The se-
quent calculus is one such proof system. A derivation in it
consists of a tree of sequents (a sequent 𝛤 ⇒ 𝛥 consists of two
sequences of formulas separated by ⇒). The topmost sequents
in a derivation are initial sequents of the form A ⇒ A. All other
sequents, for the derivation to be correct, must be correctly jus-
tified by one of a number of inference rules. These come in
pairs; a rule for operating on the left and on the right side of
a sequent for each connective and quantifier. For instance, if a
sequent 𝛤 ⇒ 𝛥,A → B is justified by the →R rule, the preceding
sequent (the premise) must be A, 𝛤 ⇒ 𝛥,B. Some rules also
allow the order or number of sentences in a sequent to be manip-
ulated, e.g., the XR rule allows two formulas on the right side of
a sequent to be switched.
If there is a derivation of the sequent ⇒ A, we say A is a
theorem and write ⊢ A. If there is a derivation of 𝛤0 ⇒ A where
every B in 𝛤0 is in 𝛤, we say A is derivable from 𝛤 and write
𝛤 ⊢ A. If there is a derivation of 𝛤0 ⇒ where every B in 𝛤0
is in 𝛤, we say 𝛤 is inconsistent, otherwise consistent. These
notions are interrelated, e.g., 𝛤 ⊢ A iff 𝛤 ∪ {¬A} is inconsistent.
They are also related to the corresponding semantic notions, e.g.,
if 𝛤 ⊢ A then 𝛤 ⊨ A. This property of proof systems—what can
be derived from 𝛤 is guaranteed to be entailed by 𝛤—is called
CHAPTER 10. THE SEQUENT CALCULUS 179
Problems
Problem 10.1. Give derivations of the following sequents:
1. ⇒ ¬(A → B) → (A ∧ ¬B)
2. (A ∧ B) → C ⇒ (A → C ) ∨ (B → C )
2. ∃x (A(x) → ∀y A(y))
Natural
Deduction
11.1 Rules and Derivations
Natural deduction systems are meant to closely parallel the infor-
mal reasoning used in mathematical proof (hence it is somewhat
“natural”). Natural deduction proofs begin with assumptions. In-
ference rules are then applied. Assumptions are “discharged” by
the ¬Intro, →Intro, ∨Elim and ∃Elim inference rules, and the
label of the discharged assumption is placed beside the inference
for clarity.
180
CHAPTER 11. NATURAL DEDUCTION 181
Rules for ∨
[A] n [B] n
A
∨Intro
A∨B
B
∨Intro A∨B C C
A∨B n ∨Elim
C
Rules for →
[A] n
A→B A
→Elim
B
B
n →Intro
A→B
Rules for ¬
CHAPTER 11. NATURAL DEDUCTION 182
[A] n
¬A A
⊥ ¬Elim
⊥
n ¬Intro
¬A
Rules for ⊥
[¬A] n
⊥ ⊥
I
A
n ⊥ ⊥
C
A
Rules for ∃
[A(a)]n
A(t )
∃Intro
∃x A(x)
∃x A(x) C
n ∃Elim
C
11.4 Derivations
We’ve said what an assumption is, and we’ve given the rules of
inference. Derivations in natural deduction are inductively gen-
erated from these: each derivation either is an assumption on its
own, or consists of one, two, or three derivations followed by a
correct inference.
[C ] 1 D C [D] 1
∧Intro ∧Intro
1
C ∧D 1
C ∧D
→Intro →Intro
C → (C ∧ D) D → (C ∧ D)
1
B
→Intro
A→B
(A ∧ B) → A
[A ∧ B] 1
1
A
→Intro
(A ∧ B) → A
[A ∧ B] 1
∧Elim
1
A
→Intro
(A ∧ B) → A
(¬A ∨ B) → (A → B)
[¬A ∨ B] 1
1
A→B
→Intro
(¬A ∨ B) → (A → B)
CHAPTER 11. NATURAL DEDUCTION 187
3
B B
→Intro 4 →Intro
[¬A ∨ B] 1 A→B A→B
2 ∨Elim
1
A→B
→Intro
(¬A ∨ B) → (A → B)
B
CHAPTER 11. NATURAL DEDUCTION 188
[¬(A ∨ ¬A)] 1
1
⊥ ⊥C
A ∨ ¬A
¬A A
⊥ ¬Elim
1 ⊥C
A ∨ ¬A
2
⊥
¬Intro
¬A A
⊥ ¬Elim
1 ⊥C
A ∨ ¬A
[A] 2 [¬A] 3
∨Intro ∨Intro
[¬(A ∨ ¬A)] 1 A ∨ ¬A [¬(A ∨ ¬A)] 1 A ∨ ¬A
⊥ ¬Elim ⊥ ⊥ ¬Elim
2 ¬Intro 3 C
¬A A
⊥ ¬Elim
1 ⊥C
A ∨ ¬A
[∃x ¬A(x)] 1
¬∀x A(x)
1 →Intro
∃x ¬A(x) → ¬∀x A(x)
[¬A(a)] 2
3
⊥
¬Intro
[∃x ¬A(x)] 1 ¬∀x A(x)
2 ∃Elim
¬∀x A(x)
1 →Intro
∃x ¬A(x) → ¬∀x A(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.
[∀x A(x)] 3
∀Elim
[¬A(a)] 2 A(a)
⊥ ¬Elim
1 3 ¬Intro
[∃x ¬A(x)] ¬∀x A(x)
2 ∃Elim
¬∀x A(x)
1 →Intro
∃x ¬A(x) → ¬∀x A(x)
It is important, especially when dealing with quantifiers, to
double check at this point that the eigenvariable condition has
not been violated. Since the only rule we applied that is subject
to the eigenvariable condition was ∃Elim, and the eigenvariable a
CHAPTER 11. NATURAL DEDUCTION 192
∃x C (x,b)
We have two premises to work with. To use the first, i.e., try
to find a derivation of ∃x C (x,b) from ∃x (A(x) ∧ B (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) ∧ B (a)] 1
[A(a) ∧ B (a)] 1
∧Elim
B (a)
C (a,b). We now have both B (a) → C (a,b) and B (a). Our next
move should be a straightforward application of the →Elim rule.
∀x (B (x) → C (x,b)) [A(a) ∧ B (a)] 1
∀Elim ∧Elim
B (a) → C (a,b) B (a)
→Elim
C (a,b)
¬∀x A(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 con-
tradiction.
[∀x A(x)] 1
1
⊥
¬Intro
¬∀x A(x)
CHAPTER 11. NATURAL DEDUCTION 194
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 A(x) → ∃y B (y) together with ∀x A(x) will allow us to use the
→Elim rule.
∀x A(x) → ∃y B (y) [∀x A(x)] 1
→Elim
∃y B (y)
1
⊥
¬Intro
¬∀x A(x)
We now have one final assumption to work with, and it looks like
this will help us reach a contradiction by using ¬Elim.
𝛥, [A] 1
𝛤
𝛿1
𝛿0
1
B
→Intro
A→B A
→Elim
B
CHAPTER 11. NATURAL DEDUCTION 196
When 𝛤 = {A1 ,A2 , . . . ,Ak } is a finite set we may use the sim-
plified notation A1 ,A2 , . . . ,Ak ⊢ B for 𝛤 ⊢ B, in particular A ⊢ B
means that {A} ⊢ B.
Note that if 𝛤 ⊢ A and A ⊢ B, then 𝛤 ⊢ B. It follows also that
if A1 , . . . ,An ⊢ B and 𝛤 ⊢ Ai for each i , then 𝛤 ⊢ B.
1. 𝛤 is inconsistent.
Proof. Exercise. □
2
⊥ 1
⊥
¬Intro ¬Intro
¬¬A ¬A
⊥ ¬Elim
2. A,B ⊢ A ∧ B.
A∧B A∧B
∧Elim ∧Elim
A B
2. We can derive:
A B
∧Intro
A∧B □
2. Both A ⊢ A ∨ B and B ⊢ A ∨ B.
¬A [A] 1 ¬B [B] 1
A∨B ⊥ ¬Elim ⊥ ¬Elim
1 ∨Elim
⊥
2. Both ¬A ⊢ A → B and B ⊢ A → B.
A→B A
→Elim
B
CHAPTER 11. NATURAL DEDUCTION 200
¬A [A] 1
⊥ ⊥ ¬Elim
I
1
B B
→Intro →Intro
A→B A→B
Note that →Intro may, but does not have to, discharge the
assumption A. □
2. ∀x A(x) ⊢ A(t ).
A(t )
∃Intro
∃x A(x)
∀x A(x)
∀Elim
A(t ) □
CHAPTER 11. NATURAL DEDUCTION 201
11.11 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
𝛤, [A] n
𝛿1
⊥
n ¬Intro
¬A
𝛤
𝛿1
A∧B
∧Elim
A
𝛤
𝛿1
A
∨Intro
A∨B
𝛤, [A] n
𝛿1
B
n →Intro
A→B
𝛤
𝛿1
⊥ ⊥
I
A
𝛤
𝛿1
A(a)
∀Intro
∀x A(x)
𝛤1 𝛤2
𝛿1 𝛿2
A B
∧Intro
A∧B
𝛤1 𝛤2
𝛿1 𝛿2
A→B A
→Elim
B
t1 = t2 A(t1 )
=Elim
A(t2 )
t = t =Intro
t1 = t2 A(t2 )
=Elim
A(t1 )
s =t A(s )
=Elim
A(t )
∀x ∀y ((A(x) ∧ A(y)) → x = y)
∃x ∀y (A(y) → y = x)
1
a =b
→Intro
((A(a) ∧ A(b)) → a = b)
∀Intro
∀y ((A(a) ∧ A(y)) → a = y)
∀Intro
∀x ∀y ((A(x) ∧ A(y)) → x = y)
∃x ∀y (A(y) → y = x) a =b
2 ∃Elim
1
a = b
→Intro
((A(a) ∧ A(b)) → a = b)
∀Intro
∀y ((A(a) ∧ A(y)) → a = y)
∀Intro
∀x ∀y ((A(x) ∧ A(y)) → x = y)
CHAPTER 11. NATURAL DEDUCTION 208
𝛿1 𝛿2
t1 = t2 A(t1 )
=Elim
A(t2 )
Summary
Proof systems provide purely syntactic methods for characteriz-
ing consequence and compatibility between sentences. Natural
deduction is one such proof system. A derivation in it consists
of a tree formulas. The topmost formulas in a derivation are as-
sumptions. All other formulas, for the derivation to be correct,
must be correctly justified by one of a number of inference rules.
These come in pairs; an introduction and an elimination rule for
each connective and quantifier. For instance, if a formula A is
justified by a →Elim rule, the preceding formulas (the premises)
must be B → A and B (for some B). Some inference rules also
allow assumptions to be discharged. For instance, if A → B is in-
ferred from B using →Intro, any occurrences of A as assumptions
in the derivation leading to the premise B may be discharged, and
is given a label that is also recorded at the inference.
If there is a derivation with end formula A and all assumptions
are discharged, we say A is a theorem and write ⊢ A. If all undis-
charged assumptions are in some set 𝛤, we say A is derivable
from 𝛤 and write 𝛤 ⊢ A. If 𝛤 ⊢ ⊥ we say 𝛤 is inconsistent, oth-
erwise consistent. These notions are interrelated, e.g., 𝛤 ⊢ A iff
𝛤 ∪ {¬A} is inconsistent. They are also related to the correspond-
ing semantic notions, e.g., if 𝛤 ⊢ A then 𝛤 ⊨ A. This property
of proof systems—what can be derived from 𝛤 is guaranteed to
be entailed by 𝛤—is called soundness. The soundness theo-
rem is proved by induction on the length of derivations, showing
that each individual inference preserves entailment of its conclu-
sion from open assumptions provided its premises are entailed
by their undischarged assumptions.
Problems
Problem 11.1. Give derivations of the following:
1. ¬(A → B) → (A ∧ ¬B)
CHAPTER 11. NATURAL DEDUCTION 210
3. ¬¬A → A
2. ∃x (A(x) → ∀y A(y))
The
Completeness
Theorem
12.1 Introduction
The completeness theorem is one of the most fundamental re-
sults about logic. It comes in two formulations, the equivalence
of which we’ll prove. In its first formulation it says something fun-
damental about the relationship between semantic consequence
and our derivation system: if a sentence A follows from some sen-
tences 𝛤, then there is also a derivation that establishes 𝛤 ⊢ A.
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 exis-
tence result: every consistent set of sentences is satisfiable. Con-
sistency is a proof-theoretic notion: it says that our derivation
system is unable to produce certain derivations. 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
completeness theorem was first proved—in fact before we had the
211
CHAPTER 12. THE COMPLETENESS THEOREM 212
1. If 𝛤 ⊢ A, then A ∈ 𝛤.
3. A ∨ B ∈ 𝛤 iff either A ∈ 𝛤 or B ∈ 𝛤.
4. A → B ∈ 𝛤 iff either A ∉ 𝛤 or B ∈ 𝛤.
1. If 𝛤 ⊢ A, then A ∈ 𝛤.
Suppose that 𝛤 ⊢ A. Suppose to the contrary that A ∉ 𝛤.
Since 𝛤 is complete, ¬A ∈ 𝛤. By Propositions 10.20
and 11.20, 𝛤 is inconsistent. This contradicts the assump-
tion that 𝛤 is consistent. Hence, it cannot be the case that
A ∉ 𝛤, so A ∈ 𝛤.
2. Exercise.
4. Exercise. □
𝛤0 = 𝛤
𝛤n+1 = 𝛤n ∪ {D n }
𝛤n ⊢ ∃x n An (x n ) 𝛤n ⊢ ¬An (c n )
We’ll now show that complete, consistent sets which are satu-
rated have the property that it contains a universally quantified
sentence iff it contains all its instances and it contains an existen-
tially quantified sentence iff it contains at least one instance. We’ll
CHAPTER 12. THE COMPLETENESS THEOREM 220
use this to show that the structure we’ll generate from a complete,
consistent, saturated set makes all its quantified sentences true.
2. Exercise. □
Let 𝛤 ∗ = n ≥0 𝛤n .
⋃︁
Each 𝛤n is consistent: 𝛤0 is consistent by definition. If
𝛤n+1 = 𝛤n ∪ {An }, this is because the latter is consistent. If it
isn’t, 𝛤n+1 = 𝛤n ∪ {¬An }. We have to verify that 𝛤n ∪ {¬An } is
consistent. Suppose it’s not. Then both 𝛤n ∪ {An } and 𝛤n ∪ {¬An }
are inconsistent. This means that 𝛤n would be inconsistent by
Propositions 10.20 and 11.20, contrary to the induction hypothe-
sis.
For every n and every i < n, 𝛤i ⊆ 𝛤n . This follows by a simple
induction on n. For n = 0, there are no i < 0, so the claim holds
automatically. For the inductive step, suppose it is true for n.
We have 𝛤n+1 = 𝛤n ∪ {An } or = 𝛤n ∪ {¬An } by construction. So
𝛤n ⊆ 𝛤n+1 . If i < n, then 𝛤i ⊆ 𝛤n by inductive hypothesis, and so
⊆ 𝛤n+1 by transitivity of ⊆.
From this it follows that every finite subset of 𝛤 ∗ is a subset
of 𝛤n for some n, since each B ∈ 𝛤 ∗ not already in 𝛤0 is added at
some stage i . If n is the last one of these, then all B in the finite
subset are in 𝛤n . So, every finite subset of 𝛤 ∗ is consistent. By
Propositions 10.17 and 11.17, 𝛤 ∗ is consistent.
Every sentence of Frm(L) appears on the list used to de-
fine 𝛤 ∗ . If An ∉ 𝛤 ∗ , then that is because 𝛤n ∪ {An } was inconsis-
tent. But then ¬An ∈ 𝛤 ∗ , so 𝛤 ∗ is complete. □
constant symbol to itself, and make sure that more generally, for
∗
every closed term t , ValM (𝛤 ) (t ) = t . The predicate symbols are
assigned extensions in such a way that an atomic sentence is true
in M(𝛤 ∗ ) iff it is in 𝛤 ∗ . This will obviously make all the atomic
sentences in 𝛤 ∗ true in M(𝛤 ∗ ). The rest are true provided the 𝛤 ∗
we start with is consistent, complete, and saturated.
6. A ≡ B → C : exercise.
7. A ≡ ∀x B (x): exercise.
12.7 Identity
The construction of the term model given in the preceding sec-
tion is enough to establish completeness for first-order logic for
sets 𝛤 that do not contain =. The term model satisfies every
A ∈ 𝛤 ∗ which does not contain = (and hence all A ∈ 𝛤). 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.”
1. ≈ is reflexive.
2. ≈ is symmetric.
3. ≈ is transitive.
CHAPTER 12. THE COMPLETENESS THEOREM 225
2. If 𝛤 ∗ ⊢ t = t ′ then 𝛤 ∗ ⊢ t ′ = t .
4. If 𝛤 ∗ ⊢ t = t ′, then
1. |M/≈ | = Trm(L)/≈ .
2. c M/≈ = [c ] ≈
3. f M/≈ ([t
1 ] ≈ , . . . , [tn ] ≈ ) = [f (t1 , . . . ,tn )] ≈
and
CHAPTER 12. THE COMPLETENESS THEOREM 227
Proof. Note that the 𝛤’s in Corollary 12.19 and Theorem 12.18
are universally quantified. To make sure we do not confuse our-
selves, let us restate Theorem 12.18 using a different variable: for
any set of sentences 𝛥, if 𝛥 is consistent, it is satisfiable. By con-
traposition, if 𝛥 is not satisfiable, then 𝛥 is inconsistent. We will
use this to prove the corollary.
Suppose that 𝛤 ⊨ A. Then 𝛤 ∪ {¬A} is unsatisfiable by Propo-
sition 7.27. Taking 𝛤 ∪ {¬A} as our 𝛥, the previous version of
Theorem 12.18 gives us that 𝛤 ∪ {¬A} is inconsistent. By Propo-
sitions 10.19 and 11.19, 𝛤 ⊢ A. □
𝛥 = {c ≠ t : t ∈ Trm(L)}.
𝛥 = {A ≥n : n ≥ 1}
pose 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 A ≥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.
2. (A ∨ B) ∈ 𝛤 iff either A ∈ 𝛤 or B ∈ 𝛤.
3. (A → B) ∈ 𝛤 iff either A ∉ 𝛤 or B ∈ 𝛤.
CHAPTER 12. THE COMPLETENESS THEOREM 232
Summary
The completeness theorem is the converse of the soundness
theorem. In one form it states that if 𝛤 ⊨ A then 𝛤 ⊢ A, in an-
other that if 𝛤 is consistent then it is satisfiable. We proved the
second form (and derived the first from the second). The proof is
involved and requires a number of steps. We start with a consis-
tent set 𝛤. First we add infinitely many new constant symbols c i
as well as formulas of the form ∃x A(x) → A(c ) where each for-
mula A(x) with a free variable in the expanded language is paired
with one of the new constants. This results in a saturated con-
sistent set of sentences containing 𝛤. It is still consistent. Now
we take that set and extend it to a complete consistent set. A
complete consistent set has the nice property that for any sen-
tence A, either A or ¬A is in the set (but never both). Since we
started from a saturated set, we now have a saturated, complete,
consistent set of sentences 𝛤 ∗ that includes 𝛤. From this set it
is now possible to define a structure M such that M(𝛤 ∗ ) ⊨ A iff
A ∈ 𝛤 ∗ . In particular, M(𝛤 ∗ ) ⊨ 𝛤, i.e., 𝛤 is satisfiable. If = is
present, the construction is slightly more complex.
Two important corollaries follow from the completeness theo-
rem. The compactness theorem states that 𝛤 ⊨ A iff 𝛤0 ⊨ A
for some finite 𝛤0 ⊆ 𝛤. An equivalent formulation is that 𝛤
is satisfiable iff every finite 𝛤0 ⊆ 𝛤 is satisfiable. The com-
pactness theorem is useful to prove the existence of structures
with certain properties. For instance, we can use it to show that
there are infinite models for every theory which has arbitrarily
large finite models. This means in particular that finitude can-
not be expressed in first-order logic. The second corollary, the
Löwenheim-Skolem Theorem, states that every satisfiable 𝛤
CHAPTER 12. THE COMPLETENESS THEOREM 235
Problems
Problem 12.1. Complete the proof of Proposition 12.2.
Beyond
First-order
Logic
13.1 Overview
First-order logic is not the only system of logic of interest: there
are many extensions and variations of first-order logic. A logic
typically consists of the formal specification of a language, usu-
ally, but not always, a deductive system, 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 de-
signed 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 reason-
ing to be the determination of which statements are necessarily
237
CHAPTER 13. BEYOND FIRST-ORDER LOGIC 238
We need to add axioms that insure that the sorts are separate—
e.g., ∀x ¬(Ger man(x)∧F r ench(x))—as well as axioms that guar-
antee that “drinks wine” only holds of objects satisfying the pred-
icate F r ench(x), etc. With these conventions and axioms, it is
not difficult to show that many-sorted sentences translate to first-
order sentences, and many-sorted derivations translate to first-
order derivations. Also, many-sorted structures “translate” to cor-
responding first-order structures and vice-versa, so we also have
a completeness theorem for many-sorted logic.
CHAPTER 13. BEYOND FIRST-ORDER LOGIC 240
∃R ∀x 1 , . . . ,x k (A(x 1 , . . . ,x k ) ↔ R (x 1 , . . . ,x k )),
particular you can quantify over these sets; for example, one can
express induction for the natural numbers with a single axiom
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 ′))
The negation of this sentence then defines the class of finite struc-
tures.
In addition, one can define the class of well-orderings, by
adding the following to the definition of a linear ordering:
This asserts that every non-empty set has a least element, modulo
the identification of “set” with “one-place relation”. For another
example, one can express the notion of connectedness for graphs,
by saying that there is no nontrivial separation of the vertices into
disconnected parts:
fourth-order logic will let us talk about sets of objects of that kind.
As you may have guessed, one can iterate this idea arbitrarily.
In practice, higher-order logic is often formulated in terms
of functions instead of relations. (Modulo the natural identifica-
tions, this difference is inessential.) Given some basic “sorts” A,
B, C , . . . (which we will now call “types”), we can create new ones
by stipulating
1. N is a finite type.
2. 0 is a term of type N
Rs t (0) = s
Rs t (x + 1) = t (x,R s t (x)),
with the usual rules of logic with quantifiers and identity predi-
cate.
If one augments the finite type system with a type 𝛺 of truth
values, one has to include axioms which govern its use as well. In
fact, if one is clever, one can get rid of complex formulas 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 ver-
sions 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 admit a complete,
effective derivation system. But one can consider a weaker se-
mantics, 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 frame-
work in which we can embed a good deal of mathematics in a
natural way: starting with N, one can define real numbers, con-
tinuous functions, and so on. It is also particularly attractive in
the context of intuitionistic logic, since the types have clear “con-
structive” intepretations. 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.
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 A(x) means that you have to give a
specific x, and a proof that it satisfies A, like in the second proof.
Proving that A or B holds requires that you can prove one or the
other.
Formally speaking, intuitionistic first-order logic is what you
get if you omit 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 reasoning.
One can take this to be the kind of reasoning that is justified on
a certain philosophical view of mathematics (such as Brouwer’s
intuitionism); one can take it to be a kind of mathematical rea-
soning 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 motivation. But
whatever philosophical positions we may hold, we can study in-
tuitionistic 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 intu-
itionist connectives, usually known as the BHK interpretation
(named after Brouwer, Heyting, and Kolmogorov). It runs as
follows: a proof of A ∧ B consists of a proof of A paired with a
CHAPTER 13. BEYOND FIRST-ORDER LOGIC 251
1. (A → ⊥) → ¬A.
2. A ∨ ¬A
3. ¬¬A → A
(A ∨ B) N ≡ ¬¬(AN ∨ B N )
(A → B) N ≡ (AN → B N )
(∀x A) N ≡ ∀x AN
(∃x A) N ≡ ¬¬∃x AN
2. 𝔐,w ⊮ ⊥.
One would like to augment logic with rules and axioms deal-
ing with modality. For example, the system S4 consists of the
ordinary axioms and rules of propositional logic, together with
the following axioms:
◇A → □◇A
Turing
Machines
259
CHAPTER 14
Turing
Machine
Computations
14.1 Introduction
What does it mean for a function, say, from N to N to be com-
putable? Among the first answers, and the most well known one,
is that a function is computable if it can be computed by a Tur-
ing machine. This notion was set out by Alan Turing in 1936.
Turing machines are an example of a model of computation—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 speci-
fying computational procedures. Even though the term “Turing
machine” evokes the image of a physical machine with moving
parts, strictly speaking a Turing machine is a purely mathemat-
ical construct, and as such it idealizes the idea of a computa-
tional 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
260
CHAPTER 14. TURING MACHINE COMPUTATIONS 261
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 special kind of imaginary mechanism. This mechanism con-
sists of a tape and a read-write head. In our version of Turing ma-
chines, the tape is infinite in one direction (to the right), and it is
divided into squares, each of which may contain a symbol from a
finite alphabet. Such alphabets can contain any number of differ-
ent symbols, say, but we will mainly make do with three: ⊲, ⊔, and
I . When the mechanism is started, the tape is empty (i.e., each
square contains the symbol ⊔) 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 and a symbol 𝜎
and outputs a triple ⟨q ′, 𝜎 ′,D⟩. Whenever the mechanism is in
state q and reads symbol 𝜎, it replaces the symbol on the current
square with 𝜎 ′, the head moves left, right, or stays put according
to whether D is L, R, or N , and the mechanism goes into state q ′.
For instance, consider the situation in Figure 14.1. The visible
part of the tape of the Turing machine contains the end-of-tape
CHAPTER 14. TURING MACHINE COMPUTATIONS 262
which has only two internal states, q 0 and q 1 , and one instruction:
⊔,I ,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 ⊔ in state q 0 , write a I , move right, and move to state q 1 .
This is equivalent to the transition function mapping ⟨q 0 , ⊔⟩ to
⟨q 1 ,I ,R⟩.
start q0 q1
I ,I ,R
𝛿(q 0 ,I ) = ⟨q 1 ,I ,R⟩,
𝛿(q 1 ,I ) = ⟨q 0 ,I ,R⟩,
𝛿(q 1 , ⊔) = ⟨q 1 , ⊔,R⟩
The above machine halts only when the input is an even num-
ber of strokes. Otherwise, the machine (theoretically) continues
to operate indefinitely. For any machine and input, it is possi-
ble to trace through the configurations of the machine in order to
determine the output. We will give a formal definition of config-
urations later. For now, we can intuitively think of configurations
as a series of diagrams showing the state of the machine at any
CHAPTER 14. TURING MACHINE COMPUTATIONS 265
⊲I I 1 I ⊔ . . .
⊲I I I 0 ⊔ . . .
⊲I I I ⊔1 . . .
The machine has now traversed past all the I ’s, and is reading
a ⊔ in state q 1 . As shown in the diagram, there is an instruction
of the form 𝛿(q 1 , ⊔) = ⟨q 1 , ⊔,R⟩. Since the tape is filled with ⊔
indefinitely to the right, the machine will continue to execute this
instruction forever, staying in state q 1 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 halt-
ing 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 ⊔ at q 0 .
Example 14.2.
⊔, ⊔,R ⊔, ⊔,R
I ,I ,R
start q0 q1
I ,I ,R
Example 14.3. The machine table for the even machine is:
⊔ I ⊲
q0 I ,q 1 ,R
q1 ⊔,q 1 ,R I ,q 0 ,R
I ,I ,R I ,I ,R
I , ⊔,R ⊔, ⊔,R
start q0 q1 q2
⊔, ⊔,R ⊔,I ,R
q5 q4 q3
⊔, ⊔,L I ,I ,L
I ,I ,L I ,I ,L ⊔,I ,L
3. an initial state q 0 ∈ Q ,
Q = {q 0 ,q 1 }
𝛴 = {⊲, ⊔,I },
𝛿(q 0 ,I ) = ⟨q 1 ,I ,R⟩,
𝛿(q 1 ,I ) = ⟨q 0 ,I ,R⟩,
𝛿(q 1 , ⊔) = ⟨q 1 , ⊔,R⟩.
3. q ∈ Q
⟨⊲ ⌢ I , 1,q 0 ⟩.
I ,I ,R I ,I ,R I , ⊔,N
⊔,I ,N ⊔, ⊔,L
start q0 q1 q2
I n 1 ⊔ I n 2 ⊔ . . . ⊔ I nk
I ,I ,R I ,I ,L
⊔,I ,L
q2 q3
q6
⊔, ⊔,R ⊔, ⊔,L
R
I,
⊔,
⊔,I ,R
I ,I ,R q1 q4
q7 I ,I ,R
I , ⊔,R I ,I ,L
⊔, ⊔,L
start q0 q5
⊔,I ,R
q8 I , ⊔,N
I ,I ,L
every I in the input. It has to keep track of where the input ends,
so it leaves a ⊔ between the input and the added strokes, which it
fills with a I at the very end. And we have to “remember” where
we are in the input, so we temporarily replace a I in the input
block by a ⊔.
⊔, ⊔,R I ,I ,R I ,I ,L
I ,I ,R ⊔, ⊲,L
start q6 q7 q8
⊔, ⊔,L ⊔, ⊔,R
⊲, ⊲,R ⊔, ⊔,L
q 11 q 10 q9
L
⊔,
⊔,I ,R
I,
⊲, ⊔,N
⊔, ⊔,R q 12 q 13
of ⊔’s), it erases the I ’s one at a time and writes them at the be-
ginning of the tape. In order to be able to tell when it is done, it
first marks the end of the block of I ’s with a ⊲ symbol, which gets
deleted at the end. We’ve started numbering the states at q 6 , so
they can be added to the doubler machine. All you’ll need is an
additional instruction 𝛿(q 5 , ⊔) = ⟨q 6 , ⊔,N ⟩, i.e., an arrow from q 5
to q 6 labelled ⊔, ⊔,N .
⊔, ⊔,R
I ,I ,R
start q0 q1
I ,I ,R
⊔, ⊔,N
I ,I ,R
start q0 q1
I ,I ,R
⊔, ⊔,N ⊔, ⊔,N
h r
⊔,I ,N
start q0 q1
⊔, ⊔,L
I ,I ,R I ,I ,R
q2
I ,I ,L
I , ⊔,L
h q3
⊲, ⊲,R
⎧
⎪
⎪ 𝛿(q , 𝜎) if q ∈ Q
′′
⎨
⎪
𝛿 (q , 𝜎) = 𝛿 ′ (q , 𝜎) if q ∈ Q ′
⎪
⎪ ⟨q ′ , 𝜎,N ⟩ if q ∈ Q and 𝛿(q , 𝜎) undefined
⎪
⎩ 0
I ,I ,R I ,I ,R I , ⊔,N
⊔,I ,N ⊔, ⊔,L
start q0 q1 q2
the first stroke in the input and writes two strokes in a separate
output. Let’s add an instruction to make sure the tape head is
reading the first stroke of the output of the addition machine.
I ,I ,R I ,I ,R
⊔,I ,N ⊔, ⊔,L
start q0 q1 q2
I , ⊔,L
I ,I ,L q3
⊲, ⊲,R
q4
I ,I ,R I ,I ,R
⊔,I ,N ⊔, ⊔,L
start q0 q1 q2
I , ⊔,L
I ,I ,L q3
I ,I ,R I ,I ,R
⊲, ⊲,R
I , ⊔,R ⊔, ⊔,R
q4 q5 q6
⊔, ⊔,R ⊔,I ,R
q9 q8 q7
⊔, ⊔,L I ,I ,L
I ,I ,L I ,I ,L ⊔,I ,L
Summary
A Turing machine is a kind of idealized computation mecha-
nism. It consists of a one-way infinite tape, divided into squares,
each of which can contain a symbol from a pre-determined al-
phabet. The machine operates by moving a read-write head
along the tape. It may also be in one of a pre-determined num-
ber of states. The actions of the read-write head are determined
CHAPTER 14. TURING MACHINE COMPUTATIONS 285
Problems
Problem 14.1. Choose an arbitary input and trace through the
configurations of the doubler machine in Example 14.4.
all the A’s precede all the B’s, and rejects, i.e., does not halt on,
any string where the number of A’s is not equal to the number
of B’s or the A’s do not precede all the B’s. (E.g., the machine
should accept AABB, and AAABBB, but reject both AAB and
AABBAABB.)
where n and m ∈ Z+ .
Undecidability
15.1 Introduction
It might seem obvious that not every function, even every arith-
metical function, 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 number
of particles in the universe that decay in the n-th 1-second inter-
val 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 hope-
lessly 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 fi-
nite (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.
288
CHAPTER 15. UNDECIDABILITY 289
⊔, ⊔,R
I ,I ,R
start q0 q1
I ,I ,R
⊔, ⊔,R
A,A,R
start s h
A,A,R
2, 2,R
3, 3,R
start 1 2
3, 3,R
𝛴 𝛿 (2,2)=⟨2,2,R ⟩
⏟⏞⏞⏟ ⏟ˉˉˉˉˉ⏞⏞ˉˉˉˉˉ⏟
2, 1, 2 , 3, 1, 2, 3, 1, 1, 3, 2, 3, 2 , 2, 2, 2, 2, 2 , 2, 3, 1, 3, 2 .
⏞⏟⏟⏞ ⏞ˉˉˉˉˉ⏟⏟ˉˉˉˉˉ⏞ ⏞ˉˉˉˉˉ⏟⏟ˉˉˉˉˉ⏞
Q 𝛿 (1,3)= ⟨2,3,R ⟩ 𝛿 (2,3)=⟨1,3,R ⟩
Theorem 15.1. There are functions from N to N which are not Tur-
ing computable.
A machine may have more than one index, e.g., two descrip-
tions 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 Tur-
ing machine descriptions 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 description would be a sequence of blocks of I ’s (represent-
ing the positive integers in the sequence describing Me ).
Given this, it now becomes natural to ask: what functions
of Turing machine indices are themselves computable by Turing
machines? What properties of Turing machine indices can be de-
cided by Turing machines? An example: the function that maps
an index e to the number of states the Turing machine with in-
dex e has, is computable by a Turing machine. Here’s what such
a Turing machine would do: started on a tape containing a sin-
gle block of e I ’s, it would first decode e into its description. The
description is now represented by a sequence of blocks of I ’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 I ’s and then halt.
A remarkable result is the following:
7. Repeat.2
3. A constant symbol 0
0=0
n + 1 = n′
∀x ∀y ((Qqi (x ′, y) ∧ S𝜎 (x ′, y)) →
(Qq j (x, y ′) ∧ S𝜎′ (x ′, y ′) ∧ A(x, y))) ∧
∀y ((Qqi (0, y) ∧ S𝜎 (0, y)) →
(Qq j (0, y ′) ∧ S𝜎′ (0, y ′) ∧ A(0, y)))
∃x ∃y Qh (x, y)
Proof. Exercise. □
1. 𝛿(q , 𝜎) = ⟨q ′, 𝜎 ′,R⟩
2. 𝛿(q , 𝜎) = ⟨q ′, 𝜎 ′,L⟩
CHAPTER 15. UNDECIDABILITY 307
3. 𝛿(q , 𝜎) = ⟨q ′, 𝜎 ′,N ⟩
Qq (m,n) ∧ S𝜎 (m,n))
We now get
∀x ∀y ((Qq (x ′, y) ∧ S𝜎 (x ′, y)) →
(Qq ′ (x, y ′) ∧ S𝜎′ (x ′, y ′) ∧ A(x, y))) ∧
∀y ((Qqi (0, y) ∧ S𝜎 (0, y)) →
(Qq j (0, y ′) ∧ S𝜎′ (0, y ′) ∧ A(0, y)))
Qq ′ (l ,n ′) ∧ S𝜎′ (m,n ′) ∧
S𝜎0 (0,n ′) ∧ · · · ∧ S𝜎k (k ,n ′) ∧
∀x (k < x → S⊔ (x,n ′))
′
as before. (Note that in the first case, l ≡ l + 1 ≡ m and in
the second case l ≡ 0.) But this just is C (M ,w,n + 1).
Proof. By Lemma 15.13, we know that, for any time n, the de-
scription C (M ,w,n) of the configuration of M at time n is en-
tailed by T (M ,w). Suppose M halts after k steps. It will be
scanning square m, say. Then C (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 15.12,
C (M ,w,k ) ⊨ E (M ,w). But since T (M ,w) ⊨ C (M ,w,k ), we have
T (M ,w) ⊨ E (M ,w) and therefore T (M ,w) → E (M ,w) is valid.□
∀x ∀y ((Qqi (x ′, y) ∧ S𝜎 (x ′, y)) →
(Qq j (x, y ′) ∧ S𝜎′ (x ′, y ′) ∧ A(x, y))) ∧
∀y ((Qqi (0, y) ∧ S𝜎 (0, y)) →
(Qq j (0, y ′) ∧ S𝜎′ (0, y ′) ∧ A(0, y) ∧ B (y ′)))
|M ′ | = {0, . . . ,n}
{︄
M′ x + 1 if x < n
′ (x) =
n otherwise,
CHAPTER 15. UNDECIDABILITY 315
Proof. Exercise. □
Summary
Turing machines are determined by their instruction sets, which
are finite sets of quintuples (for every state and symbol read, spec-
ify new state, symbol written, and movement of the head). The
finite sets of quintuples are enumerable, so there is a way of as-
sociating a number with each Turing machine instruction set.
The index of a Turing machine is the number associated with
its instruction set under a fixed such schema. In this way we can
“talk about” Turing machines indirectly—by talking about their
indices.
One important problem about the behavior of Turing ma-
chines is whether they eventually halt. Let h (e ,n) be the func-
tion which = 1 if the Turing machine with index e halts when
started on input n, and = 0 otherwise. It is called the halting
function. The question of whether the halting function is itself
Turing computable is called the halting problem. The answer is
no: the halting problem is unsolvable. This is established using
a diagonal argument.
The halting problem is only one example of a larger class
of problems of the form “can X be accomplished using Turing
machines.” Another central problem of logic is the decision
problem for first-order logic: is there a Turing machine that
can decide if a given sentence is valid or not. This famous prob-
lem was also solved negatively: the decision problem is unsolv-
able. This is established by a reduction argument: we can asso-
ciate with each Turing machine M and input w a first-order sen-
tence T (M ,w) → E (M ,w) which is valid iff M halts when started
CHAPTER 15. UNDECIDABILITY 317
Problems
Problem 15.1. Can you think of a way to describe Turing ma-
chines that does not require that the states and alphabet symbols
are explicitly listed? You may define your own notion of “stan-
dard” machine, but say something about why every Turing ma-
chine can be computed by a “standard” machine in your new
sense.
is Turing computable.
CHAPTER 15. UNDECIDABILITY 318
Proofs
A.1 Introduction
Based on your experiences in introductory logic, you might be
comfortable with a derivation system—probably a natural de-
duction or Fitch style derivation system, or perhaps a proof-tree
system. You probably remember doing proofs in these systems,
either proving a formula or show that a given argument is valid.
In order to do this, you applied the rules of the system until 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 something 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.
321
APPENDIX A. PROOFS 322
Using a Conjunction
Perhaps the simplest inference pattern is that of drawing as con-
clusion 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
conjunction; 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
conjunction. 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).
APPENDIX A. PROOFS 328
Proving a Disjunction
When what you are proving takes the form of a disjunction (i.e., it
is an statement 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 are themselves dis-
junctive, 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 conclusion 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 any-
thing, it’s true for each particular thing. So if, say, the hypothesis
of your proof is A ⊆ B, that means (unpacking the definition
APPENDIX A. PROOFS 329
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 neces-
sary 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 disjunctive. Here’s a simple example:
Since x ∈ A, A ≠ ∅.
Let a ∈ A.
It’s maybe good practice to keep bound variables like “x” sep-
arate from hypothetical names like a, like we did. In practice,
however, we often don’t and just use x, like so:
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 in-
tersections of sets. It will illustrate unpacking definitions, proofs
of conjunctions, of universal claims, and proof by cases.
So, if z ∈ A ∪ (B ∩ C ) then z ∈ (A ∪ B) ∩ (A ∪ C ).
So, if z ∈ (A ∪ B) ∩ (A ∪ C ) then z ∈ A ∪ (B ∩ C ). □
show that some claim p is false, i.e., you want to show ¬p. The
most promising strategy is to (a) suppose that p is true, and (b)
show that this assumption leads to something you know to be
false. “Something known to be false” may be a result that con-
flicts with—contradicts—p itself, or some other hypothesis of the
overall claim you are considering. For instance, a proof of “if q
then ¬p” involves assuming that q is true and proving ¬p from
it. If you prove ¬p by contradiction, that means assuming p in
addition to q . If you can prove ¬q from p, you have shown that
the assumption p leads to something that contradicts your other
assumption q , since q and ¬q cannot both be true. Of course,
you have to use other inference patterns in your proof of the con-
tradiction, as well as unpacking definitions. Let’s consider an
example.
A has no elements iff it’s not the case that there is an x such that
x ∈ A.
Since A ⊆ B, x ∈ B.
Proposition A.11. A ⊆ A ∪ B.
A ∩ (A ∪ B) = A
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
• https://www.youtube.com/watch?v=BQ4yd2W50No
• https://www.youtube.com/watch?v=StTqXEQ2l-Y
APPENDIX A. PROOFS 350
Problems
Problem A.1. Suppose you are asked to prove that A ∩ B ≠ ∅.
Unpack all the definitions occuring here, i.e., restate this in a way
that does not mention “∩”, “=”, or “∅.
Proof. If z ∈ A ∪ (A ∩ B) then z ∈ A or z ∈ A ∩ B. If z ∈ A ∩ B,
z ∈ A. Any z ∈ A is also ∈ A ∪ (A ∩ B). □
APPENDIX B
Induction
B.1 Introduction
Induction is an important proof technique which is used, in dif-
ferent forms, in almost all areas of logic, theoretical computer
science, and mathematics. It is needed to prove many of the re-
sults in logic.
Induction is often contrasted with deduction, and character-
ized as the inference from the particular to the general. For in-
stance, 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 inference, in that it
proceeds from many particlar cases (this emerald is green, that
emerald is green, etc.) to a general claim (all emeralds are green).
Mathematical induction is also an inference that concludes a gen-
eral claim, but it is of a very different kind that this “simple in-
duction.”
Very roughly, an inductive proof in mathematics concludes
that all mathematical objects of a certain sort have a certain prop-
erty. In the simplest case, the mathematical objects an inductive
proof is concerned with are natural numbers. In that case an in-
ductive proof is used to establish that all natural numbers have
some property, and it does this by showing that
351
APPENDIX B. INDUCTION 352
B.2 Induction on N
In its simplest form, induction is a technique used to prove results
for all natural numbers. It uses the fact that by starting from 0
and repeatedly adding 1 we eventually reach every natural num-
ber. 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 property P ” by P (k ), etc.), then a proof by induction that
P (n) for all n ∈ N consists of:
To make this crystal clear, suppose we have both (1) and (2).
Then (1) tells us that P (0) is true. If we also have (2), we know
in particular that if P (0) then P (0 + 1), i.e., P (1). This follows
from the general statement “for any k , if P (k ) then P (k + 1)” by
putting 0 for k . So by modus ponens, we have that P (1). From (2)
again, now taking 1 for n, we have: if P (1) then P (2). Since we’ve
APPENDIX B. INDUCTION 353
Theorem B.1. With n dice one can throw all 5n + 1 possible values
between n and 6n.
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 number between 1 and 6.
s0 = 0
sn+1 = sn + (n + 1)
s 0 = 0,
s1 = s0 + 1 = 1,
s2 = s1 + 2 =1+2=3
s3 = s2 + 3 = 1 + 2 + 3 = 6, etc.
thereby established that P holds for all numbers less than 1. And
if we know that if P (l ) for all l < k , then P (k ), we know this
in particular for k = 1. So we can conclude P (1). With this we
have proved P (0) and P (1), i.e., P (l ) for all l < 2, and since we
have also the conditional, if P (l ) for all l < 2, then P (2), we can
conclude P (2), and so on.
In fact, if we can establish the general conditional “for all k ,
if P (l ) for all l < k , then P (k ),” we do not have to establish P (0)
anymore, since it follows from it. For remember that a general
claim like “for all l < k , P (l )” is true if there are no l < k . This
is a case of vacuous quantification: “all As are Bs” is true if there
are no As, ∀x (A(x) → B (x)) is true if no x satisfies A(x). In this
case, the formalized version would be “∀l (l < k → P (l ))”—and
that is true if there are no l < k . And if k = 0 that’s exactly the
case: no l < 0, hence “for all l < 0, P (0)” is true, whatever P is.
A proof of “if P (l ) for all l < k , then P (k )” thus automatically
establishes P (0).
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 .
closing “]” (if there are any at all), and for any ◦ we can find “nice”
expressions on either side, surrounded by a pair of parentheses.
We would like to precisely specify what counts as a “nice
term.” First of all, every letter by itself is nice. Anything that’s
not just a letter by itself should be of the form “[t ◦ s ]” where s
and t are themselves nice. Conversely, if t and s are nice, then we
can form a new nice term by putting a ◦ between them and sur-
round them by a pair of brackets. We might use these operations
to define the set of nice terms. This is an inductive definition.
a, b, c, d
Note that we have not yet proved that every sequence of sym-
bols that “feels” nice is nice according to this definition. However,
it should be clear that everything we can construct does in fact
“feel nice”: brackets are balanced, and ◦ connects parts that are
themselves nice.
The key feature of inductive definitions is that if you want
to prove something about all nice terms, the definition tells you
which cases you must consider. For instance, if you are told that
t is a nice term, the inductive definition tells you what t can look
like: t can be a letter, or it can be [s 1 ◦ s 2 ] for some pair of
nice terms s 1 and s2 . Because of clause (3), those are the only
possibilities.
When proving claims about all of an inductively defined set,
the strong form of induction becomes particularly important. For
instance, suppose we want to prove that for every nice term of
length n, the number of [ in it is < n/2. This can be seen as a
claim about all n: for every n, the number of [ in any nice term
of length n is < n/2.
l1 l2 l1 + l2 + 2 l1 + l − 2 + 3
m1 + m2 + 1 < + +1 = < = k /2.
2 2 2 2
o (s 1 ,s 2 ) =[s 1 ◦ s 2 ]
Proof. By induction on t :
1. t is a letter by itself: Then t has no proper initial segments.
2. If t2 is [s 1 ◦ s 2 ], then t1 ⊑ t2 iff t = t2 , t1 ⊑ s 1 , or t1 ⊑ s 2 .
If t2 = s1 ◦ s2 , then t1 ⊑ t2 iff t1 = t2 , t1 ⊑ s 1 , or t1 ⊑ s2 .
APPENDIX B. INDUCTION 363
s 1 = b and s 2 = a ◦ b.
r 1 = b ◦ a and r 2 = b.
For instance
s1 = a and s 2 = b ◦ c ◦ d,
or as r 1 ◦ r 2 with
r 1 = a ◦ b and r 2 = c ◦ d.
Problems
Problem B.1. Define the set of supernice terms by
Biographies
C.1 Georg Cantor
An early biography of Georg
Cantor (gay-org kahn-tor)
claimed that he was born and
found on a ship that was sail-
ing for Saint Petersburg, Rus-
sia, and that his parents were
unknown. This, however, is
not true; although he was
born in Saint Petersburg in
1845.
Cantor received his doc-
torate in mathematics at the
University of Berlin in 1867.
He is known for his work in
set theory, and is credited
with founding set theory as a
distinctive research discipline. Fig. C.1: Georg Cantor
He was the first to prove that
there are infinite sets of different sizes. His theories, and espe-
cially his theory of infinities, caused much debate among mathe-
maticians at the time, and his work was controversial.
366
APPENDIX C. BIOGRAPHIES 367
when their policy was updated to allow female students. She re-
ceived her doctorate in mathematics in 1907.
Despite her qualifications, Noether experienced much resis-
tance during her career. From 1908–1915, she taught at Erlangen
without pay. During this time, she caught the attention of David
Hilbert, one of the world’s foremost mathematicians of the time,
who invited her to Göttingen. However, women were prohibited
from obtaining professorships, and she was only able to lecture
under Hilbert’s name, again without pay. During this time she
proved what is now known as Noether’s theorem, which is still
used in theoretical physics today. Noether was finally granted
the right to teach in 1919. Hilbert’s response to continued resis-
tance of his university colleagues reportedly was: “Gentlemen,
the faculty senate is not a bathhouse.”
In the later 1920s, she concentrated on work in abstract alge-
bra, and her contributions revolutionized the field. In her proofs
she often made use of the so-called ascending chain condition,
which states that there is no infinite strictly increasing chain of
certain sets. For instance, certain algebraic structures now known
as Noetherian rings have the property that there are no infinite
sequences of ideals I 1 ⊊ I 2 ⊊ . . . . The condition can be general-
ized to any partial order (in algebra, it concerns the special case
of ideals ordered by the subset relation), and we can also con-
sider the dual descending chain condition, where every strictly
decreasing sequence in a partial order eventually ends. If a par-
tial order satisfies the descending chain condition, it is possible
to use induction along this order in a similar way in which we
can use induction along the < order on N. Such orders are called
well-founded or Noetherian, and the corresponding proof principle
Noetherian induction.
Noether was Jewish, and when the Nazis came to power in
1933, she was dismissed from her position. Luckily, Noether was
able to emigrate to the United States for a temporary position at
Bryn Mawr, Pennsylvania. During her time there she also lectured
at Princeton, although she found the university to be unwelcom-
ing to women (Dick, 1981, 81). In 1935, Noether underwent an
APPENDIX C. BIOGRAPHIES 374
quence and logical truth were written during this time. In 1939,
Tarski was visiting the United States for a lecture tour. During
his visit, Germany invaded Poland, and because of his Jewish her-
itage, 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 Institute 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.
The Greek
Alphabet
Alpha 𝛼 A Nu 𝜈 N
Beta 𝛽 B Xi 𝜉 𝛯
Gamma 𝛾 𝛤 Omicron o O
Delta 𝛿 𝛥 Pi 𝜋 𝛱
Epsilon 𝜀 E Rho 𝜌 P
Zeta 𝜁 Z Sigma 𝜎 𝛴
Eta 𝜂 H Tau 𝜏 T
Theta 𝜃 𝛩 Upsilon 𝜐 𝛶
Iota 𝜄 I Phi 𝜑 𝛷
Kappa 𝜅 K Chi 𝜒 X
Lambda 𝜆 𝛬 Psi 𝜓 𝛹
Mu 𝜇 M Omega 𝜔 𝛺
381
Glossary
anti-symmetric R is anti-symmetric iff, whenever both Rxy and
Ryx, then x = y; in other words: if x ≠ y then not Rxy
or not Ryx (see section 2.2).
assumption A formula that stands topmost in a derivation, also
called an initial formula. It may be discharged or undis-
charged (see section 11.1).
asymmetric R is asymmetric if for no pair x, y ∈ A we have Rxy
and Ryx (see section 2.4).
382
GLOSSARY 383
389
PHOTO CREDITS 390
391
BIBLIOGRAPHY 392
John Dawson, Jr. 1997. Logical Dilemmas: The Life and Work of
Kurt Gödel. Boca Raton: CRC Press.
Potter, Michael. 2004. Set Theory and its Philosophy. Oxford: Ox-
ford University Press.
Tarski, Alfred. 1981. The Collected Works of Alfred Tarski, vol. I–IV.
Basel: Birkhäuser.
398