FirstOrderLogic StuartRussel
FirstOrderLogic StuartRussel
First-Order
Logic
The FOL language
FOL is a language—we define the syntax, the semantics,
and give examples.
• Limitation:
– Propositional logic has very limited expressive power,
unlike natural language. E.g., we cannot express “pits
cause breezes in adjacent squares” except by writing one
sentence for each square
First-Order Logic – The FOL language –
First-order logic
Connectiv x, y, a, b, . . .
es ∧ ∨ ¬ ⇒ ⇔
Equality =
Quantifiers ∀∃
Functions S qr t, L e f tLeg O f , . . .
⟨term⟩ → function(⟨term⟩,. . . )
| constant
| variable
⟨complex → ¬ ⟨sentence⟩
sentence⟩ | (⟨sentence⟩ [∧ | ∨ | ⇒ | ⇔ ]
⟨sentence⟩)
• Existential quantification
∃ ⟨variables⟩ ⟨sentence⟩
∃ x P is true in a model m iff P is true with x being some
possible object in the model
Example: “Someone at Stanford is smart:” ∃ x At(x, Stanford) ∧
Smart(x)
First-
Orde
r
Logic
–
FOL
Infere
nce –
13/3
Universal instantiation (UI)
• Whenever a KB contains a universally quantified sentence,
we may add to the KB any instantiation of that sentence,
where the logic variable v is replaced by a concrete
ground term g:
∀v α
S U B S T ({ v/g} , α)
∃v α
S U B S T ({ v/k } , α)
First-
Orde
r
Logic
–
FOL
Infere
nce –
16/3
Reduction to propositional inference
• Instantiating all quantified sentences allows us to ground the
KB, that is, to make the KB propositional
• Example: Suppose the KB contains just the following:
∀ x K ing (x ) ∧ G r eedy(x ) ⇒
E vil (x ) K i n g ( J o h n )
Greedy(John)
B r other(R ichard, J ohn)
2. Move ¬ inwards: ¬∀ x, p ≡ ∃ x ¬ p, ¬∃ x, p ≡ ∀ x ¬ p:
l1 ∨ · · · ∨ lk , m1 ∨ · · · ∨ mn
(l 1 ∨ · · · ∨ l i − 1 ∨ l i + 1 ∨ · · · ∨ l k ∨ m 1 ∨ · · · ∨ m j − 1 ∨ m j + 1 ∨ · · ·
∨ m n )θ
Example:
¬Rich(x) ∨ Unhappy(x), R i c h ( Ke n )
Unhappy(Ken)
First-
with θ = { x / K e n } Orde
r
• Apply resolution steps to C N F ( K B ∧ ¬α); complete for FOL Logic
–
FOL
Infere
nce –
36/3
Example: crime – resolution proof
First-
Orde
r
Logic
–
FOL
Infere
nce –
37/3