Resolution Preliminaries Computational LogicLecture 9 By Prof. Michael Genesereth, Computer Science, Stanford Univ Spring 2005 Modified by Charles Ling.

Slides:



Advertisements
Similar presentations
Applications Computational LogicLecture 11 Michael Genesereth Spring 2004.
Advertisements

Artificial Intelligence 8. The Resolution Method
Resolution Proof System for First Order Logic
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
Standard Logical Equivalences
Resolution.
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.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
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)
Propositional Logic. Grammatical Complexity A natural language is complex. E.g. –The dog chased the cat. –The dog that ate the rat chased the cat. –The.
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Logic in Computer Science Transparency No Chapter 3 Propositional Logic 3.6. Propositional Resolution.
Inference and Resolution for Problem Solving
Logic in Computer Science Transparency No Chapter 3 Propositional Logic 3.6. Propositional Resolution 3.7. Natural Deduction.
Computational Logic General Game PlayingLecture 4 Michael Genesereth / Nat Love Spring 2006.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Chapter 3 Propositional Logic
Logic Programming Part 2: Semantics James Cheney CS 411.
Introduction to Logic for Artificial Intelligence Lecture 2 Erik Sandewall 2010.
CS1502 Formal Methods in Computer Science Lecture Notes 10 Resolution and Horn Sentences.
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.
Propositional Resolution Computational LogicLecture 4 Michael Genesereth Spring 2005.
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
UIUC CS 497: Section EA Lecture #3 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
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.
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.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
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 Early AI explored how to automate several reasoning tasks – these were solved by what we might call weak problem solving methods as.
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.
第 1 6 章 谓词演算中的归结. 2 Outline Unification Predicate-Calculus Resolution Completeness and Soundness Converting Arbitrary wffs to Clause Form Using Resolution.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
1 Introduction to Artificial Intelligence LECTURE 9: Resolution in FOL Theorem Proving in First Order Logic Unification Resolution.
Lecture 9: Resolution in First Order Logic Heshaam Faili University of Tehran Theorem Proving in First Order Logic Unification Resolution.
Automated Reasoning General Game PlayingLecture 3 Michael Genesereth Spring 2005.
Introduction to Logic for Artificial Intelligence Lecture 2
Resolution in the Propositional Calculus
Herbrand Resolution.
Relational Proofs Formal proofs in Relational Logic are analogous to formal proofs in Propositional Logic. The major difference is that there are additional.
Propositional Resolution
CS157 Greatest Hits The Top 100 Slides of the Course
Relational Proofs Computational Logic Lecture 8
Prolog IV Logic, condensed.
Back to “Serious” Topics…
Horn Clauses and Unification
Metatheorems Computational Logic Lecture 8
Relational Proofs Computational Logic Lecture 7
Logical Entailment Computational Logic Lecture 3
Horn Clauses and Unification
Relational Proofs Computational Logic Lecture 7
Properties of Relational Logic
Relational Proofs Computational Logic Lecture 7
Resolution Proof System for First Order Logic
Resolution Theorem Proving
Herbrand Semantics Computational Logic Lecture 15
Resolution Preliminaries
Presentation transcript:

Resolution Preliminaries Computational LogicLecture 9 By Prof. Michael Genesereth, Computer Science, Stanford Univ Spring 2005 Modified by Charles Ling. Use with permission

2 Resolution Principle The Resolution Principle is a rule of inference. Using the Resolution Principle alone (without axiom schemata or other rules of inference), it is possible to build a theorem prover that is sound and complete for all of Relational Logic. The search space using the Resolution Principle is much smaller than with standard axiom schemata.

3 Plan First Lecture: Unification Relational Clausal Form Second Lecture: Resolution Principle Resolution Theorem Proving Third Lecture: True or False Questions Fill in the Blank Questions Residue Fourth Lecture: Strategies to enhance efficiency

4 Clausal Form Relational resolution works only on expressions in clausal form. Fortunately, it is possible to convert any set of Relational Logic sentences into an equally satisfiable set of sentences in clausal form. Notice the notations used by this author, different from the textbook in many ways!

5 Clausal Form A literal is either an atomic sentence or a negation of an atomic sentence. A clausal sentence is either a literal or a disjunction of literals. A clause is a set of literals (interpreted as disjunction). {p(a)} {  p(a)} {p(a), q(b)} The empty clause {} is unsatisfiable.

6 Inseado Implications Out: Negations In:

7 Inseado (continued) Standardize variables Existentials Out (Outside in): Introductng Skolem constants and functions.

8 Inseado (continued) Alls Out Distribution

9 Inseado (continued) Operators Out

10 Example

11 Example

12 Example (continued)

13 Clausal Form Bad News: The result of converting a set of sentences is not necessarily logically equivalent to the original set of sentences. Why? Introduction of Skolem constants and functions. Good News: The result of converting a set of sentences is satisfiable if and only if the original set of sentences is satisfiable. Important because we use satisfiability to determine logical entailment.

14 Difficulty with Universal Instantiation

15 Substititions A substitution is a finite set of pairs of variables and terms, called replacements. {X  a, Y  f(b), V  W} The result of applying a substitution  to an expression  is the expression  obtained from  by replacing every occurrence of every variable in the substitution by its replacement. p(X,X,Y,Z){X  a,Y  f(b),V  W}=p(a,a,f(b),Z)

16 Cascaded Substitutions r{x,y,z}{x  a, y  f(u), z  v}=r{a,f(u),v} r{a,f(u),v}{u  d, v  e}=r(a,f(d),e) r{x,y,z}{x  a,y  f(d),z  e}=r(a,f(d),e)

17 Composition of Substitutions The composition of substitution  and  is the substitution (written compose( ,  ) or, more simply,  ) obtained by (1) applying  to the replacements in  (2) adding to  pairs from  with different variables (3) deleting any assignments of a variable to itself. {x  a, y  f(u), z  v}{u  d,v  e,z  g} ={x  a,y  f(d),z  e}{u  d,v  e,z  g} ={x  a,y  f(d),z  e,u  d,v  e}

18 Unification A substitution  is a unifier for an expression  and an expression  if and only if  = . p(X,Y){X  a,Y  b,V  b}=p(a,b) p(a,V){X  a,Y  b,V  b}=p(a,b) If two expressions have a unifier, they are said to be unifiable. Otherwise, they are nonunifiable. p(X,X) p(a,b)

19 Non-Uniqueness of Unification Unifier 1: p(X,Y){X  a,Y  b,V  b}=p(a,b) p(a,V){X  a,Y  b,V  b}=p(a,b) Unifier 2: p(X,Y){X  a,Y  f(W),V  f(W)}=p(a,f(W)) p(a,V){X  a,Y  f(W),V  f(W)}=p(a,f(W)) Unifier 3: p(X,Y){X  a,Y  V}=p(a,V) p(a,V){X  a,Y  V}=p(a,V)

20 Most General Unifier A substitution  is a most general unifier (mgu) of two expressions if and only if it is as general as or more general than any other unifier. Theorem: If two expressions are unifiable, then they have an mgu that is unique up to variable permutation. p(X,Y){X  a,Y  V}=p(a,V) p(a,V){X  a,Y  V}=p(a,V) p(X,Y){X  a,V  Y}=p(a,Y) p(a,V){X  a,V  Y}=p(a,Y) (May omit the next few slides on how to find mgu. Usually easy to see in simple proof).

21 Expression Structure Each expression is treated as a sequence of its immediate subexpressions. Linear Version: p(a, f(b, c), d) Structured Version: car cdr pad fbc

22 Most General Unification function mgu (x, y, s) {if x = y then s else if varp(x) then mguvar(x, y, s) else if atom(x) then {if varp(y) then mguvar(y, x, s) else if atom(y) then if x = y then s} else if varp(y) then mguvar(y, x, s) else if atom(y) then false else if s  mgu(car(x),car(y), s) then mgu(cdr(x), cdr(y), s)} function mguvar (x, y, s) {var dum; if dum  assoc(x, s) then mgu(right(dum), y, s) else compose(s,{x  plug(y,s)})}

23 Example Call: mgu( p(X,b), p(a,Y), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( X, a, {} ) Exit: {X  a} Call: mgu( b, Y, {X  a} ) Exit: {X  a,Y  b}

24 Example Call: mgu( p(X,X), p(a,b), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( X, a, {} ) Exit: {X  a} Call: mgu( X, b, {X  a} ) Call: mgu( a, b, {X  a} ) Exit: false

25 Example Call: mgu( p(f(X),f(X)), p(Y,f(a)), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( f(X), Y, {} ) Exit: {Y  f(X)} Call: mgu( f(X), f(a), {Y  f(X)} ) Call: mgu( f, f, {Y  f(X)} ) Exit: {Y  f(X)} Call: mgu( X, a, {Y  f(X)} ) Exit: {Y  f(a),X  a}

26 Example Call: mgu( p(X,X), p(Y,f(Y)), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( X, Y, {} ) Exit: {X  Y} Call: mgu( X, f(Y), {X  Y} ) Call: mgu( Y, f(Y), {X  Y} ) Exit: {X  f(Y),Y  f(Y)}

27 Problem Circularity Problem: {X  f(Y),Y  f(Y)} Unification Problem: p(X,X){X  f(Y),Y  f(Y)}=p(f(Y),f(Y)) p(Y,f(Y)){X  f(Y),Y  f(Y)}=p(f(Y),f(f(Y))) Semantic Problem: ~hates(X,X) hates(Y,f(Y))

28 Solution Before assigning a variable to an expression, first check that the variable does not occur within that expression. This is called, oddly enough, the occur check test. Prolog does not do the occur check (and is proud of it).

29 Most General Unification (revised) function mguvar (x, y, s) {var dum; if dum  assoc(x, s) then mgu(right(dum), y, s) else if mguchkp(x, y, s) then false else compose(s,{x  plug(y,s)})} function mguchkp (p, q, s) {if p=q then true else if varp(p) then mguchkp(p, right(assoc(q, s)), s) else if atom(q) then false else some(lambda(x).mguchkp(p,x,s),q)}

30 Example Call: mgu( p(X,X), p(Y,f(Y)), {} ) Call: mgu( p, p, {} ) Exit: {} Call: mgu( X, Y, {} ) Exit: {X  Y} Call: mgu( X, f(Y), {X  Y} ) Call: mgu( Y, f(Y), {X  Y} ) Exit: false

Resolution Theorem Proving Computational LogicLecture 10 Michael Genesereth Spring 2005

32 Plan First Lecture: Unification Relational Clausal Form Second Lecture: Resolution Principle Resolution Theorem Proving Third Lecture: True or False Questions Fill in the Blank Questions Residue Fourth Lecture: Strategies to enhance efficiency

33 Propositional Resolution

34 Relational Resolution I

35 Example

36 Example

37 Example Everybody loves somebody. Everybody loves a lover. Show that everybody loves everybody.

38 Example (continued)

39 Example (concluded)

40 Harry and Ralph Every horse can outrun every dog. Some greyhound can outrun every rabbit. Show that every horse can outrun every rabbit.

41 Harry and Ralph (continued)

42 Harry and Ralph (continued)

43 Harry and Ralph (concluded)

44 Example Given:  x.  y.(p(x,y)  q(x,y))  x.  y.(p(x,y)  q(x,y)) Prove:  x.  y.(p(x,y)  q(x,y))

45 Example (continued)  x.  y.(p(x,y)  q(x,y))  x.  y.((  p(x,y)  q(x,y))  ( p(x,y)   q(x,y))) (  p(a,y)  q(a,y))  ( p(a,y)   q(a,y)) {  p(a,y), q(a,y)} {p(a,y),  q(a,y)}  x.  y.(p(x,y)  q(x,y)) p(x, f(x))  q(x, f(x)) {p(a,f(x)), q(a,f(x))}

46 Example (continued) Negate the goal:  x.  y.(p(x,y)  q(x,y))   x.  y.(p(x,y)  q(x,y)) Convert to Clausal Form:  x.  y.(p(x,y)  q(x,y))  x.  y.  (p(x,y)  q(x,y))  x.  y.(  p(x,y)   q(x,y))  p(x,y)   q(x,y) {  p(x,y),  q(x,y)}

47 Example (concluded) 1. {  p(a,y), q(a,y)}Premise 2. {p(a,y),  q(a,y)}Premise 3. {p(x, f(x)), q(x, f(x))}Premise 4. {  p(x,y),  q(x,y)}Negated Goal 5. {q(a, f(a))}1, 3 6. {p(a, f(a))}2, 3 7. {  p(a, f(a))}4, 5 8. {}6, 7

48 Problem

49 Relational Resolution II

50 Example

51 Problem Without Renaming 1. {r(a,b,u1)}Premise 2. {r(b,c,u2)}Premise 3. {r(c,d,u3)}Premise 4. {r(x,z,f(v)),  r(x,y,f(f(v))),  r(y,z,f(f(v)))}Premise 5. {  r(a,d,w)}Goal 6. {r(a,z,f(v)),  r(b,z,f(f(v)))}1,4 7. {  r(b,d,f(f(v)))}5,6 8. {  r(a,y,f(f(v))),  r(y,d,f(f(v)))}4,5 9. {  r(b,d,f(f(v)))}1,8

52 Solution With Renaming 1. {r(a,b,u1)}Premise 2. {r(b,c,u2)}Premise 3. {r(c,d,u3)}Premise 4. {r(x,z,f(v)),  r(x,y,f(f(v))),  r(y,z,f(f(v)))}Premise 5. {  r(a,d,w)}Goal 6. {  r(a,y6,f(f(v6))),  r(y6,d,f(f(v6)))}4,5 7. {  r(b,d,f(f(v7)))}1,6 8. {  r(b,y8,f(f(f(v8)))),  r(y8,d,f(f(f(v8))))}4,7 9. {  r(c,d,f(f(f(v9))))}2,8 10. {}3,9

53 Problem

54 Factors If a subset of the literals in a clause  has a most general unifier , then the clause  ' obtained by applying  to  is called a factor of . Clause {p(x),p(f(y)),r(x,y)} Factors {p(f(y)),r(f(y),y)} {p(x),p(f(y)),r(x,y)}

55 Relational Resolution III (Final Version)

56 Example

57 Need for Original Clauses 1. {p(a,y), p(x,b)}Premise 2. {  p(a,d)}Premise 3. {  p(c,b)}Premise 4. {p(x,b)}1,2 5. {}3,4 1. {p(a,y), p(x,b)}Premise 2. {  p(a,d)}Premise 3. {  p(c,b)}Premise 4. {p(a,b)}Factor of 1

58 Provability A resolution derivation of a clause  from a set  of clauses is a sequence of clauses terminating in  in which each item is (1) a member of  or (2) the result of applying the resolution to earlier items. A sentence  is provable from a set of sentences  by resolution if and only if there is a derivation of the empty clause from the clausal form of  {  }. A resolution proof is a derivation of the empty clause from the clausal form of the premises and the negation of the desired conclusion.

59 Soundness and Completeness Metatheorem: Provability using the Relational Resolution Principle is sound and complete for Relational Logic (without equality).