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

Slides:



Advertisements
Similar presentations
Completeness and Expressiveness
Advertisements

Resolution Proof System for First Order Logic
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
Standard Logical Equivalences
Resolution.
Automated Reasoning Systems For first order Predicate Logic.
First Order Logic Resolution
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
Logic seminar 5 The resolution principle Slobodan Petrović.
Inference and Resolution for Problem Solving
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
CSE (c) S. Tanimoto, 2007 Unification 1 Unification Predicate calculus rules are sometimes so general that we need to create specializations of.
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
Introduction to Logic for Artificial Intelligence Lecture 2 Erik Sandewall 2010.
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Relation, function 1 Mathematical logic Lesson 5 Relations, mappings, countable and uncountable sets.
Introduction to Logic1 Introduction to Logic 3. lecture Propositional Logic Continuing Marie Duží.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Advanced Topics in FOL Chapter 18 Language, Proof and Logic.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
1st-order Predicate Logic (FOL)
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
1 Chapter 8 Inference and Resolution for Problem Solving.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
First Order Predicate Logic
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Lecture 4: Predicates and Quantifiers; Sets.
Scope, free variable, closed wff §In  X(A) or  X(A), where A is a wff : X is called the variable quantified over; A is said to be (within) the scope.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Automated Reasoning Systems For first order Predicate Logic.
Automated reasoning with propositional and predicate logics Spring 2007, Juris Vīksna.
1 Section 9.1 Automatic Reasoning Recall that a wff W is valid iff ¬ W is unsatisfiable. Resolution is an inference rule used to prove unsatisfiability.
CSE (c) S. Tanimoto, 2008 Predicate Calculus II 1 Predicate Calculus 2 Outline: Unification: definitions, algorithm Formal interpretations and satisfiability.
1/5/2016Hilbertův kalkul1 Lecture 12 Hilbert-like calculus.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
1 Hojjat Ghaderi, University of Toronto, Fall 2006 CSC384: Intro to Artificial Intelligence Knowledge Representation III ● Required Readings: 9.1, 9.2,
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
1 Introduction to Artificial Intelligence LECTURE 9: Resolution in FOL Theorem Proving in First Order Logic Unification Resolution.
Introduction to Logic for Artificial Intelligence Lecture 2
Horn Clauses and Unification
General Resolution method in FOL
Lesson 5 Relations, mappings, countable and uncountable sets
Natural deduction Gerhard Gentzen.
1st-order Predicate Logic (FOL)
Lesson 5 Relations, mappings, countable and uncountable sets
Horn Clauses and Unification
Horn Clauses and Unification
CSE (c) S. Tanimoto, 2004 Unification
CSE S. Tanimoto Unification
Horn Clauses and Unification
CSE (c) S. Tanimoto, 2002 Unification
Horn Clauses and Unification
Resolution Proof System for First Order Logic
1st-order Predicate Logic (FOL)
Presentation transcript:

General resolution Method1 General Resolution method in FOL Lesson 8

General resolution Method 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 |= ?

General resolution Method 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

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

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.

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

General resolution Method 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:

General resolution Method 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!

General resolution Method 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

General resolution Method 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.

General resolution Method 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

General resolution Method 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 B(x))  Qx B(x), Qx B)  Qx B, 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)

General resolution Method 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

General resolution Method 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.

General resolution Method 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))]}

General resolution Method 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}

General resolution Method 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).

General resolution Method 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.

General resolution Method 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.

General resolution Method 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

General resolution Method 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.

General resolution Method 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

General resolution Method 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.

General resolution Method 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

General resolution Method 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.

General resolution Method 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).

General resolution Method 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)}

General resolution Method 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 

General resolution Method 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):

General resolution Method 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)