1 / 42

Chapter 7 Logic Agents

Chapter 7 Logic Agents Outline Knowledge-based agents Wumpus world Logic in general – models and entailment Propositional (Boolean) Logic Equivalence, validity, satisfiability Inference rules and theorem proving forward chaining backward chaining resolution Knowledge bases

andrew
Télécharger la présentation

Chapter 7 Logic Agents

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. Chapter 7 Logic Agents

  2. Outline • Knowledge-based agents • Wumpus world • Logic in general – models and entailment • Propositional (Boolean) Logic • Equivalence, validity, satisfiability • Inference rules and theorem proving • forward chaining • backward chaining • resolution Introduction to Artificial Intelligence - APSU

  3. Knowledge bases • Knowledge base (KB) • a set of sentences in a formal language • Declarative approach to building an agent • TELL it what it needs to know (add new sentences to the KB) • ASK what it knows (query KB) and the answer should follow from what has been told • involve inference – deriving new sentences from old • Agents can be viewed at the knowledge level • what they know, regardless of how implemented or at the implementation level • data structures in KB • algorithms that manipulate them Introduction to Artificial Intelligence - APSU

  4. Define game as a search problem • The agent must be able to: • represent states, actions, etc. • incorporate new percepts • update internal representations of the world • deduce hidden properties of the world • deduce appropriate actions Introduction to Artificial Intelligence - APSU

  5. Wumpus world PEAS description • Performance measure • gold +1000, death -1000 • -1 per step, -10 for using the arrow • Environment • Squares adjacent to wumpus are stench • Squares adjacent to pit are breezy • Glitter iff gold is in the same square • Shooting kills wumpus if you are facing it • Shooting uses up the only arrow • Grabbing picks up gold if in same square • Releasing drops the gold in same square • Wumpus emits a woeful scream when it is killed • Agent dies if entering a square with a pit or wumpus • Actuators • Left turn, Right turn, Forward, Grab, Release, Shoot • Sensors • Stench, Breeze, Glitter, Bump, Woeful scream Introduction to Artificial Intelligence - APSU

  6. Properties of wumpus world • 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 Introduction to Artificial Intelligence - APSU

  7. Exploring a wumpus world Introduction to Artificial Intelligence - APSU

  8. Exploring a wumpus world (cont’d) Introduction to Artificial Intelligence - APSU

  9. Logic in general • Logics are formal languages for representing information such that conclusions can be drawn • Syntax defines the (well-formed) sentences in the language • Semantics defines the “meaning” of sentences, i.e., defines truth of a sentence in each possible world • Every sentence must be either true or false in each possible world • Examples: the language of arithmetic Introduction to Artificial Intelligence - APSU

  10. Model and Entailment • Logicians call each possible world Model • We say m is a model of a sentence aifa is true in m. • Entailment refers a sentence follows logically from another sentence • a |= b represents the sentence aentails the sentence b • a |= b if and only if, in every model in whichais true, b is also true • e.g. x + y = 4 entails 4 = x + y • M(a) is the set of all models of a M(b) is the set of all models of b • Knowledge base KB entails sentence a • KB |= a iff a is true in all models where KB is true • M(KB) is the set of all models of KB M(a) is the set of all models of a Introduction to Artificial Intelligence - APSU

  11. Entailment in the wumpus world • Situation after detecting nothing in [1, 1], moving right, breeze in [2, 1] • Consider possible models for ?s assuming only pits • 3 Boolean choices 8 possible models Introduction to Artificial Intelligence - APSU

  12. Wumpus models Introduction to Artificial Intelligence - APSU

  13. Wumpus models (cont’d) • KB = wumpus-world rules + observations Introduction to Artificial Intelligence - APSU

  14. Wumpus models (cont’d) • a1 = “There is no pit in [1, 2].” KB |= a1 proved by model checking • enumerates all possible models to check that a1 is true in all models in which KB is true Introduction to Artificial Intelligence - APSU

  15. Wumpus models (cont’d) • a2 = “There is no pit in [2, 2].” KB a2 Introduction to Artificial Intelligence - APSU

  16. Inference • Inference is to derive conclusions from KB i.e., an inference algorithm derives only entailed sentences i.e., an inference algorithm can derive any sentence that is entailed Introduction to Artificial Intelligence - APSU

  17. Propositional logic: Syntax Introduction to Artificial Intelligence - APSU

  18. Propositional logic: Semantics • The semantics defines the rules for determining the truth of a sentence w.r.t. a particular model • Each model specifies true/false for each propositional symbol • 8 possible models can be enumerated automatically with these symbols • Rules for evaluating truth w.r.t. a model m: Note means “If P is true, then I am claiming that Q is true. Otherwise I am making no claim.” • simple recursive process evaluates an arbitrary sentence, e.g., Introduction to Artificial Intelligence - APSU

  19. Wumpus world sentences Wumpus world rules R1: R2: R3: The sentences from the breeze percepts for the first two squares visited R4: R5: Introduction to Artificial Intelligence - APSU

  20. Truth tables for inference KB: Note KB is true in three models Does KB entails the following sentences? Introduction to Artificial Intelligence - APSU

  21. Inference by enumeration Introduction to Artificial Intelligence - APSU

  22. Logical equivalence Introduction to Artificial Intelligence - APSU

  23. Validity and satisfiability Introduction to Artificial Intelligence - APSU

  24. Proof methods Introduction to Artificial Intelligence - APSU

  25. Inference Rules • Modus Ponens • And-Elimination • All of the logical equivalences • Example on P212 • Monotonicity: the set of entailed sentences can only increase as information is added to the knowledge base • inference rules can be applied whenever suitable premises are found in the knowledge base – the conclusion of rule must follow regardless of what else is in the knowledge base. Introduction to Artificial Intelligence - APSU

  26. Resolution Introduction to Artificial Intelligence - APSU

  27. Conversion to CNF Introduction to Artificial Intelligence - APSU

  28. Resolution algorithm Introduction to Artificial Intelligence - APSU

  29. Resolution example Introduction to Artificial Intelligence - APSU

  30. Forward and backward chaining A disjunction of literals of which at most one is positive. written as an implication Introduction to Artificial Intelligence - APSU

  31. Forward chaining • Idea: Fire any rule whose premises are satisfied in the KB, add its conclusion to the KB, until query is found Data-driven reasoning Introduction to Artificial Intelligence - APSU

  32. Forward chaining algorithm Introduction to Artificial Intelligence - APSU

  33. Forward chaining example Introduction to Artificial Intelligence - APSU

  34. Forward chaining example Introduction to Artificial Intelligence - APSU

  35. Forward chaining example Introduction to Artificial Intelligence - APSU

  36. Backward chaining • Idea: Work backwards from the query q: to prove q by BC, 1) check if q is known already, or 2) prove by BC all premises of some rule concluding q 3) until reaches a set of known facts Goal-driven reasoning Introduction to Artificial Intelligence - APSU

  37. Backward chaining example Introduction to Artificial Intelligence - APSU

  38. Backward chaining example Introduction to Artificial Intelligence - APSU

  39. Backward chaining example Introduction to Artificial Intelligence - APSU

  40. Backward chaining example Introduction to Artificial Intelligence - APSU

  41. Forward vs. backward chaining • FC is data-driven: automatic, unconscious processing, e.g., object recognition, routine decisions May do lots of work that is irrelevant to the goal • BC is goal-driven: appropriate for problem-solving, e.g., Where are my keys? How do I get into a graduate program Complexity of BC can be much less than linear in size of KB Introduction to Artificial Intelligence - APSU

  42. Summary • Logical agents apply inference to a knowledge base to derive new information and make decisions • Basic concepts of logic: • syntax: formal structure of sentences • semantics: truth of sentences wrt models • entailment: necessary truth of one sentence given another • inference: deriving sentences from other sentences • soundness: derivations produce only entailed sentences • completeness: derivations can produce all entailed sentences • Wumpus world requires the ability to represent partial and negated information, reason by cases, etc. • Forward, backwardchaining are linear-time, complete for Horn clauses • Resolution is complete for propositional logic • Propositional logic lacks expressive power Introduction to Artificial Intelligence - APSU

More Related