4.3 Recursive Definitions and Structural Induction Sometimes it is difficult to define an object explicitly. However, it may be easy to define this object.

Slides:



Advertisements
Similar presentations
Chapter 2 Revision of Mathematical Notations and Techniques
Advertisements

22C:19 Discrete Structures Induction and Recursion Spring 2014 Sukumar Ghosh.
22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Recursive Definitions and Structural Induction
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:
UCI ICS/Math 6A, Summer Recursion -1 after Strong Induction “Normal” Induction “Normal” Induction: If we prove.
UCI ICS/Math 6D5-Recursion -1 Strong Induction “Normal” Induction “Normal” Induction: If we prove that 1) P(n 0 ) 2) For any k≥n 0, if P(k) then P(k+1)
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
Recursive Definitions Rosen, 3.4. Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
CSE 321 Discrete Structures Winter 2008 Lecture 12 Induction.
CSE115/ENGR160 Discrete Mathematics 03/31/11
Lecture Recursive Definitions. Fractals fractals are examples of images where the same elements is being recursively.
Courtesy Costas Busch - RPI1 Mathematical Preliminaries.
Lecture Recursive Definitions. Fractals fractals are examples of images where the same elements is being recursively.
Chapter Mathematical Induction
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
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,
Induction and recursion
22C:19 Discrete Math Induction and Recursion Fall 2011 Sukumar Ghosh.
Induction and recursion
Relations Chapter 9.
Recursive Definitions and Structural Induction
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Induction and recursion
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 4 Induction and Recursion 歐亞書局.
Chapter 4: Induction and Recursion
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Induction and recursion
Tree A connected graph that contains no simple circuits is called a tree. Because a tree cannot have a simple circuit, a tree cannot contain multiple.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Mathematical Preliminaries. Sets Functions Relations Graphs Proof Techniques.
5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible.
Chapter 5 With Question/Answer Animations. Section 5.1.
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.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Mathematical Preliminaries
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
1 Recursive Definitions and Structural Induction CS 202 Epp section ??? Aaron Bloomfield.
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
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.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Chapter 5 Kenneth Rosen, Discrete Mathematics and its Applications, 7th edition, McGraw Hill Instructor: Longin Jan Latecki, Copyright.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
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.
Recursive Definitions and Structural Induction ICS 6D Sandy Irani.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Mathematical Induction What it is? Why is it a legitimate proof method? How to use it?
Mathematical Induction And Recursion Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Chapter 4: Induction and Recursion
Induction and recursion
Induction and Recursion Chapter 5
Relations Chapter 9.
CS2210:0001Discrete Structures Induction and Recursion
Induction and Recursion
Discrete Structures for Computer Science
CSE 321 Discrete Structures
Chapter 4 Induction and Recursion
321 Section, Feb. 14 Natalie Linnell.
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
Induction and recursion
Induction and recursion
Chapter 4 (Part 2): Mathematical Reasoning, Induction & Recursion
Presentation transcript:

4.3 Recursive Definitions and Structural Induction Sometimes it is difficult to define an object explicitly. However, it may be easy to define this object in terms of itself. This process is called recursion. FIGURE 1 A Recursively Defined Picture. 1

Recursively Defined Functions We use two steps to define a function with the set of nonnegative integers as its domain: Basis step: specify the value of the function at zero. Recursive step: give a rule for finding its value at an integer from its values at smaller integers. Such a definition is called a recursive or inductive definition. Example 1: suppose that f is defined recursively by f(0)=3, f(n+1)=2*f(n) +3. find f(1), f(2), f(3), f(4). 2

Example 2: give an inductive definition of the factorial function F(n)=n!. Example 3: Give a recursive definition of a n, where a is a nonzero real number and n is a nonnegative integer. Example 4: Give a recursive definition of 3 Recursively Defined Functions

Definition 1: The Fibonacci numbers, f 0, f 1,f 2,..., are defined by the equations: f 0 =0, f 1 =1, and f n = f n-1 + f n-2 for n = 2, 3, 4,... Example 5: Find the Fibonacci numbers f 2, f 3, f 4, f 5, and f 6. Example 6: Show that whenever n ≥ 3, f n > α n-2, where 4 Recursively Defined Functions

Recursively Defined Sets and Structures Example 7: consider the subset S of the set of integers defined by Basis step: 3 S. Recursive step: if x S, y S, then x+y S. 5

Definition 2: The set  * of strings over the alphabet  can be defined recursively by Basis step:  * (where λ is the empty string containing no symbols) Recursive step: if w  * and x , then wx  * Example 8: if  ={0, 1}, the strings found to be in  *, the set of all bit strings, are 1.λ specified to be in the basis step, 2.0 and 1 formed during the first application of the recursive step, 3.00, 01, 10, and 11 formed during the second application for the recursive step, and so on. 6 Recursively Defined Sets and Structures

Definition 3: two strings can be combined via the operation of concatenation. Let  be a set of symbols and  * the set of strings formed form symbols in . We can define the concatenation of two strings, denoted by ∙, recursively as follows. Basis step: if w  *, then w ∙ λ=w, where λ is the empty string. Recursive step: if w 1  * and w 2  * and x , then w 1 ∙(w 2 x)=(w 1 ∙ w 2 )x Example 9: length of a string Give a recursive definition of l(w), the length of the string w. 7 Recursively Defined Sets and Structures

Definition 4: The set of rooted trees, where a rooted tree consists of a set of vertices containing a distinguished vertex called the root, and edges connecting these vertices, can be defined recursively by these steps: Basis step: A single vertex r is a rooted tree. Recursive step: Suppose that T 1, T 2,...,T n are disjoint rooted trees with roots r 1, r 2,..., r n, respectively. Then the graph formed by staring with a root r, which is not in any of the rooted trees T 1, T 2,...,T n, and adding an edge from r to each of the vertices r 1, r 2,..., r n, is also a rooted tree. 8 Recursively Defined Sets and Structures

FIGURE 2 Building Up Rooted Trees. 9 Recursively Defined Sets and Structures

Definition 5: The set of extended binary trees can be defined recursively by these step: Basis step: The empty set is an extended binary tree. Recursive step: if T 1 and T 2 are disjoint extended binary trees, there is an extended binary tree, denoted by T 1 ∙ T 2, consisting of a root r together with edges connecting the root to each of the roots of the left subtree T 1 and the right subtree T 2 when these trees are nonempty. 10 Recursively Defined Sets and Structures

FIGURE 3 Building Up Extended Binary Trees. 11 Recursively Defined Sets and Structures

Definition 6: The set of full binary trees can be defined recursively by these steps: Basis step: There is a full binary tree consisting only of a single vertex r. Recursive step: if T 1 and T 2 are disjoint full binary trees, there is a full binary tree, denoted by T 1 ∙ T 2, consisting of a root r together with edges connecting the root to each of the roots of the left subtree T 1 and the right subtree T Recursively Defined Sets and Structures

FIGURE 4 Building Up Full Binary Trees. 13 Recursively Defined Sets and Structures

Structural Induction To prove results about recursively defined sets we generally use some form of mathematical induction. Example 12: show that the set S defined in example 7 by specifying that 3 S and that if x S and y S, then x+y S, is the set of all positive integers that are multiples of 3. 14

Structural Induction Definition 7: We define the height and number of vertex, h(T) and n(T), of a full binary tree T recursively,. Basis step: The height of the full binary tree T consisting of only a root r is h(T)=0 Recursive step: If T 1 and T 2 are full binary trees, then the full binary tree T= T 1 ∙T 2 has height h(T) = 1+ max(h(T 1 ), h(T 2 )), n(T) = 1+n(T 1 )+n(T 2. Theorem 2: If T is a full binary tree T, then n(T) ≤ 2 h(T)

Generalized Induction As an example, note that we can define an ordering on N x N, the ordered pairs of nonnegative integers, by specifying that (x1, y1) is less than or equal to (x2, y2) if either x1< x2, or x1=x2 and y1 < y2; this is called the lexicographic ordering. The set N x N with this ordering has the property that every subset of N x N has a least element (see Supplementary exercise 53 in section 8.6). This implies that we can recursively define the terms a m,n, with m  N, n  N, and prove results about them using a variant of mathematical induction, as illustrated in example

Generalized Induction Example 15: Suppose that a m,n is defined recursively for (m, n)  N x N by a 0,0 =0 and Show that a m,n =m+n(n+1)/2 for all (m, n) NxN that is, for all pairs of nonnegative integers. 17