The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V18. Measure and integration

Mathlib.MeasureTheory.Integral.Marginal

24 declarations. Mathlib docs · Source

Marginals of multivariate functions

In this file, we define a convenient way to compute integrals of multivariate functions, especially if you want to write expressions where you integrate only over some of the variables that the function depends on. This is common in induction arguments involving integrals of multivariate functions. This constructions allows working with iterated integrals and applying Tonelli's theorem and Fubini's theorem, without using measurable equivalences by changing the representation of your space (e.g. ((ι ⊕ ι') → ℝ) ≃ (ι → ℝ) × (ι' → ℝ)).

Main Definitions

  • Assume that ∀ i : ι, X i is a product of measurable spaces with measures μ i on X i, f : (∀ i, X i) → ℝ≥0∞ is a function and s : Finset ι. Then lmarginal μ s f or ∫⋯∫⁻_s, f ∂μ is the function that integrates f over all variables in s. It returns a function that still takes the same variables as f, but is constant in the variables in s. Mathematically, if s = {i₁, ..., iₖ}, then lmarginal μ s f is the expression $$ \vec{x}\mapsto \int!!\cdots!!\int f(\vec{x}[\vec{y}])dy_{i_1}\cdots dy_{i_k}. $$ where $\vec{x}[\vec{y}]$ is the vector $\vec{x}$ with $x_{i_j}$ replaced by $y_{i_j}$ for all $1 \le j \le k$. If f is the distribution of a random variable, this is the marginal distribution of all variables not in s (but not the most general notion, since we only consider product measures here). Note that the notation ∫⋯∫⁻_s, f ∂μ is not a binder, and returns a function.

Main Results

  • lmarginal_union is the analogue of Tonelli's theorem for iterated integrals. It states that for measurable functions f and disjoint finsets s and t we have ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ.

Implementation notes

The function f can have an arbitrary product as its domain (even infinite products), but the set s of integration variables is a Finset. We are assuming that the function f is measurable for most of this file. Note that asking whether it is AEMeasurable is not even well-posed, since there is no well-behaved measure on the domain of f.

TODO

  • Define the marginal function for functions taking values in a Banach space.

theorem MeasureTheory.lmarginal.congr_simp E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {inst_1 : DecidableEq δ}
  [inst_2 : DecidableEq δ] (μ μ_1 : (i : δ) → MeasureTheory.Measure (X i)),
  μ = μ_1 →
    ∀ (s s_1 : Finset δ),
      s = s_1 →
        ∀ (f f_1 : ((i : δ) → X i) → ENNReal),
          f = f_1 → ∀ (x x_1 : (i : δ) → X i), x = x_1 → (∫⋯∫⁻_s, f ∂μ) x = (∫⋯∫⁻_s_1, f_1 ∂μ_1) x_1

def MeasureTheory.lmarginal E3 #

{δ : Type u_1} →
  {X : δ → Type u_3} →
    [inst : (i : δ) → MeasurableSpace (X i)] →
      [DecidableEq δ] →
        ((i : δ) → MeasureTheory.Measure (X i)) → Finset δ → (((i : δ) → X i) → ENNReal) → ((i : δ) → X i) → ENNReal

Integrate f(x₁,…,xₙ) over all variables xᵢ where i ∈ s. Return a function in the remaining variables (it will be constant in the xᵢ for i ∈ s). This is the marginal distribution of all variables not in s when the considered measure is the product measure.

def MeasureTheory.«term∫⋯∫⁻__,_∂_» E1 #

Lean.ParserDescr

Integrate f(x₁,…,xₙ) over all variables xᵢ where i ∈ s. Return a function in the remaining variables (it will be constant in the xᵢ for i ∈ s). This is the marginal distribution of all variables not in s when the considered measure is the product measure.

def MeasureTheory.«term∫⋯∫⁻__,_» E1 #

Lean.ParserDescr

Integrate f(x₁,…,xₙ) over all variables xᵢ where i ∈ s. Return a function in the remaining variables (it will be constant in the xᵢ for i ∈ s). This is the marginal distribution of all variables not in s when the considered measure is the product measure.

theorem Measurable.lmarginal E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] (μ : (i : δ) → MeasureTheory.Measure (X i))
  [inst_1 : DecidableEq δ] {s : Finset δ} {f : ((i : δ) → X i) → ENNReal} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)],
  Measurable f → Measurable (∫⋯∫⁻_s, f ∂μ)

theorem MeasureTheory.lmarginal_empty E0 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] (μ : (i : δ) → MeasureTheory.Measure (X i))
  [inst_1 : DecidableEq δ] (f : ((i : δ) → X i) → ENNReal), ∫⋯∫⁻_∅, f ∂μ = f

theorem MeasureTheory.lmarginal_congr E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] (μ : (i : δ) → MeasureTheory.Measure (X i))
  [inst_1 : DecidableEq δ] {s : Finset δ} {x y : (i : δ) → X i} (f : ((i : δ) → X i) → ENNReal),
  (∀ i ∉ s, x i = y i) → (∫⋯∫⁻_s, f ∂μ) x = (∫⋯∫⁻_s, f ∂μ) y

The marginal distribution is independent of the variables in s.

theorem MeasureTheory.lmarginal_update_of_mem E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] (μ : (i : δ) → MeasureTheory.Measure (X i))
  [inst_1 : DecidableEq δ] {s : Finset δ} {i : δ},
  i ∈ s →
    ∀ (f : ((i : δ) → X i) → ENNReal) (x : (i : δ) → X i) (y : X i),
      (∫⋯∫⁻_s, f ∂μ) (Function.update x i y) = (∫⋯∫⁻_s, f ∂μ) x

theorem MeasureTheory.lmarginal_singleton E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] (f : ((i : δ) → X i) → ENNReal) (i : δ),
  ∫⋯∫⁻_{i}, f ∂μ = fun x ↦ ∫⁻ (xᵢ : X i), f (Function.update x i xᵢ) ∂μ i

theorem MeasureTheory.lmarginal_mono E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] {s : Finset δ} {f g : ((i : δ) → X i) → ENNReal}, f ≤ g → ∫⋯∫⁻_s, f ∂μ ≤ ∫⋯∫⁻_s, g ∂μ

theorem MeasureTheory.lmarginal_union E3 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] (μ : (i : δ) → MeasureTheory.Measure (X i))
  [inst_1 : DecidableEq δ] {s t : Finset δ} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)]
  (f : ((i : δ) → X i) → ENNReal), Measurable f → Disjoint s t → ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ

theorem MeasureTheory.lmarginal_union' E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] (μ : (i : δ) → MeasureTheory.Measure (X i))
  [inst_1 : DecidableEq δ] [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] (f : ((i : δ) → X i) → ENNReal),
  Measurable f → ∀ {s t : Finset δ}, Disjoint s t → ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_t, ∫⋯∫⁻_s, f ∂μ ∂μ

theorem MeasureTheory.lmarginal_insert E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] {s : Finset δ} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] (f : ((i : δ) → X i) → ENNReal),
  Measurable f →
    ∀ {i : δ},
      i ∉ s →
        ∀ (x : (i : δ) → X i), (∫⋯∫⁻_insert i s, f ∂μ) x = ∫⁻ (xᵢ : X i), (∫⋯∫⁻_s, f ∂μ) (Function.update x i xᵢ) ∂μ i

Peel off a single integral from a lmarginal integral at the beginning (compare with lmarginal_insert', which peels off an integral at the end).

theorem MeasureTheory.lmarginal_erase E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] {s : Finset δ} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] (f : ((i : δ) → X i) → ENNReal),
  Measurable f →
    ∀ {i : δ},
      i ∈ s →
        ∀ (x : (i : δ) → X i), (∫⋯∫⁻_s, f ∂μ) x = ∫⁻ (xᵢ : X i), (∫⋯∫⁻_s.erase i, f ∂μ) (Function.update x i xᵢ) ∂μ i

Peel off a single integral from a lmarginal integral at the beginning (compare with lmarginal_erase', which peels off an integral at the end).

theorem MeasureTheory.lmarginal_insert' E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] {s : Finset δ} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] (f : ((i : δ) → X i) → ENNReal),
  Measurable f →
    ∀ {i : δ}, i ∉ s → ∫⋯∫⁻_insert i s, f ∂μ = ∫⋯∫⁻_s, fun x ↦ ∫⁻ (xᵢ : X i), f (Function.update x i xᵢ) ∂μ i ∂μ

Peel off a single integral from a lmarginal integral at the end (compare with lmarginal_insert, which peels off an integral at the beginning).

theorem MeasureTheory.lmarginal_erase' E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] {s : Finset δ} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] (f : ((i : δ) → X i) → ENNReal),
  Measurable f →
    ∀ {i : δ}, i ∈ s → ∫⋯∫⁻_s, f ∂μ = ∫⋯∫⁻_s.erase i, fun x ↦ ∫⁻ (xᵢ : X i), f (Function.update x i xᵢ) ∂μ i ∂μ

Peel off a single integral from a lmarginal integral at the end (compare with lmarginal_erase, which peels off an integral at the beginning).

theorem MeasureTheory.lmarginal_univ E0 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] [inst_3 : Fintype δ]
  {f : ((i : δ) → X i) → ENNReal},
  ∫⋯∫⁻_Finset.univ, f ∂μ = fun x ↦ ∫⁻ (x : (i : δ) → X i), f x ∂MeasureTheory.Measure.pi μ

theorem MeasureTheory.lintegral_eq_lmarginal_univ E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] [inst_3 : Fintype δ]
  {f : ((i : δ) → X i) → ENNReal} (x : (i : δ) → X i),
  ∫⁻ (x : (i : δ) → X i), f x ∂MeasureTheory.Measure.pi μ = (∫⋯∫⁻_Finset.univ, f ∂μ) x

theorem MeasureTheory.lmarginal_image E1 #

∀ {δ : Type u_1} {δ' : Type u_2} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)]
  {μ : (i : δ) → MeasureTheory.Measure (X i)} [inst_1 : DecidableEq δ] [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)]
  [inst_3 : DecidableEq δ'] {e : δ' → δ},
  Function.Injective e →
    ∀ (s : Finset δ') {f : ((i : δ') → X (e i)) → ENNReal},
      Measurable f →
        ∀ (x : (i : δ) → X i),
          (∫⋯∫⁻_Finset.image e s, f ∘ fun x ↦ (fun {x_1} ↦ x) ∘' e ∂μ) x =
            (∫⋯∫⁻_s, f ∂(fun {x} ↦ μ) ∘' e) ((fun {x_1} ↦ x) ∘' e)

theorem MeasureTheory.lmarginal_update_of_notMem E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] {s : Finset δ} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] {i : δ}
  {f : ((i : δ) → X i) → ENNReal},
  Measurable f →
    i ∉ s →
      ∀ (x : (i : δ) → X i) (y : X i),
        (∫⋯∫⁻_s, f ∂μ) (Function.update x i y) = (∫⋯∫⁻_s, f ∘ fun x ↦ Function.update x i y ∂μ) x

theorem MeasureTheory.lmarginal_eq_of_subset E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] {s t : Finset δ} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)]
  {f g : ((i : δ) → X i) → ENNReal},
  s ⊆ t → Measurable f → Measurable g → ∫⋯∫⁻_s, f ∂μ = ∫⋯∫⁻_s, g ∂μ → ∫⋯∫⁻_t, f ∂μ = ∫⋯∫⁻_t, g ∂μ

theorem MeasureTheory.lmarginal_le_of_subset E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] {s t : Finset δ} [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)]
  {f g : ((i : δ) → X i) → ENNReal},
  s ⊆ t → Measurable f → Measurable g → ∫⋯∫⁻_s, f ∂μ ≤ ∫⋯∫⁻_s, g ∂μ → ∫⋯∫⁻_t, f ∂μ ≤ ∫⋯∫⁻_t, g ∂μ

theorem MeasureTheory.lintegral_eq_of_lmarginal_eq E0 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] [inst_3 : Fintype δ] (s : Finset δ)
  {f g : ((i : δ) → X i) → ENNReal},
  Measurable f →
    Measurable g →
      ∫⋯∫⁻_s, f ∂μ = ∫⋯∫⁻_s, g ∂μ →
        ∫⁻ (x : (i : δ) → X i), f x ∂MeasureTheory.Measure.pi μ =
          ∫⁻ (x : (i : δ) → X i), g x ∂MeasureTheory.Measure.pi μ

theorem MeasureTheory.lintegral_le_of_lmarginal_le E1 #

∀ {δ : Type u_1} {X : δ → Type u_3} [inst : (i : δ) → MeasurableSpace (X i)] {μ : (i : δ) → MeasureTheory.Measure (X i)}
  [inst_1 : DecidableEq δ] [∀ (i : δ), MeasureTheory.SigmaFinite (μ i)] [inst_3 : Fintype δ] (s : Finset δ)
  {f g : ((i : δ) → X i) → ENNReal},
  Measurable f →
    Measurable g →
      ∫⋯∫⁻_s, f ∂μ ≤ ∫⋯∫⁻_s, g ∂μ →
        ∫⁻ (x : (i : δ) → X i), f x ∂MeasureTheory.Measure.pi μ ≤
          ∫⁻ (x : (i : δ) → X i), g x ∂MeasureTheory.Measure.pi μ