1 Proof Strategies CS/APMA 202 Rosen section 3.1 Aaron Bloomfield.
Proof Review CS 202 Aaron Bloomfield Spring 2007.
-
Upload
shonda-dalton -
Category
Documents
-
view
217 -
download
0
description
Transcript of Proof Review CS 202 Aaron Bloomfield Spring 2007.
Proof Review
CS 202Aaron Bloomfield
Spring 2007
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
Logic proofsLogic proofs
Using Truth Tables
p q r p→r q →r (p→r)(q →r) pq (pq) →r
T T T T T T T TT T F F F F T F
T F T T T T F T
T F F F T T F T
F T T T T T F T
F T F T F T F T
F F T T T T F T
F F F T T T F T
rqprqrp )()()(
(pq) →rpq(p→r)(q →r)q →rp→rrqp
Idempotent Law
Associativity of Or
rqprqrp )()()( Definition of implication
Using Logical Equivalences
rqprqrp )()()(
rqprqp
rqprrqp
rqprqrp )()()(
rqprqrp
Re-arranging
Original statement
DeMorgan’s Law
qpqp
qpqp )(
rqrprqrp )()(
rrr
Set proofsSet proofs
Definition of difference
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)
)AB-(BBA
)A(BB
)AB(B
A)B(B
A)(B)B(B
A)(BA)(BBA
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!
A B A ∩ B B-A B-(B-A)1 1 1 0 11 0 0 0 00 1 0 1 00 0 0 0 0
Proof by showing each set is a subset of the other 1
• Assume that xB-(B-A)– By definition of difference, we know that xB and xB-A
• Consider xB-A– If xB-A, then (by definition of difference) xB and xA– Since xB-A, then only one of the inverses has to be true
(DeMorgan’s law): xB or xA• So we have that xB and (xB or xA)
– It cannot be the case where xB and xB– Thus, xB and xA– This is the definition of intersection
• Thus, if xB-(B-A) then xA∩B
Proof by showing each set is a subset of the other 2
• Assume that xA∩B– By definition of intersection, xA and xB
• Thus, we know that xB-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 xB-A– We also know that if xA∩B then xB (by definition of
intersection)– Thus, if xB and xB-A, we can restate that (using the definition
of difference) as xB-(B-A)• Thus, if xA∩B then xB-(B-A)
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
)}(|{ AxBxBxx
)( ABB )}(|{ ABxBxx
))}((|{ ABxBxx
}|{ AxBxx
)}(|{ AxBxBxx }|{ AxBxBxBxx })(|{ AxBxBxBxx
}|{ AxBxFx
BA
Rules of InferenceRules of Inference
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
q
qpp
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
p
qpq
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
qp
p
p
qp
More rules of inference• Conjunction: if p and q are
true separately, then pq is true
• Elimination: If pq 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
qp
qp
q
pqp
rp
rqqp
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 pq is true, and ¬pr is true, then qr must be true– Not in the textbook
p qp rq r
r
p c
p
rq
rpqp
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”?
pqrst
¬p q
r → p
¬r → s
s → t
t
Example of proof1. ¬p q 1st hypothesis2. ¬p Simplification using step 13. r → p 2nd hypothesis4. ¬r Modus tollens using steps 2 & 35. ¬r → s 3rd hypothesis6. s Modus ponens using steps 4 & 57. s → t 4th hypothesis8. t Modus ponens using steps 6 & 7
p
qp
q
qpp
p
qpq
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
¬tr
Example of proof1. ¬t 3rd hypothesis2. s → t 2nd hypothesis3. ¬s Modus tollens using steps 2 & 34. (¬r¬f)→(sl) 1st hypothesis5. ¬(sl)→¬(¬r¬f) Contrapositive of step 46. (¬s¬l)→(rf) DeMorgan’s law and double negation law7. ¬s¬l Addition from step 38. rf Modus ponens using steps 6 & 79. r Simplification using step 8
p
qp
q
qpp
p
qpq
qp
p
Proofs without a categoryProofs without a category
Corollary 1: algebraic proofCorollary 1: algebraic proof
Let Let nn be a non-negative integer. Then be a non-negative integer. Then
Algebraic proofAlgebraic proof
n
k
n
kn
0
2
n
k
knk
kn
0
11
nn )11(2
n
k kn
0
n
j
jjnn yxjn
yx0
)(
Corollary 1: combinatorial proofCorollary 1: combinatorial proof
Let Let nn be a non-negative integer. Then be a non-negative integer. Then
Combinatorial proofCombinatorial proof A set with A set with nn elements has 2 elements has 2nn subsets subsets
By definition of power setBy definition of power set Each subset has either 0 or 1 or 2 or … or Each subset has either 0 or 1 or 2 or … or nn elements elements
There are subsets with 0 elements, subsets with 1 There are subsets with 0 elements, subsets with 1 element, … and subsets with element, … and subsets with nn elements elements
Thus, the total number of subsets isThus, the total number of subsets is Thus,Thus,
n
k
n
kn
0
2
nn
k kn
20
0n
n
k kn
0
1n
nn
Pigeonhole PrinciplePigeonhole PrincipleConsider 5 distinct points (Consider 5 distinct points (xxii, , yyii) with integer values, where ) with integer values, where ii = 1, = 1, 2, 3, 4, 52, 3, 4, 5Show that the midpoint of at least one pair of these five points Show that the midpoint of at least one pair of these five points also has integer coordinatesalso has integer coordinates
Thus, we are looking for the midpoint of a segment from (Thus, we are looking for the midpoint of a segment from (aa,,bb) to ) to ((cc,,dd))
The midpoint is ( (The midpoint is ( (aa++cc)/2, ()/2, (bb++dd)/2 ))/2 )Note that the midpoint will be integers if Note that the midpoint will be integers if aa and and cc have the same have the same parity: are either both even or both oddparity: are either both even or both odd
Same for Same for bb and and ddThere are four parity possibilitiesThere 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 Since we have 5 points, by the pigeonhole principle, there must be two points that have the same parity possibilitybe two points that have the same parity possibility
Thus, the midpoint of those two points will have integer coordinatesThus, the midpoint of those two points will have integer coordinates
Ten proof methods in Ten proof methods in chapter 3chapter 3
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
Direct proof example
• Show that the square of an even number is an even number– Rephrased: if n is even, then n2 is even
• Assume n is even– Thus, n = 2k, for some k (definition of even
numbers)– n2 = (2k)2 = 4k2 = 2(2k2)– As n2 is 2 times an integer, n2 is thus even
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
Indirect proof example
• If n2 is an odd integer then n is an odd integer
• Prove the contrapositive: If n is an even integer, then n2 is an even integer
• Proof: n=2k for some integer k (definition of even numbers)
• n2 = (2k)2 = 4k2 = 2(2k2)• Since n2 is 2 times an integer, it is even
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
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
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
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
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
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: p1, p2 …, pn.• Consider the number q = p1p2 … pn + 1
– This number is not divisible by any of the listed primes• If we divided pi 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 p1, p2 …, pn.
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:
qppp n ...21
qpqpqpqppp nn ...... 2121
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 and b > 0
• Then |a| = -a, |b| = b, and– Case 4: a < 0 and b < 0
• Then |a| = -a, |b| = -b, and
ba
ba
ba
ba
ba
ba
ba
ba
ba
ba
ba
ba
ba
ba
ba
ba
ba
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
Proofs of equivalence example• Show that m2=n2 if and only if m=n or m=-n
– Rephrased: (m2=n2) ↔ [(m=n)(m=-n)]• Need to prove two parts:
– [(m=n)(m=-n)] → (m2=n2)• Proof by cases!• Case 1: (m=n) → (m2=n2)
– (m)2 = m2, and (n)2 = n2, so this case is proven• Case 2: (m=-n) → (m2=n2)
– (m)2 = m2, and (-n)2 = n2, so this case is proven– (m2=n2) → [(m=n)(m=-n)]
• Subtract n2 from both sides to get m2-n2=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)
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
Constructive existence proof example
• Show that a square exists that is the sum of two other squares– Proof: 32 + 42 = 52
• Show that a cube exists that is the sum of three other cubes– Proof: 33 + 43 + 53 = 63
Non-constructive existence proof example
• Prove that either 2*10500+15 or 2*10500+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*10500+15, 2*10500+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!
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
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!
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
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
InductionInduction
Mathematical induction example
• Inductive step: show 6
)1)1(2)(1)1)((1(1
1
2
kkkik
i
6)32)(2)(1()1(
1
22
kkkikk
i
6139261392 2323 kkkkkk
)32)(2)(1()12)(1()1(6 2 kkkkkkk
6)32)(2)(1(
6)12)(1()1( 2
kkkkkkk
6)1)1(2)(1)1)((1(1
1
2
kkkik
i
6)12)(1(
1
2
kkkik
i
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
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
Chess and induction7
6
5
4
3
2
1
0
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.
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