Title: Chaining in First Order Logic
1Chaining in First Order Logic
- CS 171/271
- (Chapter 9, continued)
- Some text and images in these slides were drawn
fromRussel Norvigs published material
2Forward Chaining
- Forward Chaining in PL extends to FOL
- A similar restriction applies to the KB
- Implications
- Atomic sentences
- KB can contain quantifiers
- Apply EI for existentially quantified sentences
- Allow variables for universally quantified
sentences (omit quantifier in such sentences)
3Knowledge Base Example
- The law says that it is a crime for an American
to sell weapons to hostile nations. The country
Nono, an enemy of America, has some missiles, and
all of its missiles were sold to it by Colonel
West, who is American. - Prove that Colonel West is a criminal
4Knowledge Base Example
- ... it is a crime for an American to sell weapons
to hostile nations - American(x) ? Weapon(y) ? Sells(x,y,z) ?
Hostile(z) ? Criminal(x) - Nono has some missiles, i.e., ?x Owns(Nono,x) ?
Missile(x) - Owns(Nono,M1) and Missile(M1)
- all of its missiles were sold to it by Colonel
West - Missile(x) ? Owns(Nono,x) ? Sells(West,x,Nono)
- Missiles are weapons
- Missile(x) ? Weapon(x)
- An enemy of America counts as "hostile
- Enemy(x,America) ? Hostile(x)
- West, who is American
- American(West)
- The country Nono, an enemy of America
- Enemy(Nono,America)
5Forward Chaining Algorithm
6Forward Chaining Example
7Forward Chaining Example
Missile(x) ? Weapon(x)
Enemy(x,America) ? Hostile(x)
Missile(x) ? Owns(Nono,x) ? Sells(West,x,Nono)
8Forward Chaining Example
- American(x) ? Weapon(y) ? Sells(x,y,z) ?
Hostile(z) ? Criminal(x)
9About Forward Chaining
- Matching rules against known facts
- Incremental forward chaining
- Irrelevant facts
10Backward Chaining
- Begin with goal (query)
- Recursively build a set of substitutions that
satisfy the premises necessary to conclude goal
11Backward Chaining Algorithm
- SUBST(COMPOSE(?1, ?2), p) SUBST(?2, SUBST(?1,
p))
12Backward Chaining Example
13Backward Chaining Example
14Backward Chaining Example
15Backward Chaining Example
16Backward Chaining Example
17Backward Chaining Example
18Backward Chaining Example
19Backward Chaining Example
20About Backward Chaining
- Uses composition of substitutions
- A DFS algorithm
- Linear time
- Repeated states and incompleteness