knowledge representation ii
play

Knowledge Representation (II) Paolo Turrini Department of - PowerPoint PPT Presentation

Intro to AI Knowledge Representation (II) Paolo Turrini Department of Computing, Imperial College London Introduction to Artificial Intelligence Paolo Turrini Intro to AI Intro to AI The main reference Stuart Russell and Peter Norvig


  1. Intro to AI Properties of forward chaining Sound (because of soundness of GMP) Complete for first-order (entailed!) definite clauses Paolo Turrini Intro to AI

  2. Intro to AI Properties of forward chaining Sound (because of soundness of GMP) Complete for first-order (entailed!) definite clauses May not terminate in general if α is not entailed Paolo Turrini Intro to AI

  3. Intro to AI Properties of forward chaining Sound (because of soundness of GMP) Complete for first-order (entailed!) definite clauses May not terminate in general if α is not entailed It’s inefficient: Paolo Turrini Intro to AI

  4. Intro to AI Properties of forward chaining Sound (because of soundness of GMP) Complete for first-order (entailed!) definite clauses May not terminate in general if α is not entailed It’s inefficient: but there can be improvements Paolo Turrini Intro to AI

  5. Intro to AI Properties of forward chaining Sound (because of soundness of GMP) Complete for first-order (entailed!) definite clauses May not terminate in general if α is not entailed It’s inefficient: but there can be improvements well... matching conjunctive premises against known facts is NP-hard Paolo Turrini Intro to AI

  6. Intro to AI Properties of forward chaining Sound (because of soundness of GMP) Complete for first-order (entailed!) definite clauses May not terminate in general if α is not entailed It’s inefficient: but there can be improvements well... matching conjunctive premises against known facts is NP-hard Forward chaining is widely used in deductive databases Paolo Turrini Intro to AI

  7. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  8. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  9. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  10. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  11. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  12. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  13. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  14. Intro to AI Backward chaining algorithm function FOL-BC-Ask ( KB , goals , θ ) returns a set of substitutions inputs : KB , a knowledge base goals , a list of conjuncts forming a query ( θ already applied) θ , the current substitution, initially the empty substitution { } local variables : answers , a set of substitutions, initially empty if goals is empty then return { θ } q ′ ← First ( goals ) θ for each sentence r in KB where Standardize-Apart ( r ) = ( p 1 ∧ . . . ∧ p n ⇒ q ) and θ ′ ← Unify ( q , q ′ ) succeeds new goals ← [ p 1 , . . . , p n | Rest ( goals )] answers ← FOL-BC-Ask ( KB , new goals , Compose ( θ ′ , θ )) ∪ answers return answers Paolo Turrini Intro to AI

  15. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  16. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  17. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  18. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  19. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  20. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  21. Intro to AI Backward chaining example Paolo Turrini Intro to AI

  22. Intro to AI Properties of backward chaining Depth-first recursive proof search Paolo Turrini Intro to AI

  23. Intro to AI Properties of backward chaining Depth-first recursive proof search space is linear in size of proof Paolo Turrini Intro to AI

  24. Intro to AI Properties of backward chaining Depth-first recursive proof search space is linear in size of proof Incomplete due to infinite loops Paolo Turrini Intro to AI

  25. Intro to AI Properties of backward chaining Depth-first recursive proof search space is linear in size of proof Incomplete due to infinite loops Widely used for logic programming Paolo Turrini Intro to AI

  26. Intro to AI Resolution Full first-order version: ℓ 1 ∨ · · · ∨ ℓ k , m 1 ∨ · · · ∨ m n ( ℓ 1 ∨ · · · ∨ ℓ i − 1 ∨ ℓ i +1 ∨ · · · ∨ ℓ k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j +1 ∨ · · · ∨ m n ) θ where Unify ( ℓ i , ¬ m j ) = θ . Paolo Turrini Intro to AI

  27. Intro to AI Resolution Full first-order version: ℓ 1 ∨ · · · ∨ ℓ k , m 1 ∨ · · · ∨ m n ( ℓ 1 ∨ · · · ∨ ℓ i − 1 ∨ ℓ i +1 ∨ · · · ∨ ℓ k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j +1 ∨ · · · ∨ m n ) θ where Unify ( ℓ i , ¬ m j ) = θ . For example, ¬ Rich ( x ) ∨ Unhappy ( x ) Paolo Turrini Intro to AI

  28. Intro to AI Resolution Full first-order version: ℓ 1 ∨ · · · ∨ ℓ k , m 1 ∨ · · · ∨ m n ( ℓ 1 ∨ · · · ∨ ℓ i − 1 ∨ ℓ i +1 ∨ · · · ∨ ℓ k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j +1 ∨ · · · ∨ m n ) θ where Unify ( ℓ i , ¬ m j ) = θ . For example, ¬ Rich ( x ) ∨ Unhappy ( x ) Rich ( Berlusconi ) Paolo Turrini Intro to AI

  29. Intro to AI Resolution Full first-order version: ℓ 1 ∨ · · · ∨ ℓ k , m 1 ∨ · · · ∨ m n ( ℓ 1 ∨ · · · ∨ ℓ i − 1 ∨ ℓ i +1 ∨ · · · ∨ ℓ k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j +1 ∨ · · · ∨ m n ) θ where Unify ( ℓ i , ¬ m j ) = θ . For example, ¬ Rich ( x ) ∨ Unhappy ( x ) Rich ( Berlusconi ) Unhappy ( Berlusconi ) Paolo Turrini Intro to AI

  30. Intro to AI Resolution Full first-order version: ℓ 1 ∨ · · · ∨ ℓ k , m 1 ∨ · · · ∨ m n ( ℓ 1 ∨ · · · ∨ ℓ i − 1 ∨ ℓ i +1 ∨ · · · ∨ ℓ k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j +1 ∨ · · · ∨ m n ) θ where Unify ( ℓ i , ¬ m j ) = θ . For example, ¬ Rich ( x ) ∨ Unhappy ( x ) Rich ( Berlusconi ) Unhappy ( Berlusconi ) Paolo Turrini Intro to AI

  31. Intro to AI Resolution Full first-order version: ℓ 1 ∨ · · · ∨ ℓ k , m 1 ∨ · · · ∨ m n ( ℓ 1 ∨ · · · ∨ ℓ i − 1 ∨ ℓ i +1 ∨ · · · ∨ ℓ k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j +1 ∨ · · · ∨ m n ) θ where Unify ( ℓ i , ¬ m j ) = θ . For example, ¬ Rich ( x ) ∨ Unhappy ( x ) Rich ( Berlusconi ) Unhappy ( Berlusconi ) with θ = { x / Berlusconi } Paolo Turrini Intro to AI

  32. Intro to AI Resolution Full first-order version: ℓ 1 ∨ · · · ∨ ℓ k , m 1 ∨ · · · ∨ m n ( ℓ 1 ∨ · · · ∨ ℓ i − 1 ∨ ℓ i +1 ∨ · · · ∨ ℓ k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j +1 ∨ · · · ∨ m n ) θ where Unify ( ℓ i , ¬ m j ) = θ . For example, ¬ Rich ( x ) ∨ Unhappy ( x ) Rich ( Berlusconi ) Unhappy ( Berlusconi ) with θ = { x / Berlusconi } Apply resolution steps to CNF ( KB ∧ ¬ α ) Paolo Turrini Intro to AI

  33. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: Paolo Turrini Intro to AI

  34. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: ∀ x [ ∀ y Pizza ( y ) ⇒ Dislikes ( x , y )] ⇒ [ ∃ y Dislikes ( y , x )] Paolo Turrini Intro to AI

  35. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: ∀ x [ ∀ y Pizza ( y ) ⇒ Dislikes ( x , y )] ⇒ [ ∃ y Dislikes ( y , x )] 1. Eliminate biconditionals and implications Paolo Turrini Intro to AI

  36. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: ∀ x [ ∀ y Pizza ( y ) ⇒ Dislikes ( x , y )] ⇒ [ ∃ y Dislikes ( y , x )] 1. Eliminate biconditionals and implications ∀ x [ ¬∀ y ¬ Pizza ( y ) ∨ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] Paolo Turrini Intro to AI

  37. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: ∀ x [ ∀ y Pizza ( y ) ⇒ Dislikes ( x , y )] ⇒ [ ∃ y Dislikes ( y , x )] 1. Eliminate biconditionals and implications ∀ x [ ¬∀ y ¬ Pizza ( y ) ∨ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] 2. Move ¬ inwards: ¬∀ x ϕ ≡ ∃ x ¬ ϕ , ¬∃ x ϕ ≡ ∀ x ¬ ϕ : Paolo Turrini Intro to AI

  38. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: ∀ x [ ∀ y Pizza ( y ) ⇒ Dislikes ( x , y )] ⇒ [ ∃ y Dislikes ( y , x )] 1. Eliminate biconditionals and implications ∀ x [ ¬∀ y ¬ Pizza ( y ) ∨ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] 2. Move ¬ inwards: ¬∀ x ϕ ≡ ∃ x ¬ ϕ , ¬∃ x ϕ ≡ ∀ x ¬ ϕ : ∀ x [ ∃ y ¬ ( ¬ Pizza ( y ) ∨ Dislikes ( x , y ))] ∨ [ ∃ y Dislikes ( y , x )] Paolo Turrini Intro to AI

  39. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: ∀ x [ ∀ y Pizza ( y ) ⇒ Dislikes ( x , y )] ⇒ [ ∃ y Dislikes ( y , x )] 1. Eliminate biconditionals and implications ∀ x [ ¬∀ y ¬ Pizza ( y ) ∨ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] 2. Move ¬ inwards: ¬∀ x ϕ ≡ ∃ x ¬ ϕ , ¬∃ x ϕ ≡ ∀ x ¬ ϕ : ∀ x [ ∃ y ¬ ( ¬ Pizza ( y ) ∨ Dislikes ( x , y ))] ∨ [ ∃ y Dislikes ( y , x )] ∀ x [ ∃ y ¬¬ Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] Paolo Turrini Intro to AI

  40. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: ∀ x [ ∀ y Pizza ( y ) ⇒ Dislikes ( x , y )] ⇒ [ ∃ y Dislikes ( y , x )] 1. Eliminate biconditionals and implications ∀ x [ ¬∀ y ¬ Pizza ( y ) ∨ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] 2. Move ¬ inwards: ¬∀ x ϕ ≡ ∃ x ¬ ϕ , ¬∃ x ϕ ≡ ∀ x ¬ ϕ : ∀ x [ ∃ y ¬ ( ¬ Pizza ( y ) ∨ Dislikes ( x , y ))] ∨ [ ∃ y Dislikes ( y , x )] ∀ x [ ∃ y ¬¬ Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] ∀ x [ ∃ y Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] Paolo Turrini Intro to AI

  41. Intro to AI Conversion to CNF Everyone who dislikes pizzas is disliked by someone: ∀ x [ ∀ y Pizza ( y ) ⇒ Dislikes ( x , y )] ⇒ [ ∃ y Dislikes ( y , x )] 1. Eliminate biconditionals and implications ∀ x [ ¬∀ y ¬ Pizza ( y ) ∨ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] 2. Move ¬ inwards: ¬∀ x ϕ ≡ ∃ x ¬ ϕ , ¬∃ x ϕ ≡ ∀ x ¬ ϕ : ∀ x [ ∃ y ¬ ( ¬ Pizza ( y ) ∨ Dislikes ( x , y ))] ∨ [ ∃ y Dislikes ( y , x )] ∀ x [ ∃ y ¬¬ Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] ∀ x [ ∃ y Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ y Dislikes ( y , x )] Paolo Turrini Intro to AI

  42. Intro to AI Conversion to CNF contd. 3. Standardise variables: each quantifier should use a different one Paolo Turrini Intro to AI

  43. Intro to AI Conversion to CNF contd. 3. Standardise variables: each quantifier should use a different one ∀ x [ ∃ y Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ z Dislikes ( z , x )] Paolo Turrini Intro to AI

  44. Intro to AI Conversion to CNF contd. 3. Standardise variables: each quantifier should use a different one ∀ x [ ∃ y Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ z Dislikes ( z , x )] 4. Skolemize: a more general form of existential instantiation. Paolo Turrini Intro to AI

  45. Intro to AI Conversion to CNF contd. 3. Standardise variables: each quantifier should use a different one ∀ x [ ∃ y Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ z Dislikes ( z , x )] 4. Skolemize: a more general form of existential instantiation. Each existential variable is replaced by a Skolem function Paolo Turrini Intro to AI

  46. Intro to AI Conversion to CNF contd. 3. Standardise variables: each quantifier should use a different one ∀ x [ ∃ y Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ z Dislikes ( z , x )] 4. Skolemize: a more general form of existential instantiation. Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables: Paolo Turrini Intro to AI

  47. Intro to AI Conversion to CNF contd. 3. Standardise variables: each quantifier should use a different one ∀ x [ ∃ y Pizza ( y ) ∧ ¬ Dislikes ( x , y )] ∨ [ ∃ z Dislikes ( z , x )] 4. Skolemize: a more general form of existential instantiation. Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables: ∀ x [ Pizza ( F ( x )) ∧ ¬ Dislikes ( x , F ( x ))] ∨ Dislikes ( G ( x ) , x ) Paolo Turrini Intro to AI

  48. Intro to AI Conversion to CNF contd. 5. Drop universal quantifiers: [ Pizza ( F ( x )) ∧ ¬ Dislikes ( x , F ( x ))] ∨ Dislikes ( G ( x ) , x ) Paolo Turrini Intro to AI

  49. Intro to AI Conversion to CNF contd. 5. Drop universal quantifiers: [ Pizza ( F ( x )) ∧ ¬ Dislikes ( x , F ( x ))] ∨ Dislikes ( G ( x ) , x ) 6. Distribute ∧ over ∨ : [ Pizza ( F ( x )) ∨ Dislikes ( G ( x ) , x )] ∧ ∧ [ ¬ Dislikes ( x , F ( x )) ∨ Dislikes ( G ( x ) , x )] Paolo Turrini Intro to AI

  50. Intro to AI Resolution proof: definite clauses Paolo Turrini Intro to AI

  51. Intro to AI What we have seen Inference methods with different structure and properties Forward-chaining (deductive databases) Backward-chaining (logic programming) Resolution (full-first order logic) Paolo Turrini Intro to AI

  52. Intro to AI Coming next Knowledge and uncertainty: what if we don’t know exactly? How to handle uncertain information: representation reasoning Paolo Turrini Intro to AI

  53. Intro to AI Appendix: Universal Instantiation Every instantiation of a universally quantified sentence is entailed by it: ∀ v α α ( { v / g } ) for any variable v and ground term g Paolo Turrini Intro to AI

  54. Intro to AI Appendix: Universal Instantiation Every instantiation of a universally quantified sentence is entailed by it: ∀ v α α ( { v / g } ) for any variable v and ground term g E.g., ∀ x King ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) yields Paolo Turrini Intro to AI

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend