reasoning
play

Reasoning 7 AI Slides (5e) c Lin Zuoquan@PKU 2003-2019 1 7 7 - PowerPoint PPT Presentation

Reasoning 7 AI Slides (5e) c Lin Zuoquan@PKU 2003-2019 1 7 7 Reasoning 7.1 Proofs 7.2 Completeness 7.3 Reducing first-order case to propositional level 7.4 Unification 7.5 Generalized Modus Ponens 7.6 Forward and backward chaining


  1. Reasoning 7 AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 1 7

  2. 7 Reasoning 7.1 Proofs 7.2 Completeness 7.3 Reducing first-order case to propositional level 7.4 Unification 7.5 Generalized Modus Ponens 7.6 Forward and backward chaining 7.7 Resolution AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 2 7

  3. A brief history of reasoning 450 b.c. Stoics propositional logic 322 b.c. Aristotle syllogisms (inference rules), quantifiers 1565 Cardano probability theory (propositional logic + uncertainty) 1847 Boole propositional logic (again) 1879 Frege first-order logic 1922 Wittgenstein proof by truth tables 1930 G¨ odel ∃ complete algorithm for FOL 1930 Herbrand complete algorithm for FOL (reduce to propositional) ¬∃ complete algorithm for arithmetic 1931 G¨ odel 1960 Davis/Putnam “practical” algorithm for propositional logic 1965 Robinson “practical” algorithm for FOL—resolution AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 3 7

  4. Proofs Sound inference: find α such that KB ⊢ α Proof process is a search, operators are inference rules Modus Ponens (MP) α, α ⇒ β At ( lin, pku ) At ( lin, pku ) ⇒ Ok ( lin ) β Ok ( lin ) And-Introduction (AI) α β Ok ( lin ) AImajor ( lin ) α ∧ β Ok ( Lin ) ∧ AImajor ( in ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 4 7

  5. 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 E.g., ∀ x King ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) yields King ( john ) ∧ Greedy ( john ) ⇒ Evil ( john ) King ( richard ) ∧ Greedy ( richard ) ⇒ Evil ( richard ) King ( father ( john )) ∧ Greedy ( father ( john )) ⇒ Evil ( father ( john )) . . . AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 5 7

  6. Existential instantiation (EI) c For any sentence α , variable v , and constant symbol k that does not appear elsewhere in the knowledge base: ∃ v α Subst ( { v/k } , α ) E.g., ∃ x Crown ( x ) ∧ OnHead ( x, john ) yields Crown ( c ) ∧ OnHead ( c, john ) provided c is a new constant symbol, called a Skolem constant Another example: from ∃ x d ( x y ) /dy = x y we obtain d ( e y ) /dy = e y provided e is a new constant symbol AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 6 7

  7. Instantiation UI can be applied several times to add new sentences; the new KB is logically equivalent to the old 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 AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 7 7

  8. Example proof bob is a buffalo 1. Buffalo ( bob ) pat is a pig 2. Pig ( pat ) Buffaloes outrun pigs 3. ∀ x, y Buffalo ( x ) ∧ Pig ( y ) ⇒ Faster ( x, y ) bob outruns pat Buffalo ( bob ) ∧ Pig ( pat ) ⇒ Faster ( bob, pat ) UE 3, { x/bob, y/pat } AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 8 7

  9. Example proof AI 1 & 2 4. Buffalo ( bob ) ∧ Pig ( pat ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 9 7

  10. Example proof UE 3, { x/bob, y/pat } 5. Buffalo ( bob ) ∧ Pig ( pat ) ⇒ Faster ( bob, pat ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 10 7

  11. Example proof MP 6 & 7 6. Faster ( bob, pat ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 11 7

  12. Search with inference rules Operators are inference rules States are sets of sentences Goal test checks state to see if it contains query sentence 1 2 3 AI, UE, MP are common inference patterns AI 1 & 2 1 2 3 4 Problem: branching factor huge, esp. for UE UE 3 {x/Bob, y/Pat} 1 2 3 4 5 Idea: find a substitution that makes the rule premise match some known facts MP 5 & 6 1 2 3 4 5 6 ⇒ a single, more powerful inference rule AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 12 7

  13. Completeness Soundeness and Completeness Theorem of FOL KB ⊢ α iff KB | = α Procedure i is complete if and only if KB ⊢ i α whenever KB | = α Forward and backward chaining are complete for Horn KBs but incomplete for full FOL E.g., from PhD ( x ) ⇒ HighlyQualified ( x ) ¬ PhD ( x ) ⇒ EarlyEarnings ( x ) HighlyQualified ( x ) ⇒ Rich ( x ) EarlyEarnings ( x ) ⇒ Rich ( x ) should be able to infer Rich ( Me ) , but FC/BC won’t do it Does a complete algorithm exist?? AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 13 7

  14. Incompleteness By extending the language of FOL to allow for the mathematical induction scheme in arithmetic, G¨ odel proved that there are true arithmetic sentecnes that cannot be proved Incompleteness theorem: If the formal arithmetic system N is ( ω -) consistent, then there is a sentence S which is not a theorem of N , nor its negation Hence, N is not complete What does G¨ odel incompleteness theorem mean in AI?? AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 14 7

  15. Reducing first-order case to propositional level Suppose the KB contains just the following: ∀ x King ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) King ( john ) Greedy ( john ) Brother ( richard,john ) Instantiating the universal sentence in all possible ways, we have King ( john ) ∧ Greedy ( john ) ⇒ Evil ( john ) King ( richard ) ∧ Greedy ( richard ) ⇒ Evil ( richard ) King ( john ) Greedy ( john ) Brother ( richard,john ) The new KB is propositionalized: proposition symbols are King ( john ) , Greedy ( john ) , Evil ( john ) , King ( richard ) etc. AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 15 7

  16. Reduction A literal (sentence) is ground if it contains no variables Herbrand Theorem a ground sentence is entailed by new KB iff entailed by original KB i.e., FOL KB can be propositionalized so as to preserve entailment Idea: propositionalize KB and query, apply resolution, return result Problem: with function symbols, there are infinitely many ground terms, e.g., father ( father ( father ( john ))) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 16 7

  17. Reduction 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 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 Theorem (Turing/Church, 1936): Entailment in FOL is semidecidable can find a proof of α if KB | = α cannot always prove that KB �| = α Cf. Halting Problem: proof procedure may be about to terminate with success or failure, or may go on for ever AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 17 7

  18. Problems with propositionalization Propositionalization seems to generate lots of irrelevant sentences E.g., from ∀ x King ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) King ( john ) ∀ y Greedy ( y ) Brother ( richard,john ) it seems obvious that Evil ( john ) , but propositionalization produces lots of facts such as Greedy ( richard ) that are irrelevant With p k -ary predicates and n constants, there are p · n k instantiations With function symbols, it gets much worse AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 18 7

  19. 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 αθ = βθ p q θ Knows ( john, x ) Knows ( john, jane ) Knows ( john, x ) Knows ( y, lin ) Knows ( john, x ) Knows ( y, mother ( y )) Knows ( john, x ) Knows ( x, lin ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 19 7

  20. 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 αθ = βθ p q θ Knows ( john, x ) Knows ( john, jane ) { x/jane } Knows ( john, x ) Knows ( y, lin ) Knows ( john, x ) Knows ( y, mother ( y )) Knows ( john, x ) Knows ( x, lin ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 20 7

  21. 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 αθ = βθ p q θ Knows ( john, x ) Knows ( john, jane ) { x/jane } Knows ( john, x ) Knows ( y, lin ) { x/lin, y/john } Knows ( john, x ) Knows ( y, mother ( y )) Knows ( john, x ) Knows ( x, lin ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 21 7

  22. 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 αθ = βθ p q θ Knows ( john, x ) Knows ( john, jane ) { x/jane } Knows ( john, x ) Knows ( y, lin ) { x/lin, y/john } Knows ( john, x ) Knows ( y, mother ( y )) { y/john, x/mother ( john ) } Knows ( john, x ) Knows ( x, lin ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 22 7

  23. 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 αθ = βθ p q θ Knows ( john, x ) Knows ( john, jane ) { x/jane } Knows ( john, x ) Knows ( y, lin ) { x/lin, y/john } Knows ( john, x ) Knows ( y, mother ( y )) { y/john, x/mother ( john ) } Knows ( john, x ) Knows ( x, lin ) fail Standardizing apart eliminates overlap of variables, e.g., Knows ( z, lin ) AI Slides (5e) c � Lin Zuoquan@PKU 2003-2019 23 7

Recommend


More recommend