Documentation

CslibFrontier.Computability.WordRAM.OfTuring.Space

Word RAMs simulate space-bounded multi-tape Turing machines #

Cslib.WordRAM.OfTuring.executes_simProgram bounds the simulated work-tape addresses by the running time t, so its words must hold simBound k m |x| t. A run that visits at most s work cells keeps every work head within [-s, s], so the same simulator works when the words hold only simBound k m |x| s. With polynomial work space, the word size can then stay logarithmic in the input length while the running time is arbitrary, for example 2 ^ o(n).

The proof of Cslib.WordRAM.OfTuring.executes_simProgram_of_runsInSpace is that of Cslib.WordRAM.OfTuring.executes_simProgram, with the time bound on the head positions replaced by the space bound.

Main results #

theorem Turing.MultiTapeTM.natAbs_workTapePos_runFrom_le_of_runsInSpace {k : ℕ} {Q : Type} {tm : MultiTapeTM k Bool Q} {inp : List Bool} {s : ℕ} (h : tm.RunsInSpace inp s) (j : ℕ) (i : Fin k) :
((runFrom (tm.initCfg inp) j).workTapePos i).natAbs ≤ s

A run in space s keeps every work head within distance s of the origin, at every step.

theorem Cslib.WordRAM.OfTuring.executes_simProgram_of_runsInSpace {k m : ℕ} {Q : Type} {tm : Turing.MultiTapeTM k Bool Q} {inp : List Bool} {δ : Q → Option Bool → (Fin k → Option Bool) → Turing.Action k Bool Q} (hδ : ∀ (q : Q) (a : Option Bool) (s : Fin k → Option Bool), tm.tr q a s = δ q a s) (e : Q ≃ Fin m) {t s : ℕ} (ht : (Turing.MultiTapeTM.runFrom (tm.initCfg inp) t).state = none) (hs : tm.RunsInSpace inp s) {w : ℕ} (hw : simBound k m inp.length s < 2 ^ w) (hout : (Turing.MultiTapeTM.runFrom (tm.initCfg inp) t).output.length < w) :

The simulator in space-bounded words. As Cslib.WordRAM.OfTuring.executes_simProgram, but the words need only hold simBound k m |inp| s for a space bound s of the run, instead of simBound k m |inp| t for its running time t. The instruction count is still simTime k m t.

theorem Cslib.WordRAM.uniformDecidableInTimeLogWord_of_decidableInTimeAndSpace {α : Type} {A : Set α} {enc : α ↪ List Bool} {t s : α → ℕ} (h : Turing.MultiTapeTM.DecidableInTimeAndSpace A enc t s) {D e : ℕ} (hs : ∀ (a : α), s a ≤ D * ((enc a).length + 1) ^ e) :
∃ (C : ℕ), UniformDecidableInTimeLogWord Basis.additive A (fun (x : ℕ) (a : α) => List.map Bool.toNat (enc a)) (fun (a : α) => (enc a).length) fun (a : α) (x : ℕ) => C * t a + C

Space-bounded Turing deciders on the word RAM. If a multi-tape machine decides A within time t a and work space s a ≤ D * (|enc a| + 1) ^ e, then one fixed program over Basis.additive, run on the bits of enc a, decides A within C * t a + C instructions at every word size w ≥ logWidth k |enc a|, for constants C and k > 0. Unlike Cslib.WordRAM.DTIME_subset_RAMTIME_additive, the running time need not be polynomially bounded: the words only hold the addresses of visited cells, which the space bound controls.