Objective: Prove that (factorial-product a b) terminates with the value a × b! for any nonnegative integer b.
Base Case: When b = 0, factorial-product gives a. Since a × b! = a × 0! = a, this is correct.
Inductive Hypothesis (I.H.): Assume (factorial-product i j) gives i × j! for j = b-1.
Induction Step:
Consider (factorial-product a b). It computes:
(factorial-product (* a b) (- b 1))
Since this satisfies the I.H., it gives:
(a × b) × (b-1)! =
a × (b × (b-1)!) =
a × b!
Done.