title inference in first order logic aima chapter 9
play

Title: Inference in First-Order Logic AIMA: Chapter 9 - PowerPoint PPT Presentation

B.Y. Choueiry Title: Inference in First-Order Logic AIMA: Chapter 9 Introduction to Artificial Intelligence 1 CSCE 476-876, Fall 2017 URL: www.cse.unl.edu/choueiry/F17-476-876 Instructors notes #14 Berthe Y. Choueiry


  1. B.Y. Choueiry ✫ ✬ Title: Inference in First-Order Logic AIMA: Chapter 9 Introduction to Artificial Intelligence 1 CSCE 476-876, Fall 2017 URL: www.cse.unl.edu/˜choueiry/F17-476-876 Instructor’s notes #14 Berthe Y. Choueiry (Shu-we-ri) 402)472-5444 October 18, 2017 ✪ ✩

  2. B.Y. Choueiry ✫ ✬ Outline • Reducing first order inference to propositional inference: Universal Instantiation, Existential Instantiation, Skolemization, Generalized Modus Ponens 2 • Unification • Inference mechanisms in First-Order Logic: – Forward chaining – Backward chaining Instructor’s notes #14 – Resolution (and CNF) October 18, 2017 ✪ ✩

  3. B.Y. Choueiry ✫ ✬ Universal instantiation (UI) Every instantiation of a universally quantified sentence is entailed by it: ∀ vα Subst ( { v/g } , α ) for any variable v and ground term g 3 E.g., ∀ xKing ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) yields: King ( John ) ∧ Greedy ( John ) ⇒ Evil ( John ) King ( Richard ) ∧ Greedy ( Richard ) ⇒ Evil ( Richard ) Instructor’s notes #14 King ( Father ( John )) ∧ Greedy ( Father ( John )) ⇒ Evil ( Father ( John )) October 18, 2017 . . . ✪ ✩

  4. B.Y. Choueiry ✫ ✬ Existential instantiation (EI) For any sentence α , variable v , and constant symbol k that does not appear elsewhere in the knowledge base: ∃ vα Subst ( { v/k } , α ) E.g., ∃ xCrown ( x ) ∧ OnHead ( x, John ) yields 4 Crown ( C 1 ) ∧ OnHead ( C 1 , John ) provided C 1 is a new constant symbol, called a Skolem constant Another example: from ∃ xd ( x y ) /dy = x y we obtain Instructor’s notes #14 d ( e y ) /dy = e y October 18, 2017 provided e is a new constant symbol ✪ ✩

  5. B.Y. Choueiry ✫ ✬ UI and EI UI can be applied several times to add new sentences; the new KB is logically equivalent to the old 5 EI can be applied once to replace the existential sentence; the new KB is not equivalent to the old, but is satisfiable iff the old KB was satisfiable Instructor’s notes #14 October 18, 2017 ✪ ✩

  6. B.Y. Choueiry ✫ ✬ Reduction to propositional inference (I) ∀ xKing ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) King ( John ) Greedy ( John ) Brother ( Richard, John ) Instantiating the universal sentence in all possible ways, we have: 6 King ( John ) ∧ Greedy ( John ) ⇒ Evil ( John ) King ( Richard ) ∧ Greedy ( Richard ) ⇒ Evil ( Richard ) King ( John ) Greedy ( John ) Brother ( Richard, John ) Instructor’s notes #14 October 18, 2017 The new KB is propositionalized: proposition symbols are: King ( John ) , Greedy ( John ) , Evil ( John ) , King ( Richard ) etc. ✪ ✩

  7. B.Y. Choueiry ✫ ✬ Reduction to propositional inference (II) • Claim: a ground sentence ∗ is entailed by new KB iff entailed by original KB • Claim: every FOL KB can be propositionalized so as to 7 preserve entailment • Idea: propositionalize KB and query, apply resolution, return result • Problem: with function symbols, there are infinitely many Instructor’s notes #14 ground terms, e.g., Father ( Father ( Father ( John ))) October 18, 2017 ✪ ✩

  8. B.Y. Choueiry ✫ ✬ Reduction to propositional inference (III) • Theorem: Herbrand (1930). If a sentence α is entailed by an FOL KB, it is entailed by a finite subset of the propositional KB • Idea: For n = 0 to ∞ do 8 create a propositional KB by instantiating with depth- n terms see if α is entailed by this KB • Problem: works if α is entailed, loops if α is not entailed Instructor’s notes #14 • Theorem: Turing (1936), Church (1936), entailment in FOL is October 18, 2017 semidecidable ✪ ✩

  9. B.Y. Choueiry ✫ ✬ Problems with propositionalization Propositionalization generates lots of irrelevant sentences. E.g., from ∀ xKing ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) King ( John ) 9 ∀ yGreedy ( y ) Brother ( Richard, John ) it seems obvious that Evil ( John ) , but propositionalization produces lots of facts such as Greedy ( Richard ) that are irrelevant Instructor’s notes #14 With p k -ary predicates and n constants, there are p · n k October 18, 2017 instantiations! ✪ ✩

  10. B.Y. Choueiry ✫ ✬ Unification We can get the inference immediately if we can find a substitution θ such that King ( x ) and Greedy ( x ) match King ( John ) and Greedy ( y ) θ = { x/John, y/John } works Unify ( α, β ) = θ if αθ = βθ 10 p q θ Knows ( John, x ) Knows ( John, Jane ) { x/Jane } Knows ( John, x ) Knows ( y, OJ ) { x/OJ, y/John } Knows ( John, x ) Knows ( y, Mother ( y )) { y/John, x/Mother ( John ) } Instructor’s notes #14 Knows ( John, x ) Knows ( x, OJ ) fail October 18, 2017 Standardizing apart eliminates overlap of variables, e.g., Knows ( z 17 , OJ ) ✪ ✩

  11. B.Y. Choueiry ✫ ✬ Generalized Modus Ponens (GMP) p 1 ′ , p 2 ′ , . . . , p n ′ , ( p 1 ∧ p 2 ∧ . . . ∧ p n ⇒ q ) ′ θ = p i θ for all i where p i qθ 11 ′ is King ( John ) p 1 p 1 is King ( x ) ′ is Greedy ( y ) p 2 p 2 is Greedy ( x ) θ is { x/John, y/John } q is Evil ( x ) Instructor’s notes #14 qθ is Evil ( John ) October 18, 2017 GMP used with KB of definite clauses ( exactly one positive literal) All variables assumed universally quantified ✪ ✩

  12. B.Y. Choueiry ✫ ✬ Example knowledge base The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. 12 Prove that Col. West is a criminal . . . it is a crime for an American to sell weapons to hostile nations: American ( x ) ∧ Weapon ( y ) ∧ Sells ( x, y, z ) ∧ Hostile ( z ) ⇒ Instructor’s notes #14 Criminal ( x ) October 18, 2017 ✪ ✩

  13. B.Y. Choueiry ✫ ✬ Example of KB (2) Nono . . . has some missiles, i.e., ∃ x Owns ( Nono, x ) ∧ Missile ( x ) : Owns ( Nono, M 1 ) and Missile ( M 1 ) 13 . . . all of its missiles were sold to it by Colonel West ∀ xMissile ( x ) ∧ Owns ( Nono, x ) ⇒ Sells ( West, x, Nono ) Missiles are weapons: Instructor’s notes #14 Missile ( x ) ⇒ Weapon ( x ) October 18, 2017 ✪ ✩

  14. B.Y. Choueiry ✫ ✬ Example of KB (3) An enemy of America counts as “hostile”: Enemy ( x, America ) ⇒ Hostile ( x ) 14 West, who is American . . . American ( West ) The country Nono, an enemy of America . . . Instructor’s notes #14 Enemy ( Nono, America ) October 18, 2017 ✪ ✩

  15. B.Y. Choueiry ✫ ✬ Forward chaining algorithm 15 <FOL-FC-Ask, Figure 9.3 page 332> Instructor’s notes #14 October 18, 2017 ✪ ✩

  16. B.Y. Choueiry ✫ ✬ Forward chaining proof Criminal ( West ) 16 Weapon ( M 1 ) Hostile ( Nono ) Sells ( West,M 1 ,Nono ) Instructor’s notes #14 American ( West ) Missile ( M 1 ) Owns ( Nono,M 1 ) Enemy ( Nono,America ) October 18, 2017 ✪ ✩

  17. B.Y. Choueiry ✫ ✬ Properties of forward chaining • Sound and complete for first-order definite clauses (proof similar to propositional proof) • Datalog = first-order definite clauses + no functions (e.g., 17 crime KB) FC terminates for Datalog in poly iterations: at most p · n k literals • May not terminate in general if α is not entailed Instructor’s notes #14 • This is unavoidable: entailment with definite clauses is October 18, 2017 semidecidable ✪ ✩

  18. B.Y. Choueiry ✫ ✬ Efficiency of forward chaining • Simple observation: no need to match a rule on iteration k if a premise wasn’t added on iteration k − 1 ⇒ match each rule whose premise contains a newly added literal 18 • Matching itself can be expensive • Database indexing allows O (1) retrieval of known facts l e.g., query Missile ( x ) retrieves Missile ( M 1 ) Instructor’s notes #14 • Matching conjunctive premises against known facts is NP-hard October 18, 2017 • Forward chaining is widely used in deductive databases ✪ ✩

  19. B.Y. Choueiry ✫ ✬ Backward chaining algorithm 19 <FOL-BC-Ask, Figure 9.6 page 338> Instructor’s notes #14 October 18, 2017 ✪ ✩

  20. B.Y. Choueiry ✫ ✬ Backward chaining example Criminal ( West ) 20 Weapon ( y ) American ( West ) Sells ( West,M 1 ,z ) Hostile ( Nono ) { z / Nono } { } Instructor’s notes #14 Missile ( y ) Missile ( M 1 ) Owns ( Nono,M 1 ) Enemy ( Nono,America ) October 18, 2017 { y / M1 } { } { } { } ✪ ✩

  21. B.Y. Choueiry ✫ ✬ Properties of backward chaining • Depth-first recursive proof search: space is linear in size of proof 21 • Incomplete due to infinite loops ⇒ fix by checking current goal against every goal on stack • Inefficient due to repeated subgoals (both success and failure) ⇒ fix using caching of previous results (extra space!) Instructor’s notes #14 • Widely used (without improvements!) for logic programming October 18, 2017 ✪ ✩

  22. B.Y. Choueiry ✫ ✬ Resolution: brief summary Full first-order version: l 1 ∨ · · · ∨ l k , m 1 ∨ · · · ∨ m n ( l 1 ∨ · · · ∨ l i − 1 ∨ l i +1 ∨ · · · ∨ l k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j +1 ∨ · · · ∨ m n ) θ where Unify ( l i , ¬ m j ) = θ . 22 For example, ¬ Rich ( x ) ∨ Unhappy ( x ) Rich ( Ken ) Unhappy ( Ken ) Instructor’s notes #14 with θ = { x/Ken } October 18, 2017 Apply resolution steps to CNF ( KB ∧ ¬ α ) ; complete for FOL ✪ ✩

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