Skip to main content
AlexKontorovich/PrimeNumberTheoremAnd
Source indexedlemma · leanprover/lean4:v4.32.0

FKS2.BKLNW_a2_le_five_mul_of_ge_1000

PrimeNumberTheoremAnd.IEANTN.FKS2 · PrimeNumberTheoremAnd/IEANTN/FKS2.lean:775 to 884

Source documentation

A crude linear bound on BKLNW.a₂ at large t. Any linear bound is enough; ≤ 5*t is extremely safe for t ≥ 1000.

Exact Lean statement

lemma BKLNW_a2_le_five_mul_of_ge_1000 (t : ℝ) (ht : t ≥ 1000) :
    BKLNW.a₂ t ≤ 5 * t

Complete declaration

Lean source

Canonical source
Full Lean sourceLean 4
lemma BKLNW_a2_le_five_mul_of_ge_1000 (t : ) (ht : t  1000) :    BKLNW.a₂ t  5 * t := by  -- Sketch:  -- unfold `BKLNW.a₂` -> `Inputs.default.a₂`:  --   `(1+α) * max (f (exp t)) (f (2^(⌊t/log 2⌋₊ + 1)))`.  -- Bound `f x` by the number of terms:  --   for `x ≥ 1`, each summand `x^(1/k - 1/3) ≤ 1`,  --   hence `f x ≤ (⌊log x / log 2⌋₊ + 1)` (cast to ℝ).  -- Use this for both `exp t` and the dyadic point; conclude  --   `a₂ t ≤ 2 * (t / log 2 + 3)` and then `≤ 5*t` from `ht` + `norm_num`.  have ht_nonneg : 0  t := by linarith  have hlog2_pos : 0 < log 2 := log_pos one_lt_two  set n :  := ⌊t / log 2⌋₊   have hf_nonneg (x : ) (hx : 0  x) : 0  BKLNW.f x := by    unfold BKLNW.f    exact Finset.sum_nonneg (fun _ _  Real.rpow_nonneg hx _)   have hf_le_floor_plus_one (x : ) (hx : 1  x) :      BKLNW.f x  (⌊(log x) / (log 2)⌋₊ + 1 : ) := by    have hterm :         k  Finset.Icc 3 ⌊(log x) / (log 2)⌋₊, x ^ (1 / (k : ) - 1 / (3 : ) : )  (1 : ) := by      intro k hk      have hk3 : (3 : )  k := (Finset.mem_Icc.mp hk).1      have hk3' : (3 : )  k := by exact_mod_cast hk3      have hpow_le_zero : (1 / (k : ) - 1 / (3 : ) : )  0 := by        have : (1 / (k : ) : )  1 / (3 : ) := by          exact one_div_le_one_div_of_le (by norm_num) hk3'        linarith      have hxpow : x ^ (1 / (k : ) - 1 / (3 : ) : )  x ^ (0 : ) :=        Real.rpow_le_rpow_of_exponent_le hx hpow_le_zero      simpa using hxpow    have hcard :        Finset.card (Finset.Icc 3 ⌊(log x) / (log 2)⌋₊)  ⌊(log x) / (log 2)⌋₊ + 1 := by      calc        Finset.card (Finset.Icc 3 ⌊(log x) / (log 2)⌋₊)             Finset.card (Finset.Icc 0 ⌊(log x) / (log 2)⌋₊) := by              apply Finset.card_le_card              intro m hm              exact Finset.mem_Icc.mpr Nat.zero_le m, (Finset.mem_Icc.mp hm).2        _ = ⌊(log x) / (log 2)⌋₊ + 1 := by simp    calc      BKLNW.f x  ∑ k  Finset.Icc 3 ⌊(log x) / (log 2)⌋₊, (1 : ) := by        unfold BKLNW.f        exact Finset.sum_le_sum hterm      _ = (Finset.card (Finset.Icc 3 ⌊(log x) / (log 2)⌋₊) : ) := by        simp      _  (⌊(log x) / (log 2)⌋₊ + 1 : ) := by exact_mod_cast hcard   have hexp_ge_one : (1 : )  exp t := by    have : exp (0 : )  exp t := exp_le_exp_of_le ht_nonneg    simpa using this  have hf_exp : BKLNW.f (exp t)  t / log 2 + 2 := by    calc      BKLNW.f (exp t)  (⌊(log (exp t)) / (log 2)⌋₊ + 1 : ) :=        hf_le_floor_plus_one (exp t) hexp_ge_one      _ = (⌊t / log 2⌋₊ + 1 : ) := by simp      _  t / log 2 + 1 := by        nlinarith [Nat.floor_le (div_nonneg ht_nonneg hlog2_pos.le)]      _  t / log 2 + 2 := by linarith   have hpow_ge_one : (1 : )  2 ^ (n + 1 : ) := by    exact one_le_pow₀ (by norm_num : (1 : )  2)  have hf_pow : BKLNW.f (2 ^ (n + 1 : ))  t / log 2 + 2 := by    have hfloor_pow : ⌊(log ((2 : ) ^ (n + 1))) / (log 2)⌋₊ = n + 1 := by      have hlog2_ne : (log 2 : )  0 := hlog2_pos.ne'      rw [log_pow, show (((n + 1 : ) : ) * log 2 / log 2) = ((n + 1 : ) : ) by        field_simp [hlog2_ne]]      simpa using (Nat.floor_natCast (n + 1))    calc      BKLNW.f (2 ^ (n + 1 : ))  (⌊(log ((2 : ) ^ (n + 1))) / (log 2)⌋₊ + 1 : ) :=        hf_le_floor_plus_one ((2 : ) ^ (n + 1 : )) hpow_ge_one      _ = (n : ) + 2 := by        rw [hfloor_pow, Nat.cast_add, Nat.cast_one]        ring      _  t / log 2 + 2 := by        nlinarith [Nat.floor_le (div_nonneg ht_nonneg hlog2_pos.le)]   have hmax :      max (BKLNW.f (exp t)) (BKLNW.f (2 ^ (⌊t / log 2⌋₊ + 1)))  t / log 2 + 2 := by    refine max_le hf_exp ?_    simpa [n] using hf_pow   have hfac : (1 + BKLNW.Inputs.default.α : )  2 := by    change 1 + 1.93378e-8 * BKLNW_app.table_8_margin  2    norm_num [BKLNW_app.table_8_margin]  have hmax_nonneg :      0  max (BKLNW.f (exp t)) (BKLNW.f (2 ^ (⌊t / log 2⌋₊ + 1))) := by    exact le_trans (hf_nonneg (exp t) (by positivity)) (le_max_left _ _)   have ha2_le : BKLNW.a₂ t  2 * (t / log 2 + 2) := by    unfold BKLNW.aBKLNW.Inputs.a    calc      (1 + BKLNW.Inputs.default.α) *          max (BKLNW.f (exp t)) (BKLNW.f (2 ^ (⌊t / log 2⌋₊ + 1)))           2 * max (BKLNW.f (exp t)) (BKLNW.f (2 ^ (⌊t / log 2⌋₊ + 1))) := by            exact mul_le_mul_of_nonneg_right hfac hmax_nonneg      _  2 * (t / log 2 + 2) := by gcongr   have hcoef : (2 / log 2 : ) < 3 := by    have hlog : (2 / 3 : ) < log 2 := by linarith [Real.log_two_gt_d9]    refine (div_lt_iff₀ hlog2_pos).2 ?_    nlinarith [hlog]  have hlin : 2 * (t / log 2 + 2)  5 * t := by    calc      2 * (t / log 2 + 2) = (2 / log 2) * t + 4 := by ring      _  3 * t + 4 := by nlinarith [le_of_lt hcoef, ht_nonneg]      _  5 * t := by linarith [ht]   exact ha2_le.trans hlin