Lean / Reader
Lean readerPrimeRaceZeroProduct.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports PrimeRaceLogDerivative, PrimeRaceTheta, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import PrimeRaceLogDerivativeimport PrimeRaceThetaimport Mathlib.NumberTheory.LSeries.MellinEqDirichlet/-! Differentiate the normalized centered product without assuming the zero-sumidentity. Index reflection pairs with multiplicity and keep central entries separate. -/noncomputable sectionopen Filter Topology Complexnamespace CubicPrimeRace/-- The coefficient of (s−2)(s+1) in the product factor for r and 1−r. -/def pairCoeff (r : ℂ) : ℂ := ((2-r)*(1+r))⁻¹def pairProduct {ι : Type*} (a : ι → ℂ) (s : ℂ) : ℂ :=∏' i, (1+(s-2)*(s+1)*a i)theorem normalized_pair (r s : ℂ) (h₁ : 2-r ≠ 0) (h₂ : 1+r ≠ 0) :(s-r)*(s-(1-r))/((2-r)*(1+r)) = 1+(s-2)*(s+1)*pairCoeff r := byunfold pairCoefffield_simpringprivate theorem scale_diff (s : ℂ) :HasDerivAt (fun z : ℂ => (z-2)*(z+1)) ((s+1)+(s-2)) s := bysimpa using (((hasDerivAt_id s).sub_const 2).mul ((hasDerivAt_id s).add_const 1))private theorem pairProduct_two {ι : Type*} (a : ι → ℂ) : pairProduct a 2 = 1 := bysimp [pairProduct]private theorem pairProduct_deriv {ι : Type*} (a : ι → ℂ) (ha : Summable fun i => ‖a i‖) :HasDerivAt (pairProduct a) (3 * ∑' i, a i) 2 := bylet K := Metric.closedBall (2:ℂ) 1let U := Metric.ball (2:ℂ) 1have hx : (2:ℂ) ∈ U := Metric.mem_ball_self (by norm_num)let P := fun (t : Finset ι) (s : ℂ) => ∏ i ∈ t, (1+(s-2)*(s+1)*a i)have hbound (i : ι) (s : ℂ) (hs : s ∈ K) : ‖(s-2)*(s+1)*a i‖ ≤ 4 * ‖a i‖ := byhave h : ‖s-2‖ ≤ 1 := by simpa only [K, Metric.mem_closedBall, dist_eq_norm] using hshave h' : ‖s+1‖ ≤ 4 := bycalc _ = ‖(s-2)+3‖ := by congr 1; ring_ ≤ ‖s-2‖+‖(3:ℂ)‖ := norm_add_le _ __ ≤ 4 := by rw [Complex.norm_ofNat]; linarithsimp only [norm_mul]exact mul_le_mul_of_nonneg_right ((mul_le_mul h h' (norm_nonneg _) (by norm_num)).trans_eq (by norm_num)) (norm_nonneg _)have hu := (ha.mul_left 4).hasProdUniformlyOn_one_add (isCompact_closedBall (2:ℂ) 1)(Filter.Eventually.of_forall hbound) (fun i => by fun_prop)have hc : TendstoLocallyUniformlyOn P (pairProduct a) atTop U := byhave hv := (hasProdUniformlyOn_iff_tendstoUniformlyOn.mp hu) K (Set.mem_singleton _)exact (hv.mono Metric.ball_subset_closedBall).tendstoLocallyUniformlyOnhave hD : ∀ᶠ t in (atTop : Filter (Finset ι)), DifferentiableOn ℂ (P t) U :=.of_forall (fun t => by dsimp [P]; fun_prop)have hd := hc.differentiableOn hD Metric.isOpen_ballhave hlim := Complex.logDeriv_tendsto Metric.isOpen_ball ⟨2,hx⟩ hc hD(by rw [pairProduct_two]; exact one_ne_zero)have hfd (t : Finset ι) : logDeriv (P t) 2 = ∑ i ∈ t, 3 * a i := byrw [show P t = fun s : ℂ => ∏ i ∈ t, (1+(s-2)*(s+1)*a i) from rfl,logDeriv_prod t (fun i (s:ℂ) => 1+(s-2)*(s+1)*a i) 2 (by simp) (fun _ _ => by fun_prop)]apply Finset.sum_congr rflintro i _have dd := ((scale_diff 2).mul_const (a i)).const_add 1rw [logDeriv_apply, dd.deriv]; norm_numchange Tendsto (fun t => logDeriv (P t) 2) atTop (𝓝 (logDeriv (pairProduct a) 2)) at hlimsimp_rw [hfd] at hlimhave ht := (ha.of_norm.hasSum.mul_left 3)have hval := tendsto_nhds_unique hlim htrw [logDeriv_apply, pairProduct_two, div_one] at hvalexact hval ▸ (hd.differentiableAt (Metric.isOpen_ball.mem_nhds hx)).hasDerivAt/-- This normalized product has value one at 2. The power records every centralzero. Each remaining factor accounts for a reflected pair. -/def centeredProduct {ι : Type*} (m : ℕ) (r : ι → ℂ) (s : ℂ) : ℂ :=((2*s-1)/3)^m * pairProduct (fun i => pairCoeff (r i)) sprivate theorem centered_deriv {ι : Type*} (m : ℕ) (r : ι → ℂ)(ha : Summable fun i => ‖pairCoeff (r i)‖) :HasDerivAt (centeredProduct m r) ((m:ℂ)*(2/3) + 3 * ∑' i, pairCoeff (r i)) 2 := byhave hc := ((((hasDerivAt_id (2:ℂ)).const_mul 2).sub_const 1).div_const 3).pow mhave hp := pairProduct_deriv _ hahave h := hc.mul hpchange HasDerivAt (centeredProduct m r) _ 2 at hconvert h using 1rw [pairProduct_two]norm_numtheorem paired_identity_of_product {ι : Type*} (m : ℕ) (r : ι → ℂ)(ha : Summable fun i => ‖pairCoeff (r i)‖)(hproduct : (fun s => completedEuler s / completedEuler 2) =ᶠ[𝓝 (2:ℂ)] centeredProduct m r) :((m:ℂ)*(2/3) + 3 * ∑' i, pairCoeff (r i)) =((Real.log cubicConductorScale + 1 - Real.eulerMascheroniConstant +∑' n, eulerTermAtTwo n : ℝ):ℂ) := byhave d := (centered_deriv m r ha).congr_of_eventuallyEq hproducthave he := d.derivrw [deriv_div_const] at heexact he.symm.trans logDeriv_completedEuler_twoprivate theorem centered_two {ι : Type*} (m : ℕ) (r : ι → ℂ) : centeredProduct m r 2 = 1 := bysimp only [centeredProduct, pairProduct_two, mul_one]norm_numprivate theorem reflected_product {ι : Type*} (m : ℕ) (r : ι → ℂ) (z : ℂ) :centeredProduct m r (1-z) = (-1:ℂ)^m * centeredProduct m r z := bysimp only [centeredProduct, pairProduct, show (1-z-2)*(1-z+1) = (z-2)*(z+1) by ring,show (2*(1-z)-1)/3 = (-1)*((2*z-1)/3) by ring, mul_pow, mul_assoc]/-- In a genus-one factorization into reflected pairs, the affine exponentialhas zero slope by the functional equation. This works with central zeros. -/theorem remove_affine_factor {ι : Type*} (m : ℕ) (r : ι → ℂ)(ha : Summable fun i => ‖pairCoeff (r i)‖) (G : ℂ → ℂ) (A B : ℂ)(hA : A ≠ 0) (hfe : ∀ z, G (1-z) = G z)(hf : ∀ z, G z = A * Complex.exp (B*(z-2)) * centeredProduct m r z) :B = 0 := bylet k : ℂ := (-1)^mhave hnear := (centered_deriv m r ha).continuousAt.eventually_ne(by rw [centered_two]; exact one_ne_zero : centeredProduct m r 2 ≠ 0)have he : (fun z : ℂ => k * Complex.exp (B*((1-z)-2))) =ᶠ[𝓝 (2:ℂ)](fun z : ℂ => Complex.exp (B*(z-2))) := byfilter_upwards [hnear] with z hzhave eq := hfe zrw [hf (1-z), hf z, reflected_product] at eqapply mul_left_cancel₀ hAapply mul_right_cancel₀ hzdsimp [k]; linear_combination eqhave atTwo := he.eq_of_nhdschange k * Complex.exp (B*((1-2)-2)) = Complex.exp (B*(2-2)) at atTwohave hleft := (((((hasDerivAt_id (2:ℂ)).const_sub 1).sub_const 2).const_mul B).cexp).const_mul khave hright := (((hasDerivAt_id (2:ℂ)).sub_const 2).const_mul B).cexphave e := hleft.unique (hright.congr_of_eventuallyEq he)simp only [sub_self, mul_zero, Complex.exp_zero] at atTwosimp only [id_eq, mul_one, mul_neg, sub_self, mul_zero, Complex.exp_zero, one_mul] at elinear_combination (norm := ring_nf) -(e + B*atTwo)/2/-- All zero entries separately, as needed in the original budget theorem. -/def zeroEntries {ι : Type*} (m : ℕ) (r : ι → ℂ) :Fin m ⊕ (ι ⊕ ι) → ℂ :=Sum.elim (fun _ => 1/2) (Sum.elim r (fun i => 1-r i))private theorem weight_nonneg (r : ℂ) (hr : r.re ≤ 1) : 0 ≤ ((2-r)⁻¹).re := byrw [zero_weight_eq]exact div_nonneg (by linarith) (by positivity)set_option maxHeartbeats 600000 inprivate theorem separate_entries {ι : Type*} (m : ℕ) (r : ι → ℂ)(hs : ∀ i, 0 ≤ (r i).re ∧ (r i).re ≤ 1)(ha : Summable fun i => ‖pairCoeff (r i)‖) :HasSum (fun j => ((2-zeroEntries m r j)⁻¹).re)(((m:ℂ)*(2/3) + 3 * ∑' i, pairCoeff (r i)).re) := bylet w := fun z : ℂ => ((2-z)⁻¹).rehave hpos (i : ι) : 0 ≤ w (r i) := weight_nonneg _ (hs i).2have hpos' (i : ι) : 0 ≤ w (1-r i) := byapply weight_nonnegrw [Complex.sub_re, Complex.one_re]; linarith [(hs i).1]have heq (i : ι) : w (r i) + w (1-r i) = (3*pairCoeff (r i)).re := byhave h₁ : 2-r i ≠ 0 := byintro h; have hh := congrArg Complex.re hnorm_num [Complex.sub_re] at hh; linarith [(hs i).2]have h₂ : 1+r i ≠ 0 := byintro h; have hh := congrArg Complex.re hsimp only [Complex.add_re, Complex.one_re, Complex.zero_re] at hh; linarith [(hs i).1]change _ + _ = _unfold wrw [← Complex.add_re]congr 1rw [show 2-(1-r i) = 1+r i by ring]unfold pairCoeff; field_simp; ringhave hboth := Complex.hasSum_re (ha.of_norm.hasSum.mul_left 3)simp_rw [← heq] at hbothhave h₁ : Summable fun i => w (r i) :=hboth.summable.of_nonneg_of_le hpos (fun i => le_add_of_nonneg_right (hpos' i))have h₂ : Summable fun i => w (1-r i) :=hboth.summable.of_nonneg_of_le hpos' (fun i => le_add_of_nonneg_left (hpos i))have htotal := (h₁.hasSum.add h₂.hasSum).unique hbothhave hpair : HasSum (fun i : ι ⊕ ι => w (Sum.elim r (fun i => 1-r i) i))((3*∑' i, pairCoeff (r i)).re) := byrw [← htotal]exact HasSum.sum (f := fun i : ι ⊕ ι => w (Sum.elim r (fun j => 1-r j) i)) h₁.hasSum h₂.hasSumrw [Complex.add_re]apply HasSum.sum (f := fun j => w (zeroEntries m r j)) _ hpairchange HasSum (fun _ : Fin m => w (1/2)) _convert hasSum_fintype (fun _ : Fin m => w (1/2)) using 1have hcentral : w (1/2) = (2/3:ℝ) := byhave hh : ((2-(1/2:ℂ))⁻¹ : ℂ) = ((2/3:ℝ):ℂ) := by push_cast; norm_numexact congrArg Complex.re hhrw [hcentral]simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]have hh : ((2/3:ℝ):ℂ) = 2/3 := by push_cast; rflrw [← hh, ← Complex.ofReal_natCast, ← Complex.ofReal_mul, Complex.ofReal_re]/-- Sufficient global inputs for the full zero-sum identity. Neither alogarithmic derivative formula nor an estimate on that derivative is an input.The cubic continuation and its zero factorization still have to be constructed. -/theorem zero_sum_of_continuation_factorization {ι : Type*} (m : ℕ) (r : ι → ℂ)(hs : ∀ i, 0 ≤ (r i).re ∧ (r i).re ≤ 1)(ha : Summable fun i => ‖pairCoeff (r i)‖)(G : ℂ → ℂ) (A B : ℂ) (germ : G =ᶠ[𝓝 (2:ℂ)] completedEuler)(hfe : ∀ z, G (1-z) = G z)(hf : ∀ z, G z = A * Complex.exp (B*(z-2)) * centeredProduct m r z) :HasSum (fun j => ((2-zeroEntries m r j)⁻¹).re)(Real.log cubicConductorScale + 1 - Real.eulerMascheroniConstant +∑' n, eulerTermAtTwo n) := byhave hA : A = completedEuler 2 := byhave he := germ.eq_of_nhdsrw [hf 2, centered_two] at hesimpa using hehave hA' : A ≠ 0 := hA.trans_ne completed_two_nehave hb := remove_affine_factor m r ha G A B hA' hfe hfhave hp : (fun z => completedEuler z / completedEuler 2) =ᶠ[𝓝 (2:ℂ)] centeredProduct m r := byfilter_upwards [germ] with z hzrw [← hz, hf z, hb, zero_mul, Complex.exp_zero, mul_one, ← hA, mul_div_cancel_left₀ _ hA']have he := congrArg Complex.re (paired_identity_of_product m r ha hp)rw [Complex.ofReal_re] at heexact he ▸ separate_entries m r hs ha/-- Entire continuation of the Euler germ, if supplied, is unique. -/theorem unique_entire_continuation {G H : ℂ → ℂ} (hG : Differentiable ℂ G)(hH : Differentiable ℂ H) (gG : G =ᶠ[𝓝 (2:ℂ)] completedEuler)(gH : H =ᶠ[𝓝 (2:ℂ)] completedEuler) : G = H :=(hG.differentiableOn.analyticOnNhd isOpen_univ).eq_of_eventuallyEq(hH.differentiableOn.analyticOnNhd isOpen_univ) (gG.trans gH.symm)/-- Mellin identification at any point where the two coefficient expansionsagree. Index n stands for the positive Fourier index n+1. -/theorem theta_equals_euler_of_coefficients {s : ℂ} (hs : 0 < s.re) (a : ℕ → ℂ)(heat : ∀ t : ℝ, 0 < t → HasSum (fun n : ℕ => a n *Real.exp (-(((n:ℝ)+1)/cubicConductorScale)*t)) (Theta.kernel t : ℂ))(absolute : Summable fun n : ℕ => ‖a n‖ / (((n:ℝ)+1)/cubicConductorScale)^s.re)(dirichlet : HasSum (fun n : ℕ => a n / (((n:ℝ)+1 : ℝ):ℂ)^s) (cubicEuler s)) :Theta.completion s = completedEuler s := byhave hQ : 0 < cubicConductorScale := by unfold cubicConductorScale; positivityhave h := hasSum_mellin (a := a) (p := fun n : ℕ => ((n:ℝ)+1)/cubicConductorScale)(fun _ => Or.inr (by positivity)) hs heat absoluterw [Theta.completion_eq_mellin]let C : ℂ := Complex.exp ((Real.log cubicConductorScale:ℂ)*s) * Complex.Gamma sapply h.uniquechange HasSum _ (C * cubicEuler s)convert dirichlet.mul_left C using 1funext nhave hn : 0 < (n:ℝ)+1 := by positivityhave he (v : ℝ) (hv : 0 < v) : (v:ℂ)^s = Complex.exp ((Real.log v : ℂ)*s) := byrw [Complex.cpow_def_of_ne_zero (Complex.ofReal_ne_zero.mpr hv.ne'), Complex.ofReal_log hv.le]rw [he _ (div_pos hn hQ), he _ hn, Real.log_div hn.ne' hQ.ne', Complex.ofReal_sub, sub_mul, Complex.exp_sub]dsimp [C]; field_simp/-- Specialization to the explicit theta completion. Its functional equationis proved in PrimeRaceTheta, so it is not a hypothesis here. -/theorem theta_zero_sum {ι : Type*} (m : ℕ) (r : ι → ℂ)(hs : ∀ i, 0 ≤ (r i).re ∧ (r i).re ≤ 1)(ha : Summable fun i => ‖pairCoeff (r i)‖)(A B : ℂ) (germ : Theta.completion =ᶠ[𝓝 (2:ℂ)] completedEuler)(hf : ∀ z, Theta.completion z = A * Complex.exp (B*(z-2)) * centeredProduct m r z) :HasSum (fun j => ((2-zeroEntries m r j)⁻¹).re)(Real.log cubicConductorScale + 1 - Real.eulerMascheroniConstant +∑' n, eulerTermAtTwo n) :=zero_sum_of_continuation_factorization m r hs ha _ A B germ Theta.reflection hfend CubicPrimeRace#print axioms CubicPrimeRace.normalized_pair#print axioms CubicPrimeRace.paired_identity_of_product#print axioms CubicPrimeRace.remove_affine_factor#print axioms CubicPrimeRace.zero_sum_of_continuation_factorization#print axioms CubicPrimeRace.unique_entire_continuation#print axioms CubicPrimeRace.theta_zero_sum#print axioms CubicPrimeRace.theta_equals_euler_of_coefficients