cpsc 121 mode els of computation
play

CPSC 121: Mode els of Computation Unit 7: Proof Te Unit 7: Proof - PDF document

CPSC 121: Mode els of Computation Unit 7: Proof Te Unit 7: Proof Te chniques (part 1) chniques (part 1) Based on slides by Patrice Be Based on slides by Patrice Be lleville and Steve Wolfman lleville and Steve Wolfman Pre-Class Learning


  1. CPSC 121: Mode els of Computation Unit 7: Proof Te Unit 7: Proof Te chniques (part 1) chniques (part 1) Based on slides by Patrice Be Based on slides by Patrice Be lleville and Steve Wolfman lleville and Steve Wolfman Pre-Class Learning Pre-Class Learning Goals Goals � By the start of class, for ea � By the start of class for ea ach proof strategy below, ach proof strategy below you should be able to: � Identify the form of stateme � Identify the form of stateme nt the strategy can prove. nt the strategy can prove � Sketch the structure of a pro oof that uses the strategy. � Strategies: � Strategies: � constructive/non-constructiv ve proofs of existence � generalizing from the gener g g g ric particular p � direct proof (antecedent ass sumption) � indirect proofs by contrapos sitive and contradiction � proof by cases. Unit 7- Proof Techniques 2

  2. Quiz 7 Feedback: Quiz 7 Feedback: � In general : � In general : � Issues: � We will do more proof exam mples in class. Unit 7- Proof Techniques 3 Quiz 7 Feedback Quiz 7 Feedback � Open-ended question: whe � Open-ended question: whe en should you switch en should you switch strategies? � When you are stuck. � When you are stuck � When the proof is going aro ound in circles. � When the proof is getting to p g g oo messy. y � When it is taking too long. � Through experience (how d o you get that?) Unit 7- Proof Techniques 4

  3. In-Class Learning G In-Class Learning G oals oals � By the end of this unit you � By the end of this unit, you u should be able to: u should be able to: � Devise and attempt multiple e different, appropriate proof strategies for a given theore g g em, including , g o all those listed in the "pre e-class" learning goals o logical equivalences, o propositional rules of infe erence o rules of inference on qua antifiers � For theorems requiring only y simple insights beyond strategic choices or for which the insi ight is given/hinted, additionally prove the theorem. prove the theorem Unit 7- Proof Techniques 5 ? Where We Are in Th he BIG Questions ? Where We Are in Th he BIG Questions ? ? ? ? � How can we convince ours � How can we convince ours selves that an algorithm selves that an algorithm does what it's supposed to o do? ? ? � We need to prove its correc � We need to prove its correc ctness ctness. ? ? � How do we determine whe ether or not one algorithm is better than another one? better than another one? ? ? ? ? � Sometimes, we need a proo of to convince someone that the number of steps of our algo rithm is what we claim it is. ? ? ? ? ? ? ? ? ? 6 ? ? Unit 7- Proof Techniques

  4. Unit Outline Unit Outline � Techniques for direct pro T h i f di t oofs . f � Existential quantifiers. More general term than in Epp. g pp � Universal quantifiers. � Dealing with multiple quan tifiers. � Indirect proofs: contraposit � Indirect proofs: contraposit tive and contradiction tive and contradiction � Additional Examples Unit 7- Proof Techniques 7 Direct Proofs Direct Proofs � General strategy: � General strategy: � Start with what it is known to o hold. � Move one step at a time tow � Move one step at a time tow wards the conclusion wards the conclusion. � If the statement is an impl ication p1 … pn → c p1 ^ pn → c � Assume the premises p1, … …, pn hold. � Move one step at a time tow p wards c. � There are two general form ms of statements: o Those that start with an existential quantifier. q o Those that start with a u niversal quantifier. � We use different techniques s for them. Unit 7- Proof Techniques 8

  5. Direct Proofs :Existe Direct Proofs :Existe ential Statements ential Statements Suppose the statement has t Suppose the statement has t the form : the form : x x D, P(x) D P(x) � To prove this statement is true, we must � Find a value of x (a “witness � Find a value of x (a witness s”) for which P(x) holds s ) for which P(x) holds. � So the proof will look like th his: � Let x = <some value in D> � Let x = <some value in D> � Verify that the x we chose s satisfies the predicate. � Example: There is a prime � Example: There is a prime number x such that 3x+2 is number x such that 3x+2 is not prime. Unit 7- Proof Techniques 9 Direct Proofs :Existe Direct Proofs :Existe ential Statements ential Statements � How do we translate There � How do we translate There e is a prime number x such e is a prime number x such predicate logic ? that 3x+2 is not prime into � x � Z+, Prime(x) � ~Prim � x � Z+ Prime(x) � A. A Prim me(3x+2) me(3x+2) � x � Z+, Prime(x) � ~Prim B. me(3x+2) C. � x � Z+, Prime(x) → ~Prim me(3x+2) D. � x � Z+, Prime(x) → ~Prim � x � Z+ Prime(x) → ~Prim D me(3x+2) me(3x+2) E. None of the above. Unit 7- Proof Techniques 10

  6. Direct Proofs :Existe Direct Proofs :Existe ential Statements ential Statements � So the proof goes as follow � So the proof goes as follow ws: ws: � Proof: o Let x = o Let x o It is prime because its on nly factors are 1 and o Now 3x+2 = and o Hence 3x+2 is not prime e. o QED. Unit 7- Proof Techniques 11 Unit Outline Unit Outline � Techniques for direct proo T h i f di t f fs. � Existential quantifiers. � Universal quantifiers. � Dealing with multiple quan tifiers. � Indirect proofs: contraposit � Indirect proofs: contraposit tive and contradiction tive and contradiction � Additional Examples Unit 7- Proof Techniques 12

  7. Direct Proofs: Unive Direct Proofs: Unive ersal Statements ersal Statements Suppose our statement has t Suppose our statement has t the form : the form : x x D P(x) D, P(x) � To prove this statement is true, we must � Show that P(x) holds no ma � Show that P(x) holds no ma atter how we choose x. atter how we choose x � So the proof will look like th his: � Let x be an nonspecific (arb � Let x be an nonspecific (arb bitrary) element of D bitrary) element of D � Verify that the predicate P h holds for this x. o Note: the only assumptio o Note: the only assumptio on we can make about x is the on we can make about x is the fact that it belongs to D. So we can only use properties common to all elements of D. Unit 7- Proof Techniques 13 Direct Proofs: Unive Direct Proofs: Unive ersal Statements ersal Statements � Example: Every Racket fun � Example: Every Racket fun nction is at least 12 nction is at least 12 characters long. � The proof goes as follows: � The proof goes as follows: � Proof: o Consider an unspecified o Consider an unspecified Racket function f Racket function f o This function o Therefore f is at least 12 2 characters long. Unit 7- Proof Techniques 14

  8. Direct Proofs: Unive Direct Proofs: Unive ersal Statements ersal Statements � Terminology: the following � Terminology: the following statements all mean the statements all mean the same thing: � Consider an unspecified ele � Consider an unspecified ele ement x of D ement x of D � Without loss of generality co onsider a valid element x of D. � Suppose x is a particular bu pp p ut arbitrarily chosen element of D. y Unit 7- Proof Techniques 15 Direct Proofs: Unive Direct Proofs: Unive ersal Statements ersal Statements � Another example: � Another example: The sum of two odd numbe ers is even. Proof: Proof: Unit 7- Proof Techniques 16

  9. Direct Proofs: Speci Direct Proofs: Speci al Case al Case Suppose the statement has t Suppose the statement has t the form: the form: x D, P(x) → Q(x) � This is a special case of th � This is a special case of th he previous formula he previous formula � The textbook calls this (an d only this) a direct proof. � The proof looks like this: � Proof: o Consider an unspecified C id ifi d element x of D. l t f D o Assume that P(x) is true . o Use this and properties o o Use this and properties o of the element of D to verify that of the element of D to verify that the predicate Q holds for r this x. Unit 7- Proof Techniques 17 Direct Proofs: Speci Direct Proofs: Speci al Case al Case � Why is the line Assume tha � Why is the line Assume tha at P(x) is true valid? at P(x) is true valid? A. Because these are the only y cases where Q(x) matters. B. Because P(x) is preceded ( ) p by a universal quantifier. y q C. Because we know that P(x x) is true. D. Both (a) and (c) E. Both (b) and (c) Unit 7- Proof Techniques 18

  10. Direct Proofs: Speci Direct Proofs: Speci al Case al Case � Example: prove that � Example: prove that � � n � N, n ≥ 1024 → 10n ≤ nlog2 n � Proof: � Proof: � Consider an unspecified na tural number n. � Assume that n ≥ 1024. � Assume that n ≥ 1024 � Then ... Unit 7- Proof Techniques 19 … and for fun … and for fun � Other interesting technique � Other interesting technique es for direct proofs ☺ es for direct proofs ☺ � Proof by intimidation � Proof by lack of space (Ferm � Proof by lack of space (Ferm mat's favorite!) mat s favorite!) � Proof by authority � Proof by never-ending revis y g sion � For the full list, see: , � http://school.maths.uwa.edu u.au/~berwin/humour/invalid.proo fs.html Unit 7- Proof Techniques 20

Recommend


More recommend