Docsity

Structural Induction - Discrete Mathematics - Lecture Slides, Slides of Discrete Mathematics

Partial preview of the text

Download Structural Induction - Discrete Mathematics - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

CSE115/ENGR160 Discrete Mathematics 04/03/

5.3 Recursive definitions and

structural induction

A recursively defined picture Docsity.com 2

Recursively defined functions

  • Use two steps to define a function with the set of non-negative integers as its domain
  • Basis step : specify the value for 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

  • Suppose f is defined recursively by
    • f(0)=
    • f(n+1)=2f(n)+ Find f(1), f(2), f(3), and f(4)
    • f(1)=2f(0)+3=2*3+3=
    • f(2)=2f(1)+3=2*9+3=
    • f(3)=2f(2)+3=2*21+3=
    • f(4)=2f(3)+3=2*45+3=

Recursive functions

  • Recursively defined functions are well defined
  • For every positive integer, the value of the function is determined in an unambiguous way
  • Given any positive integer, we can use the two parts of the definition to find the value of the function at that integer
  • We obtain the same value no matter how we apply two parts of the definition

Example

  • Given a recursive definition of a n^ , where a is a non-zero real number and n is a non-negative integer
  • Note that a n+1=aโˆ™a n^ and a 0 =
  • These two equations uniquely define a n^ for all non-negative integer n

Example โ€“ Fibonacci numbers

  • Fibonacci numbers f 0 , f 1 , f 2 , are defined by the equations, f 0 =0, f 1 =1, and fn =fn-1+fn-2 for n=2, 3, 4, โ€ฆ
  • By definition

f 2 =f 1 +f 0 =1+0= f 3 =f 2 +f 1 =1+1= f 4 =f 3 +f 2 =2+1= f 5 =f 4 +f 3 =3+2= f 6 =f 5 +f 4 =5+3=

Example

  • Use strong induction to show when nโ‰ฅ3, fn>๐›ผn-^2 where fn is a Fibonacci number and
  • Let p(n) be the proposition that fn>๐›ผn-^2
  • Basis step: note that

so that p(3) and p(4) are true

  • Inductive step: assume p(j) is true, i.e., fj >๐›ผj-^2 with 3โ‰คj โ‰คk where kโ‰ฅ4. We need to show that p(k+1) is true, i.e., f (^) k>๐›ผ k-^2

11

ฮฑ =( 1 + 5 )/ 2

ฮฑ < 2 = f (^) 3 ,ฮฑ^2 = ( 3 + 5 )/ 2 < 3 = f 4

Recursively defined sets and

structures

  • Consider the subset S of the set of integers defined by - Basis step: 3โˆŠS - Recursive step: if xโˆŠS and yโˆŠS, then x+yโˆŠS
  • The new elements formed by this are 3+3=6, 3+6=9, 6+6=12, โ€ฆ
  • We will show that S is the set of all positive multiples of 3 (using structural induction)

String

  • 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 โˆŠโˆ‘*
  • The basis step defines that the empty string belongs to string
  • The recursive step states new strings are produced by adding a symbol from โˆ‘ to the end of stings in โˆ‘*
  • At each application of the recursive step, strings containing one additional symbol are generated

Concatenation

  • Two strings can be combined via the operation of concatenation
  • Let โˆ‘ be a set of symbols and โˆ‘* be the set of strings formed from symbols in โˆ‘
  • We can define the concatenation for two strings by recursive steps - Basis step: if wโˆŠโˆ‘, then wโˆ™๐œ†=w, where ๐œ† is the empty string - Recursive step: If w 1 โˆŠโˆ‘, w 2 โˆŠโˆ‘* and x โˆŠโˆ‘, then w 1 โˆ™ (w 2 x)=(w 1 โˆ™ w 2 )x - Oftentimes w 1 โˆ™ w 2 is rewritten as w 1 w 2 - e.g., w 1 =abra, and w 2 =cadabra, w 1 w 2 =abracadabra

Length of a string

  • Give a recursive definition of l(w), the length of a string w
  • The length of a string is defined by
    • l(๐œ†)=
    • l(wx)=l(w)+1 if wโˆŠโˆ‘* and xโˆŠโˆ‘

Rooted trees

  • 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 - Basis step: a single vertex r is a rooted tree - Recursive step: suppose that T 1 , T 2 , โ€ฆ, Tn are disjoint rooted trees with roots r 1 , r 2 , โ€ฆ, r (^) n , respectively. - Then the graph formed by starting with a root r, which is not in any of the rooted trees T 1 , T 2 , โ€ฆ, Tn , and adding an edge from r to each of the vertices r 1 , r 2 , โ€ฆ, r (^) n , is also a rooted tree

Rooted trees