Addition is Primitive Recursive

Theorem
The function $\operatorname{add}: \N^2 \to \N$, defined as:
 * $\operatorname{add} \left({n, m}\right) = n + m$

is primitive recursive‎.

Proof
We observe that:
 * $\operatorname{add} \left({n, 0}\right) = n + 0 = n$

and that
 * $\operatorname{add} \left({n, m + 1}\right) = n + \left({m + 1}\right) = \left({n + m}\right) + 1 = \operatorname{succ} \left({\operatorname{add} \left({n, m}\right)}\right)$

where $\operatorname{succ}$ is a basic primitive recursive‎ function.

We are to show that $\operatorname{add}$ is defined by primitive recursion.

So we need to find primitive recursive‎ functions $f: \N \to \N$ and $g: \N^3 \to \N$ such that:
 * $\operatorname{add} \left({n, m}\right) = \begin{cases}

f \left({n}\right) & : m = 0 \\ g \left({n, m - 1, \operatorname{add} \left({n, m - 1}\right)}\right) & : m > 0 \end{cases}$

Since $\operatorname{add} \left({n, 0}\right) = n$, we can see that $f \left({n}\right) = n$.

That is, $f$ is the basic primitive recursive‎ function $\operatorname{pr}^1_1: \N \to \N$.

Since $\operatorname{add} \left({n, m + 1}\right) = \operatorname{succ} \left({\operatorname{add} \left({n, m}\right)}\right)$, we can see that $g$ needs to be a function which maps the triple $\left({n, m, \operatorname{add} \left({n, m}\right)}\right)$ to $\operatorname{succ} \left({\operatorname{add} \left({n, m}\right)}\right)$.

A suitable function is:
 * $g: \N^3 \to \N$ where $g \left({n_1, n_2, n_3}\right) = \operatorname{succ} \left({n_3}\right)$

because then:
 * $g \left({n, m, \operatorname{add} \left({n, m}\right)}\right) = \operatorname{succ} \left({\operatorname{add} \left({n, m}\right)}\right)$.

Now we just need to show that $g$ is primitive recursive‎.

This is achieved by using the projection function:
 * $g \left({n_1, n_2, n_3}\right) = \operatorname{succ} \left({\operatorname{pr}^3_3 \left({n_1, n_2, n_3}\right)}\right)$.

Thus $g$ is obtained by substitution from the basic primitive recursive‎ functions $\operatorname{succ}$ and $\operatorname{pr}^3_3$ and so is primitive recursive‎.

So $\operatorname{add}$ is obtained by primitive recursion from the primitive recursive functions‎ $\operatorname{pr}^1_1$ and $g$, and so is primitive recursive‎.