Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 181 additions & 2 deletions LMLExplore/EValues/EProcess.lean

@RemyDegenne RemyDegenne Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 reuse — request_changes claude/claude-opus-5-5

The characterization, the ℝ≥0∞ martingale domination, stoppedValueLimsup_mono and Ville's inequality for e-processes are new and build on the Snell envelope, optional stopping and ExactVille instead of re-deriving them. One public lemma is just the reverse direction of a new iff with the same hypotheses.

  • LMLExplore/EValues/EProcess.lean:306 — IsEProcess.of_ae_le_isTestSupermartingale has the same hypotheses (hS) (hE) (h) as the reverse direction of isEProcess_iff_forall_exists_isTestSupermartingale (line 315) and is proved as .out 5 1, so the two public declarations state the same thing. Nothing in LMLExplore uses it. Fix: Delete IsEProcess.of_ae_le_isTestSupermartingale and its module-docstring entry (line 74). Callers write (isEProcess_iff_forall_exists_isTestSupermartingale hS hE).2 h.

Reply in this thread to contest a finding; that re-runs only this rubric and posts an answer here. (To fix it, just push a commit — that re-reviews on its own. To contest again after an answer, post a NEW reply rather than editing an old one.)

claude/claude-opus-5-5 · 39s · 250.9k in (204.3k cache read, 46.6k cache write) / 3.1k out tokens · reviewing this diff · rubric · ⚠️ rubrics checkout differs from published main

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 api-design — request_changes claude/claude-opus-5-5

The surface is minimal, but the roadmap's named equivalence isEProcess_iff_forall_exists_isTestMartingale is missing, so the characterization can only be used through position indices into the TFAE.

  • LMLExplore/EValues/EProcess.lean — No named iff between IsEProcess E ℱ S and domination by a test (super)martingale under each P ∈ S, and no converse lemma from domination by a test martingale. Users must write (isEProcess_tfae hS hE).out 0 5, which breaks if the list is reordered. Fix: Add public isEProcess_iff_forall_exists_isTestMartingale and isEProcess_iff_forall_exists_isTestSupermartingale (hypotheses hS, Adapted ℱ E), both proved from isEProcess_tfae. Optionally add IsEProcess.of_ae_le_isTestMartingale.

Reply in this thread to contest a finding; that re-runs only this rubric and posts an answer here. (To fix it, just push a commit — that re-reviews on its own. To contest again after an answer, post a NEW reply rather than editing an old one.)

claude/claude-opus-5-5 · 39s · 121.3k in (105.7k cache read, 15.6k cache write) / 3.2k out tokens · reviewing this diff · rubric · ⚠️ rubrics checkout differs from published main

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 generality — request_changes claude/claude-opus-5-5

IsEProcess.measure_inv_le_stoppedValueLimsup_le requires every member of the null to be a probability measure, though its conclusion concerns only one P; the sibling Ville lemmas need only [IsProbabilityMeasure P]. The other statements are at the natural level.

  • LMLExplore/EValues/EProcess.lean:348 — measure_inv_le_stoppedValueLimsup_le takes hS : ∀ P ∈ S, IsProbabilityMeasure P, but its claim is about one P. It needs hS only because it goes through isEVar_stoppedValueLimsup, which is a statement about the whole null. The sibling lemmas measure_exists_le_le and measure_exists_inv_le_le need only [IsProbabilityMeasure P]. Fix: Use the signature (hE : IsEProcess E ℱ S) (hP : P ∈ S) [IsProbabilityMeasure P] (hτ : IsStoppingTime ℱ τ) (α). For the proof, take hE.exists_isTestSupermartingale_ae_le hP and apply lintegral_stoppedValueLimsup_le_one_of_ae_le. That shows stoppedValueLimsup E τ is an e-variable for {P}, so IsEVar.measure_inv_le_le with mem_singleton P finishes it.

Reply in this thread to contest a finding; that re-runs only this rubric and posts an answer here. (To fix it, just push a commit — that re-reviews on its own. To contest again after an answer, post a NEW reply rather than editing an old one.)

claude/claude-opus-5-5 · 29s · 74.5k in (68k cache read, 6.5k cache write) / 2.4k out tokens · reviewing this diff · rubric · ⚠️ rubrics checkout differs from published main

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Authors: LMLExplore contributors
module

public import LMLExplore.EValues.EVariable
public import LMLExplore.Probability.Martingale.OptionalStopping
public import LMLExplore.Probability.Martingale.ExactVille
public import LMLExplore.Probability.Martingale.SnellEnvelope

/-!
# E-processes
Expand All @@ -26,6 +27,18 @@ conversely. This file also proves the closure properties of e-processes that fol
e-variables at each stopping time: restricting the null, passing to an adapted process that is
almost surely smaller, and convex combinations.

The converse holds one member of the null at a time [RRLK, Lemma 6]: an adapted process is an
e-process exactly when, under every member `P` of the null, it is `P`-almost surely dominated by a
test supermartingale for `P`, or equivalently by a test martingale for `P`. The test
supermartingale is the Snell envelope of the process under `P`
(`ProbabilityTheory.snellEnvelope`), and the test martingale is its martingale part
(`ProbabilityTheory.IsTestSupermartingale.exists_isTestMartingale_ge`). Validity at the stopping
times with values in `ℕ` is then equivalent to validity at the bounded ones, and to validity at
the stopping times with values in `WithTop ℕ`, with the `limsup` or the `liminf` of the process
where the stopping time is infinite: the definition does not depend on the convention at infinity.
Through the domination, Ville's inequality for test supermartingales gives Ville's inequality for
e-processes, so that thresholding an e-process at `α⁻¹` is a level-`α` sequential test.

## Main definitions

* `ProbabilityTheory.IsEProcess E ℱ S`: `E` is an e-process for the null `S` and the filtration
Expand All @@ -51,6 +64,20 @@ almost surely smaller, and convex combinations.
`1` is an e-process, and the e-processes for a null form a convex set.
* `ProbabilityTheory.IsTestSupermartingale.isEProcess`: a test supermartingale for a null of
probability measures is an e-process [RW, Fact 7.5].
* `ProbabilityTheory.isEProcess_tfae`: the characterization of e-processes [RRLK, Lemma 6].
* `ProbabilityTheory.isEProcess_iff_forall_exists_isTestSupermartingale`,
`ProbabilityTheory.isEProcess_iff_forall_exists_isTestMartingale`: for a null of probability
measures, an adapted process is an e-process exactly when it is dominated by a test
supermartingale, or by a test martingale, under each member of the null.
* `ProbabilityTheory.IsEProcess.exists_isTestSupermartingale_ae_le`,
`ProbabilityTheory.IsEProcess.exists_isTestMartingale_ae_le`: an e-process is dominated by a
test supermartingale and by a test martingale under each member of the null.
* `ProbabilityTheory.IsEProcess.isEVar_stoppedValueLimsup`: the value of an e-process at every
stopping time with values in `WithTop ℕ` is an e-variable.
* `ProbabilityTheory.IsEProcess.measure_exists_le_le`,
`ProbabilityTheory.IsEProcess.measure_exists_inv_le_le`,
`ProbabilityTheory.IsEProcess.measure_inv_le_stoppedValueLimsup_le`: Ville's inequality for
e-processes, uniformly over time and at a stopping time.

## Implementation notes

Expand All @@ -63,11 +90,13 @@ The definition and its closure properties are adapted from

* [RW] A. Ramdas and R. Wang, *Hypothesis Testing with E-values*, Foundations and Trends in
Statistics 1 (2025), arXiv:2410.23614.
* [RRLK] A. Ramdas, J. Ruf, M. Larsson and W. M. Koolen, *Admissible anytime-valid sequential
inference must rely on nonnegative martingales*, arXiv:2009.03167v3, Lemma 6 and Appendix A.
-/

public section

open MeasureTheory Set
open MeasureTheory Filter Set
open scoped ENNReal

namespace ProbabilityTheory
Expand Down Expand Up @@ -175,4 +204,154 @@ theorem IsTestSupermartingale.isEProcess (hS : ∀ P ∈ S, IsProbabilityMeasure
{M : ℕ → Ω → ℝ≥0∞} (hM : IsTestSupermartingale M ℱ S) : IsEProcess M ℱ S :=
⟨hM.adapted, fun τ hτ ↦ by simpa using hM.isEVar_stoppedValueLimsup hS hτ⟩

/-! ### The characterization of e-processes -/

/-- Under a probability measure `P`, an adapted process with expectation at most `1` at every
bounded stopping time is `P`-almost surely dominated by a test supermartingale for `P`, its Snell
envelope. -/
private theorem exists_isTestSupermartingale_ae_le_of_lintegral_le_one [IsProbabilityMeasure P]
(hE : Adapted ℱ E) (h : ∀ τ ∈ boundedStoppingTimesFrom ℱ 0, ∫⁻ ω, E (τ ω) ω ∂P ≤ 1) :
∃ M, IsTestSupermartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n :=
⟨snellEnvelope E ℱ P, isTestSupermartingale_snellEnvelope h, ae_le_snellEnvelope hE⟩

/-- Under a probability measure `P`, a process that is `P`-almost surely dominated by a test
supermartingale for `P` is `P`-almost surely dominated by a test martingale for `P`. -/
private theorem exists_isTestMartingale_ae_le_of_isTestSupermartingale [IsProbabilityMeasure P]
(h : ∃ M, IsTestSupermartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n) :
∃ M, IsTestMartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n := by
obtain ⟨M, hM, hEM⟩ := h
obtain ⟨M', hM', -, hMM'⟩ := hM.exists_isTestMartingale_ge (mem_singleton P)
exact ⟨M', hM', fun n ↦ (hEM n).trans (ae_of_all _ (hMM' n))⟩

/-- **E-processes are dominated by test supermartingales** [RRLK, Lemma 6]. Under every
probability measure `P` of the null, an e-process is `P`-almost surely dominated by a test
supermartingale for `P`: its Snell envelope. -/
theorem IsEProcess.exists_isTestSupermartingale_ae_le (hE : IsEProcess E ℱ S) (hP : P ∈ S)
[IsProbabilityMeasure P] :
∃ M, IsTestSupermartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n :=
exists_isTestSupermartingale_ae_le_of_lintegral_le_one hE.adapted fun _ hτ ↦
hE.lintegral_le_one (mem_boundedStoppingTimesFrom_iff.1 hτ).1 hP

/-- **E-processes are dominated by test martingales** [RRLK, Lemma 6]. Under every probability
measure `P` of the null, an e-process is `P`-almost surely dominated by a test martingale for
`P`: the martingale part of its Snell envelope. -/
theorem IsEProcess.exists_isTestMartingale_ae_le (hE : IsEProcess E ℱ S) (hP : P ∈ S)
[IsProbabilityMeasure P] :
∃ M, IsTestMartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n :=
exists_isTestMartingale_ae_le_of_isTestSupermartingale
(hE.exists_isTestSupermartingale_ae_le hP)

/-- Under a probability measure `P`, the value at every stopping time with values in `WithTop ℕ`
of a process almost surely dominated by a test supermartingale for `P` has expectation at most
`1`, with the value `limsup` where the stopping time is infinite. -/
private theorem lintegral_stoppedValueLimsup_le_one_of_ae_le [IsProbabilityMeasure P]
{M : ℕ → Ω → ℝ≥0∞} (hM : IsTestSupermartingale M ℱ {P}) (hEM : ∀ n, E n ≤ᵐ[P] M n)
{τ : Ω → WithTop ℕ} (hτ : IsStoppingTime ℱ τ) :
∫⁻ ω, stoppedValueLimsup E τ ω ∂P ≤ 1 := by
refine (lintegral_mono_ae ?_).trans
(hM.lintegral_stoppedValueLimsup_le_one (mem_singleton P) hτ)
filter_upwards [ae_all_iff.2 hEM] with ω hω using stoppedValueLimsup_mono hω

/-- **The characterization of e-processes** [RRLK, Lemma 6]. For a null of probability measures
and an adapted process `E`, the following are equivalent:
1. `E` is an e-process: its value at every stopping time with values in `ℕ` is an e-variable;
2. `E` has expectation at most `1` at every bounded stopping time, under every member of the null;
3. the same at every stopping time with values in `WithTop ℕ`, with the value
`stoppedValueLimsup E τ`, the `limsup` of `E` where the stopping time is infinite;
4. the same with the `liminf` of `E` where the stopping time is infinite;
5. under every member `P` of the null, `E` is `P`-almost surely dominated by a test
supermartingale for `P`;
6. under every member `P` of the null, `E` is `P`-almost surely dominated by a test martingale
for `P`.

The dominating test (super)martingale may depend on `P`. -/
theorem isEProcess_tfae (hS : ∀ P ∈ S, IsProbabilityMeasure P) (hE : Adapted ℱ E) :
List.TFAE [IsEProcess E ℱ S,
∀ τ ∈ boundedStoppingTimesFrom ℱ 0, ∀ P ∈ S, ∫⁻ ω, E (τ ω) ω ∂P ≤ 1,
∀ τ : Ω → WithTop ℕ, IsStoppingTime ℱ τ → ∀ P ∈ S,
∫⁻ ω, stoppedValueLimsup E τ ω ∂P ≤ 1,
∀ τ : Ω → WithTop ℕ, IsStoppingTime ℱ τ → ∀ P ∈ S,
∫⁻ ω, (if τ ω = ⊤ then liminf (fun n ↦ E n ω) atTop else stoppedValue E τ ω) ∂P ≤ 1,
∀ P ∈ S, ∃ M, IsTestSupermartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n,
∀ P ∈ S, ∃ M, IsTestMartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n] := by
tfae_have 1 → 2 := fun h τ hτ P hP ↦ have := hS P hP
h.lintegral_le_one (mem_boundedStoppingTimesFrom_iff.1 hτ).1 hP
tfae_have 2 → 5 := fun h P hP ↦ have := hS P hP
exists_isTestSupermartingale_ae_le_of_lintegral_le_one hE fun τ hτ ↦ h τ hτ P hP
tfae_have 5 → 6 := fun h P hP ↦ have := hS P hP
exists_isTestMartingale_ae_le_of_isTestSupermartingale (h P hP)
tfae_have 6 → 5 := fun h P hP ↦ by
obtain ⟨M, hM, hEM⟩ := h P hP
exact ⟨M, hM.isTestSupermartingale, hEM⟩
tfae_have 5 → 3 := fun h τ hτ P hP ↦ by
obtain ⟨M, hM, hEM⟩ := h P hP
have := hS P hP
exact lintegral_stoppedValueLimsup_le_one_of_ae_le hM hEM hτ
tfae_have 3 → 4 := fun h τ hτ P hP ↦ by
refine (lintegral_mono fun ω ↦ ?_).trans (h τ hτ P hP)
-- the `liminf` is below the `limsup` where `τ` is infinite; elsewhere both read `E` at `τ`
by_cases hτω : τ ω = ⊤
· rw [ite_eq_left hτω, stoppedValueLimsup_of_eq_top hτω]
exact liminf_le_limsup
· rw [ite_eq_right hτω, stoppedValueLimsup_eq_stoppedValue hτω]
tfae_have 4 → 1 := fun h ↦ .of_lintegral_le_one hS hE fun τ hτ P hP ↦ by
refine le_of_eq_of_le (lintegral_congr fun ω ↦ ?_) (h _ hτ P hP)
-- `↑(τ ω) ≠ ⊤` selects the `stoppedValue` branch, and `stoppedValue E (↑τ) ω` is `E (τ ω) ω`
-- by definition, since `WithTop.untopA ↑n` reduces to `n` (Mathlib has no simp lemma for it)
exact (ite_eq_right (WithTop.natCast_ne_top _)).symm
tfae_finish

/-- **The characterization of e-processes by test supermartingales** [RRLK, Lemma 6]. For a null
of probability measures, an adapted process is an e-process exactly when, under every member `P`
of the null, it is `P`-almost surely dominated by a test supermartingale for `P`. -/
theorem isEProcess_iff_forall_exists_isTestSupermartingale (hS : ∀ P ∈ S, IsProbabilityMeasure P)
(hE : Adapted ℱ E) :
IsEProcess E ℱ S ↔ ∀ P ∈ S, ∃ M, IsTestSupermartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n :=
(isEProcess_tfae hS hE).out 1 5

/-- **The characterization of e-processes by test martingales** [RRLK, Lemma 6]. For a null of
probability measures, an adapted process is an e-process exactly when, under every member `P` of
the null, it is `P`-almost surely dominated by a test martingale for `P`. -/
theorem isEProcess_iff_forall_exists_isTestMartingale (hS : ∀ P ∈ S, IsProbabilityMeasure P)
(hE : Adapted ℱ E) :
IsEProcess E ℱ S ↔ ∀ P ∈ S, ∃ M, IsTestMartingale M ℱ {P} ∧ ∀ n, E n ≤ᵐ[P] M n :=
(isEProcess_tfae hS hE).out 1 6

/-- The value at every stopping time with values in `WithTop ℕ` of an e-process for a null of
probability measures is an e-variable, with the value `stoppedValueLimsup E τ`, the `limsup` of
`E`, where the stopping time is infinite. -/
theorem IsEProcess.isEVar_stoppedValueLimsup (hS : ∀ P ∈ S, IsProbabilityMeasure P)
(hE : IsEProcess E ℱ S) {τ : Ω → WithTop ℕ} (hτ : IsStoppingTime ℱ τ) :
IsEVar (stoppedValueLimsup E τ) S :=
IsEVar.of_lintegral_le_one hS (measurable_stoppedValueLimsup hE.measurable hτ.measurable')
fun P hP ↦ by
have h := ((isEProcess_tfae hS hE.adapted).out 1 3).1 hE
exact h τ hτ P hP

/-- **Ville's inequality for e-processes**, at level `α` [RW, Fact 7.6]. Under every probability
measure of the null, the sequential test that rejects as soon as an e-process reaches `α⁻¹` has
type I error at most `α`, uniformly over time. -/
theorem IsEProcess.measure_exists_inv_le_le (hE : IsEProcess E ℱ S) (hP : P ∈ S)
[IsProbabilityMeasure P] (α : ℝ≥0∞) : P {ω | ∃ n, α⁻¹ ≤ E n ω} ≤ α := by
obtain ⟨M, hM, hEM⟩ := hE.exists_isTestSupermartingale_ae_le hP
refine (measure_mono_ae ?_).trans (hM.measure_exists_inv_le_le (mem_singleton P) α)
filter_upwards [ae_all_iff.2 hEM] with ω hω ⟨n, hn⟩ using ⟨n, hn.trans (hω n)⟩

/-- **Ville's inequality for e-processes** [RW, Fact 7.6]. Under every probability measure of the
null, the probability that an e-process ever reaches a level `c` is at most `c⁻¹`. -/
theorem IsEProcess.measure_exists_le_le (hE : IsEProcess E ℱ S) (hP : P ∈ S)
[IsProbabilityMeasure P] (c : ℝ≥0∞) :
P {ω | ∃ n, c ≤ E n ω} ≤ c⁻¹ := by
simpa using hE.measure_exists_inv_le_le hP c⁻¹

/-- **Ville's inequality for e-processes at a stopping time.** Under every probability measure `P`
of the null, the probability that an e-process is at least `α⁻¹` at a stopping time with values in
`WithTop ℕ` is at most `α`, with the value `stoppedValueLimsup E τ`, the `limsup` of `E`, where
the stopping time is infinite. -/
theorem IsEProcess.measure_inv_le_stoppedValueLimsup_le (hE : IsEProcess E ℱ S) (hP : P ∈ S)
[IsProbabilityMeasure P] {τ : Ω → WithTop ℕ} (hτ : IsStoppingTime ℱ τ) (α : ℝ≥0∞) :
P {ω | α⁻¹ ≤ stoppedValueLimsup E τ ω} ≤ α :=
((hE.anti_set (singleton_subset_iff.2 hP)).isEVar_stoppedValueLimsup
(fun _ hQ ↦ (mem_singleton_iff.1 hQ) ▸ ‹_›) hτ).measure_inv_le_le (mem_singleton P) α

end ProbabilityTheory
39 changes: 39 additions & 0 deletions LMLExplore/EValues/TestSupermartingale.lean
Comment thread
RemyDegenne marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ stopping time `τ` is multiplied by a new supermartingale `B` that equals `1` up
`ProbabilityTheory.IsTestSupermartingale.ae_eq_mul_prod_div`: conversely, every test
supermartingale is almost surely the wealth `M 0 * ∏ k < n, M (k + 1) / M k` of its successive
ratios, which are conditional e-variables [WSR24, Proposition 3].
* `ProbabilityTheory.IsTestSupermartingale.exists_isTestMartingale_ge`: a test supermartingale for
`P` is below a test martingale for `P` with the same initial value, the martingale part of its
Doob decomposition.
* `ProbabilityTheory.IsTestSupermartingale.stoppedProcess_mul`,
`ProbabilityTheory.IsTestMartingale.stoppedProcess_mul`: optional continuation
[RW, Proposition 7.9].
Expand Down Expand Up @@ -468,6 +471,42 @@ theorem IsTestSupermartingale.ae_eq_mul_prod_div (hM : IsTestSupermartingale M
hM.toIsENNSupermartingale.ae_eq_mul_prod_div hP
(hM.lintegral_zero_ne_top hP)

/-! ### Domination by a test martingale -/

/-- **Test supermartingales are dominated by test martingales.** For a member `P` of the null on
which the filtration is σ-finite, a test supermartingale `M` is below the test martingale for `P`
obtained by adding back its predictable decreases,
`M n + ∑ k < n, (M k - P⁻[M (k + 1)|ℱ k])`, which has the same initial value. This is the
martingale part of the Doob decomposition of `M`, computed in `ℝ≥0∞` with no integrability. -/
theorem IsTestSupermartingale.exists_isTestMartingale_ge [SigmaFiniteFiltration P ℱ]
(hM : IsTestSupermartingale M ℱ S) (hP : P ∈ S) :
∃ M' : ℕ → Ω → ℝ≥0∞, IsTestMartingale M' ℱ {P} ∧ M' 0 = M 0 ∧ M ≤ M' := by
-- the predictable decrease of round `k`, known at time `k`
set D : ℕ → Ω → ℝ≥0∞ := fun k ω ↦ M k ω - P⁻[M (k + 1)|ℱ k] ω with hD_def
have hD (k : ℕ) : Measurable[ℱ k] (D k) := (hM.adapted k).sub (measurable_condLExp _ _ _)
have hA (n : ℕ) : Measurable[ℱ n] fun ω ↦ ∑ k ∈ range n, D k ω :=
Finset.measurable_sum _ fun k hk ↦ (hD k).mono (ℱ.mono (mem_range.1 hk).le) le_rfl
refine ⟨fun n ω ↦ M n ω + ∑ k ∈ range n, D k ω,
⟨fun n ↦ (hM.adapted n).add (hA n), ?_, ?_⟩, by simp, fun n ω ↦ le_self_add⟩
· intro Q hQ
rw [mem_singleton_iff.1 hQ]
simpa using hM.lintegral_zero_le P hP
· intro Q hQ n s hs
rw [mem_singleton_iff.1 hQ]
-- the conditional expectation of `M (n + 1)` given `ℱ n` is below `M n`
have hC : P⁻[M (n + 1)|ℱ n] ≤ᵐ[P] M n :=
(condLExp_ae_le_iff_forall_setLIntegral_le (ℱ.le n) (hM.adapted n)).2
(hM.setLIntegral_succ_le P hP n)
have hA' : Measurable fun ω ↦ ∑ k ∈ range (n + 1), D k ω :=
(hA (n + 1)).mono (ℱ.le (n + 1)) le_rfl
rw [lintegral_add_right _ hA', ← setLIntegral_condLExp (ℱ.le n) P (M (n + 1)) hs,
← lintegral_add_right _ hA']
refine lintegral_congr_ae (ae_restrict_of_ae ?_)
filter_upwards [hC] with ω hω
have h : P⁻[M (n + 1)|ℱ n] ω + D n ω = M n ω := add_tsub_cancel_of_le hω
rw [sum_range_succ, ← h]
ring

/-! ### Pulling a known factor out of a supermartingale step -/

/-- A factor `Y` and a set `s` that are `ℱ n`-measurable can be pulled out of a step of an
Expand Down
10 changes: 10 additions & 0 deletions LMLExplore/Probability/Process/StoppedValue.lean
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ optional stopping holds at every stopping time with this convention.
that time.
* `MeasureTheory.stoppedValueLimsup_eq_stoppedValue`: where `τ` is finite it agrees with Mathlib's
`stoppedValue`.
* `MeasureTheory.stoppedValueLimsup_mono`: it is monotone in the process.
* `MeasureTheory.tendsto_stoppedValueLimsup_min`: for a convergent process, the values at the
truncated times `min τ N` converge to the value at `τ`.
* `MeasureTheory.measurable_stoppedValueLimsup`: it is measurable for measurable `u n` and `τ`.
Expand Down Expand Up @@ -137,6 +138,15 @@ theorem tendsto_stoppedValueLimsup_min [TopologicalSpace β]

end ConditionallyCompleteLattice

/-- The value at a random time is monotone in the process: if `u n ω ≤ v n ω` at every time `n`,
then the value of `u` at `ω` at every random time is at most that of `v`. -/
theorem stoppedValueLimsup_mono [CompleteLattice β] {u v : ℕ → Ω → β}
(h : ∀ n, u n ω ≤ v n ω) : stoppedValueLimsup u τ ω ≤ stoppedValueLimsup v τ ω := by
unfold stoppedValueLimsup
split_ifs
· exact limsup_le_limsup (Eventually.of_forall h)
· exact h _

/-- The value of a process of measurable functions at a measurable random time is measurable. -/
theorem measurable_stoppedValueLimsup [ConditionallyCompleteLinearOrder β] [TopologicalSpace β]
[OrderTopology β] [SecondCountableTopology β] [MeasurableSpace β] [BorelSpace β]
Expand Down
Loading