Optional Stopping Theorem

lean4-proofprobabilityvisualization
E[Mτ]=E[M0]\mathbb{E}[M_\tau] = \mathbb{E}[M_0]

Statement

Let (Mn,Fn)(M_n, \mathcal{F}_n) be a martingale on a probability space (Ω,F,P)(\Omega, \mathcal{F}, P). A stopping time τ\tau is a {0,1,2,}\{0,1,2,\ldots\}-valued random variable with {τn}Fn\{\tau \le n\} \in \mathcal{F}_n for all nn.

The stopped process MnτM_{n \wedge \tau} is again a martingale. Under boundedness (τN\tau \le N a.s. for some fixed NN, or supnMn<C\sup_n |M_n| < C a.s.):

E[Mτ]=E[M0].\mathbb{E}[M_\tau] = \mathbb{E}[M_0].

More generally (for submartingales with bounded stopping time στN\sigma \le \tau \le N):

E[Mσ]E[Mτ].\mathbb{E}[M_\sigma] \le \mathbb{E}[M_\tau].

Visualization

Simple random walk Sn=X1++XnS_n = X_1 + \cdots + X_n, XiUniform{1,+1}X_i \sim \text{Uniform}\{-1,+1\}. Set τ=\tau = first time Sn{a,b}S_n \in \{-a, b\} for a,b>0a, b > 0.

Sample path with a=2, b=3:
S
 3|                  *  ← absorbed at b=+3
 2|              * *
 1|   *   * * *
 0|──*─*─*───────────→ n
-1|     *
-2|                   (barrier, not hit)

τ = first hitting time of {-2, +3}

E[Sτ] = E[S₀] = 0  (OST, since τ is bounded by a·b steps)

More precisely: P(Sτ = b) = a/(a+b), P(Sτ = -a) = b/(a+b)
Check: b · a/(a+b) + (-a) · b/(a+b) = (ab - ab)/(a+b) = 0 ✓

For a=2, b=3:  P(hit +3) = 2/5 = 0.4,  P(hit -2) = 3/5 = 0.6
E[Sτ] = 3·(2/5) + (-2)·(3/5) = 6/5 - 6/5 = 0 ✓

Proof Sketch

  1. Stopped process is a (sub)martingale. For στN\sigma \le \tau \le N, express MτMσ=k=στ1(Mk+1Mk)M_\tau - M_\sigma = \sum_{k=\sigma}^{\tau-1} (M_{k+1} - M_k).
  2. Write as a predictable integral. Define Hk=1σ<kτH_k = \mathbf{1}_{\sigma < k \le \tau} which is Fk1\mathcal{F}_{k-1}-measurable (since σ,τ\sigma, \tau are stopping times). Then MτMσ=kHk(MkMk1)M_\tau - M_\sigma = \sum_k H_k (M_k - M_{k-1}).
  3. Take expectations. By the martingale property E[Hk(MkMk1)Fk1]=Hk0=0\mathbb{E}[H_k (M_k - M_{k-1}) \mid \mathcal{F}_{k-1}] = H_k \cdot 0 = 0 for martingales, or 0\ge 0 for submartingales.
  4. Sum the telescoping differences to conclude E[MτMσ]=0\mathbb{E}[M_\tau - M_\sigma] = 0 (or 0\ge 0).

Connections

Optional stopping is the engine behind the classical gambling ruin calculation and the Doob's Martingale ConvergenceDoob's Martingale ConvergenceMn submartingale, supnE[Mn+]<Mna.s.MM_n \text{ submartingale, } \sup_n \mathbb{E}[M_n^+] < \infty \Rightarrow M_n \xrightarrow{\text{a.s.}} M_\inftyAn L1-bounded submartingale converges almost surely to an integrable limitRead more → theory. Combined with the Strong Law of Large NumbersStrong Law of Large Numbers1ni=1nXia.s.E[X1]\frac{1}{n}\sum_{i=1}^n X_i \xrightarrow{\text{a.s.}} \mathbb{E}[X_1]The sample mean of i.i.d. integrable random variables converges almost surely to the population meanRead more →, it characterises recurrence of random walks.

Lean4 Proof

import Mathlib.Probability.Martingale.OptionalStopping

open MeasureTheory

/-- Optional stopping theorem: for a submartingale, the expected stopped value
    is monotone in the stopping time.
    Mathlib: `MeasureTheory.Submartingale.expected_stoppedValue_mono`. -/
theorem optional_stopping_alias
    {Ω : Type*} {m0 : MeasurableSpace Ω}
    {μ : Measure Ω} [SigmaFiniteFiltration μ (𝒢 : Filtration  m0)]
    {f :   Ω  }
    {τ π : Ω  }
    {N : }
    (hf : Submartingale f 𝒢 μ)
    (hτ : IsStoppingTime 𝒢 τ)
    (hπ : IsStoppingTime 𝒢 π)
    (hle : τ  π)
    (hbdd :  ω, π ω  N) :
    μ[stoppedValue f τ]  μ[stoppedValue f π] :=
  hf.expected_stoppedValue_mono hτ hπ hle hbdd