Presentation is loading. Please wait.

Presentation is loading. Please wait.

11 Artificial Intelligence CS 165A Thursday, November 1, 2007  First-order logic (Ch 8)  Inference in FOL (Ch 9) 1.

Similar presentations


Presentation on theme: "11 Artificial Intelligence CS 165A Thursday, November 1, 2007  First-order logic (Ch 8)  Inference in FOL (Ch 9) 1."— Presentation transcript:

1 11 Artificial Intelligence CS 165A Thursday, November 1, 2007  First-order logic (Ch 8)  Inference in FOL (Ch 9) 1

2 2 Notes HW#3 due Thursday, November 8 th Reminder: Keep up with the reading –Chapter 9 for today and Tuesday

3 3 Expansion of universal quantifier  x Enrolled(x, cs165a)  Smart(x) This is equivalent to –Enrolled (Tom, cs165a)  Smart (Tom)  Enrolled (Mary, cs165a)  Smart (Mary)  Enrolled (Chris, cs165a)  Smart (Chris)  Enrolled (chair, cs165a)  Smart (chair)  Enrolled (dirt, cs165a)  Smart (dirt)  Enrolled (surfboard, cs165a)  Smart (surfboard)  Enrolled (tooth, cs165a)  Smart (tooth)  Enrolled (Mars, cs165a)  Smart (Mars)  … –Everything! So,  x Enrolled (x, cs165a)  Smart (x) is equivalent to –Enrolled (Tom, cs165a)  Smart (Tom)  Enrolled (chair, cs165a)  Smart (chair)  …

4 4 Existential Quantifier (“There exists…”)  –  x – “There exists an x such that…” –  x, y – “There exist x and y such that…” Examples –“Somebody likes me”   x Likes (x, Me) ???  Equivalent to:  i Likes (x i, Me) –Likes (Joe, Me)  Likes (Mary, Me)  Likes (apple, Me)  Likes (dirt, Me)  Likes (death, Me)  …  Really “Something likes me” –Unless your domain consists of only people –  x Person (x)  Likes (x, Me) –  x Enrolled (x, cs165a)  WillReceiveAnA+ (x) Logical AND is a product Logical OR is a sum

5 5 Expansion of existential quantifier  x Enrolled (x, cs165a)  WillReceiveAnA+ (x) This is equivalent to –Enrolled (Tom, cs165a)  WillReceiveAnA+ (Tom)  Enrolled (Mary, cs165a)  WillReceiveAnA+ (Mary)  … …  Enrolled (Chris, cs165a)  WillReceiveAnA+ (Chris) What does this mean? –NOT “Someone in cs165a will receive an A+” –NOT “There’s someone who, if he/she were enrolled in cs165a, would receive an A+” –Rather: “Someone is enrolled in 165a and will receive an A+”

6 6 Scope of Quantifiers Scope – the portion of the {program, function, definition, sentence…} in which the object can be referred to by its simple name Parentheses can clarify the scope (make it explicit) –  x (  y ) However, the scope of quantifiers is often implicit –  w  x  y  z is the same as –  w (  x (  y (  z ) ) ) –  w  x  y  z  is the same as –  w  x  y  z (  )

7 7 Scope of Quantifiers (cont.)  x   x –  x ( )   x ( ) –  x ( )   y ( ) –  x Rich(x)  Beautiful(x)  “Someone is both rich and beautiful” –  x Rich(x)   x Beautiful(x)  “Someone is rich and someone is beautiful”  Same as  x Rich(x)   y Beautiful(y) How about –  x ( Rich(x)   x (Beautiful(x)) ) –The same as  x Rich(x)   x Beautiful(x) Same as in scope of variables in programming (C/C++, Java, etc.) Equivalent

8 8 Order, nesting of Quantifiers Implied nesting: –  x  y is the same as  x (  y ) –  x  y is the same as  x (  y )  x  y is the same as  y  x –Also,  x, y  x  y is the same as  y  x –Also,  x, y  x  y is not the same as  y  x –Try  x  y Loves(x, y) and  y  x Loves(x, y)

9 9 Example of quantifier order  x  y Loves(x, y) –  x [  y Loves(x, y) ] –  x [ Loves(x, Fred)  Loves(x, Mary)  Loves(x, Chris)  … ] –“There is at least one person who loves everybody”  Assuming the domain consists of only people  y  x Loves(x, y) –  y [  x Loves(x, y) ] –  y [ Loves(Joe, y)  Loves(Sue, y)  Loves(Kim, y)  … ] –“Everybody is loved by at least one person”

10 10 Interchangeability of  and   can be expressed using  –  x Statement-about-x … is equivalent to … –  x  Statement-about-x –Example:  x Likes(x, IceCream)   x  Likes(x, IceCream)  can be expressed using  –  x Statement-about-x … is equivalent to … –   x  Statement-about-x –Example:  x Likes(x, Spinach)   x  Likes(x, Spinach) Why care about this?

11 Brothers are siblings Sibling is transitive One’s mother is one’s sibling’s mother A first cousin is a child of a parent’s sibling 11 Examples of FOL –  x, y Brother(x, y)  Sibling(x, y) –  x, y, z Sibling(x, y)  Sibling(y, z)  Sibling(x, z) –  x, y, z Mother(x, y)  Sibling(y, z)  Mother(x, z) –  x, y FirstCousin(x, y)   v, w Parent(v, x)  Sibling(v, w)  Parent(w, y)

12 12 J, G Implication and Equivalence Note the difference between  and  –Implication / conditional (  )  A  B : “A implies B”, “If A then B” –Equivalence / biconditional (  )  A  B : “A is logically equivalent to B”  Same as (A  B)  (B  A) : “A if and only if B”, “A iff B” For “Sisters are siblings”, which one?  x, y Sister(x, y)  Sibling(x, y)  x, y Sister(x, y)  Sibling(x, y) How about “Goobligs are jinglenors”?  x, y Goobligs(x, y)  Jinglenors(x, y)  x, y Goobligs(x, y)  Jinglenors(x, y) J G Depends on the semantics!

13 13 Equivalence and Equality Note the difference between = and  Examples: –Brothers(x, y)  Brothers(y, x) –Difference(x, y) = Product(x, y) Different usage – can tell from syntax –Equivalence: sentence  sentence  T/F  T/F –Equality: term = term  Object = object  Which may be true or false – it’s the predicate –Equals(object1, object2) Causal relationship – can infer one from another Constrains the variables

14 14 Natural language vs. Logic Important: The semantics of the English language are sometimes unclear or ambivalent –But the semantics of a logic (or a KRL) should never be unclear or ambivalent! Don’t assume. The syntax and the context may disambiguate things: –Mother(Lisa)  “Lisa is a mother” or “the mother of Lisa” –Age(Lisa)  “Lisa is an age” or “the age of Lisa” –MotherOf(Lisa)  “Lisa is a motherof” or “the mother of Lisa” –MotherOf(Lisa, Mary)  “Lisa is the mother of Mary” or “the mother of Lisa is Mary” –Which are predicates and which are terms??? Age(x) = Age(y) [Clearly, “the Age of”] Mother(x)  Female(x) [Clearly, “is a mother”]

15 15 Natural language vs. Logic (cont.) When it’s not obvious, supply the definition of a predicate, for example –P(x)  True if the first letter of the string x is ‘A’-‘Z’; else False But how to define Person(x) –Person(x)  True if x has skin and hands and hair (usually) and… Bottom line: –As in programming, syntax and context do not always clarify. Therefore, document your “code”! This does not mean that everything has to be completely and exhaustively specified in order to be used –You don’t need a complete definition of every axiom

16 16 Where we are… Basics of logic: Propositional logic More general logic representation: First-order logic Now, let’s see how to use FOL to do logical inference –I.e., to reason about the world

17 Inference in First-Order Logic Chapter 9

18 18 Simple example Bob is a buffalo Pat is a pig Buffaloes outrun pigs Does Bob outrun Pat? Buffalo(Bob) Pig(Pat) Buffalo(x)  Pig(y)  Outrun(x,y) KB entails Outrun(Bob, Pat)? KB 0 |– Buffalo(Bob)  Pig(Pat) (And-Introduction) KB 1 |– Buffalo(Bob)  Pig(Pat)  Outrun(Bob, Pat) (Universal Instantiation) [coming soon] KB 2 |– Outrun(Bob, Pat) (Modus Ponens) KB 1 KB 0 KB 2 KB 3 KB 0 S


Download ppt "11 Artificial Intelligence CS 165A Thursday, November 1, 2007  First-order logic (Ch 8)  Inference in FOL (Ch 9) 1."

Similar presentations


Ads by Google