Offline · exact source
Exact Lean source

YoungDimensionMomentRateAlgebra

formalization/Cloning/YoungDimensionMomentRateAlgebra.lean

Source hash: c375d827e5e5e98e70c75562f7b70dd55ce7d62c3d0b971b957f8e47ae37f6ec

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.YoungDimensionSecondOrder
2import Cloning.YoungGeneralMoments
3 
4/-! Global second-order dimension control on the actual finite label space. -/
5noncomputable section
6open scoped BigOperators Classical
7namespace Cloning.YoungDimensionRatio
8set_option maxHeartbeats 1200000
9 
10/-- A bounded finite product has a quadratic remainder, with a bound that
11allows every finite physical label rather than just a central window. -/
12theorem product_quadratic_remainder_bounded {ι : Type*} (S : Finset ι)
13    (x : ι → ℝ) (C : ℝ) (hC : 1≤C) (hx : ∀i∈S,|1+x i|≤C) :
14    |(∏i∈S,(1+x i))-1-∑i∈S,x i| ≤ C^S.card*(∑i∈S,|x i|)^2 := by
15  induction S using Finset.induction_on with
16  | empty => simp
17  | @insert a S ha ih =>
18    have hi := ih (fun i hi=>hx i (Finset.mem_insert_of_mem hi))
19    have hxa := hx a (Finset.mem_insert_self a S)
20    have hs := Finset.abs_sum_le_sum_abs (s := S) (f := x)
21    have hs0 : 0≤∑i∈S,|x i| := Finset.sum_nonneg (fun _ _=>abs_nonneg _)
22    have hp : 1≤C^S.card := one_le_pow₀ hC
23    have hC0 : 0≤C := zero_le_one.trans hC
24    have hp0 : 0≤C^S.card := zero_le_one.trans hp
25    simp only [Finset.prod_insert ha,Finset.sum_insert ha,Finset.card_insert_of_notMem ha,pow_succ]
26    have he : (1+x a)*(∏i∈S,(1+x i))-1-(x a+∑i∈S,x i)=
27        (1+x a)*((∏i∈S,(1+x i))-1-∑i∈S,x i)+x a*(∑i∈S,x i) := by ring
28    rw [he]
29    calc
30      _ ≤ |1+x a| *|(∏i∈S,(1+x i))-1-∑i∈S,x i|+|x a| *|∑i∈S,x i| := by
31        simpa only [abs_mul] using abs_add_le
32          ((1+x a)*((∏i∈S,(1+x i))-1-∑i∈S,x i)) (x a*(∑i∈S,x i))
33      _ ≤ C*(C^S.card*(∑i∈S,|x i|)^2)+|x a| *(∑i∈S,|x i|) :=
34        add_le_add (mul_le_mul hxa hi (abs_nonneg _) hC0)
35          (mul_le_mul_of_nonneg_left hs (abs_nonneg _))
36      _ ≤ _ := by
37        have hCP : 1≤C^S.card*C := one_le_mul_of_one_le_of_one_le hp hC
38        have hcross := mul_nonneg (show 0≤2*(C^S.card*C)-1 by linarith)
39          (mul_nonneg (abs_nonneg (x a)) hs0)
40        have hsquare := mul_nonneg (mul_nonneg hp0 hC0) (sq_nonneg |x a|)
41        nlinarith
42 
43theorem product_error_le_bounded_square_sum {ι : Type*} (S : Finset ι)
44    (x : ι → ℝ) (C : ℝ) (hC : 1≤C) (hx : ∀i∈S,|1+x i|≤C) :
45    |(∏i∈S,(1+x i))-1| ≤ |∑i∈S,x i|+
46      (C^S.card*S.card)*(∑i∈S,(x i)^2) := by
47  have hr := product_quadratic_remainder_bounded S x C hC hx
48  have hcs := Finset.sum_mul_sq_le_sq_mul_sq S (fun i=>|x i|) (fun _=>(1:ℝ))
49  simp only [mul_one,one_pow,Finset.sum_const,nsmul_eq_mul,mul_one,sq_abs] at hcs
50  have hsplit : (∏i∈S,(1+x i))-1=((∏i∈S,(1+x i))-1-∑i∈S,x i)+(∑i∈S,x i) := by ring
51  rw [hsplit]
52  calc
53    _ ≤ |(∏i∈S,(1+x i))-1-∑i∈S,x i|+|∑i∈S,x i| := abs_add_le _ _
54    _ ≤ C^S.card*(∑i∈S,|x i|)^2+|∑i∈S,x i| := add_le_add hr le_rfl
55    _ ≤ C^S.card*((∑i∈S,(x i)^2)*S.card)+|∑i∈S,x i| :=
56      add_le_add (mul_le_mul_of_nonneg_left hcs (pow_nonneg (zero_le_one.trans hC) _)) le_rfl
57    _ = _ := by ring
58 
59private theorem bounded_second_order_envelope_le (A B C V N : ℝ)
60    (hA : 0≤A) (hB : 0≤B) (hC : 0≤C) (hV : 0≤V) (hN : 1≤N) :
61    A/N+B*V/N^2+C/N^2≤(A+B+C)*(1/N+V/N^2) := by
62  have hn : 0<N := zero_lt_one.trans_le hN
63  have hNN : N≤N^2 := by nlinarith
64  have hi : 1/N^2≤1/N := one_div_le_one_div_of_le hn hNN
65  have hCd : C/N^2≤C/N := by
66    simpa only [mul_one_div] using mul_le_mul_of_nonneg_left hi hC
67  calc
68    _ ≤ A/N+B*V/N^2+C/N := add_le_add le_rfl hCd
69    _ = (A+C)*(1/N)+B*(V/N^2) := by ring
70    _ ≤ (A+B+C)*(1/N)+(A+B+C)*(V/N^2) :=
71      add_le_add (mul_le_mul_of_nonneg_right (by linarith) (one_div_nonneg.mpr hn.le))
72        (mul_le_mul_of_nonneg_right (by linarith) (div_nonneg hV (sq_nonneg _)))
73    _ = _ := by ring
74 
75def globalSecondOrderConstant (r k : ℕ) : ℝ :=
76  (r:ℝ)*(r*k:ℕ)*((r:ℝ)+k) +
77    ((1+(r:ℝ)*(1+r+k))^(r*k)*(r*k:ℕ))*2*(r:ℝ)^2*
78      ((k:ℝ)+(r*k:ℕ)*((r:ℝ)+k)^2)
79 
80theorem globalSecondOrderConstant_nonneg (r k : ℕ) :
81    0≤globalSecondOrderConstant r k := by unfold globalSecondOrderConstant; positivity
82 
83/-- Actual finite labels admit a global second-order bound. The only
84structural hypothesis is their exact box count. -/
85theorem normalizedDimension_global_second_order (r k N : ℕ) (hr : 0<r) (hN : 1≤N)
86    (mu : Cloning.YoungGeneral.Shape r N) (hsum : ∑i,(mu i).val=N) :
87    |Cloning.YoungGeneral.normalizedDimension r k N mu-1| ≤
88      globalSecondOrderConstant r k*(1/(N:ℝ)+
89        (∑i,((mu i).val-(N:ℝ)/r)^2)/(N:ℝ)^2) := by
90  open Cloning.YoungGeneral in
91  have hrow : ∑i,shapeRows mu i=(N:ℝ) := by
92    dsimp only [shapeRows]
93    exact_mod_cast hsum
94  have hn : (0:ℝ)<N := by exact_mod_cast (show 0<N by omega)
95  have hn1 : (1:ℝ)≤N := by exact_mod_cast hN
96  let row := Cloning.YoungGeneral.shapeRows mu
97  let C : ℝ := 1+(r:ℝ)*(1+r+k)
98  let x : Fin r×Fin k→ℝ := fun a=>(r:ℝ)*(row a.1+crossingGap a)/N-1
99  have hC : 1≤C := by
100    dsimp [C]
101    have hp : 0≤(r:ℝ)*(1+r+k) := by positivity
102    linarith
103  have hx1 (a : Fin r×Fin k) : 1+x a=(r:ℝ)*(row a.1+crossingGap a)/N := by dsimp [x]; ring
104  have hx : ∀a∈Finset.univ,|1+x a|≤C := by
105    intro a _
106    have hpos : 0≤(r:ℝ)*(row a.1+crossingGap a)/N := by
107      have h1 : 0≤row a.1 := Cloning.YoungGeneral.shapeRows_nonneg mu a.1
108      have h2 := (crossingGap_pos a).le
109      positivity
110    rw [hx1,abs_of_nonneg hpos]
111    have hlo := Cloning.YoungGeneral.shapeRows_le mu a.1
112    have hgap := crossingGap_le a
113    have hgapN := mul_le_mul_of_nonneg_left hn1
114      (show (0:ℝ)≤r+k by positivity)
115    apply (div_le_iff₀ hn).mpr
116    dsimp only [C,row]
117    have hinside : Cloning.YoungGeneral.shapeRows mu a.1+crossingGap a≤(1+(r:ℝ)+k)*N := by nlinarith
118    nlinarith [mul_le_mul_of_nonneg_left hinside (Nat.cast_nonneg r)]
119  have hp := product_error_le_bounded_square_sum Finset.univ x C hC hx
120  simp only [Finset.card_univ,Fintype.card_prod,Fintype.card_fin,hx1] at hp
121  have hden : leadingConstant r k*(N:ℝ)^(r*k)≠0 :=
122    (mul_pos (leadingConstant_pos r k hr) (pow_pos hn _)).ne'
123  unfold Cloning.YoungGeneral.normalizedDimension
124  rw [dimensionRatio_factorization r k _ N hr hn,mul_div_cancel_left₀ _ hden]
125  have he := hp.trans (add_le_add (crossing_error_sum_bound r k row N hr hn hrow)
126    (mul_le_mul_of_nonneg_left (crossing_error_square_sum_bound r k row N hr hn)
127      (mul_nonneg (pow_nonneg (zero_le_one.trans hC) _) (Nat.cast_nonneg _))))
128  have henv := bounded_second_order_envelope_le
129    ((r:ℝ)*(r*k:ℕ)*((r:ℝ)+k))
130    ((C^(r*k)*(r*k:ℕ))*2*(r:ℝ)^2*k)
131    ((C^(r*k)*(r*k:ℕ))*2*(r:ℝ)^2*(r*k:ℕ)*((r:ℝ)+k)^2)
132    (∑i,(row i-(N:ℝ)/r)^2) N
133    (by positivity) (by positivity) (by positivity)
134    (Finset.sum_nonneg (fun _ _=>sq_nonneg _)) hn1
135  apply he.trans
136  calc
137    _ = (r:ℝ)*(r*k:ℕ)*((r:ℝ)+k)/(N:ℝ)+
138        ((C^(r*k)*(r*k:ℕ))*2*(r:ℝ)^2*k)*(∑i,(row i-(N:ℝ)/r)^2)/(N:ℝ)^2+
139        ((C^(r*k)*(r*k:ℕ))*2*(r:ℝ)^2*(r*k:ℕ)*((r:ℝ)+k)^2)/(N:ℝ)^2 := by ring
140    _ ≤ _ := henv
141    _ = _ := by dsimp only [globalSecondOrderConstant,C,row,Cloning.YoungGeneral.shapeRows]; ring
142 
143end Cloning.YoungDimensionRatio