Proofs for the CSLib multi-tape simulation #
Two layers of proof support Complexitylib.Interop.Cslib.MultiTape.
- Generic CSLib facts (namespace
Complexity.MultiTape): one step of a running configuration field by field, the input-head arithmetic, and a space bound ofk (t + 1)cells. - The simulation (namespace
Complexity.TM):MultiTapeSimrelates our configuration to a simulator configuration.TapeSimcovers each one-sided tape with its data and marker tapes, andZoneOKwithinputAction_speccovers the input head. One simulator step follows each of our steps (MultiTapeSim.step). After our machine halts, the rewind phase (Rewinding.run) emits the verdict, andtoMultiTape_computesFunassembles the time and space bounds.
The effect of an optional write on a CSLib work tape.
Equations
- Complexity.MultiTape.applyWrite cells pos none = cells
- Complexity.MultiTape.applyWrite cells pos (some s) = Function.update cells pos s
Instances For
One step from a running configuration, field by field.
Each work head visits at most t + 1 cells in t steps, so a machine with
k work tapes uses at most k * (t + 1) cells.
The data tape at pos with cells cells and the marker tape at mpos with
cells marks simulate our one-sided tape t: both heads at t's head, data
cells 1, 2, … equal to t's (CSLib blank read as □), the marker tape
unchanged, and ▷ only in cell 0 of t.
- inv : t.StartInvariant
Instances For
oneSidedWrite and oneSidedMove simulate one write-and-move.
The zone flag is consistent with the input head position h on an input
of length N.
Equations
- Complexity.TM.ZoneOK N h Complexity.TM.InputZone.left = (h = 0)
- Complexity.TM.ZoneOK N h Complexity.TM.InputZone.inner = (1 ≤ h)
- Complexity.TM.ZoneOK N h Complexity.TM.InputZone.probe = (h ≤ N)
Instances For
The input bookkeeping of inputAction tracks one input-head move. Here
pos is CSLib's clamped input head, o the overshoot counter, sym the input
symbol, and ov the counter tape's symbol.
Our read-write tapes in the simulator's order: work tapes, then the output tape.
Equations
- Complexity.TM.simTape c i = Fin.lastCases c.output c.work i
Instances For
The simulator's configurations on input x.
Equations
- tm.SimCfg x = Turing.Cfg (Complexity.TM.simTapes n) Bool (Complexity.TM.MultiTapeState tm.Q) x
Instances For
The simulator reads our input symbol.
The overshoot counter reads 1 exactly when the input head is at most one
cell past the input.
One step of our machine is one step of the simulator.
A freshly marked marker tape.
After its marking step, the simulator simulates our initial configuration.
A run of our machine is a run of the simulator of the same length.
A decider takes at least one step on every input length: the verdict cell starts blank.
CSLib's encoding of a Boolean verdict as a one-bit output.
Equations
- Complexity.TM.verdictEmb = { toFun := fun (b : Bool) => [b], inj' := Complexity.TM.verdictEmb._proof_1 }
Instances For
The simulator decides what tm decides, within time 2 f + 4 and
space (2n + 3) (2 f + 5) when tm decides within time f.