and Structural Induction II Mathematics for Computer Science MIT 6.042J/18.062J Recursive Definitions and Structural Induction II Copyright © Albert Meyer, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal
… Single node is a rooted tree If t1, t2, …, tn are RTs, so is: t1 t2 Rooted Trees Single node is a rooted tree If t1, t2, …, tn are RTs, so is: … t1 t2 tn
Rooted Trees In scheme: (((())()())((())())((()))(()(()())))
Structural vs Ordinary Induction Structural Induction on Rooted Trees reduces to Strong Induction on SIZE of subtrees. But what is the "size" of the COSINE function? Data objects may be infinite: The 18.01 Functions
Structural vs Ordinary Induction For 18.01F, replace structural induction by induction on number of steps to construct an object . Function no. of steps x, sin(x), cos(x), ex : 1 log(x) [inverse,ex] 2 cos(log(x)) [cos,log,compose] 4 x ·cos(log(x)) [id,times,] 6
Structural vs Ordinary Induction derivation tree for x ·cos(log(x)) * x cos(log x) x cos(log x) cos inv log ex
Structural vs Ordinary Induction But Structural Induction also applies to Infinite Trees
… … … … … Infinitely wide Game Tree for Problem 1 (0,0) (0,1) (1,0) (1,1) (0,2) (2,0) (1,2) (2,1) … … (0,0) (0,0) … … (0,0) (0,1) (0,2) (0,1) (0,2) Infinitely wide
In-Class Problem Problem 1
… … Single node is an FP tree If t1, t2, …, tn are FPs, so is: t1 t2 Finite-Path Trees Single node is an FP tree If t1, t2, …, tn are FPs, so is: … … t1 t2 tn May have infinitely many subtrees
With finitely many nodes Finite-Path Trees Rooted Trees are Finite-Path Trees With finitely many nodes
Finite-Path Trees … …
Finite-Path Trees … …
Finite-Path Trees: Unboundedly Deep
Finite-Path Trees: Wide & Deep
But every downward path in an FP eventually stops Finite-Path Trees But every downward path in an FP eventually stops
Proof by structural induction on def. Of FP Finite-Path Trees Proof by structural induction on def. Of FP Base Case (t is one node): Has only a 0 length path Induction Step (t has subtrees): Assume in subtrees all down paths are finite. Now path from root of t goes to root of subtree. Rest of the path in subtree must be finite by induction. QED
In-Class Problem Problem 2