The counting loop's simulation stage #
⚠️ Unreviewed by Bolton
The loop body runs one path of the source machine and reads off whether it accepts. Three wrappers turn that simulation into something a composed machine can use as a stage:
TM.startedTMmoves the start state past the compulsory▷-step, because no stage of a composed machine can be entered with a head at cell zero;TM.placeWorkTM 0 msets the simulation's tapes beside the loop's own registers, with an exact frame — the registers come back untouched;TM.retargetOutputsends the verdict to a work tape instead of the real output tape, which has to stay blank for the wipe that follows.
None of the three costs a step, and none of them disturbs the others' tapes, so a run of the simulation transports to a run of the stage of exactly the same length.
Main results #
NTM.simTM— the simulation as a stage of the counting machineNTM.simTM_reachesIn— a run of the simulation is a run of the stageNTM.simTM_verdict_tape— the verdict lands on the stage's last work tapeNTM.simTM_run— the stage run to a halt, with the acceptance bit of pathvNTM.simEntry,NTM.simEntry_dropChoice— the configuration the stage is entered atNTM.simTM_frame— the invariants and head bounds the stage leaves behindNTM.simCfg_work_middle,NTM.simCfg_work_extra,NTM.simCfg_counter_cells— where each of the stage's tapes comes from
The simulation as a stage of the counting machine. Its tapes are the source machine's
k work tapes and the choice tape — which is the loop's counter — followed by m registers of
the loop's own and, last, the tape the verdict is written to.
Equations
- tm.simTM m = (Complexity.TM.placeWorkTM 0 m tm.simCore).retargetOutput
Instances For
The stage's entry configuration: the simulation's own configuration, placed beside the loop's registers, with the real output tape blank.
Equations
- tm.simCfg m extras c = (Complexity.TM.placeWorkTM 0 m tm.simCore).retargetCfg (tm.simCore.placeWorkCfg 0 m extras c)
Instances For
A run of the simulation is a run of the stage, of exactly the same length. The loop's registers need only carry their left marker and be parked; they are returned untouched.
The simulation stage, run to a halt with its verdict. From an entry configuration whose
counter carries v and whose simulated tapes are the delayed machine's post-sentinel ones, the
stage halts within the horizon, leaves the loop's registers exactly as it found them, and writes
the acceptance bit of path v onto its last work tape.
The simulation's entry configuration. The delayed machine's post-sentinel state: every
head at cell one, the machine's own tapes blank, and the counter carrying v.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The resumed simulation's start state is the delayed machine's extra state: the sentinel step
reads ▷ on the choice tape, and the delayed machine's first transition ignores its choice bit,
so nothing branches there.
The entry configuration is the delayed machine's post-sentinel one. This is the hypothesis
NTM.choiceTM_delay_haltsIn asks for: the simulation is entered exactly where the compulsory
▷-step would have left the machine.
What the stage leaves behind. Every tape still carries its marker only at cell zero; no head has travelled further than the run was long; the input tape's contents are untouched, since a machine never writes to it. These are the facts the cleanup stage needs, and they hold for any stage, so they are read off the generic run lemmas.
The stage's tapes at the register indices are the registers, untouched.
The simulation leaves the counter's digits alone. choiceTM writes every choice bit back
unchanged and only advances the head, so after the cleanup rewinds it the counter reads as v
again.