VIEWS: 7 PAGES: 25 POSTED ON: 3/27/2011 Public Domain
Lecture 9a: Resolution Strategies Heshaam Faili Restriction hfaili@ece.ut.ac.ir strategies for University of Tehran resolution Horn clauses Resolution can be very inefficient… 1. {p,q} KB 17. { } 4, 9 2. {~p,r} KB 18. {r} 3, 10 3. {~q,r} KB 19. { } 8, 10 4. {~r} prove 20. { } 4, 11 5. {q,r} 1, 2 21. {r} 2, 12 6. {p, r} 1, 3 22. { } 7, 12 7. {¬ p} 2, 4 23. {r} 3, 13 8. {¬ q} 3, 4 24. { } 8, 13 9. {r} 3, 5 25. { } 4, 14 10. {q} 4, 5 26. {r} 2, 15 11. {r} 3, 6 27. { } 7, 15 12. {p} 4, 6 28. { } 4, 16 13. {q} 1, 7 29. { } 4, 18 short proof: 14. {r} 6, 7 30. { } 4, 21 15. {p} 1, 8 31. { } 4, 23 {1,2,3,4,5,9,17 16. {r} 5, 8 32. { } 4, 26 } Resolution Strategies: key issues How to choose the next two clauses to resolve? In the worst case we need to generate a very large number of redundant, often irrelevant conclusions. Note: the size of KB grows, so more resolutions! How to avoid useless work by not performing certain unnecessary deductions. The goal is to decrease the size of the resolution graph that leads to a conclusion. Can we restrict FOL to obtain an efficient resolution strategy: trade-off expressivity/efficiency? 3 Horn Clauses Def: A Horn clause is a clause with at most one positive (negative) literal (either form for all KB) {p1,p2,….,pn ,~q} {~p1,~p2,….,~pn ,q} usually comes from sentences that describe rules q => (p1 p2 … pn) (p’1 p’2 … p’n) => q’ the general form is the implicative normal form (p1 p2 … pn) => (q1 q2 … qm) Advantages: efficient and complete resolution strategies! Trade off expressiveness for efficiency 4 Deletion strategies Eliminate unnecessary clauses from KB so as to avoid wasted resolutions: 1. pure literal elimination 2. tautology elimination 3. subsumption elimination The deletions are always sound and complete by definition! 5 1. Pure literal elimination Remove any clause containing a “pure literal”— a literal that has no complementary instance in the data base: 1. {~p, ~q, r} 2. {~p, s} “s” is a pure literal, so these 2 clauses can be 3. {~q, s} “thrown away.” 4. {p} 5. {q} 6. {~r} This preserves soundness and completeness since we cannot derive the empty clause with pure literals 2. Tautology elimination Eliminate clauses that contain identical complementary literals -- these are tautologies which do not change the satisfiability of KB Ex1: {p(g(a)),~p(g(a))} {p(X), q(Y),~q(Y),r(Z)} can all be eliminated! Ex2: {p(a),~p(X)} cannot be eliminated! {p(a)} {~p(b)} with the first clause, {} is derivable; without, it is not 3. Subsumption elimination Delete all subsumed clauses. A clause F is said to subsume clause Y iff there is a substitution U such that F[U] =>Y Ex: 1. {p(X), q(Y)} subsumes 2. {p(a), q(V), r(W)} since the substitution U = {X/a, Y/V} makes the first a subset of the second. So we can “throw away” the second. The same set of clauses that resolve 2. will resolve 1. 8 Resolution strategies How to choose the next two clauses to resolve: unit resolution input resolution linear resolution set-of-support resolution directed resolution What is the complexity of each strategy? Are these strategies sound and complete? If not, for what subset of FOL they are? 9 Unit Resolution (1) When choosing two clauses to resolve, at least one of the clauses being resolved at every step contains a single literal (unit clause). The idea: produce shorter and shorter sentences Ex: 1. {p, q} KB 7. {q} 1, 5 2. {~p, r} KB 8. {p} 1, 6 3. {~q, r} KB 9. {r} 3, 7 4. {~r} KB 10. { } 6, 7 5. {~p} 2, 4 6. {~q} 3, 4 11. {r} 2, 8 12. { } 5, 8 Unit Resolution (2) • Unit resolution refutation is complete for Horn clauses but incomplete in general: Ex: 1. {p, q} 2. {~p, q} 3. {p, ~q} 4. {~p, ~q} Cannot perform a single unit resolution since all clauses are of size 2! Input Resolution • At least one of the clauses being resolved at every step is a member of the initial (i.e., input) knowledge base. • Input refutation is complete for Horn clauses but incomplete in general: Ex: 1. {p, q} KB 2. {~p, q} KB 3. {p, ~q} KB Cannot perform 4. {~p, ~q} KB input resolution! Linear Resolution At least one of the clauses being resolved at every step is either in the initial data knowledge base or is an ancestor of the other clause (generalization of input resolution) Linear resolution refutation complete for all clauses Ex: {p, q} {~p, q} {p, ~q} {~p, ~q} {q} {p} {~q} {q} {} Set of Support Resolution A subset G of a set KB is called a “set of support” for KB iff KB - G is satisfiable. Set of support resolution: at least one of the clauses being resolved at every step is selected from a set of support G. The idea: use only a subset of the KB for new clauses set of support refutation is complete for all clauses often, G is chosen to be the clauses derived from the negated goal can be seen as working backwards from the goal Set of Support resolution example 1. {p, q} KB 2. {~p, r} KB 3. {~q, r} KB 4. {~r} G 5. {~p} 2, 4 add to G 6. {~q} 3, 4 add to G 7. {q} 1, 5 add to G 8. {p} 1, 6 add to G 9. {r} 3, 7 10. { } 6, 7 11. {r} 2, 8 12. { } 5, 8 Ordered Resolution Each clause is treated as a linearly ordered set. Resolution is permitted only on the first literal of each clause. Literals in the conclusion preserve parent clauses' order:“positive parent” clauses followed by “negative parent” clauses. Refutation by ordered resolution is complete for Horn clauses but incomplete in general Example of Ordered Resolution 1. {p, q} KB 2. {~p, r} KB 3. {~q, r} KB 4. {~r} KB 5. {q,r} 1, 2 6. {r} 3, 5 7. { } 4, 6 The conclusion was quickly reached! Directed Resolution Use of ordered resolution on a knowledge base of “direction” clauses— i.e., Horn clauses with any positive literal either at the beginning or the end of the clause: {~p1,~p2,….,~pn ,q} <=> (p1 p2 … pn) => q Forward and Backward Resolution Forward deduction first prove p1, p2, … ,pn then conclude q try to reach the goal starting from the rules Backward deduction to prove q, try to p1, p2, … ,pn work from the goal back to the starting rules Directed resolution can be used in forward, backward, or mixed direction. Which is best depends on the branching factor. 19 Forward deduction 1. {~m(X), p(X)} KB m(X) =>p(X) 2. {m(a)} KB m(a) 3. {~p(Z)} KB p(Z) => 4. {p(a)} 1, 2 p(a) 5. { } 3, 4 {} Backward deduction 1. {p(X),~m(X)} KB p(X) <= m(X) 2. {m(a)} KB m(a) 3. {~p(Z)} KB <= p(Z) 4. {~m(Z)} 1, 3 ~m(Z) 5. { } 2, 4 {} 20 Forward reasoning: example Original KB Derivation 1. insect(X) => animal(X) 2. mammal(X) => animal(X) 8. zebra(zeke) given 3. ant(X) => insect(X) 9. ~animal(zeke) concl. 4. bee(X) => insect(X) 10. mammal(zeke). 1,8 5. spider(X) => insect(X) 11. animal(zeke) 2,10 5. lion(X) => mammal(X) 12 {} 9,11 6. tiger(X) => mammal(X) 7. zebra(X) => mammal(X) 21 Backward reasoning: example Original KB Derivation 1. insect(X) => animal(X) 8. zebra(zeke) given 2. mammal(X) => animal(X) 9. ~animal(zeke) concl. 3. ant(X) => insect(X) 10. ~insect(zeke). 1,9 4. bee(X) => insect(X) 11. ~mammal(zeke) 2,9 5. spider(X) => insect(X) 12. ~ant(zeke) 3,10 5. lion(X) => mammal(X) 13. ~bee(zeke) 4,10 6. tiger(X) => mammal(X) 14. ~spider(zeke) 5,10 7. zebra(X) => mammal(X) 15. ~lion(zeke) 6,11 16. ~tiger(zeke) 7,11 17. ~zebra(zeke) 8,11 18. {} 22 Forward and Backward Resolution The problem of deciding whether the forward or backward direction (or some mixture) is best is NP-complete. p => s1 s1 => p p => s2 s2 => p … … p => sn sn => p ~sn ~sn ~p ~p forward: n+1 steps forward: 2 steps backward: 2 steps backward: n+1 steps 23 Rule-based systems A variety of theorem provers and rule-based systems have been programmed. Most restrict the type of rules and clauses that can be input to the system. Most are refutation-based. Most provide some control over search strategy to be used: backward, forward, cut entire branches of the search tree. 24 ? 25