Offline · exact source
Exact Lean source

CountMultinomialMixture

formalization/Cloning/CountMultinomialMixture.lean

Source hash: 77cc690e53ff00eaa061a7d2e48ef66fca850e5dd198e589cb34e949eed1db8a

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Cloning.CountMultinomialMeasurability
2import Mathlib.MeasureTheory.Integral.Prod
3 
4/-! Dominated L¹ convergence for actual mixtures of probability densities. -/
5noncomputable section
6open scoped Topology
7open Filter MeasureTheory
8namespace Cloning.CountMultinomial
9set_option backward.isDefEq.respectTransparency false
10set_option maxHeartbeats 1000000
11variable {Z X : Type*} [MeasurableSpace Z] [MeasurableSpace X]
12variable (μ : Measure Z) [IsProbabilityMeasure μ] (ν : Measure X) [SFinite ν]
13 
14theorem integrable_joint_density (f : Z → X → ℝ)
15    (hm : Measurable (Function.uncurry f)) (hf : ∀ z, Integrable (f z) ν)
16    (h0 : ∀ z x, 0≤f z x) (h1 : ∀ z, (∫ x, f z x ∂ν)=1) :
17    Integrable (Function.uncurry f) (μ.prod ν) := by
18  apply (integrable_prod_iff hm.aestronglyMeasurable).mpr
19  refine ⟨Eventually.of_forall hf, ?_⟩
20  simp only [Function.uncurry_apply_pair, Real.norm_eq_abs, abs_of_nonneg (h0 _ _), h1]
21  exact integrable_const _
22 
23theorem integral_mixture_density (f : Z → X → ℝ)
24    (hm : Measurable (Function.uncurry f)) (hf : ∀ z, Integrable (f z) ν)
25    (h0 : ∀ z x, 0≤f z x) (h1 : ∀ z, (∫ x, f z x ∂ν)=1) :
26    (∫ x, (∫ z, f z x ∂μ) ∂ν)=1 := by
27  rw [← integral_integral_swap (integrable_joint_density μ ν f hm hf h0 h1)]
28  simp only [h1, integral_const, measureReal_univ_eq_one, smul_eq_mul, one_mul]
29 
30theorem mixture_l1_le (f g : Z → X → ℝ)
31    (hf : Integrable (Function.uncurry f) (μ.prod ν))
32    (hg : Integrable (Function.uncurry g) (μ.prod ν)) :
33    (∫ x, |(∫ z, f z x ∂μ)-(∫ z, g z x ∂μ)| ∂ν) ≤
34      ∫ z, (∫ x, |f z x-g z x| ∂ν) ∂μ := by
35  have he := hf.sub hg
36  calc
37    _ ≤ ∫ x, (∫ z, |f z x-g z x| ∂μ) ∂ν := by
38      apply integral_mono_ae (hf.integral_prod_right.sub hg.integral_prod_right).abs
39        he.abs.integral_prod_right
40      filter_upwards [hf.prod_left_ae, hg.prod_left_ae] with x hfx hgx
41      change |(∫ z, f z x ∂μ)-(∫ z, g z x ∂μ)| ≤ ∫ z, |f z x-g z x| ∂μ
42      change Integrable (fun z ↦ f z x) μ at hfx
43      change Integrable (fun z ↦ g z x) μ at hgx
44      rw [← integral_sub hfx hgx]
45      exact abs_integral_le_integral_abs
46    _ = _ := (integral_integral_swap he.abs).symm
47 
48theorem mixture_density_l1_tendsto (f : ℕ → Z → X → ℝ) (g : Z → X → ℝ)
49    (hfm : ∀ n, Measurable (Function.uncurry (f n)))
50    (hgm : Measurable (Function.uncurry g))
51    (hfi : ∀ n z, Integrable (f n z) ν) (hgi : ∀ z, Integrable (g z) ν)
52    (hf0 : ∀ n z x, 0≤f n z x) (hg0 : ∀ z x, 0≤g z x)
53    (hf1 : ∀ n z, (∫ x, f n z x ∂ν)=1) (hg1 : ∀ z, (∫ x, g z x ∂ν)=1)
54    (hlim : ∀ z, Tendsto (fun n ↦ ∫ x, |f n z x-g z x| ∂ν) atTop (𝓝 0)) :
55    Tendsto (fun n ↦ ∫ x, |(∫ z, f n z x ∂μ)-(∫ z, g z x ∂μ)| ∂ν)
56      atTop (𝓝 0) := by
57  have hjf n := integrable_joint_density μ ν (f n) (hfm n) (hfi n) (hf0 n) (hf1 n)
58  have hjg := integrable_joint_density μ ν g hgm hgi hg0 hg1
59  have hb n z : (∫ x, |f n z x-g z x| ∂ν) ≤ 2 := by
60    calc
61      _ ≤ ∫ x, f n z x+g z x ∂ν := by
62        apply integral_mono ((hfi n z).sub (hgi z)).abs ((hfi n z).add (hgi z))
63        intro x
64        change |f n z x-g z x| ≤ f n z x+g z x
65        simpa only [sub_zero, zero_sub, abs_neg, abs_of_nonneg (hf0 n z x), abs_of_nonneg (hg0 z x)] using abs_sub_le (f n z x) 0 (g z x)
66      _ = 2 := by rw [integral_add (hfi n z) (hgi z), hf1, hg1]; norm_num
67  have ht : Tendsto (fun n ↦ ∫ z, (∫ x, |f n z x-g z x| ∂ν) ∂μ) atTop (𝓝 0) := by
68    have hh := tendsto_integral_of_dominated_convergence (fun _ : Z ↦ (2:ℝ))
69      (fun n ↦ ((hjf n).sub hjg).abs.integral_prod_left.aestronglyMeasurable)
70      (integrable_const _)
71      (fun n ↦ Eventually.of_forall (fun z ↦ by
72        rw [Real.norm_eq_abs, abs_of_nonneg (integral_nonneg (fun _ ↦ abs_nonneg _))]
73        exact hb n z)) (Eventually.of_forall hlim)
74    simpa using hh
75  exact squeeze_zero (fun _ ↦ integral_nonneg (fun _ ↦ abs_nonneg _))
76    (fun n ↦ mixture_l1_le μ ν (f n) g (hjf n) hjg) ht
77 
78end Cloning.CountMultinomial