DOC PREVIEW
Berkeley COMPSCI 70 - Lecture 3

This preview shows page 1-2 out of 7 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 70 Discrete Mathematics for CSFall 2003 Wagner Lecture 3This 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 inductionAxiom 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 theway up to n always implies the truth of P(n + 1), then we immediately obtain the truth of P all the way upto 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 2, we see thatStrong 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 hypothesisP(0) ∧ P(1) ∧ . . . ∧ P(n), which is much stronger.Consider the following example, which is one half of the Fundamental Theorem of Arithmetic. (The otherhalf 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 isnot 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 writtenas 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, Fall 2003, Lecture 3 11. 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(2n) or P(7n), but P(n+ 1) is unconnectedto P(n).2With a strong induction, we can make the connection between P(n+1) and earlier facts in the sequence thatare 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 asa 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 suchthat 2 ≤ a, b < n + 1 and n + 1= a · b. By the inductive hypothesis, both a and b can bewritten as a product of primes. Hence n+ 1 can be written as a product of primes.2Consider 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. Inparticular, 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, sowe 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 canbe 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¢ and5¢ stamps simply by adding one more 3¢ stamp.CS 70, Fall 2003, Lecture 3 22Notice that, as with the tiling problem, the inductive proof leads directly to a simple recursive algorithm forselecting a combination of stamps.Notice also that a strong induction proof may require several “special case” proofs to establish a solidfoundation for the sequence of inductive steps. It is easy to overlook one or more of these.Simple induction and strong inductionWe 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 simpleinduction axiom; if so, then the theorems that can be proved using strong induction are a strict superset ofthe 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 therestriction to the natural numbers as implicit here):Simple: P(0) ∧ [∀n P(n) =⇒ P(n+ 1)] =⇒ ∀n P(n)Strong: P(0) ∧ [∀n P(0) ∧ . . . ∧ P(n) =⇒ P(n+ 1)] =⇒ ∀n P(n)We can reduce this to the following basic form (with the obvious definitions for propositions A, B, B0, andC):Simple: A∧ B =⇒ CStrong: A∧ B0=⇒ CNow if P(n) =⇒ P(n+ 1), then P(0) ∧ . . . ∧ P(n) =⇒ P(n+ 1). Hence, B =⇒ B0(i.e., b is stronger thanB0). Hence, if A∧ B0suffice to prove C, then surely the stronger fact A∧ B also suffices to prove C. (This iseasily 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 itdoes! We can see


View Full Document

Berkeley COMPSCI 70 - Lecture 3

Documents in this Course
Notes 1

Notes 1

12 pages

Note 2

Note 2

6 pages

Notes

Notes

6 pages

Notes

Notes

7 pages

Note 10

Note 10

8 pages

n20

n20

10 pages

n19

n19

10 pages

n18

n18

10 pages

n17

n17

6 pages

n16

n16

9 pages

n15

n15

10 pages

n14

n14

9 pages

n13

n13

6 pages

n12

n12

7 pages

n11

n11

6 pages

n10

n10

8 pages

n9

n9

5 pages

n8

n8

7 pages

n7

n7

8 pages

n6

n6

5 pages

n5

n5

8 pages

n4

n4

7 pages

n3

n3

10 pages

n2

n2

7 pages

n1

n1

5 pages

Load more
Download Lecture 3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?