import Mathlib.NumberTheory.LSeries.HurwitzZetaEven /-! An explicit weight-one theta candidate for the global continuation. The Mellin transform is entire and symmetric; agreement with the cubic Euler product is a separate arithmetic identity. -/ noncomputable section open Real HurwitzZeta Asymptotics Filter Set MeasureTheory Topology namespace CubicPrimeRace namespace Theta /-- θ(d²x), with θ(x) = ∑_{n∈ℤ} exp(−πn²x). -/ def theta (d x : ℝ) := evenKernel 0 (d^2*x) private theorem inversion {d x : ℝ} (hd : 0 < d) (hx : 0 < x) : theta d (1/x) = (Real.sqrt x / d) * theta d⁻¹ x := by unfold theta rw [evenKernel_functional_equation 0 (d^2*(1/x)), ← evenKernel_eq_cosKernel_of_zero, ← Real.sqrt_eq_rpow, Real.sqrt_mul (sq_nonneg d), Real.sqrt_sq hd.le, one_div x, Real.sqrt_inv] congr 1 <;> field_simp private theorem continuous_theta {d : ℝ} (hd : 0 < d) : ContinuousOn (theta d) (Ioi 0) := (continuousOn_evenKernel 0).comp (by fun_prop) (fun x hx => mul_pos (sq_pos_of_pos hd) hx) private theorem rapid_theta {d : ℝ} (hd : 0 < d) (r : ℝ) : (fun x => theta d x - 1) =O[atTop] (fun x : ℝ => x^r) := by obtain ⟨c,hc,h⟩ := isBigO_atTop_evenKernel_sub 0 simp only [if_true] at h have hlim : Tendsto (fun x : ℝ => d^2*x) atTop atTop := tendsto_id.const_mul_atTop (sq_pos_of_pos hd) have h' := h.comp_tendsto hlim have he := (isLittleO_exp_neg_mul_rpow_atTop (mul_pos hc (sq_pos_of_pos hd)) r).isBigO apply h'.trans convert he using 1 funext x; change Real.exp (-c * (d^2*x)) = _ congr 1; ring private def prodTheta (d e x : ℝ) := theta d x * theta e x private def block (d e x : ℝ) := prodTheta d e x + (d*e)⁻¹ * prodTheta d⁻¹ e⁻¹ x private def blockLimit (d e : ℝ) := 1+(d*e)⁻¹ private def centered (d e x : ℝ) := block d e x - blockLimit d e private theorem block_inv {d e x : ℝ} (hd : 0 < d) (he : 0 < e) (hx : 0 < x) : block d e (1/x) = x * block d e x := by unfold block prodTheta rw [inversion hd hx, inversion he hx, inversion (inv_pos.mpr hd) hx, inversion (inv_pos.mpr he) hx] simp only [inv_inv] have hsq := Real.sq_sqrt hx.le field_simp linear_combination (norm := ring_nf) (d*e*theta d x*theta e x + theta d⁻¹ x*theta e⁻¹ x)*hsq private theorem rapid_prod {d e : ℝ} (hd : 0 < d) (he : 0 < e) (r : ℝ) : (fun x => prodTheta d e x - 1) =O[atTop] (fun x : ℝ => x^r) := by have h := (rapid_theta hd r).mul (rapid_theta he 0) simp only [Real.rpow_zero, mul_one] at h convert (h.add (rapid_theta hd r)).add (rapid_theta he r) using 1 funext x; dsimp [prodTheta]; ring private theorem rapid_centered {d e : ℝ} (hd : 0 < d) (he : 0 < e) (r : ℝ) : (fun x => centered d e x) =O[atTop] (fun x : ℝ => x^r) := by have h := (rapid_prod hd he r).add ((rapid_prod (inv_pos.mpr hd) (inv_pos.mpr he) r).const_mul_left ((d*e)⁻¹)) convert h using 1 funext x; dsimp [centered, block, blockLimit]; ring private theorem continuous_centered {d e : ℝ} (hd : 0 < d) (he : 0 < e) : ContinuousOn (centered d e) (Ioi 0) := by unfold centered block prodTheta exact (((continuous_theta hd).mul (continuous_theta he)).add (continuousOn_const.mul ((continuous_theta (inv_pos.mpr hd)).mul (continuous_theta (inv_pos.mpr he))))).sub continuousOn_const private def combination (f : ℝ → ℝ → ℝ) (d : ℝ) := (f d (2*d⁻¹) + f (2*d) d⁻¹ - 2*f (2*d) (2*d⁻¹) - (1/4)*f d d⁻¹)/2 /-- d² = 1/√27 gives the determinant-27 scaling of the discriminant −108 binary forms. The factor 1/2 normalizes the first Fourier coefficient. -/ def scale : ℝ := (Real.sqrt (Real.sqrt 27))⁻¹ def kernel (x : ℝ) := combination (fun d e => centered d e x) scale private theorem hscale : 0 < scale := by unfold scale; positivity private theorem constant_cancels {d : ℝ} (hd : d ≠ 0) : combination blockLimit d = 0 := by dsimp [combination, blockLimit] field_simp; ring private theorem kernel_uncentered (x : ℝ) : kernel x = combination (fun d e => block d e x) scale := by have h := constant_cancels hscale.ne' dsimp only [kernel, combination, centered] at * linarith theorem kernel_inversion {x : ℝ} (hx : 0 < x) : kernel (1/x) = x * kernel x := by rw [kernel_uncentered, kernel_uncentered] dsimp only [combination] have hd := hscale rw [block_inv hd (by positivity) hx, block_inv (by positivity) (inv_pos.mpr hd) hx, block_inv (by positivity) (by positivity) hx, block_inv hd (inv_pos.mpr hd) hx] ring private theorem kernel_rapid (r : ℝ) : kernel =O[atTop] (fun x : ℝ => x^r) := by have hd := hscale have h1 := rapid_centered hd (show 0 < 2*scale⁻¹ by positivity) r have h2 := rapid_centered (show 0 < 2*scale by positivity) (inv_pos.mpr hd) r have h3 := rapid_centered (show 0 < 2*scale by positivity) (show 0 < 2*scale⁻¹ by positivity) r have h4 := rapid_centered hd (inv_pos.mpr hd) r convert (((h1.add h2).sub (h3.const_mul_left 2)).sub (h4.const_mul_left (1/4))).const_mul_left (1/2) using 1 funext x; dsimp [kernel, combination]; ring private theorem kernel_continuous : ContinuousOn kernel (Ioi 0) := by have hd := hscale have h1 := continuous_centered hd (show 0 < 2*scale⁻¹ by positivity) have h2 := continuous_centered (show 0 < 2*scale by positivity) (inv_pos.mpr hd) have h3 := continuous_centered (show 0 < 2*scale by positivity) (show 0 < 2*scale⁻¹ by positivity) have h4 := continuous_centered hd (inv_pos.mpr hd) exact ((((h1.add h2).sub (continuousOn_const.mul h3)).sub (continuousOn_const.mul h4))).div_const 2 private def fePair : StrongFEPair ℂ where f := fun x => (kernel x : ℂ) g := fun x => (kernel x : ℂ) k := 1 ε := 1 f₀ := 0 g₀ := 0 hk := zero_lt_one hε := one_ne_zero hf₀ := rfl hg₀ := rfl hf_int := (Complex.continuous_ofReal.comp_continuousOn kernel_continuous).locallyIntegrableOn measurableSet_Ioi hg_int := (Complex.continuous_ofReal.comp_continuousOn kernel_continuous).locallyIntegrableOn measurableSet_Ioi h_feq := fun x hx => by rw [kernel_inversion hx]; simp hf_top := fun r => by simpa using (Complex.isBigO_ofReal_left.mpr (kernel_rapid r)) hg_top := fun r => by simpa using (Complex.isBigO_ofReal_left.mpr (kernel_rapid r)) /-- The Mellin transform of the explicit theta kernel. -/ def completion : ℂ → ℂ := fePair.Λ theorem completion_eq_mellin : completion = mellin (fun x => (kernel x : ℂ)) := rfl theorem entire_completion : Differentiable ℂ completion := fePair.differentiable_Λ theorem reflection (s : ℂ) : completion (1-s) = completion s := by simpa [completion, StrongFEPair.Λ, StrongFEPair.symm, WeakFEPair.symm, fePair] using fePair.functional_equation s end Theta end CubicPrimeRace #print axioms CubicPrimeRace.Theta.kernel_inversion #print axioms CubicPrimeRace.Theta.entire_completion #print axioms CubicPrimeRace.Theta.reflection