m8 Fol
m8 Fol
m8 Fol
Chapter 8
Outline
Why FOL?
Syntax and semantics of FOL
Using FOL
Wumpus world in FOL
Knowledge engineering in FOL
First-order logic
Whereas propositional logic assumes the
world contains facts,
first-order logic (like natural language)
assumes the world contains
Objects: people, houses, numbers, colors,
baseball games, wars,
Relations: red, round, prime, brother of, bigger
than, part of, comes between,
Functions: father of, best friend, one more
than, plus,
Constants
Predicates
Functions
Variables
Connectives
Equality
Quantifiers
KingJohn, 2, NUS,...
Brother, >,...
Sqrt, LeftLegOf,...
x, y, a, b,...
, , , ,
=
,
Atomic sentences
Atomic sentence = predicate (term1,...,termn)
or term1 = term2
Term
function (term1,...,termn)
or constant or variable
Complex sentences
Complex sentences are made from atomic
sentences using connectives
S, S1 S2, S1 S2, S1 S2, S1 S2,
E.g. Sibling(KingJohn,Richard)
Sibling(Richard,KingJohn)
>(1,2) (1,2)
>(1,2) >(1,2)
objects
relations
functional relations
Universal quantification
<variables> <sentence>
Everyone at NUS is smart:
x At(x,NUS) Smart(x)
x P is true in a model m iff P is true with x being each
possible object in the model
Roughly speaking, equivalent to the conjunction of
instantiations of P
...
At(KingJohn,NUS) Smart(KingJohn)
At(Richard,NUS) Smart(Richard)
At(NUS,NUS) Smart(NUS)
Existential quantification
<variables> <sentence>
Someone at NUS is smart:
x At(x,NUS) Smart(x)$
x P is true in a model m iff P is true with x being some
possible object in the model
Roughly speaking, equivalent to the disjunction of
instantiations of P
At(KingJohn,NUS) Smart(KingJohn)
At(Richard,NUS) Smart(Richard)
At(NUS,NUS) Smart(NUS)
...
Properties of quantifiers
x y is the same as y x
x y is the same as y x
x y is not the same as y x
x y Loves(x,y)
y x Loves(x,y)
Equality
term1 = term2 is true under a given interpretation
if and only if term1 and term2 refer to the same
object
E.g., definition of Sibling in terms of Parent:
x,y Sibling(x,y) [(x = y) m,f (m = f)
Parent(m,x) Parent(f,x) Parent(m,y) Parent(f,y)]
Using FOL
The kinship domain:
Brothers are siblings
x,y Brother(x,y) Sibling(x,y)
Sibling is symmetric
x,y Sibling(x,y) Sibling(y,x)
Using FOL
The set domain:
s Set(s) (s = {} ) (x,s2 Set(s2) s = {x|s2})
x,s {x|s} = {}
x,s x s s = {x|s}
x,s x s [ y,s2} (s = {y|s2} (x = y x s2))]
s1,s2 s1 s2 (x x s1 x s2)
s1,s2 (s1 = s2) (s1 s2 s2 s1)
x,s1,s2 x (s1 s2) (x s1 x s2)
x,s1,s2 x (s1 s2) (x s1 x s2)
S = Smarter(x,y)
= {x/Hillary,y/Bill}
S = Smarter(Hillary,Bill)
Reflex
t Glitter(t) BestAction(Grab,t)
8.
3. Decide on a vocabulary
Alternatives:
Type(X1) = XOR
Type(X1, XOR)
XOR(X1)
Type(X2) = XOR
Type(A2) = AND
Connected(Out(1,X1),In(1,X2))
Connected(Out(1,X1),In(2,A2))
Connected(Out(1,A2),In(1,O1))
Connected(Out(1,A1),In(2,O1))
Connected(Out(1,X2),Out(1,C1))
Connected(Out(1,O1),Out(2,C1))
Connected(In(1,C1),In(1,X1))
Connected(In(1,C1),In(1,A1))
Connected(In(2,C1),In(2,X1))
Connected(In(2,C1),In(2,A1))
Connected(In(3,C1),In(2,X2))
Connected(In(3,C1),In(1,A2))
Summary
First-order logic:
objects and relations are semantic primitives
syntax: constants, functions, predicates,
equality, quantifiers