chapter07-new2
chapter07-new2
First-order logic
& %
1
' $
Outline
♦ Why FOL?
♦ Syntax and semantics of FOL
♦ Fun with sentences
♦ Wumpus world in FOL
& %
2
' $
' $
First-order logic
& %
4
' $
Logics in general
& %
5
' $
& %
6
' $
Atomic sentences
& %
7
' $
Complex sentences
¬S, S1 ∧ S2 , S1 ∨ S2 , S1 ⇒ S2 , S1 ⇔ S2
& %
8
' $
& %
9
' $
crown
on head
person brother
person
brother king
R $ J
left leg left leg
& %
10
' $
& %
11
' $
Universal quantification
At(KingJohn, GM U ) ⇒ Smart(KingJohn)
∧ At(Richard, GM U ) ⇒ Smart(Richard)
∧ At(M ason, GM U ) ⇒ Smart(M ason)
∧ ...
& %
12
' $
∀ x At(x, GM U ) ∧ Smart(x)
& %
13
' $
Existential quantification
& %
14
' $
& %
15
' $
Properties of quantifiers
& %
17
' $
& %
18
' $
& %
19
' $
& %
20
' $
& %
21
' $
Equality
& %
22
' $
' $
“Perception”
∀ b, g, t P ercept([Smell, b, g], t) ⇒ Smelt(t)
∀ s, b, t P ercept([s, b, Glitter], t) ⇒ AtGold(t)
Reflex: ∀ t AtGold(t) ⇒ Action(Grab, t)
Reflex with internal state: do we have the gold already?
∀ t AtGold(t) ∧ ¬Holding(Gold, t) ⇒ Action(Grab, t)
Holding(Gold, t) cannot be observed
⇒ keeping track of change is essential
& %
24
' $
Properties of locations:
∀ x, t At(Agent, x, t) ∧ Smelt(t) ⇒ Smelly(x)
∀ x, t At(Agent, x, t) ∧ Breeze(t) ⇒ Breezy(x)
Squares are breezy near a pit:
Diagnostic rule—infer cause from effect
∀ y Breezy(y) ⇒ ∃ x P it(x) ∧ Adjacent(x, y)
Causal rule—infer effect from cause
∀ x, y P it(x) ∧ Adjacent(x, y) ⇒ Breezy(y)
Neither of these is complete—e.g., the causal rule doesn’t say whether
squares far away from pits can be breezy
Definition for the Breezy predicate:
∀ y Breezy(y) ⇔ [∃ x P it(x) ∧ Adjacent(x, y)]
& %
25
' $
PIT
Gold PIT
PIT
PIT
Gold PIT
S1
PIT
Forward
S0
& %
26
' $
Describing actions I
' $
Describing actions II
& %
28
' $
Making plans
& %
29
' $
& %
30
' $
Summary
First-order logic:
– objects and relations are semantic primitives
– syntax: constants, functions, predicates, equality, quantifiers
Increased expressive power: sufficient to define wumpus world
Situation calculus:
– conventions for describing actions and change in FOL
– can formulate planning as inference on a situation calculus KB
& %
31