* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Introduction to Mathematical Logic
History of the function concept wikipedia , lookup
Peano axioms wikipedia , lookup
Intuitionistic logic wikipedia , lookup
Axiom of reducibility wikipedia , lookup
Law of thought wikipedia , lookup
Mathematical logic wikipedia , lookup
Hyperreal number wikipedia , lookup
Non-standard analysis wikipedia , lookup
Mathematical proof wikipedia , lookup
Naive set theory wikipedia , lookup
Boolean satisfiability problem wikipedia , lookup
Sequent calculus wikipedia , lookup
List of first-order theories wikipedia , lookup
First-order logic wikipedia , lookup
Curry–Howard correspondence wikipedia , lookup
Quasi-set theory wikipedia , lookup
Model theory wikipedia , lookup
Non-standard calculus wikipedia , lookup
Propositional formula wikipedia , lookup
Structure (mathematical logic) wikipedia , lookup
Laws of Form wikipedia , lookup
Introduction to Mathematical Logic László Csirmaz Central European University 2007 2 Contents 1 Introduction 1.1 Propositional Logic . 1.1.1 Syntax . . . . 1.1.2 Compactness 1.2 First-order logic . . . 1.2.1 Structures . . 1.2.2 Syntax . . . . 1.2.3 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 6 6 8 10 10 11 12 2 Model theory 15 2.1 Elementary equivalence . . . . . . . . . . . . . . . . . . . . . . . 15 2.2 The ultraproduct . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.3 Cardinality of Models . . . . . . . . . . . . . . . . . . . . . . . . 21 3 Provability, completeness 3.1 Hilbert-type derivation . . . 3.1.1 Propositional Logic . 3.1.2 First-order Logic . . 3.2 The resolution method . . . 3.2.1 Propositional Logic . 3.2.2 First-order Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 25 26 29 34 34 37 4 Incompleteness 4.1 Pre-amble . . . . . . . . . . . . . 4.2 Diophantine Equations . . . . . . 4.3 Coding . . . . . . . . . . . . . . . 4.4 Undecidability . . . . . . . . . . 4.5 Gödel’s Incompleteness Theorems 4.6 Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 45 50 51 53 60 64 5 . . . . . . . . . . . . Problems 67 3 4 CONTENTS Chapter 1 Introduction By the widely accepted definition logic investigates the laws, and methods of inference and argumentation. Mathematical logic is a mathematical investigation of this subject, similarly as 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 the like. As any other mathematical discipline, mathematical logic also distills its subject from everyday life experience. Then it gives precise definitions – hoping that they have relevance to the real objects –, and proves statements about what have been defined. These statements, or “theorems,” are pulled back to the real life, interpreted, explained, and compared to the expectations, do they confirm 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 help understanding why these are the “right definitions.” Other formal systems have been developed which have – provably – the same expression power, are easier to use, but much harder to prove things about. In this book we consider two kinds of formal systems: propositional logic and first-order logic. Propositional logic attempts to formalize the simplest deductive system, using connectives and, not, and implication. First order logic adds quantifiers to its armory, can speak about functions and relations. It is more powerful than propositional logic, and, in essence, can capture most (mathematical) reasoning. Propositional logic, being the simpler one, serves as a test-bed for several concepts. Quite a few results on propositional logic carry over to first order one with minor changes. Other formal systems are studied as well. Modal logic can handle concepts such as possible or necessary. Higher order logic deals with functional operators directly. Many sorted logic handles universes composed of different sort of 5 6 CHAPTER 1. INTRODUCTION objects such as vectors over a field. 1.1 1.1.1 Propositional Logic Syntax First we define a simple language, called propositional logic, expressing the essence of mathematical reasoning. It goes by defining a strict formal way certain objects which we shall call well-formed propositional formulas, or simply formulas. It goes by defining a language, i.e. a collection of finite sequences of a 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 essential restriction. The other part is the set of logical symbols where we have logical connectives 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 smallest set 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, we regard 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 function f : V → {>, ⊥}. It rises to a valuation of formulas as follows: > if either f (ϕ) = > or f (ψ) = >, f (ϕ ∨ ψ) = ⊥ otherwise, > if f (ϕ) = ⊥, f (¬ϕ) = ⊥ otherwise. Of course, f (ϕ ∧ ψ), f (ϕ → ψ), etc. also have the expected meaning, for example, 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 in sentences where it always evaluates to false. 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 propositional 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. We write Σ |= ϕ 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 out the ∅ 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 each variable in ϕ systematically by a formula, the resulting sentence is also a tautology. 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 operation symbols: the unary ¬ and the binary ∨ (or perhaps with ∧, →, etc.), and generating elements {vα : α < κ}. A valuation is, in fact, a homeomorphism from this algebra into the two-element algebra {>, ⊥} with the obvious interpretation of the operation symbols. A formula is a tautology iff every such homeomorphism sends it into >. One can find easily translations of the other notions introduced so far. Factorizing the algebra by the set of tautologies one gets a (freely generated) Boolean algebra. The properties of this setting can be investigated by algebraic methods, yielding nice, deep and general results, pointing out the basic reason for this or that fact. However, we shall not follow this route, only indicate how to translate back our results into the algebraic setting. 8 CHAPTER 1. INTRODUCTION Lemma 1.7 Suppose the valuations f and g agree on the propositional variables occurring in ϕ. Then f (ϕ) = g(ϕ). Proof By induction on the complexity of the formula ϕ. Since F is freely generated, and every element is uniquely built up, the induction is justified. Lemma 1.8 Given a finite set of sentences Σ, there is an algorithm which decides whether Σ is satisfiable or not. Proof By the previous lemma, the satisfiability of Σ depends only on the variables occurring in some formula of Σ. Since there are only finitely many formulas and 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, thus at most n different variables may occur. Given a valuation of the variables, checking whether all the elements of Σ are true requires time proportional to a polynomial of n, thus the total time is somewhere around 2n . One cannot hope a 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 the nonempty set X. Definition 1.9 (i) F has the finite intersection property, FIP in short, if the intersection 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 of F; (b) if A ∈ F and A ⊂ B ⊂ X then B ∈ F; finally (c) if A and B are in F then so is A ∩ B. (iii) F is an ultrafilter if it is a filter, moreover for each A ⊂ X, either A ∈ F or X − A ∈ F. Given a set X, the family of all subsets containing a particular element a ∈ 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 ultrafilters on X are trivial; on infinite sets there are non-trivial ultrafilters as well. Filters have 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 let fa : V → {>, ⊥} be a valuation which validates a. For ϕ ∈ Σ let Aϕ = {a ∈ A : ϕ ∈ a}. Of course, fa (ϕ) = > whenever a ∈ Aϕ . The collection of the subsets 1.1. PROPOSITIONAL LOGIC 9 {Aϕ : ϕ ∈ Σ} has the finite intersection property, thus there is an ultrafilter U over A containing all of them. Define f : V → {>, ⊥} as follows. For v ∈ V let f (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 some finite Σ0 ⊂ Σ we have Σ0 |= ϕ. Proof We know that Σ |= ϕ iff Σ ∪ {¬ϕ} is not satisfiable. So if Σ0 |6= ϕ then each finite subset of Σ ∪ {¬ϕ} is satisfiable, contradicting the previous theorem. The compactness theorem is a special case of the following general algebraic theorem. To state it, we need some definitions. Let B be a Boolean algebra. A subset 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, is not 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 so that 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 an ultrafilter. Given the Boolean algebra B, the Stone-space S of B consists of all ultrafilters 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 the theorem above is equivalent to saying that this space is compact. This is why this theorem is called “compactness theorem”. 10 1.2 1.2.1 CHAPTER 1. INTRODUCTION First-order logic Structures The propositional logic cannot capture such properties as “for each natural number there exists a larger one which is prime.” To do so, we need something stronger, and the most successful tool so far is the so-called first-order logic. It deals with certain objects called structures, and has a special language designed to describe properties of structures. Definition 2.1 By a similarity type, or signature, or simply type, we mean a collection of constant, relation, and function symbols with their fixed arities. Types are usually denoted by τ . The cardinality of τ , denoted by |τ | , is the cardinality of its symbols. Whenever we define a type we usually list the symbols only; their sorts and arities are determined by the context. For example, h0, 1, ≤, +, ·i is a type, here 0 and 1 are constant symbols, ≤ is a binary relation symbol, + and · are binary function symbols. Definition 2.2 For a given type τ , a τ -type structure A consists of a non-empty set (the ground set or underlying set) A, together with the interpretation of the symbols in τ . For each constant symbol c ∈ τ , its interpretation cA is an element of A; for an n-place relation symbol r ∈ τ , rA is a subset of An (i.e. rA is an n-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 the same type, the same underlying set (i.e. A = B), and for each symbol the corresponding interpretations are the same. If τ 0 is got from τ by canceling some of its symbols, then we write τ 0 ⊂ τ . From each τ -type structure A, a τ 0 -type structure A0 can be made by deleting the symbols not in τ 0 ; the resulted A0 is the τ 0 -type reduct of A, denoted by A τ 0 . Of course, it may happen that A τ 0 = B τ 0 while A 6= B. Fixing the type τ , if not stated otherwise, all structures 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 and cA = cB for each constant symbol c ∈ τ , rA = rB An for each n-place relation symbol 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 the smallest B ⊂ A with X ⊂ B. Claim 2.5 The intersection of substructures is also a substructure (if not empty), 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|, |τ |, ω). 1.2. FIRST-ORDER LOGIC 11 Proof Let X0 = X ∪ {cA : c is a constant symbol in τ }, and for n ∈ ω put Xn+1 = Xn ∪ {fA00 Xn : f ∈ τ is a function symbol } whereSfA00 Xx is the image of Xn under the function fA . It is easy to see that B = {Xn : n ∈ ω}, and it has the desired property. Definition 2.7 The structures A and B are isomorphic if there is a 1–1 onto function 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 historical reasons, 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 existential quantifier ∃, countably many (individual) variable symbols denoted as x0 , x1 , . . ., also as y, z, etc. (The individual variables should not to be confused with the propositional variables.) Beside logical symbols the alphabet contains the symbols 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 satisfying (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 }. S 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 = e1 with e0 , e1 ∈ E(τ ); and r(e0 , . . . , en−1 ) for each n-place relation symbol r ∈ τ and expressions e0 , . . . , en−1 ∈ E(τ ). 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 (individual) variable symbol. Claim 2.12 |F (τ )| = |τ | · ω . Proof It is not hard to find |τ | · ω many different elements in F (τ ), so the claim reduces to F (τ ) ≤ |τ | · ω. This can be proved exactly the same way as claim 2.9 was proved for expressions. Lemma 2.13 (Unique Readability Lemma) For each ϕ ∈ F (τ ) there is a unique 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 at the first glance. As in the case of propositional formulas, we also introduce the abbreviations seen there, including ⊥ to denote the identically false formula, and moreover we write ∀x ϕ instead of ¬ ∃ ¬ϕ . A formula ϕ ∈ F (τ ), being finite, may contain finitely many variables only. The free 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 free or bound respectively depending on whether it is disregarded in the recursive procedure 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 v which 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 variable symbol x, where it takes the value a ∈ A. Definition 2.15 For an expression e ∈ E(τ ) and a valuation v over the τ -type structure A, we define eA [v] ∈ A, the value of e, as the value of the expression when the “values” of the variable symbols are given by v. 1.2. FIRST-ORDER LOGIC 13 Definition 2.16 For ϕ ∈ F (τ ) we define A |= ϕ[v], to be read as “ϕ is true in A under valuation v” as follows: (i) A |= (e = e0 )[v] if eA [v] = e0A [v] ; (ii) A |= r(e0 , . . . , en−1 )[v] if h(e0 )A [v], . . . , (en−1 )A [v]i ∈ 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 say that 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 (ϕ) then v0 (x) = v1 (x). Then A |= ϕ[v0 ] iff A |= ϕ[v1 ] . Lemma 2.20 Let ϕ be the universal closure of ϕ ∈ F (τ ). Then A |= ϕ iff A |= ϕ. 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 for some τ -type structure A, A |= Σ; otherwise Σ is inconsistent. Obviously, if Σ is inconsistent, then Σ |= ϕ for any ϕ ∈ F (τ ), and is consistent iff Σ |6= ⊥. The notion of “semantical consequence” is, in some sense, a precise mathematical notion which captures the vague idea of “consequence.” Later we shall define the notion of “proof,” which, of course, is some collection of transformation rules applicable to those sequences of symbols which are formulas. Whenever applying these transformations sufficiently many times, we can arrive at a certain formula, then we say that the formula was derived. These rules must preserve the truth, i.e. if Σ is consistent, then no contradiction should be derived from it. The famous Gödel’s Completeness Theorem says that choosing the transformation rules appropriately, the converse will also be true, i.e. if no contradiction can be derived from the set Σ then Σ must be consistent. We shall prove this theorem later. 14 CHAPTER 1. INTRODUCTION Chapter 2 Model theory 2.1 Elementary equivalence Lemma 1.1 Suppose the τ -type structures A and B are isomorphic. Then for each ϕ ∈ 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, f v is a valuation over B, and A |= ϕ[v] iff B |= ϕ[f v]. Definition 1.2 The τ -type structures A and B are elementarily equivalent if for each ϕ ∈ F (τ ) , A |= ϕ iff B |= ϕ. Definition 1.3 A is an elementary substructure of B, or B is an elementary extension 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 for some 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 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 the theorem, 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 Löwenheim–Skolem Theorem) Let κ be a cardinal so that κ ≥ |τ | · ω, A be a structure, X ⊂ A, |X| = κ. Then there exists a B ≺ A so that X ⊂ B and |B| = κ. Proof Let ψ(x0 , . . . , xn−1 , z) ∈ F (τ ). The function f : An → A is a Skolemfunction for the formula ∃z ψ, if for every a0 , . . . , an−1 ∈ A, A |= (∃z ψ)[x0 /a0 , . . . , xn−1 /an−1 ] implies A |= ψ[x0 /a0 , . . . , xn−1 /an−1, z/f (a0 , . . . , an−1 )]. That is, for any n-tuple ha0 , . . . , an−1 i, the function f picks a value which makes ψ true provided that such a value exists. By the Axiom of Choice we have a well-ordering < on A; the following function is a Skolem-function for ∃z ψ: min {a ∈ A : A |= ψ[x0 /a0 , . . . , xn−1 /an−1 , z/a]}, < if this set is not empty; f (a0 , . . . , an−1 ) = 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 increasing sequence 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 , and fϕ is one of the fixed Skolem-functions }. Of course, |Xi+1 | =Sκ, 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–Vaught Criterion 1.4, let v be a valuation over B (the smaller structure), and suppose A |= (∃z ψ)[v]. If x0 , . . . , xn−1 are the free variables of ∃z ψ, then for some i ∈ ω, 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. 2.2. THE ULTRAPRODUCT 17 The following consequence of the above theorem is often called Skolemparadox: Corollary 1.6 Let T ⊂ F (τ ). If T is consistent, i.e. has a model, then it has a model of cardinality at most |τ | · ω. For example, if the axiom system of set theory is consistent, then this axiom system has a countable model, too. However, we can prove in set theory, that there must be a set with cardinality exceeding that of the natural numbers. In a countable model there is no room for an uncountable set, and this apparent contradiction 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 can be 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 which axiomatizes K, namely the conjunct of the (closure of the) elements of Σ. In this case the complement of K, i.e. the class of all τ -type structures not belonging to K, is also (finitely) axiomatizable. Theorem 1.8 If K is an axiomatizable class then it contains an element with cardinality ≤ |τ | · ω. Proof It is an immediate consequence of the Downward Löwenheim–Skolem Theorem 1.5. The following classes are elementary: ordered sets, partially ordered sets, groups, Abelian groups, rings, fields, (abstract) vector spaces (with a bit of hocus-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 τQ -type structure for each i ∈ I where I is an index set. The direct product B = {Ai : i ∈ I} is again a τ -type structure defined as follows. Its ground set is Y 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. For a constant symbol c ∈ τ , cB ∈ B is the element with cB (i) = cAi ; for a function symbol f ∈ τ and a0 , . . . , an−1 ∈ B fB (a0 , . . . , an−1 ) (i) = fAi a0 (i), . . . , an−1 (i) , 18 CHAPTER 2. MODEL THEORY which means that f is defined coordinatewise. Finally for an n-place relation symbol r ∈ τ , ha0 , . . . , an−1 i ∈ rB iff for all i ∈ I we have ha0 (i), . . . , an−1 (i)i ∈ rAi . Q 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 have vi (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 over B. 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 for i ∈ 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 class containing a. Q Definition 2.5 The ultraproduct A = {Ai : i ∈ I}/U is the following structure: (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, ha0 , . . . , an−1 i ∈ rA iff {i ∈ I : ha0 (i), . . . , an−1 (i)i ∈ rAi } ∈ U. Lemma 2.6 This is a sound definition. Proof We have to check that the definitions in (iii) and (iv) are independent of the choice of the representative elements a0 , ..., an−1 , that is, if aj ∼ bj for all j < n, then fB (a0 , . . . , an−1 ) ∼ fB (b0 , . . . , bn−1 ), (2.1) and ra = {i ∈ I : ha0 (i), . . . , an−1 (i)i ∈ rAi } ∈ U iff rb ∈ U. (2.2) Well, aj ∼ bj means {i ∈ I : aj (i) = bj (i)} ∈ U , thus taking the intersection of these sets in U , we get an X ∈ U so that i ∈ X implies aj (i) = bj (i) for all j < n. This yields (2.1). And since ra ∩ X = rb ∩ X, if, say, ra is in U , then so is the intersection ra ∩ X = rb ∩ X, and then rb is in U , too. This proves (2.2). 2.2. THE ULTRAPRODUCT 19 Lemma 2.7 Every valuation over A can be written as v, where v is a valuation over B and v(x) = v(x) for each variable symbol x. Theorem 2.8 (Loś Lemma) For every valuation v over B, and formula ϕ ∈ F (τ ), Y Ai /U |= ϕ[v] iff {i ∈ I : Ai |= ϕ[vi ]} ∈ U. Proof First let e ∈ E(τ ) be an expression, then eA [v] = eB [v] (this follows easily from the definition), moreover eB [v] (i) = eAi [vi ] (this was Lemma 2.3). Now let ϕ be a prime formula. If ϕ is e = e0 with e, e0 ∈ E(τ ) then A |= (e = e0 )[v] iff eA [v] = e0A [v] iff eB [v] = e0B [v] iff {i ∈ I : eAi [vi ] = e0Ai [vi ]} ∈ U iff {i ∈ I : Ai |= e = e0 [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 he0 [v], . . . , en−1 [v]i ∈ rA iff {i ∈ I : he0 [vi ], . . . , en−1 [vi ]i ∈ rAi } ∈ U iff {i ∈ I : Ai |= r(e0 , . . . , en−1 )[vi ]} ∈ U. This proves the theorem for prime formulas. Next we go by induction on the complexity 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 induction hypothesis, iff either Iϕ ∈ U or Iψ ∈ U . Now U is an ultrafilter, thus this happens 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 . Since I¬ϕ = 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)]. By the 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 witnessing Ai |= (∃x ϕ)[vi ], and if no such a b(i) exists, then let b(i) be an arbitrary element of 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. 20 CHAPTER 2. MODEL THEORY Theorem 2.9 (Loś Lemma, second form) For each formula ϕ ∈ F (τ ), U |= ϕ iff {i ∈ I : Ai |= ϕ} ∈ U . Q Ai / Proof If {i ∈ I : Ai |= ϕ} ∈ U then for all valuations v over A we have {i Q ∈ I : Ai |= ϕ[vi ]} ∈ U since it extends the previous set. So by Loś Lemma, Ai /U |= ϕ[v]. Conversely, if Ai |6= ϕQthen 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 Q Q thus Ai /U |= (¬ϕ)[v], therefore Ai /U |6= ϕ. Corollary 2.10 An elementary class is closed under ultraproducts. Theorem 2.11 (Gödel’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 finite subsets of Σ. By assumption, for each i ∈ I we have a τ -type structure Ai which is a model of i. Let U be an Q 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 . From here Loś Lemma then gives A |= ϕ, as required. Theorem 2.12 (J. Keisler) Let K be any class of τ -type structures. K is elementary 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. Otherwise i = {ϕ0 , . . . , ϕn−1 } and A |= ¬ϕ0 ∨ . . . ∨ ¬ϕn−1 for all A ∈ K, from where B |= ¬ϕ0 ∨ . . . ∨ ¬ϕn−1 , contradicting B |= i. Let U be an ultrafilter on I containing all the sets {i ∈ I : ϕ ∈ i} where {ϕ} ∈ I. By assumption, Q 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. 2.3. CARDINALITY OF MODELS 21 Theorem 2.13 The class K is finitely axiomatizable if and only if both K and its complement are elementary. Proof The condition is obviously necessary. To show the converse, suppose on the contrary that K is axiomatized by Σ ⊂ F (τ ), but by no finite set of formulas. 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. However, i being finite, does not axiomatize K, therefore there is a τ -type structure Ai in the complement of K with Ai |= i. As above, let U be an ultrafilter on I containing {i ∈ I : ϕ ∈ i} for all Q ϕ ∈ Σ. Since the complement of K is also closed 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 Löwenheim–Skolem Theorem) Suppose the theory Σ ⊂ F (τ ) has an infinite model. Then for each cardinal κ, Σ has a model of cardinality ≥ κ. Proof Let {cξ : ξ < κ} be brand new constant symbols, and expand the type τ with these symbols to τ 0 = τ ∪ {cξ : ξ < κ}. Consider the following theory: def Σ0 = Σ ∪ {cξ 6= cη : ξ < η < κ}. Since in any model of Σ0 the interpretations of the constants cξ must differ, the model will have cardinality ≥ κ. So we are home if we know that Σ0 is consistent. To prove this, we use the Compactness Theorem 2.11. Let A be an infinite model for Σ, and let ∆ be a finite subset of Σ0 . Then there is a finite subset I ⊂ κ so that def ∆ ⊂ Σ ∪ {cξ 6= cη : ξ, η ∈ I, ξ < η} = ∆0 . Interpret cξ for ξ ∈ I as different elements of A (since A was assumed to be infinite, this can be done), and interpret the remaining constants cξ with ξ ∈ /I arbitrarily. This expanded structure A0 is evidently a model of ∆0 , so of ∆, and then Σ0 is consistent. Instead of using the Compactness Theorem 2.11, we can arrive to the statement of this theorem using an appropriately chosen ultrapower of an infinite model. 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 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-th coordinate of our vectors so that vα1 (i), . . . , vαn (i) be all different elements from 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 ultrafilter U on κ the cardinality of the ultrapower κ A / U is at least κ. For a stronger statement see Problem 4. Given the structure A of type τ , pick a new constant symbol ca for each element a ∈ A, and let τA = τ ∪ {ca : a ∈ A}. Expand A into a τA -type structure A0 by interpreting ca as a ∈ A. Definition 3.2 The (complete) diagram of the structure A is the set of formulas def ∆A = {ϕ ∈ F (τA ) : ϕ is closed, and A0 |= ϕ}. Lemma 3.3 A can be embedded elementarily into the τ -type reduct of the models of its complete diagram. Proof Let B be a model of ∆A . For a ∈ A, let f (a) ∈ B be the interpretation of the constant symbol ca in B. First, f is an isomorphism between A0 and its image A∗ . For example, let r ∈ τ be an n-place relation symbol, we have to show that ha0 , . . . , an−1 i ∈ rA iff hf (a0 ), . . . , f (an−1 )i ∈ rB . But the first holds iff A0 |= 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∗ and formula ϕ(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 the same reason, this latter holds iff B |= ϕ(ca0 , . . . , can−1 ) iff B |= ϕ[v]. Thus A∗ is an elementary substructure of B, consequently A∗ τ is an elementary substructure of B τ , as was claimed. 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 reduct of the models of ∆A so that the image of A coincides with the interpretation of the constant symbols {ca : a ∈ A}. Therefore to prove the theorem it suffices to construct a model of ∆A with an extra element. To this end let c be a new constant symbol, and put def Σ = ∆A ∪ {c 6= ca : a ∈ A}. If this set of formulas is consistent, we are done. Now let Σ0 ⊂ Σ be finite. Then there is a finite subset D ⊂ A so that Σ0 ⊂ ∆A ∪ {c 6= ca : a ∈ D}. Interpret c in A as an element not in D (by assumption A is infinite, so A − D is not empty). With this we get a model of Σ0 , as required. Proof (Another proof for the same theorem) Let U be a non trivial ultrafilter on ω, and let B = ω A / U , the ultrapower of A. Now A can be embedded elementarily into B as follows. For each a ∈ A, define the function fa : ω → A by 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 indeed an elementary embedding. The theorem follows if we can show that B has an element not in the range of the embedding. By assumption, A is infinite, let ai ∈ 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 elementary S submodels, 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 formula since Aξ is a substructure of A. Also the cases ϕ∨ψ and ¬ϕ are easy. So suppose the 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 hypothesis for ψ, A |= ψ[a0 , . . . , an−1 , b], that is A |= ∃z ψ[a0 , . . . , an−1 ]. Conversely, if A |= ∃z ψ[. . .] then for some b ∈ A, A |= ψ[a0 , . . . , an−1 , b]. Since b ∈ Aη for some ξ < η < µ, by the induction hypothesis we have Aη |= ψ[a0 , . . . , an−1 , b], i.e. Aη |= ∃z ψ[. . .]. Now applying the assumption Aξ ≺ Aη we arrive at Aξ |= ∃z ψ[. . .], as was claimed. 24 CHAPTER 2. MODEL THEORY Now we give another proof for the Upward Löwenheim–Skolem Theorem 3.1. Proof (Upward Löwenheim–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ξ = S {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 an elementary extension of A ( = A0 ), and [ [ |B| = | {Aξ : ξ < κ}| = |A0 ∪ {Aξ+1 − Aξ : ξ < κ}| ≥ κ, since here we have κ many disjoint nonempty sets here. Corollary 3.6 (Löwenheim–Skolem Theorem) Suppose that the theory Σ ⊂ F (τ ) has an infinite model. Then for each κ ≥ |τ | · ω, Σ has a model of cardinality exactly κ. Proof Apply first the Upward Löwenheim–Skolem Theorem 3.1, and then the Downward one 1.5. Chapter 3 Provability, completeness By “proving a statement” we mean a procedure which convinces everybody about the truth of the statement. Moreover, a proof always deals with the form and not the content (so absolutely meaningless sentences can be accepted as formally correct reasoning). A proof system is a collection of syntactical rules applicable to formulas – as finite sequences of symbols –, which system tells whether a formula is a consequence of, or derivable from, a set of other P formulas. For a proof system P , Σ ` ϕ denotes that ϕ is derivable from Σ by the rules of P . When P is understood, it is omitted. If Σ is the empty set, it P is also left out. On the left hand side of the ` sign We write Σ, ∆ instead of P Σ ∪ ∆, and curly brackets are also omitted. Thus, for example, Σ, ψ0 , ψ1 ` ϕ P P P means Σ ∪ {ψ0 , ψ1 } ` ϕ. For a set ∆ of formulas Σ ` ∆ means Σ ` ϕ for all ϕ ∈ ∆. The definition below works for both propositional and first-order formulas equally. Definition 0.1 A proof system P is P (i) sound if Σ ` ϕ implies Σ |= ϕ ; P (ii) weakly complete if |= ϕ implies ` ϕ ; and P (iii) strongly complete if Σ |= ϕ implies Σ ` ϕ 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 system 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 (partial) function which assigns a formula, the conclusion, to a finite set of formulas called 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 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 ends with ϕ. (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 Σ0 ⊂ Σ we have Σ0 |− ϕ; (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) and sound proof system. For the Propositional Logic such a system was found first by Russel and Whitehead (or at least proved to be complete), and for the firstorder case it is due to K. Gödel. 3.1.1 Propositional Logic Let V = {Vξ : ξ < κ} be the set of propositional variables, and denote by F the set of propositional sentences. The inference rules are the instances of the following 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 list the axioms, instead introduce them where they appear, and we let the reader check that all axioms are tautologies indeed. Our axioms do not form neither a nice, 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 member of Σ ∪ {ψ}, or (iii) the conclusion of a MP. (i) In this case |− ϕ, so also Σ |− ϕ. Now introducing the axiom 3.1. HILBERT-TYPE DERIVATION 27 Ax1 ϕ → (ψ → ϕ) (that is, every instance of this scheme is an ϕ as follows: ϕ ϕ → (ψ → ϕ) ψ→ϕ axiom), we can derive ψ → ϕ from 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 Σ |− ψ → (ϑ → ϕ). From here two applications of the MP for the axiom Ax3 (ψ → (ϑ → ϕ)) → ((ψ → ϑ) → (ψ → ϕ)) gives Σ |− ψ → ϕ, as required. The following lemma formalizes the following proof technique: assume that the statement to be proved is false and derive a contradiction. Lemma 1.4 Σ, ¬ϕ |− ⊥ iff Σ |− ϕ. Proof =⇒ By the Deduction Lemma 1.3 we have Σ |− ¬ϕ → ⊥. Then apply the 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 sentences in Σ, then it assigns > to every sentence derived from Σ as well. Thus ⊥ cannot be 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− ⊥. So without loss of generality, we may assume that Σ is maximal, i.e. ϕ ∈ F is not in Σ just in case Σ, ϕ |− ⊥. Maximality also implies that ϕ ∈ Σ whenever Σ |− ϕ. 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 the other hand suppose ¬ϕ ∈ / Σ. Then by maximality Σ, ¬ϕ |− ⊥, from here Lemma 1.4 gives Σ |− ϕ, which implies ϕ ∈ Σ. Define the valuation f : V → {>, ⊥} as follows: let f (v) = > if v ∈ Σ, and f (v) = ⊥ if ¬v ∈ Σ. As propositional variables are formulas as well, Claim 1.6 justifies 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 propositional variables 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 induction hypothesis, i.e. f (¬ϕ) = ⊥, as required. Next suppose the claim for ϕ and ψ. If either ϕ or ψ is in Σ, then using one of the axioms Ax6 ϕ → (ϕ ∨ ψ) Ax7 ψ → (ϕ ∨ ψ) we get ϕ ∨ ψ ∈ Σ, moreover f (ϕ ∨ ψ) = >. If neither ϕ nor ψ is in Σ, then Claim 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 is equivalent to Σ, ¬ϕ |− ⊥, and by Lemma 1.4, to Σ |− ϕ. Axioms Ax1–Ax8 can, in fact, be derived (using MP) from the following simpler set of formulas: ϕ ∨ ϕ → ϕ , ϕ → ϕ ∨ ψ , ϕ ∨ ψ → ψ ∨ ϕ , (ϕ → ψ) → (ϑ ∨ ϕ → ϑ ∨ ψ). By transitivity, they would form a sufficient set of axioms as well as our original set does. 3.1. HILBERT-TYPE DERIVATION 3.1.2 29 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 formula got from ϕ by replacing each free occurrence of x by e. Such a substitution may change completely the meaning of the formula. For example, the formula def ϕ(x) = ∃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 the substitution no variable in e becomes bounded (as y did in the example). The next lemma says that in these cases replacing syntactically x by e first and then evaluating the formula ϕ(x/e) has the same effect as replacing first the value of x by the value of e and then evaluating ϕ. Lemma 1.9 (Substitution Lemma) Let A be a τ -type structure and v be a valuation 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. the same formulas but with ϕ, ψ, ϑ ∈ F (τ )). Later on we shall introduce more axioms. Observe that so far if ϕ is any instance of the axioms, then |= ϕ. As inference rule we also have the modus ponens MP and generalization G ϕ → ψ, ϕ ψ ϕ ∀x ϕ Since {ϕ} |= ∀x ϕ (but, in general, |6= ϕ → ∀x ϕ ), at least so far, our proof system is sound. A formula ϕ ∈ F (τ ) is a tautology if there is a tautological propositional formula ϕ b ∈ F so that ϕ is the result when the propositional variables in ϕ b are replaced systematically by appropriate first-order formulas. Since every propositional 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 is that in a derivation we can use tautologies freely. Such “extended” derivations can be straightened into a complete derivation. Lemma 1.11 (Syntactical Deduction Lemma) Suppose ψ ∈ F (τ ) is closed. Then Σ, ψ |− ϕ iff Σ |− ψ → ϕ. 30 CHAPTER 3. PROVABILITY, COMPLETENESS Proof The ⇐= part is trivial. The converse can be proved the same way as was done for propositional logic, the only case not treated there is when the last formula of the derivation is got by the inference rule G. So the lemma follows if we 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 appear in 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 universal quantifiers 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, then it is syntactically consistent. Similarly to the propositional case, syntactically consistent theories can be extended into a maximal one (using again Zorn’s Lemma). From the Deduction Lemma 1.11 (and Propositional Logic – Lemma 1.10) we get the analog of Claim 1.6: Lemma Then (i) for (ii) for (iii) for 1.13 Suppose Σ ⊂ F (τ ) is a maximal syntactically consistent theory. every ϕ ∈ F (τ ), Σ |− ϕ iff ϕ ∈ Σ; closed ϕ ∈ F (τ ) exactly one of ϕ and ¬ϕ is in Σ; 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 Σ |− ϕ by Propositional 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) ∈ Σ. 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 Henkin theory. 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 constant symbols 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. This is shown by the derivation x=x ∀x (x = x) ∀x (x = x) → (c = c) c=c axiom Ex1 generalization instance of Ax10 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 as axioms, 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 = {c0 ∈ τ : Σ |− c = c0 } 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; hc0 , . . . , cn−1 i ∈ rA iff Σ |− r(c0 , . . . , cn−1 ). By Ex2 and Ex3 (and by Propositional Logic), these definitions do not depend on the particular choice of the representative elements of the equivalence classes. 32 CHAPTER 3. PROVABILITY, COMPLETENESS The only thing we have to show is that fA is defined for all tuples. To this end let e ∈ E(τ ) be the expression f (c0 , ..., cn−1 ), and ϕ(x) ∈ F (τ ) be the formula f (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 same formula. 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 defined on the n-tuple hc0 , . . . , cn−1 i. We claim that the structure A constructed this way is a model for Σ. By Lemma 1.12 if something is in Σ then its universal closure is also in Σ, moreover a formula is true in A just in case its universal closure is true. Thus it suffices to check the equivalence A |= ϕ iff Σ |− ϕ. for closed formulas only. It is true for prime formulas by definition and by the Equality Axioms. Now A |= ¬ϕ iff A |6= ϕ (since ϕ is closed) iff Σ |6− ϕ by induction. Lemma 1.13 (ii) gives that this is iff Σ |− ¬ϕ, as required. The formula ϕ ∨ ψ can be handled similarly using (iii) of Lemma 1.13, so the only missing 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 v over A, so A |= ∃x ϕ. Conversely, if A |= ∃x ϕ[v] for some valuation, then there is a constant symbol 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). From here Σ |− ϕ(c) by induction, and then Σ |− ∃x ϕ(x) by Ax11, as required. Theorem 1.16 (Gödel’s First Completeness Theorem) If Σ is syntactically consistent then it is consistent, i.e. there is a model for Σ. Proof By the previous Theorem, it is enough to embed Σ into a maximal syntactically consistent Henkin theory. So let κ = |τ | · ω, and pick κ many new constant symbols {cξ : ξ < κ}. Let τ 0 = τ ∪ {cξ : ξ < κ}, and let {ϕξ : ξ < κ} be an enumeration of formulas in F (τ 0 ). (This set has cardinalitySκ.) Now let us define the sets Σξ ⊂ F (τ 0 ) for ξ ≤ κ as follows. Σ0 = Σ, Σξ = {Ση : η < ξ} if ξ is a limit. To define Σξ+1 work as follows. Let ϕξ ∈ f (τ 0 ) be the ξ-th element from the enumeration. If Σξ ∪ {ϕξ } is contradictory, then put Σξ+1 = Σξ . If Σξ ∪ {ϕξ } is syntactically consistent, but either ϕξ is not closed, or it is not of the form ∃x ψξ (x) for some ψξ (x) ∈ F (τ 0 ), then Σξ+1 = Σξ ∪ {ϕξ }. In every other 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 so far), say cν , and let Σξ+1 be Σξ ∪ {ϕξ , ψξ (cν )}. 3.1. HILBERT-TYPE DERIVATION 33 Next we claim that each Σξ is syntactically consistent. This is true by assumption for ξ = 0, and it follows for limit ξ by compactness. For successor ordinals it is in doubt only in the case of Σξ+1 = Σξ ∪ {ϕξ , ψξ (cν )}. For simplicity, we leave out the indices. So suppose, Σ ∪ {ϕ, ψ(c)} is contradictory. ψ(c) is closed, thus by the Deduction Lemma 1.11 (and by Propositional Logic) we have Σ, ϕ |− ¬ψ(c). By the choice of the constant symbol c, it does not occur on 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, thus there are only finitely many variable symbols in those formulas. Pick a variable symbol which does not occur at all in the derivation, let it be y, and replace the symbol c in everywhere in the derivation by y. The resulting sequence of formulas will be a correct derivation from Σ ∪ {ϕ}. Elements of Σ ∪ {ϕ} remain unchanged (as the symbol c does not occur in them), and both MP and G are invariant under this change. Finally axioms go into axioms. This is clear for Ax1–Ax8 and Ex1–Ex3. For axioms Ax9–Ax11 one has to check that the appropriate conditions remain valid after the substitution (this is the reason why we cannot require ψ to be a closed formula on Ax9). The substituted derivation ends in ¬ψ(y), thus Σ, ϕ |− ¬ψ(y). By generalization Σ, ϕ |− ∀y ¬ψ(y). Now ψ(y/x) is a correct substitution, thus Ax10 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 a maximal Henkin theory. Maximality: if ϕξ ∈ F (τ 0 ) is not in Γ, then it is so because Σξ ∪ {ϕξ } is contradictory, and then so is Γ ∪ {ϕξ }. Finally assume ∃x ψ(x) is closed and is in Γ. This formula appears in the enumeration, say as ϕξ . ϕξ is closed, and Σξ ∪ {ϕξ } is consistent, thus by the construction, ψ(cν ) ∈ Σξ+1 ⊂ Γ for some constant symbol cν . Theorem 1.17 (Gödel’s Second Completeness Theorem) The Hilbert type derivation 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 by Lemma 1.12. Now if Σ |6− ϕ then, by the Deduction Lemma 1.11, Σ ∪ {¬ϕ} is syntactically consistent, so by the First Completeness Theorem it has a model A: A |= Σ and A |6= ϕ, showing Σ |6= ϕ. 34 3.2 CHAPTER 3. PROVABILITY, COMPLETENESS The resolution method Here we present an alternative proof system which is more adequate for computers than the Hilbert-type derivation. This so-called resolution method works not on the formulas but on a certain normalized form which we shall describe in turn. 3.2.1 Propositional Logic As before, let V = {vξ : ξ < κ} be the set of propositional variables, and F be the 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 00 Σ = {>}. This yields strong completeness immediately, since Σ |= ϕ iff Σ ∪ {¬ϕ} is refutable. So let us given the set Σ ⊂ F . First, transform every element of Σ into conjunctive 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 until applicable, after that Step 2 until applicable, finally Step 3, also until it can be applied. 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 propositional variable. Step 2 disregards repeated applications of negation; finally Step 3 ends only if the formula is conjunctions of disjunctions of propositional variables, 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. 3.2. THE RESOLUTION METHOD 35 We may assume that all elements of Σ are in conjunctive normal form. In the next step we split the conjunctions into their constituents by applying the following 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 makes every element of Σ valid. Since a disjunction is valid iff some of its member is valid, 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 resolution method. Definition 2.5 A literal is either a proposition variable or its negation; and a clause 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 ∈ C valid. As there is no element in the empty clause, no literal in can be true in any 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 propositional 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 def R(c0 , c1 , `) = (c0 − {`}) ∪ (c1 − {¬`}). c is the one step resolvent of C if either c ∈ C, or there are c0, c1 ∈ C such that c = 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 valuation f : V → {>, ⊥} makes valid at least one literal in each member of C. Then some 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. 36 CHAPTER 3. PROVABILITY, COMPLETENESS Definition 2.10 (Resolution Method) Let C be a set of clauses, and c be a R clause. c is derivable from C by the resolution method, denoted as C ` c, if there is a sequence of clauses c0 , c1 , . . . , cn−1 ending with cn−1 = c so that each ci 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-element R clause. Suppose that the clause c differs from {`}, and C, {`} ` c. Then either R R C ` c, or C ` c ∪ {¬`}. Proof Suppose ci ⊂ c0i ⊂ ci ∪ {¬`} for i = 0, 1, and let c2 = R(c0 , c1 , k), and c02 = R(c00 , c01 , k). Then c2 ⊂ c02 ⊂ c2 ∪ {¬`}. Moreover if c0 is the one element clause {`}, then k must be the same literal as `, and c2 = c1 − {¬`}, thus c1 ⊂ c02 ⊂ c1 ∪ {¬`}. Similarly, if c1 is {`}, then the k is ¬`, c2 = c0 − {`}, thus c0 ⊂ c02 ⊂ c0 ∪ {¬`}. From here it follows by induction that for every clause c derivable from C, {`} there exists a clause c0 derivable from C such that c ⊂ c0 ⊂ c ∪ {¬`}. Theorem 2.12 (Strong Completeness of Resolution Method) C is refutable iff R C ` . Proof ⇐= We have seen this in Claim 2.6. R =⇒ Suppose C 6` . Then C can be extended into a maximal set of clauses so that the empty clause is still not derivable (using Zorn’s lemma). So we can assume that C is maximal. Then for each literal `, exactly one of the one-element clauses {`} and {¬`} is in C. Indeed, we cannot have both of them in C, otherwise the single resolution step R({`}, {¬`}, `) = would derive the empty clause immediately. So suppose that the clause {`} is not in C. Then by the maximality of C, from C, {`} we can derive the empty R R clause . Then by the Deduction Lemma 2.11, either C ` , or C ` {¬`}. By assumption the first case cannot hold, thus {¬`} ∈ C, as was needed. Define the valuation f : V → {>, ⊥} as follows. Let f (v) = > if the single element 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 = c0 ∪ {`} 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, {¬`}, `) = c0 , thus c0 ∈ C. c0 has one member less than c, so by induction there is a true member in c0 . Consequently C is satisfiable, i.e. not refutable. 3.2. THE RESOLUTION METHOD 3.2.2 37 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 |= Σ. As in the previous section, we perform a set of transformations on Σ which preserve consistency (or, rather, inconsistency). The resolution method will work on the “preprocessed” formulas. In this section the universal quantifier ∀ is treated as a basic (and not as a derived) symbol. • The first transformation converts the elements of Σ into prenex normal form by performing the following steps on elements of Σ until any of them is applicable: 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 replace the subformula by Qy (ψ ∨ ϑ(x/y)). If neither of these steps is applicable any more then the formula has the form Q0 x0 Q1 x1 . . . Qn−1 xn−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, both Step 1 and Step2 result in equivalent formulas. From here the lemma follows by induction. • The second transformation discards the equality symbol from Σ. Let E be a new binary symbol not in τ , and let τ 0 = τ ∪ {E}. Replace each occurrence of the equality sign by E, i.e. put E(e0 , e1 ) in place of e0 = e1 everywhere, and add 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 Σ0 ⊂ F (τ 0 ) the set of formulas got in this way. Σ0 still consists of prenex formulas, moreover Claim 2.15 Σ is consistent if and only if Σ0 is consistent. 38 CHAPTER 3. PROVABILITY, COMPLETENESS Proof =⇒ Suppose A |= Σ for some τ -type structure A. Expand A intro a τ 0 -type structure A0 interpreting E as identity, i.e. for a, b ∈ A, ha, bi ∈ EA iff a = b. Obviously every formula of Σ0 holds on A0 , thus Σ0 is consistent as well. ⇐= Let A be a model of Σ0 . By the formulas in (i) EA is an equivalence relation. For a ∈ A let a be its equivalence class: a = {b ∈ A : ha, bi ∈ EA }. The factor structure A/E has the ground set {a : a ∈ A}; the interpretation of the symbols goes via representatives. Formulas in (ii) and (iii) ensure that this can be done. By induction on formulas, for each ϕ ∈ F (τ 0 ) without equality symbol, A |= ϕ iff A/E |= ϕ, thus A/E is also a model of Σ0 . In this latter model, 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 Σ by its universal closure. This preserves prenex forms and does not affect consistency since 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 if n = 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 Skolemization of ϕ is got by repeated one-step Skolemization until no existential quantifier remains. Claim 2.17 Suppose ϕ∗ is the Skolemization of ϕ. Con(Σ, ϕ). Then Con(Σ, ϕ∗ ) iff Proof It suffices to prove the same for one-step Skolemization, which is immediate. • 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. 3.2. THE RESOLUTION METHOD 39 After the fist four set of transformations we have got a set of quantifier-free formulas in some similarity type expanding the original one. We’ve got rid of the equality sign as well. This new set of formulas is consistent just in case the original set of formulas was consistent. • The fifth transformation is very similar to the one made in the Propositional Case. The quantifier-free (i.e. open) formulas are transformed into (logically equivalent) conjunctive normal form, and using the following claim, the conjuncts 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 the negation of such a primitive formula. C is consistent if there exists a structure A so that each clause c ∈ C, no matter which valuation is chosen, possesses at least one 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 τ be the similarity type containing all the symbols in C; we may assume as well that there is at least one constant symbol in τ (if there would be none, simply add one). 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 the function 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 that the underlying set H is not empty. Lemma 2.21 The set of clauses C is consistent iff there is a model of C with ground set H together with the natural interpretation of the function and constant symbols. Proof We prove the nontrivial part only. Suppose A is a model of C, and define the 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 hh0 , . . . , hn−1 i ∈ rH iff hλ(h0 ), . . . , λ(hn−1 )i ∈ 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. 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 substitution should be performed simultaneously and not sequentially. For example, if r is a binary relation symbol, then r(x, y)[x/y, y/f (x, y)] means r(y, f (x, y)), and not 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 definition works for expressions and sequences of expressions. For the given set C of clauses, let C ∗ be the set of those instances of the substituted 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 propositional 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 the valuation f : V → {>, ⊥} as follows. If the propositional variable v ∈ V is r(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 the interpretation of the relation symbols on H as follows: hh0 , . . . , hn−1 i ∈ 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 ∗ , so it takes the value > under f , i.e. H |= c[v]. R Corollary 2.23 C is inconsistent iff C ∗ ` . This Corollary gives immediately a method to check inconsistency. One has to pick “appropriate” substitutions σ0 , . . . , σn−1 , and (not necessarily distinct) elements ci from C so that R {c0 [σ0 ], . . . , cn−1 [σn−1 ]} ` . We will do a bit more, namely we will get rid off the “appropriate” choice of substitutions. 3.2. THE RESOLUTION METHOD 41 Definition 2.24 The prime formulas π0 and π1 ∈ F (τ ) are unifiable is there exists a substitution σ so that π0 [σ] = π1 [σ]. The unifier σ is the most general unifier if for any other unifier σ 0 one can find a substitution % so that π0 [σ 0 ] = π1 [σ 0 ] = (π0 [σ])[%] = (π1 [σ])[%]. This definition works for sequences of expressions as well. Obviously the most general unifier, if exists, is unique up to renaming variables. Lemma 2.25 Suppose π0 and π1 are unifiable. Then there exists a most general unifier which can be determined by an algorithm. Proof Since π0 and π1 are unifiable only if they start with the same relation symbol, it suffices to prove the lemma for expression sequences instead of formulas. So we are given two sequences of expressions e = he0 , . . . , en−1 i and e0 = he00 , . . . , e0n i. (If they are unifiable, they must have the same length.) Suppose we know the lemma for all sequences shorter than n, and for all sequences built up from subexpressions of the present ones (so the algorithm will be a recursive one). If there is any unification, it must unify e0 and e00 . So they must be either identical variable symbols, or one of them is a variable symbol which does not occur in the other, or they must have the form e0 = f (e00 , . . . , e0k−1 ), e00 = f (e000 , . . . , e00k−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 e0 and e00 . This means that anything which unifies e0 and e00 is an extension of this σ0 . In particular, this is true of the most general unifier (if any) of e and e0 . Thus to find the latter one, we must unify e[σ0 ] and e0 [σ0 ], or, since their first members agree, to unify he1 [σ0 ], . . . , en−1 [σ0 ]i and its primed version. Now they are shorter than e so by induction we are done. This algorithm is often called “pattern matching,” and it is at the core of almost 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 is generated as follows. If necessary, rename variable symbols in c0 and c1 so that they share no common variable symbols. Pick π0 ∈ c0 and ¬π1 ∈ c1 so that π0 and π1 are unifiable with σ as the most general unifier. The resolvent is the clause def R(c0 , c1 ; π0 , π1 ) = c0 [σ] − π0 [σ] ∪ c1 [σ] − (¬π1 )[σ] . 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 def F(c; π0 , π1 ) = 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 and for their factor. Thus the following procedure cannot lead to the empty clause whenever C is consistent. Definition 2.27 (First-order Resolution Method) The clause c is derivable from R C, denoted as C ` c, if c can be got by forming resolvents and factors repeatedly starting from elements of C. Theorem 2.28 (Completeness Theorem for the Resolution Method) C is inR consistent iff C ` 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 R {c0 [σ0 ], . . . , cn−1 [σn−1 ]} ` with the set of variable-free prime formulas as propositional variables. Now the theorem follows immediately from the following Lemma. Lemma 2.29 (Lifting Lemma) Let c0 , c1 be clauses with disjoint set of variables, σ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 c00 and c01 of c0 , c1 , respectively, prime formulas π0 , π1 , and a substitution σ so that R(c0 [σ0 ], c1 [σ1 ], v) = R(c00 , c01 ; π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 c00 = c0 [%] so that c0 [σ0 ] = c00 [σ00 ] for some substitution σ00 , and v is got from only one member of c00 , let this member be π0 . c01 and π1 are defined similarly. Since v = π0 [σ00 ] = π1 [σ10 ], π0 and π1 are unifiable, so R(ϕ00 , ϕ01 ; π0 , π1 ) def is defined. By assumption, c0 and c1 share no common variables, so σ 0 = σ00 ∪σ10 is well-defined, from where σ can be got easily. 3.2. THE RESOLUTION METHOD 43 Quite frequently clauses are in a very special form: they contain at most one non-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 ← arrow may be empty. If this is the left hand side, the clause is called goal, if it is right hand side, than it is called fact. If all elements in C are Horn-clauses, then the resolution method works without factoring. Usually a single goal clause is allowed only, and in this case the resolution method simplifies to an algorithm which either gives the derivation of , or shows that cannot be derived. 44 CHAPTER 3. PROVABILITY, COMPLETENESS Chapter 4 Incompleteness 4.1 Pre-amble In this section we fix the type τ0 = h0, 1, +, ·, <i; our standard model will be the set of natural numbers, denoted by ω, endowed with the natural interpretations of 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 symbol 0, ε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 that N |= 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 = k iff Q |− εi + εj = εk , Q |− x < εi ∨ x = εi ∨ εi < x , i < j iff Q |− εi < εj , i · j = k iff Q |− εi · εj = εk , Q |− (x < εi ) → (x = ε0 ∨ . . . ∨ x = εi−1 ) . 45 46 CHAPTER 4. INCOMPLETENESS By Gödel’s completeness theorem it is enough to show that these formulas are true 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. (∀x < e) and (∃x < e) are defined as follows: The bounded quantifiers (∀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 iff N |= ϕ(~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 Σ1 ∆0 ⊂ ∆1 ⊂ Π1 We shall see later that each containment here is proper. Obviously every finite and cofinite set is ∆0 , moreover all these collections are countable (since there are 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 n free variables. Then in case of ϕ ∈ ∆0 , ϕ ∈ Σ1 , ϕ ∈ Π1 , N |= ϕ(~a) N |= ϕ(~a) N |= ϕ(~a) iff implies follows from M |= ϕ(~a) M |= ϕ(~a) 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 )ϕ ; N |= (∀x < y) ∃z ϕ ↔ ∃u (∀x < y) (∃z < u) ϕ (4.1) (4.2) The formula in (4.2) is the so-called collection principle. 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 are similar 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 subset A ⊂ ω 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 in each model of Q. So, by Gödel’s Completeness Theorem 1.17, they are derivable from 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, and put def ϑ(a) = ∃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 can be 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)), so the y witnessing N |= ∃y ψ(y, a) is smaller than x. These formulas are valid in each end-extension, so we get, as before, that they can be derived from Q. 48 CHAPTER 4. INCOMPLETENESS Definition 1.12 For a function f : ω n → ω, its graph is the set {hx, f (x)i : 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. This shows that the graph of f is also Π1 , as claimed. For a set A ⊂ ω n , its characteristic function χA : ω n → ω is defined as follows: 1 if a ∈ 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 that given a ∆0 subset A ⊂ ω n , we have a mechanical method to decide whether a given 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 that A is given by the formula ∃y ϕ(a, y) with ϕ(a, y) ∈ ∆0 . Then go through the natural numbers and for each n ∈ ω decide whether N |= ϕ(a, n) or not. If (and only 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 in advance 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 through the natural numbers, and in each step check whether any of N |= ϕ(a, n) and N |= ψ(a, n) is true. Sooner or later we shall find such a value. At that moment the procedure terminates and a ∈ A or a ∈ / A depending on which of the cases halted 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 . Then first 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) → ϕ(a1 , 0) ↓ ϕ(a2 , 0) ... ← → ϕ(a0 , 1) ↓ ϕ(a1 , 1) ϕ(a2 , 1) ... → ϕ(a0 , 2) ↑ ϕ(a1 , 2) ↑ ϕ(a2 , 2) ... → ... ... ... 4.1. PRE-AMBLE 49 At each point decide whether N |= ϕ(ai , j) or not (since ϕ ∈ ∆0 we have a decision procedure). If yes, print ai as a member of A, if not, do nothing. After that go to the next element in the diagram. It may happen that the same member appears more than once during this enumeration. It is not too hard to modify 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 functions) as the usually defined recursive, recursively enumerable (or computable) sets. We may introduce new function and relation symbols not in τ0 to denote certain (or all) ∆1 functions and relations. (This can be thought as introducing shorthands for these objects.) It is meaningful to speak about ∆1 sets and functions in the expanded language. However, everything which is ∆1 in this wider sense is ∆1 in the original sense. (Exercise.) Another important remark here is that fixing a theory T ⊂ F (τ0 ), we can define the relativised versions of ∆0 , ∆1 , etc. sets. E.g., A ⊂ ω n is ∆0 (T ) if there 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 ) . 50 CHAPTER 4. INCOMPLETENESS The scheme in the last line is the so-called induction principle. It can be shown that (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 the language where every ∆1 relation and function is denoted by some symbol, together with the distinguished n-place relation symbol R (or function symbol F ) which behaves as a (second order) variable. Given any recursive relation r ⊂ ω 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 relations to recursive relations where its name come from. 4.2 Diophantine Equations Definition 2.1 The set A ⊂ ω n is Diophantine if there exists a polynomial p(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 quantifierfree (i.e. open) formula preceded by a block of existential quantifiers. A subset A ⊂ ω 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 get that p(a, b) = 0 iff p+ (a, b) = p− (a, b), where this latter one is a prime formula in 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 following rules always using new variables: replace replace replace replace replace replace e0 = e1 e0 6= e1 e0 < e1 ¬(e0 < e1 ) ∃z0 (e0 = 0) ∧ ∃z1 (e1 = 0) ∃z0 (e0 = 0) ∨ ∃z1 (e1 = 0) by by by by by by (e0 − e1 ) = 0 ∃z (e0 − e1 )2 − z − 1 = 0 ∃z e0 + z + 1 − e1 = 0 ∃z e0 − e1 − z = 0 ∃z0 ∃z1 (e20 + e21 = 0) ∃z0 ∃z1 (e0 · e1 = 0). Theorem 2.4 (Davis–Putnam–Robinson–Matijasevic) A set is Diophantine if and only if it is Σ1 . 4.3. CODING 51 Proof =⇒ This is immediate from the Lemma above and from the preceding remark. ⇐= By induction from the Lemma below. Lemma 2.5 Suppose A ⊂ ω n+1 is Diophantine. Then so is {hx, ui ∈ ω n+1 : (∀y < u) (hx, yi ∈ A)}. Proof While requires no sophisticated methods, the proof is too lengthy to include here. 4.3 Coding The most important (and the perhaps most essential) method in recursion theory is the so-called coding, what we shall introduce just in a moment. We shall . y with takes the value 0 if x < y, and x−y otherwise. use the binary function x − Obviously, this is a ∆0 function. Theorem 3.1 There are ∆0 function Len(u), π(u, i), and Append(u, z) of one, two, and two variables, respectively, so that (i) Len(0) = 0; . 1; (ii) π(u, i) ≤ u − (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 member of that sequence (of course it will be used with i < Len(u) only); finally Append(u, z) yields the (code of the) sequence which got from u by appending z 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 {ha, b, ci ∈ ω 3 : M (a, b) = c} . √x]2 and L(x) = can defined by a ∆0 formula; and so are K(x) = x −[ √ be . K(x) − . 1. Let moreover rem(x, y) be the remainder when dividing x by [ x] − 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 0 < z) (∀v < x + 1) (x 6= y · v + z 0 ) . 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 . 1. rem(K(u), i) ≤ K(u) ≤ u − 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 for all u and z. Let n = Len(u). If b is divisible by every prime number up to n + 2 then 1 + b, 1 + 2b, ..., 1 + (n + 2)b are pairwise relatively prime, thus by the Chinese Remainder Theorem there is a solution for the simultaneous congruence system 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 when x is divided by the moduli. In this way v = M (x, b) = (x + b + 1)2 + x gives an 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. That is, if ϕ(u, z, v) ∈ F (τ0 ) is the defining ∆0 formula for Append (say), then PA |− ∀u ∀z ∃! ϕ(u, z, v). Proof This fact is not proved here, but is essential in a later theorem. Definition 3.3 Let hi = 0, hai = 0 _ a, and in general, ha0 , . . . , an−1 , an i = ha0 , . . . , an−1 i _ an . Lemma 3.4 For each n ∈ ω, the function h. . .i : ω n → ω is ∆0 . Moreover if ha0 , . . . , an−1 i = 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 = {ha0 , . . . , an−1 i ∈ ω : ha0 , . . . , an−1 i ∈ 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 a danger of confusing the two meaning of h. . .i, this does not make any trouble as far 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}. 4.4. UNDECIDABILITY 53 Theorem 3.6 (Recursion Theorem) Let Φ(R) be a recursive functional with R as 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, let ui for i < n be the (code of the) sequence consisting of the elements of r i (say, in increasing order), and let u = hu0 , . . . , un−1 i. 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 (with u 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 this relation. 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 define a relation (or function) from values it takes earlier in a recursive way, then the relation (function) will also be a recursive one. 4.4 Undecidability Let τ be a finite similarity type extending τ0 , i.e. only finitely many different symbols are allowed in τ . (This restriction can be weakened a bit.) Define the code of the symbols as (i) if x is the i-th variable symbol, then cd(x) = h0, 0, ii; (ii) if c ∈ τ is the i-th constant symbol then cd(c) = h0, 1, ii; if f ∈ τ is the i-th function symbol of arity n, then cd(f ) = h0, 2, i, ni; if r ∈ τ is the i-th relation symbol of arity n then cd(r) = h0, 3, i, ni; 54 CHAPTER 4. INCOMPLETENESS (iii) cd(¬) = h0, 4i; cd(∨) = h0, 5i; cd(∃) = h0, 6i; cd(=) = h0, 7i. 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 Gödel-number dee of the expression e ∈ E(τ ) is dxe = hcd(x)i if x is a variable symbol; dce = hcd(c)i if c ∈ τ is a constant symbol; df (e0 , . . . , en−1 )e = hcd(f ), de0 e, . . . , den−1 ei if f ∈ τ is an n-place function 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 is defined in a recursive way from values it takes earlier. Now u ∈ Expression iff u is a code of a sequence, and either u has length 1 and its only member is the code of a variable symbol or a constant symbol, or its length is bigger than 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 that each smaller number has either a different length or for some i < Len(u) its i-th member is different (evidently a ∆0 relation), and the remaining condition is 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 ∧ . 1) (π(u, i + 1) ∈ Expression). ∧ (∀i < Len(u) − . 1, This is a recursive functional for “Expression”, and since π(u, i + 1) ≤ u − it refers to values less than u. Definition 4.3 The Gödel number dϕe of the formula ϕ ∈ T (τ ) is defined as follows: de0 = e1 e = hcd(=), de0 e, de1 ei; dr(e0 , . . . , en−1 )e = hcd(r), de0 e, . . . , den−1 ei; d¬ϕe = hcd(¬), dϕei; dϕ ∨ ψe = hcd(∨), dϕe, dψei; d∃x ϕe = hcd(∃) , cd(x), dϕei. Moreover, Formula = {dϕe : ϕ ∈ F (τ )}. Lemma 4.4 The “Formula” relation is recursive. 4.4. UNDECIDABILITY 55 Claim 4.5 The “Expression” and “Formula” relations, as subsets of ω, are disjoint. Since the natural numbers were identified with special τ0 -type expressions (recall that n ∈ ω is (. . . (0 + 1) + . . . + 1) + 1 ∈ E(τ ) with n ones), and, therefore, they are τ -type expressions, the Gödel-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 = {hn, dnei : n ∈ ω} is ∆1 . Also we can use the Recursion Theorem since hu, vi ∈ A iff (u = 0 ∧ v = d0e) ∨ u 6= 0 ∧ v ∈ Expression ∧ . 1, π(v, 1)i ∈ A ∧ π(v, 0) = cd(+) ∧ π(v, 2) = 1 ∧ hu − Since d0e, d1e and cd(+) are certain natural numbers (however we won’t com. 1, π(v, 1)i pute them), this is a recursive functional for A if we know that hu − is smaller than hu, vi. While it may happen that this is not the case, we do not bother. One can make it sure by redefining the “pairing function” h. . .i, or can use a bit more sophisticated definition for A. Definition 4.7 Let Free = {hdϕe, cd(x)i : the variable x is free in ϕ ∈ F (τ )}; and for a variable x, Substx = {hdϕe, dee, dϕ(x/e)ei : ϕ ∈ F (τ ), e ∈ E(τ ), and the 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 which tells for any formula ϕ ∈ F (τ ) whether ϕ is an element of T or not; T is enumerable if we can list its members in some mechanical way; T is decidable if there exists some procedure telling for every formula whether it is a consequence of T or not. Since Substx ⊂ ω 3 is ∆1 , and the function n 7→ dne is recursive, the set A = {hdϕe, n, dϕ(x/n)ei : ϕ ∈ F (τ ), n ∈ ω} is also ∆1 . Therefore we have Σ1 formulas ϑ(x, y, z) and ϑ(x, y, z) so that ha, b, ci ∈ A implies T0 |− ϑ(a, b, c), and ha, b, ci ∈ / A implies T0 |− ϑ(a, b, c). Now let def Subst(x, y, z) = ϑ(x, y, z) ∧ (∀z 0 < z) ϑ(x, y, z 0 ) ∈ F (τ0 ) Suppose ϕ ∈ F (τ ), and n ∈ ω, then obviously, T0 |− ∀z (Subst(dϕe, n, z) ↔ z = dϕ(x/n)e. 56 CHAPTER 4. INCOMPLETENESS Theorem 4.10 (Church’s Theorem) Suppose T0 ⊂ T ⊂ F (τ ), and T is consistent. Then T is undecidable. Proof Suppose the contrary, i.e. the set of consequences of T is ∆1 . By the Representation Theorem for ∆1 sets, we have a Σ1 formula χ(x) ∈ F (τ0 ) so that for any ϕ ∈ F (τ ), (i) T0 |− χ(dϕe) if T |− ϕ; (ii) T0 |− ¬χ(dϕe) if T |6− ϕ. def Now let Ψ(x) = ∀x (Subst(x, x, z) → ¬χ(z)) ∈ F (τ0 ), and consider the (closed) def formula ν = Ψ(dΨe) ∈ F (τ0 ). We have two cases. (i) T |− ν. Then by (i) above, T0 |− χ(dνe), and since hdΨe, dΨe, dνei ∈ A as defined before the theorem, T0 |− ∃z (Subst(dΨe, dΨe, z) ∧ z = dνe). Now these give T0 |− ∃z (Subst(dΨe, dΨe, z) ∧ χ(z)) which is nothing else but the negation of ν. So T |− ν implies T0 |− ¬ν, i.e. T is 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. Taking T to be the set of τ0 -type formulas true on N, a slight modification of the proof gives 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 of natural 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 this set. A usual way to express this theorem is by saying, “the truth on natural numbers 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. 4.4. UNDECIDABILITY 57 Proof Suppose the contrary. Since T0 is finite, we can form the conjunct of the universal closures of its elements, let it be Φ ∈ F (τ0 ). Now by the completeness of |− 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 Φ is a concrete formula, the function dϕe 7→ dΦ → ϕe is evidently recursive.) But this contradicts Church’s Theorem. Observe that in contrast to this theorem, the tautologies always form a recursive set. What happens if we drop the apparently superficial restriction τ ⊃ τ0 ? For example, what can we say if τ is empty, i.e. only the equational symbol is allowed 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 (∅) is true on all models or not, and leave it as an Exercise to turn it into a proof of the claim. First, put ϕ into prenex form. Suppose it contains n different variable symbols. Now ϕ is true on all structures with at most n + 1 elements if 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 undecidable (i.e. the set {ϕ ∈ F (τ ) : |= ϕ} is not recursive) if and only if τ contains either at least two function symbols, or contains a relation or function symbol of arity ≥ 2. Next we extend the methods of the proof of Church’s Theorem so that it can be applied to other theories, too. Let τ be an arbitrary but finite similarity type. We can also define the Gödel-number of the τ -type expressions and formulas. Let f : ω → E(τ ) be a function so that n 7→ df (n)e is recursive. (Observe that our original coding satisfies this property.) We say that the relation A ⊂ ω n is representable in the theory T ⊂ F (τ ) if there exists a formula χ(x) ∈ F (τ ) so that 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 consistent theory T ⊂ F (τ ). Then T is undecidable. Proof Word by word the proof of Church’s Theorem. 58 CHAPTER 4. INCOMPLETENESS Corollary 4.16 The axiom system ZFC (Zermelo-Fraenkel axiom system for set theory with the Axiom of Choice) is undecidable. Proof (with a hotch-potch). We may assume that the symbol ∅ for the empty set, {} for pairing, and ∪ for binary union, are present in the language. Define the 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 is representable requires a finite part of ZFC only. Thus any set of formulas extending consistently that finite subset is undecidable. The language of ZFC contains a single binary relation symbol (for membership) only, therefore we have Corollary 4.17 The empty theory with a single binary relation symbol is undecidable. A theory T ⊂ F (τ ) is essentially undecidable if no consistent extension of T is decidable. Of course, consistent extensions of essentially undecidable theories are essentially undecidable. Moreover, if T is finite and essentially undecidable, T 0 ∪ T is consistent, then T 0 is undecidable. In fact, a bit more is true. Suppose we can find a model for T 0 ⊂ F (τ 0 ) so that inside this model, with the help of the symbols available in the type τ 0 we can define a τ -type model for T ⊂ F (τ ). Then T 0 is undecidable. Indeed, using the definition of the “inner model,” we can translate the formulas about T into the language of T 0 . Now if the translation of ϕ ∈ F (τ ) is ϕ0 ∈ F (τ 0 ), then in that particular model the translations of the elements of T are true. Therefore T 0 ∪ {ϕ0 : ϕ ∈ T } is consistent, and then so is {ψ ∈ F (τ ) : T 0 ∪ {ϕ0 : ϕ ∈ T } |− ψ 0 }. This is a consistent extension of T , therefore undecidable. On the other hand, if T 0 is decidable, then, T being finite, T 0 ∪ {ϕ0 : ϕ ∈ T } is also decidable. But this implies that the above set is also decidable, a contradiction. We have a finite, essentially undecidable theory T0 ⊂ F (τ0 ), and N is a model for it. Therefore if we can define N inside a model of a theory T , then this T is necessarily undecidable, moreover there is a finite T ∗ ⊂ F (τ ) so that T ∪ T ∗ is consistent, and T ∗ is essentially undecidable. Theorem 4.18 The theory of rings is undecidable. Proof A ring is a h+, −, ·, 0, 1i-type structure, let Z be the ring of integers. We are going to define an “inner structure” in Z isomorphic to N. We have the constants 0, 1, and the operations +, ·, the only missing thing is the ground set. Thus if we are able to define (by a formula) the set of the non-negative integers, 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 integer is the sum of four squares. Thus the set of those a ∈ Z which satisfy Z |= ∃x0 ∃x1 ∃x2 ∃x3 (a = x20 + x21 + x22 + x23 ) 4.4. UNDECIDABILITY 59 is just the set of natural numbers. 0 and 1 (in the “ring” sense) are here, and the sum and product of these as natural numbers agree the sum and product in the ‘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 is divisible 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 language h+, | , 1i so that Z with the natural interpretation forms a model for this theory. 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 definition for 0. For i, j ∈ Z define the result of the binary operation i − j as the only x satisfying 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 + j 2 . Since everything was defined with the given symbols, we are done. Now we return to the proof ot Tarski’s Theorem. It is enough to find a group and inside it a structure isomorphic to the one in the Lemma. We shall use another constant symbol besides the one denoting the neutral element of the 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 will be denoted by π0 ◦ π1 ∈ G. Let S = S1 ∈ G be the element with S(i) = i + 1 for 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 in A), 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 h◦, Si (here S is the constant symbol and ◦ is the 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. In contrast to these results we have Theorem 4.22 The theory of Abelian groups, and the theory of algebraically closed fields are decidable. 60 CHAPTER 4. INCOMPLETENESS 4.5 Gödel’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 = hdϕ0 e, dϕ1 e, . . . , dϕn−1 ei, 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 inference rule with premises among {ϕj : j < i}. def Definition 5.1 ProvT = {hu, dϕei : u ∈ ω is a derivation from T , and its last element is ϕ}. Observe that T |− ϕ if and only if hu, dϕei ∈ 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 {hdχe, dϕ0 e, dϕ1 ei : χ is the conclusion of an inference rule with premises in ϕ0, ϕ1 } are recursive, we have that hu, vi ∈ ProvT iff “u is a sequence” ∧ Len(u) > 0 . 1) = v ∧ (∀i < Len(u)) “π(u, i) is a formula” ∧ (∀i < Len(u)) ∧ π(u, 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; and a Σ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 T form a Σ1 set, too: T |− ϕ if and only if N |= ∃u (hu, dϕei ∈ ProvT ). We have to 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− ϕ iff T |6− ϕ iff T |− ¬ϕ. This means T |6− ϕ iff N |= ∃u (hu, d¬ϕei ∈ ProvT ). The function dϕe → 7 d¬ϕe is recursive, therefore the formulas which are not consequences of T also form a Σ1 set, as required. 4.5. GÖDEL’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 appropriate axiom system can be written explicitly). The first two are ω-categorical, and the algebraically closed fields are ω1 -categorical (they are determined completely by the transcendence degree), therefore they must be complete by the Löwenheim– Skolem Theorems. Theorem 5.6 (Gödel’s First Incompleteness Theorem) Suppose T0 ⊂ T ⊂ F (τ ), T is enumerable and consistent. Then there exists a (closed) formula independent of T , i.e. ϕ ∈ F (τ ) so that neither T |− ϕ nor T |− ¬ϕ. Proof This is an immediate consequence of the previous Theorem and Church’s Theorem. This proof is purely “existential”, i.e. only the existence of such a formulas proved. Such a formula, however, can be constructed explicitly, but is too artificial, has no “mathematical meaning” in the sense of the everyday pure mathematics. Proving independence (say, from ZFC or from PA) of more natural sentences requires techniques developed quite recently (such as forcing). Let T be an enumerable theory. Then the relation ProvT is Σ1 . Let ProvT (x, y) ∈ F (τ0 ) be the Σ∗1 formula built up in a way reflecting the definition of the relation. In particular, for any natural number a, b ∈ ω, ha, bi ∈ ProvT iff N |= ProvT (a, b) iff T0 |− ProvT (a, b) Definition 5.7 ConT ∈ F (τ0 ) is the formula ¬∃z ProvT (z, dx 6= xe). Of course, N |= ConT if and only if T is consistent. So proving that a given theory T is consistent is just the same task as proving that the (Π∗1 ) formula ConT is true on the natural numbers. In particular, the consistency of ZFC is a 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 consistent or 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 ↔ ϕ, or N |= ConT ↔ ¬ϕ. This situation changes considerably if we want to prove the formula ConT . It may happen that we cannot prove it from T 0 , say, but we can prove an equivalent of it. (If N |= ConT then N |= ConT ↔ ∀x (x = x), and T 0 |− ∀x (x = x) no matter what T 0 is.) Nevertheless, ConT is regarded as the one and only formula which expresses the consistency of T in the most basic and essential way, in the form what every consistency proof should give. If we can show T 0 |6− ConT , then this fact is expressed by saying “the consistency of T is not provable in T 0 ”. 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 (Gödel’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 ) was def defined above. Let PrT (y) = ∃x ProvT (x, y). Since we shall deal with the theory T only, we omit the subscripts. Define def Ψ(x) = ∀z Subst(x, x, z) → ¬ Pr(z) , def and let ν = Ψ(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, a contradiction. 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), in particular, 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 a derivation 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 of PA we have M |= Prov(u, dνe) for some u ∈ M , then also M |= Prov(u _ dϕ0 e _ . . . _ dϕn−1 e, d¬ Pr(dνe)e), i.e. M |= ∃x Prov(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 functions and relations defined so far behave nicely not only on N but on any model of PA. 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 above leads to PA |− Pr(dϕe) ∧ Pr(d¬ϕe) → Pr(dx 6= xe). 4.5. GÖDEL’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 |− ϕ → P v(dϕe). Our ϕ = Pr(dνe) ∈ F (τ0 ) is a Σ∗1 formula, 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 Gödel’s Second Incompleteness Theorem. As Church’s Theorem, this Theorem remains also true if instead requiring T to be an extension of PA, we require a definable “inner” model for PA in every model 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 afforded by) ZFC. And since every mathematical activity, manipulation, and proof is regarded sane, acceptable and correct only if it can be embedded into the general framework of set theory (this is not a claim, only experimental fact), there is no hope for proving the consistency of ZFC, and therefore there is no reason to look for such a proof. However, there remains the possibility that someone sometimes succeeds in proving that ZFC is inconsistent. This, in my opinion, will have very little, if any, effect on mathematics. More than 50 years of practice showed that this proof must be very long and complicated, and a slight modification either on the formula set ZFC, or on the derivation rules will mend the situation, a modification 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, therefore PA |6− ConPA , which means that T is consistent. But T |− ¬ConPA , and since T ⊃ PA, this implies T |− ¬ConT . As it was remarked, there are other possible definitions for consistency. One of them is Rosser’s: def Prov∗T (u, dϕe) = ProvT (u, dϕe) ∧ (∀v < u) ¬ProvT (v, d¬ϕe); def Con∗T = ¬(∃u Prov∗T (u, dx = xe) ∧ ∃v Prov∗T (v, dx 6= xe)). It is not hard to see that if PA ⊂ T ⊂ F (τ ), T is enumerable, then T |− Con∗T . 64 4.6 CHAPTER 4. INCOMPLETENESS Further reading Consider the set formed from those pairs of natural numbers hdϕe, ui, for which ϕ ∈ F (τ0 ) is a ∆0 formula, u = hu0 , . . . , un−1 i is a sequence of length n, all the free 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 definition for this set. Corollary 6.2 There is a universal recursive set for ∆0 formulas, i.e. a recursive U0 ⊂ ω 2 so that for each ∆0 set A ⊂ ω one can find an i ∈ ω with a ∈ A iff hi, ai ∈ U0 . Proof By the previous Lemma, the set U0 = {hdϕe, ai : ϕ ∈ 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 ∈ ω : ha, ai ∈ / U0 } is recursive, but cannot be ∆0 . Now consider the relation Sat1 ⊂ ω 2 defined similarly as Sat0 above, only that not ∆0 but Σ1 formulas are allowed. Lemma 6.4 The relation Sat1 ⊂ ω 2 is Σ1 . Proof The pair hd∃x ϕe, ui is an element of Sat1 iff ϕ ∈ F (τ0 ) is a ∆0 formula, and for some a ∈ ω we have hdϕ(x/a)e, ui ∈ Sat0 . This latter one is a recursive set, therefore Σ1 . The lemma follows from the fact, that the function hd∃x ϕe, ai 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 set A ⊂ ω one can find an i ∈ ω so that a ∈ A iff hi, ai ∈ U1 . Proof As before, the set {hdϕe, ai : ϕ ∈ F (τ0 ) is Σ1 , has a single free variable, and N |= ϕ(a)} is Σ1 . 4.6. FURTHER READING 65 Corollary 6.6 There is a Σ1 set so that its complement is not Σ1 . Proof The set {a ∈ ω : ha, ai ∈ U1} is Σ1 since U1 is Σ1 . Its complement, i.e. {a ∈ ω : ha, ai ∈ / 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 . So the above Σ1 set is not recursive. Until now we have established the following relations: ∆0 6= ∆1 6= Σ1 . Since the 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 so that for all recursive A ⊂ ω one can find an i ∈ ω with a ∈ A iff hi, ai ∈ Ur . Proof The set {a ∈ ω : ha, ai ∈ / Ur } would also be recursive. This is just the beginning of an interesting an important branch of mathematics called Recursion Theory. 66 CHAPTER 4. INCOMPLETENESS Chapter 5 Problems 1. Prove that compactness is equivalent to the following: if Σ |= ϕ then there exists a finite subset Σ0 of Σ such that Σ0 |= ϕ. 2. Decide which of the following is true, which is false. Here Σ denotes a set of propositional formulas, ϕ and ψ denote propositional formulas. What happens 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 Σ ∪ {ϕ ∧ ψ} is satisfiable. 3. (i) Let A be a finite structure. What can be said about the ultrapower I A/U ? (ii) Suppose we have only finitely many different structures among Ai for Q i ∈ I. What can be said about the ultraproduct Ai /U ? 4. Let A be an infinite structure and κ be an infinite cardinal. Show that for some ultrafilter U on κ the ultrapower κ A/U has cardinality at least 2κ . 5. “Let A be an infinite structure, |A| = κ. If . . . . . . . . . . . . . . then A has a proper elementary extension of cardinality κ.” Fill in the missing condition and prove the statement. Give an example that 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 the following is possible: (i) K1 and K2 are elementary; (ii) K1 is elementary and K2 is not; 67 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 κ is T κ-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 proper elementary extension of cardinality |A| if this cardinal is large enough. So Σ has at least two models of this cardinality, contradicting 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 an A ∈ 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 elementary. 10. Consider the following subclasses of the class of graphs. Which of them is elementary? Which is finitely axiomatizable? (i) (ii) (iii) (iv) (v) (vi) (vii) (viii) (ix) (x) all graphs; finite graphs; infinite graphs (i.e. graphs with infinitely many vertices); graphs with countably many vertices; graphs without triangles (i.e. graphs with no mutually connected vertices v0 , v1 , v2 ); connected graphs; disconnected graphs; graphs with infinitely many edges; graphs with an infinite clique (a subset A of G is a clique if any two vertices of A are connected by an edge); 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 of Q length 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 model of cardinality 2ω , but for every ω < κ < 2ω has no model of cardinality κ. [ Hint: let D ⊂ P(ω) be an almost disjoint family of cardinality 2ω , and regard the elements of D as unary predicates on ω. ] 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 into an 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 every maximal syntactically consistent extension of Σ is also Henkin? 15. Suppose the equality sign (=) does not occur neither in Σ nor in ϕ, moreover Σ |= ϕ. Does it follow from our proof of strong completeness, that than we have a derivation Σ |− ϕ in which none of the equality axioms Ex1–Ex3 are used? Why? 16. At a certain point of the proof of the completeness theorem we have used the 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 variable symbols, and |= ϕ. Then we have a derivation of ϕ in which no more 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 in any 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 least n 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 variable symbols occur, so that A |= Φn implies that A has at least 2n elements. 18. Let h·, ci be the type of the language of groups, and take the following axioms: (i) (ii) (iii) x · c = x (c is a right unit); x · (y · z) = (x · y) · z (associativity); ∀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 x0 be the right inverse of x, and y be the right inverse of x0 · x. ] 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) and the goal formula c · x = x? Find a refutation from this set by the resolution 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 taken by 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 free variables, 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 {ha, ui ∈ ω m+1 : (∀v < u) ha, vi ∈ A}. (iii) Define the Σ∗n , Π∗n formulas similarly as in the notes. Show that a subset 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: Σ1 Σ2 ∆0 ⊂ ∆1 ⊂ ⊂ ∆2 ⊂ ⊂ ∆3 . . . Π1 Π2 (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.