Lean / Reader
Lean readerPrimeRaceLogDerivative.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports PrimeRaceZeroBudget, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import PrimeRaceZeroBudgetimport Mathlib.Analysis.Complex.LocallyUniformLimitimport Mathlib.Analysis.NormedSpace.MultipliableUniformlyOnimport Mathlib.NumberTheory.Harmonic.GammaDerivimport Mathlib.Analysis.Calculus.LogDeriv/-! The logarithmic derivative of the completed cubic Euler product at two. -/noncomputable sectionopen Filter Topology Complexnamespace CubicPrimeRace/-- The shift of a reciprocal local Euler polynomial from its constant term. -/private def delta (r : ℕ) (t : ℂ) : ℂ :=if r = 1 then -t^2 else if r = 0 then t+t^2 else -2*t+t^2private def parameter (n : ℕ) (s : ℂ) : ℂ := Complex.exp (-(Real.log n : ℂ)*s)/-- The difference between the reciprocal Euler polynomial at p⁻ˢ and one. -/def correction (n : ℕ) (s : ℂ) : ℂ :=if 3 < n ∧ n.Prime then delta (rootCount n) (parameter n s) else 0private def logLocal (n : ℕ) (s : ℂ) : ℂ := -Complex.log (1+correction n s)/-- This definition represents the cubic Euler product on the right half-plane.Values of this total Lean function outside convergence are never used. -/def cubicEuler (s : ℂ) : ℂ := Complex.exp (∑' n, logLocal n s)def cubicConductorScale : ℝ := Real.sqrt 108 / (2 * Real.pi)def completedEuler (s : ℂ) : ℂ :=Complex.exp ((Real.log cubicConductorScale : ℂ)*s) * Complex.Gamma s * cubicEuler sprivate def region : Set ℂ := {s | 3/2 < s.re}private theorem open_region : IsOpen region := isOpen_lt continuous_const Complex.continuous_reprivate theorem two_mem : (2 : ℂ) ∈ region := by norm_num [region]private theorem delta_norm (r : ℕ) (t : ℂ) (ht : ‖t‖ ≤ 1) : ‖delta r t‖ ≤ 3*‖t‖ := byhave h : ‖t^2‖ ≤ ‖t‖ := by rw [norm_pow]; nlinarith [mul_nonneg (norm_nonneg t) (sub_nonneg.mpr ht)]unfold deltasplit_ifs· rw [norm_neg]; linarith [norm_nonneg t]· exact (norm_add_le _ _).trans (by linarith [norm_nonneg t])· apply (norm_add_le _ _).transrw [norm_mul, norm_neg, Complex.norm_ofNat]linarithprivate theorem correction_bounds (n : ℕ) {s : ℂ} (hs : s ∈ region) :‖correction n s‖ ≤ 3*(n:ℝ)^(-(3/2):ℝ) ∧ ‖correction n s‖ ≤ 1/2 := byby_cases h : 3 < n ∧ n.Prime· have hn : (4:ℝ) ≤ n := by exact_mod_cast h.1have hn0 : 0 < (n:ℝ) := by linarithhave hu : ‖parameter n s‖ = (n:ℝ)^(-s.re) := byrw [parameter, Complex.norm_exp, Real.rpow_def_of_pos hn0]congr 1simp only [Complex.mul_re, Complex.neg_re, Complex.neg_im, Complex.ofReal_re, Complex.ofReal_im]; ringhave he : ‖parameter n s‖ ≤ (n:ℝ)^(-(3/2):ℝ) := byrw [hu]exact Real.rpow_le_rpow_of_exponent_le (by linarith) (neg_le_neg (le_of_lt hs))have hb : (n:ℝ)^(-(3/2):ℝ) ≤ 1/8 := bycalc _ ≤ (4:ℝ)^(-(3/2):ℝ) := Real.rpow_le_rpow_of_nonpos (by norm_num) hn (by norm_num)_ = _ := byrw [show (4:ℝ) = 2^(2:ℕ) by norm_num, ← Real.rpow_natCast_mul (by norm_num)]norm_numrw [correction, if_pos h]have hd := delta_norm (rootCount n) (parameter n s) (by linarith)constructor <;> linarith· simp only [correction, if_neg h, norm_zero]exact ⟨by positivity, by norm_num⟩private theorem correction_diff (n : ℕ) : Differentiable ℂ (correction n) := byintro sunfold correctionsplit_ifs· unfold delta parameter; split_ifs <;> fun_prop· fun_propprivate theorem local_slit (n : ℕ) {s : ℂ} (hs : s ∈ region) :1+correction n s ∈ Complex.slitPlane := byapply Or.inlhave hk := (correction_bounds n hs).2have h := Complex.abs_re_le_norm (correction n s)simp only [Complex.add_re, Complex.one_re]linarith [(abs_le.mp h).1]private theorem logLocal_diff (n : ℕ) : DifferentiableOn ℂ (logLocal n) region := byintro s hshave hg : DifferentiableAt ℂ (fun z => 1+correction n z) s := (correction_diff n s).const_add _exact (hg.clog (local_slit n hs)).neg.differentiableWithinAtprivate theorem local_majorant (n : ℕ) {s : ℂ} (hs : s ∈ region) :‖logLocal n s‖ ≤ 5*(n:ℝ)^(-(3/2):ℝ) := byrw [logLocal, norm_neg]have h := correction_bounds n hshave hlog := Complex.norm_log_one_add_half_le_self h.2linarith [Real.rpow_nonneg (Nat.cast_nonneg n) (-(3/2):ℝ)]private theorem majorant_summable : Summable (fun n : ℕ => 5*(n:ℝ)^(-(3/2):ℝ)) :=(Real.summable_nat_rpow.mpr (by norm_num)).mul_left _private theorem sumLog_diff : DifferentiableOn ℂ (fun s => ∑' n, logLocal n s) region :=Complex.differentiableOn_tsum_of_summable_norm majorant_summable logLocal_diff open_region(fun n _ hs => local_majorant n hs)/-- The prime-side function is genuinely the product of the reciprocal local factors. -/theorem cubicEuler_eq_tprod {s : ℂ} (hs : 3/2 < s.re) :cubicEuler s = ∏' n, (1+correction n s)⁻¹ := byhave hg : Summable (fun n => logLocal n s) :=Summable.of_norm_bounded majorant_summable (fun n => local_majorant n hs)have h := hg.hasSum.cexphave he (n : ℕ) : Complex.exp (logLocal n s) = (1+correction n s)⁻¹ := byrw [logLocal, Complex.exp_neg, Complex.exp_log (Complex.slitPlane_ne_zero (local_slit n hs))]simpa only [Function.comp_apply, he, cubicEuler] using h.tprod_eq.symmprivate theorem parameter_two {n : ℕ} (hn : 0 < n) :parameter n 2 = ((1/(n:ℝ)^2 : ℝ) : ℂ) := byhave h : 0 < (n:ℝ) := by exact_mod_cast hnrw [parameter, show -(Real.log n : ℂ)*2 = -((Real.log n : ℂ)+(Real.log n : ℂ)) by ring,Complex.exp_neg, Complex.exp_add, ← Complex.ofReal_exp, Real.exp_log h]push_castringprivate theorem delta_ofReal (r : ℕ) (t : ℝ) :1+delta r t = (eulerDenominator r t : ℂ) := byunfold delta eulerDenominatorsplit_ifs <;> push_cast <;> ringprivate theorem complexPoly_diff (r : ℕ) (t : ℂ) : DifferentiableAt ℂ (fun z => 1+delta r z) t := byunfold deltasplit_ifs <;> fun_propprivate theorem local_derivative_two (n : ℕ) :deriv (logLocal n) 2 = (eulerTermAtTwo n : ℂ) := byby_cases h : 3 < n ∧ n.Prime· let t : ℝ := 1/(n:ℝ)^2let P : ℂ → ℂ := fun z => 1+delta (rootCount n) zhave hp : HasDerivAt P ((deriv (eulerDenominator (rootCount n)) t : ℝ) : ℂ) (t:ℂ) := byhave hP := (complexPoly_diff (rootCount n) (t:ℂ)).hasDerivAthave hr := (complexPoly_diff (rootCount n) t).hasDerivAt.real_of_complexhave heq : (fun u : ℝ => (P u).re) = eulerDenominator (rootCount n) := byext u; simp only [P, delta_ofReal, Complex.ofReal_re]change HasDerivAt (fun u : ℝ => (P u).re) _ t at hrrw [heq] at hrhave hf : (fun u : ℝ => P (u:ℂ)) = fun u : ℝ => ((eulerDenominator (rootCount n) u : ℝ):ℂ) :=funext (delta_ofReal _)have hh := hP.comp_ofRealchange HasDerivAt (fun u : ℝ => P (u:ℂ)) _ t at hhrw [hf] at hhexact hP.congr_deriv (hh.unique (hr.differentiableAt.hasDerivAt.ofReal_comp))have ht : HasDerivAt (parameter n) ((t:ℂ) * (-(Real.log n : ℂ))) 2 := byhave ht' := ((hasDerivAt_id (2:ℂ)).const_mul (-(Real.log n : ℂ))).cexpchange HasDerivAt (parameter n) (parameter n 2 * (-(Real.log n : ℂ)*1)) 2 at ht'rw [parameter_two (show 0 < n by omega), mul_one] at ht'exact ht'have htval := parameter_two (show 0 < n by omega : 0 < n)change parameter n 2 = (t:ℂ) at htvalhave hp' := (htval.symm ▸ hp).comp 2 hthave hcut : P (parameter n 2) ∈ Complex.slitPlane := bysimpa [P, correction, h] using local_slit n two_memhave hd := (hp'.clog hcut).neghave he := eulerTerm_eq_local_log_derivative hrw [he]simp only [Complex.ofReal_div, Complex.ofReal_mul]have hg : logLocal n = fun s => -Complex.log (P (parameter n s)) := byfunext s; simp [logLocal, correction, h, P]rw [hg]rw [show deriv (fun s => -Complex.log (P (parameter n s))) 2 = _ from hd.deriv, Function.comp_apply, htval]change -( _ / (1+delta (rootCount n) (t:ℂ))) = _rw [delta_ofReal]dsimp [t]push_castring· have he : logLocal n = fun _ => 0 := by ext; simp [logLocal, correction, h]rw [he]; simp [eulerTermAtTwo, h]private theorem euler_diff : DifferentiableAt ℂ cubicEuler 2 :=((sumLog_diff.differentiableAt (open_region.mem_nhds two_mem)).cexp)/-- No hypothesis on the zeros, continuation, or Euler product. -/theorem logDeriv_cubicEuler_two :logDeriv cubicEuler 2 = ((∑' n, eulerTermAtTwo n : ℝ) : ℂ) := byhave hd := Complex.hasSum_deriv_of_summable_norm majorant_summable logLocal_diff open_region(fun n _ hs => local_majorant n hs) two_memsimp_rw [local_derivative_two] at hdhave he := (sumLog_diff.differentiableAt (open_region.mem_nhds two_mem)).hasDerivAt.cexpchange deriv _ 2 / Complex.exp _ = _rw [show deriv cubicEuler 2 = _ from he.deriv, mul_div_cancel_left₀ _ (Complex.exp_ne_zero _)]rw [← hd.tsum_eq, Complex.ofReal_tsum]private theorem gamma_two_value : Complex.Gamma 2 = 1 := bysimpprivate theorem gamma_two_deriv : HasDerivAt Complex.Gamma((1-Real.eulerMascheroniConstant : ℝ):ℂ) 2 := byconvert Complex.hasDerivAt_Gamma_nat 1 using 1 <;> norm_num [harmonic_succ]; ringprivate theorem conductor_diff (s : ℂ) :HasDerivAt (fun z : ℂ => Complex.exp ((Real.log cubicConductorScale : ℂ)*z))(Complex.exp ((Real.log cubicConductorScale : ℂ)*s) * (Real.log cubicConductorScale : ℂ)) s := bysimpa only [mul_one] using ((hasDerivAt_id s).const_mul (Real.log cubicConductorScale : ℂ)).cexptheorem completed_two_ne : completedEuler 2 ≠ 0 := byunfold completedEuler cubicEulerrw [gamma_two_value]; exact mul_ne_zero (mul_ne_zero (Complex.exp_ne_zero _) one_ne_zero) (Complex.exp_ne_zero _)/-- This is the arithmetic side of the paper's identity as the logarithmicderivative of an actual holomorphic germ. -/theorem logDeriv_completedEuler_two :logDeriv completedEuler 2 =((Real.log cubicConductorScale + 1 - Real.eulerMascheroniConstant +∑' n, eulerTermAtTwo n : ℝ):ℂ) := bylet C := fun s : ℂ => Complex.exp ((Real.log cubicConductorScale : ℂ)*s)have hc : C 2 ≠ 0 := Complex.exp_ne_zero _have hg : Complex.Gamma 2 ≠ 0 := gamma_two_value.trans_ne one_ne_zerohave hf : cubicEuler 2 ≠ 0 := Complex.exp_ne_zero _have hd := (conductor_diff 2).differentiableAtchange logDeriv (fun s => (C s * Complex.Gamma s) * cubicEuler s) 2 = _rw [logDeriv_mul (f := fun s => C s * Complex.Gamma s) (g := cubicEuler) 2 (mul_ne_zero hc hg) hf (hd.mul gamma_two_deriv.differentiableAt) euler_diff,logDeriv_mul (f := C) (g := Complex.Gamma) 2 hc hg hd gamma_two_deriv.differentiableAt, logDeriv_cubicEuler_two,logDeriv_apply, logDeriv_apply, (conductor_diff 2).deriv, gamma_two_deriv.deriv, gamma_two_value]change C 2 * _ / C 2 + _ / 1 + _ = _rw [mul_div_cancel_left₀ _ hc]push_castringend CubicPrimeRace#print axioms CubicPrimeRace.cubicEuler_eq_tprod#print axioms CubicPrimeRace.logDeriv_cubicEuler_two#print axioms CubicPrimeRace.logDeriv_completedEuler_two