FolAgents HND
FolAgents HND
Logic for
Agents
Summary
First Order
Logic for
Agents
♦ FOL
♦ Wumpus world in FOL
♦ Situation calculus
Pros and cons of propositional logic
First Order
Logic for
Agents Propositional logic is declarative: pieces of syntax
correspond to facts
Propositional logic allows partial/disjunctive/negated
information
(unlike most data structures and databases)
Propositional logic is compositional:
meaning of B1,1 ∧ P1,2 is derived from meaning of B1,1 and of
P1,2
Meaning in propositional logic is context-independent
(unlike natural language, where meaning depends on context)
Propositional logic has very limited expressive power
(unlike natural language)
E.g., cannot say pits cause breezes in adjacent squares
except by writing one sentence for each square
First Order
Logic for
Agents Objects, Relations, Functions
First Order
Logic for Logical Symbols
Agents
A rst order language L is built upon the following sets of sym-
bols:
equality =
(not always included);
First Order
Logic for
Agents
FOL formulas
1 Terms
E.g., c , x , f (x , y ), f (g (c ), y ), plus (plus (x , 1), 3), . . .
2 Atomic Formulas
E.g., P (x ), Q (x , c ), R (x , f (x , y + c )), · · ·
First Order Formulas
First Order
Logic for Well-Formed Formulas
Agents
The set of formulae of L is inductively dened as follows:
If A is a formula ¬A is a formula;
If ◦ is a binary operator, A and B are formulas, then A◦B
is a formula;
Interpretations in FOL
First Order
Logic for In Prop. Logic an Interpretation for a formula G is an
Agents
assignment of truth values to each atoms occuring in the
formula
Example (Interpretation)
First Order
Logic for Example (Interpretation)
Agents
∀x ∃yP (x , y )
First Order
Logic for Given an interpretation I = hD , Ai, FOL formulas are evaluated
Agents
to true or false according to the following rules:
First Order
Logic for Example (Example of evaluation)
Agents
G , ∀x ∃yP (x , y )
InterpretationI for G
D = 1, 2 and P A (x , y ) = true i x < y
To evaluate G we have to evaluate for each element d ∈ D the
formula H , ∃yP (d , y ).
formula H is true.
x = 2 however H is false.
Thus G is false under I
First Order
Logic for Given the notion of interpretion, the concepts of model, validity
Agents and satisability can be dened as for propositional logic.
Denition (Model)
Denition (Validity)
Denition (Inconsistency)
First Order
Logic for Denition (Logical consequence)
Agents
A formula G is a logical consequence of formulas {F1 , · · · , Fn }
i for every interpretation I if I |= F1 ∧ · · · ∧ Fn we have that
I |= G .
The following theorems hold also for First Order Logic
First Order
Logic for
Agents
∀ x At (x , Berkeley ) =⇒ Smart (x )
∀ x At (x , Berkeley ) ∧ Smart (x )
First Order
Logic for
Agents
∃ x At (x , Stanford ) ∧ Smart (x )
∃ x At (x , Stanford ) =⇒ Smart (x )
Properties of quantiers
First Order
Logic for
Agents
First Order
Logic for
Agents
Suppose a wumpus-world agent is using an FOL KB
and perceives a smell and a breeze (but no glitter) at t = 5:
Tell (KB , Percept ([Smell , Breeze , None ], 5))
Ask (KB , ∃ a Action(a, 5))
I.e., does KB entail any particular actions at t = 5?
Answer: Yes , {a/Shoot } ← substitution (binding list)
Given a sentence S and a substitution σ ,
S σ denotes the result of plugging σ into S ; e.g.,
S = Smarter (x , y )
σ = {x /Hillary , y /Bill }
S σ = Smarter (Hillary , Bill )
Ask (KB , S ) returns some/all σ such that KB |= S σ
First Order
Logic for
Agents
Perception
∀ b, g , t Percept ([Smell , b, g ], t ) =⇒ Smelt (t )
∀ s , b, t Percept ([s , b, Glitter ], t ) =⇒ AtGold (t )
Reex: ∀ t AtGold (t ) =⇒ Action (Grab , t )
Reex 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 changes is essential
Deducing hidden properties I
First Order
Logic for
Agents
First Order
Logic for
Agents
Describing actions I
First Order
Logic for
Agents Eect axiomdescribe changes due to action
∀ s AtGold (s ) =⇒ Holding (Gold , Result (Grab, s ))
Frame axiomdescribe non-changes due to action
∀ s HaveArrow (s ) =⇒ HaveArrow (Result (Grab, s ))
Frame problem: nd an elegant way to handle non-change
(a) representationavoid frame axioms
(b) inferenceavoid repeated copy-overs to keep track of
state
Qualication problem: true descriptions of real actions require
endless caveatswhat if gold is slippery or nailed down or ...
Ramication problem: real actions have many secondary
consequenceswhat about the dust on the gold, wear and tear
on gloves, ...
Describing actions II
First Order
Logic for
Agents
Successor-state axioms solve the representational frame problem
Each axiom is about a predicate (not an action per se):
made P false]
Making plans
First Order
Logic for
Agents
First Order
Logic for
Agents
Summary
First Order
Logic for
Agents
First-order logic:
objects and relations are semantic primitives
syntax: constants, functions, predicates, equality, quantiers
Increased expressive power: sucient to dene wumpus world
Situation calculus:
conventions for describing actions and change in FOL
can formulate planning as inference on a situation calculus
KB