Maximum Function is Primitive Recursive

Theorem
The maximum function $$\max: \N^2 \to \N$$, defined as:

\max \left({n, m}\right) = \begin{cases} m: & n \preceq m \\ n: & m \preceq n \end{cases} $$ is primitive recursive‎.

Proof
We see that:
 * $$\max \left({n, m}\right) = \left({n \dot - m}\right) + m$$ as:


 * $$n > m \implies \left({n \dot - m}\right) + m = n - m + m = n$$;
 * $$n < m \implies \left({n \dot - m}\right) + m = 0 + m = m$$;
 * $$n = m \implies \left({n \dot - m}\right) + m = 0 + m = m = n$$.

Hence we see that $$\max$$ is obtained by substitution from the primitive recursive function $n \dot - m$.

Hence the result.