Lean / Reader
Lean readerPrimeRaceZeroBudget.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports PrimeRace, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import PrimeRaceimport Mathlib.Analysis.PSeriesimport Mathlib.Analysis.Real.Pi.Boundsimport Mathlib.NumberTheory.Harmonic.EulerMascheroni/-! Zero budget for the cube-root-of-two race, using the sign of each Euler factor.At s = 2 only a prime with no cube root of two can contribute positively toF'/F. Such a prime is 1 modulo 6. The final theorem displays the analyticidentification of the weighted zero sum as a hypothesis. -/noncomputable sectionopen Filter Topologynamespace CubicPrimeRace/-- Grouped prime-power contribution to the *positive* logarithmic derivativeF'/F at 2. The three reciprocal Euler polynomials are 1+t+t², 1-t²,and (1-t)²; t = p⁻². The ramified primes have local factor one. -/def eulerTermAtTwo (n : ℕ) : ℝ :=if 3 < n ∧ n.Prime thenlet a := (n : ℝ)^2let l := Real.log nif rootCount n = 1 then -2*l/(a^2-1)else if rootCount n = 0 then l*(a+2)/(a^2+a+1)else -2*l/(a-1)else 0/-- Reciprocal local Euler polynomials of the standard representation, writtenas functions of t = p⁻ˢ. The number of fixed roots specifies the cycle type. -/def eulerDenominator (r : ℕ) : ℝ → ℝ :=if r = 1 then fun t => 1-t^2else if r = 0 then fun t => 1+t+t^2else fun t => (1-t)^2/-- The signed term agrees with log(p) t P'(t)/P(t) for the indicated localEuler polynomial P, evaluated at t = p⁻². -/theorem eulerTerm_eq_local_log_derivative {p : ℕ} (hp : 3 < p ∧ p.Prime) :let t : ℝ := 1/(p:ℝ)^2let P := eulerDenominator (rootCount p)eulerTermAtTwo p = Real.log p * t * deriv P t / P t := bylet a := (p:ℝ)^2let t : ℝ := 1/ahave hp' : (3:ℝ) < p := by exact_mod_cast hp.1have ha : 1 < a := by dsimp [a]; nlinarithhave ha0 : a ≠ 0 := by linarithhave ht : t < 1 := (div_lt_one (by linarith : 0 < a)).2 hahave ht0 : 0 < t := one_div_pos.mpr (by linarith)have ht2 : 1-t^2 ≠ 0 := by nlinarith [mul_pos ht0 (sub_pos.mpr ht)]have hplus : 1+t+t^2 ≠ 0 := by positivityhave hsub : 1-t ≠ 0 := by linarithhave hden₁ : a^2-1 ≠ 0 := by nlinarithhave hden₂ : a^2+a+1 ≠ 0 := by positivityhave hden₃ : a-1 ≠ 0 := by linarithchange eulerTermAtTwo p = Real.log p * t * deriv _ t / _rw [eulerTermAtTwo, if_pos hp]by_cases h : rootCount p = 1· have hd := ((hasDerivAt_const t (1:ℝ)).sub ((hasDerivAt_id t).pow 2)).derivsimp only [eulerDenominator, h, if_true]rw [show deriv (fun u : ℝ => 1-u^2) t = _ from hd]change -2*Real.log p/(a^2-1) = Real.log p*t*(0-2*t^(2-1)*1)/(1-t^2)field_simpall_goals dsimp [t]; field_simp; ring· by_cases h' : rootCount p = 0· have hd := (((hasDerivAt_const t (1:ℝ)).add (hasDerivAt_id t)).add((hasDerivAt_id t).pow 2)).derivsimp only [eulerDenominator, h', Nat.zero_ne_one, if_false, if_true]rw [show deriv (fun u : ℝ => 1+u+u^2) t = _ from hd]change Real.log p*(a+2)/(a^2+a+1) = Real.log p*t*(0+1+2*t^(2-1)*1)/(1+t+t^2)field_simpall_goals dsimp [t]; field_simp; ring· have hd := (((hasDerivAt_const t (1:ℝ)).sub (hasDerivAt_id t)).pow 2).derivsimp only [eulerDenominator, h, h', if_false]rw [show deriv (fun u : ℝ => (1-u)^2) t = _ from hd]change -2*Real.log p/(a-1) = Real.log p*t*(2*(1-t)^(2-1)*(0-1))/(1-t)^2field_simpall_goals dsimp [t]; field_simp; ringprivate theorem local_bounds {n : ℕ} (hn : 3 < n) :|eulerTermAtTwo n| ≤ 2 * Real.log n / ((n : ℝ)^2 - 1) ∧eulerTermAtTwo n ≤ Real.log n / ((n : ℝ)^2 - 1) := byhave hn' : (3 : ℝ) < n := by exact_mod_cast hnlet a := (n : ℝ)^2have ha : 1 < a := by dsimp [a]; nlinarithhave hden : 0 < a - 1 := by linarithhave hsq : 0 < a^2 - 1 := by nlinarithhave hplus : 0 < a^2 + a + 1 := by positivityhave hl : 0 ≤ Real.log n := Real.log_nonneg (by linarith)have h0 : 0 ≤ Real.log n / (a-1) := by positivityhave h1 : 2 * Real.log n / (a^2-1) ≤ 2 * Real.log n / (a-1) :=div_le_div_of_nonneg_left (by positivity) hden (by nlinarith)have h2 : Real.log n * (a+2) / (a^2+a+1) ≤ Real.log n / (a-1) := byrw [div_le_div_iff₀ hplus hden]nlinarithchange |eulerTermAtTwo n| ≤ 2 * Real.log n / (a-1) ∧eulerTermAtTwo n ≤ Real.log n / (a-1)simp only [eulerTermAtTwo, ← (show a = (n : ℝ)^2 from rfl)]split_ifs· constructor· rwa [show -2 * Real.log n / (a^2-1) = -(2*Real.log n / (a^2-1)) by ring,abs_neg, abs_of_nonneg (by positivity)]· exact le_trans (div_nonpos_of_nonpos_of_nonneg (by nlinarith) hsq.le) h0· rw [abs_of_nonneg (by positivity : 0 ≤ Real.log n * (a+2) / (a^2+a+1))]exact ⟨h2.trans (by rw [mul_div_assoc]; linarith), h2⟩· rw [show -2 * Real.log n / (a-1) = -(2*Real.log n / (a-1)) by ring,abs_neg, abs_of_nonneg (by positivity)]exact ⟨le_rfl, (neg_nonpos.mpr (by positivity)).trans h0⟩· simp only [abs_zero]exact ⟨by positivity, h0⟩private theorem nonpos_off_one {n : ℕ} (hc : n % 6 ≠ 1) : eulerTermAtTwo n ≤ 0 := byby_cases h : 3 < n ∧ n.Prime· have hodd := h.2.eq_two_or_oddhave hthree : ¬3 ∣ n := byintro hdrcases h.2.eq_one_or_self_of_dvd 3 hd with hh | hh <;> omegahave hmod : n % 3 = 2 := byrw [Nat.dvd_iff_mod_eq_zero] at hthreeomegarw [eulerTermAtTwo, if_pos h]simp only [rootCount_eq_one h.2 hmod, if_true]have hn : (3 : ℝ) < n := by exact_mod_cast h.1apply div_nonpos_of_nonpos_of_nonneg· exact mul_nonpos_of_nonpos_of_nonneg (by norm_num) (Real.log_nonneg (by linarith))· nlinarith [sq_nonneg (((n : ℝ)^2) - 1)]· simp [eulerTermAtTwo, h]private theorem log_le_sqrt {x : ℝ} (hx : 0 < x) : Real.log x ≤ Real.sqrt x := byhave hs := Real.sqrt_pos.2 hxhave h := Real.log_le_sub_one_of_pos (div_pos hs (Real.exp_pos 1))rw [Real.log_div hs.ne' (Real.exp_pos 1).ne', Real.log_exp, Real.log_sqrt hx.le] at hhave he : (2:ℝ) < Real.exp 1 := by linarith [Real.exp_one_gt_d9]have hr : Real.sqrt x / Real.exp 1 ≤ Real.sqrt x / 2 :=div_le_div_of_nonneg_left hs.le (by norm_num) he.lelinarith/-- For each block of six only its second entry can contribute positively. -/private theorem block_le {k : ℕ} (hk : 0 < k) :(∑ i ∈ Finset.range 6, eulerTermAtTwo (6*k+i)) ≤(1/12 : ℝ) / ((k : ℝ)*Real.sqrt k) := byhave hk' : (1:ℝ) ≤ k := by exact_mod_cast hkhave h := (local_bounds (n := 6*k+1) (by omega)).2push_cast at hhave hs : Real.sqrt (6*(k:ℝ)+1) ≤ 3 * Real.sqrt k := byapply (Real.sqrt_le_iff).2exact ⟨by positivity, by nlinarith [Real.sq_sqrt (by positivity : (0:ℝ) ≤ k)]⟩have hr : Real.log (6*(k:ℝ)+1) / ((6*(k:ℝ)+1)^2-1) ≤(1/12:ℝ) / ((k:ℝ) * Real.sqrt k) := bycalc_ ≤ (3 * Real.sqrt k) / (36*(k:ℝ)^2) := byapply div_le_div₀ (by positivity) ((log_le_sqrt (by positivity)).trans hs)(by positivity) (by nlinarith)_ = _ := byhave hs' := Real.sq_sqrt (by positivity : (0:ℝ) ≤ k)field_simpnlinarithhave off (i : ℕ) (hi : i < 6) (hi' : i ≠ 1) : eulerTermAtTwo (6*k+i) ≤ 0 :=nonpos_off_one (by omega)simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add, Nat.add_zero]have hzero : eulerTermAtTwo (6*k) ≤ 0 := by simpa using off 0 (by decide) (by decide)linarith [off 2 (by decide) (by decide),off 3 (by decide) (by decide), off 4 (by decide) (by decide), off 5 (by decide) (by decide)]private theorem recip_step {k : ℝ} (hk : 1 ≤ k) :1 / ((k+1)*Real.sqrt (k+1)) ≤ 2/Real.sqrt k - 2/Real.sqrt (k+1) := bylet a := Real.sqrt klet b := Real.sqrt (k+1)have ha : 0 < a := Real.sqrt_pos.2 (by linarith)have hb : 0 < b := Real.sqrt_pos.2 (by linarith)have ha2 : a^2 = k := Real.sq_sqrt (by linarith)have hb2 : b^2 = k+1 := Real.sq_sqrt (by linarith)have hab : a ≤ b := Real.sqrt_le_sqrt (by linarith)have hdiff : (b-a)*(b+a) = 1 := by nlinarithhave haux : a * (b+a) ≤ 2*(k+1) := by nlinarith [mul_nonneg hb.le (sub_nonneg.mpr hab)]change 1 / ((k+1)*b) ≤ 2/a - 2/bhave hsmall : a ≤ (2*(k+1))*(b-a) := bycalca = (a*(b+a))*(b-a) := by linear_combination -a*hdiff_ ≤ _ := mul_le_mul_of_nonneg_right haux (sub_nonneg.mpr hab)rw [show 2/a - 2/b = 2*(b-a)/(a*b) by field_simp]rw [div_le_div_iff₀ (by positivity) (by positivity)]nlinarith [mul_le_mul_of_nonneg_right hsmall hb.le]private def partialEuler (blocks : ℕ) : ℝ :=∑ n ∈ Finset.range (6*blocks), eulerTermAtTwo nprivate theorem partial_succ (k : ℕ) : partialEuler (k+1) =partialEuler k + ∑ i ∈ Finset.range 6, eulerTermAtTwo (6*k+i) := bysimp [partialEuler, Nat.mul_add, Finset.sum_range_add]private theorem partial_initial : partialEuler 1 ≤ 0 := byunfold partialEulerapply Finset.sum_nonposintro i hihave hi' : i < 6 := by simpa using hiby_cases he : i = 1· simp [he, eulerTermAtTwo]· exact nonpos_off_one (by omega)private theorem partial_bound (j : ℕ) :partialEuler (j+2) ≤ (1/12 : ℝ)*(3 - 2/Real.sqrt (j+1 : ℕ)) := byinduction j with| zero =>have h := block_le (k := 1) (by decide)rw [partial_succ 1]norm_num at h ⊢linarith [partial_initial]| succ j ih =>rw [show j.succ + 2 = (j+2)+1 by omega, partial_succ]have h := block_le (k := j+2) (by omega)have hj : (1:ℝ) ≤ (j:ℝ)+1 := by linarith [Nat.cast_nonneg (α := ℝ) j]have ht := recip_step hjpush_cast at *have hs : (j:ℝ)+1+1 = j+2 := by ringrw [hs] at htsimp only [hs, div_eq_mul_inv] at *linarith/-- Absolute convergence of the explicit arithmetic Euler sum. -/theorem summable_eulerTermAtTwo : Summable eulerTermAtTwo := byapply Summable.of_norm_bounded (g := fun n : ℕ => 4*(n:ℝ)^(-(3/2):ℝ))((Real.summable_nat_rpow.mpr (by norm_num : -(3/2:ℝ) < -1)).mul_left 4)intro nrw [Real.norm_eq_abs]by_cases h : 3 < n· have hn : (3:ℝ) < n := by exact_mod_cast hhave hn' : 0 < (n:ℝ) := by linarithhave hab := (local_bounds h).1have hr : (n:ℝ)^(-(3/2):ℝ) = Real.sqrt n / (n:ℝ)^2 := byrw [show -(3/2:ℝ) = 1/2 - (2:ℕ) by norm_num, Real.rpow_sub hn',← Real.sqrt_eq_rpow, Real.rpow_natCast]rw [hr]apply hab.transhave hd : 0 < (n:ℝ)^2-1 := by nlinarithrw [show (4:ℝ)*(Real.sqrt n / (n:ℝ)^2) = 4*Real.sqrt n/(n:ℝ)^2 by ring,div_le_div_iff₀ hd (by positivity)]nlinarith [mul_le_mul_of_nonneg_right (log_le_sqrt hn') (sq_nonneg (n:ℝ)),mul_nonneg (Real.sqrt_nonneg (n:ℝ)) (show 0 ≤ (n:ℝ)^2-2 by nlinarith)]· simp only [eulerTermAtTwo, h, false_and, if_false, abs_zero]positivity/-- The arithmetic sum is at most one quarter, with all primes and all powers included. -/theorem eulerTermAtTwo_sum_le : ∑' n, eulerTermAtTwo n ≤ (1/4 : ℝ) := byhave h := summable_eulerTermAtTwo.hasSum.tendsto_sum_nathave ht : Tendsto (fun j : ℕ => 6*(j+2)) atTop atTop :=tendsto_atTop_mono (fun j => show j ≤ 6*(j+2) by omega) tendsto_idapply le_of_tendsto (h.comp ht)filter_upwards with jchange partialEuler (j+2) ≤ _have hj := partial_bound jhave hs : 0 ≤ 2 / Real.sqrt ((j+1:ℕ):ℝ) := by positivitylinarith/-- The signed arithmetic upper bound for the Hadamard zero budget.The identification of this expression with a zero sum is a separate theorem. -/theorem arithmetic_budget_lt :Real.log (Real.sqrt 108 / (2 * Real.pi)) + 1 - Real.eulerMascheroniConstant +(∑' n, eulerTermAtTwo n) < 1.32 := byhave hp := Real.pi_gt_threehave hq : Real.sqrt 108 / (2 * Real.pi) ≤ 7/4 := byrw [div_le_iff₀ (by positivity)]have hs : Real.sqrt 108 ≤ 10.5 := (Real.sqrt_le_iff).2 ⟨by norm_num, by norm_num⟩linarithhave hl := Real.log_le_log (by positivity) hqhave hu := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ) < 7/8)have hlog : Real.log (7/4) = Real.log (7/8) + Real.log 2 := byrw [← Real.log_mul (by norm_num) (by norm_num)]norm_numrw [hlog] at hllinarith [Real.log_two_lt_d9, Real.one_half_lt_eulerMascheroniConstant, eulerTermAtTwo_sum_le]/-- The summand in the audit, with real and imaginary parts written out. -/theorem zero_weight_eq (z : ℂ) :((2-z)⁻¹).re = (2-z.re)/((2-z.re)^2+z.im^2) := byrw [Complex.inv_re, Complex.normSq_apply]simpring/-- Transfer to a family of complex zeros, counted with multiplicity. Thedisplayed Hadamard/Euler identity for the actual cubic L-function is external. -/theorem zero_budget_of_identity {ι : Type*} (ρ : ι → ℂ)(hadamardEuler : (∑' i, ((2-ρ i)⁻¹).re) =Real.log (Real.sqrt 108 / (2*Real.pi)) + 1 - Real.eulerMascheroniConstant +(∑' n, eulerTermAtTwo n)) :(∑' i, ((2-ρ i)⁻¹).re) < 1.32 := hadamardEuler.trans_lt arithmetic_budget_lt/-- Each entry of a pair of real reflected zeros is counted with its own index;this also covers a double central zero. -/theorem no_reflected_real_entries {ι : Type*} (β γ : ι → ℝ)(strip : ∀ i, 0 ≤ β i ∧ β i ≤ 1)(hw : Summable (fun i => (2-β i)/((2-β i)^2+(γ i)^2)))(hadamardEuler : (∑' i, (2-β i)/((2-β i)^2+(γ i)^2)) =Real.log (Real.sqrt 108 / (2*Real.pi)) + 1 - Real.eulerMascheroniConstant +(∑' n, eulerTermAtTwo n)){i j : ι} (hij : i ≠ j) (hi : γ i = 0) (hj : γ j = 0) (href : β j = 1-β i) : False := byclassicalhave hn (k : ι) : 0 ≤ (2-β k)/((2-β k)^2+(γ k)^2) := byhave hk := (strip k).2apply div_nonneg (by linarith) (by positivity)have hl := hw.sum_le_tsum ({i,j} : Finset ι) (fun k _ => hn k)rw [Finset.sum_pair hij, hi, hj, href, hadamardEuler] at hlhave hs := strip ihave h1 : 0 < 2-β i := by linarithhave h2 : 0 < 1+β i := by linarithsimp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, add_zero] at hlrw [show (2:ℝ)-(1-β i) = 1+β i by ring] at hlhave hr : (4/3:ℝ) ≤ (2-β i)/(2-β i)^2 + (1+β i)/(1+β i)^2 := byfield_simpnlinarith [sq_nonneg (2*β i-1), mul_nonneg (sq_nonneg (2*β i-1)) (mul_nonneg h1.le h2.le)]linarith [arithmetic_budget_lt]end CubicPrimeRace#print axioms CubicPrimeRace.eulerTerm_eq_local_log_derivative#print axioms CubicPrimeRace.summable_eulerTermAtTwo#print axioms CubicPrimeRace.eulerTermAtTwo_sum_le#print axioms CubicPrimeRace.arithmetic_budget_lt#print axioms CubicPrimeRace.zero_weight_eq#print axioms CubicPrimeRace.zero_budget_of_identity#print axioms CubicPrimeRace.no_reflected_real_entries