General Resolution method in FOL

Slides:



Advertisements
Similar presentations
Completeness and Expressiveness
Advertisements

Resolution Proof System for First Order Logic
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.
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
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.
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.
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.
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.
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.
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.
General resolution Method1 General Resolution method in FOL Lesson 8.
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 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
2. The Logic of Compound Statements Summary
Introduction to Logic for Artificial Intelligence Lecture 2
Advanced Algorithms Analysis and Design
Knowledge Representation and Reasoning
Proposition & Predicates
Horn Clauses and Unification
Today’s Topics Universes of Discourse
Logics for Data and Knowledge Representation
Lesson 5 Relations, mappings, countable and uncountable sets
Natural deduction Gerhard Gentzen.
Principles of proof calculi Natural deduction
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
MA/CSSE 474 More Math Review Theory of Computation
Horn Clauses and Unification
CSE (c) S. Tanimoto, 2002 Unification
Horn Clauses and Unification
Encoding Knowledge with First Order Predicate Logic
Encoding Knowledge with First Order Predicate Logic
RESOLUTION.
Encoding Knowledge with First Order Predicate Logic
Resolution Proof System for First Order Logic
Herbrand Semantics Computational Logic Lecture 15
1st-order Predicate Logic (FOL)
Presentation transcript:

General Resolution method in FOL Lesson 8 24.11.2018 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 P1, …, Pn |= Q, iff the formula Q is true in all the models of the set of assumptions P1, …, Pn, i.e. iff |= (P1  …  Pn)  Q What follows from the assumptions? P1, …, Pn |= ? 24.11.2018 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 a lot of applications of 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 Proof Method for FOL (generalization of the resolution method for propositional logic) The input formula for the Rezolution method must be in the special conjunctive normal form, which is called Skolem clausal form a formula 24.11.2018 General resolution Method

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

General resolution Method In order to generalize the resolution method of propositional logic, there are two problems: Transformation into the Skolem clausal form: x1…xn [C1  …  Cm] where Ci are clauses, i.e., disjunctions of literals, e.g.: P(x)  Q(f(x,y)) 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. 24.11.2018 General resolution Method

Transformation into the clausal form (Skolem) Existential generalization (if there are free varaibles, then bind them by  (consistency rather than truth-preserving) Elimination of dispensable quantifiers Elimination of the connectives ,  (applying the laws of propositional logic) Moving negation inside (applying de Morgan laws) Renaming variables (so that each quantifier quantifies its own variables) Moving quantifiers to the right (applying the laws of FOL) Elimination of existential quantifiers (Skolemization – consistency preserving) Moving general quantifiers to the left Applying distributive laws 24.11.2018 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: 24.11.2018 General resolution Method

Resolution method – example P(x, f(x)) Q(y, g(y)) P(a,v)  Q(v,w) Now we have to apply the 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. Q(f(a),w) resolving 1., 3., substitution: x/a, v/f(a) resolving 2., 4., substitution: y/f(a), w/g(f(a)) QED – the negated formula is not satisfiable, it 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! 24.11.2018 General resolution Method

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: x1…xn [C1  …  Cm], a closed formula, where Ci are clauses, disjunctions of literals, e.g.: P(x)  Q(f(x,y)) Skolemization (elimination of existential quantifiers): x y1...yn A(x, y1,...,yn)  y1...yn A(c, y1,...,yn) where c is a new, in the language not used constant till now y1...yn x A(x, y1,...,yn)  y1...yn A(f(y1,...,yn), y1,...,yn) where f is a new, in the language not used functional symbol 24.11.2018 General resolution Method

Skolemization is consistency preserving y1...yn x A(x, y1,...,yn)  y1...yn A(f(y1,...,yn), y1,...,yn) B BS Proof: Let the structure I be a model of the formula BS (Skolemised). Then for any n-tuple of individuals i1, i2,…,in it holds that (n+1)-tuple of individuals i1, i2,…,in, fU (i1, i2,…,in)  AU, where fU is the function assigned to the symbol f (in the interpretation I) and AU 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 = y1y2…yn x A(x, y1, y2,…,yn). Hence every model of the formula BS is a model of the formula B, but not vice versa, ie BS |= B. The set of models MBS of the formula BS is a subset of the set of models MB of the formula B: MBS  MB. If MBS   (i.e., BS is satisfiable) then MB  , i.e., B is satisfiable as well. If MB = , i.e. B is not satisfiable, then MBS = , i.e., BS is not satisfiable, which is sufficient for the indirect proof. 24.11.2018 General resolution Method

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

Transformation into the Skolem clausal form A  AS: Existential generalization (consistency preserving) Elimination of dispensable quantifiers (that do not bind any variables – equivalent transformation) Elimination of ,  (applying the PL laws – equivalent transformation) Moving negation inside (applying de Morgan laws – equivalent transformation) Renaming variables (equivalent transformation) 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) Elimination of existential quantifiers (Skolemize the subformulas Qx B(x), Qx A(x) obtained in the step 6) Moving general quantifiers to the left (equivalent transformation) Applying distributive laws (equivalent transformation) 24.11.2018 General resolution Method

Transforming A  AS (Skolem) The resulting formula AS is not equivalent to the original formula A (nor does it follow from A), but it holds that if A has a model then AS has a model. It also holds that AS |= 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 24.11.2018 General resolution Method

General resolution Method Transformation: A  AS 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): negating the formula: x A(x)  x A(x), Renaming variables: x A(x)  y A(y), Moving quantifiers to the left: x [A(x)  y A(y)]  x y [A(x)  A(y)], and 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 do actually quantify. 24.11.2018 General resolution Method

General resolution Method Example: A  AS x {P(x)  z {y [Q(x,y)  P(f(x1))]  y [Q(x,y)  P(x)]}} 1.,2. Existential generalisation and elimination of z: x1 x {P(x)  {y [Q(x,y)  P(f(x1))]  y [Q(x,y)  P(x)]}} 3.,4. Renaming y, elimination of : x1 x {P(x)  {y [Q(x,y)  P(f(x1))]  z [Q(x,z)  P(x)]}} 5.,6. Negation moved inside, quantifiers to the right: x1 x {P(x)  {[y Q(x,y)  P(f(x1))]  [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))]} 24.11.2018 General resolution Method

The way of proving by resolution Proof of the logical validity of a formula A: Negate the formula A Transform A into the clausal Skolem form (A)S 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 P1,…,Pn | Z Negate Z Transform the assumptions and the negated conclusion into the Skolem clausal form Step-by-step apply the resolution rule (via unifying the literals) and try to prove the inconsistency of the set {P1,…,Pn, Z} 24.11.2018 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). 24.11.2018 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. 24.11.2018 General resolution Method

Unification of literals Up to now we voted for particular substitutions in order to unify literals in an ad hoc way, 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: Herbrand procedure (historically the first one) Robinson unification algorithm (currently used) 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. 24.11.2018 General resolution Method

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

General resolution Method Herbrand procedure Herbrand universe HF: 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 HA = {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 HB = {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. 24.11.2018 General resolution Method

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 HA = {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 24.11.2018 General resolution Method

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

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

Robinson’s algorithm (1965) Let A be a formula containing variables xi, i=1,2,...,n. Let us denote  ={x1/t1, x2/t2,...,xn/tn} the simultaneous substitution of terms ti for all the occurrences of variables xi 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. 24.11.2018 General resolution Method

Robinson’s algorithm (1965) It is the algorithm of finding the general unification: Assume that A = P(t1, t2,...,tn), B = P(s1,s2,...,sn), where (for the sake of simplicity) at least one of the terms ti, si is a variable. 1. For i = 1,2,...,n do: If ti = si then i =  (the empty substitution). If ti  si then check whether the terms ti, si are such that one of them is a variable, say x, and the other term, say r, does not contain this variable x. If Yes, then i = {x/r}. 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). 24.11.2018 General resolution Method

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

General resolution rule A  L1, B  L2  A  B where  is the general unification of L1, L2: L1 = L2 24.11.2018 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): 24.11.2018 General resolution Method

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)) P(x,y)  Q(x, f(g(x))) R(x)  Q(a, f(g(a))) R(b) P(z, g(z)) Q(x, f(g(x))) 1, 4: z/x, y/g(x) Q(a, f(g(a))) 2, 3: x/b 5, 6: x/a Note: Parent clauses to resolve are chosen in a way that leaves as much as possible variables free (for further substitutions) 24.11.2018 General resolution Method