Normalized URM Program

Theorem
Let $$P$$ be a URM program.

Let $$l = \lambda \left({P}\right)$$ be the number of basic instructions in $$P$$.

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

Then $$P$$ can be modified as follows:
 * Every Jump of the form $$J \left({m, n, q}\right)$$ where $$q > l$$ may be replaced by $$J \left({m, n, l+1}\right)$$;
 * If $$u > 0$$, a Clear Registers Program $$Z \left({2, u}\right)$$ can be appended to the end of $$P$$ at lines $$l+1$$ to $$l+u-1$$.

The new program $$P'$$ that results from the above modifications produces exactly the same output as $$P$$ for each input.

Note now though that $$\lambda \left({P'}\right) = l + u - 1$$.

Such a program as $$P'$$ is called a normalized URM program.

The point of doing this is so as to make programs easier to concatenate. Once the above have been done, each program has a well-defined exit line which can be used as the start line of the program that immediately follows it.

Proof
Each Jump of the form $$J \left({m, n, q}\right)$$ where $$q > l$$ leads to a line which does not contain an instruction.

The line $$J \left({m, n, l+1}\right)$$ likewise contains no instructions, by definition.

Therefore, when jumping to $$J \left({m, n, l+1}\right)$$ the program behaves in exactly the same way: that is, it stops when the instruction $$J \left({m, n, l+1}\right)$$ causes the program to jump to line $$l+1$$.

After the URM program has terminated, its output sits in $$R_1$$ by convention.

Once the URM program reaches line $$l+1$$ it has by definition terminated, and because of the modifications to the Jumps as defined above, there is no other way that it can terminate.

Any further instructions that are added to a URM program that are placed at line $$l+1$$ and those following will therefore be executed in order (as long as none of them are Jumps) and the program will then really terminate.

By adding the Clear Registers Program $$Z \left({2, u}\right)$$ to the end of $$P$$, the only effect this will have on the operation of the program is to clear all the registers to $$0$$ except the one the output is in.