resolution and refutation resolution and refutation
play

Resolution and Refutation Resolution and Refutation York University - PowerPoint PPT Presentation

Resolution and Refutation Resolution and Refutation York University CSE 3401 Vida Movahedi 1 York University CSE 3401 V. Movahedi 04_Resolution Overview Overview Propositional Logic p g Resolution Refutation Predicate


  1. Resolution and Refutation Resolution and Refutation York University CSE 3401 Vida Movahedi 1 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  2. Overview Overview • Propositional Logic p g – Resolution – Refutation • Predicate Logic – Substitution – Unification – Resolution – Refutation – Search space p [ref.: Nilsson ‐ Chap.3] [also Prof Zbigniew Stachniak’s notes] [also Prof. Zbigniew Stachniak s notes] 2 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  3. Theorems from Logic Theorems from Logic [from Mathematical Logic, George Tourlakis] [from Mathematical Logic, George Tourlakis] • Modus Ponens • Cut Rule • Transitivity of � Transitivity of � • Proof by Contradiction 3 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  4. Resolution in Logic Resolution in Logic • By A. Robinson (1965) By A. Robinson (1965) • Example: Prove • We need to show that the following set in inconsistent: 4 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  5. Resolution in Logic Programming Resolution in Logic Programming • Program P (facts and rules in clause form) Program P (facts and rules in clause form) • Goal G negated and added to program P + ¬ { G } • To prove G, we need to show is inconsistent P Complementary literals q, t : ‐ p. , p: ‐ s. Parent clauses Resolving upon p, being on different sides of : ‐ q, t : ‐ s. Resolvent 5 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  6. Example (1) Example (1) • Program P={q: ‐ . , p: ‐ q.} Program P {q: . , p: q.} • Query : ‐ p. – This is already the negated form of our goal! – This is already the negated form of our goal! q: ‐ . p: ‐ q. : ‐ p. : ‐ q. : ‐ empty clause, inconsistency p y , y therefore p is satisfiable � true 6 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  7. Refutation Refutation • When resolution is used to prove inconsistency, it is When resolution is used to prove inconsistency, it is called refutation. (refute=disprove) • The above binary tree showing resolution and • The above binary tree, showing resolution and resulting in the empty clause, is called a refutation tree. t ee • NOTE: To avoid potential mistakes, DO NOT RESOLVE UPON MORE THAN ONE LITERAL SIMULTANEOUSLY UPON MORE THAN ONE LITERAL SIMULTANEOUSLY. 7 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  8. Example (2) Example (2) A1. If Henry has two days off, then if the weather is bad, Henry is not fishing. A2. if Henry is not fishing and is not drinking in a pub with his friends then he is watching TV at home friends, then he is watching TV at home. A3. If Henry is working, then he is neither drinking in a pub with his friends nor watching TV at home. g Q. If Henry is not watching TV at home and he has two days off, then he is drinking in a pub with his friends provided that the weather is bad. 8 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  9. Example (2) (cont.) Example (2) (cont.) • From logical point of view, we want to prove Q, given From logical point of view, we want to prove Q, given A1, A2, A3. { 1 , 2 , 3 } . A A A Q • By refutation principle the consistency of • By refutation principle, the consistency of = ¬ { 1 , 2 , 3 } { } U C A A A Q is examined. is examined – Step 1: Represent as propositional formulas – Step 2: Represent as clauses Step 2: Represent as clauses – Step 3: Determine the consistency of C • If C is consistent, answer NO (false) • If C is inconsistent, answer YES (true) If C i i i t t YES (t ) 9 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  10. Example (2) (cont.) Example (2) (cont.) A1. If Henry has two days off, then if the p: H has two days off p y weather is bad, Henry is not fishing. q: weather is bad r: H is fishing A2. if Henry is not fishing and is not drinking s: H is drinking in a pub with in a pub with his friends, then he is p , his friends watching TV at home. t: H is watching TV at home A3. If Henry is working, then he is neither u: H is working drinking in a pub with his friends nor drinking in a pub with his friends nor watching TV at home. A1. p ‐ >(q ‐ >~r) A2. (~r & ~s) ‐ > t A3. u ‐ > ( s & t) A3 u > (~s & ~t) Q If H Q.If Henry is not watching TV at home and i hi TV h d he has two days off, then he is drinking in Q. (~t & p) ‐ > (q ‐ >s) a pub with his friends provided that the weather is bad. th i b d 10 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  11. Example (2) (cont.) Example (2) (cont.) • Conversion to clause form Conversion to clause form → → ¬ ⇒ ¬ ∨ ¬ ∨ ¬ ⇒ = − 1 : ( ) : , , . A p q r p q r C p q r 1 ¬ ∧ ¬ → ⇒ ¬ ¬ ∧ ¬ ∨ ⇒ ∨ ∨ ⇒ = − 2 : ( ( ) ) ( ( ) ) , , , , : . A r s t r s t r s t C r s t 2 2 → ¬ ∧ ¬ ⇒ ¬ ∨ ¬ ∧ ¬ ⇒ ¬ ∨ ¬ ∧ ¬ ∨ ¬ 3 : ( ) ( ) ( ) ( ) A u s t u s t u s u t = − ⎧ : , . C u s ⇒ ⇒ 3 ⎨ ⎨ = − : , . ⎩ C u t 4 ( ) ¬ ¬ ¬ ∧ → → ⇒ ¬ ∧ ∧ ¬ ¬ ∨ ⇒ ¬ ∧ ∧ ∧ ¬ : ( ) ( ) ( ) ( ) Q t p q s t p q s t p q s = − ⎧ ⎧ : : . C C t t 5 ⎪ = − : . ⎪ p C ⇒ 6 ⎨ = − : . q C ⎪ ⎪ 7 7 ⎪ = − : . ⎩ C s 8 11 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  12. Example (2) (cont.) Example (2) (cont.) • Determining the consistency of {C 1 , C 2 , ..., C 8 } Determining the consistency of {C 1 , C 2 , ..., C 8 } − − − − − − − − : , , . , , : . : , . : , . : . : . : . : . p q p q r r s t u s u t t s C C C C C C C C C C C C 1 6 7 8 2 3 4 5 − : , . r, s : ‐ . q r − : r . r : ‐ . : − . 12 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  13. Example (2) (cont.) Example (2) (cont.) • C={C1, C2, ..., C8} is inconsistent (by resolution/ C {C1, C2, ..., C8} is inconsistent (by resolution/ refutation) • Therefore Q is provable (deducible) • Therefore Q is provable (deducible) • Answer: YES (true) • This is how Prolog answers Queries If the empty • This is how Prolog answers Queries. If the empty string is deduced, Prolog answers YES (or TRUE). 13 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  14. Resolution in Predicate Logic Resolution in Predicate Logic • A literal in Predicate Logic (PL) is either g ( ) ( 1 ,..., ) – A positive literal in the form of p(t 1 , ..., t k ) where p is a p t t k predicate and t i are terms ¬ ( 1 ( 1 , , ,..., ) ) – Or a negative literal in the form of Or a negative literal in the form of p p t t k k • Two clauses in PL can be resolved upon two complementary unifiable literals complementary unifiable literals • Two literals are unifiable if a substitution can make them identical. them identical. • Example: – study hard(X) and y_ ( ) study hard(john) y_ (j ) – date(D, M, 2001) and date(D1, may, Y1) 14 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  15. Substitution Substitution • Substitution: is a finite set of pairs of terms denoted Substitution: is a finite set of pairs of terms denoted as [X 1 / t 1 , ..., X n / t n ] where each t i is a term and each X i is a variable. • Every variable is mapped to a te to a term; if not explicitly ; ot e p c t y mentioned, it maps to itself. • For example: – date(D, M, 2001) and date(D1, may, Y1) 15 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  16. Applying substitution to literals Applying substitution to literals • Example: p p(X, f(X, 2, Z), 5) e= [X/5, Z/h(a,2+X)] e(p(X, f(X, 2, Z), 5))= p(5, f(5, 2, h(a, 2+X)), 5) e(p(X, f(X, , ), 5)) p(5, f(5, , h(a, X)), 5) • Note: – Simultaneous substitution – X in h(a,2+X) is not substituted • Example: • Example: p r(X, Y) r(X, f(2, Y)) e=[X/Y, Y/X] e=[f(2, Y)/Z] e(r(X, Y))= r(Y, X) illegal substitution only illegal substitution ‐ only variables can be substituted 16 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  17. Applying substitution to clauses Applying substitution to clauses • Substitution of a clause is defined by applying Substitution of a clause is defined by applying substitution to each of its literals: e( p : ‐ q 1 , ..., q k .) = e(p) : ‐ e(q 1 ), ..., e(q k ). • Example: C: pass_3401(X): ‐ student(X, Y), study_hard(X). e=[X/ john, Y/ 3401] e(C)= pass_3401(john): ‐ student(john, 3401), study_hard(john). 17 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

  18. Unifier Unifier • Let p 1 and p 2 be two literals and let e be a substitution. e p 1 a d p 2 be o e a s a d e e be a subs u o We call e a unifier of p 1 and p 2 if e(p 1 )=e(p 2 ). • Two literals are unifiable if such a unifier exists Two literals are unifiable if such a unifier exists. • Example: date(D, M, 2001) and date(D1, may, Y1) date(D M 2001) and date(D1 may Y1) e 1 =[D/15, D1/ 15, M/may, Y1/2001] A more general e 2 =[ D1/D, M/may, Y1/2001] unifier • A unifier e is said to be a most general unifier (mgu) of two literals/terms iff e is more general than any other unifier of the terms unifier of the terms. 18 York University ‐ CSE 3401 ‐ V. Movahedi 04_Resolution

Recommend


More recommend