Presentation is loading. Please wait.

Presentation is loading. Please wait.

and Structural Induction II

Similar presentations


Presentation on theme: "and Structural Induction II"— Presentation transcript:

1 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

2 … 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

3 Rooted Trees In scheme: (((())()())((())())((()))(()(()())))

4 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 Functions

5 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

6 Structural vs Ordinary Induction
derivation tree for x ·cos(log(x)) * x cos(log x) x cos(log x) cos inv log ex

7 Structural vs Ordinary Induction
But Structural Induction also applies to Infinite Trees

8 … … … … … 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

9 In-Class Problem Problem 1

10 … … 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

11 Finite-Path Trees with
Rooted Trees are Finite-Path Trees with finitely many nodes

12 Finite-Path Trees

13 Finite-Path Trees

14 Finite-Path Trees: Unboundedly Deep

15 Finite-Path Trees: Wide & Deep

16 But every downward path in an FP eventually stops
Finite-Path Trees But every downward path in an FP eventually stops

17 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

18 Proof by structural induction on def. of FP
Finite-Path Trees Proof by structural induction on def. of FP 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

19 In-Class Problem Problem 2


Download ppt "and Structural Induction II"

Similar presentations


Ads by Google