CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.

Slides:



Advertisements
Similar presentations
Recursive Definitions and Structural Induction
Advertisements

Induction and Recursion. Odd Powers Are Odd Fact: If m is odd and n is odd, then nm is odd. Proposition: for an odd number m, m k is odd for all non-negative.
10.1 CompSci 102© Michael Frank Today’s topics RecursionRecursion –Recursively defined functions –Recursively defined sets –Structural Induction Reading:
Induction and recursion
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
CSE 321 Discrete Structures Winter 2008 Lecture 12 Induction.
CSE115/ENGR160 Discrete Mathematics 03/31/11
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank. Modified By Mingwu Chen Induction.
1 Section 3.4 Recursive Definitions. 2 Recursion Recursion is the process of defining an object in terms of itself Technique can be used to define sequences,
1 Strong Mathematical Induction. Principle of Strong Mathematical Induction Let P(n) be a predicate defined for integers n; a and b be fixed integers.
Induction and recursion
Mathematical Maxims and Minims, 1988
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
CSE373: Data Structures and Algorithms Lecture 2b: Proof by Induction and Powers of Two Nicki Dell Spring 2014.
Chapter 4: Induction and Recursion
CSE 311 Foundations of Computing I Lecture 16 Recursively Defined Sets and Structural Induction Spring
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
Section 2.6 Representation of numbers. Decimal representation (base 10) Given a positive integer X, the decimal representation of X is a string of digits.
Chapter 5 With Question/Answer Animations. Section 5.1.
CSE 311 Foundations of Computing I Lecture 17 Structural Induction Spring
Chapter Mathematical Induction 4.2 Strong Induction and Well-Ordering 4.3 Recursive Definitions and Structural Induction 4.4 Recursive Algorithms.
Induction Proof. Well-ordering A set S is well ordered if every subset has a least element. [0, 1] is not well ordered since (0,1] has no least element.
Lecture 4,5 Mathematical Induction and Fibonacci Sequences.
Section 3.3: Mathematical Induction Mathematical induction is a proof technique that can be used to prove theorems of the form:  n  Z +,P(n) We have.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
CSE 311 Foundations of Computing I Lecture 9 Proofs and Set Theory Autumn 2012 CSE
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
CSE 311 Foundations of Computing I Lecture 14 Euclid’s Algorithm Mathematical Induction Autumn 2012 CSE
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
CSE 311: Foundations of Computing Fall 2013 Lecture 18: Structural induction, regular expressions.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
CSE 311 Foundations of Computing I Lecture 19 Recursive Definitions: Context-Free Grammars and Languages Autumn 2012 CSE
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
1 Recursive Definitions and Structural Induction CS/APMA 202 Rosen section 3.4 Aaron Bloomfield.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
CSE 311 Foundations of Computing I Lecture 15 Strong Induction and Recursive Definitions Spring
Mathematical Induction And Recursion Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
(Proof By) Induction Recursion
Advanced Algorithms Analysis and Design
CSE 311 Foundations of Computing I
CS2210:0001Discrete Structures Induction and Recursion
CSE 311 Foundations of Computing I
Induction and recursion
CSE 311 Foundations of Computing I
CSE 311: Foundations of Computing
Discrete Structures for Computer Science
Discrete Structures for Computer Science
CSE 311: Foundations of Computing
Induction and recursion
CSE 311 Foundations of Computing I
CSE 311: Foundations of Computing
CSE 321 Discrete Structures
CSE 321 Discrete Structures
Applied Discrete Mathematics Week 9: Integer Properties
CSE 321 Discrete Structures
Rosen 5th ed., §§ ~18 slides, ~1 lecture
CSE 311 Foundations of Computing I
Induction Chapter
Advanced Analysis of Algorithms
Mathematical Induction
CSE 321 Discrete Structures
CSE 311 Foundations of Computing I
Useful GCD Fact If a and b are positive integers, then gcd(a,b) = gcd(b, a mod b) Proof: By definition of mod, a = qb+ (a mod b) for.
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
Presentation transcript:

CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111

Announcements Reading assignments – Today: th Edition th Edition th Edition (not all there) Midterm Friday, Nov 4 – Closed book, closed notes – Sample midterm questions available on website – Extra office hours Thursday, times TBA Autumn 2011CSE 3112

Highlights from last lecture Strong Induction Strong Induction proof layout: 1.By induction we will show that P(n) is true for every n≥0 2.Base Case: Prove P(0) 3.Inductive Hypothesis: Assume that for some arbitrary integer k ≥ 0, P(j) is true for every j from 0 to k 4.Inductive Step: Prove that P(k+1) is true using Inductive Hypothesis that P(j) is true for all values  k 5.Conclusion: Result follows by induction P(0)  k ((P(0)  P(1)  P(2)  …  P(k))  P(k+1))   n P(n)

Fibonacci Numbers f 0 = 0; f 1 = 1; f n = f n-1 + f n-2

Bounding the Fibonacci Numbers Theorem: 2 n/2-1  f n  2 n for n  2

Fibonacci numbers and the running time of Euclid’s algorithm Theorem: Suppose that Euclid’s algorithm takes n steps for gcd(a,b) with a>b, then a ≥ f n+1 so a ≥ 2 (n-1)/2 – # of steps at most twice # of bits of a Set r n+1 =a, r n =b then Euclid’s alg. computes r n+1 = q n r n + r n-1 r n = q n-1 r n-1 + r n-2 ●●● r 3 = q 2 r 2 + r 1 r 2 = q 1 r 1 Autumn 2011CSE 3116 each quotient q i ≥ 1 r 1 ≥ 1

Recursive Definitions of Sets Recursive definition – Basis step: 0  S – Recursive step: if x  S, then x + 2  S – Exclusion rule: Every element in S follows from basis steps and a finite number of recursive steps

Recursive definitions of sets Basis: 6  S; 15  S; Recursive: if x, y  S, then x + y  S; Basis: [1, 1, 0]  S, [0, 1, 1]  S; Recursive: if [x, y, z]  S,  in R, then [  x,  y,  z]  S if [x 1, y 1, z 1 ], [x 2, y 2, z 2 ]  S then [x 1 + x 2, y 1 + y 2, z 1 + z 2 ]  S Powers of 3

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

Structural Induction: proving properties of recursively defined sets How to prove  x ∈ S. P(x) is true: Base Case: Show that P is true for all specific elements of S mentioned in the Basis step Inductive Hypothesis: Assume that P is true for some arbitrary values of each of the existing named elements mentioned in the Recursive step Inductive Step: Prove that P holds for each of the new elements constructed in the Recursive step using the named elements mentioned in the Inductive Hypothesis Conclude that  x ∈ S. P(x) Autumn 2011CSE 31110

Structural Induction versus Ordinary Induction Ordinary induction is a special case of structural induction: – Recursive Definition of ℕ Basis: 0 ∈ ℕ Recursive Step: If k ∈ ℕ then k+1 ∈ ℕ Structural induction follows from ordinary induction Let Q(n) be true iff for all x ∈ S that take n Recursive steps to be constructed, P(x) is true. Autumn 2011CSE 31111

Using Structural Induction Let S be given by – Basis: 6  S; 15  S; – Recursive: if x, y  S, then x + y  S. Claim: Every element of S is divisible by 3 Autumn 2011CSE 31112

Strings An alphabet  is any finite set of characters. The set  * of strings over the alphabet  is defined by – Basis:  S ( is the empty string) – Recursive: if w   *, x  , then wx   *

Function definitions on recursively defined sets Len( ) = 0; Len(wx) = 1 + Len(w); for w   *, x   Concat(w, ) = w for w   * Concat(w 1, w 2 x ) = Concat(w 1, w 2 )x for w 1, w 2 in  *, x  