Native visited-space computations as branching programs (after Arora–Barak Theorem 13.15) #
Every deterministic multi-tape Turing machine running within visited work-tape space s
(Turing.MultiTapeTM.RunsInSpace) on inputs of length n for T steps compiles into a
deterministic branching program (Turing.MultiTapeTM.toBranchingProgram) over the n input bits.
The program is the one of a graph (Turing.MultiTapeTM.spaceConfigGraph) whose nodes
(Turing.MultiTapeTM.SpaceConfigNode) are input-independent timed configuration cores:
step : Fin (T + 1)— the step counter (witnessing acyclicity viarank v = T - v.step.val);inputPos : Fin (n + 2)— the read-only input-head position;storage : BoundedStorage Bool State (fun _ : Fin k => s)— the control state and work-tape contents and head positions restricted to the window[-s, s]on each of thekwork tapes;firstOutput : Option Bool— the first symbol emitted on the write-only output tape.
When the input head lies on the input word (1 ≤ inputPos ≤ n), the node queries input bit
inputPos - 1 and transitions to the next timed configuration core on both outcomes; when the
input head lies on the left or right boundary blank (0 or n + 1), the transition reads none
independently of the input bit. On any input x : Fin n → Bool on which the machine stays within
visited space s, evaluating the branching program yields the first output bit of the T-step run
(Turing.MultiTapeTM.eval_toBranchingProgram).
Taking T = (n + 2) * storageBound Bool State k s (the configuration-counting halting bound of
Turing.MultiTapeTM.haltsAt_le_card) yields the native visited-space version of Arora and Barak,
Theorem 13.15 (with the max (S n) 1 zero-space boundary correction): for every problem
A ∈ Cslib.Complexity.DSPACE enc S with S n ≥ Nat.log 2 n, there is an explicit constant c
(Turing.MultiTapeTM.spaceBranchingProgramBase, depending on the machine's tape count k, state
count Fintype.card State, binary work-tape alphabet Bool, and linear space constants c₁, c₂
under enc) such that for every input length n, a branching program of size at most
c ^ max (S n) 1 (and at most c ^ S n whenever 1 ≤ S n, in particular for all n ≥ 2 or
under the positive logarithmic convention S n ≥ Nat.log 2 n + 1) computes the length-n slice
of A (Cslib.Complexity.DSPACE.exists_branchingProgram_of_log_le,
Cslib.Complexity.DSPACE.exists_branchingProgram_of_log_add_one_le,
Cslib.Complexity.DSPACE.exists_branchingProgram_slice).
Boundary at n = 1, S(1) = 0. The exponent max (S n) 1 (or the positiveness condition
1 ≤ S n) is necessary when S n = 0: at n = 1, Nat.log 2 1 = 0, so S(n) = ⌈log₂ n⌉
satisfies S(1) = 0 ≥ log₂ 1, whereas FirstBit = {x | x₁ = 1} ∈ DSPACE 0 is nonconstant on
{0, 1}¹ and requires at least 3 > 1 = c ^ S(1) branching-program nodes (one query node and two
distinct sinks) for every base c > 1.
Space-measure qualification. Space in Cslib.Complexity.DSPACE counts distinct visited
work-tape cells (Turing.MultiTapeNTM.RunPath.space), the library's native convention, whereas
Arora and Barak's draft counts ever-nonblank cells (a weaker premise when a machine scans blank
cells without writing, so the draft's ever-nonblank SPACE(S(n)) convention remains an open
model difference).
Main definitions #
Turing.Storage.init,Turing.Storage.ofBounded,Turing.Action.applyStorage: initial storage, reconstruction of aStoragefrom aBoundedStorage, and action application on storages.Turing.MultiTapeTM.SpaceConfigNode: a timed bounded configuration core of a space-bounded machine.Turing.MultiTapeTM.spaceConfigGraph,Turing.MultiTapeTM.toBranchingProgram: the graph on timed configuration cores, and its branching program, simulatingTsteps of a machine within visited spaceson inputs of lengthn.Turing.MultiTapeTM.spaceBranchingProgramBase: the explicit basecof thec ^ S nnode-count bound.
Main results #
Turing.Storage.ofBounded_toBounded: reconstructing a storage that fits in a window from its bounded restriction is the identity.Turing.MultiTapeTM.fitsIn_runFrom: every step of a visited-space-srun fits in the uniform window[-s, s].Turing.MultiTapeTM.eval_toBranchingProgram: the branching program computes the first output bit of theT-step run on every input within visited spaces.Turing.MultiTapeTM.size_toBranchingProgram_le_pow_max,Turing.MultiTapeTM.size_toBranchingProgram_le_pow: the branching program for the configuration-counting time bound has size at mostspaceBranchingProgramBase ^ max (S n) 1(andspaceBranchingProgramBase ^ S nwhen1 ≤ S n).Cslib.Complexity.DSPACE.exists_branchingProgram_of_log_le,Cslib.Complexity.DSPACE.exists_branchingProgram_of_log_add_one_le,Cslib.Complexity.DSPACE.exists_branchingProgram_slice: native visited-space branching-program simulation (after Arora–Barak Theorem 13.15, with themax (S n) 1boundary correction) for encoded problems inDSPACE enc Sand languages inDSPACE encBits S.Cslib.Complexity.L.exists_branchingProgram,Cslib.Complexity.L.exists_branchingProgram_slice: specialization to native deterministic logarithmic spaceL encandL encBits.
References #
Reconstruct a Storage from a BoundedStorage on windows w, padding cells outside
[-(w j), w j] with none.
Along a space-s run on input, the storage at every step t fits in the uniform per-tape
window fun _ => s.
Timed configuration cores and branching-program compilation #
A timed configuration core of a k-tape binary machine with state type State, for inputs of
length n, work-tape window s, and step horizon T. Its fields are independent of the input
word x : Fin n → Bool.
The input-head position (
0andn + 1are the left and right boundary blanks).The control state and work-tape configuration restricted to
[-s, s]on each tape.The first output symbol emitted so far, if any.
Instances For
Equivalence between SpaceConfigNode and the product of its four fields.
The initial timed configuration core at step 0.
Advance a timed configuration core by one step of tm on reading inp : Option Bool under
the input head.
When the configuration c fits in the uniform window [-s, s], stepNode on c.inputSymbol
advances ofCfg s t c to ofCfg s (t + 1) (tm.step c).
The graph on timed configuration cores, over inputs Fin n → Bool, that simulates T steps
of tm within work-tape window s. Its rank is the number T - v.step.val of remaining steps.
The deterministic branching program over Fin n → Bool that simulates T steps of tm
within work-tape window s: the program of tm.spaceConfigGraph n s T, with one node for each
timed configuration core.
From the node of the t-th configuration on an input x (for 0 < n), the graph
tm.spaceConfigGraph n s T reaches the first output bit of the T-step configuration.
Correctness of the branching-program compiler: on every input x : Fin n → Bool on which
tm runs within space s, tm.toBranchingProgram n s T evaluates to the first output bit of the
T-step run of tm on List.ofFn x.
Explicit node-count bounds (2 ^ O(S)) #
The explicit base c of the exponential size bound c ^ S n for the branching programs
simulating a k-tape deterministic machine with state type State running within space
c₁ * S n + c₂ on inputs of length n. It depends on the tape count k, the state count
Fintype.card State, the fixed binary work-tape alphabet Bool (via storageBoundBase and
storageBoundExp), and the linear space constants c₁, c₂.
The branching-program size base spaceBranchingProgramBase k State c₁ c₂ is at least 2.
For s ≤ c₁ * S + c₂ and Nat.log 2 n ≤ S, the branching program simulating tm up to the
configuration-counting step bound T = (n + 2) * storageBound Bool State k s has size at most
(spaceBranchingProgramBase k State c₁ c₂) ^ max S 1.
When 1 ≤ S (in particular for n ≥ 2 or when S ≥ Nat.log 2 n + 1), the size of the
branching program is at most (spaceBranchingProgramBase k State c₁ c₂) ^ S.
Native visited-space branching-program simulation (after Arora–Barak Theorem 13.15) #
Native visited-space branching-program simulation (after Arora–Barak Theorem 13.15, general
S n ≥ Nat.log 2 n form).
For every problem A ∈ DSPACE enc S (where DSPACE measures distinct visited work-tape cells) with
∀ n, Nat.log 2 n ≤ S n, there is a constant c ≥ 2 (depending on the deciding machine's tape
count, state count, binary work-tape alphabet Bool, and linear space constants under enc) such
that for every input length n, there is a deterministic branching program
P : BranchingProgram (Fin n) Bool of size at most c ^ max (S n) 1 (hence
≤ c ^ S n whenever 1 ≤ S n, and ≤ c ^ (S n + 1) for all n) that computes
encodesMember enc A n on all encoded instances of length n. The max (S n) 1 floor is needed at
n = 1, S 1 = 0, where a nonconstant 1-bit language in DSPACE 0 requires at least 3 > 1 = c ^ 0
nodes.
Native visited-space branching-program simulation (after Arora–Barak Theorem 13.15, c ^ S n
form for positive space bounds S n ≥ 1).
When ∀ n, Nat.log 2 n ≤ S n and ∀ n, 1 ≤ S n (in particular under the repository's standard
logarithmic convention S n ≥ Nat.log 2 n + 1), every length-n slice of A ∈ DSPACE enc S is
computed on encoded instances by a branching program of size at most c ^ S n.
Native visited-space branching-program simulation (after Arora–Barak Theorem 13.15) under
S n ≥ Nat.log 2 n + 1.
Native visited-space branching-program simulation (after Arora–Barak Theorem 13.15) for
boolean languages (enc = encBits).
For every language L ∈ DSPACE encBits S with ∀ n, Nat.log 2 n ≤ S n, there is a constant
c ≥ 2 such that for every n, the slice L.slice n : (Fin n → Bool) → Bool is computed on all
2 ^ n inputs by a deterministic branching program of size at most c ^ max (S n) 1 (and at most
c ^ S n whenever 1 ≤ S n).
Native deterministic logarithmic space L has polynomial-size branching programs of size at
most c ^ (Nat.log 2 n + 1) at every input length n (via the visited-space simulation after
Arora–Barak Theorem 13.15).
For a boolean language L₀ ∈ L encBits, every length-n slice L₀.slice n has a
deterministic branching program of size at most c ^ (Nat.log 2 n + 1) (under native visited
logarithmic space).