Presentation is loading. Please wait.

Presentation is loading. Please wait.

25.12.2015General resolution Method1 General Resolution method in FOL Lesson 8.

Similar presentations


Presentation on theme: "25.12.2015General resolution Method1 General Resolution method in FOL Lesson 8."— Presentation transcript:

1 25.12.2015General resolution Method1 General Resolution method in FOL Lesson 8

2 General resolution Method2 25.12.2015 Typical problems to solve  Proving logical validity of a formula: Formula F is logically valid, denoted |= F, iff F is true in all interpretations, i.e., every interpretation structure is its model  Proving the validity of an argument: An argument is valid, denoted P 1, …, P n |= Q, iff the formula Q is true in all the models of the set of assumptions P 1, …, P n  What follows from the assumptions? P 1, …, P n |= ?

3 General resolution Method3 25.12.2015 Typical problems, tasks  Their solution by examining the infinite set of models is difficult; it is not possible to automatize semantic proofs  Therefore we look for syntactic (mechanic) methods of proving  One of them is the method of semantic tableau based on the transformation of a formula into its disjunctive normal form (disadvantage: we often need to perform many transformations using the distributive laws)  Now we are going to learn a very effective method that is used also for automatic theorem proving and programming in logic: the resolution method for FOL (generalization of the resolution method for propositional logic)  Rezolution method makes use of the conjunctive normal form of a formula

4 25.12.2015 General resolution Method 4 Resolution method  It is applicable to a formula in the special kind of the conjunctive normal form: Skolem clausal form  It makes use of the indirect proof  It serves as a theoretical foundation for automatic theorem proving and logic programming;  In particular for the programming language PROLOG

5 25.12.2015 General resolution Method 5 Resolution method In order to generalize the resolution method of propositional logic, there are two problems: 1) Transformation into the Skolem clausal form: x 1 …x n [C 1  …  C m ] where C i are clauses, i.e., disjunctions of literals, e.g.: P(x)  Q(f(x,y)) 2) In order to apply the resolution rule on a pair of a positive and negative literals, the literals have to be identical; we have to unify them. For instance: P(x)  Q(f(x),y) P(g(y))  Q(x,z) The literals P(x), P(g(y)) might have been eliminated, if they were identical; we have to unify them by substituting g(y) for x.

6 25.12.2015 General resolution Method 6 Transformation into the clausal form (Skolem) 1. Existential generalization (if there are free varaibles, then bind them by  (consistency preserving) 2. Elimination of dispensable quantifiers 3. Elimination of the connectives ,  4. Moving negation inside (applying de Morgan laws) 5. Renaming variables 6. Moving quantifiers to the right 7. Elimination of existential quantifiers (Skolemization – consistency preserving) 8. Moving general quantifiers to the left 9. Applying distributive laws

7 General resolution Method 7 25.12.2015 Resolution method – example. |= [  x  y P(x,y)   y  z Q(y,z)]   x  y  z [P(x,y)  Q(y,z)] 1. Negating the formula and variables renaming: [  x  y’ P(x,y’)   y  z Q(y,z)]   u  v  w [  P(u,v)   Q(v,w)] 2. Elimination of existential quantifiers. MIND ! [  x P(x, f(x))   y Q(y, g(y))]   v  w [  P(a,v)   Q(v,w)] 3. Moving the quantifiers to the left:  x  y  v  w [P(x, f(x))  Q(y, g(y))  [  P(a,v)   Q(v,w)]] 4. The formula is obviously not satisfiable; how to prove it? 5. Write down the clauses and perform the unification of literals, i.e., substitute appropriate terms for variables, so that to be able to apply the resolution rule:

8 General resolution Method 8 25.12.2015 Resolution method – example 1. P(x, f(x)) 2. Q(y, g(y)) 3.  P(a,v)   Q(v,w) Now we have to apply resolution rule. In order to resolve clauses 1. and 3., we have to substitute the term a for the variable x and the term f(a) for variable v. 4.  Q(f(a),w)resolving 1., 3., substitution: x/a, v/f(a) 5. resolving 2., 4., substitution: y/f(a), w/g(f(a)) QED – the negated formula is a contradiction, which means that the original formula is logically valid Note: When unifying the literals, it is necessary to substitute for all the occurrences of a variable!

9 General resolution Method 9 25.12.2015 Skolem clausal form Literal: atomic formula or the negation of an atomic formula. Examples: P(x, g(y)),  Q(z) Clause: disjunction of literals, e.g.: P(x, g(y))   Q(z) Skolem clausal form:  x 1 …  x n [C 1  …  C m ], a closed formula, where C i are clauses, disjunctions of literals, e.g.: P(x)   Q(f(x,y)) Skolemization (elimination of existential quantifiers):  x  y 1...  y n A(x, y 1,...,y n )   y 1...  y n A(c, y 1,...,y n ) where c is a new, in the language not used constant  y 1...  y n  x A(x, y 1,...,y n )   y 1...  y n A(f(y 1,...,y n ), y 1,...,y n ) where f is a new, in the language not used functional symbol

10 General resolution Method 10 25.12.2015 Skolemization is consistency preserving  y 1...  y n  x A(x, y 1,...,y n )   y 1...  y n A(f(y 1,...,y n ), y 1,...,y n ) BBSBBS Proof: Let the structure I be a model of the formula B S (Skolemised). Then for any n-tuple of individuals i 1, i 2,…,i n it holds that (n+1)-tuple of individuals  i 1, i 2,…,i n, f U (i 1, i 2,…,i n )   A U, where f U is the function assigned to the symbol f (in the interpretation I ) and A U is the relation defined by the formula A in the interpretation I. Then the interpretation structure I is also a model of the formula B =  y 1  y 2 …  y n  x A(x, y 1, y 2,…,y n ). Hence every model of the formula B S is a model of the formula B, but not vice versa, ie B S |= B. The set of models M BS of the formula B S is a subset of the set of models M B of the formula B: M BS  M B. If M BS   (i.e., B S is satisfiable) then M B  , i.e., B is satisfiable as well. If M B = , i.e. B is not satisfiable, then M BS = , i.e., B S is not satisfiable, which is sufficient for the indirect proof.

11 General resolution Method 11 25.12.2015 Thoralf Albert Skolem Born: 23 May 1887 in Sandsvaer, Buskerud, Norway Died: 23 March 1963 in Oslo, Norway Skolem was remarkably productive publishing around 180 papers on topics such as Diophantine equations, mathematical logic, group theory, lattice theory and set theory Diophantine equations group theory

12 General resolution Method 12 25.12.2015 Transformation into the Skolem clausal form A  A S : 1. Existential generalization (consistency preserving) 2. Elimination of dispensable quantifiers (that do not bind any variables – equivalent transformation) 3. Elimination of ,  (applying the PL laws – equivalent transformation) 4. Moving negation inside (applying de Morgan laws – equivalent transformation) 5. Renaming variables (equivalent transformation) 6. Moving quantifiers to the right (equivalent transformation): Qx (A @ B(x))  A @ Qx B(x), Qx (A(x) @ B)  Qx A(x) @ B, where @ is a conjunction or disjunction connective, Q is a quantifier (general or existential) 7. Elimination of existential quantifiers (Skolemize the subformulas Qx B(x), Qx A(x) obtain in the step 6) 8. Moving general quantifiers to the left (equivalent transformation) 9. Applying distributive laws (equivalent transformation)

13 General resolution Method 13 25.12.2015 Transforming A  A S (Skolem) The resulting formula A S is not equivalent to the original formula A (nor does it follow from A), but it holds that if A has a model then A S has a model. It also holds that A S |= A, but the two formulas are not equivalent. The non-equivalent steps are:  Existential generalisation  Skolemization (elimination of existential quantifiers) This is the reason why the resolution method is used as an indirect proof. It can be used for a direct proof only if the assumptions do not contain any existential quantifier

14 General resolution Method 14 25.12.2015 Transformation: A  A S Always follow the above Skolem algorithm (9 steps). Some of them can be omitted, but do not transform into the conjunctive normal form first, and then Skolemize (as you can sometimes read). In other words, do not omit the step 6. Example: the importance of the step 6 (quantifiers to the right – moved to the subformulas containing the quantified variables). We will illustrate an erroneous practice of omitting the step 6 by (not) proving that |=  x A(x)   x A(x): 1. negating the formula:  x A(x)   x  A(x), 2. Renaming variables:  x A(x)   y  A(y), 3. Moving quantifiers to the left: 4.  x [A(x)   y  A(y)]   x  y [A(x)   A(y)], and 5. Skolemize:  x [A(x)   A(f(x))]. But the terms x and f(x) cannot be unified! Thus we did not prove the above tautology, though the resolution method is a complete proof method. Each logically valid formula is provable: |= A  |  A The problem consists in the fact that we Skolemized after moving quantifiers to the left. We have to do it before, when the quantifiers are to the right – at the subformulas that they actually quantify.

15 General resolution Method 15 25.12.2015 Example: A  A S  x {P(x)   z {  y [Q(x,y)  P(f(x 1 ))]   y [Q(x,y)  P(x)]}} 1.,2. Existential generalisation and elimination of  z:  x 1  x {P(x)  {  y [Q(x,y)  P(f(x 1 ))]   y [Q(x,y)  P(x)]}} 3.,4. Renaming y, elimination of  :  x 1  x {  P(x)  {  y [  Q(x,y)  P(f(x 1 ))]   z [  Q(x,z)  P(x)]}} 5.,6. Negation moved inside, quantifiers to the right:  x 1  x {  P(x)  {[  y Q(x,y)   P(f(x 1 ))]  [  z  Q(x,z)  P(x)]}} 7. Elimination of the existential quantifiers:  x {  P(x)  {[Q(x,g(x))   P(f(a))]  [  z  Q(x,z)  P(x)]}} 8. Quantifier  z moved to the left:  x  z {  P(x)  {[Q(x,g(x))   P(f(a))]  [  Q(x,z)  P(x)]}} 9. Distributive law:  x  z {[  P(x)  Q(x,g(x))]  [  P(x)   P(f(a))]  [  P(x)   Q(x,z)  P(x)]} 10. simplifying:  x {[  P(x)  Q(x,g(x))]  [  P(x)   P(f(a))]}

16 General resolution Method 16 25.12.2015 The way of proving by resolution Proof of the logical validity of a formula A: 1. Negate the formula A 2. Transform  A into the clausal Skolem form (  A) S 3. Step-by-step apply the resolution rule (via unifying the literals) and try to prove that the formula (  A) S is not satisfiable, hence also the formula  A does not have a model, which means that A is logically valid. Proof of the validity of an argument P 1,…,P n |  Z 1. Negate Z 2. Transform the assumptions and the negated conclusion into the Skolem clausal form 3. Step-by-step apply the resolution rule (via unifying the literals) and try to prove the inconsistency of the set {P 1,…,P n,  Z}

17 General resolution Method 17 25.12.2015 Unification of literals Example:  x  y  z  v [P(x, f(x))  Q(y, h(y))  (  P(a, z)   Q(z, v))] How to prove that the formula does not have a model? 1. P(x, f(x)) 2. Q(y, h(y)) 3.  P(a, z)   Q(z, v) Now if we want to resolve the respective clauses; but there are no identical terms in the respective pairs of literals. However, all the variables are bound by the general quantifier. Hence we can apply the law of specialization, and thus substitute terms for variables in order to find the witness of inconsistency: In order to unify literals of 1 and 3, we use the substitution x/a, z/f(a).

18 General resolution Method 18 25.12.2015 Unification of literals After substituting we obtain the following clauses: 1’. P(a, f(a)) 2. Q(y, h(y)) 3‘.  P(a, f(a))   Q(f(a), v) Now resolving 1‘ and 3‘ we obtain: 4.  Q(f(a), v) Now in order to resolve 2. and 4., we again use a substitution: y/f(a), v/h(f(a)) and get 2‘. Q(f(a), h(f(a)) ) 4’.  Q(f(a), h(f(a)) ) 5. By resolving 2’, 4’ we obtain an empty clause that does not have a model. Hence the original formula A does not have a model, it is a contradiction.

19 General resolution Method 19 25.12.2015 Unification of literals Up to now we sought particular substitutions in order to unify literals ad hoc, intuitively looking for opposite “similar” literals We need to find an algorithm of unification. There are many such algorithms, we will examine two of them: a) Herbrand procedure b) Robinson unification algorithm Ad (a) A formula F is not satisfiable iff it is not true in any interpretation structure, over any universe of discourse. It might be useful to find just one universe such that F is a contradiction iff F is not satisfiable over any interpretation structure over this universe. Is there any such universe? Yes, it was discovered by Herbrand, and it is called Herbrand’s universe.

20 General resolution Method 20 25.12.2015 Jacques Herbrand Born: 12 Feb 1908 in Paris, France Died: 27 July 1931 in La Bérarde, Isère, France École Normale Supérieure at the age of 17 (!) His doctoral thesis was approved in April 1929 On a holiday in the Alps he died in a mountaineering accident at the age of 23

21 General resolution Method 21 25.12.2015 Herbrand procedure Herbrand universe H F : consists of all the possible terms made up from the constants and functional symbols occurring in the formula; if there is no constant in the formula, then use any constant. Example: For the formula A =  x [P(a)  Q(b)  P(f(x))] the H A = {a, b, f(a), f(b), f(f(a)), f(f(b)), …} For the formula B =  x  y P( (f(x), y, g(x,y) ) the H B = {a, f(a), g(a,a), f(f(a)), g(a,f(a)), g(f(a),a), …} Basic instances of a clause: all the variables are substituted for by the elements of Herbrand universe Theorem (Herbrand): A formula A in the Skolem clausal form is not satisfiable iff there is a finite conjunction of its basic instances that is not satisfiable.

22 General resolution Method 22 25.12.2015 Herbrand procedure Example: 1. P(x, f(x)) 2. Q(y, h(y)) 3.  P(a, z)   Q(z, v) Here the H A = {a, f(a), h(a), f(f(a)), f(h(a)), h(f(a)), h(h(a)), …}. Now we create basic instances, substituting elements of (the ordered) Herbrand universe for variables: Substitution 1: {x/a, y/a, z/a, v/a} P(a, f(a))  Q(a, h(a))  [  P(a, a)   Q(a, a)] Substitution 2: {x/a, y/a, z/a, v/f(a)} P(a, f(a))  Q(a, h(a))  [  P(a, a)   Q(a, f(a))] etc., till we find Substitution n: {x/a, y/f(a), z/f(a), v/h(f(a))} P(a,f(a))  Q(f(a),h(f(a)))  [  P(a,f(a))   Q(f(a),h(f(a)))] Contradiction

23 General resolution Method 23 25.12.2015 Herbrand Procedure Herbrand procedure is a method that partially decides whether a given formula F is a contradiction; if F is a contradiction then Herbrand procedure answers YES after a finite number of steps, otherwise it may not answer at all. (One of the corollaries of Gödel’s theorem; there is no procedure that would decide it totally.) Problem: Space and time complexity of the algorithm; the number of basic instances we need to generate till we find the witness of contradiction is often to large to be computationally tractable.

24 General resolution Method 24 25.12.2015 John Alan Robinson In his 1965 article "A Machine-Oriented Logic Based on the Resolution Principle" John Alan Robinson laid an important foundation for a whole branch of automated deduction systems. The original Prolog is essentially a refined automated theorem prover based on Robinson's resolutionA Machine-Oriented Logic Based on the Resolution Principle Prolog

25 General resolution Method 25 25.12.2015 Robinson’s algorithm (1965) Let A be a formula containing variables x i, i=1,2,...,n. Let us denote  ={x 1 /t 1, x 2 /t 2,...,x n /t n } the simultaneous substitution of terms t i for all the occurrences of variables x i for i=1,2,...,n. Then let A  be the formula that arises from A by performing the substitution . Unification (unification substitution) of formulas A, B is the substitution  such that A  = B . The general unification of formulas A, B is the unification  such that any other unification  of formulas A, B it holds that  =  (where   , it is not an empty substitution); in other words, the general unification leaves as much as possible variables free.

26 General resolution Method 26 25.12.2015 Robinson’s algorithm (1965) It is the algorithm of finding the general unification: Assume that A = P(t 1, t 2,...,t n ), B = P(s 1,s 2,...,s n ), where (for the sake of simplicity) at least one of the terms t i, s i is a variable. 1.For i = 1,2,...,n do: a) If t i = s i then  i =  (the empty substitution). b) If t i  s i then check whether the terms t i, s i are such that one of them is a variable, say x, and the other term, say r, does not contain this variable x. c) If Yes, then  i = {x/r}. d) If No, then finish the cycle: the formulas A, B are not unifiable. 2.If the cycle were not finished by the exception ad (d), then A, B are unifiable, and the general unification  =  1  2...  n (the composed substitution).

27 General resolution Method 27 25.12.2015 Robinson’s algorithm Example: A = P  x, f(x), u , B = P  y, z, g(x,y)   1 = {x/y}, A  1 = P(y, f(y), u , B  1 = P  y, z, g(y,y)   2 = {z/f(y)}, A  1  2 = P(y, f(y), u , B  1  2 = P  y, f(y), g(y,y)   3 = {u/g(y,y)}, A  1  2  3 = P(y, f(y), g(y,y) , B  1  2  3 = P  y, f(y), g(y,y) . The composed substitution  =  1  2  3 is the general unification of the formulas A, B: {x/y, z/f(y), u/g(y,y)}

28 General resolution Method 28 25.12.2015 General resolution rule A  L 1, B   L 2  A   B  where  is the general unification of L 1, L 2 : L 1  = L 2 

29 General resolution Method 29 25.12.2015 Example: prove the logical validity of  x  y [{P(x,y)  Q(x, f(g(x)))}  {R(x)   x  Q(x, f(g(x)))}   x  R(x)]   x  P(x, g(x)) 1. Negate the formula:  x  y [{P(x,y)  Q(x, f(g(x)))}  {R(x)   x  Q(x, f(g(x)))}   x  R(x)]   x P(x, g(x)) 2. Eliminate existential quantifiers, and rename the variables:  x  y [{P(x,y)  Q(x, f(g(x)))}  {R(x)   Q(a, f(g(a)))}   R(b)]   z P(z, g(z)) 3. Write down the clauses (after eliminating the implication):

30 General resolution Method 30 25.12.2015 Example  x  y [{P(x,y)  Q(x, f(g(x)))}  {R(x)   Q(a, f(g(a)))}   R(b)]   z P(z, g(z)) 1.  P(x,y)  Q(x, f(g(x))) 2. R(x)   Q(a, f(g(a))) 3.  R(b) 4. P(z, g(z)) 5. Q(x, f(g(x)))1, 4: z/x, y/g(x) 6.  Q(a, f(g(a)))2, 3: x/b 7. 5, 6:x/a Note: Parent clauses to resolve are chosen in such a way that leaves as much as possible variables free (for further substitutions)


Download ppt "25.12.2015General resolution Method1 General Resolution method in FOL Lesson 8."

Similar presentations


Ads by Google