Expected running time of fair-coin machines #
The running time T_{M,x} of a closed fair-coin machine M on an input x is the number of
steps after which it first halts, a random variable over its coins
Arora and Barak, Section 7.3. Its expectation is the tail sum
E[T_{M,x}] = ∑ₜ Pr[T_{M,x} > t], and T_{M,x} > t exactly when the closed run with clock t
has not halted. Turing.MultiTapePTM.expectedTime is this tail sum, valued in ℝ≥0∞, so it is
total and equals ⊤ when the machine does not halt almost surely or its running time has infinite
expectation. This is the convention of Cslib.WordRAM.expectedTime.
Halting is absorbing, so the probability of still running after t steps decreases with t, and
the probability of having halted in any given set of halted configurations increases with t.
Hence Markov's inequality takes the form (t + 1) * Pr[T_{M,x} > t] ≤ E[T_{M,x}]. A finite
expectation also means that every finite coin prefix has an extension on which the machine halts:
otherwise the run would keep running on a set of coin sequences of positive probability.
Main definitions #
Turing.MultiTapePTM.expectedTime: the expected running time.
Main results #
Turing.MultiTapePTM.toOuterMeasure_running_antitone: the probability of still running decreases.Turing.MultiTapePTM.toOuterMeasure_halted_monotone: the probability of having halted in a set of halted configurations increases.Turing.MultiTapePTM.toOuterMeasure_compl_antitone,Turing.MultiTapePTM.expectedTime_le_tsum_toOuterMeasure_compl: the probability of not yet being in such a set decreases, and these probabilities bound the expected running time.Turing.MultiTapePTM.mul_toOuterMeasure_running_le_expectedTime: Markov's inequality.Turing.MultiTapePTM.expectedTime_le_of_halted: halting withinTsteps bounds the expectation byT.Turing.MultiTapePTM.toOuterMeasure_running_eq_card: the probability of still running, as a count of coin strings.Turing.MultiTapePTM.exists_halted_append_of_expectedTime_ne_top: with finite expected running time, every coin prefix extends to a halting one.Turing.MultiTapePTM.output_isPrefix_append: replaying more coins only extends the output.
References #
The expected running time of machine on input under fair coins: the tail sum over t
of the probability that the closed run has not halted after t steps
Arora and Barak, Section 7.3. It is ⊤ when the expectation is infinite.
Running t + m steps runs t steps and then m more.
A halted configuration stays where it is.
The probability of still running decreases with the clock.
The probability of having halted in a set of halted configurations increases with the clock: halted configurations stay.
The miss probability decreases with the clock: the probability of not yet being in a set of halted configurations is the complement of an increasing probability.
The expected running time is at most the sum of the miss probabilities of any set of halted configurations.
Markov's inequality for the running time: the run is still going after t steps with
probability at most E[T] / (t + 1).
Halting within a clock bounds the expected running time: if every run has halted after
T steps, the expected running time is at most T.
The probability of still running as a count: the fraction of the 2 ^ t coin strings of
length t whose replay has not halted.
Replaying coins from a halted configuration leaves its tapes unchanged.
Outputs only grow: replaying more coins extends the output of a replay.
With finite expected running time, every coin prefix extends to a halting run: some extension of the prefix is a coin string on which the replay has halted. Otherwise every run extending the prefix would keep running, with probability at least that of the prefix at every clock, and the tail sum would be infinite.