# Documentation

Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic

# Conditional expectation #

We build the conditional expectation of an integrable function f with value in a Banach space with respect to a measure μ (defined on a measurable space structure m0) and a measurable space structure m with hm : m ≤ m0 (a sub-sigma-algebra). This is an m-strongly measurable function μ[f|hm] which is integrable and verifies ∫ x in s, μ[f|hm] x ∂μ = ∫ x in s, f x ∂μ for all m-measurable sets s. It is unique as an element of L¹.

The construction is done in four steps:

• Define the conditional expectation of an L² function, as an element of L². This is the orthogonal projection on the subspace of almost everywhere m-measurable functions.
• Show that the conditional expectation of the indicator of a measurable set with finite measure is integrable and define a map Set α → (E →L[ℝ] (α →₁[μ] E)) which to a set associates a linear map. That linear map sends x ∈ E to the conditional expectation of the indicator of the set with value x.
• Extend that map to condexpL1Clm : (α →₁[μ] E) →L[ℝ] (α →₁[μ] E). This is done using the same construction as the Bochner integral (see the file MeasureTheory/Integral/SetToL1).
• Define the conditional expectation of a function f : α → E, which is an integrable function α → E equal to 0 if f is not integrable, and equal to an m-measurable representative of condexpL1Clm applied to [f], the equivalence class of f in L¹.

The first step is done in MeasureTheory.Function.ConditionalExpectation.CondexpL2, the two next steps in MeasureTheory.Function.ConditionalExpectation.CondexpL1 and the final step is performed in this file.

## Main results #

The conditional expectation and its properties

• condexp (m : MeasurableSpace α) (μ : Measure α) (f : α → E): conditional expectation of f with respect to m.
• integrable_condexp : condexp is integrable.
• stronglyMeasurable_condexp : condexp is m-strongly-measurable.
• set_integral_condexp (hf : Integrable f μ) (hs : MeasurableSet[m] s) : if m ≤ m0 (the σ-algebra over which the measure is defined), then the conditional expectation verifies ∫ x in s, condexp m μ f x ∂μ = ∫ x in s, f x ∂μ for any m-measurable set s.

While condexp is function-valued, we also define condexpL1 with value in L1 and a continuous linear map condexpL1Clm from L1 to L1. condexp should be used in most cases.

Uniqueness of the conditional expectation

• ae_eq_condexp_of_forall_set_integral_eq: an a.e. m-measurable function which verifies the equality of integrals is a.e. equal to condexp.

## Notations #

For a measure μ defined on a measurable space structure m0, another measurable space structure m with hm : m ≤ m0 (a sub-σ-algebra) and a function f, we define the notation

• μ[f|m] = condexp m μ f.

## Tags #

conditional expectation, conditional expected value

theorem MeasureTheory.condexp_def {α : Type u_5} {F' : Type u_6} [] [] [] (m : ) {m0 : } (μ : ) (f : αF') :
= if hm : m m0 then if h : then if then f else MeasureTheory.AEStronglyMeasurable'.mk ↑() (_ : MeasureTheory.AEStronglyMeasurable' m (↑()) μ) else 0 else 0
@[irreducible]
noncomputable def MeasureTheory.condexp {α : Type u_5} {F' : Type u_6} [] [] [] (m : ) {m0 : } (μ : ) (f : αF') :
αF'

Conditional expectation of a function. It is defined as 0 if any one of the following conditions is true:

• m is not a sub-σ-algebra of m0,
• μ is not σ-finite with respect to m,
• f is not integrable.
Instances For
Instances For
theorem MeasureTheory.condexp_of_not_le {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} (hm_not : ¬m m0) :
= 0
theorem MeasureTheory.condexp_of_not_sigmaFinite {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} (hm : m m0) (hμm_not : ) :
= 0
theorem MeasureTheory.condexp_of_sigmaFinite {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} (hm : m m0) [hμm : ] :
= if then if then f else MeasureTheory.AEStronglyMeasurable'.mk ↑() (_ : MeasureTheory.AEStronglyMeasurable' m (↑()) μ) else 0
theorem MeasureTheory.condexp_of_stronglyMeasurable {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } (hm : m m0) [hμm : ] {f : αF'} (hf : ) (hfi : ) :
= f
theorem MeasureTheory.condexp_const {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } (hm : m m0) (c : F') :
(MeasureTheory.condexp m μ fun x => c) = fun x => c
theorem MeasureTheory.condexp_ae_eq_condexpL1 {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } (hm : m m0) [hμm : ] (f : αF') :
=ᶠ[] ↑()
theorem MeasureTheory.condexp_ae_eq_condexpL1Clm {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} (hm : m m0) (hf : ) :
=ᶠ[] ↑(↑() ())
theorem MeasureTheory.condexp_undef {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} (hf : ) :
= 0
@[simp]
theorem MeasureTheory.condexp_zero {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } :
= 0
theorem MeasureTheory.stronglyMeasurable_condexp {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} :
theorem MeasureTheory.condexp_congr_ae {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} {g : αF'} (h : ) :
theorem MeasureTheory.condexp_of_aestronglyMeasurable' {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } (hm : m m0) [hμm : ] {f : αF'} (hf : ) (hfi : ) :
theorem MeasureTheory.integrable_condexp {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} :
theorem MeasureTheory.set_integral_condexp {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} {s : Set α} (hm : m m0) (hf : ) (hs : ) :
∫ (x : α) in s, μ = ∫ (x : α) in s, f xμ

The integral of the conditional expectation μ[f|hm] over an m-measurable set is equal to the integral of f on that set.

theorem MeasureTheory.integral_condexp {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} (hm : m m0) [hμm : ] (hf : ) :
∫ (x : α), μ = ∫ (x : α), f xμ
theorem MeasureTheory.ae_eq_condexp_of_forall_set_integral_eq {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } (hm : m m0) {f : αF'} {g : αF'} (hf : ) (hg_int_finite : ∀ (s : Set α), μ s < ) (hg_eq : ∀ (s : Set α), μ s < ∫ (x : α) in s, g xμ = ∫ (x : α) in s, f xμ) (hgm : ) :

Uniqueness of the conditional expectation If a function is a.e. m-measurable, verifies an integrability condition and has same integral as f on all m-measurable sets, then it is a.e. equal to μ[f|hm].

theorem MeasureTheory.condexp_bot' {α : Type u_1} {F' : Type u_3} [] [] [] {m0 : } {μ : } [hμ : ] (f : αF') :
= fun x => (ENNReal.toReal (μ Set.univ))⁻¹ ∫ (x : α), f xμ
theorem MeasureTheory.condexp_bot_ae_eq {α : Type u_1} {F' : Type u_3} [] [] [] {m0 : } {μ : } (f : αF') :
=ᶠ[] fun x => (ENNReal.toReal (μ Set.univ))⁻¹ ∫ (x : α), f xμ
theorem MeasureTheory.condexp_bot {α : Type u_1} {F' : Type u_3} [] [] [] {m0 : } {μ : } (f : αF') :
= fun x => ∫ (x : α), f xμ
theorem MeasureTheory.condexp_add {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} {g : αF'} (hf : ) (hg : ) :
theorem MeasureTheory.condexp_finset_sum {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {ι : Type u_5} {s : } {f : ιαF'} (hf : ∀ (i : ι), i s) :
MeasureTheory.condexp m μ (Finset.sum s fun i => f i) =ᶠ[] Finset.sum s fun i => MeasureTheory.condexp m μ (f i)
theorem MeasureTheory.condexp_smul {α : Type u_1} {F' : Type u_3} {𝕜 : Type u_4} [] [] [NormedSpace 𝕜 F'] [] [] {m : } {m0 : } {μ : } (c : 𝕜) (f : αF') :
theorem MeasureTheory.condexp_neg {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } (f : αF') :
theorem MeasureTheory.condexp_sub {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } {f : αF'} {g : αF'} (hf : ) (hg : ) :
theorem MeasureTheory.condexp_condexp_of_le {α : Type u_1} {F' : Type u_3} [] [] [] {f : αF'} {m₁ : } {m₂ : } {m0 : } {μ : } (hm₁₂ : m₁ m₂) (hm₂ : m₂ m0) :
theorem MeasureTheory.condexp_mono {α : Type u_1} {m : } {m0 : } {μ : } {E : Type u_5} [] [] [] {f : αE} {g : αE} (hf : ) (hg : ) (hfg : ) :
theorem MeasureTheory.condexp_nonneg {α : Type u_1} {m : } {m0 : } {μ : } {E : Type u_5} [] [] [] {f : αE} (hf : ) :
theorem MeasureTheory.condexp_nonpos {α : Type u_1} {m : } {m0 : } {μ : } {E : Type u_5} [] [] [] {f : αE} (hf : ) :
theorem MeasureTheory.tendsto_condexpL1_of_dominated_convergence {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } (hm : m m0) {fs : αF'} {f : αF'} (bound_fs : α) (hfs_meas : ∀ (n : ), ) (h_int_bound_fs : MeasureTheory.Integrable bound_fs) (hfs_bound : ∀ (n : ), ∀ᵐ (x : α) ∂μ, fs n x bound_fs x) (hfs : ∀ᵐ (x : α) ∂μ, Filter.Tendsto (fun n => fs n x) Filter.atTop (nhds (f x))) :
Filter.Tendsto (fun n => MeasureTheory.condexpL1 hm μ (fs n)) Filter.atTop (nhds ())

Lebesgue dominated convergence theorem: sufficient conditions under which almost everywhere convergence of a sequence of functions implies the convergence of their image by condexpL1.

theorem MeasureTheory.tendsto_condexp_unique {α : Type u_1} {F' : Type u_3} [] [] [] {m : } {m0 : } {μ : } (fs : αF') (gs : αF') (f : αF') (g : αF') (hfs_int : ∀ (n : ), MeasureTheory.Integrable (fs n)) (hgs_int : ∀ (n : ), MeasureTheory.Integrable (gs n)) (hfs : ∀ᵐ (x : α) ∂μ, Filter.Tendsto (fun n => fs n x) Filter.atTop (nhds (f x))) (hgs : ∀ᵐ (x : α) ∂μ, Filter.Tendsto (fun n => gs n x) Filter.atTop (nhds (g x))) (bound_fs : α) (h_int_bound_fs : MeasureTheory.Integrable bound_fs) (bound_gs : α) (h_int_bound_gs : MeasureTheory.Integrable bound_gs) (hfs_bound : ∀ (n : ), ∀ᵐ (x : α) ∂μ, fs n x bound_fs x) (hgs_bound : ∀ (n : ), ∀ᵐ (x : α) ∂μ, gs n x bound_gs x) (hfg : ∀ (n : ), MeasureTheory.condexp m μ (fs n) =ᶠ[] MeasureTheory.condexp m μ (gs n)) :

If two sequences of functions have a.e. equal conditional expectations at each step, converge and verify dominated convergence hypotheses, then the conditional expectations of their limits are a.e. equal.