1 / 36

Cooperating Intelligent Systems

Cooperating Intelligent Systems. Inference in first-order logic Chapter 9, AIMA. Reduce to propositional logic. Reduce the first order logic sentences to propositional (boolean) logic. Use the inference systems in propositional logic.

dmitri
Download Presentation

Cooperating Intelligent Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA

  2. Reduce to propositional logic • Reduce the first order logic sentences to propositional (boolean) logic. • Use the inference systems in propositional logic. We need a system for transfering sentences with quantifiers to sentences without quantifiers 

  3. FOL inference rules All the propositional rules (Modus Ponens, And Elimination, And introduction, etc.) plus: Universal Instantiation (UI) Where the variable x is replaced by the ground term a everywhere in the sentence w. Example: ∀x P(x,f(x),B) ⇒ P(A,f(A),B) Existential Instantiation (EI) Where the variable x is replaced by a ground term a (that makes the sentence true) in the sentence w. Example: ∃x Q(x,g(x),B) ⇒ Q(A,g(A),B) A must be a new symbol. Ground term = a term without variables

  4. Example: Kings... C is called a Skolem constant Making up names is called skolemization

  5. Example: Kings... C is called a Skolem constant Making up names is called skolemization

  6. Propositionalization Apply Universal Instantiation (UI) and Existential Instantiation (EI) so that every FOL KB is made into a propositional KB. ⇒ We can use the tools from propositional logic to prove theorems. Problem with function constants: Father(A), Father(Father(A)), Father(Father(Father(A))), etc. ad infinitum...infinite number of sentences...how can we prove this in finite time? Theorem: We can find every entailed sentence [Gödel, Herbrand], but the search is not guaranteed to stop for nonentailed sentences.(”Solution”: negation-as-failure, stop after a certain time and assume the sentence is false) Inefficient...generalized (lifted) inference rules better

  7. Notation: Substitution Subst(q,a) = Apply the substitution q to the sentence a. Example: • = {x/John} (replace x with John) a = (King(x) ∧ Greedy(x)) ⇒ Evil(x) (King(John) ∧ Greedy(John)) ⇒ Evil(John) General form: q = {v/g} where v is a variable and g is a ground term.

  8. KB p1 = King(John) q1 = King(x) ∀x (King(x) ∧ Greedy(x) ⇒ Evil(x)) p2 = Greedy(John) q2 = Greedy(x) q = {x/John} r = Evil(x) Generalized (lifted) Modus Ponens For atomic sentences pi, qi, and r where there exists a substitution q such that Subst(q,pi) = Subst(q,qi) for all i

  9. KB p1 = King(John) q1 = King(x) ∀x (King(x) ∧ Greedy(x) ⇒ Evil(x)) p2 = Greedy(John) q2 = Greedy(x) q = {x/John} r = Evil(x) Generalized (lifted) Modus Ponens For atomic sentences pi, qi, and r where there exists a substitution q such that Subst(q,pi) = Subst(q,qi) for all i

  10. KB p1 = King(John) q1 = King(x) ∀x (King(x) ∧ Greedy(x) ⇒ Evil(x)) p2 = Greedy(John) q2 = Greedy(x) q = {x/John} r = Evil(x) King(John), Greedy(John) Subst(q,r) = Evil(John) ⇒Evil(John) Generalized (lifted) Modus Ponens For atomic sentences pi, qi, and r where there exists a substitution q such that Subst(q,pi) = Subst(q,qi) for all i Lifted inference rules make only the necessary substitutions

  11. Example: Arms dealer KB in Horn Form

  12. Example: Arms dealer KB in Horn Form Facts

  13. Forward chaining: Arms dealer Forward chaining generates all inferences (also irrelevant ones) We have proved thatWest is a criminal Criminal(West) American(x) ∧ Weapon(y) ∧ Hostile(z)∧ Sells(x,y,z) ⇒ Criminal(x)q = {x/West, y/M, z/NoNo} Weapon(M) Sells(West,M,NoNo) Hostile(NoNo) Missile(x) ∧ Owns(NoNo,x) ⇒Sells(West,x,NoNo)q = {x/M} Missile(x) ⇒ Weapon(x)q = {x/M} Enemy(x,America) ⇒ Hostile(x)q = {x/NoNo} American(West) Missile(M) Owns(NoNo,M) Enemy(NoNo,America)

  14. Example: Financial advisor KB in Horn Form • SavingsAccount(Inadequate) ⇒ Investments(Bank) • SavingsAccount(Adequate) ∧ Income(Adequate) ⇒ Investments(Stocks) • SavingsAccount(Adequate) ∧ Income(Inadequate) ⇒ Investments(Mixed) • ∀x (AmountSaved(x) ∧∃y (Dependents(y) ∧ Greater(x,MinSavings(y))) ⇒ SavingsAccount(Adequate)) • ∀x (AmountSaved(x) ∧∃y (Dependents(y) ∧¬Greater(x,MinSavings(y))) ⇒ SavingsAccount(Inadequate)) • ∀x (Earnings(x,Steady) ∧∃y (Dependents(y) ∧ Greater(x,MinIncome(y))) ⇒ Income(Adequate)) • ∀x (Earnings(x,Steady) ∧∃y (Dependents(y) ∧¬Greater(x,MinIncome(y))) ⇒ Income(Inadequate)) • ∀x (Earnings(x,UnSteady) ⇒ Income(Inadequate)) • AmountSaved($22000) • Earnings($25000,Steady) • Dependents(3) MinSavings(x) ≡ $5000•xMinIncome(x) ≡ $15000 + ($4000•x) Example from G.F. Luger, ”Artificial Intelligence” 2002

  15. FC financial advisor Investments(Mixed) SavingsAccount(Adequate) Income(Inadequate) ¬Greater($25000,MinIncome) Greater($22000,MinSavings) MinIncome = $27000MinSavings = $15000 AmountSaved($22000) Dependents(3) Earnings($25000,Steady)

  16. FOL CNF (Conjunctive Normal Form) Literal = (possibly negated) atomic sentence, e.g., ¬Rich(Me) Clause = disjunction of literals, e.g. ¬Rich(Me) ∨ Unhappy(Me) The KB is a conjunction of clauses Any FOL KB can be converted to CNF as follows: • Replace (P ⇒ Q) by (¬P ∨ Q) (implication elimination) • Move ¬ inwards, e.g., ¬∀x P(x) becomes ∃x ¬P(x) • Standardize variables apart, e.g., (∀x P(x) ∨∃x Q(x)) becomes (∀x P(x) ∨∃y Q(y)) • Move quantifiers left, e.g., (∀x P(x) ∨∃y Q(y)) becomes ∀x ∃y (P(x) ∨ Q(y)) • Eliminate ∃ by Skolemization • Drop universal quantifiers • Distribute ∧ over ∨, e.g., (P ∧ Q) ∨ R becomes (P ∨ R) ∧ (Q ∨ R) Slide from S. Russel

  17. CNF example ”Everyone who loves all animals is loved by someone” ∀x [∀y Animal(y) ⇒ Loves(x,y)] ⇒ ∃y Loves(y,x) Implication elimination∀x ¬[∀y ¬Animal(y) ∨ Loves(x,y)] ∨ ∃y Loves(y,x) Move ¬ inwards (¬∀y P becomes ∃y ¬P)∀x [∃y ¬(¬Animal(y) ∨ Loves(x,y))] ∨ ∃y Loves(y,x)∀x [∃y (Animal(y) ∧¬Loves(x,y))] ∨ ∃y Loves(y,x)∀x [∃y Animal(y) ∧¬Loves(x,y)] ∨ ∃y Loves(y,x) Standardize variables individually∀x [∃y Animal(y) ∧¬Loves(x,y)] ∨ ∃z Loves(z,x) Skolemize (Replace ∃ with constants)∀x [Animal(F(x)) ∧¬Loves(x,F(x))] ∨ Loves(G(x),x)Why not ∀x [Animal(A) ∧¬Loves(x,A)] ∨ Loves(B,x) ?? Drop ∀[Animal(F(x)) ∧¬Loves(x,F(x))] ∨ Loves(G(x),x) Distribute ∨ over ∧[Animal(F(x)) ∨ Loves(G(x),x)] ∧ [¬Loves(x,F(x)) ∨ Loves(G(x),x)]

  18. Notation: Unification Unify(p,q) = q means that Subst(q,p) = Subst(q,q)

  19. FOL resolution inference rule First-order literals are complementary if one unifies with the negation of the other Where Unify(li,¬mj) = q. Note that li and mj are removed

  20. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable Start fromthe top ¬ Arms dealer example

  21. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ∀x (American(x)∧Weapon(y)∧Hostile(z)∧Sells(x,y,z)⇒Criminal(x)) Translate to CNF: ∀x (¬(American(x)∧Weapon(y)∧Hostile(z)∧Sells(x,y,z))∨Criminal(x)) ∀x ((¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z))∨Criminal(x)) ∀x (¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z)∨Criminal(x)) ¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z)∨Criminal(x) • Any FOL KB can be converted to CNF as follows: • Replace (P ⇒ Q) by (¬P ∨ Q) (implication elimination) • Move ¬ inwards, e.g., ¬∀x P(x) becomes ∃x ¬P(x) • Standardize variables apart, e.g., (∀x P(x) ∨ ∃x Q(x)) becomes (∀x P(x) ∨ ∃y Q(y)) • Move quantifiers left, e.g., (∀x P(x) ∨ ∃y Q(y)) becomes ∀x ∃y (P(x) ∨ Q(y)) • Eliminate ∃ by Skolemization • Drop universal quantifiers • Distribute ∧ over ∨, e.g., (P ∧ Q) ∨ R becomes (P ∨ R) ∧ (Q ∨ R) ¬ Arms dealer example

  22. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ∀x (American(x)∧Weapon(y)∧Hostile(z)∧Sells(x,y,z)⇒Criminal(x)) Translate to CNF: ∀x (¬(American(x)∧Weapon(y)∧Hostile(z)∧Sells(x,y,z))∨Criminal(x)) ∀x ((¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z))∨Criminal(x)) ∀x (¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z)∨Criminal(x)) ¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z)∨Criminal(x) • Any FOL KB can be converted to CNF as follows: • Replace (P ⇒ Q) by (¬P ∨ Q) (implication elimination) • Move ¬ inwards, e.g., ¬∀x P(x) becomes ∃x ¬P(x) • Standardize variables apart, e.g., (∀x P(x) ∨ ∃x Q(x)) becomes (∀x P(x) ∨ ∃y Q(y)) • Move quantifiers left, e.g., (∀x P(x) ∨ ∃y Q(y)) becomes ∀x ∃y (P(x) ∨ Q(y)) • Eliminate ∃ by Skolemization • Drop universal quantifiers • Distribute ∧ over ∨, e.g., (P ∧ Q) ∨ R becomes (P ∨ R) ∧ (Q ∨ R) ¬ Arms dealer example

  23. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable Where Unify(li,¬mj) = q. ¬ Arms dealer example

  24. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable Where Unify(li,¬mj) = q. l1 = ¬American(x) l2 = ¬Weapon(y) l3 = ¬Sells(x,y,z) l4 = ¬Hostile(z) l5 = Criminal(x) m1 = Criminal(West) Unify(l5,¬m1) = q= {x/West} Subst(q,l1∨ l2∨ l3∨ l4) =... ¬ Arms dealer example

  25. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ¬ Arms dealer example

  26. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable l1 = ¬American(x) l2 = ¬Weapon(y) l3 = ¬Sells(x,y,z) l4 = ¬Hostile(z) l5 = Criminal(x) m2 = American(West) Unify(l1,¬m2) = q= {x/West} Subst(q,l2∨ l3∨ l4) =... ¬ Arms dealer example

  27. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ¬ Arms dealer example

  28. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ¬ Arms dealer example

  29. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ? ¬ Arms dealer example

  30. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable l2 = ¬Weapon(y) l3 = ¬Sells(x,y,z) l4 = ¬Hostile(z) m3 = Weapon(x) m4 = Missile(x) Unify(l2,¬m3) = q= {y/x} Subst(q,l2∨ l3∨ l4 ∨ m4) =... ¬ Arms dealer example

  31. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ? ¬ Arms dealer example

  32. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ¬ Arms dealer example

  33. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ¬ Arms dealer example

  34. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ¬ Arms dealer example

  35. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ¬ Arms dealer example

  36. Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable ¬ Arms dealer example ∅

More Related