(define sevens
(lambda (n)
(if (= n 0)
'()
(cons 7 (sevens (- n 1))))))
Objective: Prove by induction on n that sevens produces a list
of length n
Base case: When n = 0, the list produced is empty so it has length 0.
Induction Hypothesis: Assume that for i < n, the procedure produces a list of length i.
Induction Step:
Consider any n > 0.
By inspection, the procedure adds one seven to the result of calling the procedure on n-1.
By the induction hypothesis, calling the procedure on n-1 produces a list of length n-1.
Calling the procedure on n therefore produces a list of length 1 + n-1 = n.