Time classes #
The three parametric time classes, each relative to an encoding enc : α ↪ List Bool of
instances, with a bound t : ℕ → ℕ of the length n of the encoded instance, up to constants
c₁ * t n + c₂:
Cslib.Complexity.DTIME enc t: decided by a deterministic machine with a binary alphabet and finitely many states within timeO(t n), with any space bound (upstreamTuring.MultiTapeTM.DecidableInTimeAndSpace) Arora and Barak, Definition 1.12. This is the definition of the classes proposed upstream in cslib pull request #767, stated for encoded instances.Cslib.Complexity.NTIME enc t: decided by a nondeterministic machine within timeO(t n)(Turing.MultiTapeNTM.DecidesInTime): every computation path of that length has halted, and the instance is a member exactly when some computation path halts with output[true]Arora and Barak, Definition 2.5.Cslib.Complexity.BPTIME enc t: decided with bounded error by a fair-coin machine within timeO(t n)(Turing.MultiTapePTM.DecidesWithBoundedErrorInTime): every run onTcoins has halted, for the clockT = c₁ * t n + c₂, and the run outputs the right answer,[true]for members and[false]for the others, with probability at least2 / 3Arora and Barak, Definition 7.2.
The unbounded-error class Cslib.Complexity.PPTIME enc t, decided by strict majority by the same
fair-coin machines, is in CslibFrontier.Computability.Complexity.Classes.PP.Time.
Each polynomial class of the library is the union of the corresponding classes of time
O(n ^ k), as in the textbook Arora and Barak, Definition 1.13, Theorem 2.6,
Definition 7.2:
P (Cslib.Complexity.mem_P_iff_exists_mem_DTIME), NP
(Cslib.Complexity.mem_NP_iff_exists_mem_NTIME, through the machine characterisation
Cslib.Complexity.mem_NP_iff_decidableInPolyTime) and BPP
(Cslib.Complexity.mem_BPP_iff_exists_mem_BPTIME). For BPP, defined by polynomial-time
verifiers reading random strings, this is the characterisation by probabilistic machines: a
verifier is run on sampled coins by a fair-coin machine compiled with a halting polynomial clock
(Cslib.Probability.IsPPTOn.exists_halting_machine), and a fair-coin machine halting within T
steps is a verifier replaying T coins
(Turing.MultiTapePTM.computableInPolyTime_decide_runClosedCoins).
Timed reductions #
A problem B decidable within time O(t' m) on instances of length m pulls back along a
function g computable within time O(T a) to a problem decidable within time
O(T a + t' |encB (g a)|) (Cslib.Complexity.preimage_mem_DTIME): compute g a, then decide
whether it is in B. A decider of B within time O(t' m) gives a plain ComputableInO
certificate within time and space O(t' m)
(Cslib.Complexity.computableInO_indicator_of_mem_DTIME), in which computations compose.
Main definitions #
Cslib.Complexity.DTIME,Cslib.Complexity.NTIME,Cslib.Complexity.BPTIME.Turing.MultiTapePTM.DecidesWithBoundedErrorInTime: bounded error within a clock.
Main results #
Cslib.Complexity.DTIME_mono_of_le_mul_add,Cslib.Complexity.NTIME_mono_of_le_mul_add,Cslib.Complexity.BPTIME_mono_of_le_mul_add: the classes absorb constant factors.Cslib.Complexity.computableInO_indicator_of_mem_DTIME: a decider within the same time and space bounds up to constants.Cslib.Complexity.preimage_mem_DTIME:DTIMEunder timed reductions.Cslib.Complexity.DTIME_mono_of_eventually_le,Cslib.Complexity.NTIME_mono_of_eventually_le,Cslib.Complexity.BPTIME_mono_of_eventually_le: the classes only depend on the bound eventually.Cslib.Complexity.DTIME_subset_NTIME: a deterministic machine is a nondeterministic machine.Cslib.Complexity.mem_P_iff_exists_mem_DTIME,Cslib.Complexity.mem_NP_iff_exists_mem_NTIME,Cslib.Complexity.mem_BPP_iff_exists_mem_BPTIME: the polynomial classes are unions of time classes.
References #
machine decides A with bounded error within t, relative to the encoding enc: on every
encoded instance enc a, every run of t a steps with fair coins has halted, and the run outputs
[true] if a ∈ A, and [false] otherwise, with probability at least 2 / 3.
Instances For
Time bounds can be increased: a halted run ignores further coins.
Deterministic time #
The problems decidable within time O(t n), that is c₁ * t n + c₂ for constants c₁ and
c₂, on instances whose encoding under enc has length n, by a machine with a binary alphabet
and finitely many states, with any space bound
Arora and Barak, Definition 1.12.
Instances For
A Boolean function, computable within a time bound of the length of the encoded instance, decides a problem within that time.
A problem in DTIME enc t is decided by a machine computing its indicator within time
and space O(t n), on instances whose encoding has length n.
DTIME under timed reductions. If B is decidable within time O(t' m) on instances whose
encoding has length m, and g is computable within time O(T a), then g ⁻¹' B is decidable
within time O(t n) on instances whose encoding has length n, as soon as T a + t' |encB (g a)|
is within O(t |enc a|): compute g a, then decide whether it is in B.
Nondeterministic time #
The problems decidable within time O(t n), that is c₁ * t n + c₂ for constants c₁ and
c₂, on instances whose encoding under enc has length n, by a nondeterministic machine with a
binary alphabet and finitely many states: every computation path of that many steps has halted,
and a ∈ A exactly when some computation path halts with output [true]
Arora and Barak, Definition 2.5.
Instances For
Bounded-error probabilistic time #
The problems decidable with bounded error within time O(t n), that is c₁ * t n + c₂ for
constants c₁ and c₂, on instances whose encoding under enc has length n, by a fair-coin
machine with a binary alphabet and finitely many states: every run of that many steps has halted,
and outputs the right answer with probability at least 2 / 3
Arora and Barak, Definition 7.2.
Instances For
The polynomial classes #
NP is the union of the classes NTIME (n ^ k), through the characterisation of NP by
nondeterministic machines Arora and Barak, Theorem 2.6.
Bounded-error polynomial time #
BPP is the union of the classes BPTIME (n ^ k) Arora and Barak, Definition 7.2,
Section 7.1: a polynomial-time verifier run on uniformly sampled random strings is
a fair-coin machine halting within a polynomial clock, and a fair-coin machine halting within the
clock T is a verifier replaying random strings of length T.