1 / 29

First Order Logic II

First Order Logic II. Introduction to Artificial Intelligence CS440/ECE448 Lecture 11 SECOND HOMEWORK OUT THURSDAY. Last lecture. First order logic Syntax and semantics This Lecture First order logic Fun (?) with sentences Inference in first order logic Resolution Reading

Download Presentation

First Order Logic II

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. First Order Logic II Introduction to Artificial Intelligence CS440/ECE448 Lecture 11 SECOND HOMEWORK OUT THURSDAY

  2. Last lecture • First order logic • Syntax and semantics This Lecture • First order logic • Fun (?) with sentences • Inference in first order logic • Resolution Reading • Chapters 8 and 9

  3. Syntax of FOL: Basic elements Constants Wumpus, 2, UIUC, ... Predicates Brother, >, ... Functions Sqrt, LeftLegOf, ... Connectives     Variables x, y, a, b, ... Quantifiers  Equality = A legitimate expression of predicate calculus is called a well-formed formula (wff) or, simply, a sentence.

  4. Atomic sentences Atomic Sentence: predicate(term1, …, termn) or term1 = term2 Term: function (term1, …, termn) or constant or variable For example: Instructor(CS440,Jean) Instructor(CS440, Son(JeanJacques)) Instructor(CS440, Son(x))

  5. a d b c e Sets • The set of objects defines a “Universe of Discourse.” [Objects are represented by Constant Symbols.] • For example, in this blocks world, the universe of discourse is {a,b,c,d,e}. Interpretation: A  a B  b C  c D  d E  e

  6. a d b c e Relations • Def: A binary relation is a set of ordered pairs • Example: Consider set of blocks {a,b,c,d,e} • The “on” relation: • on = {<a,b>, <b,c>, <d,e>}. • The predicate On(A,B) can be interpreted as: <a,b>  on. • On(A,B) is TRUE, but On(A,C) and On(C,D) are FALSE (in this interpretation).

  7. a d b c e Functions • hat = {<c,b>, <b,a>,<e,d>} • hat (c) = b • hat(b) = a • hat(d) is not defined. • Hat(E) can be interpreted as d.

  8. a d b c e Formalizing Knowledge • The first step in formalizing knowledge is to construct a conceptualization, i.e., a representation of the objects in the world, and their relationships: • Objects – Universe of discourse; • Functions – Functional basis set; • Relations – Relational basis set. • A conceptualization is a triple < U of D, FBS, RBS >. • Blocks World: <{a,b,c,d,e}, {hat, …}, {on, …}>. • Second step is to express conceptualization using first order logic.

  9. a d b c e Formalizing Knowledge II • Second step is to express conceptualization using first order logic. • On(A,B) • On(B,C) • On(D,E) • On(A,Hat(C))

  10. Universal quantifiers • “Birds Fly” x Bird(x) ) Fly(x) • But what about penguins? x Bird (x)Penguin(x)  Fly(x)

  11. Existential quantifiers • “Some CS440 student is sleeping.”  x CS440Student (x)  Sleeping(x) • Note: There could be more than one sleeping student, but this says that there is at least one. • To say “Exactly one CS440 student is sleeping.” • x CS440Student (x)  Sleeping(x)^ [  y (CS440Student(y) Sleeping(y))  (x=y) ] • This is cumbersome, so sometimes a shorthand is used called the “uniqueness quantifier” ! x i.e., there exists a unique x.

  12. Variables must be quantified • In a well-formed formula (wff), all variables must be quantified. • The following are wffs:  x At (x, UIUC)  Smart(x) • x At (x, Indiana)  Smart(x) • The following are not wffs: At (x, UIUC)  Smart(x) At (x, Indiana)  Smart(x) • Occasionally, you will see expressions with variables that are not quantified. In this case, there is an implicit universal quantifier on those variables.

  13. Properties of quantifiers • x y is the same as y x • x y is the same as y x • x  yis not the same as y x • Example • Hates predicate: Hates(x,y) is true if x hates y • x y =Hates(x,y) ``There is a person who hates everyone in the world.'' • y x Hates(x,y) ``Everyone in the world is hated by at least one person.'

  14. Quantifier Duality Each quantifier (Universal or Existential) can be expressed using the other. x Likes(x, IceCream) • Everyone likes Ice Cream.  x  Likes(x, IceCream) [the dual] • There does not exist anyone who does not like ice cream. • Nobody dislikes ice cream. x Likes(x, BrusselSprouts) • Someone likes Brussel sprouts. x Likes(x, BrusselSprouts) [the dual] • Not everyone dislikes Brussel sprouts.

  15. Equality term1 = term2 is true under a given interpretation if and only if term1 and term2 refer to the same object E.g., definition of (full) Sibling in terms of Parent x, y Sibling(x,y)  [(x=y)  m,f (m=f)  Parent(m,x)  Parent(f,x)  Parent(m,y)  Parent(f,y)]

  16. Fun with sentences Brothers are siblings x, y Brother(x,y)  Sibling(x,y) ``Sibling'' is reflexive x, y Sibling(x,y)  Sibling(y,x) One's mother is one's female parent x, y Mother(x,y)  (Female(x)  Parent(x,y)) A first cousin is a child of a parent's sibling x, y FirstCousin(x,y)   p, ps Parent (p,x)  Sibling(ps,p)  Parent(ps,y)

  17. A tough one • “Every city has a dogcatcher who has been bitten by every dog in town” • Consider predicates • City(x) • Dog(x) • Dogcatcher(x,y) • LivesIn(x,y) • Bit(x,y) • x City (x)   y Dogcatcher(y,x)  (z (Dog(z)  LivesIn(z,x)  Bit(z,y))

  18. Higher Order Logic • In first order logic, we can quantify over objects and then represent predicates and functions on objects. • In a higher order logic, we can quantify over predicates and functions. • For example: • “Two objects are equal iff all predicates applied to them are equivalent.” •  x,y (x=y)  (p p(x)  p(y)) • Two functions are equal iff they have the same value for all arguments. •  f, g (f=g)  (x f(x) = g(x) ) • These are not allowed in first order logic. • While higher order logic is more expressive, we do not know how to reason effectively and undecidable.

  19. Knowledge Bases, Axioms, & Definitions • A knowledge base contains a set of sentences, all which are presumed to be TRUE. • They must be consistent. • Initial set of sentences sentences are calledaxioms. • While it may be attractive to define a minimal set of independent axioms, this is unnecessary. • Axioms of the form x,y P(x,y)  …are called definitions. • The definition of Grandparent predicate: g,c Grandparent (g,c)   p Parent(g,p) Parent(p,c) • Monotonicity of inserting entailed sentences into KB.

  20. Wumpus World Axioms • “Squares are breezy near a pit.” • Diagnostic rule– infer cause from effect y Breezy(y)  [x Pit(x)  Adjacent(x,y)] • Causal rule – infer effect from cause x,y Pit(x)  Adjacent(x,y)  Breezy(y) • Neither of these is complete – e.g. diagnostic rule doesn’t tell us that if there is no breeze then there isn’t a pit nearby. • Definition of Breezy predicate: y Breezy(y)  [x Pit(x)  Adjacent(x,y)]

  21. Keeping track of change • Facts hold in situations, rather than eternally. E.g., Holding(Gold,Now) rather than just Holding(Gold). • Situation calculus is one way to represent change in FOL: • Adds a situation argument to each non-eternal predicate • E.g., Now in Holding(Gold,Now) denotes a situation • Situations are connected by the Result function • Result(a,s) is the situation that results from doing a is s. More about situation calculus during sections on planning. Percepts?

  22. Inference Inference is the process of deriving conclusions from premises. Premises: • It is either snowing or raining. • It is not raining. Conclusion: It is snowing.

  23. Validity and Satisfiability • A sentence is valid or a tautologyiff it is TRUE in all possible worlds. • Example: P  P • In propositional logic, a truth table can be used to determine validity – a sentence is TRUE for every row. • A sentence is satisfiable iff it is TRUE in some possible world. • Example: P  Q • In propositional logic, a truth table can be used to determine satifiability – a sentence is TRUE for one row. • A sentence is unsatisfiable(self contradiction) iff it is FALSE in all possible worlds. • Example: P  P • In propositional logic, truth table can be used to determine validity – a sentence is FALSE for every row.

  24. And Elimination (AE):   Tired  Hungry  Tired  Hungry Inference Rules • Sounds inference: Find  such that KB  . • Proof process is a search, operators are inference rules. • All inference rules of propositional logic apply to FOL. Modus Ponens (MP) [“mode that affirms”, thks Aaron Becker..]:    Fish(George)  Swims(George)  Fish(George)  Swims(George)

  25. Inference Rules (ctd.) And Introduction (AI):  Relaxed  Thirsty   RelaxedThirsty Modus Tolens [“mode that denies”, thks Aaron Becker..]    Snows  Rains    Rains   Snows

  26. Substitutions Given a sentence  and binding list , the result of applying the substitution to  is denoted by Subst(, ). Example: s = {x/Sam, y/Pam}  = Likes(x,y) Subst({x/Sam, y/Pam}, Likes(x,y)) = Likes(Sam, Pam)

  27. Inference with Universal Quantifiers Universal Elimination (UE):  x  Subst({x/}, ) [ must be a ground term (i.e., no variables).] Example Imagine Universe of Discourse is {Rodrigo, Sharon, David, Jonathan}  x At (x, UIUC)  OK(x) At(Rodrigo, UIUC)  OK(Rodrigo) substitution list

  28. Inference with Existential Quantifiers Existential Elimination:   Subst({/k},  ) where k is a new (Skolem) constant. Example From x Teaches(x, CS440) we can infer that Teaches(PorkyPig, CS440) if the symbol PorkyPig hasnot appeared before.

  29. A simple proof • Premises: • Bob is a buffalo • Pat is a pig • Buffaloes outrun pigs • Prove that “Bob outruns Pat”. • Buffalo(Bob) • Pig(Pat) • x,y Buffalo(x)Pig(y)Faster(x,y) 4. Buffalo(Bob)  Pig(Pat) AI 1, 2 5. Buffalo(Bob)  Pig(Pat) Faster(Bob, Pat) UE 3, {x/Bob, y/Pat} 6. Faster(Bob, Pat) MP 4, 5

More Related