resolution,frws and bckwrd chaining

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.

Upload: api-19484677

Post on 12-Nov-2014

195 views

Category:

Documents


1 download

TRANSCRIPT

Example ProblemJohn likes all kinds of food. Apples are food. Chicken is food. Anything anyone eats and isnt killed by is food. Bill eats peanuts, and is still alive. Sue eats everything that Bill eats.

Example ProblemJohn likes all kinds of foodApples are food.

x food (x) eats(John, x)

food(apples) Chicken is food. food(chicken) Anything anyone eats and x,y eats(x,y) killed(x) isnt killed by is food. food(y)Bill eats peanuts, and is still alive. Sue eats everything that Bill eats.

eats(Bill,Peanuts) killed(Bill) x eats (Bill,x) 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 Chainingeats(John, apples) eats(John, Peanuts) eats(John, chicken) x food (x) eats(John, x) food(Peanuts) x,y eats(x,y) killed(x) food(y) food(apples) eats(Bill,Peanuts) killed(Bill) food(chicken)

More Efficient Forward ChainingChecking 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 match rules that contain recently added literals Especially if desired conclusion is not entailed (Incomplete)

Strategy

Forward chaining may not terminate

Backward ChainingStart 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 eats(John, y) Yes, y/peanuts In reality,knowledge base the algorithm would include all appropriatefood (y) Yes, y/peanuts rules. eats(x,y) killed(x)

Yes, x/Bill, y/peanuts

Yes, x/Bill

Backward Chaining Depth First recursive proof

space is linear in size of proof. infinite loops repeated subgoals

Incomplete

Can be inefficient

FOL to CNFResolution requires that FOL sentences be represented in Conjunctive Normal Form (CNF)

[ Animal ( F ( x )) Loves(G ( x ), x )] [Loves( x, F ( x )) Loves(G ( x ), x )]

Everyone who loves all animals is loved by someone. FOL: x[y Animal ( y ) Loves( x, y )] [y Loves( y, x )] CNF:

ResolutionResolution

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)

ResolutionImplicative Formx food (x) eats(John, x) food(apples) food(chicken) x,y eats(x,y) killed(x) food(y)

Conjunctive normal form food (x) eats(John, x) food(apples) food(chicken) eats(x,y) killed(x) food(y)

eats(Bill,Peanuts) killed(Bill) eats(Bill,Peanuts) 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){x/Bill, y/peanuts}

eats(Bill,Peanuts)

killed(Bill) food(peanuts)

killed(Bill)

food (x) eats(John, x)

food(peanuts)

{x/peanuts}

eats(John, peanuts)

True

Resolution uses unificationUnification: 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)knows(John, x) knows(John, x) knows(John, x) knows(John, x) x,y implicitly universally quantified

p

knows(John,Jane) knows(y, Jack) knows(y,mother(y)) knows(x, Jack)

q

{x / Jane}

{x / Jack, y / John} {y / John, x / mother(John)} fail P & Q cannot share x

Generalized Resolutionp1 .... 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 RefutationIf S is an unsatisfiable set of clauses, then the application of a finite number of resolution steps to S will yield a contradiction.

ResolutionImplicative Formx food (x) eats(John, x) food(apples) food(chicken) x,y eats(x,y) killed(x) food(y)

Conjunctive normal form food (x) eats(John, x) food(apples) food(chicken) eats(x,y) killed(x) food(y)

eats(Bill,Peanuts) killed(Bill) eats(Bill,Peanuts) killed(Bill) x eats (Bill,x) eats(Sue,x) eats (Bill,x) eats(Sue,x) Forward & Backward Chaining Resolution

Resolution refutation proofStart with: eats(John, peanuts) food (x) eats(John, x){x/Peanuts}

eats(John,Peanuts)

food(peanuts)

eats(x,y) killed(x) food(y)

{y/Peanuts}

killed(Bill)

eats(x,Peanuts) killed(x)

eats(Bill, peanuts)

Conclusion: eats(John, peanuts) eats(Bill,Peanuts) is false. Therefore, eats(John, peanuts) must be True.

{x/Bill}

False