You are on page 1of 25

Lecture 3

Knowledge Representation
• When we use search to solve a problem we
must
– Capture the knowledge needed to formalize the
problem
– Apply a search technique to solve problem
– Execute the problem solution
Role of KR
• The first step is the role of “knowledge
representation” in AI.
• Formally,
– The intended role of knowledge representation in
artificial intelligence is to reduce problems of
intelligent action to search problems.
• A good description, developed within the
conventions of a good KR, is an open door to
problem solving
• A bad description, using a bad representation, is a
brick wall preventing problem solving
A Knowledge-Based Agent
• Now we look at extended capabilities to
general logical reasoning.
• Here is one knowledge representation: logical
expressions.
• A knowledge-based agent must be able to
– Represent states, actions, etc.
– Incorporate new percepts
– Update internal representations of the world
– Deduce hidden properties about the world
– Deduce appropriate actions
The Wumpus World Environment
Percepts
WW Agent Description
• Performance measure
– gold +1000, death -1000
– -1 per step, -10 for using arrow
• Environment
– Squares adjacent to wumpus are smelly
– Squares adjacent to pit are breezy
– Glitter iff gold is in same square
– Shooting kills wumpus if agent facing it
– Shooting uses up only arrow
– Grabbing picks up gold if in same
square
– Releasing drops gold in same square
• Actuators
– Left turn, right turn, forward, grab,
release, shoot
• Sensors
– Breeze, glitter, smell, bump, scream
Sample Run
Sample Run
Sample Run
Sample Run
Sample Run
Sample Run
Sample Run
Sample Run
Sample Run
Now we look at

• How to represent facts / beliefs


✓ “There is a pit in (2,2) or (3,1)”
• How to make inferences
✓ “No breeze in (1,2), so pit in (3,1)”
Representation, Reasoning and Logic
• Sentence: Individual piece of • Semantics: Mapping from sentences
knowledge to facts in the world
- English sentence forms one piece of - They define the truth of a sentence
knowledge in English language in a “possible world”
- Statement in C forms one piece of - Add the values of 2 and 3, store
knowledge in C programming them in the memory location
language indicated by variable a
• In the language of arithmetic:
• Syntax: Form used to represent
sentences x + 2 >= y is a sentence
- Syntax of C indicates legal x2 + y > is not a sentence
combinations of symbols x + 2 >= y is true in all worlds
- a = 2 + 3; is legal where the number x + 2 is
- a = + 2 3 is not legal no less than the number y
- Syntax alone does not indicate x + 2 >= y is true in a world where
meaning x = 7, y = 1
x + 2 >= y is false in a world where
x = 0, y = 6
Entailment
• There can exist a relationship between items in the language
– Sentences “entail” sentences (representation level)
– Facts “follow” from facts (real world)
• Entail / Follow mean the new item is true if the old items are true
• A collection of sentences, or knowledge base (KB), entail a sentence
– KB |= sentence
– KB entails the sentence iff the sentence is true in all worlds where the KB is true

Entails
Sentences Sentence
S S
e e
Representation m m
a a
n n
World t t
i i
c c
s s
Follows
Facts Fact
Entailment Examples
• KB • KB
– The Giants won – CookLectures ->
– The Reds won TodayIsTuesday v TodayIsThursday
• Entails – - TodayIsThursday
– Either the Giants won or the Reds – TodayIsSaturday -> SleepLate
won – Rainy -> GrassIsWet
• KB – CookLectures v TodayIsSaturday
– To get a perfect score your – GrassIsWet
program must be turned in today – - SleepLate
– I always get perfect scores • Which of these are correct
• Entails entailments?
– I turned in my program today – - Sleeplate
– GrassIsWet
– - SleepLate v GrassIsWet
– TodayIsTuesday
– True
Models
• Logicians frequently use models, which are
formally structured worlds with respect to
which truth can be evaluated. These are our
“possible worlds”.
• M is a model of a sentence s if s is true in M.
• M(s) is the set of all models of s.
• KB entails s (KB |= s) if and only if M(KB) is a
subset of M(s)
Entailment in the Wumpus World

• Situation after detecting nothing in [1,1], moving right,


breeze in [2,1]
• Consider possible models for the situation (the region
around the visited squares) assuming only pits, no wumpi
• 3 Boolean choices, so there are 8 possible models
Wumpus Models
Wumpus Models

KB = wumpus world rules + observations


Wumpus Models

KB = wumpus world rules + observations


Possible conclusion: alpha1 = “[1,2] is safe”
KB |= alpha1, proved by model checking
Wumpus Models

KB = wumpus world rules + observations

alpha2 = “[2,2] is safe”, KB |= alpha2

You might also like