Exact Lean source
YoungFlatCouplingFinite
formalization/Cloning/YoungFlatCouplingFinite.lean
Source hash: 50c44fa7da2c8b852abeced60a12a2ba314ed52ff70b3561d32753bcf7edd6f7
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
definition
Cloning.YoungFlatCoupling.commonMassdefinition Cloning.YoungFlatCoupling.rowResidualdefinition Cloning.YoungFlatCoupling.colResidualdefinition Cloning.YoungFlatCoupling.completionWeighttheorem Cloning.YoungFlatCoupling.rowResidual_sumtheorem Cloning.YoungFlatCoupling.colResidual_sumtheorem Cloning.YoungFlatCoupling.commonMass_le_onetheorem Cloning.YoungFlatCoupling.completionWeight_nonnegtheorem Cloning.YoungFlatCoupling.completionWeight_rowtheorem Cloning.YoungFlatCoupling.completionWeight_coltheorem Cloning.YoungFlatCoupling.completionWeight_sumdefinition Cloning.YoungFlatCoupling.completionPMFtheorem Cloning.YoungFlatCoupling.completionPMF_toRealtheorem Cloning.YoungFlatCoupling.completionPMF_map_fsttheorem Cloning.YoungFlatCoupling.completionPMF_map_sndtheorem Cloning.YoungFlatCoupling.completionWeight_sub_nonnegtheorem Cloning.YoungFlatCoupling.completionWeight_residual_masstheorem Cloning.YoungFlatCoupling.completionWeight_event_le1import Cloning.YoungCompatibilityPMF
2import Mathlib.Probability.ProbabilityMassFunction.Constructions
3
4/-! Exact finite marginal completion of a common subcoupling. The residual is
5an independent product with its forced normalization, including zero defect. -/
6noncomputable section
7open scoped BigOperators ENNReal
8namespace Cloning.YoungFlatCoupling
9open Finset
10set_option maxHeartbeats 600000
11variable {I J : Type*} [Fintype I] [Fintype J]
12
13def commonMass (c : I → J → ℝ) : ℝ := ∑ i, ∑ j, c i j
14
15def rowResidual (p : I → ℝ) (c : I → J → ℝ) (i : I) : ℝ := p i - ∑ j, c i j
16
17def colResidual (q : J → ℝ) (c : I → J → ℝ) (j : J) : ℝ := q j - ∑ i, c i j
18
19def completionWeight (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ) (i : I) (j : J) : ℝ :=
20 c i j + rowResidual p c i * colResidual q c j / (1-commonMass c)
21
22theorem rowResidual_sum (p : I → ℝ) (c : I → J → ℝ) (hp : ∑ i, p i = 1) :
23 ∑ i, rowResidual p c i = 1-commonMass c := by
24 simp only [rowResidual, Finset.sum_sub_distrib, hp, commonMass]
25
26theorem colResidual_sum (q : J → ℝ) (c : I → J → ℝ) (hq : ∑ j, q j = 1) :
27 ∑ j, colResidual q c j = 1-commonMass c := by
28 simp only [colResidual, Finset.sum_sub_distrib, hq, commonMass]
29 rw [Finset.sum_comm]
30
31theorem commonMass_le_one (p : I → ℝ) (c : I → J → ℝ)
32 (hp : ∑ i, p i = 1) (hr : ∀ i, ∑ j, c i j ≤ p i) : commonMass c ≤ 1 := by
33 exact (Finset.sum_le_sum (fun i _ => hr i)).trans_eq hp
34
35theorem completionWeight_nonneg (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
36 (hp : ∑ i, p i = 1) (hc : ∀ i j, 0 ≤ c i j)
37 (hr : ∀ i, ∑ j, c i j ≤ p i) (hs : ∀ j, ∑ i, c i j ≤ q j) (i : I) (j : J) :
38 0 ≤ completionWeight p q c i j :=
39 add_nonneg (hc i j) (div_nonneg (mul_nonneg (sub_nonneg.mpr (hr i)) (sub_nonneg.mpr (hs j)))
40 (sub_nonneg.mpr (commonMass_le_one p c hp hr)))
41
42theorem completionWeight_row (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
43 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1)
44 (hr : ∀ i, ∑ j, c i j ≤ p i) (i : I) :
45 ∑ j, completionWeight p q c i j = p i := by
46 classical
47 have hsum := rowResidual_sum p c hp
48 have hres : 0 ≤ rowResidual p c i := sub_nonneg.mpr (hr i)
49 have hle : rowResidual p c i ≤ 1-commonMass c := by
50 rw [← hsum]
51 exact Finset.single_le_sum (fun j _ => sub_nonneg.mpr (hr j)) (Finset.mem_univ i)
52 simp only [completionWeight, Finset.sum_add_distrib, div_eq_mul_inv]
53 rw [← Finset.sum_mul, ← Finset.mul_sum, colResidual_sum q c hq]
54 by_cases ha : 1-commonMass c = 0
55 · have hz : rowResidual p c i = 0 := le_antisymm (hle.trans_eq ha) hres
56 have he : ∑ j, c i j = p i := by dsimp only [rowResidual] at hz; linarith
57 rw [hz, zero_mul, zero_mul, add_zero, he]
58 · rw [mul_assoc, mul_inv_cancel₀ ha, mul_one]
59 simp only [rowResidual]
60 ring
61
62theorem completionWeight_col (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
63 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1)
64 (hs : ∀ j, ∑ i, c i j ≤ q j) (j : J) :
65 ∑ i, completionWeight p q c i j = q j := by
66 classical
67 have he : completionWeight p q c = fun i j => completionWeight q p (fun j i => c i j) j i := by
68 funext i j
69 unfold completionWeight rowResidual colResidual commonMass
70 rw [Finset.sum_comm (f := fun i j => c i j)]
71 ring
72 rw [he]
73 exact completionWeight_row q p (fun j i => c i j) hq hp hs j
74
75theorem completionWeight_sum (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
76 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1) (hr : ∀ i, ∑ j, c i j ≤ p i) :
77 ∑ i, ∑ j, completionWeight p q c i j = 1 := by
78 simp only [completionWeight_row p q c hp hq hr]
79 exact hp
80
81/-- Exact marginal PMF constructed from any finite common subcoupling. -/
82def completionPMF (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
83 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1) (hc : ∀ i j, 0 ≤ c i j)
84 (hr : ∀ i, ∑ j, c i j ≤ p i) (hs : ∀ j, ∑ i, c i j ≤ q j) : PMF (I × J) :=
85 PMF.ofFintype (fun ij => ENNReal.ofReal (completionWeight p q c ij.1 ij.2)) (by
86 rw [← ENNReal.ofReal_sum_of_nonneg (fun ij _ => completionWeight_nonneg p q c hp hc hr hs ij.1 ij.2),
87 Fintype.sum_prod_type, completionWeight_sum p q c hp hq hr, ENNReal.ofReal_one])
88
89@[simp] theorem completionPMF_toReal (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
90 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1) (hc : ∀ i j, 0 ≤ c i j)
91 (hr : ∀ i, ∑ j, c i j ≤ p i) (hs : ∀ j, ∑ i, c i j ≤ q j) (ij : I × J) :
92 (completionPMF p q c hp hq hc hr hs ij).toReal = completionWeight p q c ij.1 ij.2 :=
93 ENNReal.toReal_ofReal (completionWeight_nonneg p q c hp hc hr hs ij.1 ij.2)
94
95theorem completionPMF_map_fst (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
96 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1) (hc : ∀ i j, 0 ≤ c i j)
97 (hr : ∀ i, ∑ j, c i j ≤ p i) (hs : ∀ j, ∑ i, c i j ≤ q j) (i : I) :
98 ((completionPMF p q c hp hq hc hr hs).map Prod.fst) i = ENNReal.ofReal (p i) := by
99 classical
100 simp only [PMF.map_apply, tsum_fintype, Fintype.sum_prod_type,
101 completionPMF, PMF.ofFintype_apply]
102 rw [Finset.sum_comm]
103 simp only [Finset.sum_ite_eq, Finset.mem_univ, ↓reduceIte]
104 rw [← ENNReal.ofReal_sum_of_nonneg (fun j _ => completionWeight_nonneg p q c hp hc hr hs i j),
105 completionWeight_row p q c hp hq hr]
106
107theorem completionPMF_map_snd (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
108 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1) (hc : ∀ i j, 0 ≤ c i j)
109 (hr : ∀ i, ∑ j, c i j ≤ p i) (hs : ∀ j, ∑ i, c i j ≤ q j) (j : J) :
110 ((completionPMF p q c hp hq hc hr hs).map Prod.snd) j = ENNReal.ofReal (q j) := by
111 classical
112 simp only [PMF.map_apply, tsum_fintype, Fintype.sum_prod_type,
113 completionPMF, PMF.ofFintype_apply, Finset.sum_ite_eq, Finset.mem_univ, ↓reduceIte]
114 rw [← ENNReal.ofReal_sum_of_nonneg (fun i _ => completionWeight_nonneg p q c hp hc hr hs i j),
115 completionWeight_col p q c hp hq hs]
116
117theorem completionWeight_sub_nonneg (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
118 (hp : ∑ i, p i = 1)
119 (hr : ∀ i, ∑ j, c i j ≤ p i) (hs : ∀ j, ∑ i, c i j ≤ q j) (i : I) (j : J) :
120 0 ≤ completionWeight p q c i j - c i j := by
121 change 0 ≤ c i j + _ - c i j
122 rw [add_sub_cancel_left]
123 exact div_nonneg (mul_nonneg (sub_nonneg.mpr (hr i)) (sub_nonneg.mpr (hs j)))
124 (sub_nonneg.mpr (commonMass_le_one p c hp hr))
125
126theorem completionWeight_residual_mass (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
127 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1) (hr : ∀ i, ∑ j, c i j ≤ p i) :
128 ∑ i, ∑ j, (completionWeight p q c i j - c i j) = 1-commonMass c := by
129 simp only [Finset.sum_sub_distrib, completionWeight_sum p q c hp hq hr, commonMass]
130
131theorem completionWeight_event_le (p : I → ℝ) (q : J → ℝ) (c : I → J → ℝ)
132 (hp : ∑ i, p i = 1) (hq : ∑ j, q j = 1)
133 (hr : ∀ i, ∑ j, c i j ≤ p i) (hs : ∀ j, ∑ i, c i j ≤ q j)
134 (P : I → J → Prop) [∀ i j, Decidable (P i j)] :
135 (∑ i, ∑ j, if P i j then completionWeight p q c i j else 0) ≤
136 (∑ i, ∑ j, if P i j then c i j else 0) + (1-commonMass c) := by
137 classical
138 have he (i : I) (j : J) :
139 (if P i j then completionWeight p q c i j else 0) =
140 (if P i j then c i j else 0) +
141 (if P i j then completionWeight p q c i j-c i j else 0) := by
142 split_ifs <;> ring
143 simp_rw [he, Finset.sum_add_distrib]
144 apply add_le_add_right
145 rw [← completionWeight_residual_mass p q c hp hq hr]
146 apply Finset.sum_le_sum
147 intro i _
148 apply Finset.sum_le_sum
149 intro j _
150 split_ifs
151 · exact le_rfl
152 · exact completionWeight_sub_nonneg p q c hp hr hs i j
153
154end Cloning.YoungFlatCoupling