Skip to content

Commit 51aa827

Browse files
committed
feat: port Probability.Martingale.OptionalStopping (#5274)
1 parent ab415df commit 51aa827

File tree

2 files changed

+227
-0
lines changed

2 files changed

+227
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,6 +2455,7 @@ import Mathlib.Probability.Kernel.WithDensity
24552455
import Mathlib.Probability.Martingale.Basic
24562456
import Mathlib.Probability.Martingale.Centering
24572457
import Mathlib.Probability.Martingale.OptionalSampling
2458+
import Mathlib.Probability.Martingale.OptionalStopping
24582459
import Mathlib.Probability.Notation
24592460
import Mathlib.Probability.ProbabilityMassFunction.Basic
24602461
import Mathlib.Probability.ProbabilityMassFunction.Constructions
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
/-
2+
Copyright (c) 2022 Kexing Ying. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Kexing Ying
5+
6+
! This file was ported from Lean 3 source module probability.martingale.optional_stopping
7+
! leanprover-community/mathlib commit 70fd9563a21e7b963887c9360bd29b2393e6225a
8+
! Please do not edit these lines, except to modify the commit id
9+
! if you have ported upstream changes.
10+
-/
11+
import Mathlib.Probability.Process.HittingTime
12+
import Mathlib.Probability.Martingale.Basic
13+
14+
/-! # Optional stopping theorem (fair game theorem)
15+
16+
The optional stopping theorem states that an adapted integrable process `f` is a submartingale if
17+
and only if for all bounded stopping times `τ` and `π` such that `τ ≤ π`, the
18+
stopped value of `f` at `τ` has expectation smaller than its stopped value at `π`.
19+
20+
This file also contains Doob's maximal inequality: given a non-negative submartingale `f`, for all
21+
`ε : ℝ≥0`, we have `ε • μ {ε ≤ f* n} ≤ ∫ ω in {ε ≤ f* n}, f n` where `f* n ω = max_{k ≤ n}, f k ω`.
22+
23+
### Main results
24+
25+
* `MeasureTheory.submartingale_iff_expected_stoppedValue_mono`: the optional stopping theorem.
26+
* `MeasureTheory.Submartingale.stoppedProcess`: the stopped process of a submartingale with
27+
respect to a stopping time is a submartingale.
28+
* `MeasureTheory.maximal_ineq`: Doob's maximal inequality.
29+
30+
-/
31+
32+
33+
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory
34+
35+
namespace MeasureTheory
36+
37+
variable {Ω : Type _} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {𝒢 : Filtration ℕ m0} {f : ℕ → Ω → ℝ}
38+
{τ π : Ω → ℕ}
39+
40+
-- We may generalize the below lemma to functions taking value in a `NormedLatticeAddCommGroup`.
41+
-- Similarly, generalize `(Super/Sub)martingale.set_integral_le`.
42+
/-- Given a submartingale `f` and bounded stopping times `τ` and `π` such that `τ ≤ π`, the
43+
expectation of `stoppedValue f τ` is less than or equal to the expectation of `stoppedValue f π`.
44+
This is the forward direction of the optional stopping theorem. -/
45+
theorem Submartingale.expected_stoppedValue_mono [SigmaFiniteFiltration μ 𝒢]
46+
(hf : Submartingale f 𝒢 μ) (hτ : IsStoppingTime 𝒢 τ) (hπ : IsStoppingTime 𝒢 π) (hle : τ ≤ π)
47+
{N : ℕ} (hbdd : ∀ ω, π ω ≤ N) : μ[stoppedValue f τ] ≤ μ[stoppedValue f π] := by
48+
rw [← sub_nonneg, ← integral_sub', stoppedValue_sub_eq_sum' hle hbdd]
49+
· simp only [Finset.sum_apply]
50+
have : ∀ i, MeasurableSet[𝒢 i] {ω : Ω | τ ω ≤ i ∧ i < π ω} := by
51+
intro i
52+
refine' (hτ i).inter _
53+
convert (hπ i).compl using 1
54+
ext x
55+
simp; rfl
56+
rw [integral_finset_sum]
57+
· refine' Finset.sum_nonneg fun i _ => _
58+
rw [integral_indicator (𝒢.le _ _ (this _)), integral_sub', sub_nonneg]
59+
· exact hf.set_integral_le (Nat.le_succ i) (this _)
60+
· exact (hf.integrable _).integrableOn
61+
· exact (hf.integrable _).integrableOn
62+
intro i _
63+
exact Integrable.indicator (Integrable.sub (hf.integrable _) (hf.integrable _))
64+
(𝒢.le _ _ (this _))
65+
· exact hf.integrable_stoppedValue hπ hbdd
66+
· exact hf.integrable_stoppedValue hτ fun ω => le_trans (hle ω) (hbdd ω)
67+
#align measure_theory.submartingale.expected_stopped_value_mono MeasureTheory.Submartingale.expected_stoppedValue_mono
68+
69+
/-- The converse direction of the optional stopping theorem, i.e. an adapted integrable process `f`
70+
is a submartingale if for all bounded stopping times `τ` and `π` such that `τ ≤ π`, the
71+
stopped value of `f` at `τ` has expectation smaller than its stopped value at `π`. -/
72+
theorem submartingale_of_expected_stoppedValue_mono [IsFiniteMeasure μ] (hadp : Adapted 𝒢 f)
73+
(hint : ∀ i, Integrable (f i) μ) (hf : ∀ τ π : Ω → ℕ, IsStoppingTime 𝒢 τ → IsStoppingTime 𝒢 π →
74+
τ ≤ π → (∃ N, ∀ ω, π ω ≤ N) → μ[stoppedValue f τ] ≤ μ[stoppedValue f π]) :
75+
Submartingale f 𝒢 μ := by
76+
refine' submartingale_of_set_integral_le hadp hint fun i j hij s hs => _
77+
classical
78+
specialize hf (s.piecewise (fun _ => i) fun _ => j) _ (isStoppingTime_piecewise_const hij hs)
79+
(isStoppingTime_const 𝒢 j) (fun x => (ite_le_sup _ _ (x ∈ s)).trans (max_eq_right hij).le)
80+
⟨j, fun _ => le_rfl⟩
81+
rwa [stoppedValue_const, stoppedValue_piecewise_const,
82+
integral_piecewise (𝒢.le _ _ hs) (hint _).integrableOn (hint _).integrableOn, ←
83+
integral_add_compl (𝒢.le _ _ hs) (hint j), add_le_add_iff_right] at hf
84+
#align measure_theory.submartingale_of_expected_stopped_value_mono MeasureTheory.submartingale_of_expected_stoppedValue_mono
85+
86+
/-- **The optional stopping theorem** (fair game theorem): an adapted integrable process `f`
87+
is a submartingale if and only if for all bounded stopping times `τ` and `π` such that `τ ≤ π`, the
88+
stopped value of `f` at `τ` has expectation smaller than its stopped value at `π`. -/
89+
theorem submartingale_iff_expected_stoppedValue_mono [IsFiniteMeasure μ] (hadp : Adapted 𝒢 f)
90+
(hint : ∀ i, Integrable (f i) μ) :
91+
Submartingale f 𝒢 μ ↔ ∀ τ π : Ω → ℕ, IsStoppingTime 𝒢 τ → IsStoppingTime 𝒢 π →
92+
τ ≤ π → (∃ N, ∀ x, π x ≤ N) → μ[stoppedValue f τ] ≤ μ[stoppedValue f π] :=
93+
fun hf _ _ hτ hπ hle ⟨_, hN⟩ => hf.expected_stoppedValue_mono hτ hπ hle hN,
94+
submartingale_of_expected_stoppedValue_mono hadp hint⟩
95+
#align measure_theory.submartingale_iff_expected_stopped_value_mono MeasureTheory.submartingale_iff_expected_stoppedValue_mono
96+
97+
/-- The stopped process of a submartingale with respect to a stopping time is a submartingale. -/
98+
protected theorem Submartingale.stoppedProcess [IsFiniteMeasure μ] (h : Submartingale f 𝒢 μ)
99+
(hτ : IsStoppingTime 𝒢 τ) : Submartingale (stoppedProcess f τ) 𝒢 μ := by
100+
rw [submartingale_iff_expected_stoppedValue_mono]
101+
· intro σ π hσ hπ hσ_le_π hπ_bdd
102+
simp_rw [stoppedValue_stoppedProcess]
103+
obtain ⟨n, hπ_le_n⟩ := hπ_bdd
104+
exact h.expected_stoppedValue_mono (hσ.min hτ) (hπ.min hτ)
105+
(fun ω => min_le_min (hσ_le_π ω) le_rfl) fun ω => (min_le_left _ _).trans (hπ_le_n ω)
106+
· exact Adapted.stoppedProcess_of_discrete h.adapted hτ
107+
· exact fun i =>
108+
h.integrable_stoppedValue ((isStoppingTime_const _ i).min hτ) fun ω => min_le_left _ _
109+
#align measure_theory.submartingale.stopped_process MeasureTheory.Submartingale.stoppedProcess
110+
111+
section Maximal
112+
113+
open Finset
114+
115+
theorem smul_le_stoppedValue_hitting [IsFiniteMeasure μ] (hsub : Submartingale f 𝒢 μ) {ε : ℝ≥0}
116+
(n : ℕ) : ε • μ {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω} ≤
117+
ENNReal.ofReal (∫ ω in {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω},
118+
stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω ∂μ) := by
119+
have hn : Set.Icc 0 n = {k | k ≤ n} := by ext x; simp
120+
have : ∀ ω, ((ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω) →
121+
(ε : ℝ) ≤ stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω := by
122+
intro x hx
123+
simp_rw [le_sup'_iff, mem_range, Nat.lt_succ_iff] at hx
124+
refine' stoppedValue_hitting_mem _
125+
simp only [Set.mem_setOf_eq, exists_prop, hn]
126+
exact
127+
let ⟨j, hj₁, hj₂⟩ := hx
128+
⟨j, hj₁, hj₂⟩
129+
have h := set_integral_ge_of_const_le (measurableSet_le measurable_const
130+
(Finset.measurable_range_sup'' fun n _ => (hsub.stronglyMeasurable n).measurable.le (𝒢.le n)))
131+
(measure_ne_top _ _) this (Integrable.integrableOn (hsub.integrable_stoppedValue
132+
(hitting_isStoppingTime hsub.adapted measurableSet_Ici) hitting_le))
133+
rw [ENNReal.le_ofReal_iff_toReal_le, ENNReal.toReal_smul]
134+
· exact h
135+
· exact ENNReal.mul_ne_top (by simp) (measure_ne_top _ _)
136+
· exact le_trans (mul_nonneg ε.coe_nonneg ENNReal.toReal_nonneg) h
137+
#align measure_theory.smul_le_stopped_value_hitting MeasureTheory.smul_le_stoppedValue_hitting
138+
139+
/-- **Doob's maximal inequality**: Given a non-negative submartingale `f`, for all `ε : ℝ≥0`,
140+
we have `ε • μ {ε ≤ f* n} ≤ ∫ ω in {ε ≤ f* n}, f n` where `f* n ω = max_{k ≤ n}, f k ω`.
141+
142+
In some literature, the Doob's maximal inequality refers to what we call Doob's Lp inequality
143+
(which is a corollary of this lemma and will be proved in an upcomming PR). -/
144+
theorem maximal_ineq [IsFiniteMeasure μ] (hsub : Submartingale f 𝒢 μ) (hnonneg : 0 ≤ f) {ε : ℝ≥0}
145+
(n : ℕ) : ε • μ {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω} ≤
146+
ENNReal.ofReal (∫ ω in {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω},
147+
f n ω ∂μ) := by
148+
suffices ε • μ {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω} +
149+
ENNReal.ofReal
150+
(∫ ω in {ω | ((range (n + 1)).sup' nonempty_range_succ fun k => f k ω) < ε}, f n ω ∂μ) ≤
151+
ENNReal.ofReal (μ[f n]) by
152+
have hadd : ENNReal.ofReal (∫ ω, f n ω ∂μ) =
153+
ENNReal.ofReal
154+
(∫ ω in {ω | ↑ε ≤ (range (n+1)).sup' nonempty_range_succ fun k => f k ω}, f n ω ∂μ) +
155+
ENNReal.ofReal
156+
(∫ ω in {ω | ((range (n+1)).sup' nonempty_range_succ fun k => f k ω) < ↑ε}, f n ω ∂μ) := by
157+
rw [← ENNReal.ofReal_add, ← integral_union]
158+
· rw [← integral_univ]
159+
convert rfl
160+
ext ω
161+
change (ε : ℝ) ≤ _ ∨ _ < (ε : ℝ) ↔ _
162+
simp only [le_or_lt, Set.mem_univ]
163+
· rw [disjoint_iff_inf_le]
164+
rintro ω ⟨hω₁, hω₂⟩
165+
change (ε : ℝ) ≤ _ at hω₁
166+
change _ < (ε : ℝ) at hω₂
167+
exact (not_le.2 hω₂) hω₁
168+
· exact measurableSet_lt (Finset.measurable_range_sup'' fun n _ =>
169+
(hsub.stronglyMeasurable n).measurable.le (𝒢.le n)) measurable_const
170+
exacts [(hsub.integrable _).integrableOn, (hsub.integrable _).integrableOn,
171+
integral_nonneg (hnonneg _), integral_nonneg (hnonneg _)]
172+
rwa [hadd, ENNReal.add_le_add_iff_right ENNReal.ofReal_ne_top] at this
173+
calc
174+
ε • μ {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω} +
175+
ENNReal.ofReal
176+
(∫ ω in {ω | ((range (n + 1)).sup' nonempty_range_succ fun k => f k ω) < ε}, f n ω ∂μ) ≤
177+
ENNReal.ofReal
178+
(∫ ω in {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω},
179+
stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω ∂μ) +
180+
ENNReal.ofReal
181+
(∫ ω in {ω | ((range (n + 1)).sup' nonempty_range_succ fun k => f k ω) < ε},
182+
stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω ∂μ) := by
183+
refine' add_le_add (smul_le_stoppedValue_hitting hsub _)
184+
(ENNReal.ofReal_le_ofReal (set_integral_mono_on (hsub.integrable n).integrableOn
185+
(Integrable.integrableOn (hsub.integrable_stoppedValue
186+
(hitting_isStoppingTime hsub.adapted measurableSet_Ici) hitting_le))
187+
(measurableSet_lt (Finset.measurable_range_sup'' fun n _ =>
188+
(hsub.stronglyMeasurable n).measurable.le (𝒢.le n)) measurable_const) _))
189+
intro ω hω
190+
rw [Set.mem_setOf_eq] at hω
191+
have : hitting f {y : ℝ | ↑ε ≤ y} 0 n ω = n := by
192+
classical simp only [hitting, Set.mem_setOf_eq, exists_prop, Pi.coe_nat, Nat.cast_id,
193+
ite_eq_right_iff, forall_exists_index, and_imp]
194+
intro m hm hεm
195+
exact False.elim
196+
((not_le.2 hω) ((le_sup'_iff _).2 ⟨m, mem_range.2 (Nat.lt_succ_of_le hm.2), hεm⟩))
197+
simp_rw [stoppedValue, this, le_rfl]
198+
_ = ENNReal.ofReal (∫ ω, stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω ∂μ) := by
199+
rw [← ENNReal.ofReal_add, ← integral_union]
200+
· rw [← integral_univ (μ := μ)]
201+
convert rfl
202+
ext ω
203+
change _ ↔ (ε : ℝ) ≤ _ ∨ _ < (ε : ℝ)
204+
simp only [le_or_lt, Set.mem_univ]
205+
· rw [disjoint_iff_inf_le]
206+
rintro ω ⟨hω₁, hω₂⟩
207+
change (ε : ℝ) ≤ _ at hω₁
208+
change _ < (ε : ℝ) at hω₂
209+
exact (not_le.2 hω₂) hω₁
210+
· exact measurableSet_lt (Finset.measurable_range_sup'' fun n _ =>
211+
(hsub.stronglyMeasurable n).measurable.le (𝒢.le n)) measurable_const
212+
· exact Integrable.integrableOn (hsub.integrable_stoppedValue
213+
(hitting_isStoppingTime hsub.adapted measurableSet_Ici) hitting_le)
214+
· exact Integrable.integrableOn (hsub.integrable_stoppedValue
215+
(hitting_isStoppingTime hsub.adapted measurableSet_Ici) hitting_le)
216+
exacts [integral_nonneg fun x => hnonneg _ _, integral_nonneg fun x => hnonneg _ _]
217+
_ ≤ ENNReal.ofReal (μ[f n]) := by
218+
refine' ENNReal.ofReal_le_ofReal _
219+
rw [← stoppedValue_const f n]
220+
exact hsub.expected_stoppedValue_mono (hitting_isStoppingTime hsub.adapted measurableSet_Ici)
221+
(isStoppingTime_const _ _) (fun ω => hitting_le ω) (fun _ => le_rfl : ∀ _, n ≤ n)
222+
#align measure_theory.maximal_ineq MeasureTheory.maximal_ineq
223+
224+
end Maximal
225+
226+
end MeasureTheory

0 commit comments

Comments
 (0)