Tutorial for Week 1 material ---------------------------- 1. Consider the following claims: (A1) Programs that passed test 1 passed test 2. (A2) Programs that passed test 1 also passed test 2. (a) Should we consider A1 and A2 to have different meanings? What would be an appropriate domain/universe for A1 and A2? What are the other sets we're interested in for A1 and A2? Draw the general Venn diagram for P, T1 and T2. What would be a counterexample to (A1)? Where would the counterexample be in the diagram? (b) Suppose claim A1 is true. Put an X in the region(s) of the Venn diagram from (a) that can't contain any programs. Draw a simpler version of the diagram. Consider the following programs: p1: passed test 1 p2: passed test 2 p3: didn't pass test 1 p4: didn't pass test 2 What else can you say (if anything) about p1, p2, p3, p4? Try thinking about it in three ways: By thinking about A1. From the two Venn diagrams. 2. (a) Consider the following database of programs: Program Runtime efficiency Poly? is O(n!)? ---------------------------------- p1 Yes Yes p2 Yes No p3 No Yes p4 No No Which of the programs, if any, would be a counterexample to: (S1) The runtime efficiency is O(n!) for Poly programs. (S1') When a program's efficiency is O(n!) it's a Poly program. Write S1 in the form: If ... then ... Is there a claim of the form If ... then ... for which p2 is a counterexample? How about p1? (b) Consider the following database of programs: Program Poly? NPoly? ---------------------- p1 Yes Yes p2 Yes No p3 No Yes p4 No No Which of the programs, if any, would be a counterexample to: (S2) A program is Poly only if it's NPoly. (S2') A program is Poly if it's NPoly. Write S2 in the form: Every ... is ... Is there a claim of the form: Every ... is ... for which p1 is a counterexample?