Optional Stopping Theorem
ProvedMarkovMixing.optional_stoppingLet be a Markov chain on a finite state space . A martingale adapted to the chain is a family of real-valued functions of the trajectory up to time whose one-step conditional expectation is neutral: for every trajectory , where extends by one step. A stopping time is a -valued stopping rule: whether to stop at time is determined by the trajectory up to . Fix a starting state ; is almost surely finite when the total probability of ever stopping equals one, and the stopped expectation is the sum over all times and trajectories from of (trajectory weight) × (probability of stopping exactly at ) × .
The theorem (the Optional Stopping Theorem, Corollary 17.7 of Levin–Peres–Wilmer) asserts: if is uniformly bounded — for some constant and all — and is almost surely finite, then
stopping a fair game at a fair time wins nothing. This identity is the workhorse of discrete probability — the gambler's ruin probabilities and hitting-time identities of Missions I and VI are all instances — and in this mission it feeds the analysis of the evolving-set process.
import Definitions.Def_mm_martingale
namespace MarkovMixing
/-- **Corollary 17.7, the Optional Stopping Theorem** (LPW): if `M` is a
bounded martingale with respect to the chain and `τ` is an almost surely
finite stopping time, then `E_x(M_τ) = M_0(x)`. -/
theorem optional_stopping {V : Type*} [Fintype V] [DecidableEq V]
(P : Matrix V V ℝ) (hP : IsStochastic P)
(M : ∀ t : ℕ, (Fin (t + 1) → V) → ℝ) (hM : IsChainMartingale P M)
(s : ∀ t : ℕ, (Fin (t + 1) → V) → ℝ)
(hs01 : ∀ (t : ℕ) (ω : Fin (t + 1) → V), s t ω = 0 ∨ s t ω = 1)
(x : V) (hfin : (∑' t : ℕ, ∑ y, stopAtProb P x s t y) = 1)
(K : ℝ) (hK : ∀ (t : ℕ) (ω : Fin (t + 1) → V), |M t ω| ≤ K) :
stoppedExp P x s M = M 0 (fun _ => x) := by
sorry
end MarkovMixingRead-back
What the Lean code literally says, in plain math · claude-fable-5
Read-back: optional_stopping
Let be a finite type with decidable equality (possibly empty), and let be a real matrix on that is stochastic: every entry satisfies and every row sums to , i.e. for each . Let be a family assigning a real number to each and each path , and assume is a chain martingale for : for every and every path of length ,
where appends to . Let be a family assigning a real number to each and each path of length , and assume each value is exactly or exactly (this is the only constraint on ; nothing requires to depend on the path in any adapted way beyond its type, which already forces to depend only on the first states). Fix a starting state . Write, for and ,
for the probability-like mass of stopping at time in state starting from (a finite sum over all paths; is the length- prefix; both products are empty, hence , when ). Assume the hypothesis
where the sum over is a tsum (equal to by convention if the family is not summable — the hypothesis rules that degenerate reading out, since it asserts the value is ). Finally, assume there is a real number (its sign is not separately hypothesized) with for all and all paths .
Then the theorem asserts the equality
where the left-hand side's outer sum over is again a tsum (value if not summable), and denotes the one-point path of length constantly equal to . In words: the stopped expectation of — the sum over all times and all paths from of (path weight) × (product of one-minus- over all proper prefixes) × ( at time ) × ( at time ) — equals the initial value at the trivial path sitting at . If is empty, the hypothesis is unsatisfiable (every inner sum is empty, so the total is ), making the statement vacuous in that case.
Confirmed by the mission captain (proposal self-audit).