Proof (computability of shortlex ordering)

"What is the relationship of the lengths of content in registers $i$ and $j$?"

  1. Copy the contents of registers $i,j$ to unused registers $i', j'$.

  2. If both registers $i'$ and $j'$ are non-empty:

    1. Remove the final letters from both registers.

    2. Go to 2.

  3. If both registers $i'$ and $j'$ are empty,

    1. answer "they are of equal length".

  4. If register $i'$ is empty but register $j'$ is not,

    1. answer "the content of register $i$ is shorter than the content of register $j$".

  5. If register $j'$ is empty but register $i'$ is not,

    1. answer "the content of register $j$ is shorter than the content of register $i$".

Characterstic function of $\sb{(v,w)}{v<w}$

  1. Compare the lengths of $v$ and $w$.

  2. If $|v|<|w|$,

    1. empty register 0, add $a$ to it, and halt.

  3. If $|w|<|v|$,

    1. empty register 0 and halt.

  4. If $|w|=|v|$:

    1. Copy $v,w$ into unused registers in reverse order.

    2. If both registers are non-empty:

      1. Remove final letters $v(i), w(i)$ from both registers.

      2. If $v(i) < w(i)$,

        1. empty register 0, add $a$ to it, and halt.

      3. If $w(i) < v(i)$,

        1. empty register 0 and halt.

      4. Go to 4.2.

    3. Otherwise empty register 0 and halt.

Finding immediate successor of a word $w$

Suppose we have an ordering $a_0 < a_1 < \ldots < a_n$ on $Σ$.

  1. Empty an unused register $j$.

  2. If a final letter (say $a_l$) can be moved from $w$ to register $j$:

    1. If $a_l=a_n$:

      1. Go to 2.

    2. Otherwise:

      1. Add $a_{l+1}$ to $w$.

      2. Add as many letters $a_0$ to $w$ as there are letters in register $j$.

      3. Halt.

  3. Otherwise:

    1. Add as many letters $a_0$ to $w$ as there are letters in register $j$.

    2. Add one more $a_0$.