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
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.
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.
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.
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)
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
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
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
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.
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.
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)
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
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
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
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
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.
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.
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
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.
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?
– 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
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