Register operations #
The hand-rolled core machines of the reduction emitter's register calculus
(docs/A5-ReductionEmitter.md): skipTM (a one-step no-op, the fold
identity), incRegTM (append one mark to a register), and clearRegTM
(blank a register). All register arithmetic (addition, multiplication,
polynomial evaluation) composes from these via the forRegTM loop
combinator.
Specs are in the ghost-parametrized EmitPred style: registers are the
canonical tapes regTape v, and posts are Function.update equations.
One idle step and halt: the identity for seqTM folds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
IncPhase is finite (it has exactly four states).
Equations
- One or more equations did not get rendered due to their size.
Increment register q: scan right over the marks, write a mark on the
first blank, rewind to cell 1. From regTape d to regTape (d + 1) in
2d + 4 steps; every other tape untouched.
Equations
- One or more equations did not get rendered due to their size.
Instances For
incRegTM Hoare specification. From regTape d in register q, reach
regTape (d + 1) in 2d + 4 steps; the input, output, and every other work
tape are untouched.
Cells of a register holding d mid-clear: positions 1..k blanked,
k+1..d still marked.
Equations
- Complexity.TM.clearRegCells d k j = if j = 0 then Complexity.Γ.start else if j ≤ k then Complexity.Γ.blank else if j ≤ d then Complexity.Γ.one else Complexity.Γ.blank
Instances For
Before any blanking (k = 0), a mid-clear register is exactly regCells d.
After blanking all d marks (k = d), a mid-clear register is regCells 0.
No mid-clear cell at position j ≥ 1 is the ▷ sentinel.
Blanking cell k + 1 of clearRegCells d k advances the sweep to
clearRegCells d (k + 1).
Clear register q: sweep right blanking the marks, rewind to cell 1.
From regTape d to regTape 0 in 2d + 4 steps; every other tape untouched.
Equations
- One or more equations did not get rendered due to their size.
Instances For
clearRegTM Hoare specification. From regTape d in register q, reach
regTape 0 in 2d + 4 steps; everything else untouched.