Proof internals for simulating CSLib machines on Complexitylib machines #
Folding lemmas for the simulator Complexity.FromMultiTape.toTM: the cell
layout of a folded two-way tape, and the head moves of the three phases of a
simulated step.
Our symbol storing a binary CSLib cell.
Equations
Instances For
Folded cells are never the left-end cell.
A folded tape simulating the CSLib tape f with head at z; the sign flag
s records whether z is negative.
The head is on the folded cell of
z.The sign flag says whether
zis negative.Cell 0 holds
▷.Every folded cell stores its CSLib cell.
Instances For
A right move increments the head.
The head moves of phases 0, 1 and 2 on a folded tape whose only ▷
is cell 0 carry the head from the folded cell of z to that of z + m, and
update the sign flag.
The CSLib tape after the write wr.
Equations
- Complexity.FromMultiTape.applyWr f z none = f
- Complexity.FromMultiTape.applyWr f z (some c) = Function.update f z c
Instances For
One simulated step on a folded work tape. Phases 0, 1 and 2 carry a
folded tape simulating CSLib tape f with head z to one simulating the
CSLib tape after the write wr and the move m.
One simulated step on the input tape. Phases 0, 1 and 2 move our
input head from CSLib's input position p to the position reached by CSLib's
clamped move m.
Our output tape holds the CSLib output out after ▷, with the head just
past it.
The head is just past the output.
▷sits exactly at cell 0.Cells
1, …, |out|hold the output.
Instances For
One simulated step on the output tape. Phase 0 appends the emitted
bit e; phases 1 and 2 leave the tape alone.
One step of the simulator from a configuration that has not halted.
The simulation relation between our configuration c and a CSLib
configuration d on input x, at the start of a simulated step.
The input head is on CSLib's input position.
The input tape is untouched.
- work (j : Fin k) : FoldRel (c.work j) (d.workTapes j) (d.workTapePos j) (decide (d.workTapePos j < 0))
Each work tape folds its CSLib work tape.
The output tape holds CSLib's output.
Instances For
One CSLib step from a running configuration, field by field.
One simulated step. From the simulation relation at a CSLib step that does not halt, three steps of the simulator restore the relation.
The halting step. From the simulation relation at a CSLib step that halts, one step of the simulator halts with CSLib's final output.
The CSLib initial configuration on input x.
Equations
Instances For
The first step. One step of the simulator moves every head off ▷ and
establishes the simulation relation with CSLib's initial configuration.
The run. While CSLib has not halted after n steps, the simulator
reaches, after 3 n + 1 steps, a configuration related to CSLib's.
The simulator decides what CSLib decides. If M computes the indicator
of L within time t, the simulator decides L within time 3 t.