Offline · exact source
Exact Lean source

YoungCompatibilityFallback

formalization/Cloning/YoungCompatibilityFallback.lean

Source hash: 3e51b2fcc5197f0d144b01adbd044ae060485fd58eaa917577eb86b04c5529eb

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.YoungCompatibility
2import Cloning.YoungCompatibilityPMF
3 
4/-!
5# The manuscript's actual randomized Young kernel with fallback
6 
7Every row is constructed as the pushforward of the normalized dither PMF.
8On incompatible labels it uses exactly the one-row partition specified in the
9manuscript. The row agrees with the raw kernel on all typical inputs under
10proved numerical conditions.  Consequently the output-law change is bounded
11by twice the input atypical probability, and its affinity change by the square
12root of that quantity.  Young-law concentration remains a separate input.
13-/
14 
15noncomputable section
16open scoped BigOperators Topology Classical
17open Filter
18 
19namespace Cloning.YoungCompatibility
20 
21/-- The one-row fallback in equation `rounding-kernel`. -/
22def oneRow {d : ℕ} (m : ℤ) : Fin (d + 1) → ℤ := fun i ↦ if i = 0 then m else 0
23 
24theorem oneRow_isYoung {d : ℕ} (m : ℤ) (hm : 0 ≤ m) :
25    IsYoung m (oneRow (d := d) m) := by
26  refine ⟨?_, ?_, ?_⟩
27  · intro i
28    simp only [oneRow]
29    split_ifs <;> omega
30  · intro i j hij
31    by_cases hi : i = 0
32    · simp only [oneRow, hi, ↓reduceIte]
33      split_ifs <;> omega
34    · have hj : j ≠ 0 := fun hj ↦ hi (le_antisymm (hj ▸ hij) (Fin.zero_le _))
35      simp [oneRow, hi, hj]
36  · simp [oneRow]
37 
38/-- The raw probability row on full affine-lattice labels. -/
39def rawKernel {d : ℕ} (γ : ℝ) (m : ℤ) (μ : Fin (d + 1) → ℤ) :
40    PMF (Fin (d + 1) → ℤ) :=
41  (YoungRounding.roundingPMF γ (fun i : Fin d ↦ (μ i.castSucc : ℝ))).map (complete m)
42 
43/-- The exact fallback function in the manuscript. -/
44def fallbackLabel {d : ℕ} (n m : ℤ) (μ ν : Fin (d + 1) → ℤ) : Fin (d + 1) → ℤ :=
45  if Compatible n m μ ν then ν else oneRow m
46 
47/-- The actual normalized Young transition law, including fallback. -/
48def fallbackKernel {d : ℕ} (γ : ℝ) (n m : ℤ) (μ : Fin (d + 1) → ℤ) :
49    PMF (Fin (d + 1) → ℤ) :=
50  (rawKernel γ m μ).map (fallbackLabel n m μ)
51 
52theorem fallbackKernel_sum {d : ℕ} (γ : ℝ) (n m : ℤ) (μ : Fin (d + 1) → ℤ) :
53    ∑' ν, fallbackKernel γ n m μ ν = 1 := (fallbackKernel γ n m μ).tsum_coe
54 
55/-- Fallback really produces a Young output even on atypical input rows. -/
56theorem fallbackKernel_support_isYoung {d : ℕ} (γ : ℝ) (n m : ℤ)
57    (hm : 0 ≤ m) (μ : Fin (d + 1) → ℤ) (hμ : IsYoung n μ)
58    (ν : Fin (d + 1) → ℤ) (hν : fallbackKernel γ n m μ ν ≠ 0) :
59    IsYoung m ν := by
60  obtain ⟨w, _, rfl⟩ := (PMF.mem_support_map_iff _ _ _).mp hν
61  unfold fallbackLabel
62  split_ifs with h
63  · exact compatible_isYoung hμ h
64  · exact oneRow_isYoung m hm
65 
66/-- On rows whose raw support is compatible, the fallback PMF equals the raw
67PMF.  This helper is instantiated below with the proved support theorem. -/
68theorem fallbackKernel_eq_raw_of_support {d : ℕ} (γ : ℝ) (n m : ℤ)
69    (μ : Fin (d + 1) → ℤ)
70    (h : ∀ z, YoungRounding.roundingPMF γ (fun i : Fin d ↦ (μ i.castSucc : ℝ)) z ≠ 0 →
71      Compatible n m μ (complete m z)) :
72    fallbackKernel γ n m μ = rawKernel γ m μ := by
73  unfold fallbackKernel rawKernel
74  rw [PMF.map_comp]
75  apply PMF.ext
76  intro ν
77  simp only [PMF.map_apply]
78  apply tsum_congr
79  intro z
80  by_cases hz : YoungRounding.roundingPMF γ (fun i : Fin d ↦ (μ i.castSucc : ℝ)) z = 0
81  · simp [hz]
82  · simp [Function.comp_apply, fallbackLabel, h z hz]
83 
84/-- Typicality uses actual Young labels, plus the unnormalized coordinate
85window equivalent to `‖μ/n-p‖∞ ≤ ε` for positive sample size. -/
86def Typical {d : ℕ} (n : ℤ) (p : Fin (d + 1) → ℝ) (ε : ℝ)
87    (μ : Fin (d + 1) → ℤ) : Prop :=
88  IsYoung n μ ∧ ∀ i, |(μ i : ℝ) - (n : ℝ) * p i| ≤ (n : ℝ) * ε
89 
90/-- The row identity required for the PMF error theorem is now a conclusion,
91proved for the actual randomized kernel under explicit spectral conditions. -/
92theorem fallbackKernel_eq_raw_of_typical {d : ℕ} (hd : 1 ≤ d)
93    (n m : ℤ) (p : Fin (d + 1) → ℝ) (γ ε a : ℝ)
94    (hn : 0 ≤ (n : ℝ)) (hγ : 1 ≤ γ) (ha : 0 ≤ a)
95    (hp : ∀ i, a ≤ p i) (hgap : ∀ i j, i < j → a ≤ p i - p j)
96    (hε : ε ≤ a / 4)
97    (hmargin : 4 * ((d : ℝ) * ((γ + 1) / 2)) ≤ (γ - 1) * (n : ℝ) * a)
98    (hm : (m : ℝ) = γ * (n : ℝ))
99    (μ : Fin (d + 1) → ℤ) (hμ : Typical n p ε μ) :
100    fallbackKernel γ n m μ = rawKernel γ m μ := by
101  apply fallbackKernel_eq_raw_of_support
102  exact rounding_support_compatible hd n m μ p γ ε a hn hγ ha hp hgap hε hmargin
103    hμ.1.2.2 hm hμ.2
104 
105/-- Countable-law version of the manuscript's actual fallback estimate. -/
106theorem rounding_fallback_l1_bound {d : ℕ} (hd : 1 ≤ d)
107    (n m : ℤ) (p : Fin (d + 1) → ℝ) (γ ε a : ℝ)
108    (hn : 0 ≤ (n : ℝ)) (hγ : 1 ≤ γ) (ha : 0 ≤ a)
109    (hp : ∀ i, a ≤ p i) (hgap : ∀ i j, i < j → a ≤ p i - p j)
110    (hε : ε ≤ a / 4)
111    (hmargin : 4 * ((d : ℝ) * ((γ + 1) / 2)) ≤ (γ - 1) * (n : ℝ) * a)
112    (hm : (m : ℝ) = γ * (n : ℝ)) (P : PMF (Fin (d + 1) → ℤ)) :
113    CountableScheffe.l1Distance
114      (probability (P.bind (fallbackKernel γ n m)))
115      (probability (P.bind (rawKernel γ m))) ≤ 2 * badMass P (Typical n p ε) := by
116  apply bind_fallback_l1_bound
117  exact fallbackKernel_eq_raw_of_typical hd n m p γ ε a hn hγ ha hp hgap hε hmargin hm
118 
119/-- The label-affinity cost of the actual fallback, for every normalized
120countable target law, including the Young law at the output sample size. -/
121theorem rounding_fallback_affinity_bound {d : ℕ} (hd : 1 ≤ d)
122    (n m : ℤ) (p : Fin (d + 1) → ℝ) (γ ε a : ℝ)
123    (hn : 0 ≤ (n : ℝ)) (hγ : 1 ≤ γ) (ha : 0 ≤ a)
124    (hp : ∀ i, a ≤ p i) (hgap : ∀ i j, i < j → a ≤ p i - p j)
125    (hε : ε ≤ a / 4)
126    (hmargin : 4 * ((d : ℝ) * ((γ + 1) / 2)) ≤ (γ - 1) * (n : ℝ) * a)
127    (hm : (m : ℝ) = γ * (n : ℝ)) (P Q : PMF (Fin (d + 1) → ℤ)) :
128    |CountableScheffe.affinity (probability (P.bind (fallbackKernel γ n m))) (probability Q) -
129      CountableScheffe.affinity (probability (P.bind (rawKernel γ m))) (probability Q)| ≤
130        Real.sqrt (2 * badMass P (Typical n p ε)) := by
131  apply bind_fallback_affinity_bound
132  exact fallbackKernel_eq_raw_of_typical hd n m p γ ε a hn hγ ha hp hgap hε hmargin hm
133 
134/-- The manuscript's compact-spectrum, eventual fallback bound.  Every
135quantifier over spectra, input laws and target laws follows the same eventual
136sample threshold.  The kernel equality is derived, not assumed. -/
137theorem eventually_fallback_error_bounds {d : ℕ} (hd : 1 ≤ d)
138    (K : Set (Fin (d + 1) → ℝ)) (hK : IsCompact K)
139    (hpos : ∀ p ∈ K, ∀ i, 0 < p i) (hanti : ∀ p ∈ K, StrictAnti p)
140    (m : ℕ → ℤ) (γn ε : ℕ → ℝ) (γ : ℝ) (hγ : 1 < γ)
141    (hγn : Tendsto γn atTop (𝓝 γ)) (hε : Tendsto ε atTop (𝓝 0))
142    (hm : ∀ n, (m n : ℝ) = γn n * (n : ℝ)) :
143    ∀ᶠ (n : ℕ) in atTop, ∀ p ∈ K, ∀ P Q : PMF (Fin (d + 1) → ℤ),
144      CountableScheffe.l1Distance
145        (probability (P.bind (fallbackKernel (γn n) n (m n))))
146        (probability (P.bind (rawKernel (γn n) (m n)))) ≤
147          2 * badMass P (Typical n p (ε n)) ∧
148      |CountableScheffe.affinity (probability (P.bind (fallbackKernel (γn n) n (m n)))) (probability Q) -
149        CountableScheffe.affinity (probability (P.bind (rawKernel (γn n) (m n)))) (probability Q)| ≤
150          Real.sqrt (2 * badMass P (Typical n p (ε n))) := by
151  obtain ⟨a, ha, hp, hgap⟩ := compact_spectra_positive_gap K hK hpos hanti
152  filter_upwards [eventually_rounding_support_compatible hd m γn ε γ a ha hγ hγn hε hm]
153    with n hn
154  intro p hpk P Q
155  have hsame (μ : Fin (d + 1) → ℤ) (hμ : Typical n p (ε n) μ) :
156      fallbackKernel (γn n) n (m n) μ = rawKernel (γn n) (m n) μ := by
157    apply fallbackKernel_eq_raw_of_support
158    exact hn p (hp p hpk) (hgap p hpk) μ hμ.1.2.2 hμ.2
159  exact ⟨bind_fallback_l1_bound P _ _ _ hsame,
160    bind_fallback_affinity_bound P _ _ _ hsame Q⟩
161 
162/-- For any sequence of spectra in a compact interior set, concentration is
163now the only missing premise for asymptotic invisibility of fallback.  Both
164laws and every output target may vary with sample size. -/
165theorem fallback_errors_tendsto_zero {d : ℕ} (hd : 1 ≤ d)
166    (K : Set (Fin (d + 1) → ℝ)) (hK : IsCompact K)
167    (hpos : ∀ p ∈ K, ∀ i, 0 < p i) (hanti : ∀ p ∈ K, StrictAnti p)
168    (m : ℕ → ℤ) (γn ε : ℕ → ℝ) (γ : ℝ) (hγ : 1 < γ)
169    (hγn : Tendsto γn atTop (𝓝 γ)) (hε : Tendsto ε atTop (𝓝 0))
170    (hm : ∀ n, (m n : ℝ) = γn n * (n : ℝ))
171    (p : ℕ → Fin (d + 1) → ℝ) (hp : ∀ n, p n ∈ K)
172    (P Q : ℕ → PMF (Fin (d + 1) → ℤ))
173    (hbad : Tendsto (fun n ↦ badMass (P n) (Typical n (p n) (ε n))) atTop (𝓝 0)) :
174    Tendsto (fun n ↦ CountableScheffe.l1Distance
175      (probability ((P n).bind (fallbackKernel (γn n) n (m n))))
176      (probability ((P n).bind (rawKernel (γn n) (m n))))) atTop (𝓝 0) ∧
177    Tendsto (fun n ↦ |CountableScheffe.affinity
178      (probability ((P n).bind (fallbackKernel (γn n) n (m n)))) (probability (Q n)) -
179      CountableScheffe.affinity (probability ((P n).bind (rawKernel (γn n) (m n))))
180        (probability (Q n))|) atTop (𝓝 0) := by
181  have hb := eventually_fallback_error_bounds hd K hK hpos hanti m γn ε γ hγ hγn hε hm
182  have hbad2 : Tendsto (fun n ↦ 2 * badMass (P n) (Typical n (p n) (ε n))) atTop (𝓝 0) := by
183    simpa only [mul_zero] using hbad.const_mul 2
184  constructor
185  · apply squeeze_zero' (Eventually.of_forall (fun n ↦ tsum_nonneg (fun _ ↦ abs_nonneg _)))
186    · exact hb.mono fun n hn ↦ (hn (p n) (hp n) (P n) (Q n)).1
187    · exact hbad2
188  · apply squeeze_zero' (Eventually.of_forall (fun n ↦ abs_nonneg _))
189    · exact hb.mono fun n hn ↦ (hn (p n) (hp n) (P n) (Q n)).2
190    · simpa only [Real.sqrt_zero] using hbad2.sqrt
191 
192end Cloning.YoungCompatibility