We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byKarlee Pill
Modified over 2 years ago
Recursive Definitions & Structural Induction: Selected Exercises
Copyright © Peter Cappello2 Exercise 10 Give a recursive definition of S m ( n ), the sum of integer m + nonnegative integer n.
Copyright © Peter Cappello3 Exercise 10 Solution Give a recursive definition of S m ( n ), the sum of integer m + nonnegative integer n. S m ( n ) = ( n == 0 ) ? m : 1 + S m ( n – 1 );
Copyright © Peter Cappello4 Exercise 20 Give a recursive definition of the functions max & min so that max( a 1, a 2, …, a n ) & min( a 1, a 2, …, a n ) are the maximum & minimum of a 1, a 2, …, a n, respectively.
Copyright © Peter Cappello5 Exercise 20 Solution Give a recursive definition of the functions max & min so that max( a 1, a 2, …, a n ) & min( a 1, a 2, …, a n ) are the maximum & minimum of a 1, a 2, …, a n, respectively. max( a 1 ) = a 1 ; max( a 1, a 2 ) = (a 1 a 2 ) ? a 2 : a 1 ; (Why is this needed?) max( a 1, a 2, …, a n ) = max (max( a 1, a 2, …, a n-1 ), a n ) The min function is defined similarly.
Copyright © Peter Cappello6 Exercise 30 Prove that in any bit string, the string 01 occurs at most 1 more time than the string 10.
Copyright © Peter Cappello7 Exercise 30 Prove that in any bit string “01” occurs at most 1 more time than the “10”. Can we prove it by induction? Can we base the induction on the length of the bit string? If we –Show it’s true for | s | = 1 –Assume it’s true for | s | < n We try to show it’s true for | s | = n. –We break the string into bit string r = the 1 st n – 1 bits, followed by the last bit. –Apply the induction hypothesis to r. –Induction step: 4 cases, depending on the last bit of r &the last bit of s. –The case fails when the last bit of r is 1 & the last bit of s is 0. What to do?
Copyright © Peter Cappello8 Exercise 30 Proof 1.Basis: |s| = 1: #01(s) = 0 1 = #10(s) Assume: |s| < n #01(s) #10(s) Show: |s| = n #01(s) #10(s) + 1 (Decomposing s arbitrarily into 2 smaller strings, fails. Try it.) Case: s does not contain substring “10”: 1.It is of the form 0*1*. 2.#01(s) 1 = #10(s) + 1.
Copyright © Peter Cappello9 Case: s does contain substring “10”: Break s into 2 strings, t and u, between a “10” E.g., is broken into (100111)( ) 1. t ends in “1”; u begins with “0”. 2.#01(t) #10(t) + 1 (S.I.H.) 3.#01(u) #10(u) + 1 (S.I.H.) 4.#01(s) = #01(t) + #01(u) #10(t) + #10(u) + 2 = #10(s) + 1.
Copyright © Peter Cappello10 Exercise 40 To recursively define a set: 1.Define it to have some “initial” elements; 2.Give rules that compose new elements from pre- existing elements. Recursively define the set S of bit strings with more 0s than 1s.
Copyright © Peter Cappello11 Exercise 40 Solution Recursively define the set S of bit strings that have more 0s than 1s. 1.0 S. 2.x, y S xy, 1xy, x1y, xy1 S. This recursive definition of set S is like a context free grammar. S is a context-free language. These grammars & languages are studied in CMPSC 138. We use them to define the syntax of programming languages, like Java, C, & C++.
Copyright © Peter Cappello12
Copyright © Peter Cappello13 Exercise 50 Ackermann’s function is defined as follows: A( m, n ) = 2n, if m = 0; = 0, if m ≥ 1 n = 0 = 2, if m ≥ 1 n = 1 = A( m – 1, A( m, n – 1 ) ), if m ≥ 1 n ≥ 2. Show that A( 1, k ) = 2 k, for k ≥ 1. (We use structural induction.)
Copyright © Peter Cappello14 Exercise 50 Solution Ackermann’s function is defined as follows: A( m, n ) = 2n, if m = 0; = 0, if m ≥ 1 n = 0 = 2, if m ≥ 1 n = 1 = A( m – 1, A( m, n – 1 ) ), if m ≥ 1 n ≥ 2. Show that, for k ≥ 1, A( 1, k ) = 2 k. Basis k = 1: A( 1, 1 ) = 2 = 2 1. Show A( 1, k ) = 2 k A( 1, k + 1 ) = 2 k+1, for arbitrary k. Assume A( 1, k ) = 2 k. Prove A( 1, k + 1 ) = 2 k+1 : A( 1, k + 1) = A( 0, A(1, k ) ) = A( 0, 2 k ) = 2. 2 k = 2 k+1.
A Bijection between Z + & Rooted Trees The discussion below is based on Peter Cappello. A New Bijection between Natural Numbers and Rooted Trees. 4th SIAM Conf. on Discrete Mathematics, San Francisco, June 1988.A New Bijection between Natural Numbers and Rooted Trees Let P denote the set of primes numbers. Let T denote the set of rooted trees. Let p: Z +, P, where p(n) is the n th prime (e.g., p(4) = 7 and p -1 (7) = 4 ). p -1 (n) n. Copyright © Peter Cappello15
The Growth of Functions: Selected Exercises Goals Introduce big-O & big-Omega Show how to estimate the size of functions using this notation.
Recurrence Relations: Selected Exercises. Copyright © Peter Cappello2 Exercise 10 (a) A person deposits $1,000 in an account that yields 9% interest compounded.
The Pigeonhole Principle: Selected Exercises. Copyright © Peter Cappello2 The Pigeon-Hole Principle Let k be a positive integer. If k + 1 or more objects.
Generalized Permutations & Combinations: Selected Exercises.
The Basics of Counting: Selected Exercises. Copyright © Peter Cappello2 Sum Rule Example There are 3 sizes of pink shirts & 7 sizes of blue shirts. How.
Strong Induction: Selected Exercises Goal Explain & illustrate proof construction of a variety of theorems using strong induction.
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.
Mathematical Induction. The Principle of Mathematical Induction Let S n be a statement involving the positive integer n. If 1.S 1 is true, and 2.the truth.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 03/31/11 Ming-Hsuan Yang UC Merced 1.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Recursive Definitions Rosen, 3.4. Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
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.
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
Chapter 5: Sequences, Mathematical Induction, and Recursion 5.4 Strong Mathematical Induction and the Well-Ordering Principle for the Integers 1 Mathematics.
Chapter 5 With Question/Answer Animations. Chapter Summary Mathematical Induction Strong Induction Recursive Definitions Structural Induction.
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Copyright © Peter Cappello Mathematical Induction Goals Explain & illustrate construction of proofs of a variety of theorems using mathematical induction.
22C:19 Discrete Structures Induction and Recursion Spring 2014 Sukumar Ghosh.
Review for CS1050. Review Questions Without using truth tables, prove that (p q) q is a tautology. Prove that the sum of an even integer and an.
Proof Methods & Strategy. Copyright © Peter Cappello2 Proof by Cases ( p 1 p 2 ... p n ) q ( p 1 q ) ( p 2 q ) ... ( p n q ). Prove.
Chapter 4: Induction and Recursion Discrete Mathematics and Its Applications Lingma Acheson Department of Computer and Information Science,
1 Recursive Definitions and Structural Induction CS 202 Epp section ??? Aaron Bloomfield.
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Discrete Mathematics Math 6A Homework 9 Solution.
Chapter 6 Mathematical Induction 6.1 The Principle of mathematical induction 6.2 A More General Principle of Mathematical Induction 6.3 * Proof by Minimum.
Section Recursion 2 Recursion – defining an object (or function, algorithm, etc.) in terms of itself. Recursion can be used to define sequences.
March 5, 2015Applied Discrete Mathematics Week 6: Counting 1 Recursively Defined Functions A famous example: The Fibonacci numbers f(0) = 0, f(1) = 1 f(n)
Recurrence Relations: Selected Exercises (a) A person deposits $1,000 in an account that yields 9% interest compounded annually. a) Set up a recurrence.
Mathematical Induction And Recursion Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Section Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction Generalized Induction 2.
Inclusion-Exclusion Selected Exercises Powerpoint Presentation taken from Peter Cappello’s webpage
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Courtesy Costas Busch - RPI1 Mathematical Preliminaries.
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.
Fall 2002CMSC Discrete Structures1 Chapter 3 Sequences Mathematical Induction Recursion Recursion.
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.
Lesson 10.4: Mathematical Induction Mathematical Induction is a form of mathematical proof. Principle of Mathematical Induction: Let P n be a statement.
More Set Definitions and Proofs 1.6, 1.7. Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element,
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Mathematical Induction Rosen 3.3. Basics The Well-Ordering Property - Every nonempty set of nonnegative integers has a least element. Many theorems state.
Chapter 5 1. Chapter Summary Mathematical Induction Strong Induction Recursive Definitions Structural Induction Recursive Algorithms.
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,
Mathematical Preliminaries. Sets Functions Relations Graphs Proof Techniques.
April 7, 2015Applied Discrete Mathematics Week 9: Relations 1 Now it’s Time for… AdvancedCountingTechniques.
© 2017 SlidePlayer.com Inc. All rights reserved.