logical agents
play

Logical agents Chapter 7 Chapter 7 1 Outline Wumpus world Logic - PowerPoint PPT Presentation

Revised by Hankui Zhuo, March 21, 2018 Logical agents Chapter 7 Chapter 7 1 Outline Wumpus world Logic in generalmodels and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules


  1. Revised by Hankui Zhuo, March 21, 2018 Logical agents Chapter 7 Chapter 7 1

  2. Outline ♦ Wumpus world ♦ Logic in general—models and entailment ♦ Propositional (Boolean) logic ♦ Equivalence, validity, satisfiability ♦ Inference rules and theorem proving – forward chaining – backward chaining – resolution Chapter 7 2

  3. Wumpus World PEAS description Performance measure gold +1000, death -1000 -1 per step, -10 for using the arrow Breeze Environment Stench 4 PIT Squares adjacent to wumpus are smelly Breeze Breeze 3 PIT Squares adjacent to pit are breezy Stench Gold Glitter iff gold is in the same square Breeze Stench 2 Shooting kills wumpus if you are facing it Shooting uses up the only arrow Breeze Breeze 1 PIT Grabbing picks up gold if in same square START Releasing drops the gold in same square 1 2 3 4 Actuators Left turn, Right turn, Forward, Grab, Release, Shoot Sensors Breeze, Glitter, Smell Chapter 7 3

  4. Wumpus world characterization Observable?? Chapter 7 4

  5. Wumpus world characterization Observable?? No—only local perception Deterministic?? Chapter 7 5

  6. Wumpus world characterization Observable?? No—only local perception Deterministic?? Yes—outcomes exactly specified Episodic?? Chapter 7 6

  7. Wumpus world characterization Observable?? No—only local perception Deterministic?? Yes—outcomes exactly specified Episodic?? No—sequential at the level of actions Static?? Chapter 7 7

  8. Wumpus world characterization Observable?? No—only local perception Deterministic?? Yes—outcomes exactly specified Episodic?? No—sequential at the level of actions Static?? Yes—Wumpus and Pits do not move Discrete?? Chapter 7 8

  9. Wumpus world characterization Observable?? No—only local perception Deterministic?? Yes—outcomes exactly specified Episodic?? No—sequential at the level of actions Static?? Yes—Wumpus and Pits do not move Discrete?? Yes Single-agent?? Chapter 7 9

  10. Wumpus world characterization Observable?? No—only local perception Deterministic?? Yes—outcomes exactly specified Episodic?? No—sequential at the level of actions Static?? Yes—Wumpus and Pits do not move Discrete?? Yes Single-agent?? Yes—Wumpus is essentially a natural feature Chapter 7 10

  11. Exploring a wumpus world OK OK OK A Chapter 7 11

  12. Exploring a wumpus world B OK A OK OK A Chapter 7 12

  13. Exploring a wumpus world P? B OK P? A OK OK A Chapter 7 13

  14. Exploring a wumpus world P? B OK P? A S OK OK A A Chapter 7 14

  15. Exploring a wumpus world P? P B OK P? OK A S OK OK W A A Chapter 7 15

  16. Exploring a wumpus world P? P B OK P? OK A A S OK OK W A A Chapter 7 16

  17. Exploring a wumpus world P? OK P B OK P? OK OK A A S OK OK W A A Chapter 7 17

  18. Exploring a wumpus world P? OK P B OK P? BGS OK OK A A A S OK OK W A A Chapter 7 18

  19. Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language Semantics define the “meaning” of sentences; i.e., define truth of a sentence in a world E.g., the language of arithmetic x + 2 ≥ y is a sentence; x 2 + y > is not a sentence x + 2 ≥ y is true iff the number x + 2 is no less than the number y x + 2 ≥ y is true in a world where x = 7 , y = 1 x + 2 ≥ y is false in a world where x = 0 , y = 6 Chapter 7 19

  20. Entailment Entailment means that one thing follows from another: KB | = α Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true E.g., the KB containing “the Giants won” and “the Reds won” entails “Either the Giants won or the Reds won” E.g., x + y = 4 entails 4 = x + y Entailment is a relationship between sentences (i.e., syntax ) that is based on semantics Note: brains process syntax (of some sort) Chapter 7 20

  21. Models Logicians typically think in terms of models, which are formally structured worlds with respect to which truth can be evaluated We say m is a model of a sentence α if α is true in m M ( α ) is the set of all models of α Then KB | = α if and only if M ( KB ) ⊆ M ( α ) x x x x x x E.g. KB = Giants won and Reds won x x x M( ) xx x x α = Giants won x x x x x x x x x x x x x x x x xx x x x x x x x x x M(KB) x x x x x x x Chapter 7 21

  22. Entailment in the wumpus world Situation after detecting nothing in [1,1], ? ? moving right, breeze in [2,1] ? B Consider possible models for ?s A A assuming only pits 3 Boolean choices ⇒ 8 possible models Chapter 7 22

  23. Wumpus models 2 PIT 2 Breeze 1 Breeze PIT 1 1 2 3 1 2 3 PIT 2 PIT 2 2 Breeze 1 PIT Breeze 1 Breeze 1 1 2 3 1 2 3 1 2 3 PIT PIT 2 2 PIT Breeze 1 Breeze PIT 1 PIT PIT 2 1 2 3 1 2 3 Breeze PIT 1 1 2 3 Chapter 7 23

  24. Wumpus models 2 PIT 2 Breeze 1 Breeze PIT 1 1 2 3 KB 1 2 3 PIT 2 PIT 2 2 Breeze 1 PIT Breeze 1 Breeze 1 1 2 3 1 2 3 1 2 3 PIT PIT 2 2 PIT Breeze 1 Breeze PIT 1 PIT PIT 2 1 2 3 1 2 3 Breeze PIT 1 1 2 3 KB = wumpus-world rules + observations Chapter 7 24

  25. Wumpus models 2 PIT 2 Breeze 1 Breeze PIT 1 1 2 3 KB 1 2 3 1 PIT 2 PIT 2 2 Breeze 1 PIT Breeze 1 Breeze 1 1 2 3 1 2 3 1 2 3 PIT PIT 2 2 PIT Breeze 1 Breeze PIT 1 PIT PIT 2 1 2 3 1 2 3 Breeze PIT 1 1 2 3 KB = wumpus-world rules + observations α 1 = “[1,2] is safe”, KB | = α 1 , proved by model checking Chapter 7 25

  26. Wumpus models 2 PIT 2 Breeze 1 Breeze PIT 1 1 2 3 KB 1 2 3 PIT 2 PIT 2 2 Breeze 1 PIT Breeze 1 Breeze 1 1 2 3 1 2 3 1 2 3 PIT PIT 2 2 PIT Breeze 1 Breeze PIT 1 PIT PIT 2 1 2 3 1 2 3 Breeze PIT 1 1 2 3 KB = wumpus-world rules + observations Chapter 7 26

  27. Wumpus models PIT 2 2 Breeze 1 Breeze 2 1 PIT 1 2 3 KB 1 2 3 PIT 2 PIT 2 2 Breeze PIT 1 Breeze 1 Breeze 1 1 2 3 1 2 3 1 2 3 PIT PIT 2 PIT 2 Breeze 1 Breeze PIT 1 PIT PIT 2 1 2 3 1 2 3 Breeze PIT 1 1 2 3 KB = wumpus-world rules + observations α 2 = “[2,2] is safe”, KB �| = α 2 Chapter 7 27

  28. Inference KB ⊢ i α = sentence α can be derived from KB by procedure i Soundness: i is sound if whenever KB ⊢ i α , it is also true that KB | = α Completeness: i is complete if whenever KB | = α , it is also true that KB ⊢ i α Chapter 7 28

  29. Propositional logic: Syntax Propositional logic is the simplest logic—illustrates basic ideas The proposition symbols P 1 , P 2 etc are sentences If S is a sentence, ¬ S is a sentence (negation) If S 1 and S 2 are sentences, S 1 ∧ S 2 is a sentence (conjunction) If S 1 and S 2 are sentences, S 1 ∨ S 2 is a sentence (disjunction) If S 1 and S 2 are sentences, S 1 ⇒ S 2 is a sentence (implication) If S 1 and S 2 are sentences, S 1 ⇔ S 2 is a sentence (biconditional) Chapter 7 29

  30. Propositional logic: Semantics Each model specifies true/false for each proposition symbol E.g. P 1 , 2 P 2 , 2 P 3 , 1 true true false (With these symbols, 8 possible models, can be enumerated automatically.) Rules for evaluating truth with respect to a model m : ¬ S is true iff S is false S 1 ∧ S 2 is true iff S 1 is true and S 2 is true S 1 ∨ S 2 is true iff S 1 is true or S 2 is true S 1 ⇒ S 2 is true iff is false or is true S 1 S 2 i.e., is false iff is true and is false S 1 S 2 S 1 ⇔ S 2 is true iff S 1 ⇒ S 2 is true and S 2 ⇒ S 1 is true Simple recursive process evaluates an arbitrary sentence, e.g., ¬ P 1 , 2 ∧ ( P 2 , 2 ∨ P 3 , 1 ) = true ∧ ( false ∨ true ) = true ∧ true = true Chapter 7 30

  31. Truth tables for connectives ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q P Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true Chapter 7 31

  32. Wumpus world sentences Let P i,j be true if there is a pit in [ i, j ] . Let B i,j be true if there is a breeze in [ i, j ] . ¬ P 1 , 1 ¬ B 1 , 1 B 2 , 1 “Pits cause breezes in adjacent squares” Chapter 7 32

  33. Wumpus world sentences Let P i,j be true if there is a pit in [ i, j ] . Let B i,j be true if there is a breeze in [ i, j ] . ¬ P 1 , 1 ¬ B 1 , 1 B 2 , 1 “Pits cause breezes in adjacent squares” ⇔ ( P 1 , 2 ∨ P 2 , 1 ) B 1 , 1 ⇔ ( P 1 , 1 ∨ P 2 , 2 ∨ P 3 , 1 ) B 2 , 1 “A square is breezy if and only if there is an adjacent pit” Chapter 7 33

Recommend


More recommend