Docsity

Logic and Propositional Inference in the Wumpus World, Study notes of Computer Science

Partial preview of the text

Download Logic and Propositional Inference in the Wumpus World and more Study notes Computer Science in PDF only on Docsity!

LogicLogic

Introduction to Artificial

IntelligenceCS440/ECE448Lecture 9

SECOND HOMEWORKDUE MONDAY

Last lectureLast lecture

-^ Nondeterministic games•^ Logic–^ –

The^ WumpusTheWumpus

worldworld

-^ Entailment^ – Entailment

Today

-^ Logic– Entailment and inference– Propositional logic: Syntax and semantics– Inference rules

Reading^ Reading

-^ Chapters 7 and 8

Function

MINIMAX-VALUE (state, game)

returns

a utility value

If^ TERMINAL-TESTgame then

return

UTILITYgame else if

MAX is to move in

state^ then return

the highest MINIMAX-VALUE of Successors[

state]

else return

the lowest MINIMAX-VALUE of Successors[

state]

Function

EXPECTIMINIMAX-VALUE (state, game)

returns

a utility value

If^ TERMINAL-TESTgame then

return

UTILITYgame else^ if

state

is a chance node

then

return

average of

EXPECTIMINMAX-VALUE

of Successors(

state)

else if

MAX is to move in

state^ then return

the highest EXPECTIMINIMAX-VALUE of Successors[

state]

else return

the lowest EXPECTIMINIMAX-VALUE of Successors[

state]

LogicLogic

TheThe

WumpusWumpus

WorldWorld

-^ Goals:

Get gold back to the start without entering it or wumpussquare. • Percepts:

Breeze, Glitter, Smell.

-^ Actions:

Left turn, Right turn, Forward, Grab, Release, Shoot.

Environment •^ Squares adjacent to wumpus aresmelly.•^ Squares adjacent to pit arebreezy.•^ Glitter if and only if gold is in the^ same square.•^ Shooting kills the wumpus

if you

are facing it.• Shooting uses up the only arrow.• Grabbing picks up the gold if inthe same square.• Releasing drops the gold in thesame square.

Logic in generalLogic 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 sentencetruth of a sentence
in a world.

-^ For example, the language of arithmetic^ –^

x + 2
≥≥≥≥^ y^
is a sentence.

-^ x + y >

is not a sentence.

-^ x + 2

≥≥≥≥^ y^
is true iff the number
x+^
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.

EntailmentEntailment

Logical

Representation

World

SentencesKB^ Facts

Semantics

Sentences

α^ Semantics Facts

Entail Follows
  • A knowledge base is a collection of sentences.• An entailed sentence is true, given that the old sentences inthe knowledge base are true.

Potential models of the Wumpus world A model is an instance of the world. A model of a set of sentencesis an instance of the world where these sentences are true.

Entailment againEntailment again

InferenceInference

-^ A knowledge base is a collection of sentences.•^ Knowledge base KB entails sentence

α^ if and only if

α^ is true whenever KB is true (i.e. all sentencesin KB are true).

-^ An inference procedure

i^

can do two things:

  • Given KB, generate new sentence

α^ purported to be entailed

by KB.– Given KB and

α, report whether or not

α^ is entailed by KB.

-^ A^ sound

inference procedure only produces entailed sentences.

-^ Every entailed sentence can be generated by a

complete

inference procedure.

Order of PrecedenceOrder of Precedence

From highest to lowest:parenthesis

( Sentence )

NOT

AND

OR^

Implies

Equivalent

Propositional logic: SemanticsPropositional logic: Semantics

Most sentences are sometimes true.

P^ ∧^ Q

Some sentences are always true (valid).

¬^ P^ ∨

P
Some sentences are never true (unsatisfiable).

¬^ P^ ∧

P

Model ofP^ ∧^ Q

Propositional Inference: Enumeration MethodPropositional Inference: Enumeration Method^ •^ Let

α=Αα=Αα=Αα=Α ∨

∨∨∨ ΒΒΒΒ^ and

KB = (
ΑΑΑΑ ∨∨∨∨^ C)
∧∧∧∧ ((((B^
∨∨∨∨ ¬¬¬¬C)

-^ Is it the case that KB

α

-^ Check all possible models --

α^ must be true whenever KB is true

True True True True True

True True False True True

True False True False True

True True False False True

True True True True False

True False False True False

False False True False False

False False False False False

αααα ΑΑΑΑ ∨∨∨∨ ΒΒΒΒ KB(ΑΑΑΑ ∨∨∨∨^ C)^ ∧∧∧∧ ((((B ∨∨∨∨ ¬¬¬¬C) C B A

Propositional Inference: Enumeration MethodPropositional Inference: Enumeration Method^ •^ Let

α=Αα=Αα=Αα=Α ∨

∨∨∨ ΒΒΒΒ^ and

KB = (
ΑΑΑΑ ∨∨∨∨^ C)
∧∧∧∧ ((((B^
∨∨∨∨ ¬¬¬¬C)

-^ Is it the case that KB

α

-^ Check all possible models --

α^ must be true whenever KB is true

True True True True True

True True False True True

True False True False True

True True False False True

True True True True False

True False False True False

False False True False False

False False False False False

αααα ΑΑΑΑ ∨∨∨∨ ΒΒΒΒ KB(ΑΑΑΑ ∨∨∨∨^ C)^ ∧∧∧∧ ((((B ∨∨∨∨ ¬¬¬¬C) C B A