Documentation

Complexitylib.Classes.Containments

Containment relations between complexity classes #

This file collects the standard containment results between complexity classes.

Theorems #

DTIME ⊆ NTIME: every language decidable by a DTM in time O(T) is also decidable by an NTM in time O(T), via the TM.toNTM embedding.

theorem Complexity.DTIME_mono {T₁ T₂ : } (h : BigO T₁ T₂) :
DTIME T₁ DTIME T₂

DTIME is monotone with respect to =O: if T₁ =O T₂, then DTIME T₁ ⊆ DTIME T₂.

P ⊆ EXP: every polynomial-time language is also exponential-time.

DTIME ⊆ DSPACE: a DTM running in time T uses at most O(T) auxiliary space, since every two-way tape head can move at most one cell per step.

P ⊆ PSPACE: every polynomial-time language uses polynomial space.

RTIME ⊆ NTIME: one-sided error implies nondeterministic. The same NTM works: RejectsWithProb 0 means no accepting paths for x ∉ L, and AcceptsWithProb (1/2) means some accepting path exists for x ∈ L.

DTIME ⊆ BPTIME: every deterministic TM can be viewed as a PTM with zero error. When the DTM accepts, all paths accept (prob = 1 ≥ 2/3). When it rejects, no path accepts (prob = 0 ≤ 1/3).

P ⊆ BPP: every polynomial-time language is also in BPP.

theorem Complexity.NTIME_mono {T₁ T₂ : } (h : BigO T₁ T₂) :
NTIME T₁ NTIME T₂

NTIME is monotone: if T₁ =O T₂, then NTIME T₁ ⊆ NTIME T₂.

theorem Complexity.DSPACE_mono {S₁ S₂ : } (h : BigO S₁ S₂) :
DSPACE S₁ DSPACE S₂

DSPACE is monotone: if S₁ =O S₂, then DSPACE S₁ ⊆ DSPACE S₂.

NP ⊆ NEXP: every nondeterministic polynomial-time language is also nondeterministic exponential-time.

EXP ⊆ NEXP: every deterministic exponential-time language is also nondeterministic exponential-time.

BPTIME ⊆ PPTIME: two-sided bounded error implies unbounded error, since 2/3 > 1/2 and 1/3 < 1/2.

theorem Complexity.P_compl {L : Language} (h : L P) :

P is closed under complement: if L ∈ P then Lᶜ ∈ P.

DSPACE ⊆ NSPACE: every language decidable by a DTM in space O(S) is also decidable by an NTM in space O(S), via the TM.toNTM embedding.

theorem Complexity.NSPACE_mono {S₁ S₂ : } (h : BigO S₁ S₂) :
NSPACE S₁ NSPACE S₂

NSPACE is monotone: if S₁ =O S₂, then NSPACE S₁ ⊆ NSPACE S₂.

L ⊆ NL: every deterministic log-space transducer language is also in NL.

ZPP ⊆ RP: zero-error probabilistic ⊆ one-sided error.

DTIME ⊆ NSPACE (composition of DTIME ⊆ DSPACE and DSPACE ⊆ NSPACE).

P ⊆ NPSPACE via P ⊆ PSPACE ⊆ NPSPACE.

P ⊆ NEXP via P ⊆ EXP ⊆ NEXP.

P ⊆ PP via P ⊆ BPP ⊆ PP.

theorem Complexity.P_union {L₁ L₂ : Language} (h₁ : L₁ P) (h₂ : L₂ P) :
L₁ L₂ P

P is closed under union: derived from DTIME_union and polynomial-bound composition.

theorem Complexity.P_inter {L₁ L₂ : Language} (h₁ : L₁ P) (h₂ : L₂ P) :
L₁ L₂ P

P is closed under intersection: via L₁ ∩ L₂ = (L₁ᶜ ∪ L₂ᶜ)ᶜ.