* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Completeness - OSU Department of Mathematics
List of first-order theories wikipedia , lookup
Law of thought wikipedia , lookup
Bayesian inference wikipedia , lookup
Mathematical logic wikipedia , lookup
Gödel's incompleteness theorems wikipedia , lookup
Non-standard calculus wikipedia , lookup
Combinatory logic wikipedia , lookup
Structure (mathematical logic) wikipedia , lookup
Propositional formula wikipedia , lookup
Interpretation (logic) wikipedia , lookup
Laws of Form wikipedia , lookup
Model theory wikipedia , lookup
Boolean satisfiability problem wikipedia , lookup
First-order logic wikipedia , lookup
Arrow's impossibility theorem wikipedia , lookup
Natural deduction wikipedia , lookup
Curry–Howard correspondence wikipedia , lookup
Propositional calculus wikipedia , lookup
LECTURES ON COMPLETENESS Timothy J. Carlson Winter 2012 Our goal is Gödel’s completeness theorem Any valid logical implication has a proof. To establish this, we will need to carefully define the terms valid logical implication and proof. 1 Preliminaries Our basic reference is A Mathematical Introduction to Logic by Herbert Enderton (2nd Ed.) except that for first-order logic: • We will use connectives ¬, ∧ and ∨ (rather than ¬ and →). • We will have quantifiers ∀ and ∃ (rather than only ∀). • We will treat the equality symbol, =, as any other binary predicate symbol i.e. if a language includes = it must be a binary predicate symbol but a structure can interpret = as an arbitrary binary relation over its universe. Fix a first-order language L. Definition 1.1 A structure A for a language with = which interprets = as equality restricted to |A| is said to respect equality. 2 Homomorphisms and Congruences Assume A and B are structures for a first-order language L. A function h : |A| → |B| is a homomorphism of A to B if the following hold: • For every constant symbol c h(cA ) = cB 1 • Whenever P is an m-ary predicate symbol PA (a1 , . . . , am ) iff PB (h(a1 ), . . . , h(am )) for all a1 , . . . , am ∈ |A|. • Whenever f is an n-ary function symbol h(f A (a1 , . . . , an )) = f B (h(a1 ), . . . , h(an )) for all a1 , . . . , an ∈ |A|. Notice that if = is in L, A and B respect equality and h is a homormorphism of A to B then h is 1-1 i.e. h is an embedding of A into B. When h is a homomorphism from A to B, define the kernel of h to be the binary relation on |A| consisting of all pairs (a1 , a2 ) such that h(a1 ) = h(a2 ). For many algebraic structures, the kernel of a homomorphism can be coded in a simpler way e.g. in the case A and B are groups, one can recover the kernel if one knows the set of elements of A which map to the identity in B. Suppose A is a structure for a language L. A binary relation ≡ on |A| is a congruence on A provided • ≡ is an equivalence relation on |A|, • for any n-place predicate symbol P if ai ≡ bi for i = 1, . . . , n then PA (a1 , . . . , an ) iff PA (b1 , . . . , bn ) whenever a1 , . . . , an , b1 , . . . , bn ∈ |A|, and • for any n-place function symbol f if ai ≡ bi for i = 1, . . . , n then f A (a1 , . . . , an ) ≡ f A (b1 , . . . , bn ) whenever a1 , . . . , an , b1 , . . . , bn ∈ |A|. Theorem 2.1 Assume A and B are structures for L. If h is a homomorphism of A into B then the kernel of h is a congruence on A. Proof. Straightforward. Given a congruence ≡ on A we define A/≡ to be the structure whose universe consists of the equivalence classes of ≡ such that, writing a/ ≡ for the equivalence class containing a, • for any n-place predicate symbol P PA/≡ (a1 / ≡, . . . , an / ≡) iff PA (a1 , . . . , an ) 2 whenever a1 , . . . , an ∈ |A|. • for any n-place function symbol f f A/≡ (a1 / ≡, . . . , an / ≡) = f A (a1 , . . . , an )/ ≡ whenever a1 , . . . , an ∈ |A|. • for any constant symbol c cA/≡ = cA / ≡ The canonical homomorphism of A into A/ ≡ is the function h defined by h(a) = a/ ≡ . Notice that to justify the definition of A/≡, one must show the first two clauses are independent of a1 , . . . , an (other choices could give the same equivalence classes). This is exactly what last two clauses in the definition of congruence are for. Theorem 2.2 If ≡ is a congruence on A then the canonical homomorphism is a homomorphism. Proof. Straightforward. Theorem 2.3 Assume f is a homomorphism of A to B and let ≡ be the kernel of f . Let h be the canonical homomorphism of A to A/≡. There is a unique embedding g of A/ ≡ into B such that f = g ◦ h. Proof. Straightforward. The following is a version of the Homormorphism Theorem from Enderton’s book that is appropriate for our approach to first-order logic. Theorem 2.4 (Homomorphism Theorem) Assume h is a homomorphism from a structure A into a structure B. (a) If s is an assignment in A then h(s(t)) = h ◦ s(t) for all terms t. (b) For any quantifier free formula ϕ (?) A |= ϕ[s] iff B |= ϕ[h ◦ s] 3 for all assignments s in A. (c) If h is onto then for any formula ϕ, (?) holds for all s. Proof. For part (a), assume s is an assignment in A. Use the Induction Principle for terms to show that for all terms t, h(s(t)) = h ◦ s(t). For parts (b) and (c), let I bet the collection of formulas ϕ such that (?) holds for all assignments s in A. A straightforward argument using part (a) shows that all atomic formulas are in I and that I is closed under ¬, ∧ and ∨. Since the quantifier free formulas are the formulas generated from the atomic formulas by ¬, ∧ and ∨, part (b) follows by the Induction Principle. Part (c) follow similarly by showing I is closed under quantification if h is onto. Exercise 1. Assume h is a homomorphism from A to B. Show that for any quantifier free formula ϕ whose free variables are among the distinct variables x1 , . . . , x n A |= ϕ[x1 , . . . , xn |a1 , . . . , an ] iff B |= ϕ[x1 , . . . , xn |h(a1 , ), . . . , h(an )] for all a1 , . . . , an ∈ |A|. This is an alternate version of part (b) of the Homomorphism Theorem. Establish an analogue of part (c) also. If we modify the definition of homomorphism by weakening the clause concerning predicate symbols by only requiring the forward direction of the equivalence • Whenever P is an m-ary predicate symbol PA (a1 , . . . , am ) =⇒ PB (h(a1 ), . . . , h(am )) for all a1 , . . . , am ∈ |A|. we obtain the notion of a weak homomorphism. This weak version of homomorphism is more useful in many contexts e.g. most parts of algebra. Exercises Assume A and B are structures for L. 2. Assume h is a weak homomorphism from A to B and s is an assignment in A. Show that for all terms t1 and t2 , if s(t1 ) = s(t2 ) then h ◦ s(t1 ) = h ◦ s(t2 ). 3. Assume h is a weak homomorphism of A to B which is onto and both A and B respect equality. Show that for all terms t1 and t2 whose variables are among the distinct variables x1 , . . . , xn , y1 , . . . , ym then A |= ∀x1 · · · ∀xn ∃y1 · · · ∃ym t1 = t2 implies B |= ∀x1 · · · ∀xn ∃y1 · · · ∃ym t1 = t2 4 3 Substitution For ϕ a formula, we define whether a variable x occurs free in ϕ by recursion on the generation of ϕ. The intention of this definition is that x occurs free in ϕ when there is an occurence of x in ϕ which is not in the scope of any quantifier. Assume x1 , . . . , xn are distinct variables and t1 , . . . , tn are terms. We define the term u(x1 , . . . , xn |t1 , . . . , tn ) by recursion on terms u to be the result of simultaneously replacing each occurence of xi by ti for i = 1, . . . , n (the details definition is straightforward and left to the reader). We will also write uxt for u(x|t) (this is the notation used by Enderton). We define the formula ϕ(x1 , . . . , xn |t1 , . . . , tn ) by recursion on formulas ϕ simultaneously for all sequences x1 , . . . , xn of distinct variables and terms t1 , . . . , tn to be the result of replacing each free occurrence of xi by ti for i = 1, . . . , n (the details of the definition are straightforward and left to the reader). We will also write ϕxt for ϕ(x|t) (this is the notation used by Enderton). For ϕ a formula, x a variable and t a term, the notion that t is substitutable for x in ϕ is definited by recursion on the generation of ϕ. The idea here is that when substituting t for the free occurences of x, no variable in t becomes quantified. Lemma 3.1 Assume ϕ is a formula and x is a variable. 1. ϕxx = ϕ. 2. x is substitutable for x in ϕ. 3. If x is not free in ϕ then ϕxt = ϕ for any term t. Proof. By the Induction Principle for formulas. Exercises 1. Find a language L, a structure A for L, a variable x, a term t and an assignment s in A such that A |= ϕxt [s] but A 6|= ϕ[s(x|s(t))]. 2. Suppose x and y are distinct variables. Also suppose t and u are terms such that y does not occur in t and x does not occur in u. Show that (ϕxt )yu = (ϕyu )xt . Hint: First prove the corresponding fact for substitutions into terms. 3. Show that if ϕ is a formula, x is a variable and t is a term such that any variable which occurs in t is substitutable for x in ϕ then t is substitutable for x in ϕ. 5 4. Show that (ϕxy )yt = ϕxt iff either x = y, y = t, or both y is substitutable for x in ϕ and y does not occur free in ϕ. 5. Suppose t is substitutable for x in ϕ and x is free in ϕ. Show that for any variable z, z is free in ϕxt iff either z occurs in t or both z is free in ϕ and z 6= x. Substitution Lemma for Terms Assume A is a structure for L, x1 , . . . , xn are distinct variables and t1 , . . . , tn are terms. Also assume s is an assignment in A. For any term u, s(u(x1 , . . . , xn |t1 , . . . , tn )) = s(x1 , . . . , xn |s(t1 ), . . . , s(tn )(u) Proof. By the Induction Principle for terms. Substitution Lemma for Formulas Assume A is a structure for L. For any formula ϕ, for all distinct variables x1 , . . . , xn and all terms t1 , . . . , tn , if ti is substitutable for xi in ϕ for i = 1, . . . , n then A |= ϕ(x1 , . . . , xn |t1 , . . . , tn )[s] A |= ϕ[s(x1 , . . . , xn |s(t1 ), . . . , s(tn ))] iff for any assignment s in A. Proof. By the Induction Principle for formulas. Definition 3.2 Assume ϕ is a formula and x is a variable. x is quantified in ϕ if either ∀x or ∃x is a segment of ϕ. Lemma 3.3 Assume t is a term. For any formula ϕ, if no variable which occurs in t is quantified in ϕ then t is substitutable for x in ϕ for any variable x. Proof. By the Induction Principle for formulas. Recall that the complexity of a formula α, denoted by comp(α), is defined by recursion so that • if α is atomic then the complexity of α is 0, • comp((¬α))=comp(α)+1, • comp((α ∧ β))=comp((α ∨ β))=max{comp(α),comp(β)}+1, and • comp(∀x α) = comp(∃x α)=comp(α)+1. Lemma 3.4 If ϕ is a formula, x1 , . . . , xn are distinct variables and t1 , . . . , tn are terms then ϕ and ϕ(x1 , . . . , xn |t1 , . . . , tn ) have the same complexity. 6 Proof. By the Induction Principles for formulas. In order to deal with situations where a term may not be substitutable for a variable we need the notion of an alphabetic variant of a formula. Intuitively, α̃ is an alphabetic variant of α if α̃ can be obtained from α by changing quantified variables so as not to affect the “bindings”. We first define the set of immediate alphabetic variants of a formula by recursion so that the following hold. • If α is atomic then α is the only immediate alphabetic variant of α. • The immediate alphabetic variants of the formula (¬α) are the formulas of the form (¬α̃) where (α̃) is an immediate alphabetic variant of α. • For either ∧ or ∨, the immediate alphabetic variants of (α β) are the formulas of the form (α̃ β̃) where α̃ is an immediate alphabetic variant of α and β̃ is an immediate alphabetic variant of β. • For Q either ∀ or ∃, the immediate alphabetic variants of Qxα are the formulas of the form Qy α̃yx where α̃ is an immediate alphabetic variant of α, y is a variable which is substitutable for x in α̃ and y does not occur free in Qxα. We define the relationship of being an alphabetic variant between formulas to be the equivalence relation generated by the relation of being an immediate alphabetic variant i.e. α̃ is an alphabetic variant of α iff there is a finite sequence of formulas α0 , . . . , αn such that α0 = α, αn = α̃ and for each i < n either αi+1 is an immediate alphabetic variant of αi or αi is an immediate alphabetic variant of αi+1 . Exercises 6. ∀y∀u Pyu is an immediate alphabetic variant of ∀x∀y Pxy but not vice versa. 7. ∀x∀y Pxy and ∀y∀xPyx are alphabetic variants but neither is an immediate alphabetic variant of the other. Lemma 3.5 Alphabetic variants have the same complexity and the same free variables. Proof. First use induction on formulas α, to show that α and α̃ have the same complexity and free variables whenever α̃ is an immediate alphabetic variant of α. Lemma 3.6 Alphabetic variants are logically equivalent. Proof. First use the Induction Principle for formulas to show that immediate alphabetic variants are logically equivalent. 7 Lemma 3.7 For any formula α and infinite set of variables X, there is an immediate alphabetic variant α̃ of α such that every variable which is quantified in α̃ is in X. Proof. By the Induction Principle for formulas. Lemma 3.8 For any formula α, variable x, and term t, there is an immediate alphabetic variant α̃ of α such that t is substitutable for x in α̃. Proof. By the previous lemma and Lemma 3.3. Exercises 8. Show that for any formula ϕ, ϕ is an immediate alphabetic variant of ϕ. 9. Show that for any formula α and alphabetic variant α̃ of α there is a formula α0 such that α0 is an immediate alphabetic variant of α and α̃ is an immediate alphabetic variant of α0 . 10. Assume ϕ is a formula. Show that (a) If ϕ is atomic then a formula ϕ̃ is an alphabetic variant of ϕ iff ϕ̃ = ϕ. (b) If ϕ = α∧β then a formula ϕ̃ is an alphabetic variant of ϕ iff ϕ̃ = α̃∧ β̃ where α̃ is an alphabetic variant of α and β̃ is an alphabetic variant of β. (c) If ϕ = α∨β then a formula ϕ̃ is an alphabetic variant of ϕ iff ϕ̃ = α̃∨ β̃ where α̃ is an alphabetic variant of α and β̃ is an alphabetic variant of β. (d) If ϕ = ∀xα then a formula ϕ̃ is an alphabetic variant of ϕ iff ϕ̃ = ∀z α̃zy where α̃ is an alphabetic variant of αyx for some variable y which is not free in ∀xα and is substitutable for x in α and z is a variable which does not occur free in ∀yαyx and is substitutable for y in α̃. Notice that ∀yαyx is an immediate alphabetic variant of ∀xα and ∀z α̃zy is an immediate alphabetic variant of ∀yαyx . (e) If ϕ = ∃xα then a formula ϕ̃ is an alphabetic variant of ϕ iff ϕ̃ = ∃z α̃zy where α̃ is an alphabetic variant of αyx for some variable y which is not free in ∃xα and is substitutable for x in α and z is a variable which does not occur free in ∃yαyx and is substitutable for y in α̃. Notice that ∃yαyx is an immediate alphabetic variant of ∃xα and ∃z α̃zy is an immediate alphabetic variant of ∃yαyx . Before proving the completeness theorem, we will discuss the methods involved in the proof (term structures and how sets of formulas with good closure properties can be used to construct models) and prove Compactness Theorem A set of formulas is satisfiable iff it is finitely satisfiable i.e. every finite subset is satisfiable. 8 We will not prove the Compactness Theorem in full generality since we don’t assume familiarity with the arithmetic of uncountable cardinals. We will only give the proof for countable languages. The proof in the general case is essentially the same. We will then prove the Completeness Theorem using the Compactness Theorem. Our argument will show that the restriction of the Completeness Theorem to countable languages follows from the restriction of the Compactness Theorem to countable languages. So, these notes contain a complete proof of the Completeness Theorem for countable languages For the remainder of these notes, we will often omit parentheses in formulas when no confusion is likely. 4 Term Structures A is a term structure for a language L if A is a structure for L such that • the universe of A is the set of terms of L, • for any n-place function symbol f and terms t1 , . . . , tn f A (t1 , . . . , tn ) = ft1 · · · tn • for any constant symbol c cA = c If ∆ is a set of formulas, the term structure determined by ∆ is the term structure A where for any n-place predicate symbol P PA (t1 , . . . , tn ) iff Pt1 · · · tn ∈ ∆ . For a term structure A, the identity assignment will play a special role. Lemma 4.1 Assume A is a term structure. If s is the identity assignment, i.e. s(x) = x for any variable x, then s(t) = t for any term t. Proof. By the Induction Principle for terms. Lemma 4.2 Assume α and β are formulas and x is a variable. 1. ¬¬α |==| α 2. ¬(α ∧ β) |==| ¬α ∨ ¬β 3. ¬(α ∨ β) |==| ¬α ∧ ¬β 4. ¬∀xα |==| ∃x¬α 5. ¬∃xα |==| ∀x¬α 9 Proof. Straightforward. We will want to build term structures from sets of formulas which have certain closure properties. In order to motivate those properties one should work through Exercises Assume A is a structure for L and s maps the variables into |A|. Let ∆ be the collection of formulas ϕ such that A |= ϕ[s]. 1. If B is the term structure determined by ∆ then s is a homomorphism of B into A. 2. (a) If α ∧ β ∈ ∆ then α ∈ ∆ and β ∈ ∆. (b) if α ∨ β ∈ ∆ then either α ∈ ∆ or β ∈ ∆. (c) If ∀xα ∈ ∆ then for any term t and any alphabetic variant α̃ of α for which t is substitutable for x, α̃tx ∈ ∆. (d) If ¬α ∈ ∆ then α 6∈ ∆. (e) If ¬¬α ∈ ∆ then α ∈ ∆. (f) If ¬(α ∧ β) ∈ ∆ then ¬α ∨ ¬β ∈ ∆. (g) If ¬(α ∨ β) ∈ ∆ then ¬α ∧ ¬β ∈ ∆. (h) If ¬∀xα ∈ ∆ then ∃x¬α ∈ ∆. (i) If ¬∃xα ∈ ∆ then ∀x¬α ∈ ∆. (j) For any formula ϕ either ϕ ∈ ∆ or ¬ϕ ∈ ∆. 3. If s is onto and ∃xα ∈ ∆ then α̃tx ∈ ∆ for some term t and any alphabetic variant α̃ of α for which t is substitutable for x, 4. If s is onto and s0 is the identity assignment then B |= ϕ[s0 ] iff A |= ϕ[s]. Hint: use the homomorphism theorem. 5. If a set of sentences Γ is satisfiable in a countable structure then it is satisfiable in a term structure with the identity assignment. Remark: We will see that any satisfiable set of formulas in a countable language is satisfiable in a countable structure. The main tool for building appropriate term structures is the following Theorem 4.3 (Model Existence Theorem) Assume ∆ is a set of formulas in the language L such that the following conditions hold. 1. If α ∧ β ∈ ∆ then α ∈ ∆ and β ∈ ∆. 2. If α ∨ β ∈ ∆ then either α ∈ ∆ or β ∈ ∆. 3. If ∀xα ∈ ∆ then for any term t there is an alphabetic variant α̃ of α for which t is substitutable for x such that α̃tx ∈ ∆. 10 4. If ∃xα ∈ ∆ then α̃tx ∈ ∆ for some term t and alphabetic variant α̃ of α for which t is substitutable for x. 5. (a) If ¬α ∈ ∆ where α is atomic then α 6∈ ∆. (b) If ¬¬α ∈ ∆ then α ∈ ∆. (c) If ¬(α ∧ β) ∈ ∆ then ¬α ∨ ¬β ∈ ∆. (d) If ¬(α ∨ β) ∈ ∆ then ¬α ∧ ¬β ∈ ∆. (e) If ¬∀xα ∈ ∆ then ∃x¬α ∈ ∆. (f ) If ¬∃xα ∈ ∆ then ∀x¬α ∈ ∆. If A is the term structure determined by ∆ and s is the identity assignment then if ϕ ∈ ∆ then A |= ϕ[s] (∗) for any formula ϕ. Proof. Show that (∗) holds by strong induction on the complexity of the formula ϕ. More specifically, let I be the set of n ∈ ω such for all ϕ ∈ ∆, if comp(ϕ) = n then A |= ϕ[s]. Use strong induction to show I = ω. 5 Compactness Fix a first-order language L for this section. Our goal in this section is to prove Theorem 5.1 (Compactness Theorem) A set of formulas is satisfiable iff it is finitely satisfiable. Lemma 5.2 1. If Σ is a satisfiable set of formulas and Σ |= ϕ then Σ; ϕ is satisfiable. 2. If Σ is satisfiable and α ∨ β ∈ Σ then either Σ; α is satisfiable or Σ; β is satisfiable. 3. If Σ is satisfiable, ∃xα ∈ Σ and c is a constant symbol which does not occur in any element of Σ then Σ; αcx is satisfiable. Proof. Exercise Proof of the Compactness Theorem. We only give the proof for the case when L is countable. Claim 1. 1. If Σ is a finitely satisfiable set of formulas and Σ |= ϕ then Σ; ϕ is finitely satisfiable. 2. If Σ is finitely satisfiable and α∨β ∈ Σ then either Σ; α is finitely satisfiable or Σ; β is finitely satisfiable. 11 3. If Σ is finitely satisfiable, ∃xα ∈ Σ and c is a constant symbol which does not occur in any element of Σ then Σ; αcx is finitely satisfiable. The claim follows easily from the previous lemma. (⇒) Trivial (of course, we don’t need to use the fact that L is countable here). (⇐) Assume Γ is finitely satisfiable. We want to extend Γ to a set Γ∞ which satisfies the conditions of Theorem 2.2 in which case we know that Γ∞ , hence Γ, is satisfiable. First, extend the language L by a countably infinite set C of new constant symbols to get the language LC . Let C consist of those finitely satisfiable sets of formulas of LC of the form Γ; ∆ where ∆ is finite. Notice that Γ ∈ C (there is a subtlety here – the claim is that Γ is finitely satisfiable in structures for LC ). Claim 2. C satisfies the following conditions. 1. If α ∧ β ∈ Σ ∈ C then Σ; α; β ∈ C. 2. If α ∨ β ∈ Σ ∈ C then either Σ; α ∈ C or Σ; β ∈ C. 3. If ∀xα ∈ Σ ∈ C then Σ; α̃tx ∈ C for any term t and alphabetic variant α̃ of α in which t is substitutable for x. 4. If ∃xα ∈ Σ ∈ C then Σ; αcx ∈ C whenever c is an element of C which does not occur in any element of Σ. 5. (a) If ¬α ∈ Σ ∈ C where α is atomic then α 6∈ Σ. (b) If ¬¬α ∈ Σ ∈ C then Σ; α ∈ C. (c) If ¬(α ∧ β) ∈ Σ ∈ C then Σ; ¬α ∨ ¬β ∈ C. (d) If ¬(α ∨ β) ∈ Σ ∈ C then Σ; ¬α ∧ ¬β ∈ C. (e) If ¬∀xα ∈ Σ ∈ C then Σ; ∃x¬α ∈ C. (f) If ¬∃xα ∈ Σ ∈ C then Σ; ∀x¬α ∈ C. The claim follows easily from the previous lemma. We now define an increasing sequence Γ = Γ0 ⊆ Γ1 ⊆ · · · of elements of C by S recursion so that Γ∞ = n∈ω Γn satisfies the conditions of the Model Existence Theorem. We partially satisfy one of the conditions at each stage. To keep track of the condition we want to help satisfy at stage n, let hα0 , t0 i, hα1 , t1 i, . . . enumerate all pairs hα, ti where α is a nonatomic formula and t is a term in LC so that each pair occurs infinitely often. If αn isn’t in Γn we add no new formulas and let Γn+1 = Γn . Otherwise, when defining Γn+1 from Γn one adds appropriate formulas according to the relevant condition from Model Existence Theorem for αn or, in the case αn has the form ∀xα, αn and tn . For example, when αn has the form ∃xα we choose a constant symbol c from C which doesn’t occur in Γn (remember, no constant in C occurs in Γ and Γn extends Γ by only a finite set of formulas) and add αcx to Γn+1 . Also, when αn is in Γn and has 12 the form ∀xα then Γn+1 is Γn ; α̃txn where α̃ is an alphabetic variant of α such that tn is substitutable for x in α̃. Let Γ∞ be the union of the Γn . Since Γ∞ satisfies the conditions of the Model Existence Theorem, Γ∞ is satisfiable. Since Γ = Γ0 ⊆ Γ∞ , Γ is satisfiable. Corollary 5.3 (Alternate Version of the Compactness Theorem) For Γ a set of formulas and ϕ a formula, Γ |= ϕ iff Γ0 |= ϕ for some finite subset Γ0 of Γ. Proof. Immediate from the Compactness Theorem using the fact that Σ 6|= α iff Σ; α is satisfiable. We can abstract the properties of C which are used in the proof of the Compactness Theorem to prove the following theorem. Theorem 5.4 (Satisfiability Theorem) Assume C is a collection of sets of formulas such that 1. If α ∧ β ∈ Γ ∈ C then Γ; α; β ∈ C. 2. If α ∨ β ∈ Γ ∈ C then either Γ; α ∈ C or Γ; β ∈ C. 3. If ∀xα ∈ Γ ∈ C then for any term t there is an alphabetic variant α̃ of α in which t is substitutable for x such that Γ; α̃tx ∈ C. 4. If ∃xα ∈ Γ ∈ C then there is a term t and an alphabetic variant α̃ of α in which t is substitutable for x such that Γ; α̃tx ∈ C. 5. (a) (b) (c) (d) (e) (f ) If ¬α ∈ Γ ∈ C where α is atomic then α 6∈ Γ. If ¬¬α ∈ Γ ∈ C then Γ; α ∈ C. If ¬(α ∧ β) ∈ Γ ∈ C then Γ; ¬α ∨ ¬β ∈ C. If ¬(α ∨ β) ∈ Γ ∈ C then Γ; ¬α ∧ ¬β ∈ C. if ¬∀xα ∈ Γ ∈ C then Γ; ∃x¬α ∈ C. If ¬∃xα ∈ Γ ∈ C then Γ; ∀x¬α ∈ C. If Γ ∈ C then Γ is satisfiable. When C satisfies the conditions of the theorem, we say that C satisfies the satisfiability conditions. Exercises 1. Show that the collection of finite sets of formulas which are satisfiable satisfies the satisfiability conditions. 2. Assume that P is an n-place predicate symbol in L (every first-order language is required to have at least one predicate symbol). Show that the collection of all sets of formulas which are satisfiable does not satisfy the satisfiability conditions. Hint: As in the previous exercise, all conditions other than condition 5 hold in this case. 13 6 Proof Systems We begin by discussing systems of rules in an abstract setting. A rule is a pair (P, c) where P is a set. P is the set of premises of (P, c) and c is called the conclusion of (P, c). A set Y is closed under (P, c) if P ⊆ Y implies c ∈ Y . For a set U , a rule (P, c) is a rule on U if P ⊆ U and c ∈ U . Assume R is a set of rules. If (∅, c) is a rule in R, we say that c is an axiom of R. A set Y is closed under R if Y is closed under all the rules in R. Theorem 6.1 If R is a set of rules and X is a set there is a smallest set containing X which is closed under R. Proof. Let C be the intersection of all sets containing X and closed under R (notice that any set containing all premises and conclusions of rules in R is closed under R). C is easily seen to be as desired. The smallest set containing X and closed under R is called the set generated from X by R. A rule (A, c) is finitary if A is finite. Since we are interested in looking at formal proof systems for first-order logic, our main interest is in finitary rules. If R is a set of rules, X is a set and a is arbitrary, a proof of a from X in R is a finite sequence c0 , . . . , cn such that a = cn and for each i ≤ n either ci ∈ X or there is a rule (A, ci ) ∈ R such that A ⊆ {c0 , . . . , ci−1 }. We will say that c0 , . . . , cn is a proof of a in R if it is a proof of a from ∅ in R. a is provable from X in R if there is a proof of a from X in R. a is provable in R if a is provable from ∅ in R. Theorem 6.2 Assume R is a set of rules and X is a set. 1. The set of c such that c is provable from X in R is a subset of the set generated from X by R. 2. If the rules in R are finitary then the set of c such that c is provable from X in R is the set generated from X by R. Proof. Straightforward. Remark. Since the set C generated from X by R is closed under R, any a which is provable from C in R is in C. Example. Suppose F is a set of operations on a set A and X is a subset of A. Let R be the set of rules of the form x1 x2 ··· xn f (x1 , x2 , . . . , xn ) 14 where f is an n-ary operation in F and x1 , x2 , . . . , xn ∈ A. For any X ⊆ A, the set generated from X by R is exactly the set generated from X by F. When writing a proof in mathematics, one proceeds by drawing new conclusions from what preceded. For each new statement, there are background assumptions. Moreover, those assumptions can change from line to line (consider a direct proof of a universal statement or an implication). A sequent in a language L is an object of the form Γ ` ϕ where Γ is a finite set of formulas of L and ϕ is a formula of L. Think of ϕ a statement in a mathematical proof and Γ as the background assumptions. Henceforth, when L is understood we will drop mention of it. Suppose R is a set of rules on the set of sequents. We will write Γ `R ϕ if Γ ` ϕ is provable in R. R is sound if Γ `R ϕ implies Γ |= ϕ for all sequents Γ ` ϕ. R is complete if Γ |= ϕ implies Γ `R ϕ for all sequents Γ ` ϕ. We want to find a set R of rules on sequents such that • R is sound, • R is complete, • R is decidable, and • R consists of rules commonly used in mathematics. The first two conditions guarantee that Γ `R ϕ iff Γ |= ϕ The third condition is necessary for a proof system which can actually be used. The final condition will guarantee that any valid logical implication can be proved by a standard proof. 7 The Proof System N based on Natural Methods of Deduction Fix a language L for this section. We now describe several families of rules on sequents which comprise a proof system we denote by N . The rules of N are all formalized versions of rules commonly used in mathematical proofs. For this section, we let Γ and ∆ along with subscripts or superscripts range over finite sets of formulas, and we let α, β and ϕ along with subscripts or superscripts range over formulas. The axioms of N consist of all sequents of the form Γ`ϕ where ϕ ∈ Γ. 15 The family (SPEC) of specialization rules are the rules which have either the form Γ`α∧β Γ`α or the form Γ`α∧β Γ`β The family (CASES) of argument by cases rules consists of all rules which have the form Γ`α∨β Γ; α ` ϕ Γ`ϕ Γ; β ` ϕ The family (UI) of universal instantiation rules consists of all rules of the form Γ ` ∀xα Γ ` α̃tx where α̃ is an alphabetic variant of α and the term t is substitutable for x in α̃. The family (EI) of existential instantiation rules consists of all rules of the form Γ; αyx ` ϕ Γ ` ∃xα Γ`ϕ where the variable y is substitutable for x in α and doesn’t occur free in any element of Γ, ∃xα or in ϕ. The family (DN) of double negation rules consists of all rules of the form Γ ` ¬¬α Γ`α where the variable y is substitutable for x in α. The family (DM) of DeMorgan rules consists of all rules which have either the form Γ ` ¬(α ∧ β) Γ ` ¬α ∨ ¬β or the form Γ ` ¬(α ∨ β) Γ ` ¬α ∧ ¬β 16 The family (GDM) of generalized DeMorgan rules consists of all rules which have either the form Γ ` ¬∀xα Γ ` ∃x¬α or the form Γ ` ¬∃xα Γ ` ∀x¬α The family (RAA) of reductio ad absurdum rules consists of the rules which have the form Γ; ¬ϕ ` α Γ; ¬ϕ ` ¬α Γ`ϕ The family (WEAK) of weakening rules consists of the rules which have the form Γ`ϕ Γ+ ` ϕ where Γ ⊆ Γ+ . The family (CUT) of cut rules consists of the rules which have the form Γ`α Γ; α ` ϕ Γ`ϕ N is the union of the families described above. Notice that N is a decidable set of rules all of which are are used in common practice. The last two families of rules are redundant i.e. any sequent which can be proved in N can be proved without using (WEAK) or (CUT). The proof is complicated. The family (TRANS) of transitivity rules consists of all rules which have the form Γ ` α (α ∈ ∆) Γ`ϕ ∆`ϕ Theorem 7.1 The set of sequents provable in N is closed under (TRANS) 17 Proof. By induction on the cardinality of ∆ in the rule displayed above using the closure of the provable sequents under (WEAK) and (CUT). Using the theorem, a straightforward argument establishes a stronger result: the families (WEAK) and (CUT) can be replaced by (TRANS). Exercise 1. Let N − denote the set of rules in N except the rules in (WEAK) or (CUT). Show that a sequent is provable in N iff it is provable in N − +(TRANS). 8 The Completeness Theorem for N Fix a language L for this section. Theorem 8.1 (Soundness of N ) For any sequent Γ ` ϕ, if Γ `N ϕ then Γ |= ϕ. Proof. Tedious but straightforward induction which boils down to showing that for any rule Γi ` ϕi (i = 1, . . . , n) Γ`ϕ in N , if Γi |= ϕi for i = 1, . . . , n then Γ |= ϕ. Notice that a finite set of formulas Γ is not satisfiable iff Γ |= ϕ for all ϕ. By analogy, we define Γ is inconsistent iff Γ `N ϕ for all formulas ϕ. Γ is consistent if Γ is not inconsistent. Lemma 8.2 Assume Γ and ∆ are finite sets of formulas such that Γ `N α for all α ∈ ∆. If Γ is consistent then Γ ∪ ∆ is consistent. Proof. By Theorem 7.1. Lemma 8.3 If Γ `N α and Γ `N ¬α then Γ is inconsistent. Proof. Let ϕ be a formula. The following “proof tree” shows Γ `N ϕ. Γ `N α Γ; ¬ϕ `N α Γ `N ¬α Γ; ¬ϕ `N ¬α (WEAK) Γ `N ϕ (WEAK) (RAA) Lemma 8.4 Assume Γ is a finite set of formulas. 1. If α ∧ β ∈ Γ then Γ `N α and Γ `N β. 18 2. If ∀xα ∈ Γ then Γ `N α̃tx whenever t is a term and α̃ is an alphabetic variant of α such that t is substitutable for x in α̃. 3. If ¬¬α ∈ Γ then Γ `N α. 4. If ¬(α ∧ β) ∈ Γ then Γ `N ¬α ∨ ¬β. 5. If ¬(α ∨ β) ∈ Γ then Γ `N ¬α ∧ ¬β. 6. If ¬∀xα ∈ Γ then Γ `N ∃x¬α. 7. If ¬∃xα ∈ Γ then Γ `N ∀x¬α. Proof. Recalling that Γ ` ϕ is an axiom of N whenever ϕ ∈ Γ, one easily checks the given sequent in each clause has a proof of length 2. For example, assume α ∧ β ∈ Γ. Since both Γ`α∧β Γ`α and Γ`α∧β Γ`β are rules in (SPEC), Γ ` α ∧ β, Γ ` α and Γ ` α ∧ β, Γ ` β are proofs of Γ ` α and Γ ` β respectively. The following lemma is the key to the proof of the Completeness Theorem. Lemma 8.5 For Γ a finite set of formulas, if Γ is consistent then Γ is satisfiable. Proof. Let C be the collection of finite consistent sets of formulas. By the Satisfiability Theorem, it suffices to show that C satisfies the satisfiability conditions 1-5. 1. Assume α ∧ β ∈ Γ ∈ C. Γ `N α and Γ `N β by the previous lemma. By Lemma 8.2, Γ; α; β is consistent. 2. Assume α ∨ β ∈ Γ ∈ C. Argue by contradiction and assume Γ; α 6∈ C and Γ; β 6∈ C. Since Γ ` α∨β is an axiom, Γ `N α∨β. Since Γ; α and Γ; β are inconsistent, Γ; α `N ¬(α ∨ β) and Γ; β `N ¬(α ∨ β). Since the provable sequents are closed under the rule Γ`α∨β Γ; α ` ¬(α ∨ β) Γ ` ¬(α ∨ β) 19 Γ; β ` ¬(α ∨ β) from (CASES), Γ `N ¬(α ∨ β). By Lemma 8.3, Γ is inconsistent contradicting Γ ∈ C. 3. Assume ∀xα ∈ Γ ∈ C. Suppose t is a term. Let α̃ be an alphabetic variant of α such that t is substitutable for x in α̃. By the previous lemma, Γ `N α̃tx . By Lemma 8.2, Γ; α̃tx is consistent. 4. Assume ∃xα ∈ Γ ∈ C. Let y be a variable which does not occur free in any element of Γ and which is substitutable for x in α. Argue by contradiction and assume Γ; αyx is not consistent. Since Γ ` ∃xα is an axiom, Γ `N ∃xα. Since the provable sequents are closed under the rule Γ ` ∃xα Γ; αyx ` ¬∃xα Γ ` ¬∃xα from (EI), Γ `N ¬∃xα. By Lemma 8.3, Γ is inconsistent contradicting Γ ∈ C. 5(a). Assume ¬α ∈ Γ ∈ C where α is atomic. Argue by contradiction and assume α ∈ Γ. Since Γ ` ¬α is an axiom, Γ `N ¬α. Similarly, since Γ ` α is an axiom, Γ `N α. By Lemma 8.3, Γ is inconsistent contradicting Γ ∈ C. 5(b). Assume ¬¬α ∈ Γ ∈ C. By the previous lemma, Γ `N α. By Lemma 8.2, Γ; α is consistent. 5(c)-(f). The proofs are similar to that of 5(b). Theorem 8.6 (Completeness Theorem for N ) For any finite set of formulas Γ and any formula ϕ, Γ |= ϕ iff Γ `N ϕ Proof. (⇐) By the soundness of N . (⇒) Assume Γ |= ϕ. Γ; ¬ϕ is not satisfiable. By Lemma 6.4, Γ; ¬ϕ is inconsistent. Since the the sequents provable in N are closed under (RAA), Γ `N ϕ. Corollary 8.7 1. For any set of formulas Γ and any formula ϕ, Γ |= ϕ iff Γ0 `N ϕ for some finite Γ0 ⊆ Γ. 2. For any set of formulas Γ, Γ is satisfiable iff every finite subset of Γ is consistent. Proof. Part 1 follows from the Compactness Theorem and the Completeness Theorem for N . For part 2, show Γ is not satisfiable iff there is a finite subset of Γ which is inconsistent using the compactness theorem and part 1. Theorem 8.8 (Abstract Completeness Theorem) The collection of valid sequents is effectively enumerable. 20 Proof. Since the rules of N are decidable, the proofs in N are easily seen to be decidable and, therefore, effectively enumerable. This implies that the sequents provable in N are effectively enumerable, but these are just the valid sequents by the Completeness Theorem for N . One might suppose that we should restrict ourselves to rules which contain only valid sequents. While possible, the resulting system would be somewhat unnatural since the set of valid sequents do not form a decidable set for almost all first-order languages. A set of rules H on sequents is a Hilbert system if the set of assumptions remains fixed throughout any rule i.e. for a given rule there is a Γ such that every premise and the conclusion has the form Γ ` ϕ. The proof system presented in Enderton’s text is essentially a Hilbert system. Exercise 3. Show that there is a Hilbert system which is decidable, complete and sound. In fact, one can find such a system in which any premise of a rule or conclusion of a rule is valid. Hint: This can be derived directly from the the Abstract Completeness Theorem. 9 Some Natural Rules of Deduction We Missed This material in this section will not be used later and may be skipped. We now list several families of rules which are formalizations of rules which are commonly used. V The family ( INTRO) of conjunction introduction rules are the rules which have the form Γ`α Γ`β Γ`α∧β W The family ( INTRO) of disjunction introduction rules are the rules which have either the form Γ`α Γ`α∨β or the form Γ`β Γ`α∨β The family (∀INTRO) of universal introduction rules consists of all rules of the form 21 Γ ` αyx Γ ` ∀xα where y is a variable which is substitutable for x in α and does not occur free in any element of Γ or in ∀xα. The family (∃INTRO) of existential introduction rules consists of all rules of the form Γ ` α̃tx Γ ` ∃xα where α̃ is an alphabetic variant of α and t is a term which is substitutable for x in α̃. For formulas α and β, define α → β to be the formula ¬α ∨ β. The family (MP) or modus ponens consists of the rules which have the form Γ`α Γ`α→β Γ`β The family (→INTRO) of implication introduction rules consists of all rules of the form Γ; α ` β Γ`α→β Other rules which are commonly used include the “inverses” of the rules in the families (DN), (DM) and (GDM) where the inverse of a rule α β is β α Lemma 9.1 The valid (i.e. sequents Γ ` ϕ where Γ |= ϕ) are closed V sequents W under the rules in ( INTRO), ( INTRO), (∀INTRO), (∃INTRO), (MP) and (→INTRO) and the inverses of the rules in (DN), (DM) and (GDM). Proof. Straightforward but tedious. Theorem 9.2W Assume N + is the set of rules in N along with all rules in V ( INTRO), ( INTRO), (∀INTRO), (∃INTRO), (MP) and (→INTRO) and the inverses of the rules in (DN), (DM) and (GDM). For any sequent Γ ` ϕ, Γ `N + ϕ iff Γ |= ϕ 22 Proof. By the previous lemma and the completeness theorem for N . Alternately, the theorem follows from the following exercise. Exercise Let N + be as in the previous theorem. If X is a set of sequents which is closed under N then X is also closed under N + . . 10 Logic for Equality If L contains = we define the equality axioms, EQL , for L to be the following • ∀x x = x • for P an n-place predicate symbol, possibly =, ∀x1 · · · ∀xn ∀y1 · · · ∀yn (x1 = y1 ∧ · · · ∧ xn = yn ∧ Px1 · · · xn → Py1 · · · yn ) • for f an n-place function symbol ∀x1 · · · ∀xn ∀y1 · · · ∀yn (x1 = y1 ∧ · · · ∧ xn = yn → fx1 · · · xn = fy1 · · · yn ) When L is understood, we will write EQ for EQL . Lemma 10.1 For any structure A, A satisfies the equality axioms iff =A is a congruence on A. Proof. Mostly straightforward. Assuming A satisfies EQ, to see that =A is an equivalence relation, use the fact that, since the second group of axoms in EQ P being = is satisfied by A, for all a1 , a2 , b1 , b2 ∈ |A|, if a1 =A b1 , a2 =A b2 and a1 =A a2 then b1 =A b2 . Since A |= ∀x x = x, =A is reflexive. To see =A is symmetric, assume a =A b. Use reflexivity and the fact above with a1 = a2 = b2 = a and b1 = b. A similar argument, using reflexivity and symmetry, establishes transitivity. Lemma 10.2 If =A is a congruence on A then A/ =A respects equality. Proof. Straightforward. Theorem 10.3 Assume Γ is a set of formulas. Γ is satisfiable in a structure which respects equality iff Γ + EQ is satisfiable. 23 Proof. (⇒) By Lemma 10.1, any structure which respects equality satisfies EQ. (⇐) Assume Γ + EQ is satisfiable. Let A be a structure and s an assignment in |A| such that Γ + EQ is satisfied in A with s. By the previous lemma, =A is a congruence. Since the canonical homormophism h is a homormorphism of A onto A/(=A ), the Homorphism Theorem implies that A/(=A ) satisfies Γ with h ◦ s. Moreover, A/(=A ) is a structure which respects equality. Exercise 1. Assume Γ is a set of formulas in a language L. Let L0 be the sublanguage of L whose predicate symbols, function symbols and constant symbols are those which occur in Γ. Show that Γ is satisfiable in a structure for L which respects equality iff Γ + EQL0 is satisfiable in a structure for L0 . 11 Modifying N for Equality Some approaches to first-order logic require that the equality symbol always be interpreted as actual equality. We establish a completeness theorem for this version of first order logic in this section. Fix a language L which includes = for this section. For Σ a set of formulas and ϕ a formula, define Σ|= eq ϕ to mean that A |= Σ[s] =⇒ A |= ϕ[s] for every structure A for L which respects equality and every assignment s in A. Theorem 11.1 Assume Γ is a set of formulas and ϕ is a formula. Γ|= eq ϕ iff Γ + EQ |= ϕ Proof. By Theorem 10.3. Theorem 11.2 (Compactness Theorem for First-Order Logic with Equality) For Γ a set of formulas, Γ is satisfiable in a structure which respects equallity iff every finite subset of Γ is satisfiable in a structure which respects equality. Proof. By the Compactness Theorem of Section 5 and Theorem 10.3. Corollary 11.3 For Γ a set of formulas and ϕ a formula, Γ|= eq ϕ iff Γ0 |= eq ϕ for some finite subset Γ0 of Γ. Proof. Immediate from the previous theorem. Lemma 11.4 For Γ a finite set of formulas and ϕ a formula, Γ|= eq ϕ iff Γ∪∆ `N ϕ for some finite subset ∆ of EQ. 24 Proof. By Theorem 11.1, the corollary to the Compactness Theorem of Section 5 and the Completeness Theorem for N . We will write ` ϕ for the sequent ∅ ` ϕ. Lemma 11.5 Assume Σ is a set of sentences and let N + be obtained from N by adding the rules ` ϕ for ϕ ∈ Σ. For any sequent Γ ` α, Γ `N + α ⇐⇒ Γ ∪ Σ |= α . Proof. (⇒) Similar to the proof of the soundness of N . Argue by induction on the length of proofs after showing that for any rule Γi ` ϕi (i = 1, . . . , n) Γ`ϕ in N + , if Γi ∪ Σ |= ϕi for i = 1, . . . , n then Γ ∪ Σ |= ϕ. (⇐) Assume Γ ∪ Σ |= α. By the Compactness Theorem, Γ ∪ Σ0 |= α for some finite subset Σ0 of Σ. By the completeness theorem for N , Γ ∪ Σ0 `N ϕ. This implies that Γ ∪ Σ0 `N + ϕ. Use induction on the size of Σ0 to show that Γ `N + ϕ (use the fact that the provable sequents are closed under weakening and and the cut rules). We remark that the ⇒ direction of the proof breaks down if we don’t require each element of Σ be a sentence (consider the existential instantiation rules). Exercises 1. Assume Σ is a set of formulas and let N + be obtained from N by adding the rules ` ϕ for ϕ ∈ Σ. Show that for ϕ ∈ Σ and x a variable, `N + ∀xϕ. 2. Show that we cannot drop the requirement that the elements of Σ be sentences in the lemma above. Theorem 11.6 Let N eq be the extension of N obtained by adding the axioms ` ϕ for ϕ ∈ EQ. For any finite set of formulas Γ and any formula ϕ Γ|= eq ϕ iff Γ `N eq ϕ Proof. Straightforward from Theorem 11.1 and the previous lemma. A more natural alternative to the set of rules N + of the theorem is obtained by adding the following collections of axioms: `t=t t1 = u1 , . . . , tn = un , Pt1 · · · tn ` Pu1 · · · un t1 = u1 , . . . , tm = um ` ft1 · · · tm = fu1 · · · um 25 Theorem 11.7 Let N + be the extension of N by adding the axioms above. For any finite set of formulas Γ and any formula ϕ Γ|= eq ϕ iff Γ `N + ϕ Proof. It is enough to show the new axioms of N + are provable in N eq and the new axioms of N eq are provable in N + . Notice that in the theorem above, it suffices to add only the new axioms where the terms t, ti and uj are variables. 26