A Problematic Course in Math Logic
A Problematic Course in Math Logic
Mathematical Logic
Version 1.5
Volume I
Propositional and
First-Order Logic
Stefan Bilaniuk
Author address:
Department of Mathematics
Trent University
Peterborough, Ontario
Canada K9J 7B8
E-mail address: sbilaniuk@trentu.ca
1991 Mathematics Subject Classification. 03.
Preface v
Introduction 1
Propositional Logic 5
Chapter 1. Language 7
Chapter 2. Truth Assignments 11
Chapter 3. Deductions 15
Chapter 4. Soundness and Completeness 19
First-Order Logic 21
Chapter 5. Languages 23
Chapter 6. Structures and Models 33
Chapter 7. Deductions 41
Chapter 8. Soundness and Completeness 47
Chapter 9. Applications of Compactness 51
Hints 57
Chapter 1. Hints 59
Chapter 2. Hints 61
Chapter 3. Hints 63
Chapter 4. Hints 65
Chapter 5. Hints 67
Chapter 6. Hints 69
Chapter 7. Hints 71
iii
iv CONTENTS
Chapter 8. Hints 73
Chapter 9. Hints 75
Appendices 77
Appendix A. A Little Set Theory 79
Appendix B. The Greek Alphabet 81
Appendix C. Logic Limericks 83
Bibliography 85
Index 87
Preface
1
Future versions of both volumes may include more – or less! – material. Feel
free to send suggestions, corrections, criticisms, and the like — I’ll feel free to ignore
them or use them.
v
vi PREFACE
4
If you are not a mathematician, gentle reader, you are hereby temporarily
promoted.
1
2 INTRODUCTION
and determine their truth. The real fun lies in the relationship between
interpretation of statements, truth, and reasoning.
This volume develops the basics of two kinds of formal logical sys-
tems, propositional logic and first-order logic. Propositional logic at-
tempts to make precise the relationships that certain connectives like
not, and , or , and if . . . then are used to express in English. While it
has uses, propositional logic is not powerful enough to formalize most
mathematical discourse. For one thing, it cannot handle the concepts
expressed by all and there is. First-order logic adds all and there is to
those which propositional logic could handle, and suffices, in principle,
to formalize most mathematical reasoning. To be sure, it will not han-
dle concepts which arise outside of mathematics, such as possible and
relevant, among many others. (Trying to incorporate such concepts
into systems extending first-order logic is a substantial industry in phi-
losophy, but of marginal interest in mathematics.) Propositional logic,
which is much simpler, will be dealt with first in order to gain some
experience in dealing with formal systems before tackling first-order
logic. Besides, some of the results about propositional logic carry over
to first-order logic with little change.
Other Sources and Further Reading. [4], [8], and [9] are texts
which go over similar ground (and much more), while [1] and [3] are
INTRODUCTION 3
1
H
HH
H
j
H
2 3
H
H
H
Hj
H
4
5
H
H
HH
j?
H
6 7
H
H
H
Hj
H
8
?
9
4 INTRODUCTION
Propositional Logic
CHAPTER 1
Language
Truth Assignments
Truth tables are often used even when the formula in question is
not broken down all the way into atomic formulas. For example, if α
and β are any formulas and we know that α is true but β is false, then
the truth of (α → (¬β)) can be determined by means of the following
table:
α β (¬β) (α → (¬β))
T F T T
Definition 2.2. If v is a truth assignment and ϕ is a formula, we
will often say that v satisfies ϕ if v(ϕ) = T . Similarly, if Σ is a set
of formulas, we will often say that v satisfies Σ if v(σ) = T for every
σ ∈ Σ. We will say that ϕ (respectively, Σ) is satisfiable if there is
some truth assignment which satisfies it.
Definition 2.3. A formula ϕ is a tautology if it is satisfied by
every truth assignment. A formula ψ is a contradiction if there is no
truth assignment which satisfies it.
For example, (A4 → A4) is a tautology while (¬(A4 → A4)) is a
contradiction, and A4 is a formula which is neither. One can check
whether a given formula is a tautology, contradiction, or neither, by
grinding out a complete truth table for it, with a separate line for each
possible assignment of truth values to the atomic subformulas of the
formula. For A3 → (A4 → A3 ) this gives
A3 A4 A4 → A3 A3 → (A4 → A3)
T T T T
T F T T
F T F T
F F T T
so A3 → (A4 → A3) is a tautology. Note that, by Proposition 2.2, we
need only consider the possible truth values of the atomic sentences
which actually occur in a given formula.
One can often use truth tables to determine whether a given formula
is a tautology or a contradiction even when it is not broken down all
the way into atomic formulas. For example, if α is any formula, then
the table
α (α → α) (¬(α → α))
T T F
F T F
demonstrates that (¬(α → α)) is a contradiction, no matter which
formula of LP α actually is.
14 2. TRUTH ASSIGNMENTS
Deductions
2. ¬α → ¬α Example 3.1
3. (¬α → α) → α 1,2 MP
Hence ` (¬α → α) → α, as desired. To be completely formal, one
would have to insert the deduction given in Example 3.1 (with ϕ re-
placed by ¬α throughout) in place of line 2 above and renumber the
old line 3.
Problem 3.3. Show that if α, β, and γ are formulas, then
1. { α → (β → γ), β } ` α → γ
2. ` α ∨ ¬α
Example 3.4. Let us show that ` ¬¬β → β.
1. (¬β → ¬¬β) → ((¬β → ¬β) → β) A3
2. ¬¬β → (¬β → ¬¬β) A1
3. ¬¬β → ((¬β → ¬β) → β) 1,2 Example 3.2
4. ¬β → ¬β Example 3.1
5. ¬¬β → β 3,4 Problem 3.3.1
Hence ` ¬¬β → β, as desired.
Certain general facts are sometimes handy:
Proposition 3.4. If ϕ1ϕ2 . . . ϕn is a deduction of LP , then ϕ1 . . . ϕ`
is also a deduction of LP for any ` such that 1 ≤ ` ≤ n.
Proposition 3.5. If Γ ` δ and Γ ` δ → β, then Γ ` β.
Proposition 3.6. If Γ ⊆ ∆ and Γ ` α, then ∆ ` α.
Proposition 3.7. If Γ ` ∆ and ∆ ` σ, then Γ ` σ.
The following theorem often lets one take substantial shortcuts
when trying to show that certain deductions exist in LP , even though
it doesn’t give us the deductions explicitly.
Theorem 3.8 (Deduction Theorem). If Σ is any set of formulas
and α and β are any formulas, then Σ ` α → β if and only if Σ∪{α} `
β.
Example 3.5. Let us show that ` ϕ → ϕ. By the Deduction
Theorem it is enough to show that {ϕ} ` ϕ, which is trivial:
1. ϕ Premiss
Compare this to the deduction in Example 3.1.
Problem 3.9. Appealing to previous deductions and the Deduction
Theorem if you wish, show that:
1. {δ, ¬δ} ` γ
18 3. DEDUCTIONS
2. ` ϕ → ¬¬ϕ
3. ` (¬β → ¬α) → (α → β)
4. ` (α → β) → (¬β → ¬α)
5. ` (β → ¬α) → (α → ¬β)
6. ` (¬β → α) → (¬α → β)
7. ` σ → (σ ∨ τ )
8. {α ∧ β} ` β
9. {α ∧ β} ` α
CHAPTER 4
How are deduction and implication related, given that they were
defined in completely different ways? We have some evidence that they
behave alike; compare, for example, Proposition 2.9 and the Deduction
Theorem. It had better be the case that if there is a deduction of a
formula ϕ from a set of premisses Σ, then ϕ is implied by Σ. (Otherwise,
what’s the point of defining deductions?) It would also be nice for the
converse to hold: whenever ϕ is implied by Σ, there is a deduction of
ϕ from Σ. (So anything which is true can be proved.) The Soundness
and Completeness Theorems say that both ways do hold, so Σ ` ϕ if
and only if Σ |= ϕ, i.e. ` and |= are equivalent for propositional logic.
One direction is relatively straightforward to prove . . .
Theorem 4.1 (Soundness Theorem). If ∆ is a set of formulas and
α is a formula such that ∆ ` α, then ∆ |= α.
. . . but for the other direction we need some additional concepts.
Definition 4.1. A set of formulas Γ is inconsistent if Γ ` ¬(α →
α) for some formula α, and consistent if it is not inconsistent.
For example, {A41} is consistent by Proposition 4.2, but it follows
from Problem 3.9 that {A13, ¬A13} is inconsistent.
Proposition 4.2. If a set of formulas is satisfiable, then it is con-
sistent.
Proposition 4.3. Suppose ∆ is an inconsistent set of formulas.
Then ∆ ` ψ for any formula ψ.
Proposition 4.4. Suppose Σ is an inconsistent set of formulas.
Then there is a finite subset ∆ of Σ such that ∆ is inconsistent.
Corollary 4.5. A set of formulas Γ is consistent if and only if
every finite subset of Γ is consistent.
To obtain the Completeness Theorem requires one more definition.
Definition 4.2. A set of formulas Σ is maximally consistent if Σ
is consistent but Σ ∪ {ϕ} is inconsistent for any ϕ ∈
/ Σ.
19
20 4. SOUNDNESS AND COMPLETENESS
Languages
1
It is possible to formalize almost all of mathematics in a single first-order
language, like that of set theory or category theory. However, trying to actually do
most mathematics in such a language is so hard as to be pointless.
2
Specifically, to countable one-sorted first-order languages with equality.
5. LANGUAGES 25
1. Groups.
2. Graphs.
3. Vector spaces.
We will need a few additional concepts and facts about formulas of
first-order logic later on. First, what are the subformulas of a formula?
Problem 5.10. Define the set of subformulas of a formula ϕ of a
first-order language L.
For example, if ϕ is
(((¬∀v1 (¬ = v1 c7)) → P32 v5v8) → ∀v8(= v8 f53 c0 v1v5 → P21 v8))
in the language L1 , then the set of subformulas of ϕ, S(ϕ), ought to
include
• = v1c7 , P32 v5v8, = v8f53 c0 v1v5 , P21 v8 ,
• (¬ = v1c7 ), (= v8f53 c0 v1v5 → P21 v8),
• ∀v1 (¬ = v1 c7), ∀v8(= v8f53 c0 v1v5 → P21 v8),
• (¬∀v1 (¬ = v1 c7)),
• (¬∀v1 (¬ = v1 c7)) → P32 v5v8), and
• (((¬∀v1 (¬ = v1c7 )) → P32 v5 v8) → ∀v8(= v8f53 c0 v1v5 → P21 v8))
itself.
Second, we will need a concept that has no counterpart in proposi-
tional logic.
Definition 5.4. Suppose x is a variable of a first-order language
L. Then x occurs free in a formula ϕ of L is defined as follows:
1. If ϕ is atomic, then x occurs free in ϕ if and only if x occurs in
ϕ.
2. If ϕ is (¬α), then x occurs free in ϕ if and only if x occurs free
in α.
3. If ϕ is (β → δ), then x occurs free in ϕ if and only if x occurs
free in β or in δ.
4. If ϕ is ∀vk ψ, then x occurs free in ϕ if and only if x is different
from vk and x occurs free in ψ.
An occurrence of x in ϕ which is not free is said to be bound . A formula
σ of L in which no variable occurs free is said to be a sentence.
Part 4 is the key: it asserts that an occurrence of a variable x
is bound instead of free if it is in the “scope” of an occurrence of
∀x. For example, v7 is free in ∀v5 = v5v7, but v5 is not. Different
occurences of a given variable in a formula may be free or bound,
depending on where they are; e.g. v6 occurs both free and bound in
∀v0 (= v0f31 v6 → (¬∀v6 P91 v6 )).
30 5. LANGUAGES
given by
(
s(vk ) if vk is different from x
s(x|m)(vk ) =
m if vk is x.
If M |= ϕ[s], we shall say that M satisfies ϕ on assignment s or that
ϕ is true in M on assignment s. We will often write M 2 ϕ[s] if it is
not the case that M |= ϕ[s]. Also, if Γ is a set of formulas of L, we
shall take M |= Γ[s] to mean that M |= γ[s] for every formula γ in Γ
and say that M satisfies Γ on assignment s. Similarly, we shall take
M 2 Γ[s] to mean that M 2 γ[s] for some formula γ in Γ.
Clauses 1 and 2 are pretty straightforward and clauses 3 and 4 are
essentially identical to the corresponding parts of Definition 2.1. The
key clause is 5, which says that ∀ should be interpreted as “for all
elements of the universe”.
Example 6.3. Let R be the structure for LF and s the assignment
for R given in Example 6.1, and consider the formula ∀v1 (= v3 ·0v1 →=
v30) of LF . We can verify that R |= ∀v1 (= v3 · 0v1 →= v30) [s] as
follows:
R |= ∀v1 (= v3 · 0v1 →= v3 0) [s]
⇐⇒ for all a ∈ |R|, R |= (= v3 · 0v1 →= v3 0) [s(v1|a)]
⇐⇒ for all a ∈ |R|, if R |== v3 · 0v1 [s(v1|a)],
then R |== v3 0 [s(v1|a)]
⇐⇒ for all a ∈ |R|, if s(v1|a)(v3) = s(v1 |a)(·0v1),
then s(v1|a)(v3) = s(v1|a)(0)
⇐⇒ for all a ∈ |R|, if s(v3) = s(v1|a)(0) · s(v1|a)(v1), then s(v3) = 0
⇐⇒ for all a ∈ |R|, if s(v3) = 0 · a, then s(v3 ) = 0
⇐⇒ for all a ∈ |R|, if 4 = 0 · a, then 4 = 0
⇐⇒ for all a ∈ |R|, if 4 = 0, then 4 = 0
. . . which last is true whether or not 4 = 0 is true or false.
Problem 6.4. Let N be the structure for LN in Problem 6.2. Let
p : V → N be defined by p(v2k ) = k and p(v2k+1 ) = k. Verify that
1. N |= ∀w (¬Sw = 0) [p] and
2. N 2 ∀x∃y x + y = 0 [p].
Proposition 6.5. Suppose M is a structure for L, s is an assign-
ment for M, x is a variable, and ϕ is a formula of a first-order language
L. Then M |= ∃x ϕ[s] if and only if M |= ϕ[s(x|m)] for some m ∈ |M|.
Working with particular assignments is difficult but, while some-
times unavoidable, not always necessary.
6. STRUCTURES AND MODELS 37
Deductions
41
42 7. DEDUCTIONS
1 c
ϕx is ϕ with every occurence of the constant c replaced by x.
46 7. DEDUCTIONS
CHAPTER 8
Applications of Compactness
From the finite to the infinite. Perhaps the simplest use of the
Compactness Theorem is to show that if there exist arbitrarily large
finite objects of some type, then there must also be an infinite object
of this type.
Example 9.1. We will use the Compactness Theorem to show that
there is an infinite commutative group in which every element is of order
2, i.e. such that g · g = e for every element g.
Let LG be the first-order language with just two non-logical sym-
bols:
• Constant symbol: e
• 2-place function symbol: ·
Here e is intended to name the group’s identity element and · the group
operation. Let Σ be the set of sentences of LG including:
1. The axioms for a commutative group:
• ∀x x · e = x
• ∀x ∃y x · y = e
• ∀x ∀y ∀z x · (y · z) = (x · y) · z
• ∀x ∀y y · x = x · y
2. A sentence which asserts that every element of the universe is of
order 2:
• ∀x x · x = e
3. For each n ≥ 2, a sentence, σn , which asserts that there are at
least n different elements in the universe:
• ∃x1 . . . ∃xn ((¬x1 = x2) ∧ (¬x1 = x3 ) ∧ · · · ∧ (¬xn−1 = xn ))
51
52 9. APPLICATIONS OF COMPACTNESS
Hints
59
60 1. HINTS
CHAPTER 2
Hints
61
62 2. HINTS
CHAPTER 3
Hints
63
64 3. HINTS
CHAPTER 4
Hints
65
66 4. HINTS
CHAPTER 5
Hints
5.1. Try to disassemble each string using Definition 5.2. Note that
some might be valid terms of more than one of the given languages.
5.2. This is similar to Problem 1.5.
5.3. This is similar to Proposition 1.7.
5.4. Try to disassemble each string using Definitions 5.2 and 5.3.
Note that some might be valid formulas of more than one of the given
languages.
5.5. This is just like Problem 1.2.
5.6. This is similar to Problem 1.5. You may wish to use your
solution to Problem 5.2.
5.7. This is similar to Proposition 1.7.
5.8. You might want to rephrase some of the given statements to
make them easier to formalize.
1. Look up associativity if you need to.
2. “There is an object such that every object is not in it.”
3. This should be easy.
4. Ditto.
5. “Any two things must be the same thing.”
5.9. If necessary, don’t hesitate to look up the definitions of the
given structures.
1. Read the discussion at the beginning of the chapter.
2. You really need only one non-logical symbol.
3. There are two sorts of objects in a vector space, the vectors
themselves and the scalars of the field, which you need to be
able to tell apart.
5.10. Use Definition 5.3 in the same way that Definition 1.2 was
used in Definition 1.3.
5.11. The scope of a quantifier ought to be a certain subformula of
the formula in which the quantifier occurs.
67
68 5. HINTS
Hints
Hints
Hints
symbols and relation symbols in a similar way. You need to show that
all these things are well-defined, and then show that M |= Σ.
8.15. Expand Γ to a maximally consistent set of sentences with a
set of witnesses in a suitable extension of L, apply Theorem 8.14, and
then cut down the resulting structure to one for L.
8.16. One direction is just Proposition 8.2. For the other, use
Corollary 8.15.
8.17. This follows from Theorem 8.16 in the same way that the
Completeness Theorem for propositional logic followed from Theorem
4.11.
8.18. This follows from Theorem 8.16 in the same way that the
Compactness Theorem for propositional logic followed from Theorem
4.11.
CHAPTER 9
Hints
9.1. In each case, apply the trick used in Example 9.1. For defi-
nitions and the concrete examples, consult texts on combinatorics and
abstract algebra.
9.2. Suppose Ramsey’s Theorem fails for some n. Use the Com-
pactness Theorem to get a contradiction to Lemma 9.3 by showing
there must be an infnite graph with no clique or independent set of
size n.
9.3. Inductively define a sequence a0, a1 , . . . , of vertices so that for
every n, either it is the case that for all k ≥ n there is an edge joining
an to ak or it is the case that for all k ≥ n there is no edge joining an
to ak . There will then be a subsequence of the sequence which is an
infinite clique or a subsequence which is an infinite independent set.
9.4. The key is to figure out how, given an assignment for one
structure, one should define the corresponding assignment in the other
structure. After that, proceed by induction using the definition of
satisfaction.
9.5. When are two finite structures for L= elementarily equivalent?
9.6. In a suitable expanded language, consider Th(N) together with
the sentences ∃x 0 + x = c, ∃x S0 + x = c, ∃x SS0 + x = c, . . .
9.7. Suppose M |= Th(N) but is not isomorphic to N.
1. Consider the subset of |M| given by 0M , S M (0M ), S M (S M (0M )),
...
2. If it didn’t have one, it would be a copy of N.
3. Start with a infinite number and work down.
9.8. Expand LF by throwing in a constant symbol for every real
number, plus an extra one, and take it from there.
75
76 9. HINTS
Appendices
APPENDIX A
1
Which came first, the chicken or the egg? Since, biblically speaking, “In the
beginning was the Word”, maybe we ought to plump for alphabetical order. Which
begs the question: In which alphabet?
APPENDIX B
A α alpha
B β beta
Γ γ gamma
∆ δ delta
E ε epsilon
Z ζ zeta
H η eta
Θ θ ϑ theta
I ι iota
K κ kappa
Λ λ lambda
M µ mu
N ν nu
O o omicron
Ξ ξ xi
Π π $ pi
P ρ % rho
Σ σ ς sigma
T τ tau
Υ υ upsilon
Φ φ ϕ phi
X χ chi
Ψ ψ psi
Ω ω omega
81
82 B. THE GREEK ALPHABET
APPENDIX C
Logic Limericks
Deduction Theorem
Generalization Theorem
Soundness Theorem
Completeness Theorem
83
84 C. LOGIC LIMERICKS
Bibliography
[1] Jon Barwise (ed.), Handbook of Mathematical Logic, North Holland, Amster-
dam, 1977, ISBN 0-7204-2285-X.
[2] Merrie Bergman, James Moor, and Jack Nelson, The Logic Book, Random
House, NY, 1980, ISBN 0-394-32323-8.
[3] C.C. Chang and H.J. Keisler, Model Theory, third ed., North Holland, Ams-
terdam, 1990.
[4] Herbert B. Enderton, A Mathematical Introduction to Logic, Academic Press,
New York, 1972.
[5] Paul R. Halmos, Naive Set Theory, Undergraduate Texts in Mathematics,
Springer-Verlag, New York, 1974, ISBN 0-387-90092-6.
[6] James M. Henle, An Outline of Set Theory, Problem Books in Mathematics,
Springer-Verlag, New York, 1986, ISBN 0-387-96368-5.
[7] Douglas R. Hofstadter, Gödel, Escher, Bach, Random House, New York, 1979,
ISBN 0-394-74502-7.
[8] Jerome Malitz, Introduction to Mathematical Logic, Springer-Verlag, New
York, 1979, ISBN 0-387-90346-1.
[9] Yu.I. Manin, A Course in Mathematical Logic, Graduate Texts in Mathemat-
ics 53, Springer-Verlag, New York, 1977, ISBN 0-387-90243-0.
[10] Roger Penrose, The Emperor’s New Mind, Oxford University Press, Oxford,
1989.
85
86 BIBLIOGRAPHY
Index
(, 7, 24 R, 80
), 7, 24 Rn , 53
=, 24, 25 S, 10
∩, 79 T , 11
∪, 79 Th, 39, 45
∃, 30 vn , 24
∀, 24, 25, 30 X n , 79
↔, 9, 30 [X]k , 79
∈, 79 Ȳ , 79
∧, 9, 30
¬, 7, 24, 25 abbreviations, 9, 30
∨, 9, 30 all, 2
|=, 14, 35, 37 and, 2, 9
2, assignment, 34, 35
Q 14, 36, 37 extended, 35
, 79
`, 16, 43 truth, 11
\, 79 atomic formulas, 7, 27
⊆, 79 axiom, 15, 28, 39
×, 79 logical, 43
→, 7, 24, 25 schema, 15, 42
A1, 15, 42
An , 7 A2, 15, 42
F , 11 A3, 15, 42
ϕxt , 42 A4, 42
L, 24 A5, 42
L= , 26 A6, 42
L1 , 26 A7, 42
LF , 26 A8, 42
LG, 51 bound variable, 29
LN , 26
LNT , 25 chicken, 80
LO , 26 clique, 52
LP , 7 Compactness Theorem, 20, 50
LS , 26 applications of, 51
M, 33 complement, 79
N, 80 Completeness Theorem, 20, 50, 83
N, 33 connectives, 7, 9, 24
P, 79 consistent, 19, 47
Q, 80 maximally, 19, 48
87
88 INDEX
satisfiable, 13, 37
satisfies, 13, 36, 37
scope of a quantifier, 30
sentence, 29
sentential logic, 7
set theory, 79
Soundness Theorem, 19, 47, 83
structure, 33
subformula, 10, 29
subgraph, 52
subset, 79
substitutable, 41
substitution, 41
symbols, 7, 24
logical, 24
non-logical, 24
tautology, 13, 38
term, 26, 31, 35
unique readability, 32
theorem, 31
theory, 39, 45
there is, 2
truth
assignment, 11
in a structure, 36, 37
table, 12, 13
values, 11
uncountable, 80
union, 79
unique readability
of formulas, 10, 32
of terms, 32
Unique Readability Theorem, 10, 32
universal quantifier, 30
universe, 33