reasoning with variables
play

Reasoning with Variables An instance of an atom or a clause is - PowerPoint PPT Presentation

Reasoning with Variables An instance of an atom or a clause is obtained by uniformly substituting terms for variables. A substitution is a finite set of the form { V 1 / t 1 , . . . , V n / t n } , where each V i is a distinct variable and each t


  1. Reasoning with Variables An instance of an atom or a clause is obtained by uniformly substituting terms for variables. A substitution is a finite set of the form { V 1 / t 1 , . . . , V n / t n } , where each V i is a distinct variable and each t i is a term. The application of a substitution σ = { V 1 / t 1 , . . . , V n / t n } to an atom or clause e , written e σ , is the instance of e with every occurrence of V i replaced by t i . � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 1

  2. Application Examples The following are substitutions: σ 1 = { X / A , Y / b , Z / C , D / e } σ 2 = { A / X , Y / b , C / Z , D / e } σ 3 = { A / V , X / V , Y / b , C / W , Z / W , D / e } The following shows some applications: p ( A , b , C , D ) σ 1 = p ( X , Y , Z , e ) σ 1 = p ( A , b , C , D ) σ 2 = p ( X , Y , Z , e ) σ 2 = p ( A , b , C , D ) σ 3 = p ( X , Y , Z , e ) σ 3 = � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 2

  3. Application Examples The following are substitutions: σ 1 = { X / A , Y / b , Z / C , D / e } σ 2 = { A / X , Y / b , C / Z , D / e } σ 3 = { A / V , X / V , Y / b , C / W , Z / W , D / e } The following shows some applications: p ( A , b , C , D ) σ 1 = p ( A , b , C , e ) p ( X , Y , Z , e ) σ 1 = p ( A , b , C , D ) σ 2 = p ( X , Y , Z , e ) σ 2 = p ( A , b , C , D ) σ 3 = p ( X , Y , Z , e ) σ 3 = � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 3

  4. Application Examples The following are substitutions: σ 1 = { X / A , Y / b , Z / C , D / e } σ 2 = { A / X , Y / b , C / Z , D / e } σ 3 = { A / V , X / V , Y / b , C / W , Z / W , D / e } The following shows some applications: p ( A , b , C , D ) σ 1 = p ( A , b , C , e ) p ( X , Y , Z , e ) σ 1 = p ( A , b , C , e ) p ( A , b , C , D ) σ 2 = p ( X , Y , Z , e ) σ 2 = p ( A , b , C , D ) σ 3 = p ( X , Y , Z , e ) σ 3 = � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 4

  5. Application Examples The following are substitutions: σ 1 = { X / A , Y / b , Z / C , D / e } σ 2 = { A / X , Y / b , C / Z , D / e } σ 3 = { A / V , X / V , Y / b , C / W , Z / W , D / e } The following shows some applications: p ( A , b , C , D ) σ 1 = p ( A , b , C , e ) p ( X , Y , Z , e ) σ 1 = p ( A , b , C , e ) p ( A , b , C , D ) σ 2 = p ( X , b , Z , e ) p ( X , Y , Z , e ) σ 2 = p ( A , b , C , D ) σ 3 = p ( X , Y , Z , e ) σ 3 = � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 5

  6. Application Examples The following are substitutions: σ 1 = { X / A , Y / b , Z / C , D / e } σ 2 = { A / X , Y / b , C / Z , D / e } σ 3 = { A / V , X / V , Y / b , C / W , Z / W , D / e } The following shows some applications: p ( A , b , C , D ) σ 1 = p ( A , b , C , e ) p ( X , Y , Z , e ) σ 1 = p ( A , b , C , e ) p ( A , b , C , D ) σ 2 = p ( X , b , Z , e ) p ( X , Y , Z , e ) σ 2 = p ( X , b , Z , e ) p ( A , b , C , D ) σ 3 = p ( X , Y , Z , e ) σ 3 = � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 6

  7. Application Examples The following are substitutions: σ 1 = { X / A , Y / b , Z / C , D / e } σ 2 = { A / X , Y / b , C / Z , D / e } σ 3 = { A / V , X / V , Y / b , C / W , Z / W , D / e } The following shows some applications: p ( A , b , C , D ) σ 1 = p ( A , b , C , e ) p ( X , Y , Z , e ) σ 1 = p ( A , b , C , e ) p ( A , b , C , D ) σ 2 = p ( X , b , Z , e ) p ( X , Y , Z , e ) σ 2 = p ( X , b , Z , e ) p ( A , b , C , D ) σ 3 = p ( V , b , W , e ) p ( X , Y , Z , e ) σ 3 = � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 7

  8. Application Examples The following are substitutions: σ 1 = { X / A , Y / b , Z / C , D / e } σ 2 = { A / X , Y / b , C / Z , D / e } σ 3 = { A / V , X / V , Y / b , C / W , Z / W , D / e } The following shows some applications: p ( A , b , C , D ) σ 1 = p ( A , b , C , e ) p ( X , Y , Z , e ) σ 1 = p ( A , b , C , e ) p ( A , b , C , D ) σ 2 = p ( X , b , Z , e ) p ( X , Y , Z , e ) σ 2 = p ( X , b , Z , e ) p ( A , b , C , D ) σ 3 = p ( V , b , W , e ) p ( X , Y , Z , e ) σ 3 = p ( V , b , W , e ) � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 8

  9. Unifiers Substitution σ is a unifier of e 1 and e 2 if e 1 σ = e 2 σ . Substitution σ is a most general unifier (mgu) of e 1 and e 2 if ◮ σ is a unifier of e 1 and e 2 ; and ◮ if substitution σ ′ also unifies e 1 and e 2 , then e σ ′ is an instance of e σ for all atoms e . If two atoms have a unifier, they have a most general unifier. � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 9

  10. Unification Example Which of the following are unifiers of p ( A , b , C , D ) and p ( X , Y , Z , e ): σ 1 = { X / A , Y / b , Z / C , D / e } σ 2 = { Y / b , D / e } σ 3 = { X / A , Y / b , Z / C , D / e , W / a } σ 4 = { A / X , Y / b , C / Z , D / e } σ 5 = { X / a , Y / b , Z / c , D / e } σ 6 = { A / a , X / a , Y / b , C / c , Z / c , D / e } σ 7 = { A / V , X / V , Y / b , C / W , Z / W , D / e } σ 8 = { X / A , Y / b , Z / A , C / A , D / e } Which are most general unifiers? � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 10

  11. Unification Example p ( A , b , C , D ) and p ( X , Y , Z , e ) have as unifiers: σ 1 = { X / A , Y / b , Z / C , D / e } σ 4 = { A / X , Y / b , C / Z , D / e } σ 7 = { A / V , X / V , Y / b , C / W , Z / W , D / e } σ 6 = { A / a , X / a , Y / b , C / c , Z / c , D / e } σ 8 = { X / A , Y / b , Z / A , C / A , D / e } σ 3 = { X / A , Y / b , Z / C , D / e , W / a } The first three are most general unifiers. The following substitutions are not unifiers: σ 2 = { Y / b , D / e } σ 5 = { X / a , Y / b , Z / c , D / e } � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 11

  12. 1: procedure unify ( t 1 , t 2 ) ⊲ Returns mgu of t 1 and t 2 or ⊥ . E ← { t 1 = t 2 } ⊲ Set of equality statements 2: S ← {} ⊲ Substitution 3: while E � = {} do 4: select and remove x = y from E 5: if y is not identical to x then 6: if x is a variable then 7: replace x with y in E and S 8: S ← { x / y } ∪ S 9: else if y is a variable then 10: replace y with x in E and S 11: S ← { y / x } ∪ S 12: else if x is p ( x 1 , . . . , x n ) and y is 13: p ( y 1 , . . . , y n ) then E ← E ∪ { x 1 = y 1 , . . . , x n = y n } 14: else 15: return ⊥ ⊲ t 1 and t 2 do not unify 16: return S ⊲ S is mgu of t 1 and t 2 17: � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 12

  13. Logical Consequence Atom g is a logical consequence of KB if and only if: g is an instance of a fact in KB , or there is an instance of a rule g ← b 1 ∧ . . . ∧ b k in KB such that each b i is a logical consequence of KB . � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 13

  14. Aside: Debugging false conclusions To debug answer g that is false in the intended interpretation: If g is a fact in KB , this fact is wrong. Otherwise, suppose g was proved using the rule: g ← b 1 ∧ . . . ∧ b k where each b i is a logical consequence of KB . ◮ If each b i is true in the intended interpretation, this clause is false in the intended interpretation. ◮ If some b i is false in the intended interpretation, debug b i . � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 14

  15. Proofs A proof is a mechanically derivable demonstration that a formula logically follows from a knowledge base. Given a proof procedure, KB ⊢ g means g can be derived from knowledge base KB . Recall KB | = g means g is true in all models of KB . A proof procedure is sound if KB ⊢ g implies KB | = g . A proof procedure is complete if KB | = g implies KB ⊢ g . � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 15

  16. Bottom-up proof procedure KB ⊢ g if there is g ′ added to C in this procedure where g = g ′ θ : C := {} ; repeat select clause “ h ← b 1 ∧ . . . ∧ b m ” in KB such that there is a substitution θ such that for all i , there exists b ′ i ∈ C and θ ′ i where b i θ = b ′ i θ ′ i and there is no h ′ ∈ C and θ ′ such that h ′ θ ′ = h θ C := C ∪ { h θ } until no more clauses can be selected. � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 16

  17. Example live ( Y ) ← connected to ( Y , Z ) ∧ live ( Z ) . live ( outside ) . connected to ( w 6 , w 5 ) . connected to ( w 5 , outside ) . � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 17

  18. Example live ( Y ) ← connected to ( Y , Z ) ∧ live ( Z ) . live ( outside ) . connected to ( w 6 , w 5 ) . connected to ( w 5 , outside ) . C = { live ( outside ) , connected to ( w 6 , w 5 ) , connected to ( w 5 , outside ) , live ( w 5 ) , live ( w 6 ) } � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 18

  19. Soundness of bottom-up proof procedure If KB ⊢ g then KB | = g . Suppose there is a g such that KB ⊢ g and KB �| = g . Then there must be a first atom added to C that has an instance that isn’t true in every model of KB . Call it h . � D. Poole and A. Mackworth 2016 c Artificial Intelligence, Lecture 13.3, Page 19

Recommend


More recommend