Polynomial-space simulation and configuration-count clocks #
This module provides general configuration-count clock theorems and polynomial-space simulation
certificates for Turing.MultiTapeTM.Universal:
- Configuration-count clocks (
exists_simSpace_le_and_universal_eq_true_iff,exists_budgetedUniversal_eq_true_iff): Any simulation ofdonxthat stays withinsvisited work-tape cells (or within ab-bit encoded configuration budget) and halts at some steptalready halts with the same output at some stept₀ ≤ 2 ^ (b + 1)wherecfgSpaceBound (descLen d) x.length d.tapes s ≤ b. Before the first halting stept₀, every step visits a distinct configuration inCslib.BitString.shortWords b. - Visited-cell-budgeted universal simulation (
spaceBoundedUniversal,computableInPolySpace_spaceBoundedUniversal): WhilebudgetedUniversalbounds the bit-length of encoded configurations,spaceBoundedUniversal (d, x, t, s)tracks the per-tape head excursions ofrun d xand enforces the exact visited work-tape cell boundsimSpace d x t ≤ s. BothbudgetedUniversalandspaceBoundedUniversalare computable in polynomial space with respect toeInSandeOut.
Main definitions #
Turing.MultiTapeTM.Universal.initBounds,Turing.MultiTapeTM.Universal.updateBounds,Turing.MultiTapeTM.Universal.boundsSpace,Turing.MultiTapeTM.Universal.boundsAt: per-tape left/right head excursion bounds forrun d xand their total visited cell count.Turing.MultiTapeTM.Universal.SpaceLoopState,Turing.MultiTapeTM.Universal.spaceLoopInit,Turing.MultiTapeTM.Universal.spaceLoopStep: the loop state and transition for visited-space bounded simulation.Turing.MultiTapeTM.Universal.spaceBoundedUniversal: universal simulation enforcing the exact visited work-tape cell budgetsimSpace d x t ≤ s.
Main results #
Turing.MultiTapeTM.Universal.boundsSpace_boundsAt:boundsSpace (boundsAt d x j) = simSpace d x j.Turing.MultiTapeTM.Universal.exists_simSpace_le_and_universal_eq_true_iff: a simulation halts withinsvisited work-tape cells with a given output at some step if and only if it has halted withinsvisited cells with that output by step2 ^ (b + 1).Turing.MultiTapeTM.Universal.exists_budgetedUniversal_eq_true_iff: clocked equivalence forbudgetedUniversal.Turing.MultiTapeTM.Universal.spaceBoundedUniversal_eq_singleton_true_iff:spaceBoundedUniversal (d, x, t, s) = ([n], true) ↔ simSpace d x t ≤ s ∧ universal (d, x, t) = ([n], true).Turing.MultiTapeTM.Universal.computableInPolySpace_budgetedUniversal,Turing.MultiTapeTM.Universal.computableInPolySpace_spaceBoundedUniversal: polynomial-space certificates forbudgetedUniversalandspaceBoundedUniversal.
Halting and space stabilization for run, universal, and simSpace #
Configuration-count clock for visited-space simulations: if universal (d, x, t) halts at
some step t with simSpace d x t ≤ s, then for any b ≥ cfgSpaceBound (descLen d) x.length d.tapes s, it already halts with the same output at some step t₀ ≤ 2 ^ (b + 1) with
simSpace d x t₀ ≤ s.
Clocked equivalence for visited-space simulations: for any b ≥ cfgSpaceBound (descLen d) x.length d.tapes s and any step count T ≥ 2 ^ (b + 1), there exists a step t with
simSpace d x t ≤ s and universal (d, x, t) = (out, true) if and only if simSpace d x T ≤ s
and universal (d, x, T) = (out, true).
Configuration-count clock and polynomial-space certificate for budgetedUniversal #
Once the budgeted run from (init d, []) halts at step t, it remains at the same pair at
every later step T ≥ t.
Configuration-count clock for budgetedUniversal: if budgetedUniversal (d, x, t, b)
halts at some step t, then it already halts with the same output at some step t₀ ≤ 2 ^ (b + 1).
Before the first halting step t₀, every step must fit within the b-bit configuration budget and
visit a distinct configuration in shortWords b.
Clocked equivalence for budgetedUniversal: for any step count T ≥ 2 ^ (b + 1), there
exists a step t at which budgetedUniversal (d, x, t, b) = (out, true) if and only if
budgetedUniversal (d, x, T, b) = (out, true).
budgetedUniversal is computable in polynomial space (in fact linear space) with respect
to eInS and eOut.
Visited-cell-budgeted universal simulation (spaceBoundedUniversal) #
At step j, for every work tape i < d.tapes, the visited positions visited d x j i form
the integer interval [ -l, r ] where (l, r) = (boundsAt d x j).getD i (0, 0), and the current
head headAt d x j i lies in [ -l, r ].
boundsSpace (boundsAt d x j) equals simSpace d x j.
Loop state for visited-space bounded universal simulation.
- desc : Desc
Description of the simulated machine.
Simulated input symbols.
- space : ℕ
Visited work-tape cell budget.
- cfg : SCfg
Current simulated configuration.
First two output symbols emitted so far.
Per-tape head excursion bounds
(leftMax, rightMax).- withinSpace : Bool
Whether every step up to the current configuration stayed within
spacevisited cells.
Instances For
Canonical encoding of SpaceLoopState.
Initial state for spaceBoundedUniversal (d, x, t, s).
One step of visited-space bounded simulation: if st.withinSpace holds, compute the next
simulated configuration and updated excursion bounds; if the resulting visited cell count
boundsSpace bounds' stays within st.space, advance to the new configuration and bounds,
otherwise freeze the state and record withinSpace := false.
Visited-cell-budgeted universal simulation: run spaceLoopStep for t steps on
spaceLoopInit i and return the first two output symbols together with whether the run stayed
within s visited work-tape cells and halted.
Characterization of spaceLoopStep^[k] (spaceLoopInit (d, x, t, s)):
- when
simSpace d x k ≤ s, the loop state is at stepkofrun d xwithwithinSpace = true; - when
¬ simSpace d x k ≤ s,withinSpace = falseand the loop state is frozen at some stepj ≤ kwithj = 0 ∨ simSpace d x j ≤ s.
Every reachable state of spaceLoopStep from spaceLoopInit (d, x, t, s) is at some step
j ≤ k of run d x with j = 0 ∨ simSpace d x j ≤ s.
When simSpace d x t ≤ s, spaceBoundedUniversal (d, x, t, s) returns the first two output
symbols of universal (d, x, t) and whether it has halted.
Characterization of spaceBoundedUniversal acceptance:
spaceBoundedUniversal (d, x, t, s) = (out, true) holds if and only if simSpace d x t ≤ s,
(universal (d, x, t)).1.take 2 = out, and (universal (d, x, t)).2 = true.
Singleton-output characterization of spaceBoundedUniversal:
spaceBoundedUniversal (d, x, t, s) = ([n], true) holds if and only if simSpace d x t ≤ s and
universal (d, x, t) = ([n], true).
Clocked equivalence for spaceBoundedUniversal with singleton output: for any
b ≥ cfgSpaceBound (descLen d) x.length d.tapes s and T ≥ 2 ^ (b + 1), there exists a step t
at which spaceBoundedUniversal (d, x, t, s) = ([n], true) if and only if
spaceBoundedUniversal (d, x, T, s) = ([n], true).
Polynomial-time step and polynomial-space certificate for spaceBoundedUniversal #
init is computable in polynomial time.
Keeping the first two output symbols after appending an optional symbol is computable in polynomial time.
initBounds is computable in polynomial time.
updateBounds is computable in polynomial time.
boundsSpace is computable in polynomial time.
spaceLoopInit is computable in polynomial time from eInS to eSpaceLoopState.
spaceLoopStep is computable in polynomial time on eSpaceLoopState.
spaceBoundedUniversal is computable in polynomial space with respect to eInS and
eOut.