Absolute Value of Integer is Primitive Recursive

Theorem
For every $n \in \N$, let $n$ code the integer $k_n$.

Let $a : \N \to \N$ be defined as:
 * $\map a n = \size {k_n}$

Then, $a$ is primitive recursive.

Proof
Let $a : \N \to \N$ be defined as:
 * $\map a n = \map {\operatorname{quot}} {n + 1, 2}$

By: it follows that $a$ is primitive recursive.
 * Constant Function is Primitive Recursive
 * Quotient is Primitive Recursive
 * Successor Function is Primitive Recursive

By definition of code number for integer, either:
 * $n = 2 k_n - 1$, with $k_n > 0$

or:
 * $n = - 2 k_n$, with $k_n \le 0$

In the first case, with $k_n > 0$, we have:
 * $k_n = \size {k_n}$

Then:

In the second case, with $k_n \le 0$, we have:
 * $k_n = - \size {k_n}$

Then: