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 Quick upgrade on quizzes Lecture 9: More on predicate logic Prof. Julia Hockenmaier juliahmr@illinois.edu http://cs.illinois.edu/fa11/cs440 The building


  1. CS440/ECE448: Intro to Artificial Intelligence � Quick upgrade on quizzes � Lecture 9: 
 More on 
 predicate logic � Prof. Julia Hockenmaier � juliahmr@illinois.edu � � http://cs.illinois.edu/fa11/cs440 � � � The building blocks � A (finite) set of variables VAR : 
 VAR ={x, y, z,…} Review: 
 A (finite) set of constants CONST : 
 CONST ={john, mary, tom,…} � syntax of 
 � For n=1…N : � predicate logic � 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 � �

  2. Putting everything together � Terms: constants ( john ); variables ( x ); n-ary function symbols applied to n terms ( fatherOf(x) ) � – Ground terms contain no variables � Semantics of 
 � Formulas: n- ary predicate symbols applied to n terms ( likes(x,y) ); negated formulas ( ¬ fatherOf(x) ); predicate logic � 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 � Model M=(D,I) � Interpretation of variables � A variable assignment v over a domain D The domain D is a nonempty set of objects: � is a (partial) function from variables to D. D ={a1, b4, c8,…} � The interpretation function I maps: � The assignment v = [ a21/x, b13/y ] assigns object - each constant c to an element c I of D: John I = a1 a21 to the variable x, and object b13 to variable y. - each n -place function symbol f to an (total) n -ary We recursively manipulate variable assignments function f I D n ! D : fatherOf I (a1) = b4 � when interpreting quantified formulas. � - each n -place predicate symbol p to an n -ary Notation: v [ b/z ] is just like v , but it also maps z to b. relation p I ⊆ D n : child I ={a1,c8} likes I ={ ⟨ a1, b4 ⟩ , ⟨ b4,a1 ⟩ } We will make sure that v is undefined for z. � 7 � 8 �

  3. Interpretation of terms � Interpretation of formulas � Variables: ⟦ x ⟧ M,g = g(x) Atomic formulas: � defined by the variable assignment � ⟦ P(t 1 ,...t n ) ⟧ M,g =true iff ⟨⟦ t 1 ⟧ M,g ,... ⟦ t n ⟧ M,g ⟩ ∈ P I Constants: ⟦ c ⟧ M,g = c I 
 Complex formulas (connectives): defined by the interpretation function � ⟦ ¬ ! ⟧ 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 Functions: defined by the interpretation ⟦ ! # " ⟧ M,g =true iff ⟦ ! ⟧ M,g =false or ⟦ " ⟧ M,g =true function and recursion on the arguments 
 ⟦ f(t 1 ,….t n ) ⟧ M,g = f I ( ⟦ t 1 ⟧ M,g ,…, ⟦ t n ⟧ M,g ) � 9 � CS440/ECE448: Intro AI � 10 � Interpretation of formulas: 
 Satisfaction and entailment � quantifiers � ! is satisfied in M ( M � ! ) iff ⟦ ! ⟧ M,[] =true � Universal quantifier: � ! is valid ( � ! ) iff ! is satisfied in any model. � ⟦∀ x ! ⟧ M,g =true iff ⟦ ! ⟧ M,g[u/x] =true for all u ∈ D ! entails " iff !# " is valid. 
 � Existential quantifier: NB: We cannot interpret open formulas 
 ⟦∀ x ! ⟧ M,g =true iff ⟦ ! ⟧ M,g[u/x] =true (i.e. containing free variables) � for at least one u ∈ D CS440/ECE448: Intro AI � 11 � CS440/ECE448: Intro AI � 12 �

  4. From English to predicate logic � Birds fly. � Some birds fly. � Using predicate logic � There are three people in SC1404. � SC1404 is empty. � There are exactly three people in SC1404. � There are three people in SC1404 
 “Birds fly” vs “Some birds fly” � SC1404 is empty. � Birds fly: �� � ! x [Bird(x) " Flies(x)] There are three people in 1404: �� $ ¬ # x [Bird(x) $ ¬ Flies(x)] # x # y # z [person(x) $ in(x, SC1404) $ person(y) $ in(x, SC1404) $ person(z) $ in(x, SC1404) Some birds fly: � # x [Bird(x) $ Flies(x)] 
 $ x % y $ x % z $ y % z] � SC1404 is empty. � ¬ # x [person(x) $ in(x, SC1404)] � � CS440/ECE448: Intro AI � 16 �

  5. There are exactly three people in What about…. � SC1404 � # x # y # z [person(x) $ in(x, SC1404) “Most birds fly.” � $ person(y) $ in(x, SC1404) � $ person(z) $ in(x, SC1404) This cannot be expressed in FOL: � $ x % y $ x % z $ y % z | bird I & fly I | > 0.5 | bird I | $ ! w [(person(w) $ in(w, SC1404)) � ! (w = x ∨ w = y ∨ w = z)]] CS440/ECE448: Intro AI � 17 � CS440/ECE448: Intro AI � 18 � Inference in predicate logic � All men are mortal. Socrates is a man. Socrates is mortal. Inference in 
 We need a new version of modus ponens: � predicate logic � ∀ x P(x) ! Q(x) P(s’) '''''''''' Q(s’) � CS440/ECE448: Intro AI � 20 �

  6. How do we deal with 
 FOL is semi-decidable � quantifiers and variables? � Can we prove whether A � B? � � � Solution 1: Propositionalization � Case 1: A does entail B. � Ground all the variables. � Any sound & complete inference procedure � will terminate (and confirm that A � B) � Solution 2: Lifted inference � � Ground (skolemize) all the existentially Case 2: A does not entail B. � quantified variables. All remaining variables No inference procedure is guaranteed to are universally quantified. � terminate. � Use unification. � CS440/ECE448: Intro AI � 22 � 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. � Inference in 
 � The function S UBST ( ( , " ) applies the predicate logic: 
 substitutions in ( to the free variables in propositionalization � formula " and returns the result. � � S UBST ({x/a, y/b}, friend(x,y}) = friend(a,b) � CS440/ECE448: Intro AI � 24 �

  7. Are these 
 Substitutions � acceptable substitutions? � A substitution ( is a set of pairings of variables v i with terms t i : 
 {x/y} Yes � ( = {v 1 /t 1 , v 2 /t 2 , v 3 /t 3 , …, v n / t n } {x/y, z/F(y)} Yes � � • Each variable v i is distinct � {x/y, z/F(y), x/A} • t i can be any term (variable, constant, NO: x appears twice � function), as long as it does not contain v i {x/y, z/F(y), y/A} Yes � directly or indirectly � � {x/y, y/F(z), z/G(x)} NO: z/F(z) not allowed � 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)} � Universal instantiation � Existential instantiation � We can replace a universally quantified variable We can replace a existentially quantified with any ground term: 
 variable with a new ground term: � � � �∀ x " (x) � �∃ x " (x) � � � '''''''''' (UI) '''''''''' (EI) S UBST ({x/a}, " ) S UBST ({x/ t }, " ) Condition: t doesn’t appear in " or in Hence: ∀ x (man(x) ! mortal(x)) any other formula in our KB '''''''''''''' (UI) Hence: ∃ x man(x) S UBST ({x/s’}, man(x) ! mortal(x)) '''''' (EI) = man(s’) ! mortal(s’) man(c’) � CS440/ECE448: Intro AI � 27 � CS440/ECE448: Intro AI � 28 �

  8. Propositionalization � Propositionalization � If we can reduce A � B to propositional If we have a finite domain, we can use UI and EI to eliminate all variables. � resolution, A � B is decidable. � � � KB: ∀ x [(student(x) ! inClass(x)) ! sleep(x)] student(Mary) professor(Julia) We cannot reduce A � B to propositional resolution if they contain functions or Propositionalized KB: 
 equality. � (student(Mary) ! inClass(Mary)) ! sleep(Mary) (student(Julia) ! inClass(Julia)) ! sleep(Julia) � etc. …this is not very efficient.... � � CS440/ECE448: Intro AI � 29 � CS440/ECE448: Intro AI � 30 � Some fragments of FOL 
 are decidable � � Can we prove whether A � B? � Direct (lifted) inference � in predicate logic: 
 If both A and B belong to the same decidable fragment of FOL, 
 will it work? � any sound and complete inference procedure will terminate 
 (and tell us whether A � B) � � CS440/ECE448: Intro AI � 32 �

  9. 
 Which fragment of FOL 
 Prenex normal form � does ! belong to? � Every WFF in FOL can be translated to prenex Every well-formed formula in FOL has an conjunctive normal form. � equivalent prenex normal form, 
 � in which all the quantifiers are at the front. � Prenex form: � � All quantifiers are at the front of the formula � � ∀ x ∃ y ∃ z ∀ w ! (x,y,z,w) Conjunctive Normal Form: � A conjunction of clauses. � ! (x,y,z,w) (the ʻ matrix ʼ ) does not contain any � Depending on the form of the clauses in the CNF quantifiers. � of A, B , A � B may be decidable. � CS440/ECE448: Intro AI � 33 � CS440/ECE448: Intro AI � 34 � We can move quantifiers 
 Equivalences: 
 outside of connectives � alphabetic variants � We can move quantifiers to the front, e.g.: � � # xP(x) $ # yQ(y) % # x # y [P(x) $ Q(y)] We already saw: � but we cannot ʻ merge ʼ them: � � # xP(x) $ # xQ(x) � # x [P(x) $ Q(y)] ! xP(x) $ ! yQ(y) % ! x ! y [P(x) $ Q(y)] ! xP(x) & ! yQ(y) % ! x ! y [P(x) & Q(y)] To avoid clashes, we first rename bound variables to any other new (unbound) variable: � # xP(x) $ # yQ(y) % # x # y [P(x) $ Q(y)] � # xP(x) $ # xQ(x) % # xP(x) $ # yQ(y) # xP(x) & # yQ(y) % # x # y [P(x) & Q(y)] # yQ(y) is an alphabetic variant of # xQ(x) � � � 35 � CS440/ECE448: Intro AI � 36 �

Recommend


More recommend