Download presentation
Presentation is loading. Please wait.
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
20
Mathematics for Computer Science MIT 6.042J/18.062J
Sums, Products & Asymptotics Copyright © Albert Meyer, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal
21
C. F. Gauss Picture source:
22
Sum for children … … 10,445 + 10, … ,372
23
Sum for children Nine-year old Gauss (so the story goes) saw that each number was 103 greater than the previous one.
24
Sum for children ( ) + ( (103)) + ( (103)) + … + ( (103)) = 8900(25) + 103( … + 24)
25
Arithmetic Series A ::= … + (n-1) + n
26
A ::= 1 + 2 + … + (n-1) + n A = 1 + 2 + … + (n-1) + n
Arithmetic Series A ::= … + (n-1) + n A = … + (n-1) + n
27
A ::= 1 + 2 + … + (n-1) + n A = n + (n-1) + … + 2 + 1
Arithmetic Series A ::= … + (n-1) + n A = n + (n-1) + …
28
2A =(n+1)+(n+1) + … + (n+1) + (n+1)
Arithmetic Series A ::= … + (n-1) + n A = n + (n-1) + … 2A =(n+1)+(n+1) … + (n+1) + (n+1)
29
2A =(n+1)+(n+1) + … + (n+1) + (n+1)
Arithmetic Series A ::= … + (n-1) + n A = n + (n-1) + … 2A =(n+1)+(n+1) … + (n+1) + (n+1) = n(n+1)
30
Arithmetic Series So
31
Geometric Series
32
Geometric Series
33
Geometric Series
34
Geometric Series xn+1
35
Geometric Series n+1
36
The future value of $$. I will promise to pay you $100
Annuities The future value of $$. I will promise to pay you $100 in exactly one year, if you will pay me $X now.
37
X = $100/1.03 ≈ $97.09 My bank will pay me 3% interest.
Annuities My bank will pay me 3% interest. I can’t lose if you pay me: X = $100/1.03 ≈ $97.09
38
97.09¢ today is worth $1.00 in a year
Annuities 97.09¢ today is worth $1.00 in a year $1.00 in a year is worth $1/1.03 today $n in a year is worth $nr today, where r = 1/1.03
39
$n in two years is worth $nr2 today $n in k years is worth $nrk today
Annuities $n in two years is worth $nr2 today $n in k years is worth $nrk today
40
I will pay you $100/year for 10 years If you will pay me $Y now.
Annuities I will pay you $100/year for 10 years If you will pay me $Y now. I can’t lose if you pay me 100r + 100r r3 + … + 100r10 =100r(1+ r + … + r9) = 100r(1-r10)/(1-r) = $853.02
41
In-Class Problem Problems 3 & 4
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.