notes 3
play

Notes 3 Spring 2005 Clancy/Wagner This lecture covers further - PDF document

CS 70 Discrete Mathematics for CS Notes 3 Spring 2005 Clancy/Wagner This lecture covers further variants of induction, including strong induction and the closely related well- ordering axiom. We then apply these techniques to prove properties


  1. CS 70 Discrete Mathematics for CS Notes 3 Spring 2005 Clancy/Wagner This lecture covers further variants of induction, including strong induction and the closely related well- ordering axiom. We then apply these techniques to prove properties of simple recursive programs. Strong induction Axiom 3.1 (Strong Induction) : For any property P , if P ( 0 ) and ∀ n ∈ N ( P ( 0 ) ∧ P ( 1 ) ∧ ... ∧ P ( n ) = ⇒ P ( n + 1 )) , then ∀ n ∈ N P ( n ) . This says that if all the following sentences are true: P ( 0 ) P ( 0 ) = ⇒ P ( 1 ) P ( 0 ) ∧ P ( 1 ) = ⇒ P ( 2 ) P ( 0 ) ∧ P ( 1 ) ∧ P ( 2 ) = ⇒ P ( 3 ) P ( 0 ) ∧ P ( 1 ) ∧ P ( 2 ) ∧ P ( 3 ) = ⇒ P ( 4 ) and so on, then P ( n ) must be true for all n . Intuitively, this seems quite reasonable. If the truth of P all the way up to n always implies the truth of P ( n + 1 ) , then we immediately obtain the truth of P all the way up to n + 1, which implies the truth of P ( n + 2 ) , and so on ad infinitum . If we compare the Strong Induction axiom to the original Induction axiom from Lecture Notes 2, we see that Strong Induction appears to make it easier to prove things. With simple induction, one must prove P ( n + 1 ) given the inductive hypothesis P ( n ) ; with strong induction one gets to assume the inductive hypothesis P ( 0 ) ∧ P ( 1 ) ∧ ... ∧ P ( n ) , which is much stronger. Consider the following example, which is one half of the Fundamental Theorem of Arithmetic. (The other half says that the product is unique.) Theorem 3.1 : Any natural number n > 1 can be written as a product of primes. To prove this, of course, we need to define prime numbers: Definition 3.1 (Prime) : A natural number n > 1 is prime iff it has exactly two factors (1 and n ). 1 itself is not prime. Let’s see first what happens when we try a simple induction: Proof : (Attempt 1) The proof is by induction over the natural numbers n > 1. • Base case: prove P ( 2 ) . P ( 2 ) is the proposition that 2 can be written as a product of primes. This is true, since 2 can be written as the product of one prime, itself. (Remember that 1 is not prime!) • Inductive step: prove P ( n ) = ⇒ P ( n + 1 ) for all natural numbers n > 1. CS 70, Spring 2005, Notes 3 1

  2. 1. The inductive hypothesis states that n can be written as a product of primes. 2. To prove: n + 1 can be written as a product of primes. 3. We’re stuck: given P ( n ) , we could easily establish P ( 2 n ) or P ( 7 n ) , but P ( n + 1 ) is unconnected to P ( n ) . ✷ With a strong induction, we can make the connection between P ( n + 1 ) and earlier facts in the sequence that are relevant. For example, if n + 1 = 72, then P ( 36 ) and P ( 24 ) are useful facts. Proof : The proof is by strong induction over the natural numbers n > 1. • Base case: prove P ( 2 ) , as above. • Inductive step: prove P ( 2 ) ∧ ... ∧ P ( n ) = ⇒ P ( n + 1 ) for all natural numbers n > 1. 1. The inductive hypothesis states that, for all natural numbers m from 2 to n , m can be written as a product of primes. 2. To prove: n + 1 can be written as a product of primes. 3. Proof by cases: – n + 1 is prime: then n + 1 can be written as the product of one prime, itself. – n + 1 is not prime: then by the definition of prime numbers, there exist integers a , b such that 2 ≤ a , b < n + 1 and n + 1 = a · b . By the inductive hypothesis, both a and b can be written as a product of primes. Hence n + 1 can be written as a product of primes. ✷ Consider the following example, which is of immense interest to post offices and their customers: Theorem 3.2 : Any integer amount of postage from 8 ¢ upwards can be composed from 3 ¢ and 5 ¢ stamps. With a strong induction, we can make the connection between P ( n + 1 ) and earlier facts in the sequence. In particular, P ( n − 2 ) is relevant because n + 1 can be composed from the solution for n − 2 plus one 3¢ stamp. So the inductive step works if P ( n − 2 ) is known already. This will not be the case when n + 1 is 9 or 10, so we will need to handle these separately. Proof : The proof is by strong induction over the natural numbers n ≥ 8. • Base case: prove P ( 8 ) . P ( 8 ) is the proposition that 8¢ of postage can be composed from 3¢ and 5¢ stamps. This is true, requiring 1 of each. • Inductive step: prove P ( 8 ) ∧ ... ∧ P ( n ) = ⇒ P ( n + 1 ) for all natural numbers n ≥ 8. 1. The inductive hypothesis states that, for all natural numbers m from 8 to n , m ¢ of postage can be composed from 3¢ and 5¢ stamps. 2. To prove: ( n + 1 ) ¢ of postage can be composed from 3¢ and 5¢ stamps. 3. The cases where n + 1 is 9 or 10 must be proved separately. 9¢ can be composed from three 3¢ stamps. 10¢ can be composed from two 5¢ stamps. 4. For all natural numbers n + 1 > 10, the inductive hypothesis entails the proposition P ( n − 2 ) . If ( n − 2 ) ¢ can be composed from 3¢ and 5¢ stamps, then ( n + 1 ) ¢ can be composed from 3¢ and 5¢ stamps simply by adding one more 3¢ stamp. CS 70, Spring 2005, Notes 3 2

  3. ✷ Notice that, as with the tiling problem, the inductive proof leads directly to a simple recursive algorithm for selecting a combination of stamps. Notice also that a strong induction proof may require several “special case” proofs to establish a solid foundation for the sequence of inductive steps. It is easy to overlook one or more of these. Simple induction and strong induction We have seen that strong induction makes certain proofs easy even when simple induction appears to fail. A natural question to ask is whether the strong induction axiom is in fact logically stronger than the simple induction axiom; if so, then the theorems that can be proved using strong induction are a strict superset of the theorems that can be proved using simple induction. Let’s investigate this question. First, does the strong induction entail the simple induction axiom? Intuitively, this seems to be true. Let’s put the two axioms side by side and examine their structure (we’ll take the restriction to the natural numbers as implicit here): P ( 0 ) ∧ [ ∀ n P ( n ) = ⇒ P ( n + 1 )] = ⇒ ∀ n P ( n ) Simple: P ( 0 ) ∧ [ ∀ n P ( 0 ) ∧ ... ∧ P ( n ) = ⇒ P ( n + 1 )] = ⇒ ∀ n P ( n ) Strong: We can reduce this to the following basic form (with the obvious definitions for propositions A , B , B ′ , and C ): A ∧ B = ⇒ C Simple: A ∧ B ′ Strong: = ⇒ C ⇒ B ′ (i.e., b is stronger than Now if P ( n ) = ⇒ P ( n + 1 ) , then P ( 0 ) ∧ ... ∧ P ( n ) = ⇒ P ( n + 1 ) . Hence, B = B ′ ). Hence, if A ∧ B ′ suffice to prove C , then surely the stronger fact A ∧ B also suffices to prove C . (This is easily checked using truth tables.) Therefore, the strong induction axiom entails the simple induction axiom. Second, does the simple induction entail the strong induction axiom? One might expect not, but in fact it does! We can see this by defining, for any property P ( n ) , the proposition Q ( n ) ⇔ P ( 0 ) ∧ ... ∧ P ( n ) That is, Q ( n ) is the property “ P holds from 0 to n .” The idea is that simple induction using Q is in fact identical to strong induction using P . The simple induction axiom for Q is Q ( 0 ) ∧ [ ∀ n Q ( n ) = ⇒ Q ( n + 1 )] = ⇒ ∀ n Q ( n ) Expanding out the definition of Q , we obtain P ( 0 ) ∧ [ ∀ n ( P ( 0 ) ∧ ... ∧ P ( n )) = ⇒ ( P ( 0 ) ∧ ... ∧ P ( n ) ∧ P ( n + 1 ))] = ⇒ [ ∀ n ( P ( 0 ) ∧ ... ∧ P ( n ))] A few moments’ thought [we recommend thinking this thought yourself] reveals that this proposition is logically equivalent to the proposition P ( 0 ) ∧ [ ∀ n P ( 0 ) ∧ ... ∧ P ( n ) = ⇒ P ( n + 1 )] = ⇒ ∀ n P ( n ) CS 70, Spring 2005, Notes 3 3

Recommend


More recommend