Documentation

CslibFrontier.Computability.Complexity.Classes.Alternation.Space

Alternating space: APSPACE and AL #

The class Cslib.Complexity.APSPACE consists of the problems decided within polynomial space by alternating machines (Turing.MultiTapeATM) with a binary alphabet and finitely many states, and Cslib.Complexity.AL of those decided within logarithmic space c * (log₂ n + 1) Chandra, Kozen and Stockmeyer, Section 3 Sipser, Section 10.3. Deciding within space (Turing.MultiTapeATM.DecidesInSpace) bounds the space of every computation path of the nondeterministic machine of the table, and asks every branch to halt. Like Cslib.Complexity.AP, the classes are relative to the encoding of instances. A time bound gives a space bound (Turing.MultiTapeATM.DecidesInTime.decidesInSpace), so AP ⊆ APSPACE, and AL ⊆ APSPACE. In terms of the parametric classes Cslib.Complexity.ASPACE, APSPACE is the union of the classes ASPACE (n ^ k) (Cslib.Complexity.mem_APSPACE_iff_exists_mem_ASPACE) and AL is ASPACE (log₂ n) (Cslib.Complexity.AL_eq_ASPACE).

A space-bounded alternating machine is simulated deterministically by evaluating its configuration graph bottom-up (Turing.MultiTapeATM.boundedAccepts). Under space s, at most 2 ^ (2 * coreLengthBound k State n s + 1) = 2 ^ O(log n + s) views are reachable, and marking them decides acceptance. Acceptance (Turing.MultiTapeATM.Accepts) is the least fixed point of the labelling, acceptance within some finite number of moves, so an infinite branch never helps a configuration accept. The marking rounds compute exactly this least fixed point (Turing.MultiTapeATM.markAccepts_iff), so the simulation needs no halting assumption, and it applies to recognizers (Turing.MultiTapeATM.RecognizesInSpace), whose branches may run forever. Under logarithmic space there are polynomially many views and the simulation is polynomial-time (Turing.MultiTapeATM.RecognizesInSpace.mem_P). Under polynomial space it is polynomial-time in the instance padded by the exponential number of views, so in exponential time (Turing.MultiTapeATM.RecognizesInSpace.mem_EXP). Hence AL ⊆ P and APSPACE ⊆ EXP, the simulation halves of AL = P and APSPACE = EXP.

Main definitions #

Main results #

References #

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

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

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

Alternating logarithmic space Chandra, Kozen and Stockmeyer Sipser, Section 10.3: the problems decided within space c * (log₂ n + 1), where n is the length of the encoded instance, by an alternating machine with a binary alphabet and finitely many states.

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

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

theorem Cslib.Complexity.AL_eq_ASPACE {α : Type} {enc : α ↪ List Bool} :

AL is ASPACE(log₂ n) Sipser, Section 10.3: the bounds c * (log₂ n + 1) and c₁ * log₂ n + c₂ give the same problems.

theorem Cslib.Complexity.AP_subset_APSPACE {α : Type} {enc : α ↪ List Bool} :
AP enc ⊆ APSPACE enc

Alternating polynomial time is within alternating polynomial space: a decider within time t decides within space k * (t + 1).

theorem Cslib.Complexity.AL_subset_APSPACE {α : Type} {enc : α ↪ List Bool} :
AL enc ⊆ APSPACE enc

Alternating logarithmic space is within alternating polynomial space.

theorem Turing.MultiTapeATM.RecognizesInSpace.mem_P {α : Type} {enc : α ↪ List Bool} {k : ℕ} {State : Type} [Finite State] {atm : MultiTapeATM k Bool State} {A : Set α} {c : ℕ} (h : atm.RecognizesInSpace enc A fun (a : α) => c * ((enc a).length.log2 + 1)) :

Alternating logspace recognizers are within polynomial time Chandra, Kozen and Stockmeyer, Section 3: a problem recognized by an alternating machine within logarithmic space, whose branches need not halt, is in P, by marking the polynomially many reachable views. This is the alternating analogue of Cslib.Complexity.mem_P_of_recognizesInSpace. The bound must have the shape c * (Nat.log2 n + 1); a smaller bound is first raised with RecognizesInSpace.mono.

theorem Turing.MultiTapeATM.RecognizesInSpace.mem_EXP {α : Type} {enc : α ↪ List Bool} {k : ℕ} {State : Type} [Finite State] {atm : MultiTapeATM k Bool State} {A : Set α} {s : α → ℕ} (hs : MultiTapeTM.PolyBounded (fun (a : α) => (enc a).length) s) (h : atm.RecognizesInSpace enc A s) :

Alternating polynomial-space recognizers are within exponential time Chandra, Kozen and Stockmeyer, Section 3: a problem recognized by an alternating machine within polynomial space, whose branches need not halt, is in EXP, by marking the exponentially many reachable views.

theorem Cslib.Complexity.AL_subset_P {α : Type} {enc : α ↪ List Bool} :
AL enc ⊆ P enc

AL ⊆ P Chandra, Kozen and Stockmeyer, Section 3 Sipser, Section 10.3: alternating logarithmic space is within polynomial time.

theorem Cslib.Complexity.APSPACE_subset_EXP {α : Type} {enc : α ↪ List Bool} :
APSPACE enc ⊆ EXP enc

APSPACE ⊆ EXP Chandra, Kozen and Stockmeyer, Section 3 Sipser, Section 10.3: alternating polynomial space is within exponential time.