<<

Math 4680, Topics in and Computation, Winter 2012 2. t is substitutable for x in ¬ ϕ iff t is substitutable for x in ϕ. Lecture Notes 4: Soundness, Completeness, and Consequences for t is substitutable for x in ϕ  ψ iff t is substitutable for x in ϕ and t is First-Order Logic substitutable for x in ψ.

Peter Selinger 3. t is substitutable for x in ∀y.ϕ iff either (a) x is not free in ∀y.ϕ or 1 Substitution (b) y is not free in t and t is substitutable for x in ϕ. t is substitutable for x in ∃y.ϕ iff either We write t1[t/x] for the result of substituting the t for the variable x in the term t1, and ϕ[t/x] for the result of substituting t for x in the formula ϕ. Here, (a) x is not free in ∃y.ϕ or only free occurrences of x are substituted. More precisely, substitution is defined (b) is not free in and is substitutable for in . recursively as follows. On terms: y t t x ϕ Convention. From now on, whenever we write ϕ[t/x], it is always implicitly x[t/x] = t assumed that t is substitutable for x in ϕ. If t is not substitutable for x in ϕ, then y[t/x] = y if x, y are different variables we implicitly rename the bound variables in ϕ so that t becomes substitutable for f(t1,...,t )[t/x] = f(t1[t/x],...,t [t/x]) n n x in ϕ. On formulas: In the proofs of soundness and completeness, we often need to relate substitutions 1. P (t1,...,tn)[t/x] = P (t1[t/x],...,tn[t/x]) to the of the involved terms in a structure. The following lemma ≈ ≈ (t1 t2)[t/x] = t1[t/x] t2[t/x] provides the necessary facts. 2. (¬ ϕ)[t/x] = ¬(ϕ[t/x]) (ϕ  ψ)[t/x] = (ϕ[t/x])  (ψ[t/x]) Lemma 1 (Substitution Lemma). Suppose A is a structure and s is a valuation. 3. (∀x.ϕ)[t/x] = ∀x.ϕ Suppose t a term, x a variable, and s¯(t)= a. Let s′ = s(a|x). Then (∀y.ϕ)[t/x] = ∀y.(ϕ[t/x]) if x, y are different variables ′ (∃x.ϕ)[t/x] = ∃x.ϕ 1. s¯(t1[t/x]) = s¯(t1) for all terms t1. ∃ ∃ ( y.ϕ)[t/x] = y.(ϕ[t/x]) if x, y are different variables ′ 2. |=A ϕ[t/x][s] iff |=A ϕ [s ], for all formulas ϕ such that t is substitutable Substitution is a more subtle notion than meets the eye. In particular, one has to for x in ϕ. be careful that t does not contain any free variables which get captured when t is substituted into some formula. Consider the formula ∃y.x 6≈ y. In a structure Proof. By induction on terms and formulas.  with two or more elements, this statement is true for any x. On the other hand, if we substitute y for x, we obtain ∃y.y 6≈ y, which is false! We want to rule out situations like this. 2 Natural Deduction We say that t is substitutable for x in ϕ if we can substitute t for x in ϕ without worrying about free variables of t intruding the scope of quantifiers in ϕ. More The natural deduction rules for first-order logic are those for sentential logic, plus precisely, this concept is defined by on ϕ: the rules given below. Note that since we are already using lower-case roman letters for variables, we are now using numbers to identify canceled hypotheses. 1. If ϕ is atomic, then t is always substitutable for x in ϕ. Also, in the rules for quantifiers, whenever we write ϕ[t/x], it is always implicitly

1 2 assumed that t is substitutable for x in ϕ. Note the side conditions in the (∀I) 3 Soundness and Completeness and (∃E) rules. These conditions ensure that we have not made any unwarranted assumptions about the variable a. 2 (Soundness and Completeness). If Γ is a of formulas, and ϕ is a Rules for quantifiers: formula, then Γ ⊢ ϕ iff Γ |= ϕ. Γ The left-to-right implication is called soundness, and the right-to-left implication . . is called completeness. ϕ[a/x] (∀I) if a is a variable not free in Γ or ϕ ∀x.ϕ Proof. Soundness is proved by induction on the size of derivations, and by a case distinction on what the last rule in the derivation is. The substitution lemma is Γ needed in the cases of the quantifier rules. . . For the proof of completeness, see e.g. van Dalen’s book [?].  ∀x.ϕ (∀E) if t is a term ϕ[t/x] 4 Compactness and consequences Γ . The following theorem is a trivial consequenceof the soundness and completeness . theorem, but it has many interesting and surprising applications. Recall that a set ϕ (∃I) if t is a term of formulas is called satisfiable if there exists a structure and a valuation that ϕ[t/x] makes all formulas in the set true.

Γ Γ, [ϕ[a/x]]1 Theorem 3 (Compactness). Let Γ be a set of formulas. If every finite of Γ . . is satisfiable, then Γ is satisfiable. . . ∃x.ϕ ψ 1 (∃E) if a is a variable not free in Γ, ϕ, or ψ Proof. We prove the contrapositive. Suppose Γ is not satisfiable. Then Γ |= ⊥. ψ By completeness, Γ ⊢ ⊥. But natural deductions are finite, hence any deduction ′ Rules for equality: can only use finitely many hypotheses. It follows that Γ ⊢ ⊥ for some finite Γ′ ⊆ Γ. By soundness, Γ′ |= ⊥, and thus Γ′ is not satisfiable, as desired.  s ≈ t r ≈ s s ≈ t t ≈ t (refl) t ≈ s (symm) r ≈ t (trans) Several applications of the compactness theorem are demonstrated in the exercises ′ s ≈ s′ s ≈ s ϕ[s/x] of Problem Set 9. Here are some more examples of such applications: ≈ ′ (cong1) ′ (cong2) t[s/x] t[s /x] ϕ[s /x] Theorem 4. Suppose Σ is a set of sentences. If Σ has arbitrarily large finite As before, we write Γ ⊢ ϕ if there is a natural deduction derivation, all of whose models, then it has an infinite model. uncanceled hypotheses are in Γ, and whose conclusion is ϕ. Proof. Suppose Σ has arbitrarily large finite models. For every n ∈ N, let λn be the sentence that states “there are at least n distinct object”. Notice that λn is first-order definable, for instance

λ3 = ∃x∃y∃z(x 6≈ y ∧ x 6≈ z ∧ y 6≈ z).

3 4 Consider the set of sentences Φ=Σ ∪{λn | n ∈ N}. Since Σ has arbitrarily Proof. “⇒”: Suppose K is finitely axiomatizable. Then surely K is axioma- c large finite models, every finite subset of Φ has a model. By compactness, Φ has tizable. To show that K is axiomatizable, let K = Mod(σ1,...,σn). Let c a model. But any model of Φ is infinite, and it is also a model of Σ. Thus, Σ has σ = σ1 ∧ ... ∧ σn. Then A ∈ K iff |=A σ. Consequently A ∈ K iff 6|=A σ, iff c an infinite model.  |=A ¬ σ. Thus, K = Mod(¬ σ). “⇐”: Suppose both K and Kc are axiomatizable. Let K = Mod(Σ) and Kc = Recall that a K of structures is called axiomatizable if K = Mod(Σ), Mod(Γ). Since no structure is in K and Kc, the set Σ ∪ Γ is unsatisfiable. By for some set of sentences Σ. Also, K is called finitely axiomatizable if K = compactness, there exists a finite subset Σ′ ∪ Γ′ which is unsatisfiable. Clearly Mod(σ1,...,σn) for finitely many sentences σ1,...,σn. every model of Σ is a model of Σ′. Conversely, let A be a model of Σ′. Then A ′ A c A Theorem 5. The class of all infinite structures is axiomatizable, but not finitely does not satisfy Γ , and hence not Γ. Thus 6∈ K , thus ∈ K. We have: axiomatizable. ′ K = Mod(Σ) ⊆ Mod(Σ ) ⊆ K,

N ′ Proof. Let K be the class of infinite structures. The set {λn | n ∈ } axiomatizes and hence K = Mod(Σ ). Thus K is finitely axiomatizable, as desired.  K. Suppose, on the other hand, that K was finitely axiomatizable. Then there exist sentences σ1,...,σn such that K = Mod(σ1,...,σn). Let σ = σ1 ∧ ... ∧ A σn, then K = Mod(σ). Thus, a structure is infinite iff |=A σ. Equivalently, a 5 Size of models structure A is finite iff |=A ¬ σ. But then the class of finite structures would be axiomatizable, contradicting Theorem 4.  The cardinality of a set is the number of elements in the set. Different infinite The following theorem is often useful in proving that a certain class of structures sets can have different cardinalities; for instance, the set of natural numbers has is not finitely axiomatizable: a smaller cardinality than the set of real numbers. We say the cardinality of a structure A is the cardinality of its carrier |A|. The cardinality of a language L is Theorem 6. If K is a finitely axiomatizable class of structures, and if K = the cardinality of L, considered as a set of sentences. ′ ′ Mod(Σ), then there exists a finite subset Σ ⊆ Σ such that K = Mod(Σ ). Remark. If P and F are the sets of predicate symbols, respectively sym- bols, of the language L, then the cardinality of L is κ = max(card P∪F, ℵ0). Proof. By assumption, is finitely axiomatizable. Let 1 be sentences K τ ,...,τn Here, ℵ0 is the cardinality of a . such that K = Mod(τ1,...,τn). Then K = Mod(τ), where τ = τ1 ∧ ... ∧ τn. Now every model of Σ is in the class K, and hence satisfies τ. It follows that the To see why this is true, first, notice that the alphabet A of L consists of the symbols set Σ∪{¬ τ} is unsatisfiable. By compactness, there exists a finite subset Σ′ ⊆ Σ from P and F, finitely many special symbols such as parentheses and logical ′ ¬ ′ connectives, and countably many variables. Thus, the cardinality of A is κ. Let such that Σ ∪{ τ} is unsatisfiable. This means that every model of Σ is not a ∗ ¬ ′ A be the set of finite strings in the alphabet A. One can regard these strings as model of τ, or in other words, every model of Σ is a model of τ. Also, every ∗ 3 4 model of Σ is certainly a model of Σ′. We thus have K = Mod(Σ) ⊆ Mod(Σ′) ⊆ finite tuples, thus A = {ǫ}∪A∪A×A∪A ∪ A ∪ .... Here ǫ is the empty ′ string. But notice that the cardinality of each An is the same as the cardinality of Mod(τ)= K. It follows that K = Mod(Σ ) as desired.  ∗ A, when n > 1. Thus the cardinality of A is at most A×ℵ0, which is in turns ∗ 6 ∗ 6 If K is a class of structures, let us write Kc for the complement of the class. That the cardinality of A. Since L ⊆ A , it follows that card L card A card A. 6 is, a structure A is in Kc iff it is not in K. On the other hand, clearly card A card L. Thus it follows that L has the same cardinality as its alphabet A. Theorem 7. A class K of structures is finitely axiomatizable if and only if both K and Kc are axiomatizable. Theorem 8 (L¨owenheim-Skolem-Tarski). Let Γ is a satisfiable set of formulas in a language of cardinality κ. Then

5 6 1. Γ is satisfiable in some structure of cardinality 6 κ. Proof. (a) Take Γ=Σ and κ = ℵ0 in Theorem 8(2). (b) Take Γ = Th(A) in Theorem 8(2) to obtain a model B of Th(A) of cardinality λ. Then Th(A) ⊆ > 2. If Γ is satisfiable in some infinite structure, then for every cardinality λ κ, Th(B). On the other hand, if σ is some sentence that is true in B, then ¬ σ is there exists a structure of cardinality λ in which Γ is satisfiable. not true in B, thus ¬ σ is not true in A, hence σ is true in A. If follows that Th(B) ⊆ Th(A). Hence B ≡ A.  Proof. 1. This follows from the proof of the completeness theorem. In the proof of the completeness theorem, we proceeded as follows: First, we replace all free Note that the preceding theorem and corollary are surprising. They imply, for variables in Γ by new constants, to obtain a set of sentences, which we close under instance, that there is an uncountable structure which satisfies precisely the same derivability to obtain a theory T . The language of T contains at most countably first-order sentences as the natural numbers. On the other hand, there is some many new constants, so it has the same cardinality as the language of Γ. Let L be countable structure which is elementarily equivalent to the reals. the language of T . Next, we constructed a Henkin theory Tω by adding a constant for each existential sentence of L, countably many times. The resulting language Lω still has the same cardinality as L. We defined A to be the set of 6 Complete and κ-categorical theories closed terms of Lω. Clearly, the cardinality of A is at most that of Lω. Finally, we constructed a structure A in which T , thus Γ, is satisfiable. We let the carrier |A| Recall that a set of sentences is called a theory if for all sentences σ, T ⊢ σ be a certain quotient of A. Thus, card |A| 6 card A 6 card Lω = card L = κ. implies σ ∈ T . Also recall that the theory Th(A) of a structure A is the set of 2. Suppose now that Γ is satisfiable in some infinite structure. Let L be the sentences that are satisfied in A. (It follows from soundness that this is indeed a > ′ language of Γ. Let λ κ be a cardinal. Consider the language L obtained from theory). Further, if K is a class of structures, then Th(K) is defined to be the set c L by adding λ many new constant symbols { x | x ∈ λ}. Consider the set of of sentences that are satisfied in all structures in K. formulas Φ=Γ ∪{cx 6≈ cy | x 6= y ∈ λ}. Definition. A theory T is complete if for every sentence σ, either σ ∈ T or ′ ¬ σ ∈ T . Notice that since Γ is satisfiable in some infinite structure A, every finite subset Φ c ′ ′ ′ of Φ is also satisfiable, namely by mapping the finitely many x that are mentioned Lemma 10. 1. If T ⊆ T and T is complete and T is consistent, then T = T . in Φ′ to different elements of A. By compactness, it follows that Φ is satisfiable. By part 1., Φ is satisfiable in some structure B of cardinality 6 λ (notice that λ 2. A theory is complete iff it is maximally consistent. is the cardinality of the language L′). On the other hand, since B is a model of 3. For any structure A, Th(A) is complete. cx 6≈ cy, for any distinct x, y ∈ λ, B has cardinality at least λ. It follows that the cardinality of B is exactly λ. Further, Γ is satisfiable in B.  4. Suppose K is a non-empty class of structures. Then Th(K) is complete iff for all A, B ∈ K, A ≡ B. Recall that two structures A and B are called elementarily equivalent if Th(A)= Th(B). Concretely, this means that A and B make precisely the same sentences Proof. 1. Suppose T ⊆ T ′ and T is complete and T ′ is consistent. Suppose there true. If A and B are elementarily equivalent, we write A ≡ B. was some sentence σ ∈ T ′ such that σ 6∈ T . Then ¬ σ ∈ T since T is complete. Since T ⊆ T ′, it follows that ¬ σ ∈ T ′. But then σ, ¬ σ ∈ T ′, which implies that Corollary 9. (a) Let Σ be a set of sentences in a countable language. If Σ has T ′ is inconsistent, a contradiction. Hence T = T ′. an infinite model, then Σ has models of every infinite cardinality. 2. Left-to-right. Suppose T is complete. Then it is maximally consistent by 1. (b) Let A be an infinite structure for a language of cardinality κ. Then for any Right-to-left: Suppose T is maximally consistent. Suppose σ 6∈ T . Then T ∪{σ} B infinite cardinal λ > κ, there is a structure of cardinality λ such that is inconsistent by maximality of T . Hence T, σ ⊢ ⊥, and thus T ⊢ ¬ σ by the B A ≡ . (¬ I) rule. Since T is a theory, it follows that ¬ σ ∈ T . Hence T is complete.

7 8 3. This is trivial. For any sentence σ, either |=A σ or |=A ¬ σ, by definition of |=. Example 14. It is a theorem in algebra that two algebraically closed fields are iso- Thus σ ∈ Th(A) or ¬ σ ∈ Th(A). morphicif they have the same characteristic and the same transcendence degree. It 4. Left-to-right: Suppose Th(K) is complete. Consider any A ∈ K. Then follows that any two algebraically closed fields of characteristic 0 are isomorphic Th(K) ⊆ Th(A). ButTh(K) is completeand Th(A) is consistent, hence Th(K)= if they have the same cardinality. In our terminology, the theory of algebraically Th(A) by 2. Similarly Th(K) = Th(B) for any B ∈ K, hence A ≡ B. closed fields of characteristic 0 is κ-categorical for any uncountable cardinal κ. Right-to-left: Suppose A ≡ B for all A, B ∈ K. Pick some A ∈ K. Then Also, this theory has no finite models. Hence it is complete by the Ło´s-Vaught Th(K)= Th(A). But Th(A) is complete by 3.  Test. One consequence of this fact is that any two such fields are elementarily equivalent. Thus, any sentence that is true for the complex numbers is true in One useful fact about complete theories is that they are often decidable. every algebraically closed field of characteristic 0. Another consequence of com- pleteness is that the theory of the complex numbers is decidable. This means, for Theorem 11. Suppose T is a theory with an set Σ that can be effectively any first-order statement about the complex numbers, there is a decision procedure listed by an algorithm. If T is complete, then T is decidable. which decides whether the statement is true or false.

Proof. Essentially, the decicion procedure for T is the following: Suppose you A decision procedure for the first-order theory of complex numbers is a very pow- want to decide whether a given sentence σ is in T . systematically enumerate all erful tool to have. However, this does not mean that we can decide any statement the valid natural deductions whose hypotheses are among Σ. Since T is complete, about the complex numbers. Only first-order statements are affected. There are eventually either σ or ¬ σ appears as the conclusion of one of these deductions. many interesting statements about the complex numbers that are not expressible Depending on which is the case, the procedure will output “yes” or “no”. This is in first-order, for instance, any statements that refer to arbitrary of the always guaranteed to happen after a finite amount of time.  complex numbers.

The following test is sometimes useful for proving that certain theories are com- plete. If κ is a cardinality, then we say that a theory T is κ-categorical if all models of T of cardinality κ are isomorphic. Theorem 12 (Ło´s-Vaught Test). Suppose T only has infinite models, and T is κ-categorical for some κ not less than the cardinality of L. Then T is complete.

Proof. Suppose T is not complete. Then there exists a sentence σ such that T 6⊢ σ and T 6⊢ ¬ σ. By completeness, there exist models A and B of T such that 6|=A σ and 6|=B ¬ σ. In other words, |=A ¬ σ and |=B σ. A and B are infinite by assumption. By Corollarycor-LST, there exist structures A′ and B′ of cardinality κ which are elementarily equivalent to A, respectively B. Thus |=A′ ¬ σ and ′ ′ |=B′ σ. Since both A and B are models of T , this contradicts the fact that T is κ-categorical.

Applications: Example 13. We proved in class that any two countable dense linear orders with- out endpoints are isomorphic. In other words, the theory T of countable dense linear orders without endpoints is ℵ0-categorical. Also, T has no finite models. It follows that T is complete.

9 10