Documentation

CslibFrontier.Computability.Complexity.Classes.Alternation

Alternating time and space classes #

The parametric classes of alternating machines (Turing.MultiTapeATM, in CslibFrontier.Computability.Machines.Turing.MultiTape.Alternating) with a binary alphabet and finitely many states Chandra, Kozen and Stockmeyer Sipser, Section 10.3. They are relative to an encoding enc : α ↪ List Bool of instances, with a bound of the length n of the encoded instance, up to constants c₁ * t n + c₂, like Cslib.Complexity.NTIME and Cslib.Complexity.NSPACE:

Chandra, Kozen and Stockmeyer bound only the space of the accepting computations of accepted instances Chandra, Kozen and Stockmeyer, Definition 2.5. Bounding every reachable configuration without asking for halting is recognition within space (Turing.MultiTapeATM.RecognizesInSpace). The classes use the deciding form of Sipser instead, in which every reachable configuration obeys the bound and every branch halts. For bounds S(n) ≥ log n constructible in space S(n) these give the same problems Chandra, Kozen and Stockmeyer, Theorem 2.6(b). The deterministic simulation ASPACE s ⊆ DTIME (2 ^ O(log₂ n + s)) (Cslib.Complexity.exists_mem_DTIME_of_mem_ASPACE, in CslibFrontier.Computability.Complexity.Classes.Alternation.DeterministicTime) is proved for recognizers, so it holds in either convention, with no constructibility hypothesis.

Space counts visited work-tape cells: the input tape is read-only and the output tape write-only. A time bound gives a space bound, so ATIME t ⊆ ASPACE t (Cslib.Complexity.ATIME_subset_ASPACE).

The input head moves one cell per step, as for the deterministic and nondeterministic machines. A machine running within time t n < n therefore reads only a prefix of its input, and ATIME below linear time is not the alternating logarithmic time of machines with random access to their input.

Alternating polynomial time Cslib.Complexity.AP is the union of the classes ATIME (n ^ k) (Cslib.Complexity.mem_AP_iff_exists_mem_ATIME). It is PSPACE (Cslib.Complexity.AP_eq_PSPACE, in CslibFrontier.Computability.Complexity.Classes.Alternation.Savitch). The space classes Cslib.Complexity.APSPACE and Cslib.Complexity.AL are in CslibFrontier.Computability.Complexity.Classes.Alternation.Space.

Main definitions #

Main results #

References #

def Cslib.Complexity.AP {α : Type} (enc : α ↪ List Bool) :
Set (Set α)

Alternating polynomial time Chandra, Kozen and Stockmeyer Arora and Barak, Section 5.3: the problems decided within polynomial time by an alternating machine with a binary alphabet and finitely many states, with respect to the encoding enc of instances.

def Cslib.Complexity.ATIME {α : Type} (enc : α ↪ List Bool) (t : ℕ → ℕ) :
Set (Set α)

Alternating time Chandra, Kozen and Stockmeyer, Section 3 Sipser, Section 10.3: the problems decided within time O(t n), that is c₁ * t n + c₂, by an alternating machine with a binary alphabet and finitely many states, on instances whose encoding under enc has length n.

def Cslib.Complexity.ASPACE {α : Type} (enc : α ↪ List Bool) (s : ℕ → ℕ) :
Set (Set α)

Alternating space Chandra, Kozen and Stockmeyer, Section 3 Sipser, Section 10.3: the problems decided within space O(s n), that is c₁ * s n + c₂, by one alternating machine with a binary alphabet and finitely many states, along every computation path, on instances whose encoding under enc has length n. Following Sipser's deciders, every branch also halts. Chandra, Kozen and Stockmeyer bound only the accepting computations of accepted instances Chandra, Kozen and Stockmeyer, Definition 2.5.

theorem Cslib.Complexity.ATIME_mono_of_le_mul_add {α : Type} {enc : α ↪ List Bool} {t₁ t₂ : ℕ → ℕ} {C : ℕ} (h : ∀ (n : ℕ), t₁ n ≤ C * t₂ n + C) :
ATIME enc t₁ ⊆ ATIME enc t₂

ATIME absorbs constant factors: a bound t₁ n ≤ C * t₂ n + C puts ATIME enc t₁ inside ATIME enc t₂.

theorem Cslib.Complexity.ASPACE_mono_of_le_mul_add {α : Type} {enc : α ↪ List Bool} {s₁ s₂ : ℕ → ℕ} {C : ℕ} (h : ∀ (n : ℕ), s₁ n ≤ C * s₂ n + C) :
ASPACE enc s₁ ⊆ ASPACE enc s₂

ASPACE absorbs constant factors: a bound s₁ n ≤ C * s₂ n + C puts ASPACE enc s₁ inside ASPACE enc s₂.

theorem Cslib.Complexity.ATIME_mono {α : Type} {enc : α ↪ List Bool} {t₁ t₂ : ℕ → ℕ} (h : ∀ (n : ℕ), t₁ n ≤ t₂ n) :
ATIME enc t₁ ⊆ ATIME enc t₂

ATIME is monotone in the time bound.

theorem Cslib.Complexity.ASPACE_mono {α : Type} {enc : α ↪ List Bool} {s₁ s₂ : ℕ → ℕ} (h : ∀ (n : ℕ), s₁ n ≤ s₂ n) :
ASPACE enc s₁ ⊆ ASPACE enc s₂

ASPACE is monotone in the space bound.

theorem Cslib.Complexity.ATIME_mono_of_eventually_le {α : Type} {enc : α ↪ List Bool} {t₁ t₂ : ℕ → ℕ} (h : ∀ᶠ (n : ℕ) in Filter.atTop, t₁ n ≤ t₂ n) :
ATIME enc t₁ ⊆ ATIME enc t₂

ATIME only depends on the time bound eventually.

theorem Cslib.Complexity.ASPACE_mono_of_eventually_le {α : Type} {enc : α ↪ List Bool} {s₁ s₂ : ℕ → ℕ} (h : ∀ᶠ (n : ℕ) in Filter.atTop, s₁ n ≤ s₂ n) :
ASPACE enc s₁ ⊆ ASPACE enc s₂

ASPACE only depends on the space bound eventually.

theorem Cslib.Complexity.ATIME_subset_ASPACE {α : Type} {enc : α ↪ List Bool} {t : ℕ → ℕ} :
ATIME enc t ⊆ ASPACE enc t

Alternating time is within alternating space: a decider within time c₁ * t n + c₂ with k work tapes decides within space k * (c₁ * t n + c₂ + 1).

theorem Cslib.Complexity.mem_AP_iff_exists_mem_ATIME {α : Type} {enc : α ↪ List Bool} {A : Set α} :
A ∈ AP enc ↔ ∃ (k : ℕ), A ∈ ATIME enc fun (x : ℕ) => x ^ k

AP is the union of the classes ATIME (n ^ k) Chandra, Kozen and Stockmeyer, Section 3 Sipser, Section 10.3.