module public import ConditionalGoldbach.Proofs.SpectralDiagonalBound /-! A uniform row-sum estimate for the diagonal Hardy Gram matrix. -/ public section set_option autoImplicit false noncomputable section open scoped BigOperators namespace ConditionalGoldbach private lemma mangoldt_prefix_le (M : ℕ) : (∑ j ∈ Finset.range M, mangoldt (j + 1)) ≤ (M : ℝ) * (Real.log 4 + 4) := by have he (k : ℕ) : (∑ j ∈ Finset.range k, mangoldt (j + 1)) = ∑ j ∈ Finset.Icc 1 k, mangoldt j := by induction k with | zero => simp | succ k ih => have hs : Finset.Icc 1 (k + 1) = insert (k + 1) (Finset.Icc 1 k) := by ext i simp only [Finset.mem_Icc, Finset.mem_insert] omega rw [Finset.sum_range_succ, ih, hs, Finset.sum_insert (by simp)] ring rw [he, mangoldt_partialSum_eq_psi, mul_comm] exact Chebyshev.psi_le_const_mul_self (Nat.cast_nonneg M) /-- Partial summation transfers the Chebyshev bound to any decreasing nonnegative weight. -/ private lemma mangoldt_sum_antitone_le (u : ℕ → ℝ) (hu : Antitone u) (hu0 : ∀ j, 0 ≤ u j) (M : ℕ) : (∑ j ∈ Finset.range M, mangoldt (j + 1) * u j) ≤ (Real.log 4 + 4) * ∑ j ∈ Finset.range M, u j := by let C : ℝ := Real.log 4 + 4 let mass := fun k => ∑ j ∈ Finset.range k, mangoldt (j + 1) have hmass (k : ℕ) : 0 ≤ (k : ℝ) * C - mass k := sub_nonneg.mpr (mangoldt_prefix_le k) have hb (k : ℕ) : (∑ j ∈ Finset.range k, mangoldt (j + 1) * u j) + ((k : ℝ) * C - mass k) * u k ≤ C * ∑ j ∈ Finset.range k, u j := by induction k with | zero => simp [mass] | succ k ih => have hstep := mul_le_mul_of_nonneg_left (hu (Nat.le_succ k)) (hmass (k + 1)) have hm : mass (k + 1) = mass k + mangoldt (k + 1) := Finset.sum_range_succ _ _ rw [hm, Nat.cast_succ] at hstep rw [Finset.sum_range_succ, Finset.sum_range_succ, hm, Nat.cast_succ] linarith exact (le_add_of_nonneg_right (mul_nonneg (hmass M) (hu0 M))).trans (hb M) private lemma overlap_div_le {x y : ℝ} (hx : 0 < x) (hy : 0 < y) : min (y / x) (x / y) / y ≤ 4 * x / (x + y) ^ 2 := by rcases le_total y x with h | h · calc _ ≤ (y / x) / y := div_le_div_of_nonneg_right (min_le_left _ _) hy.le _ = 1 / x := by field_simp _ ≤ _ := by apply (div_le_div_iff₀ hx (by positivity)).mpr have hsq : (x + y) ^ 2 ≤ (2 * x) ^ 2 := (sq_le_sq₀ (by positivity) (by positivity)).mpr (by linarith) linarith · calc _ ≤ (x / y) / y := div_le_div_of_nonneg_right (min_le_right _ _) hy.le _ = x / y ^ 2 := by ring _ ≤ _ := by apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr have hsq : (x + y) ^ 2 ≤ (2 * y) ^ 2 := (sq_le_sq₀ (by positivity) (by positivity)).mpr (by linarith) nlinarith [mul_le_mul_of_nonneg_left hsq hx.le] /-- For every finite section, the row mass of the exponentially decaying overlap `min(m/n,n/m)` against the tilted coprime diagonal is uniformly `O(1/a)`. -/ theorem diagonalCoefficient_overlap_sum_le (N n M : ℕ) (hn : 1 ≤ n) (a : ℝ) (ha : 0 < a) : (∑ j ∈ Finset.range M, diagonalCoefficient N j * (j + 1 : ℕ) ^ (-2 * a) * min ((j + 1 : ℕ) / (n : ℝ)) ((n : ℝ) / (j + 1 : ℕ))) ≤ 2 * (Real.log 4 + 4) / a := by let x : ℝ := n have hx : 0 < x := by dsimp [x]; exact_mod_cast (show 0 < n by omega) let u := fun j : ℕ => x / ((x + j) * (x + j + 1)) have hu0 (j : ℕ) : 0 ≤ u j := by dsimp [u]; positivity have hu : Antitone u := by intro j k hjk have hjk' : (j : ℝ) ≤ k := by exact_mod_cast hjk dsimp only [u] apply div_le_div_of_nonneg_left hx.le (by positivity) exact mul_le_mul (by linarith) (by linarith) (by positivity) (by positivity) have hu_sum (k : ℕ) : (∑ j ∈ Finset.range k, u j) = 1 - x / (x + k) := by induction k with | zero => simp [hx.ne'] | succ k ih => rw [Finset.sum_range_succ, ih, Nat.cast_succ] dsimp [u] have hk : x + k ≠ 0 := ne_of_gt (by positivity) have hks : x + k + 1 ≠ 0 := ne_of_gt (by positivity) rw [show x + ((k : ℝ) + 1) = x + k + 1 by ring] field_simp [hk, hks] <;> ring let C : ℝ := Real.log 4 + 4 have hsum : (∑ j ∈ Finset.range M, mangoldt (j + 1) * u j) ≤ C := by apply (mangoldt_sum_antitone_le u hu hu0 M).trans rw [hu_sum] have hC : 0 ≤ C := by dsimp [C]; positivity change C * (1 - x / (x + M)) ≤ C nlinarith [mul_nonneg hC (by positivity : 0 ≤ x / (x + M))] have hterm (j : ℕ) : diagonalCoefficient N j * (j + 1 : ℕ) ^ (-2 * a) * min ((j + 1 : ℕ) / x) (x / (j + 1 : ℕ)) ≤ (2 / a) * (mangoldt (j + 1) * u j) := by let y : ℝ := (j + 1 : ℕ) have hy : 0 < y := by dsimp [y]; positivity have hΛ : 0 ≤ mangoldt (j + 1) := ArithmeticFunction.vonMangoldt_nonneg have hcoeff : diagonalCoefficient N j ≤ mangoldt (j + 1) ^ 2 / y := by unfold diagonalCoefficient split_ifs · rfl · positivity have hΛw : mangoldt (j + 1) * y ^ (-2 * a) ≤ 1 / (2 * a) := by have hlog : mangoldt (j + 1) ≤ y ^ (2 * a) / (2 * a) := ArithmeticFunction.vonMangoldt_le_log.trans (Real.log_le_rpow_div hy.le (by positivity)) rw [show -2 * a = -(2 * a) by ring, Real.rpow_neg hy.le, ← div_eq_mul_inv] apply (div_le_iff₀ (Real.rpow_pos_of_pos hy _)).mpr linarith have hweight : min (y / x) (x / y) / y ≤ 4 * u j := by apply (overlap_div_le hx hy).trans have hyj : y = (j : ℝ) + 1 := by simp [y] rw [hyj, show x + ((j : ℝ) + 1) = x + j + 1 by ring] dsimp [u] rw [← mul_div_assoc] apply div_le_div_of_nonneg_left (by positivity) (by positivity) nlinarith [show 0 ≤ x + j + 1 by positivity] calc _ ≤ (mangoldt (j + 1) ^ 2 / y) * y ^ (-2 * a) * min (y / x) (x / y) := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hcoeff (Real.rpow_nonneg hy.le _)) (le_min (by positivity) (by positivity)) _ = mangoldt (j + 1) * (mangoldt (j + 1) * y ^ (-2 * a)) * (min (y / x) (x / y) / y) := by ring _ ≤ mangoldt (j + 1) * (1 / (2 * a)) * (4 * u j) := mul_le_mul (mul_le_mul_of_nonneg_left hΛw hΛ) hweight (div_nonneg (le_min (by positivity) (by positivity)) hy.le) (by positivity) _ = _ := by ring calc _ ≤ ∑ j ∈ Finset.range M, (2 / a) * (mangoldt (j + 1) * u j) := Finset.sum_le_sum (fun j _ => hterm j) _ = (2 / a) * ∑ j ∈ Finset.range M, mangoldt (j + 1) * u j := (Finset.mul_sum ..).symm _ ≤ (2 / a) * C := mul_le_mul_of_nonneg_left hsum (by positivity) _ = _ := by dsimp [C]; ring end ConditionalGoldbach