state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω hab : a < b hn : lowerCrossingTime a b f N (n + 1) ω ≠ N h : upperCrossingTime a b f N (n + 1) ω = lowerCrossingTime a b f N (n + 1) ω ⊢ b ≤ f (upperCrossingTime a b f N (n + 1) ω) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h]
exact stoppedValue_upperCrossingTime (h.symm ▸ hn)
theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h]
Mathlib.Probability.Martingale.Upcrossing.243_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω hab : a < b hn : upperCrossingTime a b f N (n + 1) ω ≠ N ⊢ lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by
refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by
Mathlib.Probability.Martingale.Upcrossing.253_0.80Cpy4Qgm9i1y9y
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω hab : a < b hn : upperCrossingTime a b f N (n + 1) ω ≠ N h : lowerCrossingTime a b f N n ω = upperCrossingTime a b f N (n + 1) ω ⊢ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω ≤ a
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _
simp only [stoppedValue]
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _
Mathlib.Probability.Martingale.Upcrossing.253_0.80Cpy4Qgm9i1y9y
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω hab : a < b hn : upperCrossingTime a b f N (n + 1) ω ≠ N h : lowerCrossingTime a b f N n ω = upperCrossingTime a b f N (n + 1) ω ⊢ f (upperCrossingTime a b f N (n + 1) ω) ω ≤ a
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue]
rw [← h]
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue]
Mathlib.Probability.Martingale.Upcrossing.253_0.80Cpy4Qgm9i1y9y
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω hab : a < b hn : upperCrossingTime a b f N (n + 1) ω ≠ N h : lowerCrossingTime a b f N n ω = upperCrossingTime a b f N (n + 1) ω ⊢ f (lowerCrossingTime a b f N n ω) ω ≤ a
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h]
exact stoppedValue_lowerCrossingTime (h.symm ▸ hn)
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h]
Mathlib.Probability.Martingale.Upcrossing.253_0.80Cpy4Qgm9i1y9y
theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b ⊢ ∃ n, upperCrossingTime a b f N n ω = N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by
by_contra h
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by
Mathlib.Probability.Martingale.Upcrossing.290_0.80Cpy4Qgm9i1y9y
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b h : ¬∃ n, upperCrossingTime a b f N n ω = N ⊢ False
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h;
push_neg at h
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h;
Mathlib.Probability.Martingale.Upcrossing.290_0.80Cpy4Qgm9i1y9y
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b h : ∀ (n : ℕ), upperCrossingTime a b f N n ω ≠ N ⊢ False
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h
have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _)
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h
Mathlib.Probability.Martingale.Upcrossing.290_0.80Cpy4Qgm9i1y9y
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b h : ∀ (n : ℕ), upperCrossingTime a b f N n ω ≠ N this : StrictMono fun n => upperCrossingTime a b f N n ω ⊢ False
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _)
obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _)
Mathlib.Probability.Martingale.Upcrossing.290_0.80Cpy4Qgm9i1y9y
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N
Mathlib_Probability_Martingale_Upcrossing
case intro.intro.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b h : ∀ (n : ℕ), upperCrossingTime a b f N n ω ≠ N this : StrictMono fun n => upperCrossingTime a b f N n ω k : ℕ hk : N < (fun n => upperCrossingTime a b f N n ω) k ⊢ False
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩
exact not_le.2 hk upperCrossingTime_le
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩
Mathlib.Probability.Martingale.Upcrossing.290_0.80Cpy4Qgm9i1y9y
theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω hab : a < b ⊢ BddAbove {n | upperCrossingTime a b f N n ω < N}
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by
obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab
theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by
Mathlib.Probability.Martingale.Upcrossing.302_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N}
Mathlib_Probability_Martingale_Upcrossing
case intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω hab : a < b k : ℕ hk : upperCrossingTime a b f N k ω = N ⊢ BddAbove {n | upperCrossingTime a b f N n ω < N}
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab
refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩
theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab
Mathlib.Probability.Martingale.Upcrossing.302_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N}
Mathlib_Probability_Martingale_Upcrossing
case intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω hab : a < b k : ℕ hk : upperCrossingTime a b f N k ω = N n : ℕ hn : upperCrossingTime a b f N n ω < N ⊢ n ≤ k
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩
by_contra hn'
theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩
Mathlib.Probability.Martingale.Upcrossing.302_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N}
Mathlib_Probability_Martingale_Upcrossing
case intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω hab : a < b k : ℕ hk : upperCrossingTime a b f N k ω = N n : ℕ hn : upperCrossingTime a b f N n ω < N hn' : ¬n ≤ k ⊢ False
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn'
exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk)
theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn'
Mathlib.Probability.Martingale.Upcrossing.302_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N}
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b ⊢ upperCrossingTime a b f N N ω = N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by
by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab)
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
case pos Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b hN' : N < Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) ⊢ upperCrossingTime a b f N N ω = N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) ·
refine' le_antisymm upperCrossingTime_le _
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) ·
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
case pos Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b hN' : N < Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) ⊢ N ≤ upperCrossingTime a b f N N ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _
have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b hN' : N < Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) ⊢ StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.pred (Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N))))
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by
refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m✝ : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b hN' : N < Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) m : ℕ hm : m < Nat.pred (Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N)) ⊢ upperCrossingTime a b f N (m + 1) ω ≠ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _
rw [Nat.lt_pred_iff] at hm
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m✝ : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b hN' : N < Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) m : ℕ hm : Nat.succ m < Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) ⊢ upperCrossingTime a b f N (m + 1) ω ≠ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm
convert Nat.find_min _ hm
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
case pos Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b hN' : N < Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.pred (Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N)))) ⊢ N ≤ upperCrossingTime a b f N N ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm
convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN')
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
case neg Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b hN' : ¬N < Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) ⊢ upperCrossingTime a b f N N ω = N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') ·
rw [not_lt] at hN'
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') ·
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
case neg Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N✝ n m : ℕ ω✝ : Ω f : ℕ → Ω → ℝ N : ℕ ω : Ω hab : a < b hN' : Nat.find (_ : ∃ n, upperCrossingTime a b f N n ω = N) ≤ N ⊢ upperCrossingTime a b f N N ω = N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN'
exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab))
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN'
Mathlib.Probability.Martingale.Upcrossing.315_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f ⊢ IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by
induction' n with k ih
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
case zero Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f ⊢ IsStoppingTime ℱ (upperCrossingTime a b f N Nat.zero) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N Nat.zero)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih ·
refine' ⟨isStoppingTime_const _ 0, _⟩
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih ·
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
case zero Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f ⊢ IsStoppingTime ℱ (lowerCrossingTime a b f N Nat.zero)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩
simp [hitting_isStoppingTime hf measurableSet_Iic]
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
case succ Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f k : ℕ ih : IsStoppingTime ℱ (upperCrossingTime a b f N k) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N k) ⊢ IsStoppingTime ℱ (upperCrossingTime a b f N (Nat.succ k)) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N (Nat.succ k))
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] ·
obtain ⟨_, ih₂⟩ := ih
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] ·
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
case succ.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f k : ℕ left✝ : IsStoppingTime ℱ (upperCrossingTime a b f N k) ih₂ : IsStoppingTime ℱ (lowerCrossingTime a b f N k) ⊢ IsStoppingTime ℱ (upperCrossingTime a b f N (Nat.succ k)) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N (Nat.succ k))
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih
have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f k : ℕ left✝ : IsStoppingTime ℱ (upperCrossingTime a b f N k) ih₂ : IsStoppingTime ℱ (lowerCrossingTime a b f N k) ⊢ IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1))
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by
intro n
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f k : ℕ left✝ : IsStoppingTime ℱ (upperCrossingTime a b f N k) ih₂ : IsStoppingTime ℱ (lowerCrossingTime a b f N k) n : ℕ ⊢ MeasurableSet {ω | upperCrossingTime a b f N (k + 1) ω ≤ n}
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n
simp_rw [upperCrossingTime_succ_eq]
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f k : ℕ left✝ : IsStoppingTime ℱ (upperCrossingTime a b f N k) ih₂ : IsStoppingTime ℱ (lowerCrossingTime a b f N k) n : ℕ ⊢ MeasurableSet {ω | hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) N ω ≤ n}
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq]
exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq]
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
case succ.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f k : ℕ left✝ : IsStoppingTime ℱ (upperCrossingTime a b f N k) ih₂ : IsStoppingTime ℱ (lowerCrossingTime a b f N k) this : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) ⊢ IsStoppingTime ℱ (upperCrossingTime a b f N (Nat.succ k)) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N (Nat.succ k))
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _
refine' ⟨this, _⟩
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
case succ.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f k : ℕ left✝ : IsStoppingTime ℱ (upperCrossingTime a b f N k) ih₂ : IsStoppingTime ℱ (lowerCrossingTime a b f N k) this : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) ⊢ IsStoppingTime ℱ (lowerCrossingTime a b f N (Nat.succ k))
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ ·
intro n
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ ·
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
case succ.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f k : ℕ left✝ : IsStoppingTime ℱ (upperCrossingTime a b f N k) ih₂ : IsStoppingTime ℱ (lowerCrossingTime a b f N k) this : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) n : ℕ ⊢ MeasurableSet {ω | lowerCrossingTime a b f N (Nat.succ k) ω ≤ n}
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n
exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n
Mathlib.Probability.Martingale.Upcrossing.337_0.80Cpy4Qgm9i1y9y
theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 ⊢ upcrossingStrat a b f N n ω ≤ 1
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by
rw [upcrossingStrat, ← Finset.indicator_biUnion_apply]
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 ⊢ Set.indicator (⋃ i ∈ Finset.range N, Set.Ico (lowerCrossingTime a b f N i ω) (upperCrossingTime a b f N (i + 1) ω)) 1 n ≤ 1
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] ·
exact Set.indicator_le_self' (fun _ _ => zero_le_one) _
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] ·
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
case h Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 ⊢ Set.PairwiseDisjoint ↑(Finset.range N) fun k => Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _
intro i _ j _ hij
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
case h Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 i : ℕ a✝¹ : i ∈ ↑(Finset.range N) j : ℕ a✝ : j ∈ ↑(Finset.range N) hij : i ≠ j ⊢ (Disjoint on fun k => Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)) i j
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij
simp only [Set.Ico_disjoint_Ico]
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
case h Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 i : ℕ a✝¹ : i ∈ ↑(Finset.range N) j : ℕ a✝ : j ∈ ↑(Finset.range N) hij : i ≠ j ⊢ min (upperCrossingTime a b f N (i + 1) ω) (upperCrossingTime a b f N (j + 1) ω) ≤ max (lowerCrossingTime a b f N i ω) (lowerCrossingTime a b f N j ω)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico]
obtain hij' | hij' := lt_or_gt_of_ne hij
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico]
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
case h.inl Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 i : ℕ a✝¹ : i ∈ ↑(Finset.range N) j : ℕ a✝ : j ∈ ↑(Finset.range N) hij : i ≠ j hij' : i < j ⊢ min (upperCrossingTime a b f N (i + 1) ω) (upperCrossingTime a b f N (j + 1) ω) ≤ max (lowerCrossingTime a b f N i ω) (lowerCrossingTime a b f N j ω)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij ·
rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij ·
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
case h.inl Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 i : ℕ a✝¹ : i ∈ ↑(Finset.range N) j : ℕ a✝ : j ∈ ↑(Finset.range N) hij : i ≠ j hij' : i < j ⊢ upperCrossingTime a b f N (Nat.succ i) ω ≤ lowerCrossingTime a b f N j ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij'))
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
case h.inr Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 i : ℕ a✝¹ : i ∈ ↑(Finset.range N) j : ℕ a✝ : j ∈ ↑(Finset.range N) hij : i ≠ j hij' : i > j ⊢ min (upperCrossingTime a b f N (i + 1) ω) (upperCrossingTime a b f N (j + 1) ω) ≤ max (lowerCrossingTime a b f N i ω) (lowerCrossingTime a b f N j ω)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) ·
rw [gt_iff_lt] at hij'
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) ·
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
case h.inr Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 i : ℕ a✝¹ : i ∈ ↑(Finset.range N) j : ℕ a✝ : j ∈ ↑(Finset.range N) hij : i ≠ j hij' : j < i ⊢ min (upperCrossingTime a b f N (i + 1) ω) (upperCrossingTime a b f N (j + 1) ω) ≤ max (lowerCrossingTime a b f N i ω) (lowerCrossingTime a b f N j ω)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij'
rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij'
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
case h.inr Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 i : ℕ a✝¹ : i ∈ ↑(Finset.range N) j : ℕ a✝ : j ∈ ↑(Finset.range N) hij : i ≠ j hij' : j < i ⊢ upperCrossingTime a b f N (Nat.succ j) ω ≤ lowerCrossingTime a b f N i ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij'))
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)]
Mathlib.Probability.Martingale.Upcrossing.377_0.80Cpy4Qgm9i1y9y
theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f ⊢ Adapted ℱ (upcrossingStrat a b f N)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by
intro n
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by
Mathlib.Probability.Martingale.Upcrossing.398_0.80Cpy4Qgm9i1y9y
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f n : ℕ ⊢ StronglyMeasurable (upcrossingStrat a b f N n)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n
change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n
Mathlib.Probability.Martingale.Upcrossing.398_0.80Cpy4Qgm9i1y9y
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f n : ℕ ⊢ StronglyMeasurable fun ω => ∑ k in Finset.range N, Set.indicator ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}) 1 n
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n
refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _)
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n
Mathlib.Probability.Martingale.Upcrossing.398_0.80Cpy4Qgm9i1y9y
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f n i : ℕ x✝ : i ∈ Finset.range N ⊢ MeasurableSet fun ω => setOf (fun n => n < upperCrossingTime a b f N (i + 1) ω) n
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _)
simp_rw [← not_le]
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _)
Mathlib.Probability.Martingale.Upcrossing.398_0.80Cpy4Qgm9i1y9y
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n✝ m : ℕ ω : Ω ℱ : Filtration ℕ m0 hf : Adapted ℱ f n i : ℕ x✝ : i ∈ Finset.range N ⊢ MeasurableSet fun ω => setOf (fun n => ¬upperCrossingTime a b f N (i + 1) ω ≤ n) n
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le]
exact (hf.isStoppingTime_upperCrossingTime n).compl
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le]
Mathlib.Probability.Martingale.Upcrossing.398_0.80Cpy4Qgm9i1y9y
theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N)
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a✝ b✝ : ℝ f : ℕ → Ω → ℝ N✝ n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ a b : ℝ N : ℕ ⊢ Submartingale (fun n => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by
refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by
Mathlib.Probability.Martingale.Upcrossing.417_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ
Mathlib_Probability_Martingale_Upcrossing
case refine'_1 Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a✝ b✝ : ℝ f : ℕ → Ω → ℝ N✝ n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ a b : ℝ N : ℕ ⊢ ∀ (n : ℕ) (ω : Ω), (1 - upcrossingStrat a b f N n) ω ≤ 1
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ ·
exact fun n ω => sub_le_self _ upcrossingStrat_nonneg
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ ·
Mathlib.Probability.Martingale.Upcrossing.417_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ
Mathlib_Probability_Martingale_Upcrossing
case refine'_2 Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a✝ b✝ : ℝ f : ℕ → Ω → ℝ N✝ n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ a b : ℝ N : ℕ ⊢ ∀ (n : ℕ) (ω : Ω), 0 ≤ (1 - upcrossingStrat a b f N n) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg ·
intro n ω
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg ·
Mathlib.Probability.Martingale.Upcrossing.417_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ
Mathlib_Probability_Martingale_Upcrossing
case refine'_2 Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a✝ b✝ : ℝ f : ℕ → Ω → ℝ N✝ n✝ m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ a b : ℝ N n : ℕ ω : Ω ⊢ 0 ≤ (1 - upcrossingStrat a b f N n) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω
simp [upcrossingStrat_le_one]
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω
Mathlib.Probability.Martingale.Upcrossing.417_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ ⊢ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ≤ ∫ (x : Ω), f n x ∂μ - ∫ (x : Ω), f 0 x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by
have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl]
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ ⊢ 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by
have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ this : ∫ (ω : Ω) in Set.univ, Finset.sum (Finset.range 0) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ω ∂μ ≤ ∫ (ω : Ω) in Set.univ, Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ω ∂μ ⊢ 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ
rw [integral_univ, integral_univ] at this
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ this : ∫ (x : Ω), Finset.sum (Finset.range 0) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ⊢ 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this
refine' le_trans _ this
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ this : ∫ (x : Ω), Finset.sum (Finset.range 0) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ⊢ 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range 0) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this
simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl]
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ⊢ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ≤ ∫ (x : Ω), f n x ∂μ - ∫ (x : Ω), f 0 x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl]
have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl]
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ⊢ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ = ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => f (k + 1) - f k) x ∂μ - ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by
simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply]
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ⊢ ∫ (x : Ω), ∑ x_1 in Finset.range n, f (x_1 + 1) x - ∑ x_1 in Finset.range n, f x_1 x - ∑ x_1 in Finset.range n, upcrossingStrat a b f N x_1 x * (f (x_1 + 1) x - f x_1 x) ∂μ = ∫ (x : Ω), ∑ x_1 in Finset.range n, f (x_1 + 1) x - ∑ x_1 in Finset.range n, f x_1 x ∂μ - ∫ (x : Ω), ∑ x_1 in Finset.range n, upcrossingStrat a b f N x_1 x * (f (x_1 + 1) x - f x_1 x) ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply]
refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply]
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ⊢ Integrable fun x => ∑ x_1 in Finset.range n, upcrossingStrat a b f N x_1 x * (f (x_1 + 1) x - f x_1 x)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _
convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
case h.e'_5 Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ ⊢ (fun x => ∑ x_1 in Finset.range n, upcrossingStrat a b f N x_1 x * (f (x_1 + 1) x - f x_1 x)) = ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1
ext
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
case h.e'_5.h Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ x✝ : Ω ⊢ ∑ x in Finset.range n, upcrossingStrat a b f N x x✝ * (f (x + 1) x✝ - f x x✝) = Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x✝
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext;
simp
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext;
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : 0 ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ h₂ : ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ = ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => f (k + 1) - f k) x ∂μ - ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ⊢ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ≤ ∫ (x : Ω), f n x ∂μ - ∫ (x : Ω), f 0 x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp
rw [h₂, sub_nonneg] at h₁
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => f (k + 1) - f k) x ∂μ h₂ : ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ = ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => f (k + 1) - f k) x ∂μ - ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ⊢ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ≤ ∫ (x : Ω), f n x ∂μ - ∫ (x : Ω), f 0 x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁
refine' le_trans h₁ _
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 inst✝ : IsFiniteMeasure μ hf : Submartingale f ℱ μ h₁ : ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ≤ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => f (k + 1) - f k) x ∂μ h₂ : ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) x ∂μ = ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => f (k + 1) - f k) x ∂μ - ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => upcrossingStrat a b f N k * (f (k + 1) - f k)) x ∂μ ⊢ ∫ (x : Ω), Finset.sum (Finset.range n) (fun k => f (k + 1) - f k) x ∂μ ≤ ∫ (x : Ω), f n x ∂μ - ∫ (x : Ω), f 0 x ∂μ
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _
simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl]
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _
Mathlib.Probability.Martingale.Upcrossing.427_0.80Cpy4Qgm9i1y9y
theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0]
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a✝ b✝ : ℝ f✝ : ℕ → Ω → ℝ N n m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 inst✝² : Preorder ι inst✝¹ : OrderBot ι inst✝ : InfSet ι a b : ℝ f : ι → Ω → ℝ ω : Ω ⊢ upcrossingsBefore a b f ⊥ ω = ⊥
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by
simp [upcrossingsBefore]
@[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by
Mathlib.Probability.Martingale.Upcrossing.455_0.80Cpy4Qgm9i1y9y
@[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 ⊢ upcrossingsBefore a b f 0 ω = 0
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by
simp [upcrossingsBefore]
theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by
Mathlib.Probability.Martingale.Upcrossing.460_0.80Cpy4Qgm9i1y9y
theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 ⊢ upcrossingsBefore a b f 0 = 0
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by
ext ω
@[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by
Mathlib.Probability.Martingale.Upcrossing.463_0.80Cpy4Qgm9i1y9y
@[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0
Mathlib_Probability_Martingale_Upcrossing
case h Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 ω : Ω ⊢ upcrossingsBefore a b f 0 ω = OfNat.ofNat 0 ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω;
exact upcrossingsBefore_zero
@[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω;
Mathlib.Probability.Martingale.Upcrossing.463_0.80Cpy4Qgm9i1y9y
@[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hab : a < b hn : upcrossingsBefore a b f N ω < n ⊢ upperCrossingTime a b f N n ω = N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by
refine' le_antisymm upperCrossingTime_le (not_lt.1 _)
theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by
Mathlib.Probability.Martingale.Upcrossing.476_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 hab : a < b hn : upcrossingsBefore a b f N ω < n ⊢ ¬upperCrossingTime a b f N n ω < N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _)
convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab)
theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _)
Mathlib.Probability.Martingale.Upcrossing.476_0.80Cpy4Qgm9i1y9y
theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N n m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 f : ℕ → Ω → ℝ ω : Ω hab : a < b ⊢ upcrossingsBefore a b f N ω ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by
by_cases hN : N = 0
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by
Mathlib.Probability.Martingale.Upcrossing.482_0.80Cpy4Qgm9i1y9y
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N
Mathlib_Probability_Martingale_Upcrossing
case pos Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N n m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 f : ℕ → Ω → ℝ ω : Ω hab : a < b hN : N = 0 ⊢ upcrossingsBefore a b f N ω ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 ·
subst hN
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 ·
Mathlib.Probability.Martingale.Upcrossing.482_0.80Cpy4Qgm9i1y9y
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N
Mathlib_Probability_Martingale_Upcrossing
case pos Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ n m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 f : ℕ → Ω → ℝ ω : Ω hab : a < b ⊢ upcrossingsBefore a b f 0 ω ≤ 0
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN
rw [upcrossingsBefore_zero]
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN
Mathlib.Probability.Martingale.Upcrossing.482_0.80Cpy4Qgm9i1y9y
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N
Mathlib_Probability_Martingale_Upcrossing
case neg Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N n m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 f : ℕ → Ω → ℝ ω : Ω hab : a < b hN : ¬N = 0 ⊢ upcrossingsBefore a b f N ω ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] ·
refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] ·
Mathlib.Probability.Martingale.Upcrossing.482_0.80Cpy4Qgm9i1y9y
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N
Mathlib_Probability_Martingale_Upcrossing
case neg Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N n✝ m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 f : ℕ → Ω → ℝ ω : Ω hab : a < b hN : ¬N = 0 n : ℕ hn : upperCrossingTime a b f N n ω < N ⊢ n ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _
by_contra hnN
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _
Mathlib.Probability.Martingale.Upcrossing.482_0.80Cpy4Qgm9i1y9y
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N
Mathlib_Probability_Martingale_Upcrossing
case neg Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f✝ : ℕ → Ω → ℝ N n✝ m : ℕ ω✝ : Ω ℱ : Filtration ℕ m0 f : ℕ → Ω → ℝ ω : Ω hab : a < b hN : ¬N = 0 n : ℕ hn : upperCrossingTime a b f N n ω < N hnN : ¬n ≤ N ⊢ False
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN
exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le)
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN
Mathlib.Probability.Martingale.Upcrossing.482_0.80Cpy4Qgm9i1y9y
theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : lowerCrossingTime a b f N n ω < N ⊢ upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by
have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : lowerCrossingTime a b f N n ω < N h' : upperCrossingTime a b f N n ω < N ⊢ upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h
induction' n with k ih
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case zero Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : lowerCrossingTime a b f N Nat.zero ω < N h' : upperCrossingTime a b f N Nat.zero ω < N ⊢ upperCrossingTime a b f M Nat.zero ω = upperCrossingTime a b f N Nat.zero ω ∧ lowerCrossingTime a b f M Nat.zero ω = lowerCrossingTime a b f N Nat.zero ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih ·
simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm]
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih ·
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case zero Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : lowerCrossingTime a b f N Nat.zero ω < N h' : upperCrossingTime a b f N Nat.zero ω < N ⊢ hitting f (Set.Iic a) 0 N ω = hitting f (Set.Iic a) 0 M ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm]
refine' hitting_eq_hitting_of_exists hNM _
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm]
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case zero Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : lowerCrossingTime a b f N Nat.zero ω < N h' : upperCrossingTime a b f N Nat.zero ω < N ⊢ ∃ j ∈ Set.Icc 0 N, f j ω ∈ Set.Iic a
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _
rw [lowerCrossingTime, hitting_lt_iff] at h
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case zero Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : ∃ j ∈ Set.Ico (upperCrossingTime a b f N Nat.zero ω) N, f j ω ∈ Set.Iic a h' : upperCrossingTime a b f N Nat.zero ω < N ⊢ ∃ j ∈ Set.Icc 0 N, f j ω ∈ Set.Iic a case zero.hi Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : hitting f (Set.Iic a) (upperCrossingTime a b f N Nat.zero ω) N ω < N h' : upperCrossingTime a b f N Nat.zero ω < N ⊢ N ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h
obtain ⟨j, hj₁, hj₂⟩ := h
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case zero.intro.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h' : upperCrossingTime a b f N Nat.zero ω < N j : ℕ hj₁ : j ∈ Set.Ico (upperCrossingTime a b f N Nat.zero ω) N hj₂ : f j ω ∈ Set.Iic a ⊢ ∃ j ∈ Set.Icc 0 N, f j ω ∈ Set.Iic a case zero.hi Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : hitting f (Set.Iic a) (upperCrossingTime a b f N Nat.zero ω) N ω < N h' : upperCrossingTime a b f N Nat.zero ω < N ⊢ N ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h
exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl]
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case succ Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ ih : lowerCrossingTime a b f N k ω < N → upperCrossingTime a b f N k ω < N → upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : upperCrossingTime a b f N (Nat.succ k) ω < N ⊢ upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω ∧ lowerCrossingTime a b f M (Nat.succ k) ω = lowerCrossingTime a b f N (Nat.succ k) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] ·
specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h')
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] ·
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case succ Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : upperCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω ⊢ upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω ∧ lowerCrossingTime a b f M (Nat.succ k) ω = lowerCrossingTime a b f N (Nat.succ k) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h')
have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl]
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h')
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : upperCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω ⊢ upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by
rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h'
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : ∃ j ∈ Set.Ico (lowerCrossingTime a b f N k ω) N, f j ω ∈ Set.Ici b ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω ⊢ upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω case hi Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) N ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω ⊢ N ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h'
simp only [upperCrossingTime_succ_eq]
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h'
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : ∃ j ∈ Set.Ico (lowerCrossingTime a b f N k ω) N, f j ω ∈ Set.Ici b ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω ⊢ hitting f (Set.Ici b) (lowerCrossingTime a b f M k ω) M ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) N ω case hi Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) N ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω ⊢ N ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq]
obtain ⟨j, hj₁, hj₂⟩ := h'
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq]
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case intro.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω j : ℕ hj₁ : j ∈ Set.Ico (lowerCrossingTime a b f N k ω) N hj₂ : f j ω ∈ Set.Ici b ⊢ hitting f (Set.Ici b) (lowerCrossingTime a b f M k ω) M ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) N ω case hi Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) N ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω ⊢ N ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h'
rw [eq_comm, ih.2]
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h'
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case intro.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω j : ℕ hj₁ : j ∈ Set.Ico (lowerCrossingTime a b f N k ω) N hj₂ : f j ω ∈ Set.Ici b ⊢ hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) N ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) M ω case hi Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : hitting f (Set.Ici b) (lowerCrossingTime a b f N k ω) N ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω ⊢ N ≤ N
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2]
exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl]
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2]
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case succ Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : upperCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω this : upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω ⊢ upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω ∧ lowerCrossingTime a b f M (Nat.succ k) ω = lowerCrossingTime a b f N (Nat.succ k) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl]
refine' ⟨this, _⟩
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl]
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case succ Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : upperCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω this : upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω ⊢ lowerCrossingTime a b f M (Nat.succ k) ω = lowerCrossingTime a b f N (Nat.succ k) ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩
simp only [lowerCrossingTime, eq_comm, this]
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case succ Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : upperCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω this : upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω ⊢ hitting f (Set.Iic a) (upperCrossingTime a b f N (Nat.succ k) ω) N ω = hitting f (Set.Iic a) (upperCrossingTime a b f N (Nat.succ k) ω) M ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this]
refine' hitting_eq_hitting_of_exists hNM _
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this]
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case succ Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : lowerCrossingTime a b f N (Nat.succ k) ω < N h' : upperCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω this : upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω ⊢ ∃ j ∈ Set.Icc (upperCrossingTime a b f N (Nat.succ k) ω) N, f j ω ∈ Set.Iic a
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this] refine' hitting_eq_hitting_of_exists hNM _
rw [lowerCrossingTime, hitting_lt_iff _ le_rfl] at h
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this] refine' hitting_eq_hitting_of_exists hNM _
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case succ Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h : ∃ j ∈ Set.Ico (upperCrossingTime a b f N (Nat.succ k) ω) N, f j ω ∈ Set.Iic a h' : upperCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω this : upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω ⊢ ∃ j ∈ Set.Icc (upperCrossingTime a b f N (Nat.succ k) ω) N, f j ω ∈ Set.Iic a
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff _ le_rfl] at h
obtain ⟨j, hj₁, hj₂⟩ := h
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff _ le_rfl] at h
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
case succ.intro.intro Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M k : ℕ h' : upperCrossingTime a b f N (Nat.succ k) ω < N ih : upperCrossingTime a b f M k ω = upperCrossingTime a b f N k ω ∧ lowerCrossingTime a b f M k ω = lowerCrossingTime a b f N k ω this : upperCrossingTime a b f M (Nat.succ k) ω = upperCrossingTime a b f N (Nat.succ k) ω j : ℕ hj₁ : j ∈ Set.Ico (upperCrossingTime a b f N (Nat.succ k) ω) N hj₂ : f j ω ∈ Set.Iic a ⊢ ∃ j ∈ Set.Icc (upperCrossingTime a b f N (Nat.succ k) ω) N, f j ω ∈ Set.Iic a
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff _ le_rfl] at h obtain ⟨j, hj₁, hj₂⟩ := h
exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff _ le_rfl] at h obtain ⟨j, hj₁, hj₂⟩ := h
Mathlib.Probability.Martingale.Upcrossing.492_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing
Ω : Type u_1 ι : Type u_2 m0 : MeasurableSpace Ω μ : Measure Ω a b : ℝ f : ℕ → Ω → ℝ N n m : ℕ ω : Ω ℱ : Filtration ℕ m0 M : ℕ hNM : N ≤ M h : upperCrossingTime a b f N (n + 1) ω < N ⊢ upperCrossingTime a b f M (n + 1) ω = upperCrossingTime a b f N (n + 1) ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
/- Copyright (c) 2022 Kexing Ying. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kexing Ying -/ import Mathlib.Data.Set.Intervals.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" /-! # Doob's upcrossing estimate Given a discrete real-valued submartingale $(f_n)_{n \in \mathbb{N}}$, denoting by $U_N(a, b)$ the number of times $f_n$ crossed from below $a$ to above $b$ before time $N$, Doob's upcrossing estimate (also known as Doob's inequality) states that $$(b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(f_N - a)^+].$$ Doob's upcrossing estimate is an important inequality and is central in proving the martingale convergence theorems. ## Main definitions * `MeasureTheory.upperCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing above `b` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.lowerCrossingTime a b f N n`: is the stopping time corresponding to `f` crossing below `a` the `n`-th time before time `N` (if this does not occur then the value is taken to be `N`). * `MeasureTheory.upcrossingStrat a b f N`: is the predictable process which is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. Intuitively one might think of the `upcrossingStrat` as the strategy of buying 1 share whenever the process crosses below `a` for the first time after selling and selling 1 share whenever the process crosses above `b` for the first time after buying. * `MeasureTheory.upcrossingsBefore a b f N`: is the number of times `f` crosses from below `a` to above `b` before time `N`. * `MeasureTheory.upcrossings a b f`: is the number of times `f` crosses from below `a` to above `b`. This takes value in `ℝ≥0∞` and so is allowed to be `∞`. ## Main results * `MeasureTheory.Adapted.isStoppingTime_upperCrossingTime`: `upperCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime`: `lowerCrossingTime` is a stopping time whenever the process it is associated to is adapted. * `MeasureTheory.Submartingale.mul_integral_upcrossingsBefore_le_integral_pos_part`: Doob's upcrossing estimate. * `MeasureTheory.Submartingale.mul_lintegral_upcrossings_le_lintegral_pos_part`: the inequality obtained by taking the supremum on both sides of Doob's upcrossing estimate. ### References We mostly follow the proof from [Kallenberg, *Foundations of modern probability*][kallenberg2021] -/ open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology namespace MeasureTheory variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} /-! ## Proof outline In this section, we will denote by $U_N(a, b)$ the number of upcrossings of $(f_n)$ from below $a$ to above $b$ before time $N$. To define $U_N(a, b)$, we will construct two stopping times corresponding to when $(f_n)$ crosses below $a$ and above $b$. Namely, we define $$ \sigma_n := \inf \{n \ge \tau_n \mid f_n \le a\} \wedge N; $$ $$ \tau_{n + 1} := \inf \{n \ge \sigma_n \mid f_n \ge b\} \wedge N. $$ These are `lowerCrossingTime` and `upperCrossingTime` in our formalization which are defined using `MeasureTheory.hitting` allowing us to specify a starting and ending time. Then, we may simply define $U_N(a, b) := \sup \{n \mid \tau_n < N\}$. Fixing $a < b \in \mathbb{R}$, we will first prove the theorem in the special case that $0 \le f_0$ and $a \le f_N$. In particular, we will show $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[f_N]. $$ This is `MeasureTheory.integral_mul_upcrossingsBefore_le_integral` in our formalization. To prove this, we use the fact that given a non-negative, bounded, predictable process $(C_n)$ (i.e. $(C_{n + 1})$ is adapted), $(C \bullet f)_n := \sum_{k \le n} C_{k + 1}(f_{k + 1} - f_k)$ is a submartingale if $(f_n)$ is. Define $C_n := \sum_{k \le n} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)$. It is easy to see that $(1 - C_n)$ is non-negative, bounded and predictable, and hence, given a submartingale $(f_n)$, $(1 - C) \bullet f$ is also a submartingale. Thus, by the submartingale property, $0 \le \mathbb{E}[((1 - C) \bullet f)_0] \le \mathbb{E}[((1 - C) \bullet f)_N]$ implying $$ \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[(1 \bullet f)_N] = \mathbb{E}[f_N] - \mathbb{E}[f_0]. $$ Furthermore, \begin{align} (C \bullet f)_N & = \sum_{n \le N} \sum_{k \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} \sum_{n \le N} \mathbf{1}_{[\sigma_k, \tau_{k + 1})}(n)(f_{n + 1} - f_n)\\ & = \sum_{k \le N} (f_{\sigma_k + 1} - f_{\sigma_k} + f_{\sigma_k + 2} - f_{\sigma_k + 1} + \cdots + f_{\tau_{k + 1}} - f_{\tau_{k + 1} - 1})\\ & = \sum_{k \le N} (f_{\tau_{k + 1}} - f_{\sigma_k}) \ge \sum_{k < U_N(a, b)} (b - a) = (b - a) U_N(a, b) \end{align} where the inequality follows since for all $k < U_N(a, b)$, $f_{\tau_{k + 1}} - f_{\sigma_k} \ge b - a$ while for all $k > U_N(a, b)$, $f_{\tau_{k + 1}} = f_{\sigma_k} = f_N$ and $f_{\tau_{U_N(a, b) + 1}} - f_{\sigma_{U_N(a, b)}} = f_N - a \ge 0$. Hence, we have $$ (b - a) \mathbb{E}[U_N(a, b)] \le \mathbb{E}[(C \bullet f)_N] \le \mathbb{E}[f_N] - \mathbb{E}[f_0] \le \mathbb{E}[f_N], $$ as required. To obtain the general case, we simply apply the above to $((f_n - a)^+)_n$. -/ /-- `lowerCrossingTimeAux a f c N` is the first time `f` reached below `a` after time `c` before time `N`. -/ noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) : Ω → ι := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux /-- `upperCrossingTime a b f N n` is the first time before time `N`, `f` reaches above `b` after `f` reached below `a` for the `n - 1`-th time. -/ noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) : ℕ → Ω → ι | 0 => ⊥ | n + 1 => fun ω => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime /-- `lowerCrossingTime a b f N n` is the first time before time `N`, `f` reaches below `a` after `f` reached above `b` for the `n`-th time. -/ noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ι] [OrderBot ι] [InfSet ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω = hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ι] variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω} theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by cases n · simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] · simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero' theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by simp only [lowerCrossingTime, hitting_le ω] #align measure_theory.lower_crossing_time_le MeasureTheory.lowerCrossingTime_le theorem upperCrossingTime_le_lowerCrossingTime : upperCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N n ω := by simp only [lowerCrossingTime, le_hitting upperCrossingTime_le ω] #align measure_theory.upper_crossing_time_le_lower_crossing_time MeasureTheory.upperCrossingTime_le_lowerCrossingTime theorem lowerCrossingTime_le_upperCrossingTime_succ : lowerCrossingTime a b f N n ω ≤ upperCrossingTime a b f N (n + 1) ω := by rw [upperCrossingTime_succ] exact le_hitting lowerCrossingTime_le ω #align measure_theory.lower_crossing_time_le_upper_crossing_time_succ MeasureTheory.lowerCrossingTime_le_upperCrossingTime_succ theorem lowerCrossingTime_mono (hnm : n ≤ m) : lowerCrossingTime a b f N n ω ≤ lowerCrossingTime a b f N m ω := by suffices Monotone fun n => lowerCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans lowerCrossingTime_le_upperCrossingTime_succ upperCrossingTime_le_lowerCrossingTime #align measure_theory.lower_crossing_time_mono MeasureTheory.lowerCrossingTime_mono theorem upperCrossingTime_mono (hnm : n ≤ m) : upperCrossingTime a b f N n ω ≤ upperCrossingTime a b f N m ω := by suffices Monotone fun n => upperCrossingTime a b f N n ω by exact this hnm exact monotone_nat_of_le_succ fun n => le_trans upperCrossingTime_le_lowerCrossingTime lowerCrossingTime_le_upperCrossingTime_succ #align measure_theory.upper_crossing_time_mono MeasureTheory.upperCrossingTime_mono end ConditionallyCompleteLinearOrderBot variable {a b : ℝ} {f : ℕ → Ω → ℝ} {N : ℕ} {n m : ℕ} {ω : Ω} theorem stoppedValue_lowerCrossingTime (h : lowerCrossingTime a b f N n ω ≠ N) : stoppedValue f (lowerCrossingTime a b f N n) ω ≤ a := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne lowerCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 lowerCrossingTime_le⟩, hj₂⟩ #align measure_theory.stopped_value_lower_crossing_time MeasureTheory.stoppedValue_lowerCrossingTime theorem stoppedValue_upperCrossingTime (h : upperCrossingTime a b f N (n + 1) ω ≠ N) : b ≤ stoppedValue f (upperCrossingTime a b f N (n + 1)) ω := by obtain ⟨j, hj₁, hj₂⟩ := (hitting_le_iff_of_lt _ (lt_of_le_of_ne upperCrossingTime_le h)).1 le_rfl exact stoppedValue_hitting_mem ⟨j, ⟨hj₁.1, le_trans hj₁.2 (hitting_le _)⟩, hj₂⟩ #align measure_theory.stopped_value_upper_crossing_time MeasureTheory.stoppedValue_upperCrossingTime theorem upperCrossingTime_lt_lowerCrossingTime (hab : a < b) (hn : lowerCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N (n + 1) ω < lowerCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne upperCrossingTime_le_lowerCrossingTime fun h => not_le.2 hab <| le_trans _ (stoppedValue_lowerCrossingTime hn) simp only [stoppedValue] rw [← h] exact stoppedValue_upperCrossingTime (h.symm ▸ hn) #align measure_theory.upper_crossing_time_lt_lower_crossing_time MeasureTheory.upperCrossingTime_lt_lowerCrossingTime theorem lowerCrossingTime_lt_upperCrossingTime (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : lowerCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := by refine' lt_of_le_of_ne lowerCrossingTime_le_upperCrossingTime_succ fun h => not_le.2 hab <| le_trans (stoppedValue_upperCrossingTime hn) _ simp only [stoppedValue] rw [← h] exact stoppedValue_lowerCrossingTime (h.symm ▸ hn) #align measure_theory.lower_crossing_time_lt_upper_crossing_time MeasureTheory.lowerCrossingTime_lt_upperCrossingTime theorem upperCrossingTime_lt_succ (hab : a < b) (hn : upperCrossingTime a b f N (n + 1) ω ≠ N) : upperCrossingTime a b f N n ω < upperCrossingTime a b f N (n + 1) ω := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_lt_upperCrossingTime hab hn) #align measure_theory.upper_crossing_time_lt_succ MeasureTheory.upperCrossingTime_lt_succ theorem lowerCrossingTime_stabilize (hnm : n ≤ m) (hn : lowerCrossingTime a b f N n ω = N) : lowerCrossingTime a b f N m ω = N := le_antisymm lowerCrossingTime_le (le_trans (le_of_eq hn.symm) (lowerCrossingTime_mono hnm)) #align measure_theory.lower_crossing_time_stabilize MeasureTheory.lowerCrossingTime_stabilize theorem upperCrossingTime_stabilize (hnm : n ≤ m) (hn : upperCrossingTime a b f N n ω = N) : upperCrossingTime a b f N m ω = N := le_antisymm upperCrossingTime_le (le_trans (le_of_eq hn.symm) (upperCrossingTime_mono hnm)) #align measure_theory.upper_crossing_time_stabilize MeasureTheory.upperCrossingTime_stabilize theorem lowerCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ lowerCrossingTime a b f N n ω) : lowerCrossingTime a b f N m ω = N := lowerCrossingTime_stabilize hnm (le_antisymm lowerCrossingTime_le hn) #align measure_theory.lower_crossing_time_stabilize' MeasureTheory.lowerCrossingTime_stabilize' theorem upperCrossingTime_stabilize' (hnm : n ≤ m) (hn : N ≤ upperCrossingTime a b f N n ω) : upperCrossingTime a b f N m ω = N := upperCrossingTime_stabilize hnm (le_antisymm upperCrossingTime_le hn) #align measure_theory.upper_crossing_time_stabilize' MeasureTheory.upperCrossingTime_stabilize' -- `upperCrossingTime_bound_eq` provides an explicit bound theorem exists_upperCrossingTime_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : ∃ n, upperCrossingTime a b f N n ω = N := by by_contra h; push_neg at h have : StrictMono fun n => upperCrossingTime a b f N n ω := strictMono_nat_of_lt_succ fun n => upperCrossingTime_lt_succ hab (h _) obtain ⟨_, ⟨k, rfl⟩, hk⟩ : ∃ (m : _) (_ : m ∈ Set.range fun n => upperCrossingTime a b f N n ω), N < m := ⟨upperCrossingTime a b f N (N + 1) ω, ⟨N + 1, rfl⟩, lt_of_lt_of_le N.lt_succ_self (StrictMono.id_le this (N + 1))⟩ exact not_le.2 hk upperCrossingTime_le #align measure_theory.exists_upper_crossing_time_eq MeasureTheory.exists_upperCrossingTime_eq theorem upperCrossingTime_lt_bddAbove (hab : a < b) : BddAbove {n | upperCrossingTime a b f N n ω < N} := by obtain ⟨k, hk⟩ := exists_upperCrossingTime_eq f N ω hab refine' ⟨k, fun n (hn : upperCrossingTime a b f N n ω < N) => _⟩ by_contra hn' exact hn.ne (upperCrossingTime_stabilize (not_le.1 hn').le hk) #align measure_theory.upper_crossing_time_lt_bdd_above MeasureTheory.upperCrossingTime_lt_bddAbove theorem upperCrossingTime_lt_nonempty (hN : 0 < N) : {n | upperCrossingTime a b f N n ω < N}.Nonempty := ⟨0, hN⟩ #align measure_theory.upper_crossing_time_lt_nonempty MeasureTheory.upperCrossingTime_lt_nonempty theorem upperCrossingTime_bound_eq (f : ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) (hab : a < b) : upperCrossingTime a b f N N ω = N := by by_cases hN' : N < Nat.find (exists_upperCrossingTime_eq f N ω hab) · refine' le_antisymm upperCrossingTime_le _ have hmono : StrictMonoOn (fun n => upperCrossingTime a b f N n ω) (Set.Iic (Nat.find (exists_upperCrossingTime_eq f N ω hab)).pred) := by refine' strictMonoOn_Iic_of_lt_succ fun m hm => upperCrossingTime_lt_succ hab _ rw [Nat.lt_pred_iff] at hm convert Nat.find_min _ hm convert StrictMonoOn.Iic_id_le hmono N (Nat.le_sub_one_of_lt hN') · rw [not_lt] at hN' exact upperCrossingTime_stabilize hN' (Nat.find_spec (exists_upperCrossingTime_eq f N ω hab)) #align measure_theory.upper_crossing_time_bound_eq MeasureTheory.upperCrossingTime_bound_eq theorem upperCrossingTime_eq_of_bound_le (hab : a < b) (hn : N ≤ n) : upperCrossingTime a b f N n ω = N := le_antisymm upperCrossingTime_le (le_trans (upperCrossingTime_bound_eq f N ω hab).symm.le (upperCrossingTime_mono hn)) #align measure_theory.upper_crossing_time_eq_of_bound_le MeasureTheory.upperCrossingTime_eq_of_bound_le variable {ℱ : Filtration ℕ m0} theorem Adapted.isStoppingTime_crossing (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) ∧ IsStoppingTime ℱ (lowerCrossingTime a b f N n) := by induction' n with k ih · refine' ⟨isStoppingTime_const _ 0, _⟩ simp [hitting_isStoppingTime hf measurableSet_Iic] · obtain ⟨_, ih₂⟩ := ih have : IsStoppingTime ℱ (upperCrossingTime a b f N (k + 1)) := by intro n simp_rw [upperCrossingTime_succ_eq] exact isStoppingTime_hitting_isStoppingTime ih₂ (fun _ => lowerCrossingTime_le) measurableSet_Ici hf _ refine' ⟨this, _⟩ · intro n exact isStoppingTime_hitting_isStoppingTime this (fun _ => upperCrossingTime_le) measurableSet_Iic hf _ #align measure_theory.adapted.is_stopping_time_crossing MeasureTheory.Adapted.isStoppingTime_crossing theorem Adapted.isStoppingTime_upperCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (upperCrossingTime a b f N n) := hf.isStoppingTime_crossing.1 #align measure_theory.adapted.is_stopping_time_upper_crossing_time MeasureTheory.Adapted.isStoppingTime_upperCrossingTime theorem Adapted.isStoppingTime_lowerCrossingTime (hf : Adapted ℱ f) : IsStoppingTime ℱ (lowerCrossingTime a b f N n) := hf.isStoppingTime_crossing.2 #align measure_theory.adapted.is_stopping_time_lower_crossing_time MeasureTheory.Adapted.isStoppingTime_lowerCrossingTime /-- `upcrossingStrat a b f N n` is 1 if `n` is between a consecutive pair of lower and upper crossings and is 0 otherwise. `upcrossingStrat` is shifted by one index so that it is adapted rather than predictable. -/ noncomputable def upcrossingStrat (a b : ℝ) (f : ℕ → Ω → ℝ) (N n : ℕ) (ω : Ω) : ℝ := ∑ k in Finset.range N, (Set.Ico (lowerCrossingTime a b f N k ω) (upperCrossingTime a b f N (k + 1) ω)).indicator 1 n #align measure_theory.upcrossing_strat MeasureTheory.upcrossingStrat theorem upcrossingStrat_nonneg : 0 ≤ upcrossingStrat a b f N n ω := Finset.sum_nonneg fun _ _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _ #align measure_theory.upcrossing_strat_nonneg MeasureTheory.upcrossingStrat_nonneg theorem upcrossingStrat_le_one : upcrossingStrat a b f N n ω ≤ 1 := by rw [upcrossingStrat, ← Finset.indicator_biUnion_apply] · exact Set.indicator_le_self' (fun _ _ => zero_le_one) _ intro i _ j _ hij simp only [Set.Ico_disjoint_Ico] obtain hij' | hij' := lt_or_gt_of_ne hij · rw [min_eq_left (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_right (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) · rw [gt_iff_lt] at hij' rw [min_eq_right (upperCrossingTime_mono (Nat.succ_le_succ hij'.le) : upperCrossingTime a b f N _ ω ≤ upperCrossingTime a b f N _ ω), max_eq_left (lowerCrossingTime_mono hij'.le : lowerCrossingTime a b f N _ _ ≤ lowerCrossingTime _ _ _ _ _ _)] refine' le_trans upperCrossingTime_le_lowerCrossingTime (lowerCrossingTime_mono (Nat.succ_le_of_lt hij')) #align measure_theory.upcrossing_strat_le_one MeasureTheory.upcrossingStrat_le_one theorem Adapted.upcrossingStrat_adapted (hf : Adapted ℱ f) : Adapted ℱ (upcrossingStrat a b f N) := by intro n change StronglyMeasurable[ℱ n] fun ω => ∑ k in Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine' Finset.stronglyMeasurable_sum _ fun i _ => stronglyMeasurable_const.indicator ((hf.isStoppingTime_lowerCrossingTime n).inter _) simp_rw [← not_le] exact (hf.isStoppingTime_upperCrossingTime n).compl #align measure_theory.adapted.upcrossing_strat_adapted MeasureTheory.Adapted.upcrossingStrat_adapted theorem Submartingale.sum_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)) ℱ μ := hf.sum_mul_sub hf.adapted.upcrossingStrat_adapted (fun _ _ => upcrossingStrat_le_one) fun _ _ => upcrossingStrat_nonneg #align measure_theory.submartingale.sum_upcrossing_strat_mul MeasureTheory.Submartingale.sum_upcrossingStrat_mul theorem Submartingale.sum_sub_upcrossingStrat_mul [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) (a b : ℝ) (N : ℕ) : Submartingale (fun n : ℕ => ∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)) ℱ μ := by refine' hf.sum_mul_sub (fun n => (adapted_const ℱ 1 n).sub (hf.adapted.upcrossingStrat_adapted n)) (_ : ∀ n ω, (1 - upcrossingStrat a b f N n) ω ≤ 1) _ · exact fun n ω => sub_le_self _ upcrossingStrat_nonneg · intro n ω simp [upcrossingStrat_le_one] #align measure_theory.submartingale.sum_sub_upcrossing_strat_mul MeasureTheory.Submartingale.sum_sub_upcrossingStrat_mul theorem Submartingale.sum_mul_upcrossingStrat_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ) : μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] ≤ μ[f n] - μ[f 0] := by have h₁ : (0 : ℝ) ≤ μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] := by have := (hf.sum_sub_upcrossingStrat_mul a b N).set_integral_le (zero_le n) MeasurableSet.univ rw [integral_univ, integral_univ] at this refine' le_trans _ this simp only [Finset.range_zero, Finset.sum_empty, integral_zero', le_refl] have h₂ : μ[∑ k in Finset.range n, (1 - upcrossingStrat a b f N k) * (f (k + 1) - f k)] = μ[∑ k in Finset.range n, (f (k + 1) - f k)] - μ[∑ k in Finset.range n, upcrossingStrat a b f N k * (f (k + 1) - f k)] := by simp only [sub_mul, one_mul, Finset.sum_sub_distrib, Pi.sub_apply, Finset.sum_apply, Pi.mul_apply] refine' integral_sub (Integrable.sub (integrable_finset_sum _ fun i _ => hf.integrable _) (integrable_finset_sum _ fun i _ => hf.integrable _)) _ convert (hf.sum_upcrossingStrat_mul a b N).integrable n using 1 ext; simp rw [h₂, sub_nonneg] at h₁ refine' le_trans h₁ _ simp_rw [Finset.sum_range_sub, integral_sub' (hf.integrable _) (hf.integrable _), le_refl] #align measure_theory.submartingale.sum_mul_upcrossing_strat_le MeasureTheory.Submartingale.sum_mul_upcrossingStrat_le /-- The number of upcrossings (strictly) before time `N`. -/ noncomputable def upcrossingsBefore [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ) (N : ι) (ω : Ω) : ℕ := sSup {n | upperCrossingTime a b f N n ω < N} #align measure_theory.upcrossings_before MeasureTheory.upcrossingsBefore @[simp] theorem upcrossingsBefore_bot [Preorder ι] [OrderBot ι] [InfSet ι] {a b : ℝ} {f : ι → Ω → ℝ} {ω : Ω} : upcrossingsBefore a b f ⊥ ω = ⊥ := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_bot MeasureTheory.upcrossingsBefore_bot theorem upcrossingsBefore_zero : upcrossingsBefore a b f 0 ω = 0 := by simp [upcrossingsBefore] #align measure_theory.upcrossings_before_zero MeasureTheory.upcrossingsBefore_zero @[simp] theorem upcrossingsBefore_zero' : upcrossingsBefore a b f 0 = 0 := by ext ω; exact upcrossingsBefore_zero #align measure_theory.upcrossings_before_zero' MeasureTheory.upcrossingsBefore_zero' theorem upperCrossingTime_lt_of_le_upcrossingsBefore (hN : 0 < N) (hab : a < b) (hn : n ≤ upcrossingsBefore a b f N ω) : upperCrossingTime a b f N n ω < N := haveI : upperCrossingTime a b f N (upcrossingsBefore a b f N ω) ω < N := (upperCrossingTime_lt_nonempty hN).cSup_mem ((OrderBot.bddBelow _).finite_of_bddAbove (upperCrossingTime_lt_bddAbove hab)) lt_of_le_of_lt (upperCrossingTime_mono hn) this #align measure_theory.upper_crossing_time_lt_of_le_upcrossings_before MeasureTheory.upperCrossingTime_lt_of_le_upcrossingsBefore theorem upperCrossingTime_eq_of_upcrossingsBefore_lt (hab : a < b) (hn : upcrossingsBefore a b f N ω < n) : upperCrossingTime a b f N n ω = N := by refine' le_antisymm upperCrossingTime_le (not_lt.1 _) convert not_mem_of_csSup_lt hn (upperCrossingTime_lt_bddAbove hab) #align measure_theory.upper_crossing_time_eq_of_upcrossings_before_lt MeasureTheory.upperCrossingTime_eq_of_upcrossingsBefore_lt theorem upcrossingsBefore_le (f : ℕ → Ω → ℝ) (ω : Ω) (hab : a < b) : upcrossingsBefore a b f N ω ≤ N := by by_cases hN : N = 0 · subst hN rw [upcrossingsBefore_zero] · refine' csSup_le ⟨0, zero_lt_iff.2 hN⟩ fun n (hn : _ < N) => _ by_contra hnN exact hn.ne (upperCrossingTime_eq_of_bound_le hab (not_le.1 hnN).le) #align measure_theory.upcrossings_before_le MeasureTheory.upcrossingsBefore_le theorem crossing_eq_crossing_of_lowerCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : lowerCrossingTime a b f N n ω < N) : upperCrossingTime a b f M n ω = upperCrossingTime a b f N n ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by have h' : upperCrossingTime a b f N n ω < N := lt_of_le_of_lt upperCrossingTime_le_lowerCrossingTime h induction' n with k ih · simp only [Nat.zero_eq, upperCrossingTime_zero, bot_eq_zero', eq_self_iff_true, lowerCrossingTime_zero, true_and_iff, eq_comm] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff] at h obtain ⟨j, hj₁, hj₂⟩ := h exacts [⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] · specialize ih (lt_of_le_of_lt (lowerCrossingTime_mono (Nat.le_succ _)) h) (lt_of_le_of_lt (upperCrossingTime_mono (Nat.le_succ _)) h') have : upperCrossingTime a b f M k.succ ω = upperCrossingTime a b f N k.succ ω := by rw [upperCrossingTime_succ_eq, hitting_lt_iff] at h' simp only [upperCrossingTime_succ_eq] obtain ⟨j, hj₁, hj₂⟩ := h' rw [eq_comm, ih.2] exacts [hitting_eq_hitting_of_exists hNM ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩, le_rfl] refine' ⟨this, _⟩ simp only [lowerCrossingTime, eq_comm, this] refine' hitting_eq_hitting_of_exists hNM _ rw [lowerCrossingTime, hitting_lt_iff _ le_rfl] at h obtain ⟨j, hj₁, hj₂⟩ := h exact ⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩ #align measure_theory.crossing_eq_crossing_of_lower_crossing_time_lt MeasureTheory.crossing_eq_crossing_of_lowerCrossingTime_lt theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : upperCrossingTime a b f N (n + 1) ω < N) : upperCrossingTime a b f M (n + 1) ω = upperCrossingTime a b f N (n + 1) ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by
have := (crossing_eq_crossing_of_lowerCrossingTime_lt hNM (lt_of_le_of_lt lowerCrossingTime_le_upperCrossingTime_succ h)).2
theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : upperCrossingTime a b f N (n + 1) ω < N) : upperCrossingTime a b f M (n + 1) ω = upperCrossingTime a b f N (n + 1) ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω := by
Mathlib.Probability.Martingale.Upcrossing.521_0.80Cpy4Qgm9i1y9y
theorem crossing_eq_crossing_of_upperCrossingTime_lt {M : ℕ} (hNM : N ≤ M) (h : upperCrossingTime a b f N (n + 1) ω < N) : upperCrossingTime a b f M (n + 1) ω = upperCrossingTime a b f N (n + 1) ω ∧ lowerCrossingTime a b f M n ω = lowerCrossingTime a b f N n ω
Mathlib_Probability_Martingale_Upcrossing