Slide 1

Slide 1 text

cs2102: Discrete Mathematics Class 2: Proof Methods David Evans University of Virginia If you have any questions about syllabus, course organization, etc. ask them in #inclass now

Slide 2

Slide 2 text

Plan Review proof from end of last class How rigorous should proofs be? Aside: “Electronic Signatures” Proof Methods: – “If and only if” What makes a “good” proof?

Slide 3

Slide 3 text

If the product of x and y is even, at least one of x or y must be even.

Slide 4

Slide 4 text

If the product of x and y is even, at least one of x or y must be even.

Slide 5

Slide 5 text

If the product of x and y is even, at least one of x or y must be even. P = “the product of x and y is even” Q = “at least one of x or y must be even” What definitions do we need? Goal: prove P implies Q

Slide 6

Slide 6 text

If the product of x and y is even, at least one of x or y must be even. P = “the product of x and y is even” Q = “at least one of x or y must be even” Goal: prove P implies Q

Slide 7

Slide 7 text

If the product of x and y is even, at least one of x or y must be even. P = “the product of x and y is even” Q = “at least one of x or y must be even” Goal: prove P implies Q Definition: even. An integer, z, is even if there exists an integer k such that z = 2k.

Slide 8

Slide 8 text

If the product of x and y is even, at least one of x or y must be even. P = “the product of x and y is even” Q = “at least one of x or y must be even” Goal: prove P implies Q Definition: even. An integer, z, is even if there exists an integer k such that z = 2k. Definition: odd. An integer, z, is odd if there exists an integer k such that z = 2k + 1.

Slide 9

Slide 9 text

Definition: even. An integer, z, is even if and only if there exists an integer k such that z = 2k. Definition: odd. An integer, z, is odd if and only if there exists an integer k such that z = 2k + 1. Odd-Even Lemma: If an integer is not even, it is odd.

Slide 10

Slide 10 text

Definition: even. An integer, z, is even if and only if there exists an integer k such that z = 2k. Definition: odd. An integer, z, is odd if and only if there exists an integer k such that z = 2k + 1. Odd-Even Lemma: If an integer is not even, it is odd. Prove an implication: assume P, show chain that leads to Q. Assume z is an integer that is not even. Substitute definition: NOT(exists integer k such that z = 2k)

Slide 11

Slide 11 text

Lemma: If an integer is not even, it is odd. Prove an implication: assume P, show chain that leads to Q. Assume z is an integer that is not even. Substitute definition: NOT(exists integer k such that z = 2k) Meaning of NOT: no integer k exists such that z = 2k

Slide 12

Slide 12 text

Lemma: If an integer is not even, it is odd. Prove an implication: assume P, show chain that leads to Q. Assume z is an integer that is not even. Substitute definition: NOT(exists integer k such that z = 2k) Meaning of NOT: no integer k exists such that z = 2k

Slide 13

Slide 13 text

“Electronic Signatures” Digression

Slide 14

Slide 14 text

Ritualistic Signatures • Intended to make signer think seriously and impact signer’s behavior • Varying impact (?): – Quill on parchment – Pen on paper – Scribbling on tablet – Typing

Slide 15

Slide 15 text

Ritualistic Signatures • Intended to make signer think seriously and impact signer’s behavior • Varying impact (?): – Quill on parchment – Pen on paper – Scribbling on tablet – Typing Purposeful Signatures • Verifiable • Non-repudiable • Bound to content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Purposeful Signatures Verifiable Non-repudiable Bound to content Real electronic signatures: One-way hard problem Easy to raise to powers, hard to find discrete logs Signature combines message and private key Can be verified by obtaining public key from trusted source and checking signature is valid

Slide 20

Slide 20 text

Signing Pledges

Slide 21

Slide 21 text

If the product of x and y is even, at least one of x or y must be even. P = “the product of x and y is even” Q = “at least one of x or y must be even” Goal: prove P implies Q Definition: even. An integer, z, is even if there exists an integer k such that z = 2k. Lemma: If an integer is not even, it is odd.

Slide 22

Slide 22 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” To prove, P implies Q, we use contrapositive inference rule: NOT(Q) implies NOT(P) P implies Q Observe: this is starting backwards! We are starting the proof from the conclusion we want.

Slide 23

Slide 23 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” To prove, P implies Q, we prove the contrapositive: NOT(Q) implies NOT(P) To prove an implication, assume left side, show right: Assume NOT(at least one of x and y must be even)

Slide 24

Slide 24 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” To prove, P implies Q, we prove the contrapositive: NOT(Q) implies NOT(P) To prove an implication, assume left side, show right: Assume NOT(at least one of x and y must be even) By the meaning of NOT: both x and y are not even

Slide 25

Slide 25 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” To prove, P implies Q, we prove the contrapositive: NOT(Q) implies NOT(P) To prove an implication, assume left side, show right: Assume NOT(at least one of x and y must be even) By the meaning of NOT: both x and y are not even By the Odd-Even Lemma: both x and y are odd

Slide 26

Slide 26 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” To prove, P implies Q, we prove the contrapositive: NOT(Q) implies NOT(P) To prove an implication, assume left side, show right: Assume NOT(at least one of x and y must be even) By the meaning of NOT: both x and y are not even By the Odd-Even Lemma: both x and y are odd By the definition of odd: there exists integers k, m, such that x = 2k + 1 and y = 2m + 1

Slide 27

Slide 27 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” We prove the contrapositive: Assume NOT(at least one of x and y must be even) By the meaning of NOT: both x and y are not even. By the Odd-Even Lemma: both x and y are odd. By the definition of odd: there exists integers k, m, such that x = 2k + 1 and y = 2m + 1 By algebra: xy = (2k + 1)(2m + 1) = 4mk + 2m + 2k + 1 = 2(2mk + m + k) + 1

Slide 28

Slide 28 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” We prove the contrapositive: Assume NOT(at least one of x and y must be even) … By integers closed under multiplication and addition: there exists some integer r where r = 2mk + m + k By definition of odd: So xy = 2r + 1 which means the product of x and y is odd. By the Odd-Even Lemma: the product of x and y is not even.

Slide 29

Slide 29 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” We prove the contrapositive: Assume NOT(at least one of x and y must be even) … By integers closed under multiplication and addition: there exists some integer r where r = 2mk + m + k By definition of odd: So xy = 2r + 1 which means the product of x and y is odd. By the Odd-Even Lemma: the product of x and y is not even. Lemma: If an integer is not even, it is odd.

Slide 30

Slide 30 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” We prove the contrapositive: Assume NOT(at least one of x and y must be even) … By the Even-Odd* Lemma: the product of x and y is not even. So, NOT(product of x and y is even) Thus, we have proven the implication: NOT(at least one of x and y must be even) implies NOT(product of x and y is even) As shown in class, this slide had bugs in it - the version here is fixed

Slide 31

Slide 31 text

P = “the product of x and y is even” Q = “at least one of x or y must be even” We prove the contrapositive: Assume NOT(at least one of x and y must be even) … So, NOT(product of x and y is even) Thus, we have proven the implication: NOT(at least one of x and y must be even) implies NOT(product of x and y is even) By the contrapositive inference rule, this proves: at least one of x and y must be even implies product of x and y is even.

Slide 32

Slide 32 text

Ay, Harambe!

Slide 33

Slide 33 text

Purpose of a Proof Seeking Truth Deepening Understanding

Slide 34

Slide 34 text

In physics, your solution should convince a reasonable person. In math, you have to convince a person who's trying to make trouble. Frank Wilczek (2004 Nobel Prize Physics)

Slide 35

Slide 35 text

“Correct ” Rigorous Proof of P Axioms used are clear and accepted Each step uses a sound inference rule correctly: – Shows antecedents are satisfied – Concludes the conclusion Results in concluding goal proposition: P Do the proofs we do in cs2102 actually do this?

Slide 36

Slide 36 text

“Good” Proofs in cs2102 • Well written and clearly organized: – Should be obvious what you are proving and how • Convincing to a skeptical reader • State assumptions clearly: careful about not assuming non-obvious things • Focus on important steps, not gory details

Slide 37

Slide 37 text

Whitehead and Russell, Principia Mathematica

Slide 38

Slide 38 text

Automated Theorem Proving Coq PVS

Slide 39

Slide 39 text

Example Automated Proofs (thm (implies (and (evenp x) (evenp y)) (evenp (+ x y)))) From https://rosettacode.org/wiki/Proof ACL2

Slide 40

Slide 40 text

Inductive nat : Set := | O : nat | S : nat -> nat. Inductive even : nat -> Set := | even_O : even O | even_SSn : forall n:nat, even n -> even (S (S n)). Theorem even_plus_even : forall n m:nat, even n -> even m -> even (n + m). Proof. … (about 10 lines) Qed. From https://rosettacode.org/wiki/Proof Coq Human-assisted, automatically verified

Slide 41

Slide 41 text

Automatic Theorem Provers in Common Practice?

Slide 42

Slide 42 text

Proposition: input program does not have certain types of errors.

Slide 43

Slide 43 text

Processor Verification FDIV 0x4005FB / 0x2FFFFF

Slide 44

Slide 44 text

“Miracle on the Hudson” ?

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Charge • Next week: we’ll start proving non-obvious things! • Before Friday (6:29pm): course pledge, registration survey (read “Habits of Highly Mathematical People”) • Read MCS Ch 2, 3; PS1 is due next Friday • TA’s office hours will start Monday