Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 409f5f2

Browse files
committed
feat(probability/integration): Bochner integral of the product of independent functions (#13140)
This is limited to real-valued functions, which is not very satisfactory but it is not clear (to me) what the most general version of each of those lemmas would be.
1 parent fabad7e commit 409f5f2

File tree

1 file changed

+135
-18
lines changed

1 file changed

+135
-18
lines changed

src/probability/integration.lean

Lines changed: 135 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2021 Martin Zinkevich. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Martin Zinkevich
55
-/
6-
import measure_theory.integral.lebesgue
6+
import measure_theory.integral.bochner
77
import probability.independence
88

99
/-!
@@ -30,19 +30,16 @@ noncomputable theory
3030
open set measure_theory
3131
open_locale ennreal
3232

33-
variables {α : Type*}
33+
variables {α : Type*} {mα : measurable_space α} {μ : measure α} {f g : α → ℝ≥0∞} {X Y : α → ℝ}
3434

3535
namespace probability_theory
3636

37-
/-- This (roughly) proves that if a random variable `f` is independent of an event `T`,
38-
then if you restrict the random variable to `T`, then
39-
`E[f * indicator T c 0]=E[f] * E[indicator T c 0]`. It is useful for
40-
`lintegral_mul_eq_lintegral_mul_lintegral_of_independent_measurable_space`. -/
41-
lemma lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator
42-
{Mf : measurable_space α} [M : measurable_space α] {μ : measure α} (hMf : Mf ≤ M)
43-
(c : ℝ≥0∞) {T : set α} (h_meas_T : measurable_set T)
44-
(h_ind : indep_sets Mf.measurable_set' {T} μ)
45-
{f : α → ℝ≥0∞} (h_meas_f : @measurable α ℝ≥0∞ Mf _ f) :
37+
/-- If a random variable `f` in `ℝ≥0∞` is independent of an event `T`, then if you restrict the
38+
random variable to `T`, then `E[f * indicator T c 0]=E[f] * E[indicator T c 0]`. It is useful for
39+
`lintegral_mul_eq_lintegral_mul_lintegral_of_independent_measurable_space`. -/
40+
lemma lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator {Mf mα : measurable_space α}
41+
{μ : measure α} (hMf : Mf ≤ mα) (c : ℝ≥0∞) {T : set α} (h_meas_T : measurable_set T)
42+
(h_ind : indep_sets Mf.measurable_set' {T} μ) (h_meas_f : @measurable α ℝ≥0∞ Mf _ f) :
4643
∫⁻ a, f a * T.indicator (λ _, c) a ∂μ = ∫⁻ a, f a ∂μ * ∫⁻ a, T.indicator (λ _, c) a ∂μ :=
4744
begin
4845
revert f,
@@ -73,15 +70,15 @@ begin
7370
{ exact λ m n h_le a, ennreal.mul_le_mul (h_mono_f h_le a) le_rfl, }, },
7471
end
7572

76-
/-- This (roughly) proves that if `f` and `g` are independent random variables,
73+
/-- If `f` and `g` are independent random variables with values in `ℝ≥0∞`,
7774
then `E[f * g] = E[f] * E[g]`. However, instead of directly using the independence
7875
of the random variables, it uses the independence of measurable spaces for the
7976
domains of `f` and `g`. This is similar to the sigma-algebra approach to
8077
independence. See `lintegral_mul_eq_lintegral_mul_lintegral_of_independent_fn` for
8178
a more common variant of the product of independent variables. -/
8279
lemma lintegral_mul_eq_lintegral_mul_lintegral_of_independent_measurable_space
83-
{Mf Mg : measurable_space α} [M : measurable_space α] {μ : measure α}
84-
(hMf : Mf ≤ M) (hMg : Mg ≤ M) (h_ind : indep Mf Mg μ) {f g : α → ℝ≥0∞}
80+
{Mf Mg : measurable_space α} {μ : measure α}
81+
(hMf : Mf ≤ ) (hMg : Mg ≤ ) (h_ind : indep Mf Mg μ)
8582
(h_meas_f : @measurable α ℝ≥0∞ Mf _ f) (h_meas_g : @measurable α ℝ≥0∞ Mg _ g) :
8683
∫⁻ a, f a * g a ∂μ = ∫⁻ a, f a ∂μ * ∫⁻ a, g a ∂μ :=
8784
begin
@@ -108,14 +105,134 @@ begin
108105
{ exact λ n m (h_le : n ≤ m) a, ennreal.mul_le_mul le_rfl (h_mono_f' h_le a), }, }
109106
end
110107

111-
/-- This proves that if `f` and `g` are independent random variables,
108+
/-- If `f` and `g` are independent random variables with values in `ℝ≥0∞`,
112109
then `E[f * g] = E[f] * E[g]`. -/
113-
lemma lintegral_mul_eq_lintegral_mul_lintegral_of_indep_fun [measurable_space α] {μ : measure α}
114-
{f g : α → ℝ≥0∞} (h_meas_f : measurable f) (h_meas_g : measurable g)
115-
(h_indep_fun : indep_fun f g μ) :
110+
lemma lintegral_mul_eq_lintegral_mul_lintegral_of_indep_fun
111+
(h_meas_f : measurable f) (h_meas_g : measurable g) (h_indep_fun : indep_fun f g μ) :
116112
∫⁻ a, (f * g) a ∂μ = ∫⁻ a, f a ∂μ * ∫⁻ a, g a ∂μ :=
117113
lintegral_mul_eq_lintegral_mul_lintegral_of_independent_measurable_space
118114
(measurable_iff_comap_le.1 h_meas_f) (measurable_iff_comap_le.1 h_meas_g) h_indep_fun
119115
(measurable.of_comap_le le_rfl) (measurable.of_comap_le le_rfl)
120116

117+
/-- If `f` and `g` with values in `ℝ≥0∞` are independent and almost everywhere measurable,
118+
then `E[f * g] = E[f] * E[g]` (slightly generalizing
119+
`lintegral_mul_eq_lintegral_mul_lintegral_of_indep_fun`). -/
120+
lemma lintegral_mul_eq_lintegral_mul_lintegral_of_indep_fun'
121+
(h_meas_f : ae_measurable f μ) (h_meas_g : ae_measurable g μ) (h_indep_fun : indep_fun f g μ) :
122+
∫⁻ a, (f * g) a ∂μ = ∫⁻ a, f a ∂μ * ∫⁻ a, g a ∂μ :=
123+
begin
124+
have fg_ae : f * g =ᵐ[μ] (h_meas_f.mk _) * (h_meas_g.mk _),
125+
from h_meas_f.ae_eq_mk.mul h_meas_g.ae_eq_mk,
126+
rw [lintegral_congr_ae h_meas_f.ae_eq_mk, lintegral_congr_ae h_meas_g.ae_eq_mk,
127+
lintegral_congr_ae fg_ae],
128+
apply lintegral_mul_eq_lintegral_mul_lintegral_of_indep_fun
129+
h_meas_f.measurable_mk h_meas_g.measurable_mk,
130+
exact h_indep_fun.ae_eq h_meas_f.ae_eq_mk h_meas_g.ae_eq_mk
131+
end
132+
133+
/-- The product of two independent, integrable, real_valued random variables is integrable. -/
134+
lemma indep_fun.integrable_mul {β : Type*} {mβ : measurable_space β} {X Y : α → β}
135+
[normed_division_ring β] [borel_space β]
136+
(hXY : indep_fun X Y μ) (hX : integrable X μ) (hY : integrable Y μ) :
137+
integrable (X * Y) μ :=
138+
begin
139+
let nX : α → ennreal := λ a, ∥X a∥₊,
140+
let nY : α → ennreal := λ a, ∥Y a∥₊,
141+
142+
have hXY' : indep_fun (λ a, ∥X a∥₊) (λ a, ∥Y a∥₊) μ :=
143+
hXY.comp measurable_nnnorm measurable_nnnorm,
144+
have hXY'' : indep_fun nX nY μ :=
145+
hXY'.comp measurable_coe_nnreal_ennreal measurable_coe_nnreal_ennreal,
146+
147+
have hnX : ae_measurable nX μ := hX.1.ae_measurable.nnnorm.coe_nnreal_ennreal,
148+
have hnY : ae_measurable nY μ := hY.1.ae_measurable.nnnorm.coe_nnreal_ennreal,
149+
150+
have hmul : ∫⁻ a, nX a * nY a ∂μ = ∫⁻ a, nX a ∂μ * ∫⁻ a, nY a ∂μ :=
151+
by convert lintegral_mul_eq_lintegral_mul_lintegral_of_indep_fun' hnX hnY hXY'',
152+
153+
refine ⟨hX.1.mul hY.1, _⟩,
154+
simp_rw [has_finite_integral, pi.mul_apply, nnnorm_mul, ennreal.coe_mul, hmul],
155+
exact ennreal.mul_lt_top_iff.mpr (or.inl ⟨hX.2, hY.2⟩)
156+
end
157+
158+
/-- The (Bochner) integral of the product of two independent, nonnegative random
159+
variables is the product of their integrals. The proof is just plumbing around
160+
`lintegral_mul_eq_lintegral_mul_lintegral_of_indep_fun'`. -/
161+
lemma indep_fun.integral_mul_of_nonneg (hXY : indep_fun X Y μ) (hXp : 0 ≤ X) (hYp : 0 ≤ Y)
162+
(hXm : ae_measurable X μ) (hYm : ae_measurable Y μ) :
163+
integral μ (X * Y) = integral μ X * integral μ Y :=
164+
begin
165+
have h1 : ae_measurable (λ a, ennreal.of_real (X a)) μ :=
166+
ennreal.measurable_of_real.comp_ae_measurable hXm,
167+
have h2 : ae_measurable (λ a, ennreal.of_real (Y a)) μ :=
168+
ennreal.measurable_of_real.comp_ae_measurable hYm,
169+
have h3 : ae_measurable (X * Y) μ := hXm.mul hYm,
170+
171+
have h4 : 0 ≤ᵐ[μ] (X * Y) := ae_of_all _ (λ ω, mul_nonneg (hXp ω) (hYp ω)),
172+
173+
rw [integral_eq_lintegral_of_nonneg_ae (ae_of_all _ hXp) hXm.ae_strongly_measurable,
174+
integral_eq_lintegral_of_nonneg_ae (ae_of_all _ hYp) hYm.ae_strongly_measurable,
175+
integral_eq_lintegral_of_nonneg_ae h4 h3.ae_strongly_measurable],
176+
simp_rw [←ennreal.to_real_mul, pi.mul_apply, ennreal.of_real_mul (hXp _)],
177+
congr,
178+
apply lintegral_mul_eq_lintegral_mul_lintegral_of_indep_fun' h1 h2,
179+
exact hXY.comp ennreal.measurable_of_real ennreal.measurable_of_real
180+
end
181+
182+
/-- The (Bochner) integral of the product of two independent, integrable random
183+
variables is the product of their integrals. The proof is pedestrian decomposition
184+
into their positive and negative parts in order to apply `indep_fun.integral_mul_of_nonneg`
185+
four times. -/
186+
theorem indep_fun.integral_mul_of_integrable (hXY : indep_fun X Y μ)
187+
(hX : integrable X μ) (hY : integrable Y μ) :
188+
integral μ (X * Y) = integral μ X * integral μ Y :=
189+
begin
190+
let pos : ℝ → ℝ := (λ x, max x 0),
191+
let neg : ℝ → ℝ := (λ x, max (-x) 0),
192+
have posm : measurable pos := measurable_id'.max measurable_const,
193+
have negm : measurable neg := measurable_id'.neg.max measurable_const,
194+
195+
let Xp := pos ∘ X, -- `X⁺` would look better but it makes `simp_rw` below fail
196+
let Xm := neg ∘ X,
197+
let Yp := pos ∘ Y,
198+
let Ym := neg ∘ Y,
199+
200+
have hXpm : X = Xp - Xm := funext (λ ω, (max_zero_sub_max_neg_zero_eq_self (X ω)).symm),
201+
have hYpm : Y = Yp - Ym := funext (λ ω, (max_zero_sub_max_neg_zero_eq_self (Y ω)).symm),
202+
203+
have hp1 : 0 ≤ Xm := λ ω, le_max_right _ _,
204+
have hp2 : 0 ≤ Xp := λ ω, le_max_right _ _,
205+
have hp3 : 0 ≤ Ym := λ ω, le_max_right _ _,
206+
have hp4 : 0 ≤ Yp := λ ω, le_max_right _ _,
207+
208+
have hm1 : ae_measurable Xm μ := hX.1.ae_measurable.neg.max ae_measurable_const,
209+
have hm2 : ae_measurable Xp μ := hX.1.ae_measurable.max ae_measurable_const,
210+
have hm3 : ae_measurable Ym μ := hY.1.ae_measurable.neg.max ae_measurable_const,
211+
have hm4 : ae_measurable Yp μ := hY.1.ae_measurable.max ae_measurable_const,
212+
213+
have hv1 : integrable Xm μ := hX.neg.max_zero,
214+
have hv2 : integrable Xp μ := hX.max_zero,
215+
have hv3 : integrable Ym μ := hY.neg.max_zero,
216+
have hv4 : integrable Yp μ := hY.max_zero,
217+
218+
have hi1 : indep_fun Xm Ym μ := hXY.comp negm negm,
219+
have hi2 : indep_fun Xp Ym μ := hXY.comp posm negm,
220+
have hi3 : indep_fun Xm Yp μ := hXY.comp negm posm,
221+
have hi4 : indep_fun Xp Yp μ := hXY.comp posm posm,
222+
223+
have hl1 : integrable (Xm * Ym) μ := hi1.integrable_mul hv1 hv3,
224+
have hl2 : integrable (Xp * Ym) μ := hi2.integrable_mul hv2 hv3,
225+
have hl3 : integrable (Xm * Yp) μ := hi3.integrable_mul hv1 hv4,
226+
have hl4 : integrable (Xp * Yp) μ := hi4.integrable_mul hv2 hv4,
227+
have hl5 : integrable (Xp * Yp - Xm * Yp) μ := hl4.sub hl3,
228+
have hl6 : integrable (Xp * Ym - Xm * Ym) μ := hl2.sub hl1,
229+
230+
simp_rw [hXpm, hYpm, mul_sub, sub_mul],
231+
rw [integral_sub' hl5 hl6, integral_sub' hl4 hl3, integral_sub' hl2 hl1,
232+
integral_sub' hv2 hv1, integral_sub' hv4 hv3, hi1.integral_mul_of_nonneg hp1 hp3 hm1 hm3,
233+
hi2.integral_mul_of_nonneg hp2 hp3 hm2 hm3, hi3.integral_mul_of_nonneg hp1 hp4 hm1 hm4,
234+
hi4.integral_mul_of_nonneg hp2 hp4 hm2 hm4],
235+
ring
236+
end
237+
121238
end probability_theory

0 commit comments

Comments
 (0)