predicate calculus i nference logical agents
play

Predicate Calculus -- I nference Logical Agents Reasoning [Ch 6] - PDF document

1 RN, Chapter 9 Predicate Calculus -- I nference Logical Agents Reasoning [Ch 6] Propositional Logic [Ch 7] Predicate Calculus Representation [Ch 8] Syntax, Semantics, Expressiveness Example: Circuits Inference


  1. 1 RN, Chapter 9 Predicate Calculus -- I nference

  2. Logical Agents Reasoning [Ch 6] � Propositional Logic [Ch 7] � � Predicate Calculus � Representation [Ch 8] � Syntax, Semantics, Expressiveness � Example: Circuits � Inference [Ch 9] � Resolution Implemented Systems [Ch 10] � Planning [Ch 11] � 2

  3. Proof Process for Predicate Calculus � Why not “Model Checking” approach? � Still use Inference Rules to obtain new facts from exisiting info Still seeking... If ⊢ � is SOUND+ COMPLETE, ≡ ⊢ ⊨ ⇒ ⇒ Computer can IGNORE SEMANTICS and just push symbols! � Still exploiting SOUND inference rules MONOTONICITY 3

  4. 4 (Sound) Inference Rules

  5. Resolution Rule (PC) ¬ Man( x ) v Mortal( x ) � Simple example: Man( Socrates ) Mortal( Socrates ) using binding list λ = { x/Socrates } • Subst( Man(Socrates), λ ) = Subst( Man(x), λ ) • Subst(Mortal(x), λ ) = Mortal( Socrates ) α 1 v α 2 v … v α n � General: β 1 v β 2 v … v β m α ’ 1 v α ’ 2 v … v β ’ 2 v … v β ’ m where there is a binding list, λ , s.t. Subst( α n , λ ) = ¬ Subst( β 1 , λ ) Subst( α i , λ ) = α ’ i ∀ i Subst( β j , λ ) = β ’ j ∀ j + Subsumption: if KB includes P(x) , remove “P(A)”, “P(x) v Q(w)” A v B, remove A v B v C 6

  6. Requirement of Resolution For Resolution to work, need: 1. Particular type of proof procedure to be “complete" A : Called Refutation Proof [... try to find contradiction... ] 2. To express information as Conjunction of Disjunctions A : Called Conjunctive Normal Form [… is universal; can eliminate ⇒ , ∃ , ... ] 3. Process that takes two literals p, q and returns binding-list λ s.t. Subst(p, λ ) = Subst(q, λ ) A : Called Unification [... is well defined, and efficient, and ... ] 7

  7. 1. Refutation Proof KB ⊨ σ � Deduction Theory iff KB ∪ ¬σ is inconsistent iff KB ∪ ¬σ ⊨ { } � To prove σ : Add ¬σ to KB (Attempt to) Prove a contradiction � Resolution is Refutation Complete (in PC) If KB ⊨ σ then ∃ resolution proof of { } from KB ∪ ¬σ 8

  8. 9 Conjunctive Normal Form 2. Conversion to

  9. Skolemizing � To convert arbitrary PredicateCalculus to “Conjunctive Normal Form" need to eliminate ∃ � A : Just “name” it … Using new name, to avoid conflicts ∃ x Rich(x) � Eg: “There is a rich person” becomes Rich( G 1 ) where G 1 is a new “Skolem constant" � Note: Rich( G 1 ) will NOT unify with Rich(Russ) nor Rich( β for any β ) appearing in KB. � Eg: ( ) ( ) d d ∃ y = y y = y k dy k k dy e e � Trickier when ∃ is inside ∀ ... 10

  10. Skolemization # 2 � “Everyone has a heart.” � ∀ X person( X ) ⇒ ∃ Y heart( Y ) & has( X, Y ) � I ncorrect : ∀ X person( X ) ⇒ heart( h 1 ) & has( X, h 1 ) … ?everyone has the SAME heart h 1 ? � Correct : ∀ X person( X ) ⇒ heart( h(X) ) & has( X, h(X) ) where h(.) is a new symbol (“Skolem function”) � Skolem function arguments: all enclosing universally quantified variables � Eg: ∀ A ∀ B ∃ C ∀ D ∃ E g( A,B, C, D, E) ∀ A ∀ B ∀ D g( A,B, f C (A,B), D, f E (A,B,D) ) 11

  11. Skolemization # 2 Skolemizing procedure (to remove existentials) For each existential X, let Y 1 , … Y m be the universally quantified variables that are quantified to the LEFT of X's “ ∃ Y”. Generate new function symbol, g X , of m variables. Replace each X with g X (Y 1 , … Y m ) . (Write g X () as g X .) ∀ Y ∃ X φ (X) & ρ (Y ) → ∀ Y φ ( g X (Y ) ) & ρ (Y ) ∃ X ∀ Y φ (X) & ρ (Y ) → ∀ Y φ ( g X ) & ρ (Y ) 12

  12. Requirement of Resolution For Resolution to work, need: 1. Particular type of proof procedure to be “complete" A : Called Refutation Proof [... try to find contradiction... ] 2. To express information as Conjunction of Disjunctions A : Called Conjunctive Normal Form [… is universal; can eliminate ⇒ , ∃ , ... ] 3. Process that takes two literals p, q and returns binding-list λ s.t. Subst(p, λ ) = Subst(q, λ ) A : Called Unification [... is well defined, and efficient, and ... ] 14

  13. 3. Unification (Specification) Variables capitalized � Fancy Match � Unify( p, q ) = σ � p, q: atomic propositions (w/variables) � σ : binding list ... � Fail or � { V 1 /t 1 , V 2 /t 2 , ..., V n /t n } where � V i 's are distinct, � each t j is { constant, variable, functional expr. } � no V i appears in any t j � If non-Fail, Subst( p, σ ) = Subst( q, σ ) ... ie, σ makes p and q look the same 15

  14. Substitution � Substitution is set { V 1 /t 1 V 2 /t 2 … V n /t n } where � V i are distinct variables � t i are terms that do not use any of the V j s � Examples: { X / a } { X / a, Y / b, Z / f(a, W) } { X / W, Y / f(W), Z/W } { f(X) / a } { X / a, X / b } { X / f(X) } { X / f(Y), Y / g(q) } { X / f( g(q) ), Y / g(q) } 16

  15. Applying a Substitution f( a, h(Y,b), b ) f( a, h(Y,b), X ) { X/b } = f( a, h(f(Z),b), b ) f( a, h(Y,b), X ) { X/b Y/f(Z) } = f( a, h(Y,b), X ) { X/Z Y/f(Z,a) } = f( a, h(f(Z,a),b), Z ) f( a, h(Y,b), X ) { W/Z } = f( a, h(Y,b), X ) � σ need not include all variables in t; σ can include variables not in t 17

  16. Composition of Substitutions � Composition: σ ∘ θ is composition of substitutions σ , θ For any term t, t[ σ ∘ θ ] = (t σ ) θ � Example: f(X) [ { X/Z} ∘ { Z/a} ] = ( f(X) { X/Z} ) { Z/a} = f(Z) { Z/a} = f(a) � σ ∘ θ is a substitution (usually) � Eg: � [ { X/a} ∘ { Y/b} ] = { X/a, Y/b} � [ { X/Z} ∘ { Z/a} ] = { X/a, Z/a} 18

  17. Unifiers � t 1 and t 2 are unified by θ iff t 1 θ = t 2 θ Then θ is called a unifier t 1 and t 2 are unifiable � Both t 1 and t 2 can have variables 19

  18. Multiple Unifiers � { Y/X} and { X/Y} make sense, but { Y/a X/a } has irrelevant constant { X/Y W/g } has irrelevant binding (W) � Adding irrelevant bindings: ∞ unifiers! � Is there a best one ? 20

  19. Quest for Best Unifier INFERIOR unifier = composition of Wish list: Good Unifier + another substitution � No irrelevant constants � So { Y/X} preferred over { Y/a, X/a } � No irrelevant bindings � So { Y/X} preferred over { Y/X, W/f(4,Z) } � Spse λ 1 has constant where λ 2 has variable Eg, λ 1 = { X/a, Y/a } , λ 2 = { X/Y} s.t. λ 2 ∘ Then ∃ substitution μ μ = λ 1 = { Y/a} : { X/Y} ∘ Eg, μ { Y/a} = { X/a, Y/a } � Spse λ 1 has extra binding over λ 2 (Eg, λ 1 = { X/a, Y/b} , λ 2 = { X/a} ) s.t. λ 2 ∘ Then ∃ substitution μ μ = λ 1 = { Y/b} : { X/a} ∘ Eg, μ { Y/b} = { X/a, Y/b} 21

  20. 22 Most General Unifier

  21. MGU – Example# 2 � A mgu for f( W, g(Z), Z ) f( X, Y, h(X) ) is { X/W Y/g(h(W)) Z/h(W) } 23

  22. 24 MGU Procedure

  23. MGU (con't) � Notes: � If t 1 and t 2 are unifiable, then ∃ a mgu � Can be more than 1 mgu but they differ only in variable names � Not every unifier is a mgu. � A mgu uses constants only as necessary. � Implementation: ∃ fast algorithm that computes a mgu of t 1 and t 2 , if one exists; or reports failure. ( Slow part is verifying legal substitution: � none of v i appear in any t j . Avoid by resetting Prolog's occurscheck parameter.) 25

  24. Example � Natural Language Jack owns a dog. Every dog owner is an animal lover. No animal lover kills an animal. Either Jack or Curiosity killed the cat (named Tuna). Did Curiosity kill the cat? � In predicate calculus: ∃ X dog(X) & owns(jack, X) ∀ X ( ∃ Y dog(Y ) & owns(X, Y )) ⇒ animalLover(X) ∀ X animalLover(X) ⇒ ( ∀ Y animal(Y ) ⇒ ¬ kills(X, Y ) ) kills(jack, tuna) v kills(curiosity, tuna) cat(tuna) ∀ X cat(X) ⇒ animal(X) ¬ kill( curiousity, tuna) � Now what? 26

  25. CNF Form � ... in Conjunctive Normal Form ∃ X dog(X) & owns(jack, X) dog(d) ∀ X ( ∃ Y dog(Y ) & owns(X, Y )) ⇒ owns(jack, d) animalLover(X) ∀ X animalLover(X) ⇒ ( ∀ Y animal(Y ) ⇒ ¬ kills(X, Y ) ) (“d” is constant naming Jack's dog) ¬ dog(Y ) v ¬ owns(X, Y ) v animalLover(X) kills(jack, tuna) v kills(curiosity, tuna) ¬ animalLover(W) v ¬ animal(Y ) v ¬ kills(W, Y ) cat(tuna) kills( jack, tuna ) v kills( curiosity, tuna ) ∀ X cat(X) ⇒ animal(X) cat( tuna ) ¬ kill( curiousity, tuna) ¬ cat(Z) v animal(Z) ¬ kills( curiosity, tuna ) Note: Uniform structure � Use new constants / functions: d for existentials (“Skolemizing") ⇒ easier to refer to those objects 27

  26. 28 Refutation Proof by Resolution

  27. “Tricks” � 1. Refutation Proof � 2. Normalization: put in CNF form � Skolemize … remove ∃ (by giving arbitrary, but unique name to ∃ objects) � remove quantifiers � 3. Unification: matching variables/ terms to make literals look similar 29

  28. Properties of Resolution � Sound � KB ⊦ RR σ only if σ is true in EVERY world in which KB holds. � Refutation Complete � KB ⊦ RR σ whenever σ is true in EVERY world in which KB holds. (as ⊦ Resln is []-complete) � Semi-Decidable in Predicate Calculus ? σ : If Yes, returns that answer eventually � KB ⊦ RR If No, may never return � I ntractable Exponential in |KB| for Propositional Logic (Linear for Proposition HORN) 30

Recommend


More recommend