lecture 9 more on predicate logic
play

Lecture 9: More on predicate logic Prof. Julia Hockenmaier - PowerPoint PPT Presentation

CS440/ECE448: Intro to Artificial Intelligence Lecture 9: More on predicate logic Prof. Julia Hockenmaier juliahmr@illinois.edu http://cs.illinois.edu/fa11/cs440 Quick upgrade on quizzes Review:


  1. CS440/ECE448: Intro to Artificial Intelligence � Lecture 9: 
 More on 
 predicate logic � Prof. Julia Hockenmaier � juliahmr@illinois.edu � � http://cs.illinois.edu/fa11/cs440 � � �

  2. Quick upgrade on quizzes �

  3. Review: 
 syntax of 
 predicate logic �

  4. The building blocks � A (finite) set of variables VAR : 
 VAR ={x, y, z,…} A (finite) set of constants CONST : 
 CONST ={john, mary, tom,…} � � For n=1…N : � A (finite) set of n -place function symbols FUNC FUNC 1 ={fatherOf, successor,…} A (finite) set of n -place predicate symbols PRED n : 
 PRED 1 ={student, blue,…} PRED 2 ={friend, sisterOf,…} � � 4 � �

  5. Putting everything together � Terms: constants ( john ); variables ( x ); n-ary function symbols applied to n terms ( fatherOf(x) ) � – Ground terms contain no variables � � Formulas: n- ary predicate symbols applied to n terms ( likes(x,y) ); negated formulas ( ¬ fatherOf(x) ); conjunctions, disjunctions or implications of two formulas; quantified formulas � – Ground formulas (= sentences; propositions) 
 contain no free variables � – Open formulas contain at least one free variable � � CS440/ECE448: Intro AI � 5 �

  6. Semantics of 
 predicate logic �

  7. Model M=(D,I) � The domain D is a nonempty set of objects: � D ={a1, b4, c8,…} � The interpretation function I maps: � - each constant c to an element c I of D: John I = a1 - each n -place function symbol f to an (total) n -ary function f I D n → D : fatherOf I (a1) = b4 � - each n -place predicate symbol p to an n -ary relation p I ⊆ D n : child I ={a1,c8} likes I ={ ⟨ a1, b4 ⟩ , ⟨ b4,a1 ⟩ } 7 �

  8. Interpretation of variables � A variable assignment v over a domain D is a (partial) function from variables to D. The assignment v = [ a21/x, b13/y ] assigns object a21 to the variable x, and object b13 to variable y. We recursively manipulate variable assignments when interpreting quantified formulas. � Notation: v [ b/z ] is just like v , but it also maps z to b. We will make sure that v is undefined for z. � 8 �

  9. Interpretation of terms � Variables: ⟦ x ⟧ M,g = g(x) defined by the variable assignment � Constants: ⟦ c ⟧ M,g = c I 
 defined by the interpretation function � Functions: defined by the interpretation function and recursion on the arguments 
 ⟦ f(t 1 ,….t n ) ⟧ M,g = f I ( ⟦ t 1 ⟧ M,g ,…, ⟦ t n ⟧ M,g ) � 9 �

  10. Interpretation of formulas � Atomic formulas: � ⟦ P(t 1 ,...t n ) ⟧ M,g =true iff ⟨⟦ t 1 ⟧ M,g ,... ⟦ t n ⟧ M,g ⟩ ∈ P I Complex formulas (connectives): ⟦ ¬ φ ⟧ M,g =true iff ⟦ φ ⟧ M,g =false ⟦ φ ∧ ψ ⟧ M,g =true iff ⟦ φ ⟧ M,g =true and ⟦ ψ ⟧ M,g =true ⟦ φ v ψ ⟧ M,g =true iff ⟦ φ ⟧ M,g =true or ⟦ ψ ⟧ M,g =true ⟦ φ → ψ ⟧ M,g =true iff ⟦ φ ⟧ M,g =false or ⟦ ψ ⟧ M,g =true CS440/ECE448: Intro AI � 10 �

  11. Interpretation of formulas: 
 quantifiers � � Universal quantifier: � ⟦∀ x φ ⟧ M,g =true iff ⟦ φ ⟧ M,g[u/x] =true for all u ∈ D Existential quantifier: ⟦∀ x φ ⟧ M,g =true iff ⟦ φ ⟧ M,g[u/x] =true for at least one u ∈ D CS440/ECE448: Intro AI � 11 �

  12. Satisfaction and entailment � φ is satisfied in M ( M ⊨ φ ) iff ⟦ φ ⟧ M,[] =true φ is valid ( ⊨ φ ) iff φ is satisfied in any model. � φ entails ψ iff φ→ ψ is valid. 
 � NB: We cannot interpret open formulas 
 (i.e. containing free variables) � CS440/ECE448: Intro AI � 12 �

  13. Using predicate logic �

  14. From English to predicate logic � Birds fly. � Some birds fly. � There are three people in SC1404. � SC1404 is empty. � There are exactly three people in SC1404. �

  15. “Birds fly” vs “Some birds fly” � Birds fly: �� ∀ x [Bird(x) ⇒ Flies(x)] ≡ ¬ ∃ x [Bird(x) ∧ ¬ Flies(x)] Some birds fly: � ∃ x [Bird(x) ∧ Flies(x)] 
 � �

  16. There are three people in SC1404 
 SC1404 is empty. � � There are three people in 1404: �� ∃ x ∃ y ∃ z [person(x) ∧ in(x, SC1404) ∧ person(y) ∧ in(x, SC1404) ∧ person(z) ∧ in(x, SC1404) ∧ x ≠ y ∧ x ≠ z ∧ y ≠ z] SC1404 is empty. � ¬ ∃ x [person(x) ∧ in(x, SC1404)] � CS440/ECE448: Intro AI � 16 �

  17. There are exactly three people in SC1404 � ∃ x ∃ y ∃ z [person(x) ∧ in(x, SC1404) ∧ person(y) ∧ in(x, SC1404) ∧ person(z) ∧ in(x, SC1404) ∧ x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ ∀ w [(person(w) ∧ in(w, SC1404)) ⟶ (w = x ∨ w = y ∨ w = z)]] CS440/ECE448: Intro AI � 17 �

  18. What about…. � “Most birds fly.” � � This cannot be expressed in FOL: � | bird I ∩ fly I | > 0.5 | bird I | � CS440/ECE448: Intro AI � 18 �

  19. Inference in 
 predicate logic �

  20. Inference in predicate logic � All men are mortal. Socrates is a man. Socrates is mortal. We need a new version of modus ponens: � ∀ x P(x) ⟶ Q(x) P(s’) ────────── Q(s’) � CS440/ECE448: Intro AI � 20 �

  21. FOL is semi-decidable � Can we prove whether A ⊨ B? � � Case 1: A does entail B. � Any sound & complete inference procedure will terminate (and confirm that A ⊨ B) � � Case 2: A does not entail B. � No inference procedure is guaranteed to terminate. �

  22. How do we deal with 
 quantifiers and variables? � � Solution 1: Propositionalization � Ground all the variables. � � Solution 2: Lifted inference � Ground (skolemize) all the existentially quantified variables. All remaining variables are universally quantified. � Use unification. � CS440/ECE448: Intro AI � 22 �

  23. Inference in 
 predicate logic: 
 propositionalization �

  24. Grounding variables � θ = {x 1 /c 1 , …x n /c n } is a list of substitutions: � variable x i is replaced by ground term c i. � � The function S UBST ( θ , ψ ) applies the substitutions in θ to the free variables in formula ψ and returns the result. � � S UBST ({x/a, y/b}, friend(x,y}) = friend(a,b) � CS440/ECE448: Intro AI � 24 �

  25. Substitutions � A substitution θ is a set of pairings of variables v i with terms t i : 
 θ = {v 1 /t 1 , v 2 /t 2 , v 3 /t 3 , …, v n / t n } � • Each variable v i is distinct � • t i can be any term (variable, constant, function), as long as it does not contain v i directly or indirectly � � NB: the order of variables in θ doesn ʼ t matter � {x/y, y/f(a)} = {y/f(a), x/y} = {x/f(a), y/f(a)} �

  26. Are these 
 acceptable substitutions? � {x/y} Yes � {x/y, z/F(y)} Yes � {x/y, z/F(y), x/A} NO: x appears twice � {x/y, z/F(y), y/A} Yes � {x/y, y/F(z), z/G(x)} NO: z/F(z) not allowed �

  27. Universal instantiation � We can replace a universally quantified variable with any ground term: 
 � �∀ x ψ (x) � � ────────── (UI) S UBST ({x/a}, ψ ) Hence: ∀ x (man(x) ⟶ mortal(x)) ────────────── (UI) S UBST ({x/s’}, man(x) ⟶ mortal(x)) = man(s’) ⟶ mortal(s’) CS440/ECE448: Intro AI � 27 �

  28. Existential instantiation � We can replace a existentially quantified variable with a new ground term: � � � �∃ x ψ (x) � ────────── (EI) S UBST ({x/ t }, ψ ) Condition: t doesn’t appear in ψ or in any other formula in our KB Hence: ∃ x man(x) ────── (EI) man(c’) � CS440/ECE448: Intro AI � 28 �

  29. Propositionalization � If we have a finite domain, we can use UI and EI to eliminate all variables. � � KB: ∀ x [(student(x) ∧ inClass(x)) ⟶ sleep(x)] student(Mary) professor(Julia) Propositionalized KB: 
 (student(Mary) ∧ inClass(Mary)) ⟶ sleep(Mary) (student(Julia) ∧ inClass(Julia)) ⟶ sleep(Julia) etc. …this is not very efficient.... � � CS440/ECE448: Intro AI � 29 �

  30. Propositionalization � If we can reduce A ⊨ B to propositional resolution, A ⊨ B is decidable. � � We cannot reduce A ⊨ B to propositional resolution if they contain functions or equality. � � CS440/ECE448: Intro AI � 30 �

  31. Direct (lifted) inference in predicate logic: 
 will it work? �

  32. Some fragments of FOL 
 are decidable � � Can we prove whether A ⊨ B? � � If both A and B belong to the same decidable fragment of FOL, 
 any sound and complete inference procedure will terminate 
 (and tell us whether A ⊨ B) � � CS440/ECE448: Intro AI � 32 �

  33. Which fragment of FOL 
 does φ belong to? � Every WFF in FOL can be translated to prenex conjunctive normal form. � � Prenex form: � All quantifiers are at the front of the formula � � Conjunctive Normal Form: � A conjunction of clauses. � � Depending on the form of the clauses in the CNF of A, B , A ⊨ B may be decidable. � CS440/ECE448: Intro AI � 33 �

  34. Prenex normal form � Every well-formed formula in FOL has an equivalent prenex normal form, 
 in which all the quantifiers are at the front. � � ∀ x ∃ y ∃ z ∀ w φ (x,y,z,w) φ (x,y,z,w) (the ʻ matrix ʼ ) does not contain any quantifiers. � CS440/ECE448: Intro AI � 34 �

Recommend


More recommend