70
Introduction to Mathematical Logic aszl´oCsirmaz Central European University 2007

Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

  • Upload
    others

  • View
    16

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

Introduction to

Mathematical Logic

Laszlo Csirmaz

Central European University

2007

Page 2: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

2

Page 3: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

Contents

1 Introduction 51.1 Propositional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.1.1 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.1.2 Compactness . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.2 First-order logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.2.1 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.2.2 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.3 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2 Model theory 152.1 Elementary equivalence . . . . . . . . . . . . . . . . . . . . . . . 152.2 The ultraproduct . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.3 Cardinality of Models . . . . . . . . . . . . . . . . . . . . . . . . 21

3 Provability, completeness 253.1 Hilbert-type derivation . . . . . . . . . . . . . . . . . . . . . . . . 25

3.1.1 Propositional Logic . . . . . . . . . . . . . . . . . . . . . . 263.1.2 First-order Logic . . . . . . . . . . . . . . . . . . . . . . . 29

3.2 The resolution method . . . . . . . . . . . . . . . . . . . . . . . . 343.2.1 Propositional Logic . . . . . . . . . . . . . . . . . . . . . . 343.2.2 First-order Logic . . . . . . . . . . . . . . . . . . . . . . . 37

4 Incompleteness 454.1 Pre-amble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.2 Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . 504.3 Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.4 Undecidability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534.5 Godel’s Incompleteness Theorems . . . . . . . . . . . . . . . . . . 604.6 Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

5 Problems 67

3

Page 4: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4 CONTENTS

Page 5: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

Chapter 1

Introduction

By the widely accepted definition

logic investigates the laws, and methods of inference and argumen-tation.

Mathematical logic is a mathematical investigation of this subject, similarlyas number theory is the mathematical investigation of the natural numbers.Developing such a theory one can use the full machinery mathematics offers,including, for example, infinite sets, general algebraic constructions, and thelike.

As any other mathematical discipline, mathematical logic also distills itssubject from everyday life experience. Then it gives precise definitions – hopingthat they have relevance to the real objects –, and proves statements aboutwhat have been defined. These statements, or “theorems,” are pulled back tothe real life, interpreted, explained, and compared to the expectations, do theyconfirm them, or do the contradict them?

Mathematical logic studies formal logical systems as mathematical objects.Definitions in this book are designed to make proofs easy rather than to helpunderstanding why these are the “right definitions.” Other formal systems havebeen developed which have – provably – the same expression power, are easierto use, but much harder to prove things about.

In this book we consider two kinds of formal systems: propositional logicand first-order logic. Propositional logic attempts to formalize the simplestdeductive system, using connectives and, not, and implication. First order logicadds quantifiers to its armory, can speak about functions and relations. Itis more powerful than propositional logic, and, in essence, can capture most(mathematical) reasoning. Propositional logic, being the simpler one, serves asa test-bed for several concepts. Quite a few results on propositional logic carryover to first order one with minor changes.

Other formal systems are studied as well. Modal logic can handle conceptssuch as possible or necessary. Higher order logic deals with functional opera-tors directly. Many sorted logic handles universes composed of different sort of

5

Page 6: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

6 CHAPTER 1. INTRODUCTION

objects such as vectors over a field.

1.1 Propositional Logic

1.1.1 Syntax

First we define a simple language, called propositional logic, expressing theessence of mathematical reasoning. It goes by defining a strict formal waycertain objects which we shall call well-formed propositional formulas, or simplyformulas. It goes by defining a language, i.e. a collection of finite sequences ofa set Σ called alphabet.

The alphabet, the elements of which are called symbols, splits into two parts.The set of propositional variables V = {vξ : ξ < κ} is a set of distinct symbols;here κ is a cardinal. We assume that κ is infinite, however this is not an essentialrestriction. The other part is the set of logical symbols where we have logicalconnectives or operators, among them the symbols ∨ and ¬, and the parentheses( and ). Of course, logical symbols differ from the propositional variables.

Definition 1.1 The (propositional) formulas, or sentences form the smallestset F of finite sequences of V ∪ {∨,¬, (, )} which satisfies

V ⊂ F ; if ϕ, ψ ∈ F then (ϕ) ∨ (ψ) ∈ F and ¬(ϕ) ∈ F.

Lemma 1.2 (Unique Readability Lemma) By using parentheses, for each ϕ ∈F there is a unique way to decipher ϕ, i.e. to find out how it was built up. �

We shall have other sequences which we call formulas, too. However, weregard them as abbreviations only. For example,

(ϕ) ∧ (ψ) instead of ¬(¬ϕ ∨ ¬ψ)ϕ→ ψ instead of ¬ϕ ∨ ψϕ↔ ψ instead of (ϕ→ ψ) ∧ (ψ → ϕ) .

As here, in writing formulas we leave off the superfluous parentheses.We think of a propositional variable as being either true or false, which we

denote by > and ⊥, respectively. A valuation of the variables is a functionf : V → {>,⊥}. It rises to a valuation of formulas as follows:

f(ϕ ∨ ψ) ={> if either f(ϕ) = > or f(ψ) = >,⊥ otherwise,

f(¬ϕ) ={> if f(ϕ) = ⊥,⊥ otherwise.

Of course, f(ϕ ∧ ψ), f(ϕ → ψ), etc. also have the expected meaning, forexample, f(ϕ ∧ ψ) is true just in case both f(ϕ) and f(ψ) are true.

Occasionally we will use ⊥ as a logical symbol as well, i.e. it may appear insentences where it always evaluates to false.

Page 7: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

1.1. PROPOSITIONAL LOGIC 7

Definition 1.3 A formula ϕ ∈ F is satisfiable if for some valuation f : V →{>,⊥}, f(ϕ) = >. ϕ is a tautology if for each valuation f we have f(ϕ) = >.

For example, ϕ ∨ ¬ϕ is a tautology, and v0 (as a formula where v0 is a propo-sitional variable) is satisfiable but it is not tautology. ϕ is is a tautology iff ¬ϕis not satisfiable.

Definition 1.4 A collection of sentences Σ ⊂ F is satisfiable if for some f :V → {>,⊥} every ϕ ∈ Σ is true, and Σ is refutable if it is not satisfiable. Wewrite Σ |= ϕ if for every valuation f , whenever all elements of Σ are true, thenϕ is also true.

Obviously, ∅ |= ϕ iff ϕ is a tautology; Σ |= ⊥ iff Σ is refutable, i.e. not satisfiable.Σ |= ϕ iff Σ ∪ {¬ϕ} is refutable iff Σ ∪ {¬ϕ} |= ⊥. If Σ is empty, we leave outthe ∅ sign and write |= ϕ instead of ∅ |= ϕ. If Σ is finite, say Σ = {ψ0, ψ1, . . . ,ψn−1}, then Σ is satisfiable iff the sentence

ψ0 ∧ ψ1 ∧ . . . ∧ ψn−1

is satisfiable.

Lemma 1.5 (Replacement Lemma) If ϕ is a tautology, then replacing eachvariable in ϕ systematically by a formula, the resulting sentence is also a tau-tology. �

Lemma 1.6 (Deduction Lemma) Σ ∪ {ψ} |= ϕ iff Σ |= ψ → ϕ . �

By induction we get immediately that {ψ0, ψ1, . . . , ψn−1} |= ϕ iff

|= ψ0 → (ψ1 → . . .→ (ψn−1 → ϕ) . . .),

iff|= (ψ0 ∧ . . . ∧ ψn−1)→ ϕ.

We call ϕ and ψ logically equivalent if ϕ↔ ψ is a tautology. Thus ϕ∨ψ andψ ∨ ϕ are logically equivalent for each pair ϕ, ψ ∈ F .

One can think of the formulas as the freely generated algebra with two op-eration symbols: the unary ¬ and the binary ∨ (or perhaps with ∧, →, etc.),and generating elements {vα : α < κ}. A valuation is, in fact, a homeomor-phism from this algebra into the two-element algebra {>,⊥} with the obviousinterpretation of the operation symbols. A formula is a tautology iff every suchhomeomorphism sends it into >. One can find easily translations of the othernotions introduced so far. Factorizing the algebra by the set of tautologies onegets a (freely generated) Boolean algebra. The properties of this setting canbe investigated by algebraic methods, yielding nice, deep and general results,pointing out the basic reason for this or that fact. However, we shall not followthis route, only indicate how to translate back our results into the algebraicsetting.

Page 8: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

8 CHAPTER 1. INTRODUCTION

Lemma 1.7 Suppose the valuations f and g agree on the propositional variablesoccurring in ϕ. Then f(ϕ) = g(ϕ).

Proof By induction on the complexity of the formula ϕ. Since F is freelygenerated, and every element is uniquely built up, the induction is justified. �

Lemma 1.8 Given a finite set of sentences Σ, there is an algorithm whichdecides whether Σ is satisfiable or not.

Proof By the previous lemma, the satisfiability of Σ depends only on the vari-ables occurring in some formula of Σ. Since there are only finitely many formulasand finitely many variables in each, this means finitely many possibilities. �

If there are n symbols in Σ, then the number of variables is at most n, thusat most n different variables may occur. Given a valuation of the variables,checking whether all the elements of Σ are true requires time proportional to apolynomial of n, thus the total time is somewhere around 2n. One cannot hopea significantly faster method since this problem is known to be NP complete.

1.1.2 Compactness

We start with an important technical tool. Let F be a family of subsets of thenonempty set X.

Definition 1.9 (i) F has the finite intersection property, FIP in short, if theintersection of finitely many members of F is never empty.

(ii) F is a filter if (a) F is not empty, and the empty set is not an element ofF ; (b) if A ∈ F and A ⊂ B ⊂ X then B ∈ F ; finally (c) if A and B arein F then so is A ∩B.

(iii) F is an ultrafilter if it is a filter, moreover for each A ⊂ X, either A ∈ For X −A ∈ F .

Given a set X, the family of all subsets containing a particular elementa ∈ X is an ultrafilter. Ultrafilters of this form are called trivial, or principal,all other ultrafilters are nontrivial or proper. If X is finite then all ultrafilterson X are trivial; on infinite sets there are non-trivial ultrafilters as well. Filtershave the finite intersection property, and ultrafilters are maximal FIP families.An easy consequence of Zorn’s lemma is

Claim 1.10 Every FIP family can be extended to an ultrafilter. �

Theorem 1.11 (Compactness Theorem for Propositional Logic – weak form)If every finite subset of Σ is satisfiable then Σ is also satisfiable.

Proof Let A be the collection of finite subsets of Σ, and for each a ∈ A letfa : V → {>,⊥} be a valuation which validates a. For ϕ ∈ Σ let Aϕ = {a ∈ A :ϕ ∈ a}. Of course, fa(ϕ) = > whenever a ∈ Aϕ. The collection of the subsets

Page 9: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

1.1. PROPOSITIONAL LOGIC 9

{Aϕ : ϕ ∈ Σ} has the finite intersection property, thus there is an ultrafilter Uover A containing all of them. Define f : V → {>,⊥} as follows. For v ∈ V letf(v) = > if

{a ∈ A : fa(v) = >} ∈ U,

otherwise let f(v) = ⊥. By this definition, for each v ∈ V ,

Xv = {a ∈ A : fa(v) = f(v)} ∈ U.

Now pick ϕ ∈ Σ, and suppose v0, . . . , vn−1 are the only variables occurring inϕ. Pick a ∈ A from the non-empty intersection

Aϕ ∩Xv0 ∩ . . . ∩Xvn−1 ∈ U.

Then fa(vi) = f(vi) for each i < n, and fa(ϕ) = > by a ∈ Aϕ, thus f(ϕ) =fa(ϕ) = >, as required. �

Corollary 1.12 (Compactness theorem – strong form) If Σ |= ϕ then for somefinite Σ′ ⊂ Σ we have Σ′ |= ϕ.

Proof We know that Σ |= ϕ iff Σ ∪ {¬ϕ} is not satisfiable. So if Σ′ |6= ϕthen each finite subset of Σ ∪ {¬ϕ} is satisfiable, contradicting the previoustheorem. �

The compactness theorem is a special case of the following general algebraictheorem. To state it, we need some definitions. Let B be a Boolean algebra. Asubset F ⊂ B is an ultrafilter in B if a, b ∈ F , c ∈ B implies a ∧ b, a ∨ c ∈ F ;either c or −c is in F , moreover the minimal element of B, denoted by 0, isnot in F . It is not hard to see that ultrafilters are just the inverse images of >under the homomorphisms from B to {>,⊥}.

Theorem 1.13 (Ultrafilter Theorem for Boolean Algebras) Let F0 ⊂ B be sothat the lower bound of finitely many elements in F0 is never 0 (i.e. f0 ∧ . . . ∧fn−1 6= 0 for arbitrary f0, . . ., fn−1 ∈ F ). Then F0 can be extended to anultrafilter. �

Given the Boolean algebra B, the Stone-space S of B consists of all ultrafil-ters on B:

S = {F ⊂ B : F is an ultrafilter}.

S can be made a topological space by declaring the basic open sets to be {F ∈S : b ∈ F} for every b ∈ B. This is a zero-dimensional Hausdorff space, and thetheorem above is equivalent to saying that this space is compact. This is whythis theorem is called “compactness theorem”.

Page 10: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

10 CHAPTER 1. INTRODUCTION

1.2 First-order logic

1.2.1 Structures

The propositional logic cannot capture such properties as “for each naturalnumber there exists a larger one which is prime.” To do so, we need somethingstronger, and the most successful tool so far is the so-called first-order logic. Itdeals with certain objects called structures, and has a special language designedto describe properties of structures.

Definition 2.1 By a similarity type, or signature, or simply type, we mean acollection of constant, relation, and function symbols with their fixed arities.Types are usually denoted by τ . The cardinality of τ , denoted by |τ | , is thecardinality of its symbols.

Whenever we define a type we usually list the symbols only; their sorts andarities are determined by the context. For example, 〈0, 1,≤,+, ·〉 is a type, here0 and 1 are constant symbols, ≤ is a binary relation symbol, + and · are binaryfunction symbols.

Definition 2.2 For a given type τ , a τ -type structure A consists of a non-emptyset (the ground set or underlying set) A, together with the interpretation of thesymbols in τ . For each constant symbol c ∈ τ , its interpretation cA is an elementof A; for an n-place relation symbol r ∈ τ , rA is a subset of An (i.e. rA is ann-ary relation on A); finally, for an n-place function symbol f ∈ τ , fA : An → A.

The structures A and B are equal, or identical only when they have thesame type, the same underlying set (i.e. A = B), and for each symbol thecorresponding interpretations are the same. If τ ′ is got from τ by cancelingsome of its symbols, then we write τ ′ ⊂ τ . From each τ -type structure A, aτ ′-type structure A′ can be made by deleting the symbols not in τ ′; the resultedA′ is the τ ′-type reduct of A, denoted by A � τ ′. Of course, it may happen thatA � τ ′ = B � τ ′ while A 6= B. Fixing the type τ , if not stated otherwise, allstructures are of this type. The cardinality of the structure A, denoted as |A|,is the cardinality of its ground set.

Definition 2.3 A is a substructure of B, written as A ⊂ B, if A ⊂ B andcA = cB for each constant symbol c ∈ τ , rA = rB �An for each n-place relationsymbol r ∈ τ , and fA = fB �An for each n-place function symbol f ∈ τ .

Definition 2.4 Let X ⊂ A. The substructure generated by X in A is thesmallest B ⊂ A with X ⊂ B.

Claim 2.5 The intersection of substructures is also a substructure (if notempty), thus for X 6= ∅ the above definition is sound. �

Claim 2.6 Suppose X 6= ∅ and let B be the substructure generated by X. Then

|B| ≤ max(|X|, |τ |, ω).

Page 11: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

1.2. FIRST-ORDER LOGIC 11

Proof Let X0 = X ∪ {cA : c is a constant symbol in τ}, and for n ∈ ω put

Xn+1 = Xn ∪ {f ′′AXn : f ∈ τ is a function symbol }

where f ′′AXx is the image of Xn under the function fA. It is easy to see thatB =

⋃{Xn : n ∈ ω}, and it has the desired property. �

Definition 2.7 The structures A and B are isomorphic if there is a 1–1 ontofunction f : A→ B which preserves the interpretation of every symbol.

Of course, if A and B are isomorphic, then they have the same cardinality:|A| = |B|. Moreover isomorphism is an equivalence relation.

1.2.2 Syntax

To describe properties of structures we need a special language. For historicalreasons, the elements of this language are called first-order formulas of type τ ,and the definition goes as follows.

The logical symbols in the alphabet include the logical connectives ∨ and¬, parentheses ( and ), equality symbol =, the comma symbol, the existentialquantifier ∃, countably many (individual) variable symbols denoted as x0, x1,. . ., also as y, z, etc. (The individual variables should not to be confused withthe propositional variables.) Beside logical symbols the alphabet contains thesymbols of a fixed similarity type τ , these latter ones are the non-logical symbols.

Definition 2.8 The set of τ -type expressions, E(τ), is the smallest set satisfy-ing

(i) x ∈ E(τ) for each variable symbol x;(ii) c ∈ E(τ) for each constant symbol c ∈ τ ;(iii) if f ∈ τ is an n-place function symbol and e0, . . . , en−1 ∈ E(τ) are

expressions, then f(e0, . . . , en−1) ∈ E(τ) .

Observe that E(τ) is a set of finite sequences.

Claim 2.9 |E(τ)| ≤ |τ | · ω .

Proof Let E0 be the set of variable and constant symbols; and for k ∈ ω put

Ek+1 = Ek ∪ {f(e0, . . . , en−1) : f ∈ τ and e0, . . . , en−1 ∈ Ek}.

It is easy to see by induction that |Ek| ≤ |τ | · ω, and that E(τ) =⋃{Ek : k ∈

ω}. �

Definition 2.10 Prime formulas (of type τ) are: sequences of the form e0 = e1with e0, e1 ∈ E(τ); and r(e0, . . . , en−1) for each n-place relation symbol r ∈ τand expressions e0, . . . , en−1 ∈ E(τ).

Page 12: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

12 CHAPTER 1. INTRODUCTION

Definition 2.11 The set of τ -type formulas, F (τ), is the smallest set satisfying(i) every prime formula is in F (τ);

(ii) if ϕ, ψ ∈ F (τ) then so are (ϕ) ∨ (ψ), ¬(ϕ), ∃x (ϕ) where x is some (indi-vidual) variable symbol.

Claim 2.12 |F (τ)| = |τ | · ω .

Proof It is not hard to find |τ | ·ω many different elements in F (τ), so the claimreduces to F (τ) ≤ |τ | ·ω. This can be proved exactly the same way as claim 2.9was proved for expressions. �

Lemma 2.13 (Unique Readability Lemma) For each ϕ ∈ F (τ) there is aunique way to “decipher” ϕ, i.e. to find out how it was built up. �

While we do not prove this lemma, the proof is not so simple as it may seem atthe first glance.

As in the case of propositional formulas, we also introduce the abbreviationsseen there, including ⊥ to denote the identically false formula, and moreover wewrite

∀xϕ instead of ¬∃¬ϕ .

A formula ϕ ∈ F (τ), being finite, may contain finitely many variables only. Thefree variables of ϕ are defined by induction as follows. If ϕ is a prime formula,then V (ϕ) = {x : the variable x occurs in ϕ}. Furthermore V (¬ϕ) = V (ϕ),V (ϕ ∨ ψ) = V (ϕ) ∪ V (ψ), V (∃xϕ) = V (ϕ)− {x}.

We shall use the notation ϕ(x, y, . . .) to indicate that the free variables ofϕ are among the ones in the brackets. An occurrence of the variable x is freeor bound respectively depending on whether it is disregarded in the recursiveprocedure above computing V (ϕ) or not. A formula ϕ ∈ F (τ) with V (ϕ) = ∅is called closed, and if V (ϕ) = {x0, . . ., xn−1} then ∀x 0∀x 1 . . . ∀x n−1ϕ is the(universal) closure of ϕ, and is denoted by ϕ. Of course, ϕ is closed, and ϕ = ϕ.The closure of a formula might not be unique.

1.2.3 Semantics

Let ϕ ∈ F (τ), and let A be a τ -type structure. We want to define the “meaning”of ϕ in A; of course this will be done exactly as expected.

Definition 2.14 By a valuation over the structure A we mean a function vwhich assigns elements from A to the variable symbols. For a valuation v,v(x/a) is the valuation which takes the same values as v except for the variablesymbol x, where it takes the value a ∈ A.

Definition 2.15 For an expression e ∈ E(τ) and a valuation v over the τ -typestructure A, we define eA[v] ∈ A, the value of e, as the value of the expressionwhen the “values” of the variable symbols are given by v.

Page 13: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

1.2. FIRST-ORDER LOGIC 13

Definition 2.16 For ϕ ∈ F (τ) we define A |= ϕ[v], to be read as “ϕ is true inA under valuation v” as follows:

(i) A |= (e = e′)[v] if eA[v] = e′A[v] ;(ii) A |= r(e0, . . . , en−1)[v] if 〈(e0)A[v], . . . , (en−1)A[v]〉 ∈ rA ;(iii) A |= (ϕ ∨ ψ)[v] if either A |= ϕ[v] or A |= ψ[v] ;

A |= (¬ϕ)[v] if A |6= ϕ[v] ;A |= (∃xϕ)[v] if for some a ∈ A we have A |= ϕ[v(x/a)] .

Definition 2.17 If A |= ϕ[v] for all valuations v, then we write A |= ϕ, and saythat A is a model for ϕ, or ϕ is satisfied, or valid in A. For Σ ⊂ F (τ), A |= Σmeans A |= ϕ for each ϕ ∈ Σ.

Claim 2.18 The abbreviations have the expected meaning, e.g.A |= (ϕ ∧ ψ)[v] if both A |= ϕ[v] and A |= ψ[v];A |= ∀xϕ[v] if for all a ∈ A, A |= ϕ[v(x/a)]. �

Lemma 2.19 Let v0 and v1 be two valuations over A so that if x ∈ V (ϕ) thenv0(x) = v1(x). Then A |= ϕ[v0] iff A |= ϕ[v1] . �

Lemma 2.20 Let ϕ be the universal closure of ϕ ∈ F (τ). Then A |= ϕ iffA |= ϕ. �

Definition 2.21 Let Σ ⊂ F (τ) and ϕ ∈ F (τ). We write Σ |= ϕ, and say thatΣ semantically implies ϕ, if for each τ -type structure A, A |= Σ implies A |= ϕ.

Definition 2.22 We say that the set Σ ⊂ F (τ) of formulas is consistent if forsome τ -type structure A, A |= Σ; otherwise Σ is inconsistent.

Obviously, if Σ is inconsistent, then Σ |= ϕ for any ϕ ∈ F (τ), and is consis-tent iff Σ |6= ⊥.

The notion of “semantical consequence” is, in some sense, a precise math-ematical notion which captures the vague idea of “consequence.” Later weshall define the notion of “proof,” which, of course, is some collection of trans-formation rules applicable to those sequences of symbols which are formulas.Whenever applying these transformations sufficiently many times, we can ar-rive at a certain formula, then we say that the formula was derived. These rulesmust preserve the truth, i.e. if Σ is consistent, then no contradiction should bederived from it. The famous Godel’s Completeness Theorem says that choosingthe transformation rules appropriately, the converse will also be true, i.e. if nocontradiction can be derived from the set Σ then Σ must be consistent. Weshall prove this theorem later.

Page 14: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

14 CHAPTER 1. INTRODUCTION

Page 15: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

Chapter 2

Model theory

2.1 Elementary equivalence

Lemma 1.1 Suppose the τ -type structures A and B are isomorphic. Then foreach ϕ ∈ F (τ), A |= ϕ iff B |= ϕ. �

A bit more is true, namely if the function f : A→ B shows the isomorphism,then for any valuation v over A, fv is a valuation over B, and A |= ϕ[v] iffB |= ϕ[fv].

Definition 1.2 The τ -type structures A and B are elementarily equivalent iffor each ϕ ∈ F (τ) , A |= ϕ iff B |= ϕ.

Definition 1.3 A is an elementary substructure of B, or B is an elementaryextension of A, written as A ≺ B, or B � A, if A ⊂ B and and for each formulaϕ ∈ F (τ) and each evaluation v over the smaller structure A,

B |= ϕ[v] iff A |= ϕ[v].

Of course, if A ≺ B then A and B are elementarily equivalent. However,the converse is not true in general.

While A ⊂ B implies that for each valuation v over A and prime formula ϕwe have A |= ϕ[v] iff B |= ϕ[v], this is not true in general for arbitrary formulas.

Theorem 1.4 (TarskiVaught Criterion) Let A ⊂ B be two τ -type structures.Then A ≺ B iff the following holds. For each valuation v over A and formulaϕ ∈ F (τ), whenever B |= ∃xϕ[v], then for some a ∈ A we have B |= ϕ[v(x/a)].

Proof =⇒ Suppose A ≺ B. Then B |= ∃xϕ[v] iff A |= ∃xϕ[v], and then forsome a ∈ A, A |= ϕ[v(x/a)], thus B |= ϕ[v(x/a)].⇐= By induction on the complexity of ϕ we prove that A |= ϕ[v] iff B |= ϕ[v].Since A ⊂ B this is true for prime formulas. Next, if it is true for ϕ, ψ, then,by definition, it remains true for ϕ ∨ ψ and ¬ϕ. So the only missing case is

15

Page 16: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

16 CHAPTER 2. MODEL THEORY

the formulas of the form ∃xϕ. Now suppose A |= (∃xϕ)[v]. By definition,A |= ϕ[v(x/a)] with some a ∈ A; by the induction hypothesis for the formula ϕand the valuation v(x/a) we have B |= ϕ[v(x/a)], i.e. B |= (∃xϕ)[v].

To see the converse, assume B |= (∃xϕ)[v]. Using the assumption in thetheorem, we get B |= ϕ[v(x/a)] for some a ∈ A. By the induction hypothesis,A |= ϕ[v(x/a)], i.e. A |= (∃xϕ)[v], as required. �

Theorem 1.5 (Downward Lowenheim–Skolem Theorem) Let κ be a cardinalso that κ ≥ |τ | · ω, A be a structure, X ⊂ A, |X| = κ. Then there exists aB ≺ A so that X ⊂ B and |B| = κ.

Proof Let ψ(x0, . . . , xn−1, z) ∈ F (τ). The function f : An → A is a Skolem-function for the formula ∃z ψ, if for every a0, . . . , an−1 ∈ A,

A |= (∃z ψ)[x0/a0, . . . , xn−1/an−1]

impliesA |= ψ[x0/a0, . . . , xn−1/an−1,z/f(a0, . . . , an−1)].

That is, for any n-tuple 〈a0, . . . , an−1〉, the function f picks a value which makesψ true provided that such a value exists. By the Axiom of Choice we have awell-ordering < on A; the following function is a Skolem-function for ∃z ψ:

f(a0, . . . , an−1) =

min<{a ∈ A : A |= ψ[x0/a0, . . . , xn−1/an−1, z/a]},

if this set is not empty;min<

A otherwise.

For each formula ϕ of the form ∃z ψ, fix a Skolem-function fϕ. Since |F (τ)| =|τ | ·ω ≤ κ, we have at most κ many such functions. Now we define an increasingsequence of substructures of A as follows. Let B0 ⊂ A be generated by X. Since|X| = max(|X|, |τ |, ω), we have |B0| = |X| = κ. Suppose we have defined Bi

for some i ∈ ω. Then let

Xi+1 = Bi∪ { fϕ(b0, . . . , bn−1) : b0, . . . , bn−1 ∈ Bi, andfϕ is one of the fixed Skolem-functions }.

Of course, |Xi+1| = κ, and let Bi+1 be generated by Xi+1. Since B0 ⊂ B1 ⊂ . . .is increasing, B =

⋃{Bi : i ∈ ω} is also a substructure of A, and |B| = κ·ω = κ.

We claim B ≺ A. Now B ⊂ A by the construction. Using the Tarski–VaughtCriterion 1.4, let v be a valuation over B (the smaller structure), and supposeA |= (∃z ψ)[v]. If x0, . . . , xn−1 are the free variables of ∃z ψ, then for somei ∈ ω, v(x0), . . . , v(xn−1) ∈ Bi, consequently

b = fϕ(v(x0), . . . , v(xn−1)) ∈ Xi+1 ⊂ B.

Thus for some b ∈ B, A |= ψ[v(z/b)], as was needed. �

Page 17: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

2.2. THE ULTRAPRODUCT 17

The following consequence of the above theorem is often called Skolem-paradox:

Corollary 1.6 Let T ⊂ F (τ). If T is consistent, i.e. has a model, then it hasa model of cardinality at most |τ | · ω. �

For example, if the axiom system of set theory is consistent, then this axiomsystem has a countable model, too. However, we can prove in set theory, thatthere must be a set with cardinality exceeding that of the natural numbers. Ina countable model there is no room for an uncountable set, and this apparentcontradiction justifies the title “paradox.”

Definition 1.7 A class K of τ -type structures is elementary or axiomatizable,if for some set Σ ⊂ F (τ),

K = {A : A is a τ -type model of Σ}

The elementary class K is axiomatized by the set Σ of formulas. If K canbe axiomatized by some finite set of formulas, then K is finitely axiomatizable.If K is finitely axiomatizable, then, in fact, there is a single formula whichaxiomatizes K, namely the conjunct of the (closure of the) elements of Σ. Inthis case the complement ofK, i.e. the class of all τ -type structures not belongingto K, is also (finitely) axiomatizable.

Theorem 1.8 If K is an axiomatizable class then it contains an element withcardinality ≤ |τ | · ω.

Proof It is an immediate consequence of the Downward Lowenheim–SkolemTheorem 1.5. �

The following classes are elementary: ordered sets, partially ordered sets,groups, Abelian groups, rings, fields, (abstract) vector spaces (with a bit ofhocus-pocus), Boolean algebras, structures with at most 100 elements, etc.

The following classes are not elementary: well-ordered sets, torsion groups,finite fields, any class consisting of isomorphic infinite structures.

2.2 The ultraproduct

Definition 2.1 Let Ai be a τ -type structure for each i ∈ I where I is an indexset. The direct product B =

∏{Ai : i ∈ I} is again a τ -type structure defined

as follows. Its ground set is

B =∏{Ai : i ∈ I} = {f : f is a function, Dom(f) = I and f(i) ∈ Ai},

that is, the direct product of the ground sets of the constituent structures. Fora constant symbol c ∈ τ , cB ∈ B is the element with cB(i) = cAi ; for a functionsymbol f ∈ τ and a0, . . . , an−1 ∈ B(

fB(a0, . . . , an−1))(i) = fAi

(a0(i), . . . , an−1(i)

),

Page 18: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

18 CHAPTER 2. MODEL THEORY

which means that f is defined coordinatewise. Finally for an n-place relationsymbol r ∈ τ , 〈a0, . . . , an−1〉 ∈ rB iff for all i ∈ I we have 〈a0(i), . . . , an−1(i)〉 ∈rAi

.

Definition 2.2 Let v be a valuation over B =∏{Ai : i ∈ I}. Then vi is the

projection of v to the i-th coordinate, that is for each variable symbol x we havevi(x) =

(v(x)

)(i), namely, the i-th coordinate of v(x).

Lemma 2.3 Let e ∈ E(τ) and let v be a valuation over B. Then (eB[v])(i) =eAi [vi]. �

Lemma 2.4 Let ϕ ∈ F (τ) be a prime formula, and let v be a valuation overB. Then B |= ϕ[v] iff for all i ∈ I we have Ai |= ϕ[vi]. �

In general the claim of Lemma 2.4 is not true for arbitrary formulas.Now we can define the ultraproduct. Let I be an index set as above, and let

U be an ultrafilter on I. Let B be the direct product of the structures Ai fori ∈ I. Define the relation ∼ on B as follows: for a, b ∈ B,

a ∼ b iff {i ∈ I : a(i) = b(i)} ∈ U.

This is an equivalence relation, and for a ∈ B, a denotes the equivalence classcontaining a.

Definition 2.5 The ultraproduct A =∏{Ai : i ∈ I}/U is the following struc-

ture:(i) its ground set is A = {a : a ∈ B};

(ii) for a constant symbol c ∈ τ , cA = cB;(iii) for an n-place function symbol f ∈ τ and a0, . . . , an−1 ∈ B,

fA(a0, . . . , an−1) = fB(a0, . . . , an−1);

(iv) for an n-place relation symbol r ∈ τ and a0, . . . , an−1 ∈ B, 〈a0, . . . , an−1〉 ∈rA iff

{i ∈ I : 〈a0(i), . . . , an−1(i)〉 ∈ rAi} ∈ U.

Lemma 2.6 This is a sound definition.

Proof We have to check that the definitions in (iii) and (iv) are independentof the choice of the representative elements a0, ..., an−1, that is, if aj ∼ bj forall j < n, then

fB(a0, . . . , an−1) ∼ fB(b0, . . . , bn−1), (2.1)

andra = {i ∈ I : 〈a0(i), . . . , an−1(i)〉 ∈ rAi} ∈ U iff rb ∈ U. (2.2)

Well, aj ∼ bj means {i ∈ I : aj(i) = bj(i)} ∈ U , thus taking the intersectionof these sets in U , we get an X ∈ U so that i ∈ X implies aj(i) = bj(i) for allj < n. This yields (2.1). And since ra ∩ X = rb ∩ X, if, say, ra is in U , thenso is the intersection ra ∩ X = rb ∩ X, and then rb is in U , too. This proves(2.2). �

Page 19: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

2.2. THE ULTRAPRODUCT 19

Lemma 2.7 Every valuation over A can be written as v, where v is a valuationover B and v(x) = v(x) for each variable symbol x. �

Theorem 2.8 ( Los Lemma) For every valuation v over B, and formula ϕ ∈F (τ), ∏

Ai/U |= ϕ[v] iff {i ∈ I : Ai |= ϕ[vi]} ∈ U.

Proof First let e ∈ E(τ) be an expression, then eA[v] = eB[v] (this followseasily from the definition), moreover

(eB[v]

)(i) = eAi [vi] (this was Lemma 2.3).

Now let ϕ be a prime formula. If ϕ is e = e′ with e, e′ ∈ E(τ) then A |= (e =e′)[v] iff eA[v] = e′A[v] iff eB[v] = e′B[v] iff

{i ∈ I : eAi[vi] = e′Ai

[vi]} ∈ U

iff{i ∈ I : Ai |=

(e = e′

)[vi]} ∈ U,

establishing the equivalence in this case.Next, if ϕ is r(e0, . . . , en−1) where r ∈ τ is an n-ary relation symbol, then

A |= ϕ[v] iff〈e0[v], . . . , en−1[v]〉 ∈ rA

iff{i ∈ I : 〈e0[vi], . . . , en−1[vi]〉 ∈ rAi

} ∈ Uiff

{i ∈ I : Ai |= r(e0, . . . , en−1)[vi]} ∈ U.This proves the theorem for prime formulas. Next we go by induction on thecomplexity of formulas. For the sake of simplicity we shall use the notation

Iϕ = {i ∈ I : Ai |= ϕ[vi]}.

(i) A |= (ϕ ∨ ψ)[v] iff either A |= ϕ[v] or A |= ψ[v], i.e. by the inductionhypothesis, iff either Iϕ ∈ U or Iψ ∈ U . Now U is an ultrafilter, thus thishappens iff Iϕ ∪ Iψ ∈ U , and since Iϕ ∪ Iψ = Iϕ∨ψ, we are home.(ii) Similarly, A |= (¬ϕ)[v] iff A |6= ϕ[v] iff Iϕ /∈ U iff I − Iϕ ∈ U . SinceI¬ϕ = I − Iϕ, this is iff I¬ϕ ∈ U , as was needed.(iii) Finally, A |= (∃xϕ)[v] iff (by definition) for some b ∈ B, A |= ϕ[v(x/b)]. Bythe induction hypothesis, this latter holds iff for the same b ∈ B,

{i ∈ I : Ai |= ϕ[vi(x/b(i)]} ∈ U.

Now if this is the case, then surely

{i ∈ I : Ai |= (∃xϕ)[vi]} ∈ U.

Conversely, if this latter set is in U then for each i ∈ I pick b(i) ∈ Ai witnessingAi |= (∃xϕ)[vi], and if no such a b(i) exists, then let b(i) be an arbitrary elementof Ai. (To define b we need the Axiom of Choice.) With this b ∈ B, {i ∈ I :Ai |= ϕ[vi(x/b(i)]} ∈ U , therefore, by induction hypothesis, A |= ϕ[v(x/b)].From here A |= (∃xϕ)[v] as required. �

Page 20: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

20 CHAPTER 2. MODEL THEORY

Theorem 2.9 ( Los Lemma, second form) For each formula ϕ ∈ F (τ),∏

Ai/U |= ϕ iff {i ∈ I : Ai |= ϕ} ∈ U .

Proof If {i ∈ I : Ai |= ϕ} ∈ U then for all valuations v over A we have{i ∈ I : Ai |= ϕ[vi]} ∈ U since it extends the previous set. So by Los Lemma,∏

Ai/U |= ϕ[v].Conversely, if Ai |6= ϕ then for some valuation vi over Ai, Ai |= (¬ϕ)[vi]. Let

v be the valuation over∏

Ai put together from these ones. Then

{i ∈ I : Ai |= (¬ϕ)[vi]} ∈ U

thus∏

Ai/U |= (¬ϕ)[v], therefore∏

Ai/U |6= ϕ. �

Corollary 2.10 An elementary class is closed under ultraproducts. �

Theorem 2.11 (Godel’s Compactness Theorem for First-order Logic) Let Σ ⊂F (τ). If every finite subset of Σ is consistent, then so is Σ.

Proof Similar to that of the Propositional Logic. Let I be the collection of finitesubsets of Σ. By assumption, for each i ∈ I we have a τ -type structure Ai whichis a model of i. Let U be an ultrafilter on I containing the sets {i ∈ I : ϕ ∈ i}for each ϕ ∈ Σ. Let A =

∏Ai/U ; we claim A |= Σ. To this end pick ϕ ∈ Σ

arbitrarily. Since ϕ ∈ i implies Ai |= ϕ, we have {i ∈ I : Ai |= ϕ} ∈ U . Fromhere Los Lemma then gives A |= ϕ, as required. �

Theorem 2.12 (J. Keisler) Let K be any class of τ -type structures. K is ele-mentary if and only if (i) and (ii) below hold:

(i) K is closed under elementary equivalence, and(ii) K is closed under ultraproduct.

Proof =⇒ (i) is obvious, and (ii) is Corollary 2.10.⇐= Let K be a class satisfying (i) and (ii), and put

Σ = {ϕ ∈ F (τ) : A |= ϕ for all A ∈ K}.

Of course, if A ∈ K then A |= Σ. Now let B be a τ -type structure with B |= Σ,we claim that B ∈ K, i.e. that K is axiomatized by Σ. Let

I = {i ⊂ F (τ) : i is finite, its elements are closed formulas and B |= i}.

For each i ∈ I there must be an Ai ∈ K with Ai |= i. Otherwisei = {ϕ0, . . . , ϕn−1} and A |= ¬ϕ0 ∨ . . . ∨ ¬ϕn−1 for all A ∈ K, from whereB |= ¬ϕ0 ∨ . . . ∨ ¬ϕn−1, contradicting B |= i. Let U be an ultrafilter onI containing all the sets {i ∈ I : ϕ ∈ i} where {ϕ} ∈ I. By assumption,A =

∏Ai /U ∈ K, and for each {ϕ} ∈ I we have {i ∈ I : Ai |= ϕ} ∈ U ,

i.e. A |= ϕ. This means that A and B are elementarily equivalent, i.e. by (i),B ∈ K. �

Page 21: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

2.3. CARDINALITY OF MODELS 21

Theorem 2.13 The class K is finitely axiomatizable if and only if both K andits complement are elementary.

Proof The condition is obviously necessary. To show the converse, supposeon the contrary that K is axiomatized by Σ ⊂ F (τ), but by no finite set offormulas. Let

I = {i ⊂ F (τ) : i is a finite subset of Σ}.

Picking i ∈ I arbitrarily, all elements of i are true on every structure in K. How-ever, i being finite, does not axiomatize K, therefore there is a τ -type structureAi in the complement of K with Ai |= i. As above, let U be an ultrafilter onI containing {i ∈ I : ϕ ∈ i} for all ϕ ∈ Σ. Since the complement of K is alsoclosed under ultraproducts, A =

∏Ai/U is not in K. But by the construction,

A |= Σ, contradicting the fact that K was axiomatized by Σ. �

2.3 Cardinality of Models

Theorem 3.1 (Upward Lowenheim–Skolem Theorem) Suppose the theory Σ ⊂F (τ) has an infinite model. Then for each cardinal κ, Σ has a model of cardi-nality ≥ κ.

Proof Let {cξ : ξ < κ} be brand new constant symbols, and expand the typeτ with these symbols to τ ′ = τ ∪{cξ : ξ < κ}. Consider the following theory:

Σ′ def= Σ ∪ {cξ 6= cη : ξ < η < κ}.

Since in any model of Σ′ the interpretations of the constants cξ must differ,the model will have cardinality ≥ κ. So we are home if we know that Σ′ isconsistent. To prove this, we use the Compactness Theorem 2.11. Let A be aninfinite model for Σ, and let ∆ be a finite subset of Σ′. Then there is a finitesubset I ⊂ κ so that

∆ ⊂ Σ ∪ {cξ 6= cη : ξ, η ∈ I, ξ < η} def= ∆′.

Interpret cξ for ξ ∈ I as different elements of A (since A was assumed to beinfinite, this can be done), and interpret the remaining constants cξ with ξ /∈ Iarbitrarily. This expanded structure A′ is evidently a model of ∆′, so of ∆, andthen Σ′ is consistent. �

Instead of using the Compactness Theorem 2.11, we can arrive to the state-ment of this theorem using an appropriately chosen ultrapower of an infinitemodel.

Proof (Alternate proof using ultrapowers) Suppose A is an infinite model, andκ is an (infinite) cardinal. Let I be the set of all finite subsets of κ. Our aim

Page 22: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

22 CHAPTER 2. MODEL THEORY

is to define the vectors vα for α < κ so that whenever α1, . . . , αn are distinct,then the set

Dα1,...,αn = {i ∈ I : vα1(i), . . . , vαn(i) are all different }

is in the ultrafilter U . To this end, if i = {α1, . . . , αn} then define the i-thcoordinate of our vectors so that vα1(i), . . . , vαn(i) be all different elementsfrom A, and if β /∈ i then choose vβ(i) arbitrarily. As A is an infinite structure,this can be done for each i ∈ I. With this choice,

Dα1,...,αn ⊃{i ∈ I : {α1, . . . , αn} ⊂ i

}= Jα1,...,αn .

Thus we are done if all those latter sets are in U . But this family has the FIP,thus there is an ultrafilter U containing all of them. �

As I has cardinality κ, what we actually showed is that for some ultrafilterU on κ the cardinality of the ultrapower κA/U is at least κ. For a strongerstatement see Problem 4.

Given the structure A of type τ , pick a new constant symbol ca for eachelement a ∈ A, and let τA = τ ∪ {ca : a ∈ A}. Expand A into a τA-typestructure A′ by interpreting ca as a ∈ A.

Definition 3.2 The (complete) diagram of the structure A is the set of formulas

∆Adef= {ϕ ∈ F (τA) : ϕ is closed, and A′ |= ϕ}.

Lemma 3.3 A can be embedded elementarily into the τ -type reduct of the mod-els of its complete diagram.

Proof Let B be a model of ∆A. For a ∈ A, let f(a) ∈ B be the interpretationof the constant symbol ca in B. First, f is an isomorphism between A′ and itsimage A∗. For example, let r ∈ τ be an n-place relation symbol, we have toshow that

〈a0, . . . , an−1〉 ∈ rA iff 〈f(a0), . . . , f(an−1)〉 ∈ rB.

But the first holds iff A′ |= r(ca0 , . . . , can−1), iff r(ca0 , . . . , can−1) ∈ ∆A iff B |=r(ca0 , . . . , can−1), since either r(. . .) ∈ ∆A or ¬r(. . .) ∈ ∆A .

Now, A∗ ≺ B means, by definition, that for every valuation v over A∗ andformula ϕ(x0, . . . , xn−1) ∈ F (τA), A∗ |= ϕ[v] iff B |= ϕ[v]. The elements of A∗

are named by constants, thus if v(xi) is the interpretation of cai, then

A∗ |= ϕ[v] iff A∗ |= ϕ(ca0 , . . . , can−1) iff ϕ(ca0 , . . . , can−1) ∈ ∆A,

since ϕ(. . .) is closed, and either ϕ(. . .) ∈ ∆A, or its negation is in ∆A. By thesame reason, this latter holds iff B |= ϕ(ca0 , . . . , can−1) iff B |= ϕ[v].

Thus A∗ is an elementary substructure of B, consequently A∗ � τ is an ele-mentary substructure of B � τ , as was claimed. �

Page 23: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

2.3. CARDINALITY OF MODELS 23

Theorem 3.4 Each infinite structure has a proper elementary extension, i.e.if A is infinite, then for some B of the same type, B � A and B 6= A.

Proof By Lemma 3.3, A can be embedded elementarily into the τ -type reductof the models of ∆A so that the image of A coincides with the interpretation ofthe constant symbols {ca : a ∈ A}. Therefore to prove the theorem it sufficesto construct a model of ∆A with an extra element. To this end let c be a newconstant symbol, and put

Σ def= ∆A ∪ {c 6= ca : a ∈ A}.

If this set of formulas is consistent, we are done. Now let Σ′ ⊂ Σ be finite. Thenthere is a finite subset D ⊂ A so that Σ′ ⊂ ∆A ∪ {c 6= ca : a ∈ D}. Interpretc in A as an element not in D (by assumption A is infinite, so A − D is notempty). With this we get a model of Σ′, as required. �

Proof (Another proof for the same theorem) Let U be a non trivial ultrafilteron ω, and let B = ωA/U , the ultrapower of A. Now A can be embeddedelementarily into B as follows. For each a ∈ A, define the function fa : ω → Aby fa(i) = a (i.e. the constant function). The embedding is given by g : A→ B,g(a) = fa. The same computation as in Lemma 3.3 shows that this is indeedan elementary embedding. The theorem follows if we can show that B has anelement not in the range of the embedding. By assumption, A is infinite, letai ∈ A for i ∈ ω be all different elements. Put b(i) = ai, we claim b 6= fa.Indeed,

{i ∈ ω : b(i) = fa(i)}

has at most one element, thus this set is not in U if U is not trivial. �

Lemma 3.5 (Tarski) Let Aξ for ξ < µ be an increasing sequence of elementarysubmodels, i.e. ξ < η < µ implies Aξ ≺ Aη. Then A =

⋃{Aξ : ξ < µ} is an

elementary extension of all Aξ.

Proof By induction on the complexity of the formula ϕ(x0, . . . , xn−1) ∈ F (τ)we prove that for any ξ < µ and a0, . . . , an−1 ∈ Aξ we have

Aξ |= ϕ[a0, . . . , an−1] iff A |= ϕ[a0, . . . , an−1]. (2.3)

From here the claim is immediate. Now (2.3) is true when ϕ is a prime formulasince Aξ is a substructure of A. Also the cases ϕ∨ψ and ¬ϕ are easy. So supposethe formula is of the form ∃z ψ(x0, . . . , xn−1, z). Now if Aξ |= ∃z ψ[a0, . . . , an−1],then for some b ∈ Aξ, Aξ |= ψ[a0, . . . , an−1, b]. By the induction hypothesisfor ψ, A |= ψ[a0, . . . , an−1, b], that is A |= ∃z ψ[a0, . . . , an−1]. Conversely, ifA |= ∃z ψ[. . .] then for some b ∈ A, A |= ψ[a0, . . . , an−1, b]. Since b ∈ Aη forsome ξ < η < µ, by the induction hypothesis we have Aη |= ψ[a0, . . . , an−1, b],i.e. Aη |= ∃z ψ[. . .]. Now applying the assumption Aξ ≺ Aη we arrive atAξ |= ∃z ψ[. . .], as was claimed. �

Page 24: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

24 CHAPTER 2. MODEL THEORY

Now we give another proof for the Upward Lowenheim–Skolem Theorem 3.1.

Proof (Upward Lowenheim–Skolem Theorem) Let A be an infinite structure,we construct an elementary extension B of A with cardinality ≥ κ. For ξ ≤ κdefine the structure Aξ as follows. Let A0 = A. If ξ is a limit, then Aξ =⋃{Aη : η < ξ}; otherwise let Aξ+1 be a proper elementary extension of Aξ.

By induction on ξ one can see easily that all of these structures are infinite,therefore, by Theorem 3.4, the proper elementary extensions exists; moreover,by lemma 3.5 they form an increasing elementary chain. Thus B = Aκ is anelementary extension of A ( = A0), and

|B| = |⋃{Aξ : ξ < κ}| = |A0 ∪

⋃{Aξ+1 −Aξ : ξ < κ}| ≥ κ,

since here we have κ many disjoint nonempty sets here. �

Corollary 3.6 (Lowenheim–Skolem Theorem) Suppose that the theory Σ ⊂F (τ) has an infinite model. Then for each κ ≥ |τ | · ω, Σ has a model of cardi-nality exactly κ.

Proof Apply first the Upward Lowenheim–Skolem Theorem 3.1, and then theDownward one 1.5. �

Page 25: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

Chapter 3

Provability, completeness

By “proving a statement” we mean a procedure which convinces everybodyabout the truth of the statement. Moreover, a proof always deals with theform and not the content (so absolutely meaningless sentences can be acceptedas formally correct reasoning). A proof system is a collection of syntacticalrules applicable to formulas – as finite sequences of symbols –, which systemtells whether a formula is a consequence of, or derivable from, a set of otherformulas. For a proof system P , Σ `P ϕ denotes that ϕ is derivable from Σ bythe rules of P . When P is understood, it is omitted. If Σ is the empty set, itis also left out. On the left hand side of the `P sign We write Σ,∆ instead ofΣ ∪∆, and curly brackets are also omitted. Thus, for example, Σ, ψ0, ψ1 `

P

ϕ

means Σ ∪ {ψ0, ψ1} `P

ϕ. For a set ∆ of formulas Σ `P ∆ means Σ `P ϕ for allϕ ∈ ∆.

The definition below works for both propositional and first-order formulasequally.

Definition 0.1 A proof system P is(i) sound if Σ `P ϕ implies Σ |= ϕ ;

(ii) weakly complete if |= ϕ implies `P ϕ ; and

(iii) strongly complete if Σ |= ϕ implies Σ `P ϕ for every set Σ of formulas.

Evidently strong completeness implies weak completeness.

3.1 Hilbert-type derivation

Historically the first, and, at least in mathematics, the most natural proof sys-tem is the so-called Hilbert-type derivation. Here we are given a set of formulas,called axioms, and a collection of inference rules. An inference rule is a (par-tial) function which assigns a formula, the conclusion, to a finite set of formulascalled premises. Then a derivation from Σ is a finite sequence ϕ0, ϕ1, . . ., ϕn−1

of formulas so that for i < n, ϕi is either an axiom, or an element of Σ, or is

25

Page 26: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

26 CHAPTER 3. PROVABILITY, COMPLETENESS

the conclusion of some inference rule whose premises are among ϕ0, . . ., ϕi−1.The formula ϕ is derivable from Σ if there exists a derivation from Σ which endswith ϕ. (Axioms can be regarded as special derivation rules with no premises.)For a while this type of derivation will only be dealt with.

Claim 1.1 The Hilbert-type derivation has the following properties:(i) monotonicity: Σ0 ⊂ Σ1, Σ0 |− ϕ implies Σ1 |− ϕ;

(ii) compactness: if Σ |− ϕ then for some finite Σ′ ⊂ Σ we have Σ′ |− ϕ;(iii) transitivity: if Σ0 |− ϕ, and Σ1 |− Σ0, then Σ1 |− ϕ. �

Claim 1.2 Suppose that(i) if ϕ is an axiom, then |= ϕ,

(ii) if Σ is the set of premises of an inference rule, and ϕ is its conclusion,then Σ |= ϕ.

Then the Hilbert-type derivation is sound. �

The main issue is to find a complete (or perhaps strongly complete) andsound proof system. For the Propositional Logic such a system was found firstby Russel and Whitehead (or at least proved to be complete), and for the first-order case it is due to K. Godel.

3.1.1 Propositional Logic

Let V = {Vξ : ξ < κ} be the set of propositional variables, and denote by Fthe set of propositional sentences. The inference rules are the instances of thefollowing scheme called modus ponens (MP), or detachment:

MPϕ→ ψ, ϕ

ψ

premises

conclusion

Here the premises form the 2-element set {ϕ→ ψ,ϕ}, and the conclusion is ψ.Since {ϕ → ψ,ϕ} |= ψ, condition (ii) in Claim 1.2 is satisfied. We do not listthe axioms, instead introduce them where they appear, and we let the readercheck that all axioms are tautologies indeed. Our axioms do not form neither anice, nor an independent set (i.e. some of them can be derived from the others).However they suffice for our purposes.

Lemma 1.3 (Syntactical Deduction Lemma) Σ, ψ |− ϕ iff Σ |− ψ → ϕ.

Proof ⇐= By the monotonicity we have Σ, ψ |− ψ → ϕ, and then by MP,Σ, ψ |− ϕ.=⇒ By induction on the length of the derivation of which ϕ is the last member.Since ϕ is a member of a derivation, it is either (i) an axiom, or (ii) a memberof Σ ∪ {ψ}, or (iii) the conclusion of a MP.

(i) In this case |− ϕ, so also Σ |− ϕ. Now introducing the axiom

Page 27: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.1. HILBERT-TYPE DERIVATION 27

Ax1 ϕ→ (ψ → ϕ)

(that is, every instance of this scheme is an axiom), we can derive ψ → ϕ fromϕ as follows:

ϕ givenϕ → (ψ → ϕ) axiomψ → ϕ by MP

Therefore, by transitivity, we have Σ |− ψ → ϕ.(ii) If ϕ differs from ψ, then ϕ ∈ Σ, therefore Σ |− ϕ, and then by Ax1, Σ |−ψ → ϕ. If ϕ and ψ are the same, then we use the axiom

Ax2 ϕ→ ϕ

to derive this formula from Σ.(iii) Since ϕ is a conclusion of an MP, there is a ϑ ∈ F so that both ϑ and ϑ→ ϕoccur previously in the proof, and so have shorter derivation from Σ∪{ψ} thanϕ has. By the induction hypothesis, Σ |− ψ → ϑ and Σ |− ψ → (ϑ→ ϕ). Fromhere two applications of the MP for the axiom

Ax3 (ψ → (ϑ→ ϕ))→ ((ψ → ϑ)→ (ψ → ϕ))

gives Σ |− ψ → ϕ, as required. �

The following lemma formalizes the following proof technique: assume thatthe statement to be proved is false and derive a contradiction.

Lemma 1.4 Σ,¬ϕ |− ⊥ iff Σ |− ϕ.

Proof =⇒ By the Deduction Lemma 1.3 we have Σ |− ¬ϕ → ⊥. Then applythe following axiom and MP to derive ϕ from Σ:

Ax4 (¬ϕ→ ⊥)→ ϕ

⇐= By assumption we have Σ |− ϕ. Use the axiom

Ax5 ϕ→ (¬ϕ→ ⊥)

and MP to get Σ |− ¬ϕ→ ⊥. From here the Deduction Lemma yields Σ,¬ϕ |−⊥. �

Theorem 1.5 Σ is satisfiable if and only if Σ |6− ⊥.

Proof =⇒ As our proof system is sound, if a valuation assigns> to all sentencesin Σ, then it assigns > to every sentence derived from Σ as well. Thus ⊥ cannotbe derived from a satisfiable set of sentences.⇐= Suppose Σ |6− ⊥. By the compactness of |− (and, e.g., by Zorn’s lemma)Σ can be extended to a maximal subset of F so that we still have Σ |6− ⊥. Sowithout loss of generality, we may assume that Σ is maximal, i.e. ϕ ∈ F isnot in Σ just in case Σ, ϕ |− ⊥. Maximality also implies that ϕ ∈ Σ wheneverΣ |− ϕ.

Page 28: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

28 CHAPTER 3. PROVABILITY, COMPLETENESS

Claim 1.6 For every sentence ϕ ∈ F , exactly one of ϕ and ¬ϕ is in Σ.

Proof Indeed, we cannot have both of them in Σ. Would this be the case,Axiom 5 and two applications of MP derives ⊥, contradicting Σ |6− ⊥. On theother hand suppose ¬ϕ /∈ Σ. Then by maximality Σ,¬ϕ |− ⊥, from here Lemma1.4 gives Σ |− ϕ, which implies ϕ ∈ Σ. �

Define the valuation f : V → {>,⊥} as follows: let f(v) = > if v ∈ Σ, andf(v) = ⊥ if ¬v ∈ Σ. As propositional variables are formulas as well, Claim 1.6justifies this definition. This f assigns > to all elements of Σ. This follows from

Claim 1.7 For any sentence ϕ ∈ F , f(ϕ) = > if ϕ ∈ Σ, and f(ϕ) = ⊥ if¬ϕ ∈ Σ.

Proof By induction on the complexity of ϕ. The claim is true for propositionalvariables by definition. Now suppose it is true for ϕ and check for ¬ϕ. If ¬ϕ ∈ Σ,then f(ϕ) = ⊥ by the induction hypothesis, thus f(¬ϕ) = >. If ¬(¬ϕ) ∈ Σthen two applications of Claim 1.6 gives ϕ ∈ Σ, thus f(ϕ) = > by the inductionhypothesis, i.e. f(¬ϕ) = ⊥, as required.

Next suppose the claim for ϕ and ψ. If either ϕ or ψ is in Σ, then using oneof the axioms

Ax6 ϕ→ (ϕ ∨ ψ)Ax7 ψ → (ϕ ∨ ψ)

we get ϕ ∨ ψ ∈ Σ, moreover f(ϕ ∨ ψ) = >. If neither ϕ nor ψ is in Σ, thenClaim 1.6 gives ¬ϕ ∈ Σ and ¬ψ ∈ Σ, thus the axiom

Ax8 ¬ϕ→ (¬ψ → ¬(ϕ ∨ ψ))

and two application of MP yields ¬(ϕ∨ψ) ∈ Σ. This, together with f(ϕ∨ψ) = ⊥finishes the induction, and also the proof of the theorem. � (Theorem 1.5)

Theorem 1.8 (Strong Completeness of Propositional Logic) Σ |= ϕ iff Σ |−ϕ.

Proof Σ |= ϕ iff Σ ∪ {¬ϕ} is not satisfiable. By Theorem 1.5 this condition isequivalent to Σ,¬ϕ |− ⊥, and by Lemma 1.4, to Σ |− ϕ. �

Axioms Ax1–Ax8 can, in fact, be derived (using MP) from the followingsimpler set of formulas:

ϕ ∨ ϕ→ ϕ , ϕ→ ϕ ∨ ψ , ϕ ∨ ψ → ψ ∨ ϕ , (ϕ→ ψ)→ (ϑ ∨ ϕ→ ϑ ∨ ψ).

By transitivity, they would form a sufficient set of axioms as well as our originalset does.

Page 29: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.1. HILBERT-TYPE DERIVATION 29

3.1.2 First-order Logic

In this section τ denotes a fixed similarity type. For a formula ϕ ∈ F (τ),individual variable x, and expression e ∈ E(τ), ϕ(x/e) denotes the formulagot from ϕ by replacing each free occurrence of x by e. Such a substitutionmay change completely the meaning of the formula. For example, the formulaϕ(x) def= ∃y (y+y = x) says that “x is even,” while ϕ(x/y+1) is ∃y (y+y = y+1)which says that “there exists something equal to 1” rather than “y is odd”.To avoid these constructions, we say that a substitution is correct if after thesubstitution no variable in e becomes bounded (as y did in the example). Thenext lemma says that in these cases replacing syntactically x by e first and thenevaluating the formula ϕ(x/e) has the same effect as replacing first the value ofx by the value of e and then evaluating ϕ.

Lemma 1.9 (Substitution Lemma) Let A be a τ -type structure and v be a val-uation over A. For any correct substitution ϕ(x/e) we have

A |= (ϕ(x/e))[v] iff A |= ϕ[v(x/eA[v])].

Proof By induction on the complexity of ϕ. �

When the variable x is clear from the context we write ϕ(e) instead of ϕ(x/e).The axioms for the Hilbert-type derivation for the first-order logic contain

the first-order instances of axioms Ax1–Ax8 from Propositional Logic (i.e. thesame formulas but with ϕ, ψ, ϑ ∈ F (τ)). Later on we shall introduce moreaxioms. Observe that so far if ϕ is any instance of the axioms, then |= ϕ. Asinference rule we also have the modus ponens

MPϕ→ ψ, ϕ

ψ

and generalizationG

ϕ

∀xϕSince {ϕ} |= ∀xϕ (but, in general, |6= ϕ → ∀xϕ ), at least so far, our proofsystem is sound.

A formula ϕ ∈ F (τ) is a tautology if there is a tautological propositionalformula ϕ ∈ F so that ϕ is the result when the propositional variables in ϕare replaced systematically by appropriate first-order formulas. Since everypropositional tautology can be derived from Ax1–Ax8 using MP only, we have

Lemma 1.10 If ϕ ∈ F (τ) is a tautology, then |− ϕ. �

The derivation is transitive, so an immediate consequence of this lemma isthat in a derivation we can use tautologies freely. Such “extended” derivationscan be straightened into a complete derivation.

Lemma 1.11 (Syntactical Deduction Lemma) Suppose ψ ∈ F (τ) is closed.Then Σ, ψ |− ϕ iff Σ |− ψ → ϕ.

Page 30: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

30 CHAPTER 3. PROVABILITY, COMPLETENESS

Proof The ⇐= part is trivial. The converse can be proved the same way aswas done for propositional logic, the only case not treated there is when the lastformula of the derivation is got by the inference rule G. So the lemma follows ifwe can show

{ψ → ϕ} |− ψ → (∀xϕ)

assuming that ψ is closed. But this is immediate applying first G and then

Ax9 (∀x (ψ → ϕ))→ (ψ → ∀xϕ)assuming that x is not free in ψ. �

Lemma 1.12 Γ |− ϕ if and only if Γ |− ϕ where ϕ is the universal closure ofϕ.

Proof =⇒ Apply G repeatedly until all necessary universal quantifiers appearin the front.⇐= Apply axiom

Ax10 (∀xϕ)→ ϕ(x/e)assuming that ϕ(x/e) is a correct substitution

repeatedly to the obviously correct substitutions ϕ(xi/xi) to get rid the universalquantifiers at the beginning of the formula. �

The set Σ ⊂ F (τ) is contradictory if every ϕ ∈ F (τ) can be derived fromΣ, or, equivalently (by Lemma 1.10), if Σ |− ⊥. If Σ is not contradictory, thenit is syntactically consistent. Similarly to the propositional case, syntacticallyconsistent theories can be extended into a maximal one (using again Zorn’sLemma). From the Deduction Lemma 1.11 (and Propositional Logic – Lemma1.10) we get the analog of Claim 1.6:

Lemma 1.13 Suppose Σ ⊂ F (τ) is a maximal syntactically consistent theory.Then

(i) for every ϕ ∈ F (τ), Σ |− ϕ iff ϕ ∈ Σ;(ii) for closed ϕ ∈ F (τ) exactly one of ϕ and ¬ϕ is in Σ;(iii) for closed formulas ϕ, ψ ∈ F (τ), ϕ ∨ ψ ∈ Σ iff either ϕ ∈ Σ or ψ ∈ Σ.

Proof (i) follows from the maximality of Σ. As for (ii), we cannot have both ϕand ¬ϕ in Σ, otherwise (by Propositional Logic) ⊥ would be derivable from Σ.For the other part, if ¬ϕ is not in Σ, then by the maximality of Σ, Σ,¬ϕ |− ⊥.Then the Deduction Lemma 1.11 gives Σ |− ¬ϕ → ⊥, from where Σ |− ϕ byPropositional Logic. (iii) can be proved similarly. �

Definition 1.14 Σ ⊂ F (t) is a Henkin theory if for every closed formula∃xϕ(x) ∈ Σ there exists some constant symbol c ∈ τ such that ϕ(c) ∈ Σ.

Page 31: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.1. HILBERT-TYPE DERIVATION 31

The main idea in the proof of the Completeness Theorem is the following.

Theorem 1.15 Let Σ ⊂ F (τ) be a maximal syntactically consistent Henkintheory. Then Σ has a model.

Proof The model will be built up from the constant symbols of the type τ .Since it may happen that Σ |− c0 = c1 for different constant symbols c0, c1 ∈ τ ,we cannot use the constants directly. So define the relation ∼ on the constantsymbols as follows:

c0 ∼ c1 iff Σ |− c0 = c1.

This will be an equivalence relation if we can find the following formulas in Σ:

Ex1 x = x; x = y → y = x; (x = y ∧ y = z)→ x = z.

Indeed, to show for example that ∼ is reflexive we must have Σ |− c = c. Thisis shown by the derivation

x = x axiom Ex1∀x (x = x) generalization∀x (x = x)→ (c = c) instance of Ax10c = c by MP

Similar derivations show that ∼ is symmetric and transitive.The relation ∼ must be compatible with the interpretation of the relation

and function symbols in τ , so we need in Σ the following formulas as well:

Ex2 (x0 = y0 ∧ . . . ∧ xn−1 = yn−1)→ f(x0, . . . , xn−1) = f(y0, . . . , yn−1)for each n-place function symbol f ∈ τ ;

Ex3 (x0 = y0 ∧ . . . ∧ xn−1 = yn−1)→ (r(x0, . . . , xn−1)↔ r(x0, . . . , xn−1))for each n-place relation symbol r ∈ τ .

As these formulas are true in any structure, we can safely declare them asaxioms, called equality axioms just in contrast to the other type of logical axioms.

So the relation ∼ defined above is an equivalence relation, and let c = {c′ ∈τ : Σ |− c = c′} be the equivalence class of c. The ground set of our structure is

A = {c : c ∈ τ is a constant symbol }.

For a function symbol f ∈ τ , relation symbol r ∈ τ , and constant symbols c0,. . ., cn−1 ∈ τ , let

cA = c;fA(c0, . . . , cn−1) = c iff Σ |− f(c0, . . . , cn−1) = c;〈c0, . . . , cn−1〉 ∈ rA iff Σ |− r(c0, . . . , cn−1).

By Ex2 and Ex3 (and by Propositional Logic), these definitions do not dependon the particular choice of the representative elements of the equivalence classes.

Page 32: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

32 CHAPTER 3. PROVABILITY, COMPLETENESS

The only thing we have to show is that fA is defined for all tuples. To this endlet e ∈ E(τ) be the expression f(c0, ..., cn−1), and ϕ(x) ∈ F (τ) be the formulaf(c0, . . . , cn−1) = x, and ψ(x) be the formula x = x. Observe that both ϕ(x/e)and ψ(x/e) are correct substitutions, and both substitutions result in the sameformula. By Ex1 and Axiom 10, Σ |− ψ(x/e) as ψ(x/e) is correct. ThusΣ |− ϕ(x/e) as well, and we can use

Ax11 ϕ(x/e)→ ∃xϕ(x)assuming the substitution ϕ(x/e) is correct

to yield Σ |− ∃xϕ(x). Now Σ is Henkin, thus for some constant symbol c ∈ τwe have Σ |− ϕ(c), i.e. Σ |− f(c0, . . . , cn−1) = c. This means that fA is definedon the n-tuple 〈c0, . . . , cn−1〉.

We claim that the structure A constructed this way is a model for Σ. ByLemma 1.12 if something is in Σ then its universal closure is also in Σ, moreovera formula is true in A just in case its universal closure is true. Thus it sufficesto check the equivalence

A |= ϕ iff Σ |− ϕ.

for closed formulas only. It is true for prime formulas by definition and by theEquality Axioms. Now A |= ¬ϕ iff A |6= ϕ (since ϕ is closed) iff Σ |6− ϕ byinduction. Lemma 1.13 (ii) gives that this is iff Σ |− ¬ϕ, as required. Theformula ϕ ∨ ψ can be handled similarly using (iii) of Lemma 1.13, so the onlymissing case is ∃xϕ(x), where this formula is closed. Since Σ is Henkin, Σ |−∃xϕ(x) implies Σ |− ϕ(c) for some constant symbol c ∈ τ , and then A |= ϕ(c)by induction. Substitution Lemma 1.9 gives A |= ϕ[v(x/c)] for any valuation vover A, so A |= ∃xϕ.

Conversely, if A |= ∃xϕ[v] for some valuation, then there is a constantsymbol c ∈ τ with A |= ϕ[v(x/c)]. Also by the Substitution Lemma 1.9, A |=ϕ(x/c)[v], and since ϕ(x/c) has no free variables, this means A |= ϕ(c). Fromhere Σ |− ϕ(c) by induction, and then Σ |− ∃xϕ(x) by Ax11, as required. �

Theorem 1.16 (Godel’s First Completeness Theorem) If Σ is syntactically con-sistent then it is consistent, i.e. there is a model for Σ.

Proof By the previous Theorem, it is enough to embed Σ into a maximalsyntactically consistent Henkin theory. So let κ = |τ | · ω, and pick κ many newconstant symbols {cξ : ξ < κ}. Let τ ′ = τ ∪{cξ : ξ < κ}, and let {ϕξ : ξ < κ} bean enumeration of formulas in F (τ ′). (This set has cardinality κ.) Now let usdefine the sets Σξ ⊂ F (τ ′) for ξ ≤ κ as follows. Σ0 = Σ, Σξ =

⋃{Ση : η < ξ} if

ξ is a limit. To define Σξ+1 work as follows. Let ϕξ ∈ f(τ ′) be the ξ-th elementfrom the enumeration. If Σξ ∪ {ϕξ} is contradictory, then put Σξ+1 = Σξ. IfΣξ ∪ {ϕξ} is syntactically consistent, but either ϕξ is not closed, or it is not ofthe form ∃xψξ(x) for some ψξ(x) ∈ F (τ ′), then Σξ+1 = Σξ ∪ {ϕξ}. In everyother case pick one of the new constant symbols which do not occur in Σξ∪{ϕξ}(such a thing exists since less than κ many new constant symbols were used sofar), say cν , and let Σξ+1 be Σξ ∪ {ϕξ, ψξ(cν)}.

Page 33: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.1. HILBERT-TYPE DERIVATION 33

Next we claim that each Σξ is syntactically consistent. This is true by as-sumption for ξ = 0, and it follows for limit ξ by compactness. For successorordinals it is in doubt only in the case of Σξ+1 = Σξ ∪{ϕξ, ψξ(cν)}. For simplic-ity, we leave out the indices. So suppose, Σ ∪ {ϕ,ψ(c)} is contradictory. ψ(c)is closed, thus by the Deduction Lemma 1.11 (and by Propositional Logic) wehave Σ, ϕ |− ¬ψ(c). By the choice of the constant symbol c, it does not occuron the left hand side of the |− symbol. We claim that in this case Σ, ϕ |− ¬ψ(y)for some appropriately chosen variable symbol y.

Indeed, take the derivation of ¬ψ(c). It has finitely many formulas, thusthere are only finitely many variable symbols in those formulas. Pick a variablesymbol which does not occur at all in the derivation, let it be y, and replacethe symbol c in everywhere in the derivation by y. The resulting sequence offormulas will be a correct derivation from Σ∪{ϕ}. Elements of Σ∪{ϕ} remainunchanged (as the symbol c does not occur in them), and both MP and Gare invariant under this change. Finally axioms go into axioms. This is clearfor Ax1–Ax8 and Ex1–Ex3. For axioms Ax9–Ax11 one has to check that theappropriate conditions remain valid after the substitution (this is the reasonwhy we cannot require ψ to be a closed formula on Ax9). The substitutedderivation ends in ¬ψ(y), thus

Σ, ϕ |− ¬ψ(y).

By generalization Σ, ϕ |− ∀y ¬ψ(y). Now ψ(y/x) is a correct substitution, thusAx10 plus G yields Σ, ϕ |− ∀x¬ψ(x). Introducing the axiom

Ax12 (∀x¬ϕ)→ ¬∃xϕ,

we get Σ, ϕ |− ¬∃xψ(x). As ϕ is the same formula as ∃xψ(x), we get that fromΣ∪{ϕ} we can derive both ϕ and ¬ϕ, contradicting the assumption that Σ∪{ϕ}is syntactically consistent. This proves that Σξ is syntactically consistent for allξ.

In particular, Γ = Σκ is syntactically consistent. We claim that it is also amaximal Henkin theory. Maximality: if ϕξ ∈ F (τ ′) is not in Γ, then it is sobecause Σξ ∪ {ϕξ} is contradictory, and then so is Γ ∪ {ϕξ}. Finally assume∃xψ(x) is closed and is in Γ. This formula appears in the enumeration, sayas ϕξ. ϕξ is closed, and Σξ ∪ {ϕξ} is consistent, thus by the construction,ψ(cν) ∈ Σξ+1 ⊂ Γ for some constant symbol cν . �

Theorem 1.17 (Godel’s Second Completeness Theorem) The Hilbert type der-ivation is strongly complete, i.e. Σ |= ϕ iff Σ |− ϕ.

Proof Since all the axioms Ax1–Ax12 and Ex1–Ex3 are true in every structure,the derivation is sound. To see the converse, we may assume that ϕ is closed byLemma 1.12. Now if Σ |6− ϕ then, by the Deduction Lemma 1.11, Σ ∪ {¬ϕ} issyntactically consistent, so by the First Completeness Theorem it has a modelA: A |= Σ and A |6= ϕ, showing Σ |6= ϕ. �

Page 34: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

34 CHAPTER 3. PROVABILITY, COMPLETENESS

3.2 The resolution method

Here we present an alternative proof system which is more adequate for com-puters than the Hilbert-type derivation. This so-called resolution method worksnot on the formulas but on a certain normalized form which we shall describein turn.

3.2.1 Propositional Logic

As before, let V = {vξ : ξ < κ} be the set of propositional variables, and F bethe set of formulas. As a primitive logical connective we adopt the sign ∧, too.Given a set Σ ⊂ F , the resolution method determines whether Σ is refutable, i.e.not satisfiable, i.e. for no valuation f : V → {>,⊥} we have f ′′Σ = {>}. Thisyields strong completeness immediately, since Σ |= ϕ iff Σ ∪ {¬ϕ} is refutable.

So let us given the set Σ ⊂ F . First, transform every element of Σ intoconjunctive normal form, i.e. into a formula of the form

(±p0,0 ∨ . . . ∨±p0,n−1) ∧ (±p1,0 ∨ . . . ∨±p1,n−1) ∧ . . . ∧ (±pk,0 ∨ . . . ∨±pk,n−1)

(with appropriate bracketing where not indicated), where ±pi,j is either pi,j or¬pi,j with pi,j ∈ V . This can be achieved by performing Step 1 below untilapplicable, after that Step 2 until applicable, finally Step 3, also until it can beapplied. So let ϕ ∈ F .

Step 1. If ϕ has a subformula of the form ¬(ψ ∨ ϑ), then replace it by (¬ψ) ∧(¬ϑ); if it has a subformula of the form ¬(ψ ∨ ϑ), then replace it by (¬ψ) ∨(¬ϑ).

Step 2. Replace any subformula of ϕ of the form ¬(¬ψ) by ψ.Step 3. If ϕ has a subformula of the form ψ ∨ (ϑ0 ∧ ϑ1), or (ϑ0 ∧ ϑ1)∨ψ, then

replace it by (ψ ∨ ϑ0) ∧ (ψ ∨ ϑ1).

Claim 2.1 After this procedure, ϕ is in conjunctive normal form.

Proof Step 1 is not applicable if each negation symbol is just ahead of a propo-sitional variable. Step 2 disregards repeated applications of negation; finallyStep 3 ends only if the formula is conjunctions of disjunctions of propositionalvariables, or negation of propositional variables. �

Claim 2.2 The above process halts for each formula ϕ ∈ F . �

Claim 2.3 If starting from ϕ ∈ F we get ϕ∗ ∈ F , then |= ϕ ↔ ϕ∗, i.e. ϕ andϕ∗ are logically equivalent.

Proof Each step possesses this property. The claim follows by induction. �

Page 35: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.2. THE RESOLUTION METHOD 35

We may assume that all elements of Σ are in conjunctive normal form. Inthe next step we split the conjunctions into their constituents by applying thefollowing claim sufficiently many times.

Claim 2.4 Σ ∪ {ϕ ∧ ψ} is refutable iff Σ ∪ {ϕ,ψ} is refutable. �

So Σ is a set of disjunctions of propositional variables and their negations.Our aim is to show that there is no valuation f : V → {>,⊥} which makesevery element of Σ valid. Since a disjunction is valid iff some of its member isvalid, we may replace the disjunctions by the set of its members, disregarding(if any) of the repetitions.

Now we can introduce the notions used in connection with the resolutionmethod.

Definition 2.5 A literal is either a proposition variable or its negation; and aclause is a finite set of literals. The empty clause is denoted by �.

We are given a set C of clauses, and our goal is to show that C is refutable,i.e. no valuation f : V → {>,⊥} makes at least one literal in each clause c ∈ Cvalid. As there is no element in the empty clause, no literal in � can be true inany valuation.

Claim 2.6 If � ∈ C then C is refutable. If C = ∅ then C is not refutable,i.e. satisfiable. �

Definition 2.7 For a literal ` its negation, ¬` is the literal ¬v is ` is the propo-sitional variable v, and v if ` is the negation of v.

Definition 2.8 Let c0, c1 be clauses, ` be a literal so that ` ∈ c0 and ¬` ∈ c1.The resolvent of c0 and c1 with respect to ` is

R(c0, c1, `)def= (c0 − {`}) ∪ (c1 − {¬`}).

c is the one step resolvent of C if either c ∈ C, or there are c0,c1 ∈ C such thatc = R(c0, c1, `).

Lemma 2.9 Let c be a one step resolvent of C. Then C is refutable iff C ∪ {c}is refutable.

Proof =⇒ If C ∪ {. . .} is satisfiable then so is C.⇐= Let c = R(c0, c1, `), and suppose that C is satisfiable, i.e. the valuationf : V → {>,⊥} makes valid at least one literal in each member of C. Thensome literal from c0, and some from c1 is true. And since at most one of ` and¬` can be true, still remains a true literal in c. �

Page 36: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

36 CHAPTER 3. PROVABILITY, COMPLETENESS

Definition 2.10 (Resolution Method) Let C be a set of clauses, and c be aclause. c is derivable from C by the resolution method, denoted as C `R c, ifthere is a sequence of clauses c0, c1, . . . , cn−1 ending with cn−1 = c so that eachci is a one step resolvent from the set C ∪ {c0, . . . , ci−1}.

Lemma 2.11 (Deduction Lemma) Let ` be a literal, then {`} is a one-elementclause. Suppose that the clause c differs from {`}, and C, {`} `R c. Then eitherC `R c, or C `R c ∪ {¬`}.

Proof Suppose ci ⊂ c′i ⊂ ci ∪ {¬`} for i = 0, 1, and let c2 = R(c0, c1, k), andc′2 = R(c′0, c

′1, k). Then

c2 ⊂ c′2 ⊂ c2 ∪ {¬`}.Moreover if c0 is the one element clause {`}, then k must be the same literal as`, and c2 = c1 − {¬`}, thus

c1 ⊂ c′2 ⊂ c1 ∪ {¬`}.

Similarly, if c1 is {`}, then the k is ¬`, c2 = c0 − {`}, thus

c0 ⊂ c′2 ⊂ c0 ∪ {¬`}.

From here it follows by induction that for every clause c derivable from C, {`}there exists a clause c′ derivable from C such that c ⊂ c′ ⊂ c ∪ {¬`}. �

Theorem 2.12 (Strong Completeness of Resolution Method) C is refutable iffC `R �.

Proof ⇐= We have seen this in Claim 2.6.=⇒ Suppose C 6`R �. Then C can be extended into a maximal set of clauses sothat the empty clause is still not derivable (using Zorn’s lemma). So we canassume that C is maximal. Then for each literal `, exactly one of the one-elementclauses {`} and {¬`} is in C.

Indeed, we cannot have both of them in C, otherwise the single resolutionstep

R({`}, {¬`}, `) = �

would derive the empty clause immediately. So suppose that the clause {`} isnot in C. Then by the maximality of C, from C, {`} we can derive the emptyclause �. Then by the Deduction Lemma 2.11, either C `R �, or C `R {¬`}. Byassumption the first case cannot hold, thus {¬`} ∈ C, as was needed.

Define the valuation f : V → {>,⊥} as follows. Let f(v) = > if the singleelement clause {v} is in C, and let f(v) = ⊥ otherwise. Now for each c ∈ C,at least one literal in c must be true. This is true if c has a single member;otherwise c = c′ ∪ {`} where ` is a literal. If the one-element clause {`} is in C,then the value of ` is >. If it is not, then {¬`} ∈ C, and then

R(c, {¬`}, `) = c′,

thus c′ ∈ C. c′ has one member less than c, so by induction there is a truemember in c′. Consequently C is satisfiable, i.e. not refutable. �

Page 37: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.2. THE RESOLUTION METHOD 37

3.2.2 First-order Logic

Let Σ ⊂ F (τ) be a set of first-order formulas. We write Con(Σ) to mean that Σis consistent, i.e. there is a τ -type structure A which is a model of Σ: A |= Σ. Asin the previous section, we perform a set of transformations on Σ which preserveconsistency (or, rather, inconsistency). The resolution method will work on the“preprocessed” formulas. In this section the universal quantifier ∀ is treated asa basic (and not as a derived) symbol.

• The first transformation converts the elements of Σ into prenex normal formby performing the following steps on elements of Σ until any of them is appli-cable:

Step 1. In ϕ replace the subformula ¬(∃xψ) by ∀x (¬ψ); the subformula¬(∀xψ) by ∃x (¬ψ).

Step 2. If ϕ has a subformula ψ ∨ (Qxϑ) or (Qxϑ) ∨ ψ, where Q is either ∃or ∀ , then pick a variable y which does not occur in ϕ at all, and replacethe subformula by Qy (ψ ∨ ϑ(x/y)).

If neither of these steps is applicable any more then the formula has the form

Q0x0 Q1x1 . . . Qn−1xn−1 ψ ,

where Qi ∈ {∃,∀} and ψ ∈ F (τ) is quantifier-free.

Claim 2.13 This procedure halts for every formula ϕ ∈ F (τ). �

Claim 2.14 Suppose that starting from ϕ ∈ F (τ) we get ϕ∗ ∈ F (τ). Then|= ϕ↔ ϕ∗.

Proof By the Substitution Lemma 1.9 and by the definition of quantifiers, bothStep 1 and Step2 result in equivalent formulas. From here the lemma followsby induction. �

• The second transformation discards the equality symbol from Σ. Let E bea new binary symbol not in τ , and let τ ′ = τ ∪ {E}. Replace each occurrenceof the equality sign by E, i.e. put E(e0, e1) in place of e0 = e1 everywhere, andadd the following formulas to Σ:

(i) E(x, x); E(x, y)→ E(y, x); E(x, y) ∧ E(y, z)→ E(x, z);(ii) E(x0, y0) ∧ . . . ∧ E(xn−1, yn−1)→ E(f(x0, . . . , xn−1), f(y0, . . . , yn−1))

for each n-place function symbol f ∈ τ ;(iii) E(x0, y0) ∧ . . . ∧ E(xn−1, yn−1)→ (r(x0, . . . , xn−1)↔ r(y0, . . . , yn−1))

for each n-place relation symbol r ∈ τ .(Observe the similarity to the Equality Axioms.) Denote by Σ′ ⊂ F (τ ′) the setof formulas got in this way. Σ′ still consists of prenex formulas, moreover

Claim 2.15 Σ is consistent if and only if Σ′ is consistent.

Page 38: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

38 CHAPTER 3. PROVABILITY, COMPLETENESS

Proof =⇒ Suppose A |= Σ for some τ -type structure A. Expand A intro aτ ′-type structure A′ interpreting E as identity, i.e. for a, b ∈ A,

〈a, b〉 ∈ EA iff a = b.

Obviously every formula of Σ′ holds on A′, thus Σ′ is consistent as well.⇐= Let A be a model of Σ′. By the formulas in (i) EA is an equivalence relation.For a ∈ A let a be its equivalence class:

a = {b ∈ A : 〈a, b〉 ∈ EA}.

The factor structure A/E has the ground set {a : a ∈ A}; the interpretation ofthe symbols goes via representatives. Formulas in (ii) and (iii) ensure that thiscan be done. By induction on formulas, for each ϕ ∈ F (τ ′) without equalitysymbol, A |= ϕ iff A/E |= ϕ, thus A/E is also a model of Σ′. In this lattermodel, however, E is interpreted as the true equality, so A/E is also a model ofΣ. �

• In the third (rather simple) transformation, we replace each element of Σ byits universal closure. This preserves prenex forms and does not affect consistencysince A |= ϕ iff A |= ϕ.

To describe the fourth transformation we need the notion of Skolemization.

Definition 2.16 Let the closed formula ϕ ∈ F (τ) be of the form ∀x0 ∀x1 . . . ∀xn∃y ψ. Pick a new n-place function symbol f not in τ (or a constant symbol ifn = 0). The one-step Skolemization of ϕ is

∀x0 ∀x1 . . . ∀xn−1 ψ(y/f(x0, . . . , xn−1)).

Suppose now that ϕ is in prenex normal form, and is closed. The Skolemizationof ϕ is got by repeated one-step Skolemization until no existential quantifierremains.

Claim 2.17 Suppose ϕ∗ is the Skolemization of ϕ. Then Con(Σ, ϕ∗) iffCon(Σ, ϕ).

Proof It suffices to prove the same for one-step Skolemization, which is imme-diate. �

• The fourth transformation is the following: replace each formula by (one of)its Skolemization, and then erase the leading universal quantifiers.

Claim 2.18 This transformation does not affect consistency.

Proof Immediate from the previous Claim 2.17. �

Page 39: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.2. THE RESOLUTION METHOD 39

After the fist four set of transformations we have got a set of quantifier-freeformulas in some similarity type expanding the original one. We’ve got rid ofthe equality sign as well. This new set of formulas is consistent just in case theoriginal set of formulas was consistent.

• The fifth transformation is very similar to the one made in the PropositionalCase. The quantifier-free (i.e. open) formulas are transformed into (logicallyequivalent) conjunctive normal form, and using the following claim, the con-juncts are separated. Finally, the remaining disjunctions are turned into sets.

Claim 2.19 Con(Σ, ϕ ∧ ψ) iff Con(Σ, ϕ, ψ). �

As the result we get a set C of clauses; each clause c is a finite set of literals;and each literal is either a primitive formula π ∈ F (τ) without equality, or thenegation of such a primitive formula. C is consistent if there exists a structure Aso that each clause c ∈ C, no matter which valuation is chosen, possesses at leastone true element (but that element may be different for different valuations).

Our goal is to find a method which shows that C is inconsistent. Let τ bethe similarity type containing all the symbols in C; we may assume as well thatthere is at least one constant symbol in τ (if there would be none, simply addone).

Definition 2.20 The underlying set H of the Herbrand universe H for the typeτ is the set of variable-free expressions from E(τ). The interpretation of thefunction symbols in τ is the natural one: if f ∈ τ and h0, . . . , hn−1 ∈ H, then

fH(h0, . . . , hn−1) = f(h0, . . . , hn−1) ∈ H (as an expression).

The assumption that there is at least one constant symbol in τ ensures thatthe underlying set H is not empty.

Lemma 2.21 The set of clauses C is consistent iff there is a model of C withground set H together with the natural interpretation of the function and con-stant symbols.

Proof We prove the nontrivial part only. Suppose A is a model of C, and definethe function λ : H → A as follows. For a constant symbol c ∈ τ , let λ(c) = cA,moreover for h0, . . . , hn−1 ∈ H let

λ(f(h0, . . . , hn−1)) = fA(λ(h0), . . . , λ(hn−1)).

For an n-place relation symbol r ∈ τ define

〈h0, . . . , hn−1〉 ∈ rH iff 〈λ(h0), . . . , λ(hn−1)〉 ∈ rA.

This defines the structure H. For any prime formula π ∈ F (τ) without equality,and for every valuation v over H, we have

H |= π[v] iff A |= π[λ(v)].

This shows that H is a model of C indeed. �

Page 40: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

40 CHAPTER 3. PROVABILITY, COMPLETENESS

By a substitution σ we mean a (finite) set of substitutions x0/e0, x1/e1, . . . ,xn−1/en−1, where xi are variable symbols, and ei are expressions. A substitutionshould be performed simultaneously and not sequentially. For example, if r isa binary relation symbol, then r(x, y)[x/y, y/f(x, y)] means r(y, f(x, y)), andnot r(f(x, y), f(x, y)). For a clause c = {π0, . . . , πn−1}, c[σ] means the clause{π0[σ], . . . , πn−1[σ]} (which can have less members than c has); similar definitionworks for expressions and sequences of expressions.

For the given set C of clauses, let C∗ be the set of those instances of thesubstituted clauses of C which do not contain variable symbols:

C∗ = {c[σ] : c ∈ C, σ = [x0/h0, . . . , xn−1/hn−1],hi ∈ H, and c[σ] does not contain any variable symbol}.

Since in C∗ there are no variable symbols, it can be regarded as a set of propo-sitional clauses with the set

V = {r(h0, . . . , hn−1) : r ∈ τ is an n-place relation symbol, hi ∈ H}

as propositional variables.

Lemma 2.22 C is consistent iff C∗ is satisfiable,

Proof =⇒ By Lemma 2.21, C has a model H with ground set H. Define thevaluation f : V → {>,⊥} as follows. If the propositional variable v ∈ V isr(h0, . . . , hn−1), then

f(v) = > iff H |= r(h0, . . . , hn−1).

Since H |= C, every clause of C∗ has a true literal under this valuation.⇐= Let the valuation f : V → {>,⊥} show the satisfiability of C∗. Define theinterpretation of the relation symbols on H as follows:

〈h0, . . . , hn−1〉 ∈ rH iff f(r(h0, . . . , hn−1)) = >.

Pick c ∈ C and a valuation v over H. Then c[v] is, in fact, a member of C∗, soit takes the value > under f , i.e. H |= c[v]. �

Corollary 2.23 C is inconsistent iff C∗ `R �. �

This Corollary gives immediately a method to check inconsistency. One hasto pick “appropriate” substitutions σ0, . . . , σn−1, and (not necessarily distinct)elements ci from C so that

{c0[σ0], . . . , cn−1[σn−1]} `R �.

We will do a bit more, namely we will get rid off the “appropriate” choice ofsubstitutions.

Page 41: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.2. THE RESOLUTION METHOD 41

Definition 2.24 The prime formulas π0 and π1 ∈ F (τ) are unifiable is thereexists a substitution σ so that π0[σ] = π1[σ]. The unifier σ is the most generalunifier if for any other unifier σ′ one can find a substitution % so that

π0[σ′] = π1[σ′] = (π0[σ])[%] = (π1[σ])[%].

This definition works for sequences of expressions as well. Obviously the mostgeneral unifier, if exists, is unique up to renaming variables.

Lemma 2.25 Suppose π0 and π1 are unifiable. Then there exists a most generalunifier which can be determined by an algorithm.

Proof Since π0 and π1 are unifiable only if they start with the same relationsymbol, it suffices to prove the lemma for expression sequences instead of for-mulas. So we are given two sequences of expressions

e = 〈e0, . . . , en−1〉 and e′ = 〈e′0, . . . , e′n〉.

(If they are unifiable, they must have the same length.) Suppose we know thelemma for all sequences shorter than n, and for all sequences built up fromsubexpressions of the present ones (so the algorithm will be a recursive one). Ifthere is any unification, it must unify e0 and e′0. So they must be either identicalvariable symbols, or one of them is a variable symbol which does not occur inthe other, or they must have the form

e0 = f(e00, . . . , e0k−1), e′0 = f(e′00, . . . , e′0k−1)

with the same function symbol f ∈ τ . In the first two cases a simple substitution,in the third one the induction hypothesis gives a most general unifier σ0 for e0and e′0. This means that anything which unifies e0 and e′0 is an extension ofthis σ0. In particular, this is true of the most general unifier (if any) of e ande′. Thus to find the latter one, we must unify e[σ0] and e′[σ0], or, since theirfirst members agree, to unify 〈e1[σ0], . . . , en−1[σ0]〉 and its primed version. Nowthey are shorter than e so by induction we are done. �

This algorithm is often called “pattern matching,” and it is at the core ofalmost every theorem proving program. It can be coded nicely (and efficiently)in programming languages with recursive procedures and recursive data types.

Definition 2.26 (i) Let c0, c1 be clauses. The resolvent of c0 and c1 isgenerated as follows. If necessary, rename variable symbols in c0 and c1 sothat they share no common variable symbols. Pick π0 ∈ c0 and ¬π1 ∈ c1so that π0 and π1 are unifiable with σ as the most general unifier. Theresolvent is the clause

R(c0, c1;π0, π1) def=(c0[σ]− π0[σ]

)∪(c1[σ]− (¬π1)[σ]

).

Page 42: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

42 CHAPTER 3. PROVABILITY, COMPLETENESS

(ii) Let c be a clause so that either π0, π1 ∈ c, or ¬π0, ¬π1 ∈ c, moreover π0

and π1 are unifiable with σ as the most general unifier. The clause

F(c;π0, π1) def= c[σ]

is the factor of c.

Observe that a factor has at least one member less than the original clause.Obviously variable symbols in clauses can be renamed without changing its

meaning, thus every model for c0 and c1 is also a model for their resolvent andfor their factor. Thus the following procedure cannot lead to the empty clausewhenever C is consistent.

Definition 2.27 (First-order Resolution Method) The clause c is derivable fromC, denoted as C `R c, if c can be got by forming resolvents and factors repeatedlystarting from elements of C.

Theorem 2.28 (Completeness Theorem for the Resolution Method) C is in-consistent iff C `R �

Proof ⇐= This follows from the remark above.=⇒We know that if C is inconsistent then there are finitely many c0, . . . , cn−1 ∈C, and substitutions σ0, ..., σn−1 so that

{c0[σ0], . . . , cn−1[σn−1]} `R �

with the set of variable-free prime formulas as propositional variables. Now thetheorem follows immediately from the following Lemma. �

Lemma 2.29 (Lifting Lemma) Let c0, c1 be clauses with disjoint set of vari-ables, σ0, σ1 be substitutions so that c0[σ0] and c1[σ1] have no free variables;and v be an appropriate propositional variable. Then one can find factors c′0and c′1 of c0, c1, respectively, prime formulas π0, π1, and a substitution σ sothat

R(c0[σ0], c1[σ1], v) = R(c′0, c′1;π0, π1)[σ]. (3.1)

Proof Arrange the members of c0 = {π0, . . . , πk−1, . . .} so that

v = π0[σ0] = . . . = πk−1[σ0],

but all the other elements of c0 give other literals under substitution σ0. Then{π0, . . . , πk−1} are unifiable, so factoring by twos (k− 2 factoring all together),we get c′0 = c0[%] so that c0[σ0] = c′0[σ′0] for some substitution σ′0, and v isgot from only one member of c′0, let this member be π0. c′1 and π1 are definedsimilarly. Since v = π0[σ′0] = π1[σ′1], π0 and π1 are unifiable, so R(ϕ′0, ϕ

′1;π0, π1)

is defined. By assumption, c0 and c1 share no common variables, so σ′ def= σ′0∪σ′1is well-defined, from where σ can be got easily. �

Page 43: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

3.2. THE RESOLUTION METHOD 43

Quite frequently clauses are in a very special form: they contain at most onenon-negated literal. Such clauses are called Horn-clauses, and can be written as

π ← (π0 ∧ . . . ∧ πn−1),

since this is equivalent to π ∨ ¬π0 ∨ . . . ∨ ¬πn−1. Either side of the ← arrowmay be empty. If this is the left hand side, the clause is called goal, if it isright hand side, than it is called fact. If all elements in C are Horn-clauses, thenthe resolution method works without factoring. Usually a single goal clause isallowed only, and in this case the resolution method simplifies to an algorithmwhich either gives the derivation of �, or shows that � cannot be derived.

Page 44: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

44 CHAPTER 3. PROVABILITY, COMPLETENESS

Page 45: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

Chapter 4

Incompleteness

4.1 Pre-amble

In this section we fix the type τ0 = 〈0, 1,+, ·, <〉; our standard model will be theset of natural numbers, denoted by ω, endowed with the natural interpretationsof the symbols of τ0; this structure will be denoted as N. We associate certainτ0-type expressions with each natural number n ∈ ω: ε0 is the constant symbol0, ε1 is the expression (0 + 1), ε2 is ((0 + 1) + 1), and in general εn+1 is (εn+ 1).When εn is evaluated in N, the value will (not surprisingly) be just n.

Definition 1.1 The τ0-type structure M is an end-extension of N, or, rather,N is an initial segment of M,

(i) N is a substructure of M, i.e. N ⊂M;(ii) a ∈ N , b ∈M , b <M a implies b ∈ N ( M is “beyond” N);(iii) a ∈ N , b ∈M −N implies a <M b.

Theorem 1.2 (Robinson) There is a finite set of formulas Q ⊂ F (τ0) so thatN |= Q, moreover every model of Q is an end-extension of N.

Proof Take the following formulas:

0 6= x+ 1, (x+ 1 = y + 1)→ x = y,x+ 0 = x , x+ (y + 1) = (x+ y) + 1,x · 0 = 0 , x · (y + 1) = (x · y) + x,x < y ↔

(x 6= y ∧ ∃z (z + x = y)

),

x 6= 0→ ∃y (x = y + 1).

This set works as Q. To show this, one has to check that for any i, j ∈ ω,

i 6= j iff Q |− εi 6= εj , i < j iff Q |− εi < εj ,i+ j = k iff Q |− εi + εj = εk , i · j = k iff Q |− εi · εj = εk ,Q |− x < εi ∨ x = εi ∨ εi < x , Q |− (x < εi)→ (x = ε0 ∨ . . . ∨ x = εi−1) .

45

Page 46: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

46 CHAPTER 4. INCOMPLETENESS

By Godel’s completeness theorem it is enough to show that these formulas aretrue in every model of Q, which can be shown by using induction on i and j. �

Definition 1.3 Let e ∈ E(τ0) be an expression. The bounded quantifiers(∀x < e) and (∃x < e) are defined as follows:

(∀x < e)ϕ means ∀x (x < e → ϕ),(∃x < e)ϕ means ∃x (x < e ∧ ϕ).

Definition 1.4 The set ∆0 ⊂ F (τ0) is the smallest set of formulas so that(i) prime formulas are in ∆0,

(ii) if ϕ, ψ ∈ ∆0 then so are ϕ ∧ ψ, ϕ ∨ ψ, ¬ϕ, (∃x < e)ϕ, and (∀x < e)ϕ.A formula from F (τ0) is Σ1 (or Π1) if it is of the form ∃xϕ (or ∀xϕ) for someϕ ∈ ∆0.

Definition 1.5 Let A ⊂ ωn. This subset is ∆0 (Σ1, Π1) if there exists a ∆0

(Σ1, Π1, respectively) formula ϕ ∈ F (τ0) with n free variables so that ~a ∈ A iffN |= ϕ(~a). The set A ⊂ ωn is ∆1 if it is both Σ1 and Π1.

Denoting the collection of all the appropriate subsets also by ∆0, ∆1, Σ1,Π1, we have immediately that

∆0 ⊂ ∆1 ⊂{

Σ1

Π1

We shall see later that each containment here is proper. Obviously every finiteand cofinite set is ∆0, moreover all these collections are countable (since thereare only countably many different formulas in F (τ0)).

Claim 1.6 Let ~a ∈ ωn; M be an end-extension of N, and ϕ(x) ∈ F (τ0) have nfree variables. Then in case of

ϕ ∈ ∆0, N |= ϕ(~a) iff M |= ϕ(~a)ϕ ∈ Σ1, N |= ϕ(~a) implies M |= ϕ(~a)ϕ ∈ Π1, N |= ϕ(~a) follows from M |= ϕ(~a)

Proof �

We shall use the following basic facts about the natural numbers.

Claim 1.7 For any formula ϕ ∈ F (τ0), so that u is not free in ϕ,

N |=(∃y ∃z ϕ

)↔(∃u (∃y < u )(∃z < u )ϕ

); (4.1)

N |=((∀x < y)∃z ϕ

)↔(∃u (∀x < y) (∃z < u)ϕ

)(4.2)

The formula in (4.2) is the so-called collection principle.

Page 47: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.1. PRE-AMBLE 47

Claim 1.8 Let A, B ∈ ωn. If A, B ∈ ∆0 (or ∈ ∆1), then so are A∪B, A∩B,A − B, and A (the complement of A). If A, B ∈ Σ1 (or ∈ Π1), then A ∪ B,A ∩B ∈ Σ1 (∈ Π1), and A ∈ Π1 (∈ Σ1).

Proof We prove only that A, B ∈ Σ1 implies A ∩ B ∈ Σ1, the other cases aresimilar or immediate. So let ϕ(x, y), ψ(x, y) ∈ ∆0 be so that

a ∈ A iff N |= ∃y ϕ(a, y); b ∈ B iff N |= ∃z ψ(b, z).

Then by (4.1),

a ∈ A ∩B iff N |= ∃x((∃y < x )ϕ(a, y) ∧ (∃z < x )ψ(a, z)

). �

Definition 1.9 Let Σ∗1 ⊂ F (τ0) be the smallest set so that Σ1 ⊂ Σ∗1, and ifϕ, ψ ∈ Σ∗1 then so are ϕ ∧ ψ, ϕ ∨ ψ, ∃xϕ, (∃x < e )ϕ, (∀x < e)ϕ. The subsetA ⊂ ωn is Σ∗1 if for some ϕ(x) ∈ Σ∗1 we have a ∈ A iff N |= ϕ(a).

Claim 1.10 A subset of ωn is Σ∗1 if and only if it is Σ1.

Proof By induction using (4.1) and (4.2) above. �

If A ⊂ ωn is a ∆1 set, then one can find ∆0 formulas ϕ(x, a) and ψ(y, a)with 1 + n free variables each so that

if a ∈ A then Q |− ∃xϕ(x, a);if a /∈ A then Q |− ∃y ψ(y, a).

This is so because these formulas are valid in each end-extension, therefore ineach model of Q. So, by Godel’s Completeness Theorem 1.17, they are derivablefrom Q.

Theorem 1.11 (Representation Theorem for ∆1 Subsets) Let A ⊂ ωn be ∆1.Then one can find a Σ1-formula ϑ(x) ∈ F (τ0) with n free variables so that

a ∈ A implies Q |− ϑ(a),a /∈ A implies Q |− ¬ϑ(a).

Proof (Rosser’s idea) Let the ∆0-formulas ϕ(x, a) and ψ(y, a) be as above, andput

ϑ(a) def= ∃x(ϕ(x, a) ∧ (∀y < x)¬ψ(y, a)

).

Now if a ∈ A then M |= ϑ(a) for each end-extension M of N since such an x canbe found even in N. On the other hand, if a /∈ A, then

M |= ∀x(ϕ(x, a)→ (∃y < x)ψ(y, a)

),

since if M |= ϕ(x, a) then this x cannot be in N (a /∈ A so N |6= ∃xϕ(x, a)), sothe y witnessing N |= ∃y ψ(y, a) is smaller than x.

These formulas are valid in each end-extension, so we get, as before, thatthey can be derived from Q. �

Page 48: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

48 CHAPTER 4. INCOMPLETENESS

Definition 1.12 For a function f : ωn → ω, its graph is the set {〈x, f(x)〉 : x ∈ωn} ⊂ ωn+1. The function f is ∆0, ∆1, etc. if its graph is ∆0, ∆1, etc.

Claim 1.13 If a function is Σ1 then it is also ∆1.

Proof Let ϕ(x, y, z) ∈ ∆0 witness that f is Σ1, i.e. f(a) = b iff N |=∃z ϕ(a, b, z). Since f is a function, for each a ∈ ωn there exists a unique b ∈ ωfor which N |= ϕ(a, b, c) with some c ∈ ω. So if f(a) = b then

N |= ∀y ∀z(ϕ(a, y, z)→ y = b

),

and, conversely, of this holds then necessarily b ∈ ω is that unique element. Thisshows that the graph of f is also Π1, as claimed. �

For a set A ⊂ ωn, its characteristic function χA : ωn → ω is defined asfollows:

χA ={

1 if a ∈ A,0 if a /∈ A.

Claim 1.14 A ⊂ ωn is ∆1 iff χA is ∆1. �

This is the right place to make some remarks. First of all, it is clear thatgiven a ∆0 subset A ⊂ ωn, we have a mechanical method to decide whether agiven n-tuple of natural numbers is an element of A or not. Also, if A is Σ1,then we can verify whether an n-tuple is indeed in A. To this end, suppose thatA is given by the formula ∃y ϕ(a, y) with ϕ(a, y) ∈ ∆0. Then go through thenatural numbers and for each n ∈ ω decide whether N |= ϕ(a, n) or not. If (andonly if) a ∈ A then for some n ∈ ω we have the first case, thus proving a ∈ A.If a /∈ A, then this method does not terminate, and there is no way to tell inadvance whether will it terminate or we have to continue the work indefinitely.

If A is not only Σ1 but also Π1 (i.e. A is ∆1), then we can do a bit better.We have ∆0 formulas ϕ(a, x) and ψ(a, y) so that if a ∈ A then N |= ∃xϕ(a, x),and if a /∈ A then N |= ∃y ψ(a, y). Now what we have to do is to go throughthe natural numbers, and in each step check whether any of N |= ϕ(a, n) andN |= ψ(a, n) is true. Sooner or later we shall find such a value. At that momentthe procedure terminates and a ∈ A or a /∈ A depending on which of the caseshalted the process.

Also, we have a method to enumerate, that is, to list all the members of aΣ1 set. Suppose A ⊂ ωn is given by the formula ∃y ϕ(a, y) with ϕ ∈ ∆0. Thenfirst think out a mechanical procedure which enumerates the elements of ωn,say, in order a0, a1, ... . Then go along the arrows in the diagram below:

ϕ(a0, 0) → ϕ(a0, 1) ϕ(a0, 2) → . . .

↓ ↑ϕ(a1, 0) ← ϕ(a1, 1) ϕ(a1, 2) . . .

↓ ↑ϕ(a2, 0) → ϕ(a2, 1) → ϕ(a2, 2) . . .

. . . . . . . . .

Page 49: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.1. PRE-AMBLE 49

At each point decide whether N |= ϕ(ai, j) or not (since ϕ ∈ ∆0 we have adecision procedure). If yes, print ai as a member of A, if not, do nothing. Afterthat go to the next element in the diagram. It may happen that the samemember appears more than once during this enumeration. It is not too hard tomodify the procedure so that it enumerates every element of A exactly once.

Definition 1.15 The ∆1 subsets are called recursive or decidable; those in Σ1

are recursively enumerable, or simply enumerable.

It can be shown (however we won’t) that these are the same subsets (and func-tions) as the usually defined recursive, recursively enumerable (or computable)sets.

We may introduce new function and relation symbols not in τ0 to denotecertain (or all) ∆1 functions and relations. (This can be thought as introducingshorthands for these objects.) It is meaningful to speak about ∆1 sets andfunctions in the expanded language. However, everything which is ∆1 in thiswider sense is ∆1 in the original sense. (Exercise.)

Another important remark here is that fixing a theory T ⊂ F (τ0), we candefine the relativised versions of ∆0, ∆1, etc. sets. E.g., A ⊂ ωn is ∆0(T ) ifthere is a formula ϕ(x) ∈ ∆0 so that

a ∈ A iff T |− ϕ(a).

If T is just the set of formulas true on N then we get back the original notions.If (

∃y ∃z ϕ)↔(∃u (∃y < u) (∃z < u)ϕ

), (4.3)

and ((∀x < y)∃z ϕ

)↔(∃u (∀x < y) (∃z < u)ϕ

)(4.4)

are both consequences of T for all ϕ ∈ F (τ0) in which u is not free, and T |− Q,then all the Claims stated till now remain true except for the last but one(a Σ1 function is ∆1). Here the function must provably be a function, i.e. ifϕ(x, z) ∈ F (τ0) defines its graph, then we must have

T |− ∀x∃! yϕ(x, y).

Usually this special theory T is Peano’s axiom system denoted as PA ⊂ F (τ0),which consists of the following formulas:

0 6= x+ 1 , (x+ 1 = y + 1)→ x = y ,x+ 0 = x , x+ (y + 1) = (x+ y) + 1 ,x · 0 = 0 , x · (y + 1) = (x · y) + x ,x < y ↔

(x 6= y ∧ ∃z (z + x = y)

)(ϕ(0) ∧ ∀x (ϕ(x)→ ϕ(x+ 1))

)→ ∀xϕ(x) for all ϕ(x) ∈ F (τ0) .

Page 50: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

50 CHAPTER 4. INCOMPLETENESS

The scheme in the last line is the so-called induction principle. It can be shownthat (4.3) and (4.4) are consequences of PA, and also PA |− Q.

By a recursive functional we mean a ∆0 formula Φ(R) (or Φ(F )) in thelanguage where every ∆1 relation and function is denoted by some symbol,together with the distinguished n-place relation symbol R (or function symbolF ) which behaves as a (second order) variable. Given any recursive relationr ⊂ ωn, we may substitute it (or rather its name) for R in Φ(R). The result,Φ(r), also defines a recursive relation. So, in fact, Φ assigns recursive relationsto recursive relations where its name come from.

4.2 Diophantine Equations

Definition 2.1 The set A ⊂ ωn is Diophantine if there exists a polynomialp(x, y) on n+m variables and with integer coefficients so that

a ∈ A iff there exists b ∈ ωm with p(a, b) = 0,

that is, the Diophantine equation p(a, y) = 0 is solvable in y.

Definition 2.2 A formula ϕ ∈ F (τ0) is existential if it consists of a quantifier-free (i.e. open) formula preceded by a block of existential quantifiers. A subsetA ⊂ ωn is existential if it can be defined by some existential formula.

Obviously, every existential set is Σ1.

Lemma 2.3 A set is Diophantine iff it is existential.

Proof =⇒ Separating the positive and negative coefficients in p(x, y), we getthat p(a, b) = 0 iff p+(a, b) = p−(a, b), where this latter one is a prime formulain F (τ0). So p(a, y) = 0 is solvable (in natural numbers) iff N |= ∃y

(p+(a, y) =

p−(a, y)).

⇐= Suppose ϕ ∈ F (τ0) is existential. Move the ¬ signs inwards as far as possible(as in the construction of conjunctive normal forms), then apply the followingrules always using new variables:

replace e0 = e1 by (e0 − e1) = 0replace e0 6= e1 by ∃z

((e0 − e1)2 − z − 1 = 0

)replace e0 < e1 by ∃z

(e0 + z + 1− e1 = 0

)replace ¬(e0 < e1) by ∃z

(e0 − e1 − z = 0

)replace ∃z0 (e0 = 0) ∧ ∃z1 (e1 = 0) by ∃z0 ∃z1 (e20 + e21 = 0)replace ∃z0 (e0 = 0) ∨ ∃z1 (e1 = 0) by ∃z0 ∃z1 (e0 · e1 = 0). �

Theorem 2.4 (Davis–Putnam–Robinson–Matijasevic) A set is Diophantine ifand only if it is Σ1.

Page 51: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.3. CODING 51

Proof =⇒ This is immediate from the Lemma above and from the precedingremark.⇐= By induction from the Lemma below. �

Lemma 2.5 Suppose A ⊂ ωn+1 is Diophantine. Then so is

{〈x, u〉 ∈ ωn+1 : (∀y < u) (〈x, y〉 ∈ A)}.

Proof While requires no sophisticated methods, the proof is too lengthy toinclude here. �

4.3 Coding

The most important (and the perhaps most essential) method in recursion the-ory is the so-called coding, what we shall introduce just in a moment. We shalluse the binary function x .− y with takes the value 0 if x < y, and x−y otherwise.Obviously, this is a ∆0 function.

Theorem 3.1 There are ∆0 function Len(u), π(u, i), and Append(u, z) ofone, two, and two variables, respectively, so that

(i) Len(0) = 0;(ii) π(u, i) ≤ u .− 1;

(iii) the value of Append(u, z) is the minimal v for which Len(v) = Len(u) +1, π(v, i) = π(u, i) for all i < Len(u), and π(v,Len(u)) = z.

Len(u) is the length of the sequence “coded” by u; π(u, i) is the i-th mem-ber of that sequence (of course it will be used with i < Len(u) only); finallyAppend(u, z) yields the (code of the) sequence which got from u by appendingz at the end. We shall use u_ z to denote Append(u, z).

Proof The function M(x, y) = (x+ y + 1)2 + x is ∆0, i.e. the relation

{〈a, b, c〉 ∈ ω3 : M(a, b) = c}

can be defined by a ∆0 formula; and so are K(x) = x .−[√x]2 and L(x) =

[√x] .−K(x) .− 1. Let moreover rem(x, y) be the remainder when dividing x by

y, i.e. rem(x, y) = z is defined by the ∆0 formula

(y = 0 ∧ z = 0) ∨(y 6= 0 ∧ (∃v < x+ 1) (x = y · v + z) ∧∧ (∀z′ < z) (∀v < x+ 1) (x 6= y · v + z′)

).

Let Len(u) = rem(K(u), 1 + L(u)), and π(u, i) = rem(K(u), 1 + (i+ 2) · L(u)).They are obviously ∆0 functions, Len(0) = 0 by simple inspection, and

rem(K(u), i) ≤ K(u) ≤ u .− 1.

Page 52: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

52 CHAPTER 4. INCOMPLETENESS

Finally, the definition of Append(u, z) as given in (iii) is, in fact, a ∆0 definition.The only thing which may be in doubt is whether Append(u, z) is defined forall u and z. Let n = Len(u). If b is divisible by every prime number up to n+2then 1 + b, 1 + 2b, ..., 1 + (n + 2)b are pairwise relatively prime, thus by theChinese Remainder Theorem there is a solution for the simultaneous congruencesystem

x ≡ n+ 1 mod (1 + b)x ≡ π(u, 0) mod (1 + 2b). . .

x ≡ π(u, n− 1) mod (1 + (n+ 1)b).

If b is large enough then the right hand side values are just the remainders whenx is divided by the moduli. In this way v = M(x, b) = (x + b + 1)2 + x givesan appropriate value for the defining formula of Append(u, z), since K(v) = x,and L(v) = b. �

Claim 3.2 The functions Len, π, and Append are PA-provable function. Thatis, if ϕ(u, z, v) ∈ F (τ0) is the defining ∆0 formula for Append (say), thenPA |− ∀u∀z ∃!ϕ(u, z, v).

Proof This fact is not proved here, but is essential in a later theorem. �

Definition 3.3 Let 〈〉 = 0, 〈a〉 = 0_a, and in general,

〈a0, . . . , an−1, an〉 = 〈a0, . . . , an−1〉_an.

Lemma 3.4 For each n ∈ ω, the function 〈. . .〉 : ωn → ω is ∆0. Moreover if〈a0, . . . , an−1〉 = u, then Len(u) = n, and π(u, i) = ai for all i < n. �

For any A ⊂ ωn we define the coded version of A as follows:

Ac = {〈a0, . . . , an−1〉 ∈ ω : 〈a0, . . . , an−1〉 ∈ A}.

(Observe the two different meanings of the sharp brackets!)

Lemma 3.5 A ⊂ ωn is recursive ( i.e. ∆1) if and only if Ac ∈ ω is recursive.�

Since A can be recovered from Ac easily (i.e. by a ∆0 function), while there is adanger of confusing the two meaning of 〈. . .〉, this does not make any trouble asfar as recursiveness is concerned. So we can assume without loss of generality,that every function and relation we are dealing with is unary.

For A ⊂ ω and n ∈ ω, the restriction A �n is the set A ∩ {0, 1, . . . , n− 1}.

Page 53: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.4. UNDECIDABILITY 53

Theorem 3.6 (Recursion Theorem) Let Φ(R) be a recursive functional with Ras a unary relation symbol. Then there exists a unique relation r ⊂ ω so that

n ∈ r iff n ∈ Φ(r �n).

Moreover, this r is recursive (i.e. ∆1).

Proof The existence an uniqueness is obvious. To show that r is recursive, letui for i < n be the (code of the) sequence consisting of the elements of r�i (say,in increasing order), and let u = 〈u0, . . . , un−1〉. Then for i < n, x ∈ r � i iff(

∃j < Len(π(u, i)))x = π(π(u, i), j).

Substituting this for r�i in Φ(r�i) we get that i ∈ Φ(r�i) is a ∆1 relation (withu and i as free variables). Therefore these u’s are defined by the following ∆1

relation:

π(u, 0) = 0 ∧(∀i < Len(u)

) ((i ∈ Φ(r � i)→ π(u, i+ 1) = π(u, i)_ i) ∧

∧ (i /∈ Φ(r � i)→ π(u, i+ 1) = π(u, i))).

Now let Ψ(x) ∈ F (τ0) be a Σ1 formula so that N |= Ψ(u) iff u belongs to thisrelation. Then writing ui instead of π(u, i) we have

n ∈ r iff N |= ∃u (∃i < Len(u)) (∃j < Len(ui)) (Ψ(u) ∧ n = π(ui, j))iff N |= ∀u (∀i < Len(u))

(Ψ(u) ∧ (∃j < Len(ui)) (n ≤ π(ui, j))→

→ (∃j < Len(ui)) (n = π(ui, j))),

showing that r is ∆1 as claimed. �

The true significance of this theorem lies in the fact that whenever we definea relation (or function) from values it takes earlier in a recursive way, then therelation (function) will also be a recursive one.

4.4 Undecidability

Let τ be a finite similarity type extending τ0, i.e. only finitely many differentsymbols are allowed in τ . (This restriction can be weakened a bit.) Define thecode of the symbols as

(i) if x is the i-th variable symbol, then cd(x) = 〈0, 0, i〉;(ii) if c ∈ τ is the i-th constant symbol then cd(c) = 〈0, 1, i〉;

if f ∈ τ is the i-th function symbol of arity n, then cd(f) = 〈0, 2, i, n〉;if r ∈ τ is the i-th relation symbol of arity n then cd(r) = 〈0, 3, i, n〉;

Page 54: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

54 CHAPTER 4. INCOMPLETENESS

(iii) cd(¬) = 〈0, 4〉; cd(∨) = 〈0, 5〉; cd(∃) = 〈0, 6〉; cd(=) = 〈0, 7〉.Since, by assumption, τ is finite, all of the sets {cd(x) : x is a variable

symbol}, {cd(c) : c ∈ τ is a constant symbol}, etc. are finite, therefore ∆0.

Definition 4.1 The Godel-number dee of the expression e ∈ E(τ) isdxe = 〈cd(x)〉 if x is a variable symbol;dce = 〈cd(c)〉 if c ∈ τ is a constant symbol;df(e0, . . . , en−1)e = 〈cd(f), de0e, . . . , den−1e〉 if f ∈ τ is an n-place func-tion symbol.

Let moreover Expression = {dee ∈ ω : e ∈ E(τ)}. �

Lemma 4.2 The “Expression” relation is recursive.

Proof By the Recursion Theorem. It is enough to show that this relation isdefined in a recursive way from values it takes earlier. Now u ∈ Expressioniff u is a code of a sequence, and either u has length 1 and its only memberis the code of a variable symbol or a constant symbol, or its length is biggerthan 1, the first member is the code of a function symbol which is followed by(smaller) numbers which are “Expression”s. Now “being a code” means thateach smaller number has either a different length or for some i < Len(u) itsi-th member is different (evidently a ∆0 relation), and the remaining conditionis (

Len(u) = 1 ∧ π(u, 0) = cd(x) for some variable symbol x)∨

∨(Len(u) = 1 ∧ π(u, 0) = cd(c) for some constant symbol c ∈ τ

)∨

∨(Len(u) > 1 ∧ π(u, 0) = cd(f) for some function symbol f ∈ τ ∧∧ Len(u) = π(π(u, 0), 3) + 1 ∧∧ (∀i < Len(u) .− 1) (π(u, i+ 1) ∈ Expression)

).

This is a recursive functional for “Expression”, and since π(u, i+ 1) ≤ u .− 1,it refers to values less than u. �

Definition 4.3 The Godel number dϕe of the formula ϕ ∈ T (τ) is defined asfollows:

de0 = e1e = 〈cd(=), de0e, de1e〉;dr(e0, . . . , en−1)e = 〈cd(r), de0e, . . . , den−1e〉;d¬ϕe = 〈cd(¬), dϕe〉;dϕ ∨ ψe = 〈cd(∨), dϕe, dψe〉;d∃xϕe = 〈cd(∃) , cd(x), dϕe〉.

Moreover, Formula = {dϕe : ϕ ∈ F (τ)}. �

Lemma 4.4 The “Formula” relation is recursive. �

Page 55: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.4. UNDECIDABILITY 55

Claim 4.5 The “Expression” and “Formula” relations, as subsets of ω, aredisjoint. �

Since the natural numbers were identified with special τ0-type expressions (recallthat n ∈ ω is (. . . (0 + 1) + . . .+ 1) + 1 ∈ E(τ) with n ones), and, therefore, theyare τ -type expressions, the Godel-number dne of n ∈ ω is defined for each n.

Lemma 4.6 The function n 7→ dne is recursive.

Proof We have to show that the relation A = {〈n, dne〉 : n ∈ ω} is ∆1. Alsowe can use the Recursion Theorem since 〈u, v〉 ∈ A iff

(u = 0 ∧ v = d0e) ∨(u 6= 0 ∧ v ∈ Expression ∧

∧ π(v, 0) = cd(+) ∧ π(v, 2) = 1 ∧ 〈u .− 1, π(v, 1)〉 ∈ A)

Since d0e, d1e and cd(+) are certain natural numbers (however we won’t com-pute them), this is a recursive functional for A if we know that 〈u .− 1, π(v, 1)〉is smaller than 〈u, v〉. While it may happen that this is not the case, we do notbother. One can make it sure by redefining the “pairing function” 〈. . .〉, or canuse a bit more sophisticated definition for A. �

Definition 4.7 Let Free = {〈dϕe, cd(x)〉 : the variable x is free in ϕ ∈ F (τ)};and for a variable x, Substx = {〈dϕe, dee, dϕ(x/e)e〉 : ϕ ∈ F (τ), e ∈ E(τ), andthe substitution ϕ(x/e) is free }.

Lemma 4.8 “Free” and “Substx” are ∆1 relations. �

Definition 4.9 Let T ⊂ F (τ) be arbitrary. T is recursive if {dϕe : ϕ ∈ T} ⊂ ωis ∆1; T is enumerable if {dϕe : ϕ ∈ T} is Σ1; T is decidable if {dϕe : T |− ϕ} is∆1; finally T is undecidable if not decidable. �

That T is recursive simply means that we have a decision procedure whichtells for any formula ϕ ∈ F (τ) whether ϕ is an element of T or not; T isenumerable if we can list its members in some mechanical way; T is decidable ifthere exists some procedure telling for every formula whether it is a consequenceof T or not.

Since Substx ⊂ ω3 is ∆1, and the function n 7→ dne is recursive, the setA = {〈dϕe, n, dϕ(x/n)e〉 : ϕ ∈ F (τ), n ∈ ω} is also ∆1. Therefore we have Σ1

formulas ϑ(x, y, z) and ϑ(x, y, z) so that 〈a, b, c〉 ∈ A implies T0 |− ϑ(a, b, c), and〈a, b, c〉 /∈ A implies T0 |− ϑ(a, b, c). Now let

Subst(x, y, z) def= ϑ(x, y, z) ∧ (∀z′ < z)ϑ(x, y, z′) ∈ F (τ0)

Suppose ϕ ∈ F (τ), and n ∈ ω, then obviously,

T0 |− ∀z (Subst(dϕe, n, z)↔ z = dϕ(x/n)e.

Page 56: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

56 CHAPTER 4. INCOMPLETENESS

Theorem 4.10 (Church’s Theorem) Suppose T0 ⊂ T ⊂ F (τ), and T is consis-tent. Then T is undecidable.

Proof Suppose the contrary, i.e. the set of consequences of T is ∆1. By theRepresentation Theorem for ∆1 sets, we have a Σ1 formula χ(x) ∈ F (τ0) sothat for any ϕ ∈ F (τ),

(i) T0 |− χ(dϕe) if T |− ϕ;(ii) T0 |− ¬χ(dϕe) if T |6− ϕ.

Now let Ψ(x) def= ∀x (Subst(x, x, z)→ ¬χ(z)) ∈ F (τ0), and consider the (closed)formula ν def= Ψ(dΨe) ∈ F (τ0). We have two cases.(i) T |− ν. Then by (i) above, T0 |− χ(dνe), and since 〈dΨe, dΨe, dνe〉 ∈ A asdefined before the theorem, T0 |− ∃z (Subst(dΨe, dΨe, z)∧ z = dνe). Now thesegive

T0 |− ∃z (Subst(dΨe, dΨe, z) ∧ χ(z))

which is nothing else but the negation of ν. So T |− ν implies T0 |− ¬ν, i.e. Tis not consistent.(ii) T |6− ν. Then T0 |− ¬χ(dνe), and, as before,

T0 |− ∀z (Subst(dΨe, dΨe, z)→ z = dνe),

i.e. T0 |− ∀z (Subst(dΨe, dΨe, z)→ ¬χ(z)), T0 |− ν, which is impossible. �

In the proof above we did not use the fact that χ is a Σ1 formula. TakingT to be the set of τ0-type formulas true on N, a slight modification of the proofgives

Theorem 4.11 (Tarski) There exists no formula χ(x) ∈ F (τ0) so that for any(closed) ϕ ∈ F (τ0),

N |= ϕ if and only if N |= χ(dϕe). �

This Theorem says not only that the set of formulas true on the structure ofnatural numbers is not recursive (i.e. not ∆1), or not recursively enumerable(not Σ1), but that not formula, no matter how complex it is, can capture thisset. A usual way to express this theorem is by saying, “the truth on naturalnumbers is not arithmetical.”

Let us apply Church’s Theorem with τ = τ0, T = T0. It says that the set{ϕ ∈ F (τ0) : T0 |− ϕ} is not recursive.

Theorem 4.12 (Undecidability of First-order Logic) Let τ ⊃ τ0. The set

A = {ϕ ∈ F (τ) : |= ϕ}

(i.e. the set of τ -type formulas true on all models) is not recursive.

Page 57: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.4. UNDECIDABILITY 57

Proof Suppose the contrary. Since T0 is finite, we can form the conjunct of theuniversal closures of its elements, let it be Φ ∈ F (τ0). Now by the completenessof |− and by the Deduction Lemma 1.11,

{ϕ ∈ F (τ0) : T0 |− ϕ} = {ϕ ∈ F (τ0) : |= Φ→ ϕ}= {ϕ ∈ f(τ0) : (Φ→ ϕ) ∈ A}.

Therefore if A is recursive then so is the set of consequences of T0. (Since Φ isa concrete formula, the function dϕe 7→ dΦ → ϕe is evidently recursive.) Butthis contradicts Church’s Theorem. �

Observe that in contrast to this theorem, the tautologies always form a re-cursive set.

What happens if we drop the apparently superficial restriction τ ⊃ τ0? Forexample, what can we say if τ is empty, i.e. only the equational symbol isallowed in formulas, and no other function and relation symbols?

Claim 4.13 The set {ϕ ∈ F (∅) : |= ϕ} is recursive.

Proof We describe a procedure which checks whether a formula ϕ ∈ F (∅) istrue on all models or not, and leave it as an Exercise to turn it into a proofof the claim. First, put ϕ into prenex form. Suppose it contains n differentvariable symbols. Now ϕ is true on all structures with at most n + 1 elementsif and only if ϕ is identically true. �

So what is so special in the type τ0? Surely not the shape of the symbols,rather the kind and the arities.

Theorem 4.14 Let τ be a similarity type. The empty theory of type τ is unde-cidable (i.e. the set {ϕ ∈ F (τ) : |= ϕ} is not recursive) if and only if τ containseither at least two function symbols, or contains a relation or function symbolof arity ≥ 2. �

Next we extend the methods of the proof of Church’s Theorem so that it can beapplied to other theories, too. Let τ be an arbitrary but finite similarity type.We can also define the Godel-number of the τ -type expressions and formulas.Let f : ω → E(τ) be a function so that n 7→ df(n)e is recursive. (Observe thatour original coding satisfies this property.) We say that the relation A ⊂ ωn isrepresentable in the theory T ⊂ F (τ) if there exists a formula χ(x) ∈ F (τ) sothat for any a ∈ ωn,

T |− χ(f(a)) if a ∈ A,T |− ¬χ(f(a)) if a /∈ A.

Theorem 4.15 Suppose every recursive relation is representable in the consis-tent theory T ⊂ F (τ). Then T is undecidable.

Proof Word by word the proof of Church’s Theorem. �

Page 58: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

58 CHAPTER 4. INCOMPLETENESS

Corollary 4.16 The axiom system ZFC (Zermelo-Fraenkel axiom system forset theory with the Axiom of Choice) is undecidable.

Proof (with a hotch-potch). We may assume that the symbol ∅ for the emptyset, {} for pairing, and ∪ for binary union, are present in the language. Definethe embedding f : ω → E(τ) as expected: f(0) = ∅, f(n+ 1) = f(n) ∪ {f(n)}.The representability evidently holds. �

As in case of Peano arithmetic, to prove that every recursive function isrepresentable requires a finite part of ZFC only. Thus any set of formulasextending consistently that finite subset is undecidable. The language of ZFCcontains a single binary relation symbol (for membership) only, therefore wehave

Corollary 4.17 The empty theory with a single binary relation symbol is un-decidable. �

A theory T ⊂ F (τ) is essentially undecidable if no consistent extension of T isdecidable. Of course, consistent extensions of essentially undecidable theoriesare essentially undecidable. Moreover, if T is finite and essentially undecidable,T ′∪T is consistent, then T ′ is undecidable. In fact, a bit more is true. Supposewe can find a model for T ′ ⊂ F (τ ′) so that inside this model, with the help ofthe symbols available in the type τ ′ we can define a τ -type model for T ⊂ F (τ).Then T ′ is undecidable. Indeed, using the definition of the “inner model,” we cantranslate the formulas about T into the language of T ′. Now if the translationof ϕ ∈ F (τ) is ϕ′ ∈ F (τ ′), then in that particular model the translations of theelements of T are true. Therefore T ′ ∪{ϕ′ : ϕ ∈ T} is consistent, and then so is

{ψ ∈ F (τ) : T ′ ∪ {ϕ′ : ϕ ∈ T} |− ψ′}.

This is a consistent extension of T , therefore undecidable. On the other hand,if T ′ is decidable, then, T being finite, T ′ ∪{ϕ′ : ϕ ∈ T} is also decidable. Butthis implies that the above set is also decidable, a contradiction.

We have a finite, essentially undecidable theory T0 ⊂ F (τ0), and N is amodel for it. Therefore if we can define N inside a model of a theory T , thenthis T is necessarily undecidable, moreover there is a finite T ∗ ⊂ F (τ) so thatT ∪ T ∗ is consistent, and T ∗ is essentially undecidable.

Theorem 4.18 The theory of rings is undecidable.

Proof A ring is a 〈+,−, ·, 0, 1〉-type structure, let Z be the ring of integers.We are going to define an “inner structure” in Z isomorphic to N. We have theconstants 0, 1, and the operations +, ·, the only missing thing is the groundset. Thus if we are able to define (by a formula) the set of the non-negativeintegers, we are home. But how to do that? The squares are positive numbers,but not every positive number is a perfect square. However, every ≥ 0 integeris the sum of four squares. Thus the set of those a ∈ Z which satisfy

Z |= ∃x0 ∃x1 ∃x2 ∃x3 (a = x20 + x2

1 + x22 + x2

3)

Page 59: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.4. UNDECIDABILITY 59

is just the set of natural numbers. 0 and 1 (in the “ring” sense) are here, andthe sum and product of these as natural numbers agree the sum and product inthe ‘ring” sense. �

Theorem 4.19 (Tarski) The theory of groups is undecidable.

Proof We start with a lemma. For integers i, j ∈ Z, i | j denotes that j isdivisible by i, i.e. for some k ∈ Z we have i · k = j.

Lemma 4.20 There exists a finite, essentially undecidable theory on the lan-guage 〈+, | , 1〉 so that Z with the natural interpretation forms a model for thistheory.

Proof We have to show that the constant 0 and the multiplication is definable.Now 0 is the only element which satisfies x+x = x, obviously a good definitionfor 0. For i, j ∈ Z define the result of the binary operation i− j as the only xsatisfying x+ j = i; and the result of the unary operation i2 is the only x with

∀y (i |y ∧ (i+ 1) |y → (x+ i) |y) ∧ ∀y (i |y ∧ (i− 1) |y → (x− i) |y).

Finally, i · j is the only z satisfying (i+ j)2 = i2 + z + z + j2. Since everythingwas defined with the given symbols, we are done. �

Now we return to the proof ot Tarski’s Theorem. It is enough to find agroup and inside it a structure isomorphic to the one in the Lemma. We shalluse another constant symbol besides the one denoting the neutral element ofthe group; it is not too hard to get rid off it.

So let G be the permutation group of Z, the composition of π0, π1 ∈ G willbe denoted by π0 ◦ π1 ∈ G. Let S = S1 ∈ G be the element with S(i) = i + 1for all i ∈ Z; in general, for any n ∈ Z define Sn(i) = i + n. Let A = {π ∈ G :π ◦ S = S ◦ π}, moreover for π0, π1 ∈ A define π0 + π1 as π0 ◦ π1 (this lies inA), and define the relation π0 |π1 by

π0 |π1 iff G |= ∀x (x ◦ π0 = π0 ◦ x→ x ◦ π1 = π1 ◦ x).

They are definitions in the language 〈◦, S〉 (here S is the constant symbol and ◦ isthe group operation), and it is easy to see that A = {Sn : n ∈ Z}, Si+Sj = Si+j ,and Si |Sj iff i | j. Consequently we have defined the structure in the Lemma,so the Theorem is proved. �

By similar methods, J. Robinson proved

Theorem 4.21 The theory of fields in undecidable. �

In fact, she proved that the integers form a definable subset of the rationals. Incontrast to these results we have

Theorem 4.22 The theory of Abelian groups, and the theory of algebraicallyclosed fields are decidable. �

Page 60: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

60 CHAPTER 4. INCOMPLETENESS

4.5 Godel’s Incompleteness Theorems

Here again we fix the finite similarity type τ . Let T ⊂ F (τ). We say that u ∈ ωis a derivation from T if

u = 〈dϕ0e, dϕ1e, . . . , dϕn−1e〉,

where ϕi ∈ F (τ), and the sequence ϕ0, ... , ϕn−1 is a derivation from T , i.e.each ϕi is either an axiom, an element of T or is the conclusion of an inferencerule with premises among {ϕj : j < i}.

Definition 5.1 ProvTdef= {〈u, dϕe〉 : u ∈ ω is a derivation from T , and its last

element is ϕ}.

Observe that T |− ϕ if and only if 〈u, dϕe〉 ∈ ProvT for some u ∈ ω.

Lemma 5.2 If T is recursive (enumerable) then so is ProvT .

Proof Rather long, but easy (now). Since the sets

{dϕe : ϕ ∈ F (τ) is an instance of some axiom},

and

{〈dχe, dϕ0e, dϕ1e〉 : χ is the conclusion of an inferencerule with premises in ϕ0,ϕ1}

are recursive, we have that 〈u, v〉 ∈ ProvT iff “u is a sequence” ∧ Len(u) > 0∧ π(u,Len(u) .− 1) = v ∧ (∀i < Len(u)) “π(u, i) is a formula” ∧ (∀i < Len(u))(“π(u, i) is an instance of an axiom”∨ (∃j0 < i) (∃j1 < i) “π(u, i) is the conclu-

sion of an inference rule with premises π(u, j0) and π(u, j1)” ∨ “π(u, i) ∈ T”).

Now this is a ∆1 definition if “π(u, i) ∈ T” is ∆1, i.e. if T is recursive; anda Σ1 definition if T is enumerable. �

Definition 5.3 The theory T ⊂ F (τ) is complete if for any closed ϕ ∈ F (τ),either T |− ϕ or T |− ¬ϕ.

Theorem 5.4 Suppose T is enumerable and complete. Then T is decidable.

Proof By the Lemma, ProvT is Σ1, therefore the set of consequences of Tform a Σ1 set, too: T |− ϕ if and only if N |= ∃u (〈u, dϕe〉 ∈ ProvT ). We haveto show that this set is Π1, or, which is the same, that its complement is Σ1.Let ϕ be the universal closure of ϕ ∈ F (τ). T is complete, therefore T |6− ϕ iffT |6− ϕ iff T |− ¬ϕ. This means

T |6− ϕ iff N |= ∃u (〈u, d¬ϕe〉 ∈ ProvT ).

The function dϕe 7→ d¬ϕe is recursive, therefore the formulas which are notconsequences of T also form a Σ1 set, as required. �

Page 61: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.5. GODEL’S INCOMPLETENESS THEOREMS 61

Corollary 5.5 The following theories are decidable:(i) dense linear ordering without endpoints;(ii) atomless Boolean algebras;(iii) algebraically closed fields of a given characteristic.

Proof These theories are evidently enumerable (even recursive, an appropriateaxiom system can be written explicitly). The first two are ω-categorical, and thealgebraically closed fields are ω1-categorical (they are determined completely bythe transcendence degree), therefore they must be complete by the Lowenheim–Skolem Theorems. �

Theorem 5.6 (Godel’s First Incompleteness Theorem) Suppose T0 ⊂ T ⊂F (τ), T is enumerable and consistent. Then there exists a (closed) formulaindependent of T , i.e. ϕ ∈ F (τ) so that neither T |− ϕ nor T |− ¬ϕ.

Proof This is an immediate consequence of the previous Theorem and Church’sTheorem. �

This proof is purely “existential”, i.e. only the existence of such a formu-las proved. Such a formula, however, can be constructed explicitly, but is tooartificial, has no “mathematical meaning” in the sense of the everyday puremathematics. Proving independence (say, from ZFC or from PA) of more nat-ural sentences requires techniques developed quite recently (such as forcing).

Let T be an enumerable theory. Then the relation ProvT is Σ1. LetProvT (x, y) ∈ F (τ0) be the Σ∗1 formula built up in a way reflecting the defini-tion of the relation. In particular, for any natural number a, b ∈ ω,

〈a, b〉 ∈ ProvT iff N |= ProvT (a, b) iff T0 |− ProvT (a, b)

Definition 5.7 ConT ∈ F (τ0) is the formula ¬∃zProvT (z, dx 6= xe).

Of course, N |= ConT if and only if T is consistent. So proving that a giventheory T is consistent is just the same task as proving that the (Π∗1) formulaConT is true on the natural numbers. In particular, the consistency of ZFC isa number-theoretical statement.

For any enumerable theory T , ConT ∈ F (τ0) is a concrete closed formula,and as such, is either true or false on N (depending on whether T is consistentor not). Consequently, it is equivalent (on N) to a huge collection of other(closed) formulas. In fact, for any closed ϕ ∈ F (τ0), either N |= ConT ↔ ϕ, orN |= ConT ↔ ¬ϕ. This situation changes considerably if we want to prove theformula ConT . It may happen that we cannot prove it from T ′, say, but we canprove an equivalent of it. (If N |= ConT then N |= ConT ↔ ∀x (x = x), andT ′ |− ∀x (x = x) no matter what T ′ is.) Nevertheless, ConT is regarded as theone and only formula which expresses the consistency of T in the most basicand essential way, in the form what every consistency proof should give. If wecan show T ′ |6− ConT , then this fact is expressed by saying “the consistency ofT is not provable in T ′”.

Page 62: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

62 CHAPTER 4. INCOMPLETENESS

Recall that Subst(x, y, z) ∈ F (τ0) is the Σ∗1 formula so that for all ϕ ∈ F (τ)and n ∈ ω

T0 |− ∀z (Subst(dϕe, n, z)↔ z = dϕ(x/n)e).

Theorem 5.8 (Godel’s Second Incompleteness Theorem) Suppose τ0 ⊂ τ , PA ⊂T ⊂ F (τ), and T is a consistent enumerable theory. Then T |6− ConT .

Proof We start with a lemma. The Σ∗1 formula ProvT (x, y) ∈ F (τ0) wasdefined above. Let PrT (y) def= ∃xProvT (x, y). Since we shall deal with thetheory T only, we omit the subscripts. Define

Ψ(x) def= ∀z(Subst(x, x, z)→ ¬Pr(z)

),

and let ν def= Ψ(dΨe), saying “I am not provable”.

Lemma 5.9 T |6− ν.

Proof As in Church’s Theorem. Suppose T |− ν. Then for some u ∈ ω we have

T0 |− ProvT (u, dνe),

i.e. T0 |− ∃z (Subst(dΨe, dΨe, z) ∧ Pr(z)) ≡ ¬ν. Therefore T is inconsistent, acontradiction. �

Now the theorem follows immediately if we can show that PA |− ConT → ν.Since T0 |− Subst(dΨe, dΨe, z) ↔ z = dνe, we have T0 |− ν ↔ ¬Pr(dνe), inparticular, T ∪ {ν} |− ¬Pr(dνe). We claim that

PA |− Pr(dνe)→ Pr(d¬Pr(dνee), (4.5)

which formula says “if we have a derivation for ν (from T ), then we also have aderivation for ¬Pr(dνe).” Now if ϕ0, ϕ1, . . ., ϕn−1 is a derivation from T ∪ {ν}ending in ¬Pr(dνe), which exists by T ∪ {ν} |− ¬Pr(dνe), and in a model M ofPA we have M |= Prov(u, dνe) for some u ∈M , then also

M |= Prov(u_ dϕ0e_ . . . _ dϕn−1e, d¬Pr(dνe)e),

i.e. M |= ∃xProv(x, d¬Pr(dνe)e). Thus the implication Pr(dνe)→ Pr(d¬Pr(dνe)e)is true in every model of PA, proving (4.5).

Here is the (first) point where we use the fact that the recursive functionsand relations defined so far behave nicely not only on N but on any model ofPA. Also we have T0 |− ¬ν → Pr(dνe), which, together with (4.5) gives

PA |− ¬ν → Pr(d¬Pr(dνe)e).

For any ϕ ∈ F (τ) we have {ϕ,¬ϕ} |− x 6= x, and the same reasoning as aboveleads to

PA |− Pr(dϕe) ∧ Pr(d¬ϕe)→ Pr(dx 6= xe).

Page 63: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.5. GODEL’S INCOMPLETENESS THEOREMS 63

Since the last formula is just ¬ConT , if we know

PA |− ¬ν → Pr(dPr(dνe)e),

then substituting ϕ by Pr(dνe) we are home. At any rate, we know PA |− ¬ν →ϕ, and what we need is PA |− ϕ→ Pv(dϕe). Our ϕ = Pr(dνe) ∈ F (τ0) is a Σ∗1formula, PA ⊂ T , therefore this follows from

Lemma 5.10 If ϕ ∈ F (τ0) is a Σ∗1-formula, then PA |− ϕ→ Pr(dϕe).

Proof By a tiresome, complicated induction on the complexity of ϕ. �

By this we have proved Godel’s Second Incompleteness Theorem. �

As Church’s Theorem, this Theorem remains also true if instead requiring Tto be an extension of PA, we require a definable “inner” model for PA in everymodel of the theory T . This is evidently met by the (recursive) set of ZFC.

Corollary 5.11 If ZFC is consistent, then ZFC |6− ConZFC. �

There is no way to prove the consistency of ZFC within (or with tools affordedby) ZFC. And since every mathematical activity, manipulation, and proof isregarded sane, acceptable and correct only if it can be embedded into the generalframework of set theory (this is not a claim, only experimental fact), there is nohope for proving the consistency of ZFC, and therefore there is no reason to lookfor such a proof. However, there remains the possibility that someone sometimessucceeds in proving that ZFC is inconsistent. This, in my opinion, will have verylittle, if any, effect on mathematics. More than 50 years of practice showed thatthis proof must be very long and complicated, and a slight modification eitheron the formula set ZFC, or on the derivation rules will mend the situation, amodification which does not affect the remaining part of mathematics.

We have seen that if T is enumerable and PA ⊂ T then T |6− ConT , However,it may happen that T is consistent, and T |− ¬ConT . To show this, let T =PA ∪ {¬ConPA}. Since PA has a model (namely N), it is consistent, thereforePA |6− ConPA, which means that T is consistent. But T |− ¬ConPA, and sinceT ⊃ PA, this implies T |− ¬ConT .

As it was remarked, there are other possible definitions for consistency. Oneof them is Rosser’s:

Prov∗T (u, dϕe) def= ProvT (u, dϕe) ∧ (∀v < u)¬ProvT (v, d¬ϕe);

Con∗Tdef= ¬(∃uProv∗T (u, dx = xe) ∧ ∃vProv∗T (v, dx 6= xe)).

It is not hard to see that if PA ⊂ T ⊂ F (τ), T is enumerable, then T |− Con∗T .

Page 64: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

64 CHAPTER 4. INCOMPLETENESS

4.6 Further reading

Consider the set formed from those pairs of natural numbers 〈dϕe, u〉, for whichϕ ∈ F (τ0) is a ∆0 formula, u = 〈u0, . . . , un−1〉 is a sequence of length n, all thefree variables of ϕ are among x0, . . . , xn−1, finally

N |= ϕ[x0/u0, . . . , xn−1/un−1].

This set will be denoted by Sat0.

Lemma 6.1 Sat0 ⊂ ω2 is recursive.

Proof By the Recursion Theorem. It is not hard to give a recursive definitionfor this set. �

Corollary 6.2 There is a universal recursive set for ∆0 formulas, i.e. a recur-sive U0 ⊂ ω2 so that for each ∆0 set A ⊂ ω one can find an i ∈ ω with

a ∈ A iff 〈i, a〉 ∈ U0.

Proof By the previous Lemma, the set

U0 = {〈dϕe, a〉 : ϕ ∈ F (τ0) is ∆0, has a single free variable,and N |= ϕ(a)}

is recursive. �

Corollary 6.3 There is a recursive set which is not ∆0.

Proof A = {a ∈ ω : 〈a, a〉 /∈ U0} is recursive, but cannot be ∆0. �

Now consider the relation Sat1 ⊂ ω2 defined similarly as Sat0 above, onlythat not ∆0 but Σ1 formulas are allowed.

Lemma 6.4 The relation Sat1 ⊂ ω2 is Σ1.

Proof The pair 〈d∃xϕe, u〉 is an element of Sat1 iff ϕ ∈ F (τ0) is a ∆0 for-mula, and for some a ∈ ω we have 〈dϕ(x/a)e, u〉 ∈ Sat0. This latter one is arecursive set, therefore Σ1. The lemma follows from the fact, that the function〈d∃xϕe, a〉 7→ dϕ(x/a)e is a recursive one. �

Corollary 6.5 There is a universal Σ1 set U1 ⊂ ω2. That is, for each Σ1 setA ⊂ ω one can find an i ∈ ω so that a ∈ A iff 〈i, a〉 ∈ U1.

Proof As before, the set

{〈dϕe, a〉 : ϕ ∈ F (τ0) is Σ1, has a single free variable,and N |= ϕ(a)}

is Σ1. �

Page 65: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

4.6. FURTHER READING 65

Corollary 6.6 There is a Σ1 set so that its complement is not Σ1.

Proof The set {a ∈ ω : 〈a, a〉 ∈ U1} is Σ1 since U1 is Σ1. Its complement, i.e.{a ∈ ω : 〈a, a〉 /∈ U1} is not Σ1. �

Corollary 6.7 There is a Σ1 relation which is not recursive.

Proof The complement of a recursive relation is recursive, therefore Σ1. Sothe above Σ1 set is not recursive. �

Until now we have established the following relations: ∆0 6= ∆1 6= Σ1. Sincethe complement of a Σ1 set is Π1, and ∆1 = Σ1∩Π1, from here we have ∆1 6= Π1,and Σ1 6⊂ Π1, Π1 6⊂ Σ1.

Claim 6.8 There is no universal recursive relation, i.e. recursive Ur ⊂ ω2 sothat for all recursive A ⊂ ω one can find an i ∈ ω with

a ∈ A iff 〈i, a〉 ∈ Ur.

Proof The set {a ∈ ω : 〈a, a〉 /∈ Ur} would also be recursive. �

This is just the beginning of an interesting an important branch of mathe-matics called Recursion Theory.

Page 66: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

66 CHAPTER 4. INCOMPLETENESS

Page 67: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

Chapter 5

Problems

1. Prove that compactness is equivalent to the following: if Σ |= ϕ then thereexists a finite subset Σ′ of Σ such that Σ′ |= ϕ.

2. Decide which of the following is true, which is false. Here Σ denotes a setof propositional formulas, ϕ and ψ denote propositional formulas. Whathappens if they are first order?

(i) Σ |= ϕ ∨ ψ implies that either Σ |= ϕ or Σ |= ψ.(ii) Σ |= ϕ ∧ ψ implies that Σ |= ϕ and Σ |= ψ.

(iii) If Σ ∪ {ϕ ∨ ψ} is satisfiable, then either Σ ∪ {ϕ} is satisfiable, orΣ ∪ {ψ} is satisfiable.

(iv) If both Σ ∪ {ϕ} and Σ ∪ {ψ} are satisfiable, then Σ ∪ {ϕ ∧ ψ} issatisfiable.

3. (i) Let A be a finite structure. What can be said about the ultrapowerIA/U?

(ii) Suppose we have only finitely many different structures among Ai fori ∈ I. What can be said about the ultraproduct

∏Ai/U?

4. Let A be an infinite structure and κ be an infinite cardinal. Show that forsome ultrafilter U on κ the ultrapower κA/U has cardinality at least 2κ.

5. “Let A be an infinite structure, |A| = κ. If . . . . . . . . . . . . . . then A has aproper elementary extension of cardinality κ.”

Fill in the missing condition and prove the statement. Give an examplethat the statement does not hold without that condition.

6. Let A be a structure, K1 = {B : B is an elementary extension of A},and K2 = {B : A can be embedded elementarily into B}. Which of thefollowing is possible:

(i) K1 and K2 are elementary;(ii) K1 is elementary and K2 is not;

67

Page 68: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

68 CHAPTER 5. PROBLEMS

(iii) K1 is not elementary but K2 is;(iv) neither K1 nor K2 is elementary.

7. Let λ be an infinite cardinal, for each ξ < λ let cξ be a constant symbol.Consider the theory T = {cξ 6= cη : ξ < η < λ}. For which cardinal κ isT κ-categorical?

8. Give a theory Σ ⊂ F (τ) for some appropriate similarity type τ which isκ-categorical for each infinite κ.

“Let A be a model for this Σ. By problem 7, A has a properelementary extension of cardinality |A| if this cardinal is largeenough. So Σ has at least two models of this cardinality, con-tradicting categoricity.”

Where is the flaw in this reasoning?

9. Let K be an elementary class, K∗ be a subclass of K. Assume the following.

(i) If Ai ∈ K∗ for all i ∈ I (I is an index set), then one can find anA ∈ K∗ so that each Ai is isomorphic to a substructure of A.

(ii) If A, B ∈ K, A is a substructure of B and A /∈ K∗, then also B /∈ K∗.

Show that if K∗ is closed under elementary equivalence then K∗ is elemen-tary.

10. Consider the following subclasses of the class of graphs. Which of them iselementary? Which is finitely axiomatizable?

(i) all graphs;(ii) finite graphs;(iii) infinite graphs (i.e. graphs with infinitely many vertices);(iv) graphs with countably many vertices;(v) graphs without triangles (i.e. graphs with no mutually connected

vertices v0, v1, v2);(vi) connected graphs;(vii) disconnected graphs;(viii) graphs with infinitely many edges;(ix) graphs with an infinite clique (a subset A of G is a clique if any two

vertices of A are connected by an edge);(x) planar graphs [Hint: let Gn be the following graph on 5+10n points:

we have five points and any two of them is connected by a path oflength n. This Gn is not planar. What about

∏Gn /U ? Does it

proves that this class is not elementary? ].

11. Give a theory Σ which has a countable model, and, consequently, a modelof cardinality 2ω, but for every ω < κ < 2ω has no model of cardinality κ.[ Hint: let D ⊂ P(ω) be an almost disjoint family of cardinality 2ω, andregard the elements of D as unary predicates on ω. ]

Page 69: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

69

12. Which of the following formulas are tautologies:

(i)((¬¬ψ ∨ ϕ)→ ((¬ψ ∨ ϕ) ∧ (ψ ∨ ¬ϕ))

)→

(¬ϕ→ (ψ → ¬ϕ)

)(ii) (0 = 1 ∧ 0 6= 1)→ 0 = 2

(iii) (ϕ ∧ ψ ∧ ϑ)→ ϕ

(iv) ∃x ∃y ∃z (x 6= y ∧ y 6= z ∧ z 6= x) → ∃x∃y (x 6= y)(v) ∃x∃y ∃z

((x 6= y ∧ y 6= z ∧ z 6= x → x 6= y

)(vi) ∃x (x 6= 0)→ ∃y (y 6= 0)

13. Proving compactness, we have used that every filter can be extended intoan ultrafilter, that is, the Axiom of Choice. Consequently, proving (strong)completeness, we have also used AC. Where?

14. Is it true that if Σ is a syntactically consistent Henkin theory, then everymaximal syntactically consistent extension of Σ is also Henkin?

15. Suppose the equality sign (=) does not occur neither in Σ nor in ϕ, more-over Σ |= ϕ. Does it follow from our proof of strong completeness, thatthan we have a derivation Σ |− ϕ in which none of the equality axiomsEx1–Ex3 are used? Why?

16. At a certain point of the proof of the completeness theorem we have usedthe fact, that there is no upper bound on the available variable symbols.Where? Thus the following claim does not follows from our proof:

“Suppose ϕ ∈ F (τ) contains no more than 10 different variablesymbols, and |= ϕ. Then we have a derivation of ϕ in which nomore than 1,000,000 different variable symbols are used.”

(In fact, this claim is false.)

17. Let < be a binary relation symbol. Write a formula ϕ ∈ F (<) so that inany finite structure A, if A |= ϕ then <A is an ordering on A. Supposeϕn ∈ F (<) is so that A |= ϕn(a) for some a ∈ A then there are at leastn elements in A below a ∈ A. Describe how to get ϕ2n+1(x) from ϕn(x)using a single new variable only. Show that for each n ∈ ω there is a(closed) formula Φn ∈ F (<) in which less than n + 10 different variablesymbols occur, so that A |= Φn implies that A has at least 2n elements.

18. Let 〈·, c〉 be the type of the language of groups, and take the followingaxioms:

(i) x · c = x (c is a right unit);(ii) x · (y · z) = (x · y) · z (associativity);(iii) ∀x∃y (x · y = c) (existence of right inverse).

Show that in this case c is a left unit, i.e. c · x = x. [ Hint: let x′ be theright inverse of x, and y be the right inverse of x′ · x. ]

Page 70: Introduction to Mathematical Logiceprints.renyi.hu/55/1/csirmaz-mathematical-logic.pdf · Introduction to Mathematical Logic L aszl o Csirmaz. 2. Contents

70 CHAPTER 5. PROBLEMS

(i) Give a strict formal Hilbert type derivation for c ·x = x from (i)–(iii)above. Tautologies can be used as axioms.

(ii) What is the set of clauses corresponding to the axioms (i)–(iii) andthe goal formula c · x = x? Find a refutation from this set by theresolution method.

19. Let A ⊂ ω be recursively enumerable. Show that there exists an m ∈ ω,a polynomial p(x) with integer coefficients and m variables so that A =ω ∩ {p(a) : a ∈ ωm} (i.e. A is just the set of non-negative values takenby p).

20. Give a theory T ⊂ F (τ) which is decidable but not enumerable.

21. Find a Σ1 formula ϕ(x) ∈ F (τ0) so that for each natural number n ∈ ω,PA |− ϕ(n), but PA |6− ∀xϕ(x).

22. Find a formula ϕ(x) ∈ F (τ0) such that PA |− ϕ(0)∨ϕ(1), but PA |6− ϕ(0),and PA |6− ϕ(1).

23. For n = 1 the Σn and Πn formulas (of type τ0 ) were defined. In general,for n ≥ 1, ϕ ∈ F (τ0) is

Σn+1 if it is of the form ∃xψ with ψ ∈ Πn;Πn+1 if it is of the form ∀xψ with ψ ∈ Σn.

A subset A ⊂ ωm is Σn ( Πn ) if for some Σn ( Πn ) formula with m freevariables, a ∈ A iff N |= ϕ(a). A subset is ∆n if it is both Σn and Πn.Show that

(i) The Σn, Πn, ∆n subsets are closed under union and intersection, and∆n is closed under taking complements.

(ii) If A ⊂ ωm+1 is Σn then so is

{〈a, u〉 ∈ ωm+1 : (∀v < u) 〈a, v〉 ∈ A}.

(iii) Define the Σ∗n, Π∗n formulas similarly as in the notes. Show that asubset is Σ∗n iff it is Σn.

(iv) The set Satn = {dϕe : ϕ ∈ F (τ0) is Σn and N |= ϕ} is a Σn set.(v) ∆n 6= Σn and ∆n 6= Πn.

(vi) In the following hierarchy every containment is proper:

∆0 ⊂ ∆1 ⊂{

Σ1

Π1

}⊂ ∆2 ⊂

{Σ2

Π2

}⊂ ∆3 . . .

(vii) A subset of ω is arithmetical if it belongs to one of the above families.Show that there is a subset which is not arithmetical. Show that{dϕe : N |= ϕ} is not arithmetical.