Randomized logarithmic space #
A fair-coin machine (Turing.MultiTapePTM) reads each coin once, in order, so its randomness is
read-once. Its nondeterministic view (Turing.MultiTapePTM.toNTM) takes either coin at every
step; space is measured there, exactly as for Cslib.Complexity.NL. Every branch must halt: on
every encoded instance some number of steps t bounds every computation path. No clock is part of
the definition.
The acceptance probability on input is acceptCoins input t / 2 ^ t, where
Turing.MultiTapePTM.acceptCoins counts the coin strings of length t whose replay ends halted
with output [true]. Once every branch halts within t steps, this fraction no longer depends on
t (Turing.MultiTapePTM.acceptCoins_succ), so the classes quantify over one such t per
instance.
Cslib.Complexity.RL: members are accepted with probability at least1/2, non-members never.Cslib.Complexity.BPL: members with probability at least2/3, non-members at most1/3.
The threshold 1/2 for RL can be raised to 1 - 2 ^ (-r) for any fixed r by repetition
(Cslib.Complexity.mem_RL_iff_error_le), which also gives Cslib.Complexity.RL_subset_BPL.
The acceptance probability is an entry of a power or inverse of a polynomial-size configuration
matrix (Cslib.Complexity.exists_configMatrix_of_mem_BPL).
The model follows the decision recorded in issue #474: one-way coins, halting on every branch with
the polynomial clock a derived lemma, acceptance by counting coin strings, and space as for NL
Arora and Barak, Section 7.7.
Main definitions #
Turing.MultiTapePTM.acceptCoins: the accepting coin strings of a given length.Turing.MultiTapePTM.RunsInLogSpace: on every encoded instance, every branch stays within logarithmic space and halts within the polynomial clockTuring.polyClock d n.Cslib.Complexity.RL,Cslib.Complexity.BPL: randomized logarithmic space with one-sided and bounded two-sided error.
Main results #
Turing.MultiTapePTM.acceptCoins_succ: once every branch halts, one more coin doubles the count.Turing.MultiTapePTM.acceptCoins_mul_two_pow,Turing.MultiTapePTM.two_pow_mul_le_iff,Turing.MultiTapePTM.mul_le_two_pow_iff: the acceptance probability and its bounds do not depend on the halting time they are measured at.Turing.MultiTapePTM.accepts_toNTM_iff: the nondeterministic view accepts exactly when some coin string of a halting length is accepted.Cslib.Complexity.L_subset_RL,Cslib.Complexity.L_subset_BPL: deterministic logarithmic space is within both.Cslib.Complexity.RL_subset_NL: randomized logspace with one-sided error is withinNL.Turing.MultiTapePTM.exists_runsInLogSpace: a logarithmic-space machine that halts on every branch runs within the polynomial clock.Cslib.Complexity.exists_polyClock_of_mem_RL,Cslib.Complexity.exists_polyClock_of_mem_BPL: the derived polynomial clock; anRLorBPLmachine satisfiesRunsInLogSpace, and its acceptance bounds hold at the clock.
References #
The number of coin strings of length t whose replay from the initial configuration on
input ends halted with output [true].
At most all coin strings are accepted.
Under a time bound t, every replay of t or more coins ends halted.
One more coin doubles the count once every branch halts within t steps: the last coin
of a string of length t + 1 is read by a halted configuration and ignored.
Once every branch halts within t steps, the count scales with the number of extra coins.
The acceptance probability does not depend on the clock: for two halting times t and
t', acceptCoins input t / 2 ^ t = acceptCoins input t' / 2 ^ t'.
A lower bound x / y on the acceptance probability holds at one halting time exactly when it
holds at another.
An upper bound x / y on the acceptance probability holds at one halting time exactly when it
holds at another.
Acceptance of the nondeterministic view is acceptance by some coin string of a halting length.
Deterministic machines #
The nondeterministic view of a deterministic machine run as a fair-coin machine is the deterministic machine itself.
A deterministic machine ignores its coins: every replay of n coins is its run of n
steps.
A deterministic machine accepts all coin strings of length t or none.
The polynomial clock #
A logarithmic-space fair-coin machine with a polynomial clock: on every encoded instance
enc a of length n, every branch visits at most c * (Nat.log2 n + 1) work-tape cells and halts
within Turing.polyClock d n steps.
Every branch stays within logarithmic space.
Every branch halts within the polynomial clock.
Halting on every branch gives the polynomial clock: a machine that stays within
logarithmic space and halts on every branch of every encoded instance halts within
Turing.polyClock d n steps, for one exponent d.
Randomized logarithmic space with one-sided error
Arora and Barak, Section 7.7: some fair-coin machine with finitely many states, on
every encoded instance enc a of length n, visits at most c * (Nat.log2 n + 1) work-tape cells
on every branch, halts on every branch within some number of steps t, accepts members on at least
half of the coin strings of length t, and accepts non-members on none.
Randomized logarithmic space with bounded two-sided error
Arora and Barak, Section 7.7: as for Cslib.Complexity.RL, but members are accepted
on at least two thirds of the coin strings and non-members on at most one third.
RL has a polynomial clock: an RL machine, which only promises to halt on every branch,
halts within polyClock d n steps (Turing.MultiTapePTM.RunsInLogSpace), and the acceptance
bounds hold at that clock.
BPL has a polynomial clock: a BPL machine, which only promises to halt on every
branch, halts within polyClock d n steps (Turing.MultiTapePTM.RunsInLogSpace), and the
acceptance bounds hold at that clock.