wumpus world 1 wumpus and 1 pile of gold in a pit-filled cave starts in [1,1] facing right - random...

Post on 15-Jan-2016

219 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Wumpus World

• 1 Wumpus and 1 pile of gold in a pit-filled cave

• Starts in [1,1] facing right - Random cave

• Percepts: [smell, breeze, gold, bump, scream] - does not know own location

• Actions: forward, right, left, grab, shoot (1 arrow), climb (only from 1,1)

• Wumpus smells bad – adjacent squares (4 connected) have odor

• Breeze next to pits

• If you run into a wumpus or a pit, you die

• Goal: Climb out of cave with the gold (1000 pts) with minimal actions (-1 for each action, and –1000 if you die, -10 for using the arrow).

• Must have knowledge to infer new facts - e.g. no stench -> no wumpus in adjacent squares

• Must remember inferred facts (OK states, etc.) and use them in order to properly fulfill goals - KB construction

Knowledge Based Agents

• Have a Knowledge Base - set of representations of facts (rules) about the world

• Use knowledge about world/problem to reason about action, infer new knowledge, act quickly and more efficiently

• Can accept new tasks

• Can adapt to changes

• Can learn new facts – (add to KB) from environment

– infer them from known facts (KB)

• Representation in KB of knowledge is a sentence (a sentence for each item known)

• TELL: method to add new sentences to KB

• ASK: method to find out new stuff from KB – anything ASK returns should “follow” from KB

• Background knowledge vs. added (telled) - KB construction

• Iteratively Tell (percept input(s)) and Ask (action output(s)) over time

• Levels of abstraction – Knowledge Level - what KB knows (most abstract)

– Logical Level - Encoding into sentences - e.g. Mother (Mary, John)

– Implementation Level - how encoding is actually implemented

• Must choose representation language and Tell/Ask algorithms which efficiently support the above levels of abstraction

Definitions: Representation and Inference

• Representation Language – Syntax – describes legal sentences

– Semantics – describes interpretation/meaning of a given sentence

• Entailment - KB |= s (KB entails s) - sentence is necessarily true given KB – “one fact follows from another (set of) fact(s)”

– Note that it all rests on the KB being correct in the first place!

– a |= b iff in every model in which a is true, b is true

• An inference procedure can do one of two things:– Generate (entail) new sentences

– Determine whether a specific sentence can be entailed from KB

More Definitions on Inference

• If a given inference procedure i can derive s from a KB we write– KB |-i s

• A proof of s is the record of operation of KB |-i s of a sound inference procedure i.

• A sound inference procedure generates only entailed sentences

• An inference procedure is complete if it can generate any entailed sentence

• Hey? Should an inference procedure be sound? Should it be complete? Obviously, right?

• A sentence may be true, false or unknown (standard logic)

• logical inference = deduction = sound reasoning

• Necessarily true = valid = tautology = true under all possible interpretations in all possible worlds.

• A Sentence is satisfiable if there exists some circumstance for which it is true,

• Unsatisfiable = contradiction = a sentence that is not satisfiable

• Being able to deduce tautologies and contradictions is important, since a computer does not understand meaning of variables, for example (if A then B), and A, a computer can deduce B regardless of interpretation. Thus, the inference procedure should be useful in arbitrary domains.

Representation Language Syntax and Semantics: if precisely defined then language is a logic

A logic consists of:

1. Formal system for describing knowledge which includes:

a) syntax of the system

b) semantics of the system

2. Proof theory or an inference engine - a set of rules for deducing the entailments from a KB

Representation Language – design decisions

• Expressiveness – Natural language - very expressive, but too ambiguous, assumes contextual knowledge– Computer languages (expect too much completeness) - how to handle uncertainty (wumpus in location

a or b) – Balance of expressiveness, unambiguousness, easy support of inference

B o o k c o n c e n t r a t e s o n 2 k i n d s o f l o g i c :

1 . P r o p o s i t i o n a l l o g i c ( b o o l e a n )

( a b c )

S y m b o l s r e p r e s e n t f a c t s ( p r o p o s i t i o n s ) w h i c h m a y o r m a y n o t b e t r u e .

2 . f i r s t - o r d e r l o g i c

)()( xartveryVerySmxprofessorx

r e p r e s e n t s w o r l d i n t e r m s o f o b j e c t s , p r e d i c a t e s , a n d q u a n t i f i e r s .

Propositional Logic (Some Salient Points)

• You can use a truth table to determine if a given KB entails a given sentence! How?

• Models of a sentence - all worlds in which the sentence is true.

• Quote from the book “A sentences s is entailed by a KB if the models of the KB are all models of the sentence”. What? What about (p q p !p)?

• Inference Rules (P210) – Can’t we just use the truth table generation rule?

• A Logical Proof is a sequence of Inference rule applications

• Let’s try problem 7.8 a,b,c,d (p237)

Propositional Logic - Completeness and Complexity

• Propositional logic is complete

• can always fill out the truth table for n symbols

• exponential in n

• Is there a polynomial time proof procedure?

• Proven that satisfying a set of sentences is NP-complete

• Logical inference dependent on monotonicity of propositional and 1st order logic –

• Montonicity proclaims that– (KB1 |= s) ((KB1 KB2) |= s)

– Hey! What happens if KB2 = !s !!!!! How in the heck can anything be monotonic??!!?! Oh the

humanity!

• Any sentence entailed by KB must still be derivable after KB is augmented by an entailed sentence. That makes sense!

Solving the Wumpus World with propositional logic

• Inferring there is a Wumpus in a square - Could do by truth table, but..., can derive it directly

• Inferred and Background Knowledge in WW

• Problems with propositional logic - Just propositions

• Action - shooting the arrow - How many rules are needed?

First Order Logic

• Objects, Properties, Relations (Function a special type of relation)

• Quantifiers allow general rules, etc. (properties, relations of collections of objects)

• Much more expressive than propositions (facts)

• Term is an object – a function is a term since it can be thought of as an alias for an object - NoseOf(John)

• Examples, interpretation, equivalence

o    

)(xcatx o    

)()( xverySmartxprofessorx )()( xverySmartxprofessorx

• There isn’t anything you can do that I can’t do better

• Nobody likes everybody

• There’s somebody for everyone

• Some people like Raymond

• If you go to the beach you get sand in your toes

Unify• Knows(John, x), Knows(John, Jane)• Knows(John, x) Knows(y, Todd)• Knows(John, x) Knows(y, Mother(y))• Knows(John, x) Knows(x, Todd)• A(x, y, B(x, y, z)), A(a, Bob, a)• A(x, y, B(x, y, z)), A(a, Bob, B(c, b, a))• A(John, y, B(x, y, z)), A(a, Bob, B(a, b, c))• A(John, y, B(x, y, z)), A(a, b, B(a, M(b), c))

Inference in FOL

• Propositional inference rules all hold

• Inference rules for quantifiers

o     Universal Elimination - from (x)(P(x)) we can infer P(Waffle) under substitution {x/Waffle}

o     Existential Elimination (constant symbol must not occur elsewhere) - from (x)(P(x)) can infer P(Biscuit) - Biscuit is arbitrary (unique) name for the object which satisfies (x)(P(x))o     Existential Introduction - from P(Cheese) can infer (x)(P(x))

Nothing bigger than the ocean can live in the ocean. The earth is much bigger than the ocean. Sea turtles must spend at least part of their lives living in the ocean. Therefore the earth is not riding on the back of a giant sea turtle.

top related