Offline · exact source
Exact Lean source

YoungTwoRowAsymptotics

formalization/Cloning/YoungTwoRowAsymptotics.lean

Source hash: b0c63d4988a46b2f44dc39fd133d1f59e0b4160bc92e6044b6f39c09a8888ac7

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.YoungTwoRowMoment
2import Cloning.YoungDimensionSecondOrder
3 
4/-!
5# Forward Weyl-product moment for the concrete two-row Young law
6 
7A global finite-product remainder bound replaces the small-factor hypothesis
8in the local Taylor estimate. Normalized factors are uniformly bounded because
9the actual row lengths lie between zero and the number of boxes. The proved
10second moment of the concrete two-row law therefore yields the forward
11dimension-ratio expectation with error `O(1/N)`, without a concentration or
12moment premise. Representation-space dimension identification remains separate.
13-/
14 
15noncomputable section
16open scoped BigOperators Topology
17open Filter
18 
19namespace Cloning.YoungTwoRow
20open YoungDimensionRatio
21 
22/-- A second-order finite-product bound with uniformly bounded factors.
23The errors themselves need not tend to zero uniformly. -/
24theorem bounded_product_quadratic_remainder {ι : Type*} (S : Finset ι)
25    (x : ι → ℝ) (B : ℝ) (hB : 1 ≤ B) (hx : ∀ i ∈ S, |1 + x i| ≤ B) :
26    |(∏ i ∈ S, (1 + x i)) - 1 - ∑ i ∈ S, x i| ≤
27      B ^ S.card * (∑ i ∈ S, |x i|) ^ 2 := by
28  classical
29  induction S using Finset.induction_on with
30  | empty => simp
31  | @insert a S ha ih =>
32    have hxa := hx a (Finset.mem_insert_self a S)
33    have hrest := ih (fun i hi => hx i (Finset.mem_insert_of_mem hi))
34    have hsum : |∑ i ∈ S, x i| ≤ ∑ i ∈ S, |x i| := Finset.abs_sum_le_sum_abs _ _
35    have hsum0 : 0 ≤ ∑ i ∈ S, |x i| := Finset.sum_nonneg (fun _ _ => abs_nonneg _)
36    have hcoef : 1 ≤ B ^ S.card * B := by
37      exact one_le_mul_of_one_le_of_one_le (one_le_pow₀ hB) hB
38    simp only [Finset.prod_insert ha, Finset.sum_insert ha, Finset.card_insert_of_notMem ha,
39      pow_succ]
40    have halg : (1 + x a) * (∏ i ∈ S, (1 + x i)) - 1 - (x a + ∑ i ∈ S, x i) =
41        (1 + x a) * ((∏ i ∈ S, (1 + x i)) - 1 - ∑ i ∈ S, x i) +
42          x a * (∑ i ∈ S, x i) := by ring
43    rw [halg]
44    calc
45      _ ≤ |1 + x a| * |(∏ i ∈ S, (1 + x i)) - 1 - ∑ i ∈ S, x i| +
46          |x a| * |∑ i ∈ S, x i| := by
47        simpa only [abs_mul] using abs_add_le
48          ((1 + x a) * ((∏ i ∈ S, (1 + x i)) - 1 - ∑ i ∈ S, x i))
49          (x a * (∑ i ∈ S, x i))
50      _ ≤ B * (B ^ S.card * (∑ i ∈ S, |x i|) ^ 2) +
51          |x a| * (∑ i ∈ S, |x i|) :=
52        add_le_add (mul_le_mul hxa hrest (abs_nonneg _) (le_trans zero_le_one hB))
53          (mul_le_mul_of_nonneg_left hsum (abs_nonneg _))
54      _ ≤ _ := by
55        have hcross := mul_nonneg (show 0 ≤ 2 * (B ^ S.card * B) - 1 by linarith)
56          (mul_nonneg (abs_nonneg (x a)) hsum0)
57        have hsquare := mul_nonneg (le_trans zero_le_one hcoef) (sq_nonneg |x a|)
58        nlinarith
59 
60theorem bounded_product_error {ι : Type*} (S : Finset ι)
61    (x : ι → ℝ) (B : ℝ) (hB : 1 ≤ B) (hx : ∀ i ∈ S, |1 + x i| ≤ B) :
62    |(∏ i ∈ S, (1 + x i)) - 1| ≤
63      |∑ i ∈ S, x i| + (B ^ S.card * S.card) * (∑ i ∈ S, (x i) ^ 2) := by
64  have hrem := bounded_product_quadratic_remainder S x B hB hx
65  have hcs := Finset.sum_mul_sq_le_sq_mul_sq S (fun i => |x i|) (fun _ => (1 : ℝ))
66  simp only [mul_one, one_pow, Finset.sum_const, nsmul_eq_mul, mul_one, sq_abs] at hcs
67  have hsplit : (∏ i ∈ S, (1 + x i)) - 1 =
68      ((∏ i ∈ S, (1 + x i)) - 1 - ∑ i ∈ S, x i) + ∑ i ∈ S, x i := by ring
69  rw [hsplit]
70  calc
71    _ ≤ |(∏ i ∈ S, (1 + x i)) - 1 - ∑ i ∈ S, x i| + |∑ i ∈ S, x i| := abs_add_le _ _
72    _ ≤ B ^ S.card * (∑ i ∈ S, |x i|) ^ 2 + |∑ i ∈ S, x i| := add_le_add hrem le_rfl
73    _ ≤ B ^ S.card * ((∑ i ∈ S, (x i) ^ 2) * S.card) + |∑ i ∈ S, x i| :=
74      add_le_add (mul_le_mul_of_nonneg_left hcs (pow_nonneg (le_trans zero_le_one hB) _)) le_rfl
75    _ = _ := by ring
76 
77/-- The actual two integer row lengths viewed as a real row vector. -/
78def rowVector (N : ℕ) (p : Path N) (i : Fin 2) : ℝ :=
79  if i.val = 0 then upperRow N p else lowerRow N p
80 
81theorem rowVector_sum (N : ℕ) (p : Path N) : (∑ i, rowVector N p i) = N := by
82  simpa [rowVector, Fin.sum_univ_two] using congrArg (fun n : ℕ => (n : ℝ)) (row_sum N p)
83 
84theorem rowVector_bounds (N : ℕ) (p : Path N) (i : Fin 2) :
85    0 ≤ rowVector N p i ∧ rowVector N p i ≤ N := by
86  have h := row_sum N p
87  have ht : upperRow N p ≤ N := by omega
88  have hb : lowerRow N p ≤ N := by omega
89  dsimp [rowVector]
90  split_ifs
91  · exact ⟨Nat.cast_nonneg _, by exact_mod_cast ht⟩
92  · exact ⟨Nat.cast_nonneg _, by exact_mod_cast hb⟩
93 
94theorem rowVector_variance (N : ℕ) (p : Path N) :
95    (∑ i, (rowVector N p i - (N : ℝ) / 2) ^ 2) = rowVariance N p := by
96  simp [rowVector, rowVariance, Fin.sum_univ_two]
97 
98/-- A global bound on normalized crossing factors for every actual row shape. -/
99theorem row_factor_bound (k N : ℕ) (hN : 1 ≤ N) (p : Path N)
100    (a : Fin 2 × Fin k) :
101    |2 * (rowVector N p a.1 + crossingGap a) / N| ≤ 2 + 2 * (2 + (k : ℝ)) := by
102  have hN1 : (1 : ℝ) ≤ N := by exact_mod_cast hN
103  have hN0 : (0 : ℝ) < N := lt_of_lt_of_le zero_lt_one hN1
104  have hrow := rowVector_bounds N p a.1
105  have hgap := crossingGap_le a
106  have hgap0 := (crossingGap_pos a).le
107  have hk : 0 ≤ (k : ℝ) := Nat.cast_nonneg _
108  rw [abs_of_nonneg (div_nonneg (mul_nonneg (by norm_num) (add_nonneg hrow.1 hgap0)) hN0.le)]
109  apply (div_le_iff₀ hN0).mpr
110  norm_num only [Nat.cast_ofNat] at hgap
111  nlinarith [mul_nonneg (show 0 ≤ 2 + (k : ℝ) by linarith) (sub_nonneg.mpr hN1)]
112 
113/-- The Taylor bound is global over this concrete law; no typical set is needed. -/
114theorem dimensionRatio_global_error (k N : ℕ) (hN : 1 ≤ N) (p : Path N) :
115    |dimensionRatio 2 k (rowVector N p) /
116      (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1| ≤
117      2 * (2 * k : ℕ) * (2 + (k : ℝ)) / N +
118        ((2 + 2 * (2 + (k : ℝ))) ^ (2 * k) * (2 * k : ℕ)) *
119          (8 / (N : ℝ) ^ 2 * ((k : ℝ) * rowVariance N p +
120            (2 * k : ℕ) * (2 + (k : ℝ)) ^ 2)) := by
121  let x : Fin 2 × Fin k → ℝ :=
122    fun a => 2 * (rowVector N p a.1 + crossingGap a) / N - 1
123  have hN0 : (0 : ℝ) < N := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hN)
124  have hB : (1 : ℝ) ≤ 2 + 2 * (2 + (k : ℝ)) := by nlinarith [Nat.cast_nonneg (α := ℝ) k]
125  have hx1 (a : Fin 2 × Fin k) : 1 + x a =
126      2 * (rowVector N p a.1 + crossingGap a) / N := by dsimp [x]; ring
127  have hp := bounded_product_error Finset.univ x (2 + 2 * (2 + (k : ℝ))) hB
128    (fun a _ => by rw [hx1]; exact row_factor_bound k N hN p a)
129  simp only [Finset.card_univ, Fintype.card_prod, Fintype.card_fin, hx1] at hp
130  have hden : leadingConstant 2 k * (N : ℝ) ^ (2 * k) ≠ 0 :=
131    (mul_pos (leadingConstant_pos 2 k (by decide)) (pow_pos hN0 _)).ne'
132  rw [dimensionRatio_factorization 2 k (rowVector N p) N (by decide) hN0,
133    mul_div_cancel_left₀ _ hden]
134  have hlin := crossing_error_sum_bound 2 k (rowVector N p) N (by decide) hN0
135    (rowVector_sum N p)
136  have hquad := crossing_error_square_sum_bound 2 k (rowVector N p) N (by decide) hN0
137  norm_num only [Nat.cast_ofNat] at hlin hquad ⊢
138  rw [rowVector_variance] at hquad
139  have h := hp.trans (add_le_add hlin (mul_le_mul_of_nonneg_left hquad
140    (mul_nonneg (pow_nonneg (by positivity) _) (Nat.cast_nonneg _))))
141  norm_num only [Nat.reducePow, mul_one, Nat.cast_ofNat] at h
142  convert h using 1
143 
144/-- An explicit error constant depending only on the ambient codimension. -/
145def dimensionMomentConstant (k : ℕ) : ℝ :=
146  2 * (2 * k : ℕ) * (2 + (k : ℝ)) +
147    ((2 + 2 * (2 + (k : ℝ))) ^ (2 * k) * (2 * k : ℕ)) * 8 *
148      (3 * (k : ℝ) / 2 + (2 * k : ℕ) * (2 + (k : ℝ)) ^ 2)
149 
150theorem dimensionMomentConstant_nonneg (k : ℕ) : 0 ≤ dimensionMomentConstant k := by
151  unfold dimensionMomentConstant
152  positivity
153 
154/-- The whole concrete law, including its extreme shapes, satisfies a
155mean absolute relative-error estimate of order `1/N`. -/
156theorem mean_absolute_dimensionRatio_error (k N : ℕ) (hN : 1 ≤ N) :
157    (∑ p : Path N, weight N p * |dimensionRatio 2 k (rowVector N p) /
158      (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1|) ≤
159      dimensionMomentConstant k / N := by
160  let L : ℝ := 2 * (2 * k : ℕ) * (2 + (k : ℝ))
161  let Q : ℝ := (2 + 2 * (2 + (k : ℝ))) ^ (2 * k) * (2 * k : ℕ)
162  let D : ℝ := (2 * k : ℕ) * (2 + (k : ℝ)) ^ 2
163  have hQ : 0 ≤ Q := by dsimp [Q]; positivity
164  have hD : 0 ≤ D := by dsimp [D]; positivity
165  have hN1 : (1 : ℝ) ≤ N := by exact_mod_cast hN
166  have hN0 : (0 : ℝ) < N := lt_of_lt_of_le zero_lt_one hN1
167  have hquad : 0 ≤ Q * 8 / (N : ℝ) ^ 2 * k := by positivity
168  have hmean :
169      (∑ p : Path N, weight N p *
170        (L / N + Q * (8 / (N : ℝ) ^ 2 * ((k : ℝ) * rowVariance N p + D)))) ≤
171      L / N + Q * 8 / (N : ℝ) ^ 2 * D +
172        (Q * 8 / (N : ℝ) ^ 2 * k) * (3 * (N : ℝ) / 2) := by
173    calc
174      _ = (L / N + Q * 8 / (N : ℝ) ^ 2 * D) * (∑ p : Path N, weight N p) +
175          (Q * 8 / (N : ℝ) ^ 2 * k) * (∑ p : Path N, weight N p * rowVariance N p) := by
176        rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib]
177        apply Finset.sum_congr rfl
178        intro p hp
179        ring
180      _ ≤ _ := by
181        rw [weight_sum, mul_one]
182        exact add_le_add le_rfl (mul_le_mul_of_nonneg_left (centered_second_moment_le N) hquad)
183  have hinv : 1 / (N : ℝ) ^ 2 ≤ 1 / (N : ℝ) :=
184    one_div_le_one_div_of_le hN0 (by nlinarith)
185  have htail : Q * 8 * D / (N : ℝ) ^ 2 ≤ Q * 8 * D / N := by
186    simpa only [mul_one_div] using
187      mul_le_mul_of_nonneg_left hinv (mul_nonneg (mul_nonneg hQ (by norm_num)) hD)
188  calc
189    _ ≤ ∑ p : Path N, weight N p *
190        (L / N + Q * (8 / (N : ℝ) ^ 2 * ((k : ℝ) * rowVariance N p + D))) :=
191      Finset.sum_le_sum (fun p _ => mul_le_mul_of_nonneg_left
192        (dimensionRatio_global_error k N hN p) (weight_nonneg N p))
193    _ ≤ L / N + Q * 8 / (N : ℝ) ^ 2 * D +
194        (Q * 8 / (N : ℝ) ^ 2 * k) * (3 * (N : ℝ) / 2) := hmean
195    _ = (L + Q * 8 * (3 * (k : ℝ) / 2)) / N + Q * 8 * D / (N : ℝ) ^ 2 := by
196      field_simp
197      ring
198    _ ≤ (L + Q * 8 * (3 * (k : ℝ) / 2)) / N + Q * 8 * D / N :=
199      add_le_add le_rfl htail
200    _ = dimensionMomentConstant k / N := by unfold dimensionMomentConstant; dsimp [L, Q, D]; ring
201 
202/-- The actual expected crossing-root dimension ratio of the two-row law. -/
203def meanDimensionRatio (k N : ℕ) : ℝ :=
204  ∑ p : Path N, weight N p * dimensionRatio 2 k (rowVector N p)
205 
206/-- The manuscript's forward dimension-ratio moment, with an explicit constant
207and with the law and its second moment already proved rather than assumed. -/
208theorem meanDimensionRatio_relative_error (k N : ℕ) (hN : 1 ≤ N) :
209    |meanDimensionRatio k N /
210      (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1| ≤
211      dimensionMomentConstant k / N := by
212  have heq : meanDimensionRatio k N /
213      (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1 =
214      ∑ p : Path N, weight N p * (dimensionRatio 2 k (rowVector N p) /
215        (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1) := by
216    simp only [mul_sub, Finset.sum_sub_distrib, mul_one, weight_sum,
217      div_eq_mul_inv, ← mul_assoc, ← Finset.sum_mul, meanDimensionRatio]
218  rw [heq]
219  calc
220    _ ≤ ∑ p : Path N, |weight N p * (dimensionRatio 2 k (rowVector N p) /
221        (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1)| := Finset.abs_sum_le_sum_abs _ _
222    _ = ∑ p : Path N, weight N p * |dimensionRatio 2 k (rowVector N p) /
223        (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1| := by
224      apply Finset.sum_congr rfl
225      intro p hp
226      rw [abs_mul, abs_of_nonneg (weight_nonneg N p)]
227    _ ≤ _ := mean_absolute_dimensionRatio_error k N hN
228 
229/-- The integer two-row shape reconstructed from its size and row gap. -/
230def shapeRowVector (N s : ℕ) (i : Fin 2) : ℝ :=
231  if i.val = 0 then ((N + s) / 2 : ℕ) else ((N - s) / 2 : ℕ)
232 
233theorem rowVector_eq_shapeRowVector (N : ℕ) (p : Path N) (hp : legal N p) :
234    rowVector N p = shapeRowVector N (spin N p) := by
235  funext i
236  simp only [rowVector, shapeRowVector, upperRow_eq_of_legal N p hp,
237    lowerRow_eq_of_legal N p hp]
238 
239/-- The path expectation is exactly the expectation under the explicit shape
240law `(gap+1) * tableauPathCount / 2^N`. -/
241theorem meanDimensionRatio_eq_shape_sum (k N : ℕ) :
242    meanDimensionRatio k N = ∑ s : Fin (N + 1), shapeProbability N s *
243      dimensionRatio 2 k (shapeRowVector N s) := by
244  rw [shape_expectation N (fun s => dimensionRatio 2 k (shapeRowVector N s))]
245  apply Finset.sum_congr rfl
246  intro p hp
247  by_cases hl : legal N p
248  · rw [rowVector_eq_shapeRowVector N p hl]
249  · rw [weight_eq_zero_of_not_legal N p hl]
250    simp
251 
252/-- The forward moment bound expressed directly for the concrete shape law. -/
253theorem shape_dimensionRatio_relative_error (k N : ℕ) (hN : 1 ≤ N) :
254    |(∑ s : Fin (N + 1), shapeProbability N s * dimensionRatio 2 k (shapeRowVector N s)) /
255      (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1| ≤ dimensionMomentConstant k / N := by
256  rw [← meanDimensionRatio_eq_shape_sum]
257  exact meanDimensionRatio_relative_error k N hN
258 
259/-- The explicit `O(1/N)` rate for the actual forward dimension-ratio moment. -/
260theorem meanDimensionRatio_relative_isBigO (k : ℕ) :
261    Asymptotics.IsBigO atTop
262      (fun N : ℕ => meanDimensionRatio k N /
263        (leadingConstant 2 k * (N : ℝ) ^ (2 * k)) - 1)
264      (fun N : ℕ => 1 / (N : ℝ)) := by
265  apply Asymptotics.IsBigO.of_bound (dimensionMomentConstant k)
266  filter_upwards [eventually_ge_atTop 1] with N hN
267  have h := meanDimensionRatio_relative_error k N hN
268  have hn : (0 : ℝ) ≤ 1 / (N : ℝ) := by positivity
269  simpa only [Real.norm_eq_abs, abs_of_nonneg hn,
270    mul_one_div] using h
271 
272end Cloning.YoungTwoRow