Download First-Order Logic - Artificial Inteligence - Lecture Slides and more Slides Artificial Intelligence in PDF only on Docsity!
First-Order Logic
Chapter 8
Docsity.com
Outline
• Why FOL?
• Syntax and semantics of FOL
• Using FOL
• Wumpus world in FOL
• Knowledge engineering in FOL
Docsity.com
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 Docsity.com
Syntax of FOL: Basic elements
• Constants KingJohn, 2, NUS,...
• Predicates Brother, >,...
• Functions Sqrt, LeftLegOf,...
• Variables x, y, a, b,...
• Connectives ¬, ⇒, ∧, ∨, ⇔
• Equality =
• Quantifiers ∀, ∃
Docsity.com
Complex sentences
• Complex sentences are made from atomic
sentences using connectives
¬ S , S 1 ∧ S 2 , S 1 ∨ S 2 , S 1 ⇒ S 2 , S 1 ⇔ S 2 ,
E.g. Sibling(KingJohn,Richard) ⇒
Sibling(Richard,KingJohn)
Docsity.com
Truth in first-order logic
- Sentences are true with respect to a model and an interpretation
- Model contains objects (domain elements) and relations among them
- Interpretation specifies referents for constant symbols → objects predicate symbols → relations function symbols → functional relations
- An atomic sentence predicate(term 1 ,...,termn ) is true iff the objects referred to by term 1 ,...,termn are in the relation referred to by predicate Docsity.com
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) Docsity.com
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”
Docsity.com
Another common mistake to
avoid
- Typically, ∧ is the main connective with ∃
- Common mistake: using ⇒ as the main
connective with ∃:
∃ x At(x,NUS) ⇒ Smart(x)
is true if there is anyone who is not at NUS!
Docsity.com
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”
- Quantifier duality: each can be expressed using the other
- ∀x Likes(x,IceCream) ¬∃x ¬Likes(x,IceCream) Docsity.com
Using FOL
The kinship domain:
∀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))
Docsity.com
Using FOL
The set domain:
- ∀s Set(s) ⇔ (s = {} ) ∨ (∃x,s 2 Set(s2 ) ∧ s = {x|s2 })
- ¬∃x,s {x|s} = {}
- ∀x,s x ∈ s ⇔ s = {x|s}
- ∀x,s x ∈ s ⇔ [ ∃y,s 2 } (s = {y|s 2 } ∧ (x = y ∨ x ∈ s 2 ))]
- ∀s 1 ,s2 s1 ⊆ s 2 ⇔ (∀x x ∈ s 1 ⇒ x ∈ s 2 )
- ∀s 1 ,s2 (s 1 = s2 ) ⇔ (s1 ⊆ s 2 ∧ s 2 ⊆ s 1 )
- Docsity.com
Knowledge base for the
wumpus world
• Perception
- ∀t,s,b Percept([s,b,Glitter],t) ⇒ Glitter(t)
• Reflex
- ∀t Glitter(t) ⇒ BestAction(Grab,t)
Docsity.com
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)
Squares are breezy near a pit:
- Diagnostic rule---infer cause from effect ∀s Breezy(s) ⇒ \Exi{r} Adjacent(r,s) ∧ Pit(r)$ Docsity.com