roseking's picture
Add lean source and binary files (part 115)
b797a5b verified
Raw History Blame Contribute Delete
6.97 kB
import OAI.NumberTheory.PrimeGaps.RieszDecay
namespace OAI
namespace LargePrimeGaps
open Complex Real Set MeasureTheory Filter Topology
open Complex Filter Topology
open Complex Filter Topology MeasureTheory
open scoped FourierTransform
open Complex Real Set MeasureTheory Filter Topology
open Complex Real Set MeasureTheory Filter Topology
open Complex Real Set MeasureTheory Filter Topology
open scoped FourierTransform
open Complex Real Set MeasureTheory Filter Topology
open Complex Real Set MeasureTheory Filter Topology
open Complex Real Set MeasureTheory Filter Topology
lemma primeCharacterError_log_bound (A B : ℝ) (hA : 0<A) (hB : 0<B) :
∃ M : ℝ, 0<M ∧ ∀ (q : ℕ) [NeZero q] (χ : DirichletCharacter ℂ q), χ.IsPrimitive →
∀ x : ℝ, 2≤x → 1≤Real.log x → (Real.log x)^(2*A+2)≤x →
(q:ℝ)≤(Real.log x)^B →
‖primeCharacterError x χ‖≤M*x*(Real.log x)^(-A) := by
obtain ⟨D,hD,hb⟩ := primeWeighted_error_bound (B+2*A+2)
refine ⟨15*D+8,by positivity,?_⟩
intro q _ χ hp x hx hL hpower hq
let L := Real.log x
let K := A+2
let a := B+2*A+2
let Q := ((q:ℝ)+2)^(1/2:ℝ)
let h := x/L^K
have hx0 : 0<x := by linarith
have hx1 : 1<x := by linarith
have hL0 : 0<L := lt_of_lt_of_le zero_lt_one hL
have hK : 0<K := by dsimp [K]; linarith
have ha : 0<a := by dsimp [a]; linarith
have hpK : 0<L^K := Real.rpow_pos_of_pos hL0 _
have hh0 : 0<h := div_pos hx0 hpK
have hK1 : 1≤L^K := Real.one_le_rpow hL hK.le
have hhx : h≤x := (div_le_self hx0.le hK1)
have hKh : L^K≤x := by
apply (Real.rpow_le_rpow_of_exponent_le hL (show K≤2*A+2 by dsimp [K]; linarith)).trans
exact hpower
have hh1 : 1≤h := (le_div_iff₀ hpK).mpr (by simpa using hKh)
have hyx : x≤x+h := by linarith
have hy : 1<x+h := by linarith
have hy2 : x+h≤2*x := by linarith
have hLy : L≤Real.log (x+h) := Real.log_le_log hx0 hyx
have hLy1 : 1≤Real.log (x+h) := hL.trans hLy
have hLy2 : Real.log (x+h)≤2*L := by
calc
_ ≤ Real.log (x^2) := Real.log_le_log (by linarith) (by nlinarith)
_ = _ := by rw [Real.log_pow]; rfl
have hQ0 : 0≤Q := by dsimp [Q]; positivity
have hQ : Q≤3*L^B := by
have hq2 : 1≤(q:ℝ)+2 := by have := Nat.cast_nonneg (α:=ℝ) q; linarith
have hqpow : Q≤(q:ℝ)+2 := by
simpa only [Real.rpow_one] using
Real.rpow_le_rpow_of_exponent_le hq2 (show (1/2:ℝ)≤1 by norm_num)
have hLB : 1≤L^B := Real.one_le_rpow hL hB.le
linarith
let E (y : ℝ) := ‖weightedPrefix (primeCoefficients χ) y-characterMain χ*(y:ℂ)^2/2‖
have hEx : E x≤D*Q*x^2*L^(-a)+x := hb q χ hp x hx1 hL
have hEy : E (x+h)≤4*D*Q*x^2*L^(-a)+2*x := by
calc
_ ≤ D*Q*(x+h)^2*(Real.log (x+h))^(-a)+(x+h) := hb q χ hp (x+h) hy hLy1
_ ≤ D*Q*(2*x)^2*L^(-a)+2*x := by
apply add_le_add _ hy2
apply mul_le_mul _ (Real.rpow_le_rpow_of_nonpos hL0 hLy (neg_nonpos.mpr ha.le)) (by positivity) (by positivity)
gcongr
_ = _ := by ring
have hcoeff (n : ℕ) (hn : n∈Finset.Ioc ⌊x⌋₊ ⌊x+h⌋₊) :
‖primeCoefficients χ n‖≤2*L := by
have hn0 : 0<(n:ℝ) := by exact_mod_cast (show 0<n by have := (Finset.mem_Ioc.mp hn).1; omega)
have hnx : (n:ℝ)≤x+h := (Nat.le_floor_iff (by linarith : 0≤x+h)).mp (Finset.mem_Ioc.mp hn).2
exact (primeCoefficients_norm_le χ n).trans ((Real.log_le_log hn0 hnx).trans hLy2)
have heq : primeCharacterError x χ=
(∑ n∈Finset.Ioc 0 ⌊x⌋₊, primeCoefficients χ n)-characterMain χ*(x:ℂ) := by
classical
simp only [primeCharacterError,primeCharacterPrefix,primeCoefficients,characterMain]
split_ifs <;> simp
rw [heq]
have hu := prefix_unsmoothing hx0.le hh0 (show 0≤2*L by positivity)
(primeCoefficients χ) (characterMain χ) hcoeff
change _≤(E (x+h)+E x)/h+(h+1)*(2*L)+‖characterMain χ‖*h/2 at hu
have hδ : ‖characterMain χ‖*h/2≤h := by
have := mul_le_mul_of_nonneg_right (characterMain_norm_le χ) hh0.le
linarith
have htail : (h+1)*(2*L)≤4*h*L := by nlinarith
have herr : (E (x+h)+E x)/h ≤ 15*D*x*L^(-A)+3*x*L^(-A) := by
calc
_ ≤ (5*D*Q*x^2*L^(-a)+3*x)/h := by
apply div_le_div_of_nonneg_right _ hh0.le
linarith
_ ≤ (5*D*(3*L^B)*x^2*L^(-a)+3*x)/h := by gcongr
_ = (15*D*L^B*x^2*L^(-a)+3*x)/h := by ring
_ = 15*D*x*L^(-A)+3*L^K := by
dsimp [h]
rw [div_eq_mul_inv,inv_div]
have hr : L^B*L^(-a)*L^K=L^(-A) := by
rw [←Real.rpow_add hL0,←Real.rpow_add hL0]
congr 1
dsimp [a,K]
ring
field_simp
linear_combination 15*D*x*hr
_ ≤ _ := by
have ht : L^K≤x*L^(-A) := by
calc
_ = L^(2*A+2)*L^(-A) := by rw [←Real.rpow_add hL0]; congr 1; dsimp [K]; ring
_ ≤ _ := mul_le_mul_of_nonneg_right hpower (by positivity)
nlinarith [ht]
have hsmall : h≤x*L^(-A) := by
dsimp [h]
rw [div_eq_mul_inv,←Real.rpow_neg hL0.le]
exact mul_le_mul_of_nonneg_left
(Real.rpow_le_rpow_of_exponent_le hL (show -K≤-A by dsimp [K]; linarith)) hx0.le
have htail' : 4*h*L≤4*x*L^(-A) := by
calc
_ = 4*x*L^(1-K) := by
dsimp [h]
rw [div_eq_mul_inv,Real.rpow_sub hL0,Real.rpow_one]
ring
_ ≤ _ := mul_le_mul_of_nonneg_left
(Real.rpow_le_rpow_of_exponent_le hL (show 1-K≤-A by dsimp [K]; linarith)) (by positivity)
calc
_ ≤ (E (x+h)+E x)/h+(h+1)*(2*L)+‖characterMain χ‖*h/2 := hu
_ ≤ (15*D*x*L^(-A)+3*x*L^(-A))+4*x*L^(-A)+x*L^(-A) :=
add_le_add (add_le_add herr (htail.trans htail')) (hδ.trans hsmall)
_ = _ := by ring
theorem siegelWalfisz : SiegelWalfisz := by
intro A B hA hB
obtain ⟨M,hM,hb⟩ := primeCharacterError_log_bound A B hA hB
have hevent : ∀ᶠ x : ℝ in atTop, 2≤x ∧ 1≤Real.log x ∧ (Real.log x)^(2*A+2)≤x := by
filter_upwards [eventually_ge_atTop (2:ℝ),eventually_ge_atTop (Real.exp 1),
eventually_log_rpow_le_rpow (2*A+2) (by norm_num : (0:ℝ)<1)] with x hx hex hp
refine ⟨hx,?_,by simpa only [Real.rpow_one] using hp⟩
rw [←Real.log_exp (1:ℝ)]
exact Real.log_le_log (Real.exp_pos _) hex
obtain ⟨x₀,hx₀⟩ := eventually_atTop.mp hevent
refine ⟨M,hM,max x₀ 2,by have := le_max_right x₀ (2:ℝ); linarith,?_⟩
intro x hx d hd hdlog χ hχ
let : NeZero d := ⟨ne_of_gt hd⟩
obtain ⟨hx2,hlog,hpower⟩ := hx₀ x ((le_max_left _ _).trans hx)
exact hb d χ hχ x hx2 hlog hpower hdlog
theorem bombieriVinogradov : BombieriVinogradov :=
bombieriVinogradov_of_siegelWalfisz siegelWalfisz
theorem main : ∀ C : ℝ, 0 < C →
∃ c : ℝ, 0 < c ∧ ∃ N₀ : ℕ, ∀ N : ℕ, N₀ ≤ N →
c * (N : ℝ) ≤ ((largeGapIndices C N).card : ℝ) :=
index_density_of_bombieriVinogradov bombieriVinogradov
end LargePrimeGaps
end OAI