CSE 311: Foundations of Computing Strong Induction Fall 2014 0 - - PowerPoint PPT Presentation

cse 311 foundations of computing strong induction
SMART_READER_LITE
LIVE PREVIEW

CSE 311: Foundations of Computing Strong Induction Fall 2014 0 - - PowerPoint PPT Presentation

CSE 311: Foundations of Computing Strong Induction Fall 2014 0 Lecture 16: Recursively Defined Sets 0 1 2 + 1 () 1. By induction we will show that () is


slide-1
SLIDE 1

CSE 311: Foundations of Computing

Fall 2014 Lecture 16: Recursively Defined Sets

Strong Induction

∀ 0 ∧ 1 ∧ 2 ∧ ⋯ ∧ → + 1 ∴ ∀ ()

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

Fibonacci Numbers

  • = 0
  • = 1
  • =

+ for all ≥ 2

Bounding the Fibonacci Numbers

f0 = 0; f1 = 1; fn = fn-1 + fn-2 for all ≥ 2 Theorem: 2n/2-1 ≤ fn < 2n for all ≥ 2

Proof:

  • 1. Let P(n) be “2n/2-1 ≤ fn < 2n. By (strong) induction we prove P(n) for all n ≥ 2.

2. Base Case: P(2) is true: f2=1, 22/2-1=20=1 ≤ f2, 22=4>f2 3. Ind.Hyp: Assume 2j/2-1 ≤ fj < 2j for all integers j with 2 ≤ j ≤ k for some arbitrary integer k ≥ 2. 4.

  • Ind. Step: Goal: Show 2(k+1)/2-1 ≤ fk+1 < 2k+1
slide-2
SLIDE 2

f0 = 0; f1 = 1; fn = fn-1 + fn-2 for all ≥ 2

Theorem: 2n/2-1 ≤ fn < 2n for all ≥ 2

Proof:

  • 1. Let P(n) be “2n/2-1 ≤ fn < 2n. By (strong) induction we prove P(n) for all n ≥ 2.

2. Base Case: P(2) is true: f2=1, 22/2-1=20=1 ≤ f2, 22=4>f2 3. Ind.Hyp: Assume 2j/2-1 ≤ fj < 2j for all integers j with 2 ≤ j ≤ k for for some arbitrary integer k ≥ 2. 4.

  • Ind. Step: Goal: Show 2(k+1)/2-1 ≤ fk+1 < 2k+1

Case k=2: P(3) is true: f3=f2+f1=1+1=2, 23/2-1=21/2 ≤ 2 = f3, 23=8 > f3 Case k≥3:

fk+1 = fk + fk-1 ≥ 2k/2-1 + 2(k-1)/2 – 1 by I.H. since k-1 ≥ 2 > 2(k-1)/2-1 + 2(k-1)/2 – 1 = 2·2(k-1)/2-1 = 2(k+1)/2 – 1 fk+1 = fk + fk-1 < 2k + 2(k-1) by I.H. since k-1 ≥ 2 < 2k + 2k = 2·2k = 2k+1

Running time of Euclid’s algorithm

Theorem: Suppose that Euclid’s algorithm takes steps for gcd (, ) with > , then ≥

!

Set "

! = , " = then Euclid’s algorithm computes

"

! = #" + "

  • "

= #" + "

"

% = #" + "

  • "

= #"

  • each quotient #& ≥ 1

"

≥ 1

Recursive Definition of Sets

Recursive definition – Basis step: 0 ∈ ' – Recursive step: if ( ∈ ', then ( + 2 ∈ ' – Exclusion rule: Every element in ' follows from basis steps and a finite number of recursive steps

Recursive Definitions of Sets

Basis: 6 ∈ '; 15 ∈ '; Recursive: if (, - ∈ ', then ( + - ∈ '; Basis: 1, 1, 0 ∈ ', 0, 1, 1 ∈'; Recursive: if (, -, . ∈ ', / ∈ ℝ, then α(, /-, /. ∈ ' if [(1, -1, .1], [(2, -2, .2] ∈ ' then [(1 + (2, -1 + -2, .1 + .2] ∈ ' Powers of 3:

slide-3
SLIDE 3

Recursive Definitions of Sets: General Form

Recursive definition – Basis step: Some specific elements are in ' – Recursive step: Given some existing named elements in ' some new objects constructed from these named elements are also in '. – Exclusion rule: Every element in ' follows from basis steps and a finite number of recursive steps

Strings

  • An alphabet Σ is any finite set of characters
  • The set Σ* of strings over the alphabet Σ is

defined by – Basis: ℇ ∈ Σ* (ℇ is the empty string) – Recursive: if 4 ∈ Σ*, ∈ Σ, then 4 ∈ Σ*

Palindromes

Palindromes are strings that are the same backwards and forwards Basis:

ℇ is a palindrome and any ∈ Σ is a palindrome

Recursive step: If 5 is a palindrome then 5 is a palindrome for every ∈ Σ

All Binary Strings with no 1’s before 0’s

slide-4
SLIDE 4

Function Definitions on Recursively Defined Sets

Length: len (ℇ) = 0; len (4) = 1 + len(4); for 4 ∈ Σ∗, ∈ Σ Reversal:

ℇ8 = ℇ

4 8 = 48 for 4 ∈ Σ*, ∈ Σ Concatenation: ( • ℇ = ( for ( ∈ Σ* ( • 4 = (( • 4) for (, 4 ∈ Σ*, ∈ Σ