Documentation

CslibFrontier.Computability.Complexity.Classes.FunctionTime.WordRAM

Word-RAM time bounds give deterministic time bounds #

A fixed Basis.additive program that computes f within T n instructions on the bits of an input of length n, at every word size of at least the logarithmic threshold logWidth k n, gives f ∈ FTIME encIn encNat (t + (n + T + 1) ^ 4 · (k (size n + 1) + 1) ^ 3), provided the time bound T n itself is computable from the input in time O(t n). For T n ≥ n this is O(t n + T(n) ^ 4 log³ n). The decision version gives the same bound in DTIME.

The simulating machine runs at the word size k (size n + 1) = Θ(k log n), and its overhead is the explicit polynomial of Program.ComputesInTime.computableInO_of_width_additive. The clock hypothesis on T is needed because the machine computes its own step budget. The exponent 4 comes from the association-list memory of the simulator, whose scans are cubic in the encoded state; it is not a property of the word-RAM model.

The input convention is that of CslibFrontier.Computability.WordRAM.Invariance: the words are the bits of encIn a, and the size is |encIn a|. Together with the converse simulations of CslibFrontier.Computability.WordRAM.OfTuring, this transfers word-RAM running times to the time classes beyond P.

Main results #

References #

theorem Cslib.WordRAM.Program.ComputesInTime.computableInO_bits {α : Type} {encIn : α ↪ List Bool} {r k : ℕ} (hk : 1 ≤ k) {p : Program Basis.additive r} {T t : ℕ → ℕ} {f : α → ℕ} (h : p.ComputesInTime (fun (x : ℕ) (a : α) => List.map Bool.toNat (encIn a)) (fun (a : α) (x : ℕ) => T (encIn a).length) (fun (a : α) (w : ℕ) => logWidth k (encIn a).length ≤ w) f) (hT : (fun (a : α) => T (encIn a).length) ∈ Complexity.FTIME encIn Turing.MultiTapeTM.encNat t) :
∃ (S : ℕ → ℕ), Turing.MultiTapeTM.ComputableInO f encIn Turing.MultiTapeTM.encNat (fun (a : α) => t (encIn a).length + ((encIn a).length + T (encIn a).length + 1) ^ 4 * (k * ((encIn a).length.size + 1) + 1) ^ 3) fun (a : α) => S (encIn a).length

The simulation of the bit-list convention at logarithmic word size, with time O(t n + (n + T n + 1) ^ 4 · (k (size n + 1) + 1) ^ 3) and a space bound depending only on the input length n.

theorem Cslib.WordRAM.Program.ComputesInTime.mem_FTIME {α : Type} {encIn : α ↪ List Bool} {r k : ℕ} (hk : 1 ≤ k) {p : Program Basis.additive r} {T t : ℕ → ℕ} {f : α → ℕ} (h : p.ComputesInTime (fun (x : ℕ) (a : α) => List.map Bool.toNat (encIn a)) (fun (a : α) (x : ℕ) => T (encIn a).length) (fun (a : α) (w : ℕ) => logWidth k (encIn a).length ≤ w) f) (hT : (fun (a : α) => T (encIn a).length) ∈ Complexity.FTIME encIn Turing.MultiTapeTM.encNat t) :
f ∈ Complexity.FTIME encIn Turing.MultiTapeTM.encNat fun (n : ℕ) => t n + (n + T n + 1) ^ 4 * (k * (n.size + 1) + 1) ^ 3

Word-RAM time gives function time. A Basis.additive program computing f within T n instructions on the bits of an input of length n, at every word size of at least logWidth k n, computes a function in FTIME encIn encNat with bound t n + (n + T n + 1) ^ 4 · (k (size n + 1) + 1) ^ 3, when T n is computable from the input in time O(t n).

theorem Cslib.WordRAM.Program.DecidesInTime.mem_DTIME {α : Type} {encIn : α ↪ List Bool} {r k : ℕ} (hk : 1 ≤ k) {p : Program Basis.additive r} {T t : ℕ → ℕ} {A : Set α} (h : p.DecidesInTime (fun (x : ℕ) (a : α) => List.map Bool.toNat (encIn a)) A (fun (a : α) (x : ℕ) => T (encIn a).length) fun (a : α) (w : ℕ) => logWidth k (encIn a).length ≤ w) (hT : (fun (a : α) => T (encIn a).length) ∈ Complexity.FTIME encIn Turing.MultiTapeTM.encNat t) :
A ∈ Complexity.DTIME encIn fun (n : ℕ) => t n + (n + T n + 1) ^ 4 * (k * (n.size + 1) + 1) ^ 3

Word-RAM decision time gives deterministic time. A Basis.additive program deciding A within T n instructions on the bits of an input of length n, at every word size of at least logWidth k n, puts A in DTIME encIn with bound t n + (n + T n + 1) ^ 4 · (k (size n + 1) + 1) ^ 3, when T n is computable from the input in time O(t n).