logical agents
play

Logical Agents Philipp Koehn 5 March 2020 Philipp Koehn - PowerPoint PPT Presentation

Logical Agents Philipp Koehn 5 March 2020 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020 1 The world is everything that is the case. Wittgenstein, Tractatus Philipp Koehn Artificial Intelligence: Logical Agents 5 March


  1. Logical Agents Philipp Koehn 5 March 2020 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  2. 1 The world is everything that is the case. Wittgenstein, Tractatus Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  3. Outline 2 ● Knowledge-based agents ● Logic in general—models and entailment ● Propositional (Boolean) logic ● Equivalence, validity, satisfiability ● Inference rules and theorem proving – forward chaining – backward chaining – resolution Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  4. 3 knowledge-based agents Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  5. Knowledge-Based Agent 4 ● Knowledge base = set of sentences in a formal language ● Declarative approach to building an agent (or other system): T ELL it what it needs to know ● Then it can A SK itself what to do—answers should follow from the KB ● Agents can be viewed at the knowledge level i.e., what they know , regardless of how implemented ● Or at the implementation level i.e., data structures in KB and algorithms that manipulate them Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  6. A Simple Knowledge-Based Agent 5 function KB-A GENT ( percept ) returns an action static : KB , a knowledge base t , a counter, initially 0, indicating time T ELL ( KB , M AKE -P ERCEPT -S ENTENCE ( percept , t )) action ← A SK ( KB , M AKE -A CTION -Q UERY ( t )) T ELL ( KB , M AKE -A CTION -S ENTENCE ( action , t )) t ← t + 1 return action ● 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 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  7. 6 example Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  8. Hunt the Wumpus 7 Computer game from 1972 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  9. Wumpus World PEAS Description 8 ● Performance measure – gold +1000, death -1000 – -1 per step, -10 for using the arrow ● Environment – squares adjacent to wumpus are smelly – 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 ● Actuators Left turn, Right turn, Forward, Grab, Release, Shoot ● Sensors Breeze, Glitter, Smell Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  10. Wumpus World Characterization 9 ● 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 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  11. Exploring a Wumpus World 10 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  12. Exploring a Wumpus World 11 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  13. Exploring a Wumpus World 12 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  14. Exploring a Wumpus World 13 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  15. Exploring a Wumpus World 14 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  16. Exploring a Wumpus World 15 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  17. Exploring a Wumpus World 16 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  18. Exploring a Wumpus World 17 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  19. Tight Spot 18 ● Breeze in (1,2) and (2,1) � ⇒ no safe actions ● Assuming pits uniformly distributed, (2,2) has pit w/ prob 0.86, vs. 0.31 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  20. Tight Spot 19 ● Smell in (1,1) � ⇒ cannot move ● Can use a strategy of coercion: shoot straight ahead – wumpus was there � ⇒ dead � ⇒ safe – wumpus wasn’t there � ⇒ safe Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  21. 20 logic in general Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  22. Logic in General 21 ● 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 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  23. Entailment 22 ● 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 Ravens won” and “the Jays won” entails “the Ravens won or the Jays 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) Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  24. Models 23 ● 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 α ⇒ KB ⊧ α if and only if M ( KB ) ⊆ M ( α ) ● E.g. KB = Ravens won and Jays won α = Ravens won Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  25. Entailment in the Wumpus World 24 ● Situation after detecting nothing in [1,1], moving right, breeze in [2,1] ● Consider possible models for all ? , assuming only pits ● 3 Boolean choices � ⇒ 8 possible models Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  26. Possible Wumpus Models 25 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  27. Valid Wumpus Models 26 KB = wumpus-world rules + observations Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  28. Entailment 27 KB = wumpus-world rules + observations α 1 = “[1,2] is safe”, KB ⊧ α 1 , proved by model checking Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  29. Valid Wumpus Models 28 KB = wumpus-world rules + observations Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  30. Not Entailed 29 KB = wumpus-world rules + observations α 2 = “[2,2] is safe”, KB / ⊧ α 2 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  31. Inference 30 ● KB ⊢ i α = sentence α can be derived from KB by procedure i ● Consequences of KB are a haystack; α is a needle. Entailment = needle in haystack; inference = finding it ● 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 α ● Preview: we will define a logic (first-order logic) which is expressive enough to say almost anything of interest, and for which there exists a sound and complete inference procedure. ● That is, the procedure will answer any question whose answer follows from what is known by the KB . Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  32. 31 propositional logic Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  33. Propositional Logic: Syntax 32 ● Propositional logic is the simplest logic—illustrates basic ideas ● The proposition symbols P 1 , P 2 etc are sentences ● If P is a sentence, ¬ P is a sentence (negation) ● If P 1 and P 2 are sentences, P 1 ∧ P 2 is a sentence (conjunction) ● If P 1 and P 2 are sentences, P 1 ∨ P 2 is a sentence (disjunction) ● If P 1 and P 2 are sentences, P 1 � ⇒ P 2 is a sentence (implication) ● If P 1 and P 2 are sentences, P 1 ⇔ P 2 is a sentence (biconditional) Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

  34. Propositional Logic: Semantics 33 ● Each model specifies true/false for each proposition symbol E.g. P 1 , 2 P 2 , 2 P 3 , 1 false true false (with these symbols, 8 possible models, can be enumerated automatically) ● Rules for evaluating truth with respect to a model m : ¬ P is true iff P is false P 1 ∧ P 2 is true iff is true and is true P 1 P 2 P 1 ∨ P 2 is true iff P 1 is true or P 2 is true P 1 � ⇒ P 2 is true iff P 1 is false or P 2 is true is true and i.e., is false iff P 1 P 2 is false P 1 ⇔ P 2 P 1 � ⇒ P 2 is true and P 2 � ⇒ P 1 is true iff 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 Philipp Koehn Artificial Intelligence: Logical Agents 5 March 2020

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend