Logical Agents: AIMA 3rd Ed. - Chapter 7
Logical Agents: AIMA 3rd Ed. - Chapter 7
Gold
PIT
OK
OK OK
A
B OK
A
OK OK
A
P?
B OK P?
A
OK OK
A
P?
B OK P?
A
OK S OK
A A
P?
P
B OK P?
OK
A
OK S OK
A A W
AIMA 3rd ed. - Chapter 7 10
Exploring a wumpus world
P?
P
B OK P?
OK
A A
OK S OK
A A W
AIMA 3rd ed. - Chapter 7 11
Exploring a wumpus world
P? OK
P
B OK P? OK
OK
A A
OK S OK
A A W
AIMA 3rd ed. - Chapter 7 12
Exploring a wumpus world
P? OK
P
B OK P? BGS OK
OK
A A A
OK S OK
A A W
AIMA 3rd ed. - Chapter 7 13
Uncertainty
There may be situations where there are no guaranteed safe moves. In that
case, we will consider the likelihoods of events (e.g. if we have no
choice but go to one of the squares that may have a pit, decide on which
one has a higher probability of having a pit; we will see this later).
But for now, we assume that we are dealing with problems that can be solved
with logical thinking and the safety of squares will not be left to chance.
B OK P?
A
P? Breeze in (1,2) and (2,1)
⇒ no safe actions
OK B OK
P?
A A
S
A 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
AIMA 3rd ed. - Chapter 7 15
Inference in computers
♦ How can we get an agent do what we did?
That is, how can it know whether it is OK to move to [2,1]?
♦ Notice that an exhaustive search is not an option here because the agent
doesnt want to die.
♦ The agent needs a formal inference mechanism to derive valid conclusions
even when it does not know what the interpretation is (the computer does
not need to know the meaning of OK, or Wumpus or Pit... )
We will use a formal logic to extend the capacity of our agents by endowing
them with the capacity for logical reasoning.
KB-Rulesiai.FI#aasLwetaromeb
tas II.
AIMA 3rd ed. - Chapter 7 21
ana
Entailment
Entailment is a relationship between sentences (i.e., syntax)
that is based on semantics
-4worlds
Knowledge base KB entails sentence α (KB |= α)
possible
¥¥¥±
if and only if
α is true in all worlds where KB is true
Wetrounds -3 madde
KB : Rain ⇒
for the
Rain Nett Raminde
÷i÷±¥÷÷
Difference between world and model:
”model” is used interchangeably with ”world” in the general sense;
but a ”model” of a particular sentence is a ”world” in which that sentence
is True)
KB ani
:@ ⇒ WETG ) 1 Rami
KB
? ?
B
A A
?
2 PIT
2
Breeze
1
Breeze
1 PIT
1 2 3
1 2 3
2 PIT
2 PIT
2
Breeze
Breeze
1 PIT
1
Breeze
1
1 2 3
1 2 3
1 2 3
2 PIT PIT
2 PIT
Breeze
1
Breeze
1 PIT 2 PIT PIT
1 2 3
1 2 3
Breeze
1 PIT
1 2 3
2 PIT
2
Breeze
1
Breeze
1 PIT
1 2 3
KB
1 2 3
2 PIT
2 PIT
2
Breeze
Breeze
1 PIT
1
Breeze
1
1 2 3
1 2 3
1 2 3
2 PIT PIT
2 PIT
Breeze
1
Breeze
1 PIT 2 PIT PIT
1 2 3
1 2 3
Breeze
1 PIT
1 2 3
2 PIT
2
Breeze
1
Breeze
1 PIT
1 2 3
KB
1 2 3
1
2 PIT
2 PIT
2
Breeze
Breeze
1 PIT
1
Breeze
1
1 2 3
1 2 3
1 2 3
2 PIT PIT
2 PIT
Breeze
1
Breeze
1 PIT 2 PIT PIT
1 2 3
1 2 3
Breeze
1 PIT
1 2 3
2 PIT
2
Breeze
1
Breeze
1 PIT
1 2 3
KB
1 2 3
2 PIT
2 PIT
2
Breeze
Breeze
1 PIT
1
Breeze
1
1 2 3
1 2 3
1 2 3
2 PIT PIT
2 PIT
Breeze
1
Breeze
1 PIT 2 PIT PIT
1 2 3
1 2 3
Breeze
1 PIT
1 2 3
2 PIT
2
Breeze
1
2
Breeze
1 PIT
1 2 3
KB
1 2 3
2 PIT
2 PIT
2
Breeze
Breeze
1 PIT
1
Breeze
1
1 2 3
1 2 3
1 2 3
2 PIT PIT
2 PIT
Breeze
1
Breeze
1 PIT 2 PIT PIT
1 2 3
1 2 3
Breeze
1 PIT
1 2 3
M( ) x
α = ”Fever” x x
x
x
x x
x
x x
x x x x
x x
x x x x
xx x xx
x
x x
x x x
M(KB) x
x x x
x x
x
ğµF
inputs: KB, the knowledge base, a sentence in propositional logic Rain
α, the query, a sentence in propositional logic
⇒
symbols ← a list of the proposition symbols in KB and α
return TT-Check-All(KB, α, symbols, [ ])
IX.
•
¥ ! were
Model checking
a) truth table enumeration (always exponential in n)
b) heuristic search in model space (sound but incomplete)
e.g., min-conflicts-like hill-climbing algorithms
Application of inference rules
– Legitimate (sound) generation of new sentences from old
– Proof = a sequence of inference rule applications
Can use inference rules as operators in a standard search alg.
– Typically require translation of sentences into a normal form
(α ∧ β) ≡ (β ∧ α) commutativity of ∧ and
(α ∨ β) ≡ (β ∨ α) commutativity of ∨ or
((α ∧ β) ∧ γ) ≡ (α ∧ (β ∧ γ)) associativity of ∧
((α ∨ β) ∨ γ) ≡ (α ∨ (β ∨ γ)) associativity of ∨
¬(¬α) ≡ α double-negation elimination
(α ⇒ β) ≡ (¬β ⇒ ¬α) contraposition Rain ⇒ wetGE.TW
⇒ Rain
Talip ← (α ⇒ β) ≡ (¬α ∨ β) implication elimination
(α ⇔ β) ≡ ((α ⇒ β) ∧ (β ⇒ α)) biconditional elimination
¬(α ∧ β) ≡ (¬α ∨ ¬β) De Morgan
⇐ VTR )
¬(α ∨ β) ≡ (¬α ∧ ¬β) De Morgan Tan TB
(α ∧ (β ∨ γ)) ≡ ((α ∧ β) ∨ (α ∧ γ)) distributivity of ∧ over ∨
(α ∨ (β ∧ γ)) ≡ ((α ∨ β) ∧ (α ∨ γ)) distributivity of ∨ over ∧
⇒ AACSNW
AAERAÜ
) WAG GIDI
:L
Raif
⇒
KB
. -
.
ET
[email protected]
weansty
•
IBM )
AVB
KBtdifdonly.it is
•
C
[email protected]
)
harrison AIMA 3rd ed. - Chapter 7 44
.
Propositional inference: Enumeration method
Let KB = (A ∨ C) ∧ (B ∨ ¬C) and α = A ∨ B
Is it the case that KB |= α?
Check all possible models—α must be true wherever KB is true
O
A
F alse
B
OF
F alse
C
F alse
A ∨ C B ∨ ¬C KB α
E
F alse F alse T rue .
.
.
Truth table method: 2N rows of table for any proof involving N symbols
Linear space requirements though using Depth-First search.
Formally:
bottomwd-G.pwpam-D9.TK
β
-
aldan .
- -
αi
Dayer.Traff.ie -
di
Unit resolution (from a disjunction, if one of the disjuncts are false, you can
infer the other one is true)
α∨β ¬β
α
P?
♦ E.g., P
00
P1,3 ∨ P2,2, ¬P2,2 B OK P?
OK
O
A A
P1,3
Raü
OK S OK
A A W
O
7RJInvwewta.GR/ain-
AIMA 3rd ed. - Chapter 7 53
Resolution algorithm
Proof by contradiction, i.e., show KB ∧ ¬α unsatisfiable
B1,1 P1,2 B1,1 P P P1,2 B1,1 P2,1 B1,1 P P P2,1 P2,1 P1,2
1,2 2,1 1,2 2,1
Example KB: C ∧ (B ⇒ A) ∧ (C ∧ D ∧ E ⇒ B)
Terminology: premise ⇒ conclusion
A∧B ⇒ L L
A
B
A B
1
P
2
M
2
L
2 2
A B
1
P
2
M
2
L
1 1
A B
1
P
2
M
1
L
1 0
A B
1
P
1
M
0
L
1 0
A B
1
P
0
M
0
L
1 0
A B
0
P
0
M
0
L
0 0
A B
0
P
0
M
0
L
0 0
A B
0
P
0
M
0
L
0 0
A B
A B
A B
A B
A B
A B
A B
A B
A B
A B
A B
A B