辅导案例-CSCI 170
Proofs CSCI 170 Fall 2019 Lecture 8Sandra Batista1.1–1.2Proofs• Constructive Proof• Non-constructive Proof• Proof by Cases• Direct Proof of Implication• Proof by Contraposition• Proof by Contradiction• Disprove a statement1.1–1.23Proof Method: Constructive ProofA constructive proof is one that proves that a solution or property exists by giving the solution or instance of the property directly.Claim: Every 8x8 checkerboard can be tiled by dominos, 2x1 rectangular tiles with a 1 dot in the first square and 2 dots in the second. The tiles of the domino are the same size as each square of the checkerboard.4Constructive Proof Example 1Claim: Every 8x8 checkerboard can be tiled by dominos, 2x1 rectangular tiles with a 1 dot in the first square and 2 dots in the second. The tiles of the domino are the same size as each square of the checkerboard.Proof: Give an algorithm to tile the checkerboard.Chi 4,21 KY 7,81 8,8for Iai x sixttTEefor ly liyc.si HAEIfl y 2 1Eplaceldominosoplace in Xilzyatthidin yz 8,1 8181Proofs• Constructive Proof• Non-constructive Proof• Proof by Cases• Direct Proof of Implication• Proof by Contraposition• Proof by Contradiction• Disprove a statement1.1–1.26Proof Method: Non-constructive ProofA non-constructive proof is when a proof shows that a solution exists without giving the solution directly.Claim: At a dinner with 9 guests at least 2 must have been born on the same day of the week.Proof: PHPlet A be guests 13 be daysofweekf A 7 B f person day of foreenkSince IAI 9 7 1131 7 by PHPat least 2 guest born on someweekdayProofs• Constructive Proof• Non-constructive Proof• Proof by Cases• Direct Proof of Implication• Proof by Contraposition• Proof by Contradiction• Disprove a statement1.1–1.28Useful Refresher1. If an integer n is odd, then there exists an integer k such that n = 2k +1. If an integer n is even, then there exists an integer k such that n = 2k.2. If n is a rational, then there exists integers p and q that share no prime factors and q is non-zero such that n = p/q.3. An integer d evenly divides an integer n if it is a factor. Similarly the remainder when we divide n by d is 0. We also say that n is divisible by d.4. If n = mk + r and we divide n by m, we will be left with a remainder of r: n mod m = r5. All even numbers are 0 mod 2. All odd numbers are 1 mod 2. Whether an integer is even or odd is referred to as its parity.n dk for someKEZ9Proof Method: Proof by CasesA proof by cases is when a proof of a claim exhaustively considers all cases that are possible for the claim and shows that the claim would still hold under all such cases. Cases are often mutually exclusive.Claim: Among any three integers there are two whose sum is even.Proof: .let A be three integers 13 20,13f A B fca x mod 2Since I A1 3 IBI 2 by PHPat least 2 have same parity10Proof Method: Proof by CasesA proof by cases is when a proof of a claim exhaustively considers all cases that are possible for the claim and shows that the claim would still hold under all such cases. Cases are often mutually exclusive.Claim: Among any three integers there are two whose sum is even.Proof (continued): .It sat 3integers S F subsetAES IA1 2case I Both even x214 y 2kg K kzEZXty 2 kit 2K z 21 kit ka mod 20evencase 2both odd X 2 Kitt Y 3Kat k lqE2Xt y 2k t l t 2Kat1 2114tkzHmod 2 0also evenProofs• Constructive Proof• Non-constructive Proof• Proof by Cases• Direct Proof of Implication• Proof by Contraposition• Proof by Contradiction• Disprove a statement1.1–1.212Proof Method: Direct Proof of an ImplicationIn a direct proof of implication we assume the premise P and use logic and rules of inference to show that the conclusion Q follows.Exercise: Let n be an integer. If n is odd, then n2 is odd. Proof: Assume his odd f KEZ h 2kt IConsider n2 12kt2 4k't 4kt I212k't2141 1Since 2k't 2K C Z so NZ is oddProofs• Constructive Proof• Non-constructive Proof• Proof by Cases• Direct Proof of Implication• Proof by Contraposition• Proof by Contradiction• Disprove a statement1.1–1.214Proof Method: Proof by ContrapositionThe contrapositive of P implies Q is not Q implies not P.In a proof by contraposition of an implication P implies Q, we assume the negation of the conclusion, i.e. not Q, and use logic and rules of inference to show that the negation of the premise, i.e. not P, follows.State the contrapositive and prove it directly.Exercise: Let n be an integer. If n2 is odd, then n is odd.Proof by Contraposition:State the contrapositive and prove it directly.p q 7 of 77 pp 8If n is even then h2 is even15Proof by Contraposition ExampleExercise: Let n be an integer. If n2 is odd, then n is odd.Proof by Contraposition:78Assume his even F KE Zn 2KConsider n2 12142 442 21219single'EL h2 is evenp16Proof Method: Proof by ContrapositionThe contrapositive of P implies Q is not Q implies not P.In a proof by contraposition of an implication P implies Q, we assume the negation of the conclusion, i.e. not Q, and use logic and rules of inference to show that the negation of the premise, i.e. not P, follows.State the contrapositive and prove it directly.Exercise: Let y not equal 0. If x/y is irrational, then either x is irrational or y is irrational. Proof by contraposition:State the contrapositive and proof it directly.let x YER p OfH x is rational and y is rationalis rational17Proof by Contraposition ExampleExercise: Let y not equal 0. If x/y is irrational, then either x is irrational or y is irrational. Proof by contraposition:Assume 7g Assume is rational andy is rational F p g e 2 g to x Pig andF P2,952 pit 0 go o y IfConsider Pgtp2 pga pegEZ 139 OE is rational TpProofs• Constructive Proof• Non-constructive Proof• Proof by Cases• Direct Proof of Implication• Proof by Contraposition• Proof by Contradiction• Disprove a statement1.1–1.219Proof Method: Proof by ContradictionTo prove a statement by contradiction: Negate the statement and show any contradiction.Template for an implication: P implies Q1)This implication is logically equivalent to not P or Q2)Assume the negation:3)Show any contradiction. When we show a contradiction occurs, we show that the negation is false, so the original statement is true.p q p q→ ≡¬ ∨( )p q p q¬ ¬ ∨ ≡ ∧¬20Proof by Contradiction Example Exercise: Prove the following by contradiction: n3 is not O(n2 )Proof by contradiction:Assumen340 nnegation Assume h3E 01h2 F no e 0for all n Ino OE n'sE Cnfor all n Zuo OE n E elet n MaxEnotictis n't SCa contradiction so n 406421Proof by Contradiction Example Exercise: If 15x + 111y = 55057 for real numbers x and y, then either x is not an integer or y is not an integer.Proof by contradiction:Assumep ap n of Assume 15kt My 55057 x yEIRand X is integer and y is integerConsider 154 t My 3 5 1 37 y 550575 37 y55035751 37 y Eh but 5 0357 Zcontradiction22Proof by Contradiction Example 2Exercise: Show square root of 5 is irrational.Proof by contradiction:Assume negation Ms is rationalNB Pq for some PiofE Z f FO PigShaneno common factorsAs Pq 5 Pff5of p25 divides P25 divides pp 5C CEL23Proof by Contradiction Example 2Exercise: Show square root of 5 is irrational.Proof by contradiction (continued):5g p2Gq 2 642of2 5 a5 divides q2 5dividesofHowever5 divides both p and gThis isa contradiction because pana ofshare no primefactors24Proof by Contradiction Example 2Exercise: Show square root of 12 is irrational.Proof by contradiction:Assume negation Assume NE isrationalV12 Pq pigC Z f to p g share no12 Pq 12q2 pzPrime factors2 3q2 p2 forsoft2the Carynfee2 divides p p 2C3 divides p p 3 c25Proof by Contradiction Example 2Exercise: Show square root of 12 is irrational.Proof by contradiction (continued): i p 2C3gs ginsine223 q2 1242 o is divisiblecal by3Ii let p 3C for some CEZ223 q2 134222q2 38Since 3 doesnot divide 2 then3 divides ofp of share no primefactorsProofs• Constructive Proof• Non-constructive Proof• Proof by Cases• Direct Proof of Implication• Proof by Contraposition• Proof by Contradiction• Disprove a statement1.1–1.227Proof Method: Disprove a statementA statement is true or its negation is true.To disprove a statement, prove that its negation is true.Disprove the statement: All primes are odd.Write the statement in predicate logic and its negation. Let the predicate P(x) be “x is prime”. Why would a counterexample suffice?tf x c Z Pay Of01 1 x is primenesaytimj.az Pan m Oki atcounterexample X 228Disprove a Statement Example Disprove: Let x, y, and z be integers. There exists x and y such that for any z, x+y = z.Write the statement in predicate logic and its negation. Why isn’t a single counterexample enough?Fx Fy Hz Xty 2negationFx Hy F z XtytzKitty let z XtyH29Disprove a Statement Example Disprove: Let x, y, and z be integers. There exists a z for any x and y such that x+y = z.Write the statement in predicate logic and its negation. Then prove that the negation is true.Proofs• Constructive Proof• Non-constructive Proof• Proof by Cases• Direct Proof of Implication• Proof by Contraposition• Proof by Contradiction• Disprove a statement1.1–1.2