Explicit overhead of the word-RAM simulation by Turing machines #
Program.ComputesInTime.turingComputableInPolyTime_of_width simulates a word-RAM program by a
multi-tape Turing machine in polynomial time of unnamed degree. Here the degree is explicit. If
every primitive of the basis has degree d (Model.NativePrimitives.HasDegree), a run of at most
T instructions on n input words at word size w costs
O((T + 1) · ((n + T + 1)(w + 1)) ^ max 3 d) machine steps, on top of computing the word size,
the input words and the step budget. Only the constant factor is hidden. For Basis.additive,
whose primitives are quadratic (Basis.additive.quadraticPrimitives), the exponent is 3. The
cube comes from scanning the association-list memory of the simulator
(SparseMemory.scanTime_le_cube), not from the word-RAM model.
The simulation is the same as in CslibFrontier.Computability.WordRAM.Turing. The new ingredients
are
the degree-tracking certificates of CslibFrontier.Computability.GenericRAM.Simulation.Degree, a
cubic initialization certificate (initMemory_degree, a counted fold), and quadratic certificates
for the conventions of CslibFrontier.Computability.WordRAM.Invariance with logarithmic word size:
the bit list of the input as words (bitsToNats_degree) and the word size k (size n + 1)
(logWidthBound_degree).
Main results #
Cslib.WordRAM.initMemory_degree: building the initial memory is cubic.Cslib.WordRAM.Program.ComputesInTime.computableInO_of_width: the simulation at a supplied width schedule, with timeO(|x| + Tw + Te + Ts + (T + 1) · ((n + T + 1)(w + 1)) ^ max 3 d).Cslib.WordRAM.Program.ComputesInTime.computableInO_of_width_additive: the case ofBasis.additive, with exponent3.Cslib.WordRAM.bitsToNats_degree,Cslib.WordRAM.logWidthBound_degree: quadratic input conversion and word size for the bit-list convention.
References #
Encoded lengths #
A word list that fits w-bit words has encoded length at most n (2 w + 1).
stateBound is linear in the number of stored cells and in the word size.
Initialization with an explicit degree #
The counted fold is cubic, with quadratic output.
Building the initial memory is cubic in the encoded input words, with quadratic output.
The certificate of initMemory, cubic in the encoded input words.
The simulation with an explicit degree #
Word-RAM time gives Turing-machine time with an explicit polynomial overhead.
Let every primitive of the basis have degree d (Model.NativePrimitives.HasDegree), and let p
compute f (Program.ComputesInTime). Suppose a machine computes the word size width a in unary
in time O(Tw a), the input words encode (width a) a in time O(Te a) and a step budget
steps a ≥ time a (width a) in binary in time O(Ts a); the word size must be admitted and the
input words must fit it. Then f is computable with binary output in time
O(|encIn a| + Tw a + Te a + Ts a + (steps a + 1) · R ^ max 3 d), where
R = (n + steps a + 1) · (width a + 1) and n is the number of input words. The degree is
explicit; only the constant factor is hidden.
The additive word RAM, with the exponent 3. A run of Basis.additive within
steps a instructions on n input words at word size w costs
O(|encIn a| + Tw a + Te a + Ts a + (steps a + 1) · ((n + steps a + 1)(w + 1)) ^ 3) Turing-machine
steps; see Program.ComputesInTime.computableInO_of_width.
The bit-list convention with logarithmic word size #
The bits of a list as words, in quadratic time.
The length of a bit list in binary, in quadratic time.
Multiplying a unary number by a constant is linear.
The word size k (size n + 1) of an input of length n, in unary, in quadratic time. It
is at least the logarithmic threshold logWidth k n.