Documentation

CslibFrontier.Computability.Complexity.Classes.LogSpace.Randomized.PolyTime

Randomized logarithmic space is within polynomial time #

The number of accepting coin strings of length t from a view satisfies a recursion over the two coin successors (Turing.MultiTapePTM.viewAcceptCount), and it is the entry of the power of the configuration matrix (Turing.MultiTapePTM.configMatrix_pow_mulVec_acceptVec). A deterministic algorithm evaluates it exactly: breadth-first search lists the reachable views (Turing.MultiTapeNTM.exists_computableInPolyTime_search), and t rounds update a table of binary counts, one per view, by adding the counts of the two coin successors. Under a logarithmic space bound there are polynomially many views, and every count of round t has at most t + 1 bits, so the evaluation runs in polynomial time for any horizon computed in unary in polynomial time (Turing.MultiTapePTM.computableInPolyTime_acceptCoins). Comparing the count at the polynomial clock with 2 / 3 of the 2 ^ t coin strings decides a BPL language, so BPL ⊆ P (Cslib.Complexity.BPL_subset_P), and with Cslib.Complexity.RL_subset_BPL also RL ⊆ P. This is a sequential exact evaluation of the configuration matrix, whose powers Borodin, Cook and Pippenger evaluate in parallel Borodin, Cook and Pippenger.

The certificates use only the plain polynomial-time calculus.

Main definitions #

Main results #

References #

noncomputable def Turing.MultiTapePTM.viewAcceptCount {k : ℕ} {State : Type} (machine : MultiTapePTM k Bool State) :
ℕ → FiniteCfg k Bool State → ℕ

The accepting coin strings from a view: the number of coin strings of length t whose replay from the view ends in a halted view with output [true], by recursion over the two coin successors.

theorem Turing.MultiTapePTM.viewAcceptCount_le {k : ℕ} {State : Type} {machine : MultiTapePTM k Bool State} (t : ℕ) (finite : FiniteCfg k Bool State) :
machine.viewAcceptCount t finite ≤ 2 ^ t

At most all coin strings are accepted.

theorem Turing.MultiTapePTM.configMatrix_pow_mulVec_acceptVec {k : ℕ} {State : Type} {machine : MultiTapePTM k Bool State} {V : Finset (FiniteCfg k Bool State)} (hV : ∀ finite ∈ V, ∀ (bit : Bool), machine.viewCoinStep finite bit ∈ V) (t : ℕ) (x : ↥V) :
(machine.configMatrix ℕ V ^ t).mulVec (FiniteCfg.acceptVec ℕ V) x = machine.viewAcceptCount t ↑x

The count is an entry of the power of the configuration matrix on any set of views closed under coin steps.

theorem Turing.MultiTapePTM.acceptCoins_eq_viewAcceptCount {k : ℕ} {State : Type} {machine : MultiTapePTM k Bool State} {input : List Bool} {V : Finset (FiniteCfg k Bool State)} (hV : ∀ finite ∈ V, ∀ (bit : Bool), machine.viewCoinStep finite bit ∈ V) (hinit : machine.toNTM.initView input ∈ V) (t : ℕ) :
machine.acceptCoins input t = machine.viewAcceptCount t (machine.toNTM.initView input)

The count from the initial view is the number of accepting coin strings.

Coin steps of views are polynomial-time.

Evaluation of the counts on a table of views #

theorem Turing.MultiTapePTM.computableInPolyTime_acceptCoins {k : ℕ} {State : Type} [Finite State] {α : Type} {enc : α ↪ List Bool} {c : ℕ} (M : MultiTapePTM k Bool State) (hs : ∀ (a : α), M.toNTM.RunsInSpace (enc a) (c * ((enc a).length.log2 + 1))) {T : α → ℕ} (hT : MultiTapeTM.ComputableInPolyTime T enc MultiTapeTM.encUnary) :

Accepting coin strings are counted in polynomial time under a logarithmic space bound: breadth-first search lists the polynomially many reachable views, and T a rounds of the count recursion over a table of binary counts evaluate acceptCoins (enc a) (T a) exactly, for any horizon T computed in unary in polynomial time. Halting is not needed.

theorem Cslib.Complexity.BPL_subset_P {α : Type} {enc : α ↪ List Bool} :
BPL enc ⊆ P enc

Randomized logarithmic space with two-sided error is within polynomial time: the number of accepting coin strings at the polynomial clock is computed exactly (Turing.MultiTapePTM.computableInPolyTime_acceptCoins) and compared with two thirds of all coin strings.

theorem Cslib.Complexity.RL_subset_P {α : Type} {enc : α ↪ List Bool} :
RL enc ⊆ P enc

Randomized logarithmic space with one-sided error is within polynomial time.