modus ponens
play

Modus Ponens Claudia Chirita School of Informatics, University of - PowerPoint PPT Presentation

Modus Ponens Claudia Chirita School of Informatics, University of Edinburgh Based on slides by: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann, Vaishak Belle Informatics 2D Agents and Reasoning 2019/2020 Lecture 11 Unifjcation


  1. Modus Ponens Claudia Chirita School of Informatics, University of Edinburgh Based on slides by: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann, Vaishak Belle Informatics 2D ⋅ Agents and Reasoning ⋅ 2019/2020 Lecture 11 ⋅ Unifjcation and Generalised 6 th February 2020

  2. Outline 2 / 26 • Reducing fjrst-order inference to propositional inference • Unifjcation • Generalized Modus Ponens

  3. Substitutions 3 / 26 Let (𝐺, 𝑄) be a FOL signature and 𝑌, 𝑍 sets of variables. A substitution of variables from 𝑌 with terms over 𝑍 is a function 𝜄∶ 𝑌 → 𝑈 � (𝑍) . A substitution 𝜄 can be extended to � 𝜄∶ 𝑈 � (𝑌) → 𝑈 � (𝑍) : 𝜄(𝜏(𝑢 � , … , 𝑢 � ) = 𝜏( � � 𝜄(𝑢 � ), … , � 𝜄(𝑢 � )) for 𝜏 ∈ 𝐺 � , 𝑢 � , … , 𝑢 � ∈ 𝑈 � (𝑌) . In particular, � 𝜄(𝜏) = 𝜏 for 𝜏 ∈ 𝐺 � . {𝑦 � /𝑢 � , … , 𝑦 � /𝑢 � } is a notation for 𝜄∶ 𝑌 → 𝑈 � (𝑍) where • 𝑍 is the set of all variables occuring in the terms 𝑢 � • 𝜄(𝑦 � ) = 𝑢 � , for 𝑗 = 1, … , 𝑜 , and 𝜄(𝑦) = 𝑦 for 𝑦 ≠ 𝑦 �

  4. Substitutions 4 / 26 Applying substitutions to sentences Let (𝐺, 𝑄) be a FOL signature and 𝑌, 𝑍, 𝑎 sets of variables. We denote by 𝜒 𝜄 the result of applying the substitution 𝜄∶ 𝑌 → 𝑈 � (𝑍) to the sentence 𝜒 : 𝜌( � 𝜄(𝑢 � ), … , � 𝜄(𝑢 � )) for 𝜒 = 𝜌(𝑢 � , … , 𝑢 � ) ⎧ ⎪ 𝜄(𝑢) = � � 𝜄(𝑢 � ) for 𝜒 = (𝑢 = 𝑢 � ) ⎪ ⎪ ¬(𝜒 � 𝜄) for 𝜒 = ¬𝜒 � 𝜒 𝜄 = ⎨ (𝜒 � 𝜄) ∧ (𝜒 � 𝜄) for 𝜒 = 𝜒 � ∧ 𝜒 � ⎪ … ⎪ ⎪ ∀𝑎.(𝜒 � 𝜄 � ) for 𝜒 = ∀𝑎.𝜒 � ⎩

  5. The composition of substitutions is associative. sometimes not even well defjned. 5 / 26 Substitutions ⋅ Composition Let (𝐺, 𝑄) be a FOL signature and 𝑌, 𝑍, 𝑎 sets of variables. Composing substitutions 𝜄∶ 𝑌 → 𝑈 � (𝑍) and 𝜀∶ 𝑍 → 𝑈 � (𝑎) : 𝜄 ; 𝜀∶ 𝑌 → 𝑈 � (𝑎) , with (𝜄 ; 𝜀)(𝑦) = (𝜄 ; � 𝜀)(𝑦) . The composition of substitutions is not commutative,

  6. Universal instantiation entailed by it: Example 6 / 26 Every instantiation of a universally quantifjed sentence 𝜒 is ∀𝑦.𝜒 𝜒{𝑦/𝑢} for any variable 𝑦 and ground term 𝑢 (without variables). ∀𝑦. King (𝑦) ∧ Greedy (𝑦) → Evil (𝑦) King ( John ) ∧ Greedy ( John ) → Evil ( John ) King ( Richard ) ∧ Greedy ( Richard ) → Evil ( Richard ) King ( Father ( John )) ∧ Greedy ( Father ( John )) → Evil ( Father ( John ))

  7. Existential instantiation does not appear elsewhere in the knowledge base: Example 7 / 26 For any sentence 𝜒 , variable 𝑦 , and some constant 𝜏 that ∃𝑦.𝜒 𝜒{𝑦/𝜏} ∃𝑦. Crown (𝑦) ∧ OnHead (𝑦, John ) yields Crown (𝐷) ∧ OnHead (𝐷, John ) with 𝐷 a new constant symbol, called a Skolem constant.

  8. Reduction to propositional inference Consider a KB containing just the following: Instantiating the universal sentence in all possible ways The universal sentence can then be discarded. as propositional symbols. 8 / 26 ∀𝑦. King (𝑦) ∧ Greedy (𝑦) → Evil (𝑦) King ( John ), Greedy ( John ), Brother ( Richard , John ) (using substitutions {𝑦/ John } and {𝑦/ Richard } ) we obtain: King ( John ) ∧ Greedy ( John ) → Evil ( John ) King ( Richard ) ∧ Greedy ( Richard ) → Evil ( Richard ) The new KB is essentially propositional if we view the atomic sentences King ( John ), Greedy ( John ), Evil ( John ), King ( Richard ) , …

  9. Reduction to propositional inference Every fjrst-order KB and query can be propositionalized such A ground sentence is entailed by the new KB ifg it is entailed by the original KB. Idea Propositionalise KB and query and apply DPLL (or some other complete propositional method). Problem If the KB includes a function symbol, the set of possible ground-term substitutions is infjnite. Eg. infjnitely many nested terms such as 9 / 26 that entailment is preserved. Father ( Father ( Father ( John )))

  10. Herbrand’s theorem by a fjrst-order KB, then it is entailed by a fjnite subset of the propositionalised KB. Idea Problem 10 / 26 Theorem (Herbrand, 1930). If a sentence 𝜒 is entailed for 𝑜 = 0 to ∞ do create a propositional KB by instantiating with depth- 𝑜 terms see if 𝜒 is entailed by this KB Works if 𝜒 is entailed, loops forever if it is not entailed.

  11. Semidecidability Theorem (Turing, 1936. Church, 1936). Entailment for fjrst-order logic is semidecidable. Algorithms exist that say yes to every entailed sentence, but no algorithm exists that also says no to every non-entailed sentence. 11 / 26

  12. Problems with propositionalisation Propositionalisation is ineffjcient; it generates irrelevant sentences. Example seems obvious, but propositionalisation produces irrelevant instantiations. 12 / 26 The inference of Evil ( John ) from ∀𝑦. King (𝑦) ∧ Greedy (𝑦) → Evil (𝑦) King ( John ) ∀𝑧. Greedy (𝑧) Brother ( Richard , John ) facts such as Greedy ( Richard ) . For 𝑞 𝑙 -ary predicates and 𝑜 constants, there are 𝑞 ⋅ 𝑜 �

  13. Unifjcation substitution such that the sentences become identical under We can get the inference immediately if we can fjnd a its application. 13 / 26 substitution 𝜄 such that King (𝑦) and Greedy (𝑦) match King ( John ) and Greedy (𝑧) . 𝜄 = {𝑦/ John , 𝑧/ John } works. Intuitively, the unifjcation of two sentences means to fjnd a 𝜄 ∈ Unify (𝛽, 𝛾) ifg 𝛽𝜄 = 𝛾𝜄 . 𝛽 𝛾 𝜄 Knows ( John , 𝑦) Knows ( John , Jane ) {𝑦/ Jane } Knows ( John , 𝑦) Knows (𝑧, OJ ) {𝑦/ OJ , 𝑧/ John } Knows ( John , 𝑦) Knows (𝑧, Mother (𝑧)) {𝑧/ John , 𝑦/ Mother ( John )} Knows ( John , 𝑦) Knows (𝑦, Richard ) [ fail ]

  14. Term unifjcation 14 / 26 An equation is a pair of terms (𝑢, 𝑢 � ) with 𝑢, 𝑢 � ∈ 𝑈 � (𝑌) . We denote the equation (𝑢, 𝑢 � ) as 𝑢 ? = = 𝑢 � . A unifjcation problem is a fjnite set of equations = = 𝑢 � = = 𝑢 � 𝑉 = {𝑢 � ? � , … , 𝑢 � ? � } A unifjer (solution) for 𝑉 is a substitution 𝜄∶ 𝑌 → 𝑈 � (𝑍) s.t. 𝜄(𝑢 � ) = 𝜄(𝑢 � � ) , for 𝑗 = 1, … , 𝑜 . We denote by Unify (𝑉) the set of unifjers for 𝑉 . If 𝜄 = {𝑦 � /𝑢 � , … , 𝑦 � /𝑢 � } then = = 𝑢 � ∈ 𝑉} . = = 𝜄(𝑢 � ) ∣ 𝑢 ? 𝑉{𝑦 � /𝑢 � , … , 𝑦 � /𝑢 � } = {𝜄(𝑢) ?

  15. Most general unifjer Example There is a single most general unifjer that is unique up to renaming of variables. Example 15 / 26 To unify Knows ( John , 𝑦) and Knows (𝑧, 𝑨) , 𝜄 = {𝑧/ John , 𝑦/𝑨} or 𝜄 = {𝑧/ John , 𝑦/ John , 𝑨/ John } . The fjrst unifjer is more general than the second. A unifjer 𝜄 ∈ Unify (𝑉) is more general than 𝜀 ∈ Unify (𝑉) if there is a substitution 𝜐 s.t. 𝜀 = 𝜄 ; 𝜐 . A unifjer 𝜄 ∈ Unify (𝑉) is a most general unifjer (mgu) if for any 𝜀 ∈ Unify (𝑉) there is a substitution 𝜐 s.t. 𝜀 = 𝜄 ; 𝜐 . mgu ({ John ? = = 𝑧, 𝑦 ? = = 𝑨}) = {𝑧/ John , 𝑦/𝑨}

  16. Example What is the most general unifjer of the following equations? 16 / 26 • Loves ( John , 𝑦) ? = = Loves (𝑧, Mother (𝑧)) • Loves ( John , Mother (𝑦)) ? = = Loves (𝑧, 𝑧)

  17. 17 / 26 Example ⋅ Solution • Loves ( John , 𝑦) ? = = Loves (𝑧, Mother (𝑧)) {𝑦/ Mother ( John ), 𝑧/ John } • Loves ( John , Mother (𝑦)) ? = = Loves (𝑧, 𝑧) Fail

  18. Unifjcation The following algorithm transforms a non-ground unifjcation 18 / 26 Let 𝑆 = {𝑦 � ? = = 𝑢 � , … , 𝑦 � ? = = 𝑢 � } be a unifjcation problem with variables from 𝑌 , and 𝑍 the set of variables occurring in 𝑢 � . We say that 𝑆 is solved if 𝑦 � ≠ 𝑦 � for 𝑗 ≠ 𝑘 and 𝑦 � ∉ 𝑍 . Any solved problem 𝑆 defjnes a substitution 𝜄 � 𝜄 � = {𝑦 � /𝑢 � , … , 𝑦 � /𝑢 � } 𝜄 � ∈ Unify (𝑆) problem 𝑉 into another non-ground unifjcation problem 𝑆 . If 𝑆 = ∅ , then 𝑉 has no unifjers. Otherwise, 𝑆 is solved, and the substitution 𝜄 � determined by 𝑆 is an mgu for 𝑉 . What happens if 𝑉 is ground?

Recommend


More recommend