CSCE 420 - Homework #3 due: Thurs, Mar 21, 2013 1. You are the proprietor of Sammy’s Sport Shop. You have just received a shipment of three boxes filled with tennis balls. One box contains only yellow tennis balls, one box contains only white tennis balls, and one contains both yellow and white tennis balls. You would like to stock the tennis balls in appropriate places on your shelves. Unfortunately, the boxes have been labeled incorrectly; the manufacturer tells you that you have exactly one box of each, but that each box is definitely labeled wrong. Given the initial (incorrect) labeling of the boxes above, and the three observations, use Propositional Logic to derive the correct labeling of the middle box. a) Write down a knowledge base (set of propositional rules/sentences) that describes all the background knowledge and constraints about this problem. Do it in a general and complete way (such as what observing a white ball drawn from box 2 implies, that at most one box can contain yellow balls, etc.). Do not include derived knowledge that depends on the particular labeling of this instance shown above. Think of this knowledge base as a 'basis set' that could be used make inferences from any way the boxes could be labeled. Use propositional symbols in the following form: O1Y means a yellow ball was drawn (observed) from box 1, L1W means box 1 was initially labeled white, and C1B means box 1 actually contains both types of tennis balls. Finally, add the facts describing this particular situation to the knowledge base: {O1Y, O2W, O3Y, L1W, L2Y, L3B} // what observations imply O1YC1YC1B (c), O1WC1WC1B O2YC2YC2B, O2WC2WC2B (d) O3YC3YC3B, O3WC3WC3B (f) // labels are wrong L1YC1Y, L1WC1W, L1BC1B L2YC2Y, L2WC2W, L2BC2B L3YC3Y, L3WC3W, L3BC3B (a) // there is at least 1 box of each color C1YC1WC1B, C2YC2WC2B, C3YC3WC3B // no 2 boxes have the same contents C1YC2YC3Y, C1WC2WC3W, C1BC2BC3B (e) C2YC1YC3Y, C2WC1WC3W, C2BC1BC3B C3YC2YC1Y (b), C3WC2WC1W, C3BC2BC1B b) Use Natural Deduction to prove that box 2 contains white tennis balls (i.e. generate the sentence C2W using rules of inference). proof of KB |= C2W by natural deduction: 1. from O3Y and (f) derive C3YvC3B by MP 2. from L3B and rule (a) above derive ~C3B by MP 3. from 1 and 3 derive C3Y by reso. 4. from 3 and (b) derive ~C1Y~C2Y by MP 5. from O1Y and (c) derive C1Y v C1B by MP 6. from 4 derive ~C1Y by AndElim 7. from 5 and 6 derive C1B by resol. 8. from O2W and (d) derive C2W v C2B by MP 9. from 7 and (e) derive ~C2B ~C3B 10. from 9 derive ~C2B 11. from 8 and 10 derive C2W by reso. c) Show that box 2 must contain white balls via a Resolution Refutation proof (requires converting the sentences to CNF). // just the sentences I need... O3WC3WC3B (f) => 0. O3WC3WC3B O1YC1YC1B (c) => 1. O1YC1YC1B O2WC2WC2B (d) => 2. O2WC2WC2B L3BC3B (a) => 3. L3BC3B C1BC2BC3B (e) => 4a. C1BC2B, 4b. C1BC3B C3YC2YC1Y (b) => 5a. C3YC2Y, 5b. C3YC1Y 6. O1Y, // facts become unit clauses 7. O2W, 8. O3Y, 9. L1W, 10. L2Y, 11. L3B, 12. C2W // negation of query 13. C3YC3B [res, 8, 0] 14. C3B [res, 11, 3] 15. C3Y [res, 13, 14] 16. C1Y [res, 15, 5b] 17. C1YC1B [res, 6, 1] 18. C1B [res, 16, 17] 19. C2B [res, 18, 4a] 20. C2WC2B [res, 7, 2] 21. C2W [res, 19, 20] 22. [res, 21, 12] 2. Convert the following set of sentences to CNF and trace the DPLL algorithm on them to show it is satisfiable by finding a model. Number your clauses. Show which clauses are satisfied on each iteration. Indicate when you use the Pure Symbol or Unit Clause heuristics. Indicate which clauses is violated when backtracking occurs. ¬A¬B AB BD ¬AD ¬B¬C BC C(¬A¬B) (¬A¬B)C converted to CNF: 1. ¬A¬B 2. AB 3. BD 4. ¬AD 5. ¬B¬C 6. BC 7a. ¬C¬A 7a. ¬C¬B 8. ABC iter 1: {} D is a pure symbol, force it to be True iter 2: {D=T} nothing else is pure; can ignore clauses 3 & 4 there are no unit clauses; therefore try A=T iter 3: {D=T,A=T} 2 & 8 are satisfied; clause 1 becomes unit clause, forces B=F iter 4: {D=T, A=T, B=F} 6 becomes unit clause, forces C=T iter 5: 7a is violated, BACKTRACK go back to iter 2 (most recent choicepoint) and try A=F iter 6: {D=T, A=F} 2 becomes unit, forces B=T iter 7: {D=T, A=F, B=T} 5 becomes unit, forces C=F iter 8:{D=F, A=F, B=T, C=F}: complete truth assignment; all clauses satisfied clauses satisfied on iteration number... 2 3 4 5 6 7 D=T D=T D=T back D=T D=T A=T A=T track A=F A=F B=F B=T clause 1 2 3 4 5 6 7a 7b 8 ~A v ~B AvB ~B v D ~A v D ~B v ~C BvC ~C v ~A ~C v ~B AvBvC x x x x x x x x x x x x x x x x x x x x x x x x x x x x x 8 D=T A=F B=T C=F x x x x