URM Computable Function is Recursive

Theorem
Every URM computable function is recursive.

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

Then by hypothesis there is a URM program that computes $$f$$.

Let $$P$$ be the URM program with the smallest code number that computes $$f$$.

Let $$e = \gamma \left({P}\right)$$ be the code number of $$P$$.

Consider the function $$g: \N^k \to \N$$ given by:
 * $$g \left({n_1, n_2, \ldots, n_k}\right) \approx \mu t \left({\left({S_k \left({e, n_1, n_2, \ldots, n_k, t}\right)}\right)_1 > \operatorname{len} \left({e}\right)}\right)$$

where:
 * $$\operatorname{len} \left({e}\right)$$ is the length of $e$;
 * $$\mu t$$ is the minimization operation on $$S_k$$;
 * $$\approx$$ denotes partial function equality;
 * $$S_k \left({e, n_1, n_2, \ldots, n_k, t}\right)$$ is the state code at stage $$t$$ of the computation of $$P$$ with input $$\left({n_1, n_2, \ldots, n_k}\right)$$;
 * the number $$\left({S_k \left({e, n_1, n_2, \ldots, n_k, t}\right)}\right)_1$$ is the code number of the instruction about to be carried out at stage $$t$$.

So the inequality:
 * $$\left({S_k \left({e, n_1, n_2, \ldots, n_k, t}\right)}\right)_1 > \operatorname{len} \left({e}\right)$$

expresses the fact that at stage $$t$$ the computation has halted.

So the value of $$g \left({n_1, n_2, \ldots, n_k}\right)$$ is the state code of the first stage at which computation has halted, if there is one, and undefined otherwise.

Since the functions in this inequality, and the sign $$>$$ itself, are all primitive recursive, it follows that the inequality expresses a primitive recursive relation on $$e, n_1, n_2, \ldots, n_k, t$$.

Thus $$g$$ is a recursive function by definition, as it can be obtained by minimization on a recursive relation.

Now consider the function $$h: \N^k \to \N$$ given by:
 * $$h \left({n_1, n_2, \ldots, n_k}\right) \approx S_k \left({e, n_1, n_2, \ldots, n_k, g \left({n_1, n_2, \ldots, n_k}\right)}\right)$$.

This is recursive because it was obtained by substitution from known recursive functions.

Now $$h \left({n_1, n_2, \ldots, n_k}\right)$$ is defined iff the computation halts, and it gives the value of the state code when it has halted.

The output of this computation, which gives the value of $$f$$, is the number in register $$R_1$$.

But the number in $$R_1$$ is the exponent of $$p_2 = 3$$ in the expression of the state code $$h \left({n_1, n_2, \ldots, n_k}\right)$$ in the form $$p_1^a p_2^{r_1} p_3^{r_2} \cdots p_{k+1}^{r_k}$$.

Thus the function $$f$$ is given by:
 * $$f \left({n_1, n_2, \ldots, n_k}\right) \approx \left({h \left({n_1, n_2, \ldots, n_k}\right)}\right)_2$$.

It follows that $$f$$ is a recursive function, since it is obtained by substitution from known recursive functions.

Note
Putting all the above equations together, we note that:
 * $$f \left({n_1, n_2, \ldots, n_k}\right) \approx \left({S_k \left({e, n_1, n_2, \ldots, n_k, \mu t \left({\left({S_k \left({e, n_1, n_2, \ldots, n_k, t}\right)}\right)_1 > \operatorname{len} \left({e}\right)}\right)}\right)}\right)_2$$.

This works for every recursive function of $$k$$ variables.

The only thing that changes as we vary $$f$$ is the number $$e$$.

Thus the formula gives what is known as a normal form for recursive functions.

Hence, see Kleene's Normal Form Theorem.