The routines: specifications of the instructions #
Each instruction's specification is a reachability statement: from a configuration at
the instruction's first phase, with the tapes it reads in a stated shape, a bounded
number of steps leads to the configuration at the next instruction, with the stated
effect on the tapes it touches and none on the others (Untouched).
The control at (k, pc), first phase.
Equations
- MIPRE.TM.Interp.at_ k pc = some { k := k, pc := pc, ph := MIPRE.TM.Interp.Phase.p0 }
Instances For
c' agrees with c on the input heads outside SI and on the work tapes outside SW.
Equations
- MIPRE.TM.Interp.Untouched c c' SI SW = ((∀ j ∉ SI, c'.inputPos j = c.inputPos j) ∧ ∀ d ∉ SW, c'.workTapes d = c.workTapes d ∧ c'.workTapePos d = c.workTapePos d)
Instances For
One step of an instruction #
One step at (k, pc, ph) executing the instruction ins there.
write #
move #
toEnd #
rewind #
The scan of rewind from p1: cells pos - n + 1 … pos not blank, pos - n blank.
From cell p + n with cells p … p + n - 1 not blank and p - 1 blank, rewind
reaches cell p (the head may start on the blank after the content).
eraseRight #
The erasing scan of eraseRight (p1): erase the l held from the head, then one
left.
The return scan of eraseRight (p2): back over n blanks to the $, erase it.
Erase the l held from the head (no $ among its symbols), ending where it started.
copyUntil #
Copy the l held from the head of src (none of whose symbols is m) onto dst,
stopping with the src head on the m after it.
branch, jump, emit, halt #
Scanning left #
The scan of leftToMarker (phase p1): over the cells pos - n + 1 … pos, none holding
m, to the marker or blank at pos - n, then one right.
leftToMarker: from pos, with l (no m) on pos - |l| … pos - 1 and the marker or a
blank at pos - |l| - 1, to pos - |l|.
popBack #
The scan of popBack (phase p2): erase the cells pos - n + 1 … pos, none holding m,
to the marker or blank at pos - n, then one right.
popBack on an empty tape: two steps, nothing.
popBack: from the end pos, with l ++ [a] on pos - |l| - 1 … pos - 1, l free of
m, and the marker or a blank before: erase them, ending at pos - |l| - 1.
The budget and the counter #
A unary tape: n ones from cell 0, blank elsewhere.
Equations
Instances For
charge: one step left, then a pop per unit; halts on an exhausted budget.