Skip to content

Commit 8261ce1

Browse files
committed
feat: convergence in probability implies convergence in distribution (#30348)
Prove that convergence in probability implies convergence in distribution, as well as Slutsky's theorem on the convergence of a product of random variables (since those two facts follow from the same lemma). Co-authored-by: Remy Degenne <remydegenne@gmail.com>
1 parent 77bb8d0 commit 8261ce1

File tree

5 files changed

+273
-9
lines changed

5 files changed

+273
-9
lines changed

Mathlib/MeasureTheory/Function/ConvergenceInDistribution.lean

Lines changed: 205 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2025 Rémy Degenne. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Rémy Degenne
55
-/
6-
import Mathlib.MeasureTheory.Measure.ProbabilityMeasure
6+
import Mathlib.MeasureTheory.Measure.Portmanteau
77

88
/-!
99
# Convergence in distribution
@@ -16,6 +16,9 @@ The definition assumes that the random variables are defined on the same probabi
1616
is the most common setting in applications. Convergence in distribution for random variables
1717
on different probability spaces can be talked about using the `ProbabilityMeasure` type directly.
1818
19+
We also state results relating convergence in probability (`TendstoInMeasure`)
20+
and convergence in distribution.
21+
1922
## Main definitions
2023
2124
* `TendstoInDistribution X l Z μ`: the sequence of random variables `X n` converges in
@@ -27,6 +30,16 @@ on different probability spaces can be talked about using the `ProbabilityMeasur
2730
* `TendstoInDistribution.continuous_comp`: **Continuous mapping theorem**.
2831
If `X n` tends to `Z` in distribution and `g` is continuous, then `g ∘ X n` tends to `g ∘ Z`
2932
in distribution.
33+
* `tendstoInDistribution_of_tendstoInMeasure_sub`: the main technical tool for the next results.
34+
Let `X, Y` be two sequences of measurable functions such that `X n` converges in distribution
35+
to `Z`, and `Y n - X n` converges in probability to `0`.
36+
Then `Y n` converges in distribution to `Z`.
37+
* `TendstoInMeasure.tendstoInDistribution`: convergence in probability implies convergence in
38+
distribution.
39+
* `TendstoInDistribution.prodMk_of_tendstoInMeasure_const`: **Slutsky's theorem**.
40+
If `X n` converges in distribution to `Z`, and `Y n` converges in probability to a constant `c`,
41+
then the pair `(X n, Y n)` converges in distribution to `(Z, c)`.
42+
3043
-/
3144

3245
open Filter
@@ -35,10 +48,12 @@ open scoped Topology
3548
namespace MeasureTheory
3649

3750
variable {Ω ι E : Type*} {m : MeasurableSpace Ω} {μ : Measure Ω} [IsProbabilityMeasure μ]
38-
[TopologicalSpace E] {mE : MeasurableSpace E} {X Y : ι → Ω → E} {Z : Ω → E} {l : Filter ι}
51+
{mE : MeasurableSpace E} {X Y : ι → Ω → E} {Z : Ω → E} {l : Filter ι}
3952

4053
section TendstoInDistribution
4154

55+
variable [TopologicalSpace E]
56+
4257
/-- Convergence in distribution of random variables.
4358
This is the weak convergence of the laws of the random variables: `Tendsto` in the
4459
`ProbabilityMeasure` type. -/
@@ -55,6 +70,15 @@ lemma tendstoInDistribution_const [OpensMeasurableSpace E] (hZ : AEMeasurable Z
5570
forall_aemeasurable := fun _ ↦ by fun_prop
5671
tendsto := tendsto_const_nhds
5772

73+
@[simp]
74+
lemma tendstoInDistribution_of_isEmpty [IsEmpty E] :
75+
TendstoInDistribution X l Z μ where
76+
forall_aemeasurable := fun _ ↦ (measurable_of_subsingleton_codomain _).aemeasurable
77+
aemeasurable_limit := (measurable_of_subsingleton_codomain _).aemeasurable
78+
tendsto := by
79+
simp only [Subsingleton.elim _ (0 : Measure E)]
80+
exact tendsto_const_nhds
81+
5882
lemma tendstoInDistribution_unique [HasOuterApproxClosed E] [BorelSpace E]
5983
(X : ι → Ω → E) {Z W : Ω → E} [l.NeBot]
6084
(h1 : TendstoInDistribution X l Z μ) (h2 : TendstoInDistribution X l W μ) :
@@ -81,4 +105,183 @@ theorem TendstoInDistribution.continuous_comp {F : Type*} [OpensMeasurableSpace
81105

82106
end TendstoInDistribution
83107

108+
variable [SeminormedAddCommGroup E] [SecondCountableTopology E] [BorelSpace E]
109+
110+
/-- Let `X, Y` be two sequences of measurable functions such that `X n` converges in distribution
111+
to `Z`, and `Y n - X n` converges in probability to `0`.
112+
Then `Y n` converges in distribution to `Z`. -/
113+
lemma tendstoInDistribution_of_tendstoInMeasure_sub
114+
[l.IsCountablyGenerated] (Y : ι → Ω → E) (Z : Ω → E)
115+
(hXZ : TendstoInDistribution X l Z μ) (hXY : TendstoInMeasure μ (Y - X) l 0)
116+
(hY : ∀ i, AEMeasurable (Y i) μ) :
117+
TendstoInDistribution Y l Z μ := by
118+
have hZ : AEMeasurable Z μ := hXZ.aemeasurable_limit
119+
have hX : ∀ i, AEMeasurable (X i) μ := hXZ.forall_aemeasurable
120+
rcases isEmpty_or_nonempty E with hE | hE
121+
· simp
122+
let x₀ : E := hE.some
123+
refine ⟨hY, hZ, ?_⟩
124+
-- We show convergence in distribution by verifying the convergence of integrals of any bounded
125+
-- Lipschitz function `F`
126+
suffices ∀ (F : E → ℝ) (hF_bounded : ∃ (C : ℝ), ∀ x y, dist (F x) (F y) ≤ C)
127+
(hF_lip : ∃ L, LipschitzWith L F),
128+
Tendsto (fun n ↦ ∫ ω, F ω ∂(μ.map (Y n))) l (𝓝 (∫ ω, F ω ∂(μ.map Z))) by
129+
rwa [tendsto_iff_forall_lipschitz_integral_tendsto]
130+
rintro F ⟨M, hF_bounded⟩ ⟨L, hF_lip⟩
131+
have hF_cont : Continuous F := hF_lip.continuous
132+
-- If `F` is 0-Lipschitz, then it is constant, and all integrals are equal to that constant
133+
obtain rfl | hL := eq_zero_or_pos L
134+
· simp only [LipschitzWith.zero_iff] at hF_lip
135+
specialize hF_lip x₀
136+
simp only [← hF_lip, integral_const, smul_eq_mul]
137+
have h_prob n : IsProbabilityMeasure (μ.map (Y n)) := Measure.isProbabilityMeasure_map (hY n)
138+
have : IsProbabilityMeasure (μ.map Z) := Measure.isProbabilityMeasure_map hZ
139+
simpa using tendsto_const_nhds
140+
-- now `F` is `L`-Lipschitz with `L > 0`
141+
simp_rw [Metric.tendsto_nhds, Real.dist_eq]
142+
suffices ∀ ε > 0, ∀ᶠ n in l, |∫ ω, F ω ∂(μ.map (Y n)) - ∫ ω, F ω ∂(μ.map Z)| < L * ε by
143+
intro ε hε
144+
convert this (ε / L) (by positivity)
145+
field_simp
146+
intro ε hε
147+
-- We cut the difference into three pieces, two of which are small by the convergence assumptions
148+
have h_le n : |∫ ω, F ω ∂(μ.map (Y n)) - ∫ ω, F ω ∂(μ.map Z)|
149+
≤ L * (ε / 2) + M * μ.real {ω | ε / 2 ≤ ‖Y n ω - X n ω‖}
150+
+ |∫ ω, F ω ∂(μ.map (X n)) - ∫ ω, F ω ∂(μ.map Z)| := by
151+
refine (abs_sub_le (∫ ω, F ω ∂(μ.map (Y n))) (∫ ω, F ω ∂(μ.map (X n)))
152+
(∫ ω, F ω ∂(μ.map Z))).trans ?_
153+
gcongr
154+
-- `⊢ |∫ ω, F ω ∂(μ.map (Y n)) - ∫ ω, F ω ∂(μ.map (X n))|`
155+
-- ` ≤ L * (ε / 2) + M * μ.real {ω | ε / 2 ≤ ‖Y n ω - X n ω‖}`
156+
-- We prove integrability of the functions involved to be able to manipulate the integrals.
157+
have h_int_Y : Integrable (fun x ↦ F (Y n x)) μ := by
158+
refine Integrable.of_bound (by fun_prop) (‖F x₀‖ + M) (ae_of_all _ fun a ↦ ?_)
159+
specialize hF_bounded (Y n a) x₀
160+
rw [← sub_le_iff_le_add']
161+
exact (abs_sub_abs_le_abs_sub (F (Y n a)) (F x₀)).trans hF_bounded
162+
have h_int_X : Integrable (fun x ↦ F (X n x)) μ := by
163+
refine Integrable.of_bound (by fun_prop) (‖F x₀‖ + M) (ae_of_all _ fun a ↦ ?_)
164+
specialize hF_bounded (X n a) x₀
165+
rw [← sub_le_iff_le_add']
166+
exact (abs_sub_abs_le_abs_sub (F (X n a)) (F x₀)).trans hF_bounded
167+
have h_int_sub : Integrable (fun a ↦ ‖F (Y n a) - F (X n a)‖) μ := by
168+
rw [integrable_norm_iff (by fun_prop)]
169+
exact h_int_Y.sub h_int_X
170+
-- Now we prove the inequality
171+
rw [integral_map (by fun_prop) (by fun_prop), integral_map (by fun_prop) (by fun_prop),
172+
← integral_sub h_int_Y h_int_X, ← Real.norm_eq_abs]
173+
calc ‖∫ a, F (Y n a) - F (X n a) ∂μ‖
174+
_ ≤ ∫ a, ‖F (Y n a) - F (X n a)‖ ∂μ := norm_integral_le_integral_norm _
175+
-- Either `‖Y n x - X n x‖` is smaller than `ε / 2`, or it is not
176+
_ = ∫ a in {x | ‖Y n x - X n x‖ < ε / 2}, ‖F (Y n a) - F (X n a)‖ ∂μ
177+
+ ∫ a in {x | ε / 2 ≤ ‖Y n x - X n x‖}, ‖F (Y n a) - F (X n a)‖ ∂μ := by
178+
symm
179+
simp_rw [← not_lt]
180+
refine integral_add_compl₀ ?_ h_int_sub
181+
exact nullMeasurableSet_lt (by fun_prop) (by fun_prop)
182+
-- If it is smaller, we use the Lipschitz property of `F`
183+
-- If not, we use the boundedness of `F`.
184+
_ ≤ ∫ a in {x | ‖Y n x - X n x‖ < ε / 2}, L * (ε / 2) ∂μ
185+
+ ∫ a in {x | ε / 2 ≤ ‖Y n x - X n x‖}, M ∂μ := by
186+
gcongr ?_ + ?_
187+
· refine setIntegral_mono_on₀ h_int_sub.integrableOn integrableOn_const ?_ ?_
188+
· exact nullMeasurableSet_lt (by fun_prop) (by fun_prop)
189+
· exact fun x hx ↦ hF_lip.norm_sub_le_of_le hx.le
190+
· refine setIntegral_mono h_int_sub.integrableOn integrableOn_const fun a ↦ ?_
191+
rw [← dist_eq_norm]
192+
convert hF_bounded _ _
193+
-- The goal is now a simple computation
194+
_ = L * (ε / 2) * μ.real {x | ‖Y n x - X n x‖ < ε / 2}
195+
+ M * μ.real {ω | ε / 2 ≤ ‖Y n ω - X n ω‖} := by
196+
simp only [integral_const, MeasurableSet.univ, measureReal_restrict_apply, Set.univ_inter,
197+
smul_eq_mul]
198+
ring
199+
_ ≤ L * (ε / 2) + M * μ.real {ω | ε / 2 ≤ ‖Y n ω - X n ω‖} := by
200+
rw [mul_assoc]
201+
gcongr
202+
grw [measureReal_le_one, mul_one]
203+
-- We finally show that the right-hand side tends to `L * ε / 2`, which is smaller than `L * ε`
204+
have h_tendsto :
205+
Tendsto (fun n ↦ L * (ε / 2) + M * μ.real {ω | ε / 2 ≤ ‖Y n ω - X n ω‖}
206+
+ |∫ ω, F ω ∂(μ.map (X n)) - ∫ ω, F ω ∂(μ.map Z)|) l (𝓝 (L * ε / 2)) := by
207+
suffices Tendsto (fun n ↦ L * (ε / 2) + M * μ.real {ω | ε / 2 ≤ ‖Y n ω - X n ω‖}
208+
+ |∫ ω, F ω ∂(μ.map (X n)) - ∫ ω, F ω ∂(μ.map Z)|) l (𝓝 (L * ε / 2 + M * 0 + 0)) by
209+
simpa
210+
refine (Tendsto.add ?_ (Tendsto.const_mul _ ?_)).add ?_
211+
· rw [mul_div_assoc]
212+
exact tendsto_const_nhds
213+
· simp only [tendstoInMeasure_iff_measureReal_norm, Pi.zero_apply, sub_zero] at hXY
214+
exact hXY (ε / 2) (by positivity)
215+
· replace hXZ := hXZ.tendsto
216+
simp_rw [tendsto_iff_forall_lipschitz_integral_tendsto] at hXZ
217+
simpa [tendsto_iff_dist_tendsto_zero] using hXZ F ⟨M, hF_bounded⟩ ⟨L, hF_lip⟩
218+
have h_lt : L * ε / 2 < L * ε := half_lt_self (by positivity)
219+
filter_upwards [h_tendsto.eventually_lt_const h_lt] with n hn using (h_le n).trans_lt hn
220+
221+
/-- Convergence in probability (`TendstoInMeasure`) implies convergence in distribution
222+
(`TendstoInDistribution`). -/
223+
lemma TendstoInMeasure.tendstoInDistribution_of_aemeasurable [l.IsCountablyGenerated]
224+
(h : TendstoInMeasure μ X l Z) (hX : ∀ i, AEMeasurable (X i) μ) (hZ : AEMeasurable Z μ) :
225+
TendstoInDistribution X l Z μ :=
226+
tendstoInDistribution_of_tendstoInMeasure_sub X Z (tendstoInDistribution_const hZ)
227+
(by simpa [tendstoInMeasure_iff_norm] using h) hX
228+
229+
/-- Convergence in probability (`TendstoInMeasure`) implies convergence in distribution
230+
(`TendstoInDistribution`). -/
231+
lemma TendstoInMeasure.tendstoInDistribution [l.NeBot] [l.IsCountablyGenerated]
232+
(h : TendstoInMeasure μ X l Z) (hX : ∀ i, AEMeasurable (X i) μ) :
233+
TendstoInDistribution X l Z μ := h.tendstoInDistribution_of_aemeasurable hX (h.aemeasurable hX)
234+
235+
/-- **Slutsky's theorem**: if `X n` converges in distribution to `Z`, and `Y n` converges in
236+
probability to a constant `c`, then the pair `(X n, Y n)` converges in distribution to `(Z, c)`. -/
237+
theorem TendstoInDistribution.prodMk_of_tendstoInMeasure_const
238+
{E' : Type*} {mE' : MeasurableSpace E'} [SeminormedAddCommGroup E'] [SecondCountableTopology E']
239+
[BorelSpace E']
240+
[l.IsCountablyGenerated] (X : ι → Ω → E) (Y : ι → Ω → E') (Z : Ω → E)
241+
{c : E'} (hXZ : TendstoInDistribution X l Z μ)
242+
(hY : TendstoInMeasure μ (fun n ↦ Y n) l (fun _ ↦ c))
243+
(hY_meas : ∀ i, AEMeasurable (Y i) μ) :
244+
TendstoInDistribution (fun n ω ↦ (X n ω, Y n ω)) l (fun ω ↦ (Z ω, c)) μ := by
245+
have hX : ∀ i, AEMeasurable (X i) μ := hXZ.forall_aemeasurable
246+
have hZ : AEMeasurable Z μ := hXZ.aemeasurable_limit
247+
refine tendstoInDistribution_of_tendstoInMeasure_sub (X := fun n ω ↦ (X n ω, c))
248+
(Y := fun n ω ↦ (X n ω, Y n ω)) (Z := fun ω ↦ (Z ω, c)) (μ := μ) (l := l) ?_ ?_ (by fun_prop)
249+
· replace hXZ := hXZ.tendsto
250+
refine ⟨by fun_prop, by fun_prop, ?_⟩
251+
rw [ProbabilityMeasure.tendsto_iff_forall_integral_tendsto] at hXZ ⊢
252+
intro F
253+
let Fc : BoundedContinuousFunction E ℝ := ⟨⟨fun x ↦ F (x, c), by fun_prop⟩, by
254+
obtain ⟨C, hC⟩ := F.map_bounded'
255+
exact ⟨C, fun x y ↦ hC (x, c) (y, c)⟩⟩
256+
have h_eq (f : Ω → E) (hf : AEMeasurable f μ) :
257+
∫ ω, F ω ∂μ.map (fun ω ↦ (f ω, c)) = ∫ ω, F (ω, c) ∂(μ.map f) := by
258+
rw [integral_map (by fun_prop) (by fun_prop), integral_map (by fun_prop) (by fun_prop)]
259+
simp_rw [ProbabilityMeasure.coe_mk, h_eq (X _) (hX _), h_eq Z hZ]
260+
simpa using hXZ Fc
261+
· suffices TendstoInMeasure μ (fun n ω ↦ ((0 : E), Y n ω - c)) l 0 by
262+
convert this with n ω
263+
simp
264+
simpa [tendstoInMeasure_iff_norm] using hY
265+
266+
/-- **Slutsky's theorem** for a continuous function: if `X n` converges in distribution to `Z`,
267+
`Y n` converges in probability to a constant `c`, and `g` is a continuous function, then
268+
`g (X n, Y n)` converges in distribution to `g (Z, c)`. -/
269+
theorem TendstoInDistribution.continuous_comp_prodMk_of_tendstoInMeasure_const {E' F : Type*}
270+
{mE' : MeasurableSpace E'} [SeminormedAddCommGroup E'] [SecondCountableTopology E']
271+
[BorelSpace E']
272+
[TopologicalSpace F] [MeasurableSpace F] [BorelSpace F] {g : E × E' → F} (hg : Continuous g)
273+
[l.IsCountablyGenerated] {X : ι → Ω → E} {Y : ι → Ω → E'}
274+
{c : E'} (hXZ : TendstoInDistribution X l Z μ)
275+
(hY_tendsto : TendstoInMeasure μ (fun n ↦ Y n) l (fun _ ↦ c)) (hY : ∀ i, AEMeasurable (Y i) μ) :
276+
TendstoInDistribution (fun n ω ↦ g (X n ω, Y n ω)) l (fun ω ↦ g (Z ω, c)) μ := by
277+
refine TendstoInDistribution.continuous_comp hg ?_
278+
exact hXZ.prodMk_of_tendstoInMeasure_const X Y Z hY_tendsto hY
279+
280+
lemma TendstoInDistribution.add_of_tendstoInMeasure_const
281+
[l.IsCountablyGenerated] {c : E} (hXZ : TendstoInDistribution X l Z μ)
282+
(hY_tendsto : TendstoInMeasure μ (fun n ↦ Y n) l (fun _ ↦ c)) (hY : ∀ i, AEMeasurable (Y i) μ) :
283+
TendstoInDistribution (fun n ↦ X n + Y n) l (fun ω ↦ Z ω + c) μ :=
284+
hXZ.continuous_comp_prodMk_of_tendstoInMeasure_const
285+
(g := fun (x : E × E) ↦ x.1 + x.2) (by fun_prop) hY_tendsto hY
286+
84287
end MeasureTheory

0 commit comments

Comments
 (0)