Offline · exact source
Exact Lean source

YoungFlatCouplingEvents

formalization/Cloning/YoungFlatCouplingEvents.lean

Source hash: 01dab54639a549f3bc26d5f164165250f53516d6e6220241898902ec34ef55f9

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.YoungFlatCouplingDensity
2 
3/-! Event control for the exact-marginal overlap coupling. -/
4noncomputable section
5open scoped BigOperators Topology Classical
6open MeasureTheory Filter
7namespace Cloning.YoungFlatCoupling
8set_option backward.isDefEq.respectTransparency false
9set_option maxHeartbeats 800000
10variable {X I J : Type*} [MeasurableSpace X] [Fintype I] [Fintype J]
11variable [MeasurableSpace I] [MeasurableSingletonClass I]
12variable [MeasurableSpace J] [MeasurableSingletonClass J]
13variable (μ : Measure X)
14 
15def densityCoupling (Q : X → I) (S : X → J) (f g : X → ℝ)
16    (hQ : Measurable Q) (hS : Measurable S)
17    (hf : Integrable f μ) (hg : Integrable g μ)
18    (hf0 : ∀ x, 0 ≤ f x) (hg0 : ∀ x, 0 ≤ g x)
19    (hfm : ∫ x, f x ∂μ = 1) (hgm : ∫ x, g x ∂μ = 1) : PMF (I×J) :=
20  completionPMF (densityBin μ Q f) (densityBin μ S g) (densityCommon μ Q S f g)
21    ((densityBin_sum μ Q f (fun i => hQ (measurableSet_singleton i)) hf).trans hfm)
22    ((densityBin_sum μ S g (fun j => hS (measurableSet_singleton j)) hg).trans hgm)
23    (densityCommon_nonneg μ Q S f g hf0 hg0)
24    (densityCommon_row_le μ Q S f g (fun i => hQ (measurableSet_singleton i))
25      (fun j => hS (measurableSet_singleton j)) hf hg)
26    (densityCommon_col_le μ Q S f g (fun i => hQ (measurableSet_singleton i))
27      (fun j => hS (measurableSet_singleton j)) hf hg)
28 
29theorem densityCoupling_map_fst (Q : X → I) (S : X → J) (f g : X → ℝ)
30    (hQ : Measurable Q) (hS : Measurable S)
31    (hf : Integrable f μ) (hg : Integrable g μ)
32    (hf0 : ∀ x, 0 ≤ f x) (hg0 : ∀ x, 0 ≤ g x)
33    (hfm : ∫ x, f x ∂μ = 1) (hgm : ∫ x, g x ∂μ = 1) (i : I) :
34    ((densityCoupling μ Q S f g hQ hS hf hg hf0 hg0 hfm hgm).map Prod.fst) i =
35      ENNReal.ofReal (densityBin μ Q f i) :=
36  completionPMF_map_fst _ _ _ _ _ _ _ _ i
37 
38theorem densityCoupling_map_snd (Q : X → I) (S : X → J) (f g : X → ℝ)
39    (hQ : Measurable Q) (hS : Measurable S)
40    (hf : Integrable f μ) (hg : Integrable g μ)
41    (hf0 : ∀ x, 0 ≤ f x) (hg0 : ∀ x, 0 ≤ g x)
42    (hfm : ∫ x, f x ∂μ = 1) (hgm : ∫ x, g x ∂μ = 1) (j : J) :
43    ((densityCoupling μ Q S f g hQ hS hf hg hf0 hg0 hfm hgm).map Prod.snd) j =
44      ENNReal.ofReal (densityBin μ S g j) :=
45  completionPMF_map_snd _ _ _ _ _ _ _ _ j
46 
47theorem measurableSet_relation (Q : X → I) (S : X → J)
48    (hQ : Measurable Q) (hS : Measurable S) (P : I → J → Prop) :
49    MeasurableSet {x | P (Q x) (S x)} :=
50  (hQ.prodMk hS) (Set.toFinite {ij : I×J | P ij.1 ij.2}).measurableSet
51 
52theorem integrable_relation (Q : X → I) (S : X → J)
53    (hQ : Measurable Q) (hS : Measurable S) (P : I → J → Prop)
54    (f : X → ℝ) (hf : Integrable f μ) :
55    Integrable (fun x => if P (Q x) (S x) then f x else 0) μ :=
56  hf.indicator (measurableSet_relation Q S hQ hS P)
57 
58theorem densityCommon_event (Q : X → I) (S : X → J) (f g : X → ℝ)
59    (hQ : Measurable Q) (hS : Measurable S)
60    (hf : Integrable f μ) (hg : Integrable g μ) (P : I → J → Prop) :
61    (∑ i, ∑ j, if P i j then densityCommon μ Q S f g i j else 0) =
62      ∫ x, if P (Q x) (S x) then min (f x) (g x) else 0 ∂μ := by
63  have hmin : Integrable (fun x => min (f x) (g x)) μ := hf.inf hg
64  have hi (i : I) (j : J) : Integrable
65      (fun x => if Q x=i ∧ S x=j then min (f x) (g x) else 0) μ := by
66    convert hmin.indicator ((hQ (measurableSet_singleton i)).inter
67      (hS (measurableSet_singleton j))) using 1
68    funext x
69    simp only [Set.indicator_apply, Set.mem_inter_iff, Set.mem_preimage, Set.mem_singleton_iff]
70  have he (i : I) (j : J) : (if P i j then densityCommon μ Q S f g i j else 0) =
71      ∫ x, if P i j then (if Q x=i ∧ S x=j then min (f x) (g x) else 0) else 0 ∂μ := by
72    by_cases h : P i j <;> simp [h, densityCommon]
73  have hii (i : I) (j : J) : Integrable
74      (fun x => if P i j then (if Q x=i ∧ S x=j then min (f x) (g x) else 0) else 0) μ := by
75    by_cases h : P i j
76    · simpa only [if_pos h] using hi i j
77    · simp only [if_neg h]; exact integrable_zero _ _ _
78  simp_rw [he]
79  simp_rw [← integral_finset_sum _ (fun j _ => hii _ j)]
80  rw [← integral_finset_sum _ (fun i _ => integrable_finset_sum _ (fun j _ => hii i j))]
81  apply integral_congr_ae
82  apply ae_of_all
83  intro x
84  have hswap i j : (if P i j then (if Q x=i ∧ S x=j then min (f x) (g x) else 0) else 0) =
85      if Q x=i then (if S x=j then (if P i j then min (f x) (g x) else 0) else 0) else 0 := by
86    split_ifs <;> simp_all
87  simp only [hswap, Finset.sum_ite_irrel, Finset.sum_const_zero, Finset.sum_ite_eq,
88    Finset.mem_univ, if_true]
89 
90theorem densityCoupling_event_le (Q : X → I) (S : X → J) (f g : X → ℝ)
91    (hQ : Measurable Q) (hS : Measurable S)
92    (hf : Integrable f μ) (hg : Integrable g μ)
93    (hf0 : ∀ x, 0 ≤ f x) (hg0 : ∀ x, 0 ≤ g x)
94    (hfm : ∫ x, f x ∂μ = 1) (hgm : ∫ x, g x ∂μ = 1) (P : I → J → Prop) :
95    (∑ ij, if P ij.1 ij.2 then
96      (densityCoupling μ Q S f g hQ hS hf hg hf0 hg0 hfm hgm ij).toReal else 0) ≤
97      (∫ x, if P (Q x) (S x) then min (f x) (g x) else 0 ∂μ) +
98        (1/2 : ℝ) * ∫ x, |f x-g x| ∂μ := by
99  simp only [densityCoupling, completionPMF_toReal, Fintype.sum_prod_type]
100  convert completionWeight_event_le (densityBin μ Q f) (densityBin μ S g)
101    (densityCommon μ Q S f g) ((densityBin_sum μ Q f (fun i => hQ (measurableSet_singleton i)) hf).trans hfm)
102    ((densityBin_sum μ S g (fun j => hS (measurableSet_singleton j)) hg).trans hgm)
103    (densityCommon_row_le μ Q S f g (fun i => hQ (measurableSet_singleton i))
104      (fun j => hS (measurableSet_singleton j)) hf hg)
105    (densityCommon_col_le μ Q S f g (fun i => hQ (measurableSet_singleton i))
106      (fun j => hS (measurableSet_singleton j)) hf hg) P using 1
107  rw [densityCommon_event μ Q S f g hQ hS hf hg P,
108    densityCommon_mass μ Q S f g (fun i => hQ (measurableSet_singleton i))
109      (fun j => hS (measurableSet_singleton j)) hf hg,
110    density_overlap_defect μ f g hf hg hfm hgm]
111 
112end Cloning.YoungFlatCoupling