Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 17

Example Problem

John likes all kinds of food.


Apples are food.
Chicken is food.
Anything anyone eats and isn’t killed by
is food.
Bill eats peanuts, and is still alive.
Sue eats everything that Bill eats.
Example Problem
John likes all kinds of x food (x)  eats(John, x)
food
Apples are food. food(apples)
Chicken is food. food(chicken)
Anything anyone eats and x,y eats(x,y)  killed(x)
isn’t killed by is food.  food(y)
Bill eats peanuts, and is still eats(Bill,Peanuts) 
alive. killed(Bill)
Sue eats everything that Bill x eats (Bill,x) 
eats. eats(Sue,x)
Answer Questions (by Proof)
Does John eat peanuts?
1) eats(Bill,Peanuts)  killed(Bill)
2) x,y eats(x,y)  killed(x)  food(y)
SUBST({x/Bill,y/Peanuts}), universal elimination, and modus
ponens to derive food(peanuts)
3) x food (x)  eats(John, x)
SUBST({x/Peanuts}) and use (2, universal elimination, and
modus ponens to derive eats(John,peanuts)

Derived Proof by Forward Chaining


The proof steps could have been longer – if we had tried other derivations
For example, many possibilities for substitution and universal elimination

Need search strategies to perform this task efficiently


Pictorial View: Forward Chaining
likes(John, Peanuts)

x food (x)  likes(John, x)

food(Peanuts)
x,y eats(y,x)  alive(y)  food(x)

eats(Bill,Peanuts) Alive(Bill)
More Efficient Forward Chaining
Checking all rules will take too much time.

Check only rules that include a conjunct


that unifies a newly created fact during
the previous iteration.
 Incremental Forward Chaining
Forward Chaining
• Data Driven
• not directed at finding particular information –
can generate irrelevant conclusions
• Strategy
• match rules that contain recently added literals
• Forward chaining may not terminate
• Especially if desired conclusion is not entailed
(Incomplete)
Backward Chaining
Start at the goal, chain through inference rules
to find known facts that support the proof.
 Uses Modus Ponens backwards
 Designed to answer questions posed to a knowledge
base
likes(John, x) Yes, x/peanuts

food (x) Yes, x/peanuts

eats(y,x) alive(y)
Yes, y/Bill, x/peanuts Yes, y/Bill
Backward Chaining
• Depth First recursive proof
• space is linear in size of proof.
• Incomplete
• infinite loops
• Can be inefficient
• repeated subgoals
FOL to CNF
Resolution requires that FOL sentences be
represented in Conjunctive Normal Form
(CNF)
 Everyone who loves all animals is loved by
someone.
 FOL: x[y Animal ( y )  Loves( x, y )]  [y Loves( y, x )]
 CNF:
[ Animal( F ( x ))  Loves(G ( x ), x )]  [Loves( x, F ( x ))  Loves(G ( x ), x )]
Resolution
Resolution
 a single inference rule
 provides a complete inference algorithm
when coupled with any complete search
algorithm.

P(x)  Q(x) ,  Q(x)  R(x)


P(x)  R(x)
Resolution
Implicative Form Conjunctive normal form
x food (x)  eats(John, x)  food (x)  eats(John, x)
food(apples) food(apples)
food(chicken) food(chicken)
x,y eats(x,y)  killed(x)   eats(x,y)  killed(x)  food(y)
food(y)
eats(Bill,Peanuts)  eats(Bill,Peanuts)
killed(Bill)
killed(Bill)
x eats (Bill,x)  eats(Sue,x)  eats (Bill,x)  eats(Sue,x)
Forward & Backward Chaining Resolution
Resolution Proof

 eats(x,y)  killed(x)  food(y) eats(Bill,Peanuts)

{x/Bill, y/peanuts}

killed(Bill)  food(peanuts) killed(Bill)

 food (x)  eats(John, x) food(peanuts)


{x/peanuts}

eats(John, peanuts)  True


Resolution uses unification
Unification: takes two atomic expressions p
and q, and generates a substitution that
makes p and q look the same.
UNIFY(p,q) =  where SUBST(,p) = SUBST(,q)
p q 

x,y – implicitly
knows(John, x) knows(John,Jane) {x / Jane} universally quantified

knows(John, x) knows(y, Jack) {x / Jack, y / John}

knows(John, x) knows(y,mother(y)) {y / John, x / mother(John)}

knows(John, x) knows(x, Jack) fail P & Q cannot share x


Generalized Resolution
p1  .... p j  .... pm
q1  .... qk  .... qn
SUBST ( , ( p1  .... p j 1  p j 1.... pm  q1  .... qk 1  qk 1.... qn ))

Problem with Resolution: It is incomplete


Example: cannot prove p   p from an empty KB

However, Resolution refutation, i.e.,


proof by contradiction has been proven to be complete
(KB  p  False)  (KB  p)
Resolution Refutation
If S is an unsatisfiable set of clauses,
then the application of a finite number
of resolution steps to S will yield a
contradiction.
Resolution
Implicative Form Conjunctive normal form
x food (x)  eats(John, x)  food (x)  eats(John, x)
food(apples) food(apples)
food(chicken) food(chicken)
x,y eats(x,y)  killed(x)   eats(x,y)  killed(x)  food(y)
food(y)
eats(Bill,Peanuts)  eats(Bill,Peanuts)
killed(Bill)
killed(Bill)
x eats (Bill,x)  eats(Sue,x)  eats (Bill,x)  eats(Sue,x)
Forward & Backward Chaining Resolution
Resolution refutation proof
Start with:  eats(John, peanuts)

 food (x)  eats(John, x)  eats(John,Peanuts)

{x/Peanuts}

 food(peanuts)  eats(x,y)  killed(x)  food(y)

{y/Peanuts}

killed(Bill)  eats(x,Peanuts)  killed(x)


{x/Bill}
Conclusion: eats(John, peanuts)
eats(Bill, peanuts)  eats(Bill,Peanuts) is false. Therefore,
eats(John, peanuts) must be True.
 False

You might also like