cse 311 foundations of computing strong induction
play

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


  1. 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 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 Bounding the Fibonacci Numbers f 0 = 0; f 1 = 1; f n = f n-1 + f n-2 for all � ≥ 2 � � = 0 Theorem: 2 n/2-1 ≤ f n < 2 n for all � ≥ 2 � � = 1 Proof : ��� for all � ≥ 2 � � = � ��� + � 1. Let P(n) be “2 n/2-1 ≤ f n < 2 n . By (strong) induction we prove P(n) for all n ≥ 2. Base Case: P(2) is true: f 2 =1, 2 2/2-1 =2 0 =1 ≤ f 2 , 2 2 =4>f 2 2. Ind.Hyp: Assume 2 j/2-1 ≤ f j < 2 j for all integers j with 2 ≤ j ≤ k for some 3. arbitrary integer k ≥ 2. Ind. Step: Goal: Show 2 (k+1)/2-1 ≤ f k+1 < 2 k+1 4.

  2. f 0 = 0; f 1 = 1; f n = f n-1 + f n-2 for all � ≥ 2 Running time of Euclid’s algorithm Theorem: 2 n/2-1 ≤ f n < 2 n for all � ≥ 2 Theorem: Suppose that Euclid’s algorithm takes � steps for gcd (�, �) with � > � , then � ≥ � Proof : �!� 1. Let P(n) be “2 n/2-1 ≤ f n < 2 n . By (strong) induction we prove P(n) for all n ≥ 2. 2. Base Case: P(2) is true: f 2 =1, 2 2/2-1 =2 0 =1 ≤ f 2 , 2 2 =4>f 2 Set " � = � then Euclid’s algorithm computes �!� = �, " Ind.Hyp: Assume 2 j/2-1 ≤ f j < 2 j for all integers j with 2 ≤ j ≤ k for for some 3. arbitrary integer k ≥ 2. " �!� = # � " � + " Ind. Step: Goal: Show 2 (k+1)/2-1 ≤ f k+1 < 2 k+1 ��� 4. " � = # ��� " ��� + " each quotient # & ≥ 1 Case k=2: P(3) is true: f 3 =f 2 +f 1 =1+1=2, 2 3/2-1 =2 1/2 ≤ 2 = f 3 , 2 3 =8 > f 3 ��� Case k≥3: " � ≥ 1 ⋮ f k+1 = f k + f k-1 ≥ 2 k/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 " � = # � " � f k+1 = f k + f k-1 < 2 k + 2 (k-1) by I.H. since k-1 ≥ 2 < 2 k + 2 k = 2 · 2 k = 2 k+1 Recursive Definition of Sets Recursive Definitions of Sets Basis: Recursive definition 6 ∈ '; 15 ∈ '; if (, - ∈ ' , then ( + - ∈ ' ; Recursive: – Basis step: 0 ∈ ' – Recursive step: if ( ∈ ' , then ( + 2 ∈ ' 1, 1, 0 ∈ ', 0, 1, 1 ∈ '; Basis: – Exclusion rule: Every element in ' follows from Recursive: basis steps and a finite number of recursive if (, -, . ∈ ', / ∈ ℝ , then α (, /-, /. ∈ ' steps if [( 1 , - 1 , . 1 ], [( 2 , - 2 , . 2 ] ∈ ' then [( 1 + ( 2 , - 1 + - 2 , . 1 + . 2 ] ∈ ' Powers of 3:

  3. Recursive Definitions of Sets: General Form Strings Recursive definition • An alphabet Σ is any finite set of characters – Basis step: Some specific elements are in ' – Recursive step: Given some existing named • The set Σ * of strings over the alphabet Σ is elements in ' some new objects constructed defined by from these named elements are also in ' . – Basis: ℇ ∈ Σ * ( ℇ is the empty string) – Exclusion rule : Every element in ' follows from – Recursive: if 4 ∈ Σ *, � ∈ Σ , then 4� ∈ Σ * basis steps and a finite number of recursive steps Palindromes All Binary Strings with no 1’s before 0’s 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 � ∈ Σ

  4. Function Definitions on Recursively Defined Sets Length: len ( ℇ ) = 0; len ( 4� ) = 1 + len( 4 ); for 4 ∈ Σ ∗ , � ∈ Σ Reversal: ℇ 8 = ℇ 4� 8 = �4 8 for 4 ∈ Σ *, � ∈ Σ Concatenation: ( • ℇ = ( for ( ∈ Σ * ( • 4� = (( • 4)� for (, 4 ∈ Σ *, � ∈ Σ

Recommend


More recommend