Polynomial time on the word RAM and on multi-tape Turing machines #
A function with binary output is computable in polynomial time by a multi-tape Turing machine
(Turing.MultiTapeTM.ComputableInPolyTime) exactly when one fixed word-RAM program computes it
on the bits of its input within polynomially many instructions, at every word size above a
polynomial threshold. The two directions are the simulation of Turing machines by the word RAM
(Cslib.WordRAM.OfTuring) and the simulation of the word RAM by Turing machines
(Cslib.WordRAM.Program.ComputesInTime.turingComputableInPolyTime_of_width) Cook and
Reckhow.
Conventions #
- Input. The instance
ais given to the program as its bits, the word list(encIn a).map Bool.toNat, placed as inState.init. - Output. The program returns
f aas one word; the machine writes it in binary (encNat). - Word size. Since one word holds the output, whose bit length is bounded only by the running
time, the threshold
W |encIn a|is polynomial rather than logarithmic. When the values offare polynomial in|encIn a|, so that the output has logarithmically many bits, a logarithmic threshold suffices and the word-RAM side isCslib.WordRAM.UniformComputableInPolyTime; that value bound is also necessary for it. For decision problems, seeCslib.WordRAM.mem_P_iff_uniformPolynomialTime. - Basis. Any basis containing
Basis.additivewhose checked operations are polynomial-time, such asBasis.additive,Basis.arithmeticandBasis.standard.
Main results #
Cslib.WordRAM.computableInPolyTime_map_toNat: the bits of an instance, as words, are computable in polynomial time.Cslib.WordRAM.turingComputableInPolyTime_iff_exists_computesInTime: Turing-machine polynomial time is uniform polynomial word-RAM time at polynomial word sizes.Cslib.WordRAM.turingComputableInPolyTime_iff_uniformComputableInPolyTime: for functions with polynomially bounded values, Turing-machine polynomial time isCslib.WordRAM.UniformComputableInPolyTimeon the bits, at logarithmic word sizes.Cslib.WordRAM.UniformComputableInPolyTime.polyBounded: such word-RAM functions have polynomially bounded values.
References #
The bits of an instance, as words framed as a list of binary naturals, are computable in polynomial time from the instance.
Turing-machine polynomial time is word-RAM polynomial time. Over any basis B containing
Basis.additive whose checked operations are polynomial-time, a function f with binary output is
computable in polynomial time by a multi-tape Turing machine exactly when one fixed word-RAM program
over B computes it on the bits (encIn a).map Bool.toNat of its input, within T |encIn a|
instructions at every word size of at least W |encIn a|, for polynomially bounded T and W.
Logarithmic word sizes #
A uniform polynomial-time word-RAM function has polynomially bounded values. At the
smallest admitted word size, logWidth k |encIn a|, the output f a is one word, so
f a < 2 ^ logWidth k |encIn a| ≤ 2 ^ k (|encIn a| + 1) ^ k.
Turing-machine polynomial time is uniform polynomial word-RAM time at logarithmic word
sizes, for functions with polynomially bounded values. Over any basis B containing
Basis.additive whose checked operations are polynomial-time, let f a be polynomially bounded
in |encIn a|. Then f is computable in polynomial time by a multi-tape Turing machine exactly
when one fixed word-RAM program over B computes it on the bits (encIn a).map Bool.toNat,
within polynomially many instructions in |encIn a|, at every word size above a logarithmic
threshold (Cslib.WordRAM.UniformComputableInPolyTime). The value bound is necessary for the
word-RAM side (Cslib.WordRAM.UniformComputableInPolyTime.polyBounded); without it, see
Cslib.WordRAM.turingComputableInPolyTime_iff_exists_computesInTime.