for wednesday read chapter 9, sections 1-3 homework: –chapter 7, exercises 8 and 9
TRANSCRIPT
![Page 1: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/1.jpg)
For Wednesday
• Read chapter 9, sections 1-3
• Homework:– Chapter 7, exercises 8 and 9
![Page 2: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/2.jpg)
Program 1
• Any questions?
![Page 3: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/3.jpg)
Propositional Logic
• Simple logic
• Deals only in facts
• Provides a stepping stone into first order logic
![Page 4: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/4.jpg)
Syntax• Logical Constants: true and false• Propositional symbols P, Q ... are sentences• If S is a sentence then (S) is a sentence.• If S is a sentence then ¬S is a sentence.
• If S1 and S2 are sentences, then so are:
– S1 S2
– S1 S2
– S1 S2
– S1 S2
![Page 5: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/5.jpg)
Semantics• true and false mean truth or falsehood in the world
• P is true if its proposition is true of the world
• ¬S is the negation of S
• The remainder follow standard truth tables– S1 S2 : AND
– S1 S2 : inclusive OR
– S1 S2 : True unless S1 is true and S2 is false
– S1 S2 : bi-conditional, or if and only if
![Page 6: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/6.jpg)
Inference
• An interpretation is an assignment of true or false to each atomic proposition
• A sentence true under any interpretation is valid (a tautology or analytic sentence)
• Validity can be checked by exhaustive checking of truth tables
![Page 7: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/7.jpg)
Rules of Inference
• Alternative to truth-table checking
• A sequence of inference rule applications leading to a desired conclusion is a logical proof
• We can check inference rules using truth tables, and then use to create sound proofs
• We can treat finding a proof as a search problem
![Page 8: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/8.jpg)
Propositional Inference Rules
• Modus Ponens or Implication Elimination
• And-Elimination
• Unit Resolution
• Resolution
![Page 9: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/9.jpg)
Simpler Inference
• Horn clauses
• Forward-chaining
• Backward-chaining
![Page 10: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/10.jpg)
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???
![Page 11: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/11.jpg)
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)
![Page 12: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/12.jpg)
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.
![Page 13: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/13.jpg)
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.
![Page 14: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/14.jpg)
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 | ...
![Page 15: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/15.jpg)
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.
![Page 16: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/16.jpg)
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>, ...}
![Page 17: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/17.jpg)
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.
![Page 18: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/18.jpg)
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))
![Page 19: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/19.jpg)
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.
![Page 20: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/20.jpg)
Nesting Quantifiers• The order of quantifiers of the same type doesn't matter:
– xy(Parent(x,y) Male(y) Son(y,x))
– xy(Loves(x,y) Loves(y,x))
• The order of mixed quantifiers does matter: – xy(Loves(x,y))
• Says everybody loves somebody, i.e. everyone has someone whom they love.
– yx(Loves(x,y)) • Says there is someone who is loved by everyone in the universe.
– yx(Loves(x,y)) • Says everyone has someone who loves them.
– xy(Loves(x,y)) • Says there is someone who loves everyone in the universe.
![Page 21: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/21.jpg)
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.
![Page 22: For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9](https://reader035.vdocument.in/reader035/viewer/2022081517/5697bfc91a28abf838ca9114/html5/thumbnails/22.jpg)
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)