cse 311: foundations of computing Spring 2015 Lecture 17: - - PowerPoint PPT Presentation

โ–ถ
cse 311 foundations of computing spring 2015 lecture 17
SMART_READER_LITE
LIVE PREVIEW

cse 311: foundations of computing Spring 2015 Lecture 17: - - PowerPoint PPT Presentation

cse 311: foundations of computing Spring 2015 Lecture 17: Recursively defined sets administrative Midterm review session tonight @ 6pm (EEB 105) MIDTERM FRIDAY (IN THIS ROOM, USUAL TIME) Closed book. One page (front and back) of hand-written


slide-1
SLIDE 1

cse 311: foundations of computing Spring 2015 Lecture 17: Recursively defined sets

slide-2
SLIDE 2

administrative

Midterm review session tonight @ 6pm (EEB 105) MIDTERM FRIDAY (IN THIS ROOM, USUAL TIME) Closed book. One page (front and back) of hand-written notes allowed. Exam includes induction and strong induction! Homework #5 is up now, but due on Friday, May 15th.

slide-3
SLIDE 3

review: strong induction

Follows from ordinary induction applied to ๐‘… ๐‘œ = ๐‘„ 0 ๏ƒ™ ๐‘„ 1 ๏ƒ™ ๐‘„ 2 ๏ƒ™ โ‹ฏ ๏ƒ™ ๐‘„(๐‘œ)

๐‘„ 0 โˆ€๐‘™ ๐‘„ 0 โˆง ๐‘„ 1 โˆง ๐‘„ 2 โˆง โ‹ฏ โˆง ๐‘„ ๐‘™ โ†’ ๐‘„ ๐‘™ + 1 โˆด โˆ€๐‘œ ๐‘„(๐‘œ)

slide-4
SLIDE 4

review: strong induction English proof

1. By induction we will show that ๐‘„(๐‘œ) is true for every ๐‘œ โ‰ฅ 0 2. Base Case: Prove ๐‘„(0) 3. Inductive Hypothesis: Assume that for some arbitrary integer ๐‘™ โ‰ฅ 0, ๐‘„(๐‘˜) is true for every ๐‘˜ from 0 to ๐‘™ 4. Inductive Step: Prove that ๐‘„(๐‘™ + 1) is true using the Inductive Hypothesis (that ๐‘„(๐‘˜) is true for all values ๏‚ฃ ๐‘™) 5. Conclusion: Result follows by induction

slide-5
SLIDE 5

review: every integer at least 2 is the product of primes We argue by strong induction. P(n) = โ€œn can be expressed as a product of primesโ€ for n โ‰ฅ 2. Base Case: Note that 2 is prime; so, we can express it as โ€œ2โ€ which is a product of primes. Induction Hypothesis: Suppose P(2) โˆง P(3) โˆง ใƒปใƒปใƒป โˆง P(k) is true for some k โ‰ฅ 2. Induction Step: We go by cases. Suppose k+1 is prime. Then, โ€œk+1โ€ is a product of primes. Suppose k+1 is composite. Then, k+1 = ab for some a and b such that 1 < a, b < k+1. By our IH, we know a = p1p2 โ‹ฏ pm and b = q1q2 โ‹ฏ qn. So, k+1 = ab = โ€œp1p2 โ‹ฏ pmq1q2 โ‹ฏ qnโ€, which is a product of primes. Thus, our claim is true for n โ‰ฅ 2 by strong induction.

slide-6
SLIDE 6

review: recursive definition of functions

  • ๐บ(0) = 0; ๐บ(๐‘œ + 1) = ๐บ(๐‘œ) + 1 for all ๐‘œ โ‰ฅ 0
  • ๐ป 0 = 1; ๐ป ๐‘œ + 1 = 2 ร— ๐ป(๐‘œ) for all ๐‘œ โ‰ฅ 0
  • 0! = 1;

๐‘œ + 1 ! = ๐‘œ + 1 ร— ๐‘œ! for all ๐‘œ โ‰ฅ 0

  • ๐ผ(0) = 1; ๐ผ(๐‘œ + 1) = 2๐ผ ๐‘œ for all ๐‘œ โ‰ฅ 0
slide-7
SLIDE 7

review: Fibonacci numbers

๐‘”

0 = 0

๐‘”

1 = 1

๐‘”

๐‘œ = ๐‘” ๐‘œโˆ’1 + ๐‘” ๐‘œโˆ’2 for all ๐‘œ โ‰ฅ 2

slide-8
SLIDE 8

review: bounding the Fibonacci numbers Theorem: ๐‘”

๐‘œ < 2๐‘œ for all ๐‘œ โ‰ฅ 2.

slide-9
SLIDE 9

bounding the Fibonacci numbers

Theorem: 2

๐‘œ 2โˆ’1 โ‰ค ๐‘”

๐‘œ < 2๐‘œ for all ๐‘œ โ‰ฅ 2

slide-10
SLIDE 10

running time of Euclidโ€™s algorithm

slide-11
SLIDE 11

running time of Euclidโ€™s algorithm

Theorem: Suppose that Euclidโ€™s algorithm takes ๐‘œ steps for gcd(๐‘, ๐‘) with ๐‘ > ๐‘, then ๐‘ โ‰ฅ ๐‘”

๐‘œ+1.

Proof: Set ๐‘ ๐‘œ+1 = ๐‘, ๐‘ 

๐‘œ = ๐‘ then Euclidโ€™s algorithm computes

๐‘ 

๐‘œ+1 = ๐‘Ÿ๐‘œ๐‘  ๐‘œ + ๐‘  ๐‘œโˆ’1

๐‘ 

๐‘œ

= ๐‘Ÿ๐‘œโˆ’1๐‘ 

๐‘œโˆ’1 + ๐‘  ๐‘œโˆ’2

โ‹ฎ

๐‘ 3 = ๐‘Ÿ2๐‘ 

2 + ๐‘  1

๐‘ 2 = ๐‘Ÿ1๐‘ 

1

each quotient ๐‘Ÿ๐‘— โ‰ฅ 1 ๐‘ 

1 โ‰ฅ 1