lecture03

lecture03 - CS 70 Spring 2005 Discrete Mathematics for CS...

This preview shows pages 1–3. Sign up to view the full content.

CS 70 Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 3 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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 ) . 2 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
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/03/2011 for the course CS 70 taught by Professor Papadimitrou during the Fall '08 term at Berkeley.

Page1 / 7

lecture03 - CS 70 Spring 2005 Discrete Mathematics for CS...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online