This journal is in preparation. Submissions are open as a pilot and the editorial board is being formed. Articles marked Demonstration show the format only.
Journal of Machine-Verified MathematicsPeer-reviewed mathematics with machine-checked proofs, for the age of AI

E424/MacroRigidity/L27Aux3.lean

All files · 106 lines · source at the verified commit

1module
2
3public import E424.MacroRigidity.L27Aux
4
5@[expose] public section
6
7/-!
8# Section 6: pointwise identities for Lemma 27 (a) and (c)
9-/
10
11set_option linter.style.header false
12open Finset
13
14namespace E424
15
16/-- `Bad⁺(n) = #{s ∣ n : F n > F (n/s)}` is controlled by `r_S(n) 1_{3n ∈ E_3}` and the sum
17over `s ∣ n` of `1_{n/s ∈ G_3}`. -/
18theorem badPlus_le (S : Finset ℕ) (hS : ∀ s ∈ S, s ∈ A ∧ s % 9 ≠ 0) (n : ℕ) (hn : 1 ≤ n) :
19 ∑ s ∈ S with s ∣ n, ind (F n > F (n / s)) ≤
20 rc S n * ind (3 * n ∈ Es 3) + ∑ s ∈ S with s ∣ n, ind (n / s ∈ G3) := by
21 rw [rc_eq_sum', Finset.sum_mul, ← sum_add_distrib]
22 refine sum_le_sum fun s hs => ?_
23 rw [mem_filter] at hs
24 obtain ⟨hsS, hsd⟩ := hs
25 obtain ⟨hsA, hs9⟩ := hS s hsS
26 have hz : 1 ≤ n / s := Nat.div_pos (Nat.le_of_dvd (by omega) hsd) (Nat.pos_of_dvd_of_pos hsd (by omega))
27 have hsn : s * (n / s) = n := Nat.mul_div_cancel' hsd
28 rw [one_mul]
29 refine (ind_mono (q := 3 * n ∈ Es 3 ∨ n / s ∈ G3) fun h => ?_).trans (ind_or_le _ _)
30 by_contra hcon
31 push Not at hcon
32 have := F_mul_le_of_not_bad hsA hs9 hz (by rw [hsn]; exact hcon.1) hcon.2
33 rw [hsn] at this
34 exact absurd h (not_lt.mpr this)
35
36/-- Pointwise form of the identity `|a - b| = (b - a) + 2 (a - b)⁺` for 0/1 values, summed over `s ∣ n`. -/
37theorem badCount_eq_id (S : Finset ℕ) (n : ℕ) :
38 badCount S n = (∑ s ∈ S with s ∣ n, F (n / s)) - F n * rc S n
39 + 2 * ∑ s ∈ S with s ∣ n, ind (F n > F (n / s)) := by
40 rw [rc_eq_sum', mul_sum, badCount, mul_sum, ← sum_sub_distrib, ← sum_add_distrib]
41 refine sum_congr rfl fun s _ => ?_
42 rcases f_eq_zero_or_one (3 * n) with h | h <;>
43 rcases f_eq_zero_or_one (3 * (n / s)) with h' | h' <;>
44 simp [F, h, h', ind] <;> norm_num
45
46/-- Error budget of Lemma 27: with `e0 = e a τ / (100 (B+1)(C+1))`, the Proposition D terms and the
47three small terms (each at most `q = a τ e / 10` after multiplying by `C`) sum to at most `m e / 2`. -/
48theorem L27_budget {B C e a τ m e0 q X1 X2 X3 : ℝ} (hB0 : 0 ≤ B) (hC : 0 < C) (he : 0 < e)
49 (ha0 : 0 < a) (ha1 : a ≤ 1) (hτ0 : 0 < τ) (hτ1 : τ ≤ 1 / 100) (hm : a * τ ≤ m)
50 (hmpos : 0 < m) (he0 : e0 = e * a * τ / (100 * (B + 1) * (C + 1))) (hq : q = a * τ * e / 10)
51 (t1 : C * X1 ≤ q) (t2 : C * X2 ≤ q) (t3 : C * X3 ≤ q) :
52 2 * (6 * B * e0 + m * e0) + C * (X1 + B * e0 + X2 + X3) ≤ m * e / 2 := by
53 have hBC := mul_nonneg hB0 hC.le
54 have hKexp : (B + 1) * (C + 1) = B * C + B + C + 1 := by ring
55 have hKpos : 0 < (B + 1) * (C + 1) := by rw [hKexp]; linarith
56 have hKge : 1 ≤ (B + 1) * (C + 1) := by rw [hKexp]; linarith
57 have hKk : (12 + C) * B ≤ 12 * ((B + 1) * (C + 1)) := by rw [hKexp]; nlinarith
58 have he0pos : 0 < e0 := by rw [he0]; positivity
59 have hK : e0 * (100 * ((B + 1) * (C + 1))) = e * a * τ := by
60 rw [he0]; field_simp
61 have hr1 : (12 + C) * B * e0 ≤ 12 / 100 * (e * a * τ) :=
62 calc (12 + C) * B * e0 ≤ 12 * ((B + 1) * (C + 1)) * e0 :=
63 mul_le_mul_of_nonneg_right hKk he0pos.le
64 _ = 12 / 100 * (e0 * (100 * ((B + 1) * (C + 1)))) := by ring
65 _ = _ := by rw [hK]
66 have haτ : a * τ ≤ 1 / 100 := by nlinarith
67 have hr2 : e0 ≤ e / 10000 := by
68 have h1 : e0 * 100 ≤ e0 * (100 * ((B + 1) * (C + 1))) := by nlinarith
69 rw [hK] at h1
70 nlinarith [mul_le_mul_of_nonneg_left haτ he.le]
71 have h3 : e * (a * τ) ≤ e * m := mul_le_mul_of_nonneg_left hm he.le
72 have e2 : m * e0 ≤ m * (e / 10000) := mul_le_mul_of_nonneg_left hr2 hmpos.le
73 have e3 : q = a * τ * e / 10 := hq
74 have e1 : C * (X1 + B * e0 + X2 + X3) = C * X1 + C * B * e0 + C * X2 + C * X3 := by ring
75 nlinarith
76
77/-- The edge term of `E_div_diff`: `4 c / lo' ≤ e / 2` for `c ≤ lo^0.01`, `lo' ≥ lo^0.5`, `lo^0.49 ≥ 8/e`. -/
78theorem L27_small {lo e c lo' : ℝ} (hlo : 1 ≤ lo) (he : 0 < e) (hc : c ≤ lo ^ (0.01 : ℝ))
79 (hlo' : lo ^ (0.5 : ℝ) ≤ lo') (hpos : 0 < lo') (h : 8 / e ≤ lo ^ (0.49 : ℝ)) :
80 4 * c / lo' ≤ e / 2 := by
81 have hlo0 : 0 < lo := by linarith
82 rw [div_le_iff₀ hpos]
83 have h8 : 8 ≤ lo ^ (0.49 : ℝ) * e := by
84 have := (div_le_iff₀ he).mp h; linarith
85 have h9 : lo ^ (0.5 : ℝ) = lo ^ (0.49 : ℝ) * lo ^ (0.01 : ℝ) := by
86 rw [← Real.rpow_add hlo0]; norm_num
87 have h10 : 0 ≤ lo ^ (0.01 : ℝ) := Real.rpow_nonneg hlo0.le _
88 have h11 := mul_le_mul_of_nonneg_left hlo' (by positivity : 0 ≤ e / 2)
89 have h12 := mul_le_mul_of_nonneg_right h8 h10
90 rw [h9] at h11
91 nlinarith
92
93/-- Final arithmetic of Lemma 27, abstracted over the window averages. -/
94theorem L27_final {m β ε ε' e t X Z Sig Efr err Bad Ebc : ℝ} (hm : 0 < m) (he : 0 < e) (hE : β - ε' ≤ X)
95 (hid : Ebc = Sig - Efr + 2 * Bad) (hrc : m * X - err ≤ Efr) (hSig1 : Sig ≤ m * (β + ε))
96 (hSig2 : Sig ≤ m * (Z + (t + e / 2))) (hbc0 : 0 ≤ Ebc) (hT : 2 * Bad + err ≤ m * e / 2) :
97 Ebc / m ≤ ε + ε' + e ∧ β - ε' - e - t ≤ Z := by
98 have h1 : m * (β - ε') ≤ m * X := mul_le_mul_of_nonneg_left hE hm.le
99 constructor
100 · rw [div_le_iff₀ hm]
101 nlinarith [mul_pos hm he]
102 · have : m * (β - ε' - e - t) ≤ m * Z := by nlinarith
103 exact le_of_mul_le_mul_left this hm
104
105end E424
106