Bounded Summation is Primitive Recursive

Theorem
Let the function $f: \N^{k+1} \to \N$ be primitive recursive.

Then so is the function $g: \N^{k+1} \to \N$ defined as:
 * $\displaystyle g \left({n_1, n_2, \ldots, n_k, z}\right) = \begin{cases}

0 & : z = 0 \\ \sum_{y \mathop = 1}^z f \left({n_1, n_2, \ldots, n_k, y}\right) & : z > 0 \end{cases}$

Proof
The function $g$ satisfies:
 * $g \left({n_1, n_2, \ldots, n_k, 0}\right) = 0$
 * $g \left({n_1, n_2, \ldots, n_k, z+1}\right) = g \left({n_1, n_2, \ldots, n_k, z}\right) + f \left({n_1, n_2, \ldots, n_k, z + 1}\right)$.

Hence $g$ is defined by primitive recursion from:
 * the primitive recursive function $\operatorname{add}$
 * $f$, which is primitive recursive
 * and constants, which are primitive recursive.

Hence the result.

Note
The sum $\displaystyle \sum_{y \mathop = 1}^z$ is referred to as a bounded sum to distinguish it from $\displaystyle \sum_{y \mathop = 1}^\infty$ which is not.