Exact Lean source
YoungCompatibility
formalization/Cloning/YoungCompatibility.lean
Source hash: 0625362e98fd2966c0b0541f406343c02efd31257136d2c55ca4ab112ac037a5
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.
In the dependency map: Lifted channels
Paper ↔ Lean correspondence in this module
Declarations in this module
definition
Cloning.YoungCompatibility.IsYoungdefinition Cloning.YoungCompatibility.Compatibledefinition Cloning.YoungCompatibility.completetheorem Cloning.YoungCompatibility.complete_headtheorem Cloning.YoungCompatibility.complete_lasttheorem Cloning.YoungCompatibility.complete_sumtheorem Cloning.YoungCompatibility.compatible_isYoungtheorem Cloning.YoungCompatibility.compatible_of_typicaltheorem Cloning.YoungCompatibility.complete_rounding_support_errortheorem Cloning.YoungCompatibility.rounding_support_compatibletheorem Cloning.YoungCompatibility.eventually_rounding_support_compatibletheorem Cloning.YoungCompatibility.compact_spectra_positive_gap1import Cloning.YoungRounding
2import Mathlib.Data.Fin.Tuple.Basic
3import Mathlib.Algebra.BigOperators.Fin
4import Mathlib.Probability.ProbabilityMassFunction.Constructions
5
6/-!
7# Compatibility of actual rounded Young labels
8
9The difference between a typical input and every label in the support of the
10actual dither kernel is a partition once the spectral gap exceeds the explicit
11rounding error. Compatibility is derived from coordinate estimates; it is not
12an input assumption. `d` denotes the number of head coordinates, so labels have
13`d+1` rows. This file does not assert concentration of the Young distribution.
14-/
15
16set_option maxHeartbeats 800000
17
18noncomputable section
19open scoped BigOperators Topology
20open Filter
21
22namespace Cloning.YoungCompatibility
23
24/-- A nonnegative decreasing integer row vector, with its total number of boxes. -/
25def IsYoung {d : ℕ} (n : ℤ) (μ : Fin d → ℤ) : Prop :=
26 (∀ i, 0 ≤ μ i) ∧ Antitone μ ∧ ∑ i, μ i = n
27
28/-- The literal Cartan compatibility condition. -/
29def Compatible {d : ℕ} (n m : ℤ) (μ ν : Fin d → ℤ) : Prop :=
30 IsYoung (m - n) (fun i ↦ ν i - μ i)
31
32/-- Add the uniquely determined final lattice coordinate. -/
33def complete {d : ℕ} (m : ℤ) (z : Fin d → ℤ) : Fin (d + 1) → ℤ :=
34 Fin.snoc z (Rounding.completeLast m z)
35
36@[simp] theorem complete_head {d : ℕ} (m : ℤ) (z : Fin d → ℤ) (i : Fin d) :
37 complete m z i.castSucc = z i := by simp [complete]
38
39@[simp] theorem complete_last {d : ℕ} (m : ℤ) (z : Fin d → ℤ) :
40 complete m z (Fin.last d) = Rounding.completeLast m z := by simp [complete]
41
42theorem complete_sum {d : ℕ} (m : ℤ) (z : Fin d → ℤ) :
43 ∑ i, complete m z i = m := by
44 rw [Fin.sum_univ_castSucc]
45 simp [Rounding.completeLast]
46
47/-- A compatible output of a Young input is a Young label. -/
48theorem compatible_isYoung {d : ℕ} {n m : ℤ} {μ ν : Fin d → ℤ}
49 (hμ : IsYoung n μ) (h : Compatible n m μ ν) : IsYoung m ν := by
50 dsimp only [Compatible, IsYoung] at h hμ ⊢
51 refine ⟨fun i ↦ by have := h.1 i; have := hμ.1 i; omega,
52 fun i j hij ↦ by
53 have hd : ν j - μ j ≤ ν i - μ i := h.2.1 hij
54 have := hμ.2.1 hij
55 omega, ?_⟩
56 have hm := h.2.2
57 simp only [Finset.sum_sub_distrib, hμ.2.2] at hm
58 omega
59
60/-- An explicit deterministic criterion. A lower bound `a` for both row
61probabilities and all ordered spectral gaps controls the two kinds of boundary.
62The rounding error `c` is unnormalized. -/
63theorem compatible_of_typical {d : ℕ} (n m : ℤ) (μ ν : Fin d → ℤ)
64 (p : Fin d → ℝ) (γ ε a c : ℝ)
65 (hn : 0 ≤ (n : ℝ)) (hγ : 1 ≤ γ) (ha : 0 ≤ a)
66 (hp : ∀ i, a ≤ p i) (hgap : ∀ i j, i < j → a ≤ p i - p j)
67 (hε : ε ≤ a / 4) (hmargin : 4 * c ≤ (γ - 1) * (n : ℝ) * a)
68 (hμmass : ∑ i, μ i = n) (hνmass : ∑ i, ν i = m)
69 (hμ : ∀ i, |(μ i : ℝ) - (n : ℝ) * p i| ≤ (n : ℝ) * ε)
70 (hν : ∀ i, |(ν i : ℝ) - γ * (μ i : ℝ)| ≤ c) :
71 Compatible n m μ ν := by
72 have hγ0 : 0 ≤ γ - 1 := sub_nonneg.mpr hγ
73 have hne : (n : ℝ) * ε ≤ (n : ℝ) * (a / 4) := mul_le_mul_of_nonneg_left hε hn
74 refine ⟨?_, ?_, ?_⟩
75 · intro i
76 have hi := (abs_le.mp (hμ i)).1
77 have hi' := (abs_le.mp (hν i)).1
78 have hp' := mul_le_mul_of_nonneg_left (hp i) hn
79 have hm : (n : ℝ) * (a / 2) ≤ (μ i : ℝ) := by nlinarith
80 have hm' := mul_le_mul_of_nonneg_left hm hγ0
81 have hna := mul_nonneg hn ha
82 have hreal : 0 ≤ (ν i : ℝ) - (μ i : ℝ) := by nlinarith
83 exact_mod_cast hreal
84 · intro i j hij
85 rcases lt_or_eq_of_le hij with hij | rfl
86 · have hi := (abs_le.mp (hμ i)).1
87 have hj := (abs_le.mp (hμ j)).2
88 have hi' := (abs_le.mp (hν i)).1
89 have hj' := (abs_le.mp (hν j)).2
90 have hp' := mul_le_mul_of_nonneg_left (hgap i j hij) hn
91 have hm : (n : ℝ) * (a / 2) ≤ (μ i : ℝ) - (μ j : ℝ) := by nlinarith
92 have hm' := mul_le_mul_of_nonneg_left hm hγ0
93 have hreal : (ν j : ℝ) - (μ j : ℝ) ≤ (ν i : ℝ) - (μ i : ℝ) := by nlinarith
94 exact_mod_cast hreal
95 · exact le_rfl
96 · rw [Finset.sum_sub_distrib, hμmass, hνmass]
97
98/-- Uniform error for every full label in the actual PMF's support, including
99its dependent final coordinate. -/
100theorem complete_rounding_support_error {d : ℕ} (hd : 1 ≤ d)
101 (n m : ℤ) (μ : Fin (d + 1) → ℤ) (γ : ℝ) (hγ : 0 ≤ γ)
102 (hμmass : ∑ i, μ i = n) (hm : (m : ℝ) = γ * (n : ℝ))
103 (z : Fin d → ℤ)
104 (hz : YoungRounding.roundingPMF γ (fun i ↦ (μ i.castSucc : ℝ)) z ≠ 0)
105 (i : Fin (d + 1)) :
106 |(complete m z i : ℝ) - γ * (μ i : ℝ)| ≤ (d : ℝ) * ((γ + 1) / 2) := by
107 have hc : 0 ≤ (γ + 1) / 2 := by positivity
108 have hd' : (1 : ℝ) ≤ d := by exact_mod_cast hd
109 have hhead j := YoungRounding.roundingPMF_support γ hγ
110 (fun i ↦ (μ i.castSucc : ℝ)) z hz j
111 refine Fin.lastCases ?_ (fun j ↦ ?_) i
112 · rw [complete_last]
113 have hmass : (∑ j : Fin d, (μ j.castSucc : ℝ)) + (μ (Fin.last d) : ℝ) = n := by
114 exact_mod_cast (show (∑ j : Fin d, μ j.castSucc) + μ (Fin.last d) = n by
115 simpa only [Fin.sum_univ_castSucc] using hμmass)
116 have hscale : (m : ℝ) = γ * ((∑ j : Fin d, (μ j.castSucc : ℝ)) + (μ (Fin.last d) : ℝ)) := by
117 rw [hmass, hm]
118 simpa only [Fintype.card_fin] using Rounding.completeLast_error_bound m z
119 (fun i : Fin d ↦ (μ i.castSucc : ℝ)) (μ (Fin.last d)) γ ((γ + 1) / 2) hscale hhead
120 · rw [complete_head]
121 exact (hhead j).trans (by nlinarith)
122
123/-- The actual dither PMF cannot leave the compatible sector on a typical input
124under the explicit spectral-gap and sample-size conditions. -/
125theorem rounding_support_compatible {d : ℕ} (hd : 1 ≤ d)
126 (n m : ℤ) (μ : Fin (d + 1) → ℤ) (p : Fin (d + 1) → ℝ)
127 (γ ε a : ℝ) (hn : 0 ≤ (n : ℝ)) (hγ : 1 ≤ γ) (ha : 0 ≤ a)
128 (hp : ∀ i, a ≤ p i) (hgap : ∀ i j, i < j → a ≤ p i - p j)
129 (hε : ε ≤ a / 4)
130 (hmargin : 4 * ((d : ℝ) * ((γ + 1) / 2)) ≤ (γ - 1) * (n : ℝ) * a)
131 (hμmass : ∑ i, μ i = n) (hm : (m : ℝ) = γ * (n : ℝ))
132 (hμ : ∀ i, |(μ i : ℝ) - (n : ℝ) * p i| ≤ (n : ℝ) * ε)
133 (z : Fin d → ℤ)
134 (hz : YoungRounding.roundingPMF γ (fun i ↦ (μ i.castSucc : ℝ)) z ≠ 0) :
135 Compatible n m μ (complete m z) :=
136 compatible_of_typical n m μ (complete m z) p γ ε a _ hn hγ ha hp hgap hε
137 hmargin hμmass (complete_sum m z) hμ
138 (complete_rounding_support_error hd n m μ γ (by linarith) hμmass hm z hz)
139
140/-- The deterministic thresholds hold eventually at every fixed gain above one.
141The quantifiers over spectra and labels are inside the eventual quantifier, so
142this is uniform over all spectra with a common positive gap. -/
143theorem eventually_rounding_support_compatible {d : ℕ} (hd : 1 ≤ d)
144 (m : ℕ → ℤ) (γn ε : ℕ → ℝ) (γ a : ℝ)
145 (ha : 0 < a) (hγ : 1 < γ)
146 (hγn : Tendsto γn atTop (𝓝 γ)) (hε : Tendsto ε atTop (𝓝 0))
147 (hm : ∀ n, (m n : ℝ) = γn n * (n : ℝ)) :
148 ∀ᶠ (n : ℕ) in atTop, ∀ (p : Fin (d + 1) → ℝ),
149 (∀ i, a ≤ p i) → (∀ i j, i < j → a ≤ p i - p j) →
150 ∀ (μ : Fin (d + 1) → ℤ), (∑ i, μ i = (n : ℤ)) →
151 (∀ i, |(μ i : ℝ) - (n : ℝ) * p i| ≤ (n : ℝ) * ε n) →
152 ∀ z, YoungRounding.roundingPMF (γn n) (fun i ↦ (μ i.castSucc : ℝ)) z ≠ 0 →
153 Compatible (n : ℤ) (m n) μ (complete (m n) z) := by
154 have hn : Tendsto (fun n : ℕ ↦ (n : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop
155 have hright : Tendsto (fun n ↦ (γn n - 1) * (n : ℝ) * a) atTop atTop :=
156 ((hγn.sub_const 1).pos_mul_atTop (by linarith) hn).atTop_mul_pos ha tendsto_const_nhds
157 have hleft : Tendsto (fun n ↦ 4 * ((d : ℝ) * ((γn n + 1) / 2))) atTop
158 (𝓝 (4 * ((d : ℝ) * ((γ + 1) / 2)))) := by
159 exact (((hγn.add_const 1).div_const 2).const_mul (d : ℝ)).const_mul 4
160 have hleftbd := hleft.eventually (gt_mem_nhds (lt_add_one (4 * ((d : ℝ) * ((γ + 1) / 2)))))
161 have hrightbd := hright.eventually (eventually_ge_atTop (4 * ((d : ℝ) * ((γ + 1) / 2)) + 1))
162 have heps := hε.eventually (gt_mem_nhds (show (0 : ℝ) < a / 4 by positivity))
163 have hgain := hγn.eventually (lt_mem_nhds hγ)
164 filter_upwards [hleftbd, hrightbd, heps, hgain] with n hl hr he hg
165 intro p hp hgap μ hmass htyp z hz
166 apply rounding_support_compatible hd (n : ℤ) (m n) μ p (γn n) (ε n) a
167 (by positivity) hg.le ha.le hp hgap he.le
168 · exact_mod_cast hl.le.trans hr
169 · exact hmass
170 · simpa only [Int.cast_natCast] using hm n
171 · simpa only [Int.cast_natCast] using htyp
172 · exact hz
173
174private theorem finite_positive_lower {I : Type*} [Fintype I]
175 (f : I → ℝ) (hf : ∀ i, 0 < f i) : ∃ a, 0 < a ∧ ∀ i, a ≤ f i := by
176 classical
177 have h : ∀ s : Finset I, ∃ a, 0 < a ∧ ∀ i ∈ s, a ≤ f i := by
178 intro s
179 induction s using Finset.induction_on with
180 | empty => exact ⟨1, by norm_num, by simp⟩
181 | @insert i s hi ih =>
182 obtain ⟨a, ha, hb⟩ := ih
183 refine ⟨min a (f i), lt_min ha (hf i), ?_⟩
184 intro j hj
185 rcases Finset.mem_insert.mp hj with rfl | hj
186 · exact min_le_right _ _
187 · exact (min_le_left _ _).trans (hb j hj)
188 obtain ⟨a, ha, hb⟩ := h Finset.univ
189 exact ⟨a, ha, fun i ↦ hb i (Finset.mem_univ i)⟩
190
191/-- Compact subsets of strictly decreasing positive spectra have the common
192positive row and spectral-gap bounds used above. Compactness is applied to
193actual coordinate functions, with no compatibility input. -/
194theorem compact_spectra_positive_gap {d : ℕ}
195 (K : Set (Fin d → ℝ)) (hK : IsCompact K)
196 (hpos : ∀ p ∈ K, ∀ i, 0 < p i)
197 (hanti : ∀ p ∈ K, StrictAnti p) :
198 ∃ a, 0 < a ∧ (∀ p ∈ K, ∀ i, a ≤ p i) ∧
199 (∀ p ∈ K, ∀ i j, i < j → a ≤ p i - p j) := by
200 classical
201 have hrow (i : Fin d) : ∃ a, 0 < a ∧ ∀ p ∈ K, a ≤ p i :=
202 hK.exists_forall_le' (continuous_apply i).continuousOn (fun p hp ↦ hpos p hp i)
203 choose row hrow0 hrowbd using hrow
204 obtain ⟨a, ha, habd⟩ := finite_positive_lower row hrow0
205 have hpair (ij : Fin d × Fin d) :
206 ∃ b, 0 < b ∧ ∀ p ∈ K, ij.1 < ij.2 → b ≤ p ij.1 - p ij.2 := by
207 by_cases hij : ij.1 < ij.2
208 · obtain ⟨b, hb, hbd⟩ := hK.exists_forall_le'
209 ((continuous_apply ij.1).sub (continuous_apply ij.2)).continuousOn
210 (fun p hp ↦ sub_pos.mpr (hanti p hp hij))
211 exact ⟨b, hb, fun p hp _ ↦ hbd p hp⟩
212 · exact ⟨1, by norm_num, fun _ _ h ↦ (hij h).elim⟩
213 choose pair hpair0 hpairbd using hpair
214 obtain ⟨b, hb, hbbd⟩ := finite_positive_lower pair hpair0
215 refine ⟨min a b, lt_min ha hb, ?_, ?_⟩
216 · intro p hp i
217 exact (min_le_left _ _).trans ((habd i).trans (hrowbd i p hp))
218 · intro p hp i j hij
219 exact (min_le_right _ _).trans ((hbbd (i,j)).trans (hpairbd (i,j) p hp hij))
220
221end Cloning.YoungCompatibility