1 / 18

For Friday

For Friday. Read chapter 8 Homework: Chapter 7, exercises 2 and 10 Program 1, Milestone 2 due. Program 1. Any questions?. Propositional Inference Rules. Modus Ponens or Implication Elimination And-Elimination Unit Resolution Resolution. Simpler Inference. Horn clauses

kaycee
Download Presentation

For Friday

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. For Friday • Read chapter 8 • Homework: • Chapter 7, exercises 2 and 10 • Program 1, Milestone 2 due

  2. Program 1 • Any questions?

  3. Propositional Inference Rules • Modus Ponens or Implication Elimination • And-Elimination • Unit Resolution • Resolution

  4. Simpler Inference • Horn clauses • Forward-chaining • Backward-chaining

  5. Building an Agent with Propositional Logic • Propositional logic has some nice properties • Easily understood • Easily computed • Can we build a viable wumpus world agent with propositional logic???

  6. The Problem • Propositional Logic only deals with facts. • We cannot easily represent general rules that apply to any square. • We cannot express information about squares and relate (we can’t easily keep track of which squares we have visited)

  7. More Precisely • In propositional logic, each possible atomic fact requires a separate unique propositional symbol. • If there are n people and m locations, representing the fact that some person moved from one location to another requires nm2 separate symbols.

  8. First Order Logic • Predicate logic includes a richer ontology: • objects (terms) • properties (unary predicates on terms) • relations (n­ary predicates on terms) • functions (mappings from terms to other terms) • Allows more flexible and compact representation of knowledge • Move(x, y, z) for person x moved from location y to z.

  9. Syntax for First­Order Logic Sentence ® AtomicSentence | Sentence Connective Sentence | Quantifier Variable Sentence | ¬Sentence | (Sentence) AtomicSentence ® Predicate(Term, Term, ...) | Term=Term Term ® Function(Term,Term,...) | Constant | Variable Connective ®Ú | Ù | Þ | Û Quanitfier ®$ | " Constant ® A | John | Car1 Variable ® x | y | z |... Predicate ® Brother | Owns | ... Function ® father­of | plus | ...

  10. Terms • Objects are represented by terms: • Constants: Block1, John • Function symbols: father­of, successor, plus • An n­ary function maps a tuple of n terms to another term: father­of(John), succesor(0), plus(plus(1,1),2) • Terms are simply names for objects. • Logical functions are not procedural as in programming languages. They do not need to be defined, and do not really return a value. • Functions allow for the representation of an infinite number of terms.

  11. Predicates • Propositions are represented by a predicate applied to a tuple of terms. A predicate represents a property of or relation between terms that can be true or false: • Brother(John, Fred), Left­of(Square1, Square2) • GreaterThan(plus(1,1), plus(0,1)) • In a given interpretation, an n­ary predicate can defined as a function from tuples of n terms to {True, False} or equivalently, a set tuples that satisfy the predicate: • {<John, Fred>, <John, Tom>, <Bill, Roger>, ...}

  12. Sentences in First­Order Logic • An atomic sentence is simply a predicate applied to a set of terms. • Owns(John,Car1) • Sold(John,Car1,Fred) • Semantics is True or False depending on the interpretation, i.e. is the predicate true of these arguments. • The standard propositional connectives ( Ú ¬ Ù ÞÛ) can be used to construct complex sentences: • Owns(John,Car1) Ú Owns(Fred, Car1) • Sold(John,Car1,Fred) Þ ¬Owns(John, Car1) • Semantics same as in propositional logic.

  13. Quantifiers • Allow statements about entire collections of objects • Universal quantifier: "x • Asserts that a sentence is true for all values of variable x • "x Loves(x, FOPC) • "x Whale(x) Þ Mammal(x) • "x ("y Dog(y) Þ Loves(x,y)) Þ("z Cat(z) Þ Hates(x,z)) • Existential quantifier: $ • Asserts that a sentence is true for at least one value of a variable x • $x Loves(x, FOPC) • $x(Cat(x) Ù Color(x,Black) Ù Owns(Mary,x)) • $x("y Dog(y) Þ Loves(x,y)) Ù ("z Cat(z) Þ Hates(x,z))

  14. Use of Quantifiers • Universal quantification naturally uses implication: • "x Whale(x) Ù Mammal(x) • Says that everything in the universe is both a whale and a mammal. • Existential quantification naturally uses conjunction: • $x Owns(Mary,x) Þ Cat(x) • Says either there is something in the universe that Mary does not own or there exists a cat in the universe. • "x Owns(Mary,x) Þ Cat(x) • Says all Mary owns is cats (i.e. everthing Mary owns is a cat). Also true if Mary owns nothing. • "x Cat(x) Þ Owns(Mary,x) • Says that Mary owns all the cats in the universe. Also true if there are no cats in the universe.

  15. Nesting Quantifiers • The order of quantifiers of the same type doesn't matter: • "x"y(Parent(x,y) Ù Male(y) Þ Son(y,x)) • $x$y(Loves(x,y) Ù Loves(y,x)) • The order of mixed quantifiers does matter: • "x$y(Loves(x,y)) • Says everybody loves somebody, i.e. everyone has someone whom they love. • $y"x(Loves(x,y)) • Says there is someone who is loved by everyone in the universe. • "y$x(Loves(x,y)) • Says everyone has someone who loves them. • $x"y(Loves(x,y)) • Says there is someone who loves everyone in the universe.

  16. Variable Scope • The scope of a variable is the sentence to which the quantifier syntactically applies. • As in a block structured programming language, a variable in a logical expression refers to the closest quantifier within whose scope it appears. • $x (Cat(x) Ù"x(Black (x))) • The x in Black(x) is universally quantified • Says cats exist and everything is black • In a well­formed formula (wff) all variables should be properly introduced: • $xP(y) not well­formed • A ground expression contains no variables.

  17. Relations Between Quantifiers • Universal and existential quantification are logically related to each other: • "x ¬Love(x,Saddam) Û ¬$x Loves(x,Saddam) • "x Love(x,Princess­Di) Û ¬$x ¬Loves(x,Princess­Di) • General Identities • "x ¬P Û ¬$x P • ¬"x P Û$x ¬P • "x P Û ¬$x ¬P • $x P Û ¬"x ¬P • "x P(x) Ù Q(x) Û"x P(x) Ù"x Q(x) • $x P(x) Ú Q(x) Û$x P(x) Ú$x Q(x)

  18. Equality • Can include equality as a primitive predicate in the logic, or require it to be introduced and axiomitized as the identity relation. • Useful in representing certain types of knowledge: • $x$y(Owns(Mary, x) Ù Cat(x) Ù Owns(Mary,y) Ù Cat(y) • Ù ¬(x=y)) • Mary owns two cats. Inequality needed to ensure x and y are distinct. • "x $y married(x, y) Ù "z(married(x,z) Þ y=z) • Everyone is married to exactly one person. Second conjunct is needed to guarantee there is only one unique spouse.

More Related