Chapter 7 logic agents
Download
1 / 42

Chapter 7 - PowerPoint PPT Presentation


  • 243 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Chapter 7 ' - andrew


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Chapter 7 logic agents l.jpg

Chapter 7 Logic Agents


Outline l.jpg
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


Knowledge bases l.jpg
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


Slide4 l.jpg

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


Wumpus world peas description l.jpg
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


Properties of wumpus world l.jpg
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


Slide7 l.jpg

Exploring a wumpus world

Introduction to Artificial Intelligence - APSU


Slide8 l.jpg

Exploring a wumpus world (cont’d)

Introduction to Artificial Intelligence - APSU


Slide9 l.jpg

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


Slide10 l.jpg

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


Slide11 l.jpg

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


Slide12 l.jpg

Wumpus models

Introduction to Artificial Intelligence - APSU


Slide13 l.jpg

Wumpus models (cont’d)

  • KB = wumpus-world rules + observations

Introduction to Artificial Intelligence - APSU


Slide14 l.jpg

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


Slide15 l.jpg

Wumpus models (cont’d)

  • a2 = “There is no pit in [2, 2].” KB a2

Introduction to Artificial Intelligence - APSU


Slide16 l.jpg

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


Slide17 l.jpg

Propositional logic: Syntax

Introduction to Artificial Intelligence - APSU


Slide18 l.jpg

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


Slide19 l.jpg

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


Slide20 l.jpg

Truth tables for inference

KB:

Note KB is true in three models

Does KB entails the following sentences?

Introduction to Artificial Intelligence - APSU


Slide21 l.jpg

Inference by enumeration

Introduction to Artificial Intelligence - APSU


Slide22 l.jpg

Logical equivalence

Introduction to Artificial Intelligence - APSU


Slide23 l.jpg

Validity and satisfiability

Introduction to Artificial Intelligence - APSU


Slide24 l.jpg

Proof methods

Introduction to Artificial Intelligence - APSU


Slide25 l.jpg

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


Slide26 l.jpg

Resolution

Introduction to Artificial Intelligence - APSU


Slide27 l.jpg

Conversion to CNF

Introduction to Artificial Intelligence - APSU


Slide28 l.jpg

Resolution algorithm

Introduction to Artificial Intelligence - APSU


Slide29 l.jpg

Resolution example

Introduction to Artificial Intelligence - APSU


Slide30 l.jpg

Forward and backward chaining

A disjunction of literals of which at most one is positive.

written as an implication

Introduction to Artificial Intelligence - APSU


Slide31 l.jpg

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


Slide32 l.jpg

Forward chaining algorithm

Introduction to Artificial Intelligence - APSU


Slide33 l.jpg

Forward chaining example

Introduction to Artificial Intelligence - APSU


Slide34 l.jpg

Forward chaining example

Introduction to Artificial Intelligence - APSU


Slide35 l.jpg

Forward chaining example

Introduction to Artificial Intelligence - APSU


Slide36 l.jpg

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


Slide37 l.jpg

Backward chaining example

Introduction to Artificial Intelligence - APSU


Slide38 l.jpg

Backward chaining example

Introduction to Artificial Intelligence - APSU


Slide39 l.jpg

Backward chaining example

Introduction to Artificial Intelligence - APSU


Slide40 l.jpg

Backward chaining example

Introduction to Artificial Intelligence - APSU


Slide41 l.jpg

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


Slide42 l.jpg

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


ad