Fromal Reasoning - Solution
We use induction over the natural numbers.
Base case:
addNats 0
=
0
=
sumList []
=
sumList (natList 0)
Stepping case:
Provided that Equation holds for a fixed
n >= 0, we now demonstrate that it also holds for n+1:
addNats (n + 1)
=
(n + 1) + addNats (n + 1 - 1)}
=
(n + 1) + addNats n
=
(n + 1) + sumList (natList n)
=
sumList ((n + 1) : (natList n))
=
sumList ((n + 1) : (natList (n + 1 - 1)))
=
sumList (natList (n + 1))
QED
Gabriele Keller
Last modified: Mon Oct 29 13:51:55 EST 2001