Clear Registers Program

From ProofWiki
Jump to navigation Jump to search

URM Program

Let $a, b \in \N$ be natural numbers such that $0 < a$.

Then we define the URM program $Z \left({a, b}\right)$ to be:

Line Command
$1$ $Z \left({a}\right)$
$2$ $Z \left({a + 1}\right)$
$3$ $Z \left({a + 2}\right)$
$\vdots$ $\vdots$
$b - a + 1$ $Z \left({b}\right)$

This program clears (that is, sets to $0$) all the registers from $R_a$ through to $R_b$.

If $a > b$ then $Z \left({a, b}\right)$ is the null URM program.


The length of $Z \left({a, b}\right)$ is:

$\lambda \left({Z \left({a, b}\right)}\right) = \begin{cases} 0 & : a > b \\ b - a + 1 & : a \le b \end{cases}$


Proof

Self-evident.

$\blacksquare$