Introduction to Logic 1 1. Preliminaries 2. Propositional Logic 3. Tree method for PL 4. First-order Predicate Logic 5. Tree Method for FOL 6. Expressiveness of FOL Where are we?
Introduction to Logic 2 5. Trees for FOL
Introduction to Logic 3 The tree method for predicate logic We add to the branching rules for propositional connectives three rules for quantifiers. We use an infinite set of individual constants {a 0, a 1,...}. a. xφ x φ b. xφ(x) φ(b) c. xφ(x) φ(c) xφ x φ : for every constant b already present on the branch. If there is no previous constant, use a 0. :for c a fresh constant, not already present on the tree
Introduction to Logic 4 Algorithm 1. To show whether Γ = φ, (with Γ finite). Append φ to the formulas of Γ. 2. Close any branch which contains a formula and its negation. If all branches are closed, stop. 3. If a formula has not been considered and has for main connective a propositional connective, apply the connective rule. Otherwise do 4. 4. If a formula xφ(x) has not been considered, apply rule and go back to 3. Otherwise go to 5. 5. If a formula xφ(x) has not been examined, apply the rule and go to 6. 6. Whenever a new formula or new constant appears on the tree, go back to stage 2. Otherwise, stop.
Introduction to Logic 5 Example 1 If everyone is proud, then someone is proud? xp (x) xp (x)
Introduction to Logic 6 ( xp (x) xp (x))
Introduction to Logic 7 ( xp (x) xp (x)) xp (x) xp (x)
Introduction to Logic 8 ( xp (x) xp (x)) xp (x) xp (x) x P (x)
Introduction to Logic 9 ( xp (x) xp (x)) xp (x) xp (x) x P (x)
Introduction to Logic 10 ( xp (x) xp (x)) xp (x) xp (x) x P (x) P (a 0 )
Introduction to Logic 11 ( xp (x) xp (x)) xp (x) xp (x) x P (x) P (a 0 )
Introduction to Logic 12 ( xp (x) xp (x)) xp (x) xp (x) x P (x) P (a 0 ) P (a 0 )
Introduction to Logic 13 ( xp (x) xp (x)) xp (x) xp (x) x P (x) P (a 0 ) P (a 0 ) The algorithm stops and all branches are closed.
Introduction to Logic 14 Example 2 someone is cooking and reading, and someone is cooking and watching TV, so someone is reading and watching TV x(a(x) B(x)), x(a(x) C(x))? x(b(x) C(x)) x(a(x) B(x)) x(a(x) C(x)) x(b(x) C(x))
Introduction to Logic 15 x(a(x) B(x)) x(a(x) C(x)) x(b(x) C(x)) x (B(x) C(x))
Introduction to Logic 16 x(a(x) B(x)) x(a(x) C(x)) x(b(x) C(x)) x (B(x) C(x)) A(a 0 ) B(a 0 )
Introduction to Logic 17 x(a(x) B(x)) x(a(x) C(x)) x(b(x) C(x)) x (B(x) C(x)) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 )
Introduction to Logic 18 x(a(x) B(x)) x(a(x) C(x)) x(b(x) C(x)) x (B(x) C(x)) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) A(a 0 ) B(a 0 )
Introduction to Logic 19 x(a(x) B(x)) x(a(x) C(x)) x(b(x) C(x)) x (B(x) C(x)) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 )
Introduction to Logic 20 x(a(x) B(x)) x(a(x) C(x)) x(b(x) C(x)) x (B(x) C(x)) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 )
Introduction to Logic 21 x (B(x) C(x)) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) (B(a 0 ) C(a 0 ))
Introduction to Logic 22 x (B(x) C(x)) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) (B(a 0 ) C(a 0 )) (B(a 1 ) C(a 1 ))
Introduction to Logic 23 x (B(x) C(x)) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) (B(a 0 ) C(a 0 )) (B(a 1 ) C(a 1 )) B(a 0 ) C(a 0 )
Introduction to Logic 24 A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) A(a 0 ) B(a 0 ) A(a 1 ) C(a 1 ) (B(a 0 ) C(a 0 )) (B(a 1 ) C(a 1 )) B(a 0 ) C(a 0 ) B(a 1 ) C(a 1 )
Introduction to Logic 25 The algorithm stops, but there is an open branch. Note that the open branch gives us a countermodel with two individuals a 0 and a 1, in which a 0 is A, B but not C, and a 1 is A, C but not B. U = {a 0, a 1 } A M = U B M = {a 0 } C M = {a 1 }
Introduction to Logic 26 Example 3 Everyone loves someone, so someone is loved by everyone x yl(x, y)? y xl(x, y) x yl(x, y) y xl(x, y) y xl(x, y) y x L(x, y)
Introduction to Logic 27 Example 3 Everyone loves someone, so someone is loved by everyone x yl(x, y)? y xl(x, y) x yl(x, y) y xl(x, y) y xl(x, y) y x L(x, y)
Introduction to Logic 28 yl(a 0, y) x L(x, a 0 ) L(a 0, a 1 ) L(a 2, a 0 ) yl(a 1, y) yl(a 2, y) x L(x, a 1 ) x L(x, a 2 ) L(a 1, a 3 ) L(a 2, a 4 ) L(a 5, a 1 ) L(a 6, a 2 )..
Introduction to Logic 29 The algorithm will continue indefinitely : no stop, and an infinite open branch. However: it is us who can say (and prove) the branch will be infinite ; the algorithm has no way to tell. This also suggests that, from the algorithm, we can construct an infinite model that satisfies x yl(x, y), but falsifies y xl(x, y).
Introduction to Logic 30 Summary 1. The procedure terminates with all branches closed 2. The procedure terminates with some finite open branch 3. The procedure does not terminate (there is an infinite open branch).
Introduction to Logic 31 Completeness Let us write : φ for : the tree built from φ closes. We can prove that : Theorem (Completeness) : φ iff = φ (soundness) If a branch extension rule is applied to a satisfiable branch, one of the resulting branches is satisfiable. The interesting cases are the rules for and. Clearly, if a branch containing xφ(x) is satisfiable, so is the extension. If a branch containing xφ(x) is satisfiable in a model M, then for some constant c, φ(c) is satisfied in M. What about φ(c) where c is a fresh constant? Then the model M in which c M = c M is also a model of the branch.
Introduction to Logic 32 (completeness) If B is an open branch, extract a model M B by letting U B be the set of constants occurring on that branch. For P an n-ary predicate letter, set: (a i1,..., a in ) is in P M iff P (a i1,..., a in ) is a formula on B By induction, one can prove that if φ is on B, then M B = φ, and if φ is on B, then M B = φ. So, if φ, then M B, where B is an open branch, satisfies φ, and so φ.
Introduction to Logic 33 Undecidability So, FOL is complete: the tree method yields a sound and complete proof procedure for validity in FOL. But is FOL decidable? Note that the tree method is not a decision method, but only a semi-decision method: if = φ, then φ, ie the tree will eventually close. But if φ, it can happen that the algorithm keeps on searching (remember example 3!). This is not a specificity of this method, indeed: Theorem (Church 1936) : FOL is undecidable.
Introduction to Logic 34 6. Limitations of FOL
Introduction to Logic 35 Expressiveness We know that FOL is more expressive than PL, but how expressive is it? To answer this question, we need to know some general properties about FOL. The compactness theorem, in particular, plays an essential role.
Introduction to Logic 36 First-order logic with identity Consider FOL to which one adds a binary relation = expressing identity. In particular, if c and d are constants of the language, and M is a structure, then M = c = d iff c M = d M. How much can one express with identity? Abbreviation: x y for (x = y) there are at least two elements : x y( x = y) there are at least three elements : x y z(x y y z z x) there are at least n elements λ n := x 1 x 2... x n ( x i x j ) i j
Introduction to Logic 37 there are at most two elements : x y z(x = y y = z x = z) there are at most n elements : µ n = x 0 x 1 x n ( x i = x j ) there is exactly n elements : there are at least n elements, and at most n elements: (λ n µ n ) i j
Introduction to Logic 38 Some stars are blue : x(s(x) B(x)) (At least) two stars are blue : x y( x = y S(x) S(y) B(x) B(y)) Can we express that: infinitely many stars are blue? Consider the following theory (set of sentences): T = {λ n ; n 2} there is at least two elements there is at least three elements. T has only infinite models. Suppose it has a finite model M. Let k be the size of the domain. Since M satisfies all sentences of T, M = λ k+1 : contradiction.
Introduction to Logic 39 A finite number of Existential quantification: some Finite cardinality quantification : at least n, at most n, exactly n. Infinite cardinality: infinitely many (but note that we expressed it by means of an infinite set of sentences). What about there is a finite number of? This can t be expressed in FOL! Why? because FOL has compactness.
Introduction to Logic 40 Compactness Consider the sentences: F : there are finitely many elements F 1 : there is at least one element F 2 : there are at least two elements F 3 : there are at least three elements.. Taken together, these sentences are inconsistent: they require both that there are finitely many elements, and they entail that there are infinitely many elements. However, every finite subset of these sentences is satisfiable (why?).
Introduction to Logic 41 Compactness We know that each F n is expressible in FOL by the sentence λ n. If F (finiteness) were expressible by a sentence φ, then the set of sentences Γ = {λ n ; n 2} {φ} would not be satisfiable, while every finite subset would be : so FOL would not be compact. However... Theorem (Compactness) If every finite set of FO-sentences of a set Γ has a model, then Γ has a model. Corollary : finiteness is not expressible in FOL.
Introduction to Logic 42 Further examples Some properties of relations can be expressed in FOL: R is reflexive : xr(x, x) R is symmetric : x y(r(x, y) R(y, x)) Others can t be expressed. Example : Connectedness: for any two points x and y, there is a path leading from x to y, ie a set of points a 1,..., a n such that xra 1 Ra 2 R...Ra n Ry. Proof: show that the theory saying x and y are connected, are distinct, and there is no path of length 1 between them, no path of length 2,..., is consistent (use compactness).
Introduction to Logic 43 Most (1) There are more cats than dogs (2) Most dogs are nice Neither of the sentences can be expressed within FOL. Why not? The idea is: they involve quantification over sets, not only individuals. there are more A than B : the set of A has more elements than the set of B. Most A are B means : the set of A that are B has more elements than the set of A that are not B.
Introduction to Logic 44 Restricted quantification Some A are B : [ x : A(x)]B(x) All A are B : [ x : A(x)]B(x) We can define these new expressions within FOL. [ x : A(x)]B(x) x(a(x) B(x)) [ x : A(x)]B(x) x(a(x) B(x)]
Introduction to Logic 45 Most again Introduce a new quantifier Mx : for most x in the domain MxP (x) : most individuals are P [Mx : A(x)]B(x) is true in a structure if there are more individuals that are A and B than are A and B. Imagine we work with only finite structures: Show that [Mx : A(x)]B(x) cannot be paraphrased as: (a) Mx(A(x) B(x)) (b) Mx(A(x) B(x)) Show that (a) gives a weaker reading, and that (b) gives a stronger reading.
Introduction to Logic 46 Beyond FOL How to go beyond these expressive limitations? Use a more powerful logic: like Second Order Logic (SOL), in which we can quantify over properties (sets)! Problem : we lose some nice properties. Second-order logic, for instance, is not only undecidable, but even incomplete. It is also non-compact (since it can express finiteness of a domain).