Documentation

CslibFrontier.Computability.Complexity.Classes.Space.Nondeterministic.Savitch

Savitch's theorem: NSPACE(s) ⊆ DSPACE(s²) #

A problem decided, or only recognized, by a nondeterministic machine within space O(s) is decided by a deterministic machine within space O(s ^ 2), whenever log₂ n ≤ s n: this inclusion is Savitch's theorem [Sav70]. No constructibility of s is assumed. As in Sipser's proof of Theorem 8.5, which tries the space bounds 1, 2, 3, … in turn [Sip13], the simulating machine (Turing.MultiTapeNTM.exists_decidableInTimeAndSpace_sq) tries growing radices for the configuration graph and detects when the simulated machine leaves the current radix. The radices are those of Turing.MultiTapeNTM.ConfigurationGraph.roundRadix, shared with Immerman's inductive counting for Cslib.Complexity.NSPACE_eq_coNSPACE.

Sipser's Theorem 8.5 assumes f(n) ≥ n; the final paragraph of his Section 8.4 (3rd edition, p. 351) extends it to sublinear bounds f(n) ≥ log n. Arora and Barak's Theorem 4.14 assumes a space-constructible bound S(n) ≥ log n. The sources are about deciders on strings; the statements here also cover nonhalting recognizers and arbitrary encoded instances.

Main results #

References #

theorem Cslib.Complexity.mem_DSPACE_sq_of_recognizesInSpace {α : Type} {enc : α ↪ List Bool} {A : Set α} {s : ℕ → ℕ} (hs : ∀ (n : ℕ), n.log2 ≤ s n) {k c₁ c₂ : ℕ} {State : Type} [Finite State] {ntm : Turing.MultiTapeNTM k Bool State} (h : ntm.RecognizesInSpace enc A fun (a : α) => c₁ * s (enc a).length + c₂) :
A ∈ DSPACE enc fun (n : ℕ) => s n ^ 2

Savitch's theorem for recognizers [Sav70]: a problem recognized by a nondeterministic machine within space c₁ * s n + c₂, whose branches need not halt, is in DSPACE(s²) when log₂ n ≤ s n. The bound s need not be constructible.

theorem Cslib.Complexity.NSPACE_subset_DSPACE_sq {α : Type} {enc : α ↪ List Bool} {s : ℕ → ℕ} (hs : ∀ (n : ℕ), n.log2 ≤ s n) :
NSPACE enc s ⊆ DSPACE enc fun (n : ℕ) => s n ^ 2

Savitch's theorem [Sav70]: NSPACE(s) ⊆ DSPACE(s²) for every bound with log₂ n ≤ s n, for the library's native machines and arbitrary injective instance encodings. The bound s need not be constructible: the simulation tries growing bounds, as in Sipser's proof of Theorem 8.5 [Sip13].