Function Obtained by Minimization from URM Computable Functions

Theorem
Let the function $f: \N^{k+1} \to \N$ be a URM computable function.

Let $g: \N^k \to \N$ be the function obtained by minimization from $f$ thus:
 * $g \left({n_1, n_2, \ldots, n_k}\right) \approx \mu y \left({f \left({n_1, n_2, \ldots, n_k}\right) = 0}\right)$.

Then $g$ is also URM computable.

Proof
Let $f: \N^{k+1} \to \N$ be a URM computable function.

Let $P$ be a URM program which computes $f$.

Let $u = \rho \left({P}\right)$ be the number of registers used by $P$.

We can use:
 * the registers $R_{u+1}, R_{u+2}, \ldots, R_{u+k}$ to store the input $\left({n_1, n_2, \ldots, n_k}\right)$;
 * the register $R_{u+k+1}$ to store the current value of the recursion variable $y$.

We check whether or not $f \left({n_1, n_2, \ldots, n_k}\right) = 0$ by comparing the output from running $P$ (appearing in register $1$ at the end of the running of $P$) with the number in register $R_{u+k+2}$, which remains at $0$ throughout.

The following algorithm can be followed to create a URM program $H$ to compute $h$.

We assume that the input is $\left({n_1, n_2, \ldots, n_k}\right)$, which is held in $R_1, R_2, \ldots, R_k$.

We are to use the following registers:
 * $R_{u+1}, R_{u+2}, \ldots, R_{u+k}$ will be used to store the input $\left({n_1, n_2, \ldots, n_k}\right)$ so it does not get overwritten.
 * $R_{u+k+1}$ will hold the value of $y$.
 * $R_{u+k+2}$ will hold the $0$ throughout.

When $r_{u+k+2} = r_{u+k+1}$, the computation will have ended.

We also define $v = \lambda \left({H}\right)$ to be the number of basic instructions in $H$.

It can easily be determined that $H$ computes $g$.

Hence $g$ is URM computable.