Lean / Reader
Lean reader

PrimeRaceZeroProduct.lean

265 lines19 declarationsno sorryimports PrimeRaceLogDerivative PrimeRaceTheta Mathlib.NumberTheory.LSeries.MellinEqDirichlet

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.

  1. import PrimeRaceLogDerivative
  2. import PrimeRaceTheta
  3. import Mathlib.NumberTheory.LSeries.MellinEqDirichlet
  4. /-! Differentiate the normalized centered product without assuming the zero-sum
  5. identity. Index reflection pairs with multiplicity and keep central entries separate. -/
  6. noncomputable section
  7. open Filter Topology Complex
  8. namespace CubicPrimeRace
  9. /-- The coefficient of (s−2)(s+1) in the product factor for r and 1−r. -/
  10. def pairCoeff (r : ℂ) : ℂ := ((2-r)*(1+r))⁻¹
  11. def pairProduct {ι : Type*} (a : ι → ℂ) (s : ℂ) : ℂ :=
  12. ∏' i, (1+(s-2)*(s+1)*a i)
  13. theorem normalized_pair (r s : ℂ) (h₁ : 2-r ≠ 0) (h₂ : 1+r ≠ 0) :
  14. (s-r)*(s-(1-r))/((2-r)*(1+r)) = 1+(s-2)*(s+1)*pairCoeff r := by
  15. unfold pairCoeff
  16. field_simp
  17. ring
  18. private theorem scale_diff (s : ℂ) :
  19. HasDerivAt (fun z : ℂ => (z-2)*(z+1)) ((s+1)+(s-2)) s := by
  20. simpa using (((hasDerivAt_id s).sub_const 2).mul ((hasDerivAt_id s).add_const 1))
  21. private theorem pairProduct_two {ι : Type*} (a : ι → ℂ) : pairProduct a 2 = 1 := by
  22. simp [pairProduct]
  23. private theorem pairProduct_deriv {ι : Type*} (a : ι → ℂ) (ha : Summable fun i => ‖a i‖) :
  24. HasDerivAt (pairProduct a) (3 * ∑' i, a i) 2 := by
  25. let K := Metric.closedBall (2:ℂ) 1
  26. let U := Metric.ball (2:ℂ) 1
  27. have hx : (2:ℂ) ∈ U := Metric.mem_ball_self (by norm_num)
  28. let P := fun (t : Finset ι) (s : ℂ) => ∏ i ∈ t, (1+(s-2)*(s+1)*a i)
  29. have hbound (i : ι) (s : ℂ) (hs : s ∈ K) : ‖(s-2)*(s+1)*a i‖ ≤ 4 * ‖a i‖ := by
  30. have h : ‖s-2‖ ≤ 1 := by simpa only [K, Metric.mem_closedBall, dist_eq_norm] using hs
  31. have h' : ‖s+1‖ ≤ 4 := by
  32. calc _ = ‖(s-2)+3‖ := by congr 1; ring
  33. _ ≤ ‖s-2‖+‖(3:ℂ)‖ := norm_add_le _ _
  34. _ ≤ 4 := by rw [Complex.norm_ofNat]; linarith
  35. simp only [norm_mul]
  36. exact mul_le_mul_of_nonneg_right ((mul_le_mul h h' (norm_nonneg _) (by norm_num)).trans_eq (by norm_num)) (norm_nonneg _)
  37. have hu := (ha.mul_left 4).hasProdUniformlyOn_one_add (isCompact_closedBall (2:ℂ) 1)
  38. (Filter.Eventually.of_forall hbound) (fun i => by fun_prop)
  39. have hc : TendstoLocallyUniformlyOn P (pairProduct a) atTop U := by
  40. have hv := (hasProdUniformlyOn_iff_tendstoUniformlyOn.mp hu) K (Set.mem_singleton _)
  41. exact (hv.mono Metric.ball_subset_closedBall).tendstoLocallyUniformlyOn
  42. have hD : ∀ᶠ t in (atTop : Filter (Finset ι)), DifferentiableOn ℂ (P t) U :=
  43. .of_forall (fun t => by dsimp [P]; fun_prop)
  44. have hd := hc.differentiableOn hD Metric.isOpen_ball
  45. have hlim := Complex.logDeriv_tendsto Metric.isOpen_ball ⟨2,hx⟩ hc hD
  46. (by rw [pairProduct_two]; exact one_ne_zero)
  47. have hfd (t : Finset ι) : logDeriv (P t) 2 = ∑ i ∈ t, 3 * a i := by
  48. rw [show P t = fun s : ℂ => ∏ i ∈ t, (1+(s-2)*(s+1)*a i) from rfl,
  49. logDeriv_prod t (fun i (s:ℂ) => 1+(s-2)*(s+1)*a i) 2 (by simp) (fun _ _ => by fun_prop)]
  50. apply Finset.sum_congr rfl
  51. intro i _
  52. have dd := ((scale_diff 2).mul_const (a i)).const_add 1
  53. rw [logDeriv_apply, dd.deriv]; norm_num
  54. change Tendsto (fun t => logDeriv (P t) 2) atTop (𝓝 (logDeriv (pairProduct a) 2)) at hlim
  55. simp_rw [hfd] at hlim
  56. have ht := (ha.of_norm.hasSum.mul_left 3)
  57. have hval := tendsto_nhds_unique hlim ht
  58. rw [logDeriv_apply, pairProduct_two, div_one] at hval
  59. exact hval ▸ (hd.differentiableAt (Metric.isOpen_ball.mem_nhds hx)).hasDerivAt
  60. /-- This normalized product has value one at 2. The power records every central
  61. zero. Each remaining factor accounts for a reflected pair. -/
  62. def centeredProduct {ι : Type*} (m : ℕ) (r : ι → ℂ) (s : ℂ) : ℂ :=
  63. ((2*s-1)/3)^m * pairProduct (fun i => pairCoeff (r i)) s
  64. private theorem centered_deriv {ι : Type*} (m : ℕ) (r : ι → ℂ)
  65. (ha : Summable fun i => ‖pairCoeff (r i)‖) :
  66. HasDerivAt (centeredProduct m r) ((m:ℂ)*(2/3) + 3 * ∑' i, pairCoeff (r i)) 2 := by
  67. have hc := ((((hasDerivAt_id (2:ℂ)).const_mul 2).sub_const 1).div_const 3).pow m
  68. have hp := pairProduct_deriv _ ha
  69. have h := hc.mul hp
  70. change HasDerivAt (centeredProduct m r) _ 2 at h
  71. convert h using 1
  72. rw [pairProduct_two]
  73. norm_num
  74. theorem paired_identity_of_product {ι : Type*} (m : ℕ) (r : ι → ℂ)
  75. (ha : Summable fun i => ‖pairCoeff (r i)‖)
  76. (hproduct : (fun s => completedEuler s / completedEuler 2) =ᶠ[𝓝 (2:ℂ)] centeredProduct m r) :
  77. ((m:ℂ)*(2/3) + 3 * ∑' i, pairCoeff (r i)) =
  78. ((Real.log cubicConductorScale + 1 - Real.eulerMascheroniConstant +
  79. ∑' n, eulerTermAtTwo n : ℝ):ℂ) := by
  80. have d := (centered_deriv m r ha).congr_of_eventuallyEq hproduct
  81. have he := d.deriv
  82. rw [deriv_div_const] at he
  83. exact he.symm.trans logDeriv_completedEuler_two
  84. private theorem centered_two {ι : Type*} (m : ℕ) (r : ι → ℂ) : centeredProduct m r 2 = 1 := by
  85. simp only [centeredProduct, pairProduct_two, mul_one]
  86. norm_num
  87. private theorem reflected_product {ι : Type*} (m : ℕ) (r : ι → ℂ) (z : ℂ) :
  88. centeredProduct m r (1-z) = (-1:ℂ)^m * centeredProduct m r z := by
  89. simp only [centeredProduct, pairProduct, show (1-z-2)*(1-z+1) = (z-2)*(z+1) by ring,
  90. show (2*(1-z)-1)/3 = (-1)*((2*z-1)/3) by ring, mul_pow, mul_assoc]
  91. /-- In a genus-one factorization into reflected pairs, the affine exponential
  92. has zero slope by the functional equation. This works with central zeros. -/
  93. theorem remove_affine_factor {ι : Type*} (m : ℕ) (r : ι → ℂ)
  94. (ha : Summable fun i => ‖pairCoeff (r i)‖) (G : ℂ → ℂ) (A B : ℂ)
  95. (hA : A ≠ 0) (hfe : ∀ z, G (1-z) = G z)
  96. (hf : ∀ z, G z = A * Complex.exp (B*(z-2)) * centeredProduct m r z) :
  97. B = 0 := by
  98. let k : ℂ := (-1)^m
  99. have hnear := (centered_deriv m r ha).continuousAt.eventually_ne
  100. (by rw [centered_two]; exact one_ne_zero : centeredProduct m r 2 ≠ 0)
  101. have he : (fun z : ℂ => k * Complex.exp (B*((1-z)-2))) =ᶠ[𝓝 (2:ℂ)]
  102. (fun z : ℂ => Complex.exp (B*(z-2))) := by
  103. filter_upwards [hnear] with z hz
  104. have eq := hfe z
  105. rw [hf (1-z), hf z, reflected_product] at eq
  106. apply mul_left_cancel₀ hA
  107. apply mul_right_cancel₀ hz
  108. dsimp [k]; linear_combination eq
  109. have atTwo := he.eq_of_nhds
  110. change k * Complex.exp (B*((1-2)-2)) = Complex.exp (B*(2-2)) at atTwo
  111. have hleft := (((((hasDerivAt_id (2:ℂ)).const_sub 1).sub_const 2).const_mul B).cexp).const_mul k
  112. have hright := (((hasDerivAt_id (2:ℂ)).sub_const 2).const_mul B).cexp
  113. have e := hleft.unique (hright.congr_of_eventuallyEq he)
  114. simp only [sub_self, mul_zero, Complex.exp_zero] at atTwo
  115. simp only [id_eq, mul_one, mul_neg, sub_self, mul_zero, Complex.exp_zero, one_mul] at e
  116. linear_combination (norm := ring_nf) -(e + B*atTwo)/2
  117. /-- All zero entries separately, as needed in the original budget theorem. -/
  118. def zeroEntries {ι : Type*} (m : ℕ) (r : ι → ℂ) :
  119. Fin m ⊕ (ι ⊕ ι) → ℂ :=
  120. Sum.elim (fun _ => 1/2) (Sum.elim r (fun i => 1-r i))
  121. private theorem weight_nonneg (r : ℂ) (hr : r.re ≤ 1) : 0 ≤ ((2-r)⁻¹).re := by
  122. rw [zero_weight_eq]
  123. exact div_nonneg (by linarith) (by positivity)
  124. set_option maxHeartbeats 600000 in
  125. private theorem separate_entries {ι : Type*} (m : ℕ) (r : ι → ℂ)
  126. (hs : ∀ i, 0 ≤ (r i).re ∧ (r i).re ≤ 1)
  127. (ha : Summable fun i => ‖pairCoeff (r i)‖) :
  128. HasSum (fun j => ((2-zeroEntries m r j)⁻¹).re)
  129. (((m:ℂ)*(2/3) + 3 * ∑' i, pairCoeff (r i)).re) := by
  130. let w := fun z : ℂ => ((2-z)⁻¹).re
  131. have hpos (i : ι) : 0 ≤ w (r i) := weight_nonneg _ (hs i).2
  132. have hpos' (i : ι) : 0 ≤ w (1-r i) := by
  133. apply weight_nonneg
  134. rw [Complex.sub_re, Complex.one_re]; linarith [(hs i).1]
  135. have heq (i : ι) : w (r i) + w (1-r i) = (3*pairCoeff (r i)).re := by
  136. have h₁ : 2-r i ≠ 0 := by
  137. intro h; have hh := congrArg Complex.re h
  138. norm_num [Complex.sub_re] at hh; linarith [(hs i).2]
  139. have h₂ : 1+r i ≠ 0 := by
  140. intro h; have hh := congrArg Complex.re h
  141. simp only [Complex.add_re, Complex.one_re, Complex.zero_re] at hh; linarith [(hs i).1]
  142. change _ + _ = _
  143. unfold w
  144. rw [← Complex.add_re]
  145. congr 1
  146. rw [show 2-(1-r i) = 1+r i by ring]
  147. unfold pairCoeff; field_simp; ring
  148. have hboth := Complex.hasSum_re (ha.of_norm.hasSum.mul_left 3)
  149. simp_rw [← heq] at hboth
  150. have h₁ : Summable fun i => w (r i) :=
  151. hboth.summable.of_nonneg_of_le hpos (fun i => le_add_of_nonneg_right (hpos' i))
  152. have h₂ : Summable fun i => w (1-r i) :=
  153. hboth.summable.of_nonneg_of_le hpos' (fun i => le_add_of_nonneg_left (hpos i))
  154. have htotal := (h₁.hasSum.add h₂.hasSum).unique hboth
  155. have hpair : HasSum (fun i : ι ⊕ ι => w (Sum.elim r (fun i => 1-r i) i))
  156. ((3*∑' i, pairCoeff (r i)).re) := by
  157. rw [← htotal]
  158. exact HasSum.sum (f := fun i : ι ⊕ ι => w (Sum.elim r (fun j => 1-r j) i)) h₁.hasSum h₂.hasSum
  159. rw [Complex.add_re]
  160. apply HasSum.sum (f := fun j => w (zeroEntries m r j)) _ hpair
  161. change HasSum (fun _ : Fin m => w (1/2)) _
  162. convert hasSum_fintype (fun _ : Fin m => w (1/2)) using 1
  163. have hcentral : w (1/2) = (2/3:ℝ) := by
  164. have hh : ((2-(1/2:ℂ))⁻¹ : ℂ) = ((2/3:ℝ):ℂ) := by push_cast; norm_num
  165. exact congrArg Complex.re hh
  166. rw [hcentral]
  167. simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]
  168. have hh : ((2/3:ℝ):ℂ) = 2/3 := by push_cast; rfl
  169. rw [← hh, ← Complex.ofReal_natCast, ← Complex.ofReal_mul, Complex.ofReal_re]
  170. /-- Sufficient global inputs for the full zero-sum identity. Neither a
  171. logarithmic derivative formula nor an estimate on that derivative is an input.
  172. The cubic continuation and its zero factorization still have to be constructed. -/
  173. theorem zero_sum_of_continuation_factorization {ι : Type*} (m : ℕ) (r : ι → ℂ)
  174. (hs : ∀ i, 0 ≤ (r i).re ∧ (r i).re ≤ 1)
  175. (ha : Summable fun i => ‖pairCoeff (r i)‖)
  176. (G : ℂ → ℂ) (A B : ℂ) (germ : G =ᶠ[𝓝 (2:ℂ)] completedEuler)
  177. (hfe : ∀ z, G (1-z) = G z)
  178. (hf : ∀ z, G z = A * Complex.exp (B*(z-2)) * centeredProduct m r z) :
  179. HasSum (fun j => ((2-zeroEntries m r j)⁻¹).re)
  180. (Real.log cubicConductorScale + 1 - Real.eulerMascheroniConstant +
  181. ∑' n, eulerTermAtTwo n) := by
  182. have hA : A = completedEuler 2 := by
  183. have he := germ.eq_of_nhds
  184. rw [hf 2, centered_two] at he
  185. simpa using he
  186. have hA' : A ≠ 0 := hA.trans_ne completed_two_ne
  187. have hb := remove_affine_factor m r ha G A B hA' hfe hf
  188. have hp : (fun z => completedEuler z / completedEuler 2) =ᶠ[𝓝 (2:ℂ)] centeredProduct m r := by
  189. filter_upwards [germ] with z hz
  190. rw [← hz, hf z, hb, zero_mul, Complex.exp_zero, mul_one, ← hA, mul_div_cancel_left₀ _ hA']
  191. have he := congrArg Complex.re (paired_identity_of_product m r ha hp)
  192. rw [Complex.ofReal_re] at he
  193. exact he ▸ separate_entries m r hs ha
  194. /-- Entire continuation of the Euler germ, if supplied, is unique. -/
  195. theorem unique_entire_continuation {G H : ℂ → ℂ} (hG : Differentiable ℂ G)
  196. (hH : Differentiable ℂ H) (gG : G =ᶠ[𝓝 (2:ℂ)] completedEuler)
  197. (gH : H =ᶠ[𝓝 (2:ℂ)] completedEuler) : G = H :=
  198. (hG.differentiableOn.analyticOnNhd isOpen_univ).eq_of_eventuallyEq
  199. (hH.differentiableOn.analyticOnNhd isOpen_univ) (gG.trans gH.symm)
  200. /-- Mellin identification at any point where the two coefficient expansions
  201. agree. Index n stands for the positive Fourier index n+1. -/
  202. theorem theta_equals_euler_of_coefficients {s : ℂ} (hs : 0 < s.re) (a : ℕ → ℂ)
  203. (heat : ∀ t : ℝ, 0 < t → HasSum (fun n : ℕ => a n *
  204. Real.exp (-(((n:ℝ)+1)/cubicConductorScale)*t)) (Theta.kernel t : ℂ))
  205. (absolute : Summable fun n : ℕ => ‖a n‖ / (((n:ℝ)+1)/cubicConductorScale)^s.re)
  206. (dirichlet : HasSum (fun n : ℕ => a n / (((n:ℝ)+1 : ℝ):ℂ)^s) (cubicEuler s)) :
  207. Theta.completion s = completedEuler s := by
  208. have hQ : 0 < cubicConductorScale := by unfold cubicConductorScale; positivity
  209. have h := hasSum_mellin (a := a) (p := fun n : ℕ => ((n:ℝ)+1)/cubicConductorScale)
  210. (fun _ => Or.inr (by positivity)) hs heat absolute
  211. rw [Theta.completion_eq_mellin]
  212. let C : ℂ := Complex.exp ((Real.log cubicConductorScale:ℂ)*s) * Complex.Gamma s
  213. apply h.unique
  214. change HasSum _ (C * cubicEuler s)
  215. convert dirichlet.mul_left C using 1
  216. funext n
  217. have hn : 0 < (n:ℝ)+1 := by positivity
  218. have he (v : ℝ) (hv : 0 < v) : (v:ℂ)^s = Complex.exp ((Real.log v : ℂ)*s) := by
  219. rw [Complex.cpow_def_of_ne_zero (Complex.ofReal_ne_zero.mpr hv.ne'), Complex.ofReal_log hv.le]
  220. rw [he _ (div_pos hn hQ), he _ hn, Real.log_div hn.ne' hQ.ne', Complex.ofReal_sub, sub_mul, Complex.exp_sub]
  221. dsimp [C]; field_simp
  222. /-- Specialization to the explicit theta completion. Its functional equation
  223. is proved in PrimeRaceTheta, so it is not a hypothesis here. -/
  224. theorem theta_zero_sum {ι : Type*} (m : ℕ) (r : ι → ℂ)
  225. (hs : ∀ i, 0 ≤ (r i).re ∧ (r i).re ≤ 1)
  226. (ha : Summable fun i => ‖pairCoeff (r i)‖)
  227. (A B : ℂ) (germ : Theta.completion =ᶠ[𝓝 (2:ℂ)] completedEuler)
  228. (hf : ∀ z, Theta.completion z = A * Complex.exp (B*(z-2)) * centeredProduct m r z) :
  229. HasSum (fun j => ((2-zeroEntries m r j)⁻¹).re)
  230. (Real.log cubicConductorScale + 1 - Real.eulerMascheroniConstant +
  231. ∑' n, eulerTermAtTwo n) :=
  232. zero_sum_of_continuation_factorization m r hs ha _ A B germ Theta.reflection hf
  233. end CubicPrimeRace
  234. #print axioms CubicPrimeRace.normalized_pair
  235. #print axioms CubicPrimeRace.paired_identity_of_product
  236. #print axioms CubicPrimeRace.remove_affine_factor
  237. #print axioms CubicPrimeRace.zero_sum_of_continuation_factorization
  238. #print axioms CubicPrimeRace.unique_entire_continuation
  239. #print axioms CubicPrimeRace.theta_zero_sum
  240. #print axioms CubicPrimeRace.theta_equals_euler_of_coefficients