import PrimeRace import Mathlib.Analysis.PSeries import Mathlib.Analysis.Real.Pi.Bounds import 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 to F'/F. Such a prime is 1 modulo 6. The final theorem displays the analytic identification of the weighted zero sum as a hypothesis. -/ noncomputable section open Filter Topology namespace CubicPrimeRace /-- Grouped prime-power contribution to the *positive* logarithmic derivative F'/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 then let a := (n : ℝ)^2 let l := Real.log n if 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, written as functions of t = p⁻ˢ. The number of fixed roots specifies the cycle type. -/ def eulerDenominator (r : ℕ) : ℝ → ℝ := if r = 1 then fun t => 1-t^2 else if r = 0 then fun t => 1+t+t^2 else fun t => (1-t)^2 /-- The signed term agrees with log(p) t P'(t)/P(t) for the indicated local Euler polynomial P, evaluated at t = p⁻². -/ theorem eulerTerm_eq_local_log_derivative {p : ℕ} (hp : 3 < p ∧ p.Prime) : let t : ℝ := 1/(p:ℝ)^2 let P := eulerDenominator (rootCount p) eulerTermAtTwo p = Real.log p * t * deriv P t / P t := by let a := (p:ℝ)^2 let t : ℝ := 1/a have hp' : (3:ℝ) < p := by exact_mod_cast hp.1 have ha : 1 < a := by dsimp [a]; nlinarith have ha0 : a ≠ 0 := by linarith have ht : t < 1 := (div_lt_one (by linarith : 0 < a)).2 ha have 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 positivity have hsub : 1-t ≠ 0 := by linarith have hden₁ : a^2-1 ≠ 0 := by nlinarith have hden₂ : a^2+a+1 ≠ 0 := by positivity have hden₃ : a-1 ≠ 0 := by linarith change 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)).deriv simp 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_simp all_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)).deriv simp 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_simp all_goals dsimp [t]; field_simp; ring · have hd := (((hasDerivAt_const t (1:ℝ)).sub (hasDerivAt_id t)).pow 2).deriv simp 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)^2 field_simp all_goals dsimp [t]; field_simp; ring private theorem local_bounds {n : ℕ} (hn : 3 < n) : |eulerTermAtTwo n| ≤ 2 * Real.log n / ((n : ℝ)^2 - 1) ∧ eulerTermAtTwo n ≤ Real.log n / ((n : ℝ)^2 - 1) := by have hn' : (3 : ℝ) < n := by exact_mod_cast hn let a := (n : ℝ)^2 have ha : 1 < a := by dsimp [a]; nlinarith have hden : 0 < a - 1 := by linarith have hsq : 0 < a^2 - 1 := by nlinarith have hplus : 0 < a^2 + a + 1 := by positivity have hl : 0 ≤ Real.log n := Real.log_nonneg (by linarith) have h0 : 0 ≤ Real.log n / (a-1) := by positivity have 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) := by rw [div_le_div_iff₀ hplus hden] nlinarith change |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 := by by_cases h : 3 < n ∧ n.Prime · have hodd := h.2.eq_two_or_odd have hthree : ¬3 ∣ n := by intro hd rcases h.2.eq_one_or_self_of_dvd 3 hd with hh | hh <;> omega have hmod : n % 3 = 2 := by rw [Nat.dvd_iff_mod_eq_zero] at hthree omega rw [eulerTermAtTwo, if_pos h] simp only [rootCount_eq_one h.2 hmod, if_true] have hn : (3 : ℝ) < n := by exact_mod_cast h.1 apply 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 := by have hs := Real.sqrt_pos.2 hx have 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 h have 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.le linarith /-- 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) := by have hk' : (1:ℝ) ≤ k := by exact_mod_cast hk have h := (local_bounds (n := 6*k+1) (by omega)).2 push_cast at h have hs : Real.sqrt (6*(k:ℝ)+1) ≤ 3 * Real.sqrt k := by apply (Real.sqrt_le_iff).2 exact ⟨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) := by calc _ ≤ (3 * Real.sqrt k) / (36*(k:ℝ)^2) := by apply div_le_div₀ (by positivity) ((log_le_sqrt (by positivity)).trans hs) (by positivity) (by nlinarith) _ = _ := by have hs' := Real.sq_sqrt (by positivity : (0:ℝ) ≤ k) field_simp nlinarith have 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) := by let a := Real.sqrt k let 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 nlinarith have 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/b have hsmall : a ≤ (2*(k+1))*(b-a) := by calc a = (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 n private theorem partial_succ (k : ℕ) : partialEuler (k+1) = partialEuler k + ∑ i ∈ Finset.range 6, eulerTermAtTwo (6*k+i) := by simp [partialEuler, Nat.mul_add, Finset.sum_range_add] private theorem partial_initial : partialEuler 1 ≤ 0 := by unfold partialEuler apply Finset.sum_nonpos intro i hi have hi' : i < 6 := by simpa using hi by_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 : ℕ)) := by induction 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 hj push_cast at * have hs : (j:ℝ)+1+1 = j+2 := by ring rw [hs] at ht simp only [hs, div_eq_mul_inv] at * linarith /-- Absolute convergence of the explicit arithmetic Euler sum. -/ theorem summable_eulerTermAtTwo : Summable eulerTermAtTwo := by apply 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 n rw [Real.norm_eq_abs] by_cases h : 3 < n · have hn : (3:ℝ) < n := by exact_mod_cast h have hn' : 0 < (n:ℝ) := by linarith have hab := (local_bounds h).1 have hr : (n:ℝ)^(-(3/2):ℝ) = Real.sqrt n / (n:ℝ)^2 := by rw [show -(3/2:ℝ) = 1/2 - (2:ℕ) by norm_num, Real.rpow_sub hn', ← Real.sqrt_eq_rpow, Real.rpow_natCast] rw [hr] apply hab.trans have hd : 0 < (n:ℝ)^2-1 := by nlinarith rw [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 : ℝ) := by have h := summable_eulerTermAtTwo.hasSum.tendsto_sum_nat have ht : Tendsto (fun j : ℕ => 6*(j+2)) atTop atTop := tendsto_atTop_mono (fun j => show j ≤ 6*(j+2) by omega) tendsto_id apply le_of_tendsto (h.comp ht) filter_upwards with j change partialEuler (j+2) ≤ _ have hj := partial_bound j have hs : 0 ≤ 2 / Real.sqrt ((j+1:ℕ):ℝ) := by positivity linarith /-- 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 := by have hp := Real.pi_gt_three have hq : Real.sqrt 108 / (2 * Real.pi) ≤ 7/4 := by rw [div_le_iff₀ (by positivity)] have hs : Real.sqrt 108 ≤ 10.5 := (Real.sqrt_le_iff).2 ⟨by norm_num, by norm_num⟩ linarith have hl := Real.log_le_log (by positivity) hq have 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 := by rw [← Real.log_mul (by norm_num) (by norm_num)] norm_num rw [hlog] at hl linarith [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) := by rw [Complex.inv_re, Complex.normSq_apply] simp ring /-- Transfer to a family of complex zeros, counted with multiplicity. The displayed 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 := by classical have hn (k : ι) : 0 ≤ (2-β k)/((2-β k)^2+(γ k)^2) := by have hk := (strip k).2 apply 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 hl have hs := strip i have h1 : 0 < 2-β i := by linarith have h2 : 0 < 1+β i := by linarith simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, add_zero] at hl rw [show (2:ℝ)-(1-β i) = 1+β i by ring] at hl have hr : (4/3:ℝ) ≤ (2-β i)/(2-β i)^2 + (1+β i)/(1+β i)^2 := by field_simp nlinarith [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