Download presentation
Presentation is loading. Please wait.
Published byShonda Dalton Modified over 8 years ago
1
Proof Review CS 202 Aaron Bloomfield Spring 2007
2
Proof methods in this course Logical equivalences –via truth tables –via logical equivalences Set equivalences –via set identities –via membership tables –via mutual subset proof –via set builder notation and logical equivalences Rules of inference –for propositions –for quantified statements Proofs without a category –Pigeonhole principle –Combinatorial proofs Ten proof methods in chapter 3: –Direct proofs –Indirect proofs –Vacuous proofs –Trivial proofs –Proof by contradiction –Proof by cases –Proofs of equivalence –Existence proofs Constructive Non-constructive –Uniqueness proofs –Counterexamples Induction –Weak mathematical induction –Strong mathematical induction –Structural induction
3
Logic proofs
4
Using Truth Tables pqrp→rq →r (p→r) (q →r)pqpq(p q) →r TTTTTTTT TTFFFFTF TFTTTTFT TFFFTTFT FTTTTTFT FTFTFTFT FFTTTTFT FFFTTTFT pqpq(p→r) (q →r) q →rp→rrqp
5
Idempotent Law Associativity of Or Definition of implication Using Logical Equivalences Re-arranging Original statement DeMorgan’s Law
6
Set proofs
7
Definition of difference DeMorgan’s law Complementation law Distributive law Complement law Identity law Commutative law Proof by using basic set identities Prove that A∩B=B-(B-A)
8
Proof by membership tables The following membership table shows that A∩B=B-(B-A) Because the two indicated columns have the same values, the two expressions are identical This is similar to Boolean logic!
9
Proof by showing each set is a subset of the other 1 Assume that x B-(B-A) –By definition of difference, we know that x B and x B-A Consider x B-A –If x B-A, then (by definition of difference) x B and x A –Since x B-A, then only one of the inverses has to be true (DeMorgan’s law): x B or x A So we have that x B and (x B or x A) –It cannot be the case where x B and x B –Thus, x B and x A –This is the definition of intersection Thus, if x B-(B-A) then x A∩B
10
Proof by showing each set is a subset of the other 2 Assume that x A∩B –By definition of intersection, x A and x B Thus, we know that x B-A –B-A includes all the elements in B that are also not in A not include any of the elements of A (by definition of difference) Consider B-(B-A) –We know that x B-A –We also know that if x A∩B then x B (by definition of intersection) –Thus, if x B and x B-A, we can restate that (using the definition of difference) as x B-(B-A) Thus, if x A∩B then x B-(B-A)
11
Proof by set builder notation and logical equivalences 2 Original statement Definition of difference Negating “element of” Definition of difference DeMorgan’s Law Distributive Law Negating “element of” Negation Law Identity Law Definition of intersection
12
Rules of Inference
13
Modus Ponens example Assume you are given the following two statements: –“you are in this class” –“if you are in this class, you will get a grade” Let p = “you are in this class” Let q = “you will get a grade” By Modus Ponens, you can conclude that you will get a grade
14
Modus Tollens Assume that we know: ¬q and p → q –Recall that p → q = ¬q → ¬p Thus, we know ¬q and ¬q → ¬p We can conclude ¬p
15
Generalization & Specialization Generalization: If you know that p is true, then p q will ALWAYS be true Specialization: If p q is true, then p will ALWAYS be true
16
More rules of inference Conjunction: if p and q are true separately, then p q is true Elimination: If p q is true, and p is false, then q must be true Transitivity: If p→q is true, and q→r is true, then p→r must be true
17
Even more rules of inference Proof by division into cases: if at least one of p or q is true, then r must be true Contradiction rule: If ¬p→c is true, we can conclude p (via the contra-positive) Resolution: If p q is true, and ¬p r is true, then q r must be true –Not in the textbook
18
Example of proof We have the hypotheses: –“It is not sunny this afternoon and it is colder than yesterday” –“We will go swimming only if it is sunny” –“If we do not go swimming, then we will take a canoe trip” –“If we take a canoe trip, then we will be home by sunset” Does this imply that “we will be home by sunset”? –“It is not sunny this afternoon and it is colder than yesterday” –“We will go swimming only if it is sunny” –“If we do not go swimming, then we will take a canoe trip” –“If we take a canoe trip, then we will be home by sunset” Does this imply that “we will be home by sunset”? –“It is not sunny this afternoon and it is colder than yesterday” –“We will go swimming only if it is sunny” –“If we do not go swimming, then we will take a canoe trip” –“If we take a canoe trip, then we will be home by sunset” Does this imply that “we will be home by sunset”? –“It is not sunny this afternoon and it is colder than yesterday” –“We will go swimming only if it is sunny” –“If we do not go swimming, then we will take a canoe trip” –“If we take a canoe trip, then we will be home by sunset” Does this imply that “we will be home by sunset”? –“It is not sunny this afternoon and it is colder than yesterday” –“We will go swimming only if it is sunny” –“If we do not go swimming, then we will take a canoe trip” –“If we take a canoe trip, then we will be home by sunset” Does this imply that “we will be home by sunset”? –“It is not sunny this afternoon and it is colder than yesterday” –“We will go swimming only if it is sunny” –“If we do not go swimming, then we will take a canoe trip” –“If we take a canoe trip, then we will be home by sunset” Does this imply that “we will be home by sunset”? p q r s t ¬p q¬p q r → p ¬r → s s → t t
19
Example of proof 1.¬p q1 st hypothesis 2.¬pSimplification using step 1 3.r → p2 nd hypothesis 4.¬rModus tollens using steps 2 & 3 5.¬r → s3 rd hypothesis 6.sModus ponens using steps 4 & 5 7.s → t 4 th hypothesis 8.tModus ponens using steps 6 & 7
20
Example of proof Given the hypotheses: –“If it does not rain or if it is not foggy, then the sailing race will be held and the lifesaving demonstration will go on” –“If the sailing race is held, then the trophy will be awarded” –“The trophy was not awarded” Can you conclude: “It rained”? (¬r ¬f) → (s l) s → t ¬t r
21
Example of proof 1.¬t3 rd hypothesis 2.s → t2 nd hypothesis 3.¬sModus tollens using steps 2 & 3 4.(¬r ¬f)→(s l)1 st hypothesis 5.¬(s l)→¬(¬r ¬f)Contrapositive of step 4 6.(¬s ¬l)→(r f)DeMorgan’s law and double negation law 7.¬s ¬lAddition from step 3 8.r fModus ponens using steps 6 & 7 9.rSimplification using step 8
22
Proofs without a category
23
Corollary 1: algebraic proof Let n be a non-negative integer. Then Algebraic proof
24
Corollary 1: combinatorial proof Let n be a non-negative integer. Then Combinatorial proof A set with n elements has 2 n subsets A set with n elements has 2 n subsets By definition of power set Each subset has either 0 or 1 or 2 or … or n elements Each subset has either 0 or 1 or 2 or … or n elements There are subsets with 0 elements, subsets with 1 element, … and subsets with n elements Thus, the total number of subsets is Thus, Thus,
25
Pigeonhole Principle Consider 5 distinct points (x i, y i ) with integer values, where i = 1, 2, 3, 4, 5 Show that the midpoint of at least one pair of these five points also has integer coordinates Thus, we are looking for the midpoint of a segment from (a,b) to (c,d) The midpoint is ( (a+c)/2, (b+d)/2 ) The midpoint is ( (a+c)/2, (b+d)/2 ) Note that the midpoint will be integers if a and c have the same parity: are either both even or both odd Same for b and d Same for b and d There are four parity possibilities (even, even), (even, odd), (odd, even), (odd, odd) (even, even), (even, odd), (odd, even), (odd, odd) Since we have 5 points, by the pigeonhole principle, there must be two points that have the same parity possibility Thus, the midpoint of those two points will have integer coordinates Thus, the midpoint of those two points will have integer coordinates
26
Ten proof methods in chapter 3
27
Direct proofs Consider an implication: p→q –If p is false, then the implication is always true –Thus, show that if p is true, then q is true To perform a direct proof, assume that p is true, and show that q must therefore be true
28
Direct proof example Show that the square of an even number is an even number –Rephrased: if n is even, then n 2 is even Assume n is even –Thus, n = 2k, for some k (definition of even numbers) –n 2 = (2k) 2 = 4k 2 = 2(2k 2 ) –As n 2 is 2 times an integer, n 2 is thus even
29
Indirect proofs Consider an implication: p→q –It’s contrapositive is ¬q→¬p Is logically equivalent to the original implication! –If the antecedent (¬q) is false, then the contrapositive is always true –Thus, show that if ¬q is true, then ¬p is true To perform an indirect proof, do a direct proof on the contrapositive
30
Indirect proof example If n 2 is an odd integer then n is an odd integer Prove the contrapositive: If n is an even integer, then n 2 is an even integer Proof: n=2k for some integer k (definition of even numbers) n 2 = (2k) 2 = 4k 2 = 2(2k 2 ) Since n 2 is 2 times an integer, it is even
31
Vacuous proofs Consider an implication: p→q If it can be shown that p is false, then the implication is always true –By definition of an implication Note that you are showing that the antecedent is false
32
Vacuous proof example Consider the statement: –All criminology majors in CS 202 are female –Rephrased: If you are a criminology major and you are in CS 202, then you are female Could also use quantifiers! Since there are no criminology majors in this class, the antecedent is false, and the implication is true
33
Trivial proofs Consider an implication: p→q If it can be shown that q is true, then the implication is always true –By definition of an implication Note that you are showing that the conclusion is true
34
Trivial proof example Consider the statement: –If you are tall and are in CS 202 then you are a student Since all people in CS 202 are students, the implication is true regardless
35
Proof by contradiction Given a statement p, assume it is false –Assume ¬p Prove that ¬p cannot occur –A contradiction exists Given a statement of the form p→q –To assume it’s false, you only have to consider the case where p is true and q is false
36
Proof by contradiction example Theorem (by Euclid): There are infinitely many prime numbers. Proof. Assume there are a finite number of primes List them as follows: p 1, p 2 …, p n. Consider the number q = p 1 p 2 … p n + 1 –This number is not divisible by any of the listed primes If we divided p i into q, there would result a remainder of 1 –We must conclude that q is a prime number, not among the primes listed above This contradicts our assumption that all primes are in the list p 1, p 2 …, p n.
37
Proof by cases Show a statement is true by showing all possible cases are true Thus, you are showing a statement of the form: is true by showing that:
38
Proof by cases example Prove that –Note that b ≠ 0 Cases: –Case 1: a ≥ 0 and b > 0 Then |a| = a, |b| = b, and –Case 2: a ≥ 0 and b < 0 Then |a| = a, |b| = -b, and –Case 3: a 0 Then |a| = -a, |b| = b, and –Case 4: a < 0 and b < 0 Then |a| = -a, |b| = -b, and
39
Proofs of equivalences This is showing the definition of a bi- conditional Given a statement of the form “p if and only if q” –Show it is true by showing (p→q) (q→p) is true
40
Proofs of equivalence example Show that m 2 =n 2 if and only if m=n or m=-n –Rephrased: (m 2 =n 2 ) ↔ [(m=n) (m=-n)] Need to prove two parts: –[(m=n) (m=-n)] → (m 2 =n 2 ) Proof by cases! Case 1: (m=n) → (m 2 =n 2 ) –(m) 2 = m 2, and (n) 2 = n 2, so this case is proven Case 2: (m=-n) → (m 2 =n 2 ) –(m) 2 = m 2, and (-n) 2 = n 2, so this case is proven –(m 2 =n 2 ) → [(m=n) (m=-n)] Subtract n 2 from both sides to get m 2 -n 2 =0 Factor to get (m+n)(m-n) = 0 Since that equals zero, one of the factors must be zero Thus, either m+n=0 (which means m=n) or m-n=0 (which means m=-n)
41
Existence proofs Given a statement: x P(x) We only have to show that a P(c) exists for some value of c Two types: –Constructive: Find a specific value of c for which P(c) exists –Nonconstructive: Show that such a c exists, but don’t actually find it Assume it does not exist, and show a contradiction
42
Constructive existence proof example Show that a square exists that is the sum of two other squares –Proof: 3 2 + 4 2 = 5 2 Show that a cube exists that is the sum of three other cubes –Proof: 3 3 + 4 3 + 5 3 = 6 3
43
Non-constructive existence proof example Prove that either 2*10 500 +15 or 2*10 500 +16 is not a perfect square –A perfect square is a square of an integer –Rephrased: Show that a non-perfect square exists in the set {2*10 500 +15, 2*10 500 +16} Proof: The only two perfect squares that differ by 1 are 0 and 1 –Thus, any other numbers that differ by 1 cannot both be perfect squares –Thus, a non-perfect square must exist in any set that contains two numbers that differ by 1 –Note that we didn’t specify which one it was!
44
Uniqueness proofs A theorem may state that only one such value exists To prove this, you need to show: –Existence: that such a value does indeed exist Either via a constructive or non-constructive existence proof –Uniqueness: that there is only one such value
45
Uniqueness proof example If the real number equation 5x+3=a has a solution then it is unique Existence –We can manipulate 5x+3=a to yield x=(a-3)/5 –Is this constructive or non-constructive? Uniqueness –If there are two such numbers, then they would fulfill the following: a = 5x+3 = 5y+3 –We can manipulate this to yield that x = y Thus, the one solution is unique!
46
Counterexamples Given a universally quantified statement, find a single example which it is not true Note that this is DISPROVING a UNIVERSAL statement by a counterexample x ¬R(x), where R(x) means “x has red hair” –Find one person (in the domain) who has red hair Every positive integer is the square of another integer –The square root of 5 is 2.236, which is not an integer
47
A note on counterexamples You can DISPROVE something by showing a single counter example –You are finding an example to show that something is not true You cannot PROVE something by example Example: prove or disprove that all numbers are even –Proof by contradiction: 1 is not even –(Invalid) proof by example: 2 is even
48
Induction
49
Mathematical induction example Inductive step: show
50
Strong induction example Show that any number > 1 can be written as the product of one or more primes Base case: P(2) –2 is the product of 2 (remember that 1 is not prime!) Inductive hypothesis: assume P(2), P(3), …, P(k) are all true Inductive step: Show that P(k+1) is true
51
Strong induction example 1 Inductive step: Show that P(k+1) is true There are two cases: –k+1 is prime It can then be written as the product of k+1 –k+1 is composite It can be written as the product of two composites, a and b, where 2 ≤ a ≤ b < k+1 By the inductive hypothesis, both P(a) and P(b) are true
52
Chess and induction 7654321076543210 0 1 2 3 4 5 6 7 Can the knight reach any square in a finite number of moves? Show that the knight can reach any square (i, j) for which i+j=k where k > 1. Base case: k = 2 Inductive hypothesis: assume the knight can reach any square (i, j) for which i+j=k where k > 1. Inductive step: show the knight can reach any square (i, j) for which i+j=k+1 where k > 1.
53
Chess and induction Inductive step: show the knight can reach any square (i, j) for which i+j=k+1 where k > 1. –Note that k+1 ≥ 3, and one of i or j is ≥ 2 –If i ≥ 2, the knight could have moved from (i-2, j+1) Since i+j = k+1, i-2 + j+1 = k, which is assumed true –If j ≥ 2, the knight could have moved from (i+1, j-2) Since i+j = k+1, i+1 + j-2 = k, which is assumed true
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.