Unit III-FOL
Unit III-FOL
Outline
• Why FOL?
• Syntax and semantics of FOL
• Using FOL
Pros and cons of propositional logic
Propositional logic is declarative
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
–
–
•
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, squares, pits, wumpuses,…
– Relations: red, round, prime, brother of, bigger than, part
of, comes between, is breezy, is adjacent to, shoots …
– Functions: father of, best friend, one more than, plus, …
•
Examples:
• “One plus two equals three.” Objects: one, two, three, one plus
two; Relation: equals;
Function: plus. (“One plus two” is a name for the object that is
obtained by applying the function “plus” to the objects “one”
and “two.” “Three” is another name for this object.)
• E.g.,1 Brother(KingJohn,RichardTheLionheart)
• 2 King John’s left leg : LeftLegOf(KingJohn)
•
• 3 Richard the Lionheart’s father is married to King John’s
mother
• Married(Father(Richard),Mother(John))
Complex sentences
• Complex sentences are made from atomic
sentences using connectives
E.g. Sibling(KingJohn,Richard)
Sibling(Richard,KingJohn)
All kings are persons
A common mistake to avoid
• Typically, is the main connective with
• Common mistake: using as the main
connective with :
x At(x,NUS) Smart(x)
means “Everyone is at NUS and everyone is smart”
•
Existential quantification
<variables> <sentence>
•
•
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)
– “There is a person who loves everyone in the world”
y x Loves(x,y)
– “Everyone in the world is loved by at least one person”
•
Using FOL
The kinship domain:
• Brothers are siblings
x,y Brother(x,y) Sibling(x,y)
• One's mother is one's female parent
m,c Mother(c) = m (Female(m) Parent(m,c))
• “Sibling” is symmetric
x,y Sibling(x,y) Sibling(y,x)
–
–
–
• – “Each animal is an organism”
• – “All animals are organisms”
• – “If it is an animal then it is an organism”
• This can be formalised as:
– ∀x(Animal(x)→Organism(x))
– “Aliens exist”
– ∃xAlien(x)
•
Interacting with FOL KBs
• 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 BestAction(a,5))
•
Knowledge base for the
wumpus world
• Perception
t,s,b Percept([s,b,Glitter],t) Glitter(t)
• Reflex
t Glitter(t) BestAction(Grab,t)
–
Deducing hidden properties
x,y,a,b Adjacent([x,y],[a,b])
[a,b] {[x+1,y], [x-1,y],[x,y+1],[x,y-1]}
Properties of squares:
s,t At(Agent,s,t) Breeze(t) Breezy(s)