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

FKS2.Table4Ext.cell_eps_le_admissible_gen

PrimeNumberTheoremAnd.IEANTN.FKS2Tables.Table4ExtGenCore · PrimeNumberTheoremAnd/IEANTN/FKS2Tables/Table4ExtGenCore.lean:80 to 185

Source documentation

Transport: a checked cell dominates its table value by the row admissible curve on the whole cell [exp b, exp b']. The two transcendental constants are supplied as rational over-estimates (hCge, hrB).

Exact Lean statement

theorem cell_eps_le_admissible_gen
    (P : CellParams) (A B C R : ℝ)
    (hk : (P.k : ℝ) = 2 * B) (hB : 0 ≤ B) (hRpos : 0 < R) (hAnn : 0 ≤ A)
    (hAq : ((P.Aq : ℚ) : ℝ) = A)
    (hCge : C / Real.sqrt R ≤ ((P.c64 * 64 : ℚ) : ℝ))
    (hrB : R ^ B ≤ ((P.rB : ℚ) : ℝ))
    (c : Cell) (hc : checkCellGen P c = true) :
    ∀ x ∈ Set.Icc (exp (c.b : ℝ)) (exp (c.b' : ℝ)),
      (c.eps : ℝ) ≤ admissible_bound A B C R x

Complete declaration

Lean source

Canonical source
Full Lean sourceLean 4
theorem cell_eps_le_admissible_gen    (P : CellParams) (A B C R : )    (hk : (P.k : ) = 2 * B) (hB : 0  B) (hRpos : 0 < R) (hAnn : 0  A)    (hAq : ((P.Aq : ) : ) = A)    (hCge : C / Real.sqrt R  ((P.c64 * 64 : ) : ))    (hrB : R ^ B  ((P.rB : ) : ))    (c : Cell) (hc : checkCellGen P c = true) :     x  Set.Icc (exp (c.b : )) (exp (c.b' : )),      (c.eps : )  admissible_bound A B C R x := by  unfold checkCellGen at hc  split at hc  case isFalse => simp at hc  case isTrue hle =>    simp only [Bool.and_eq_true, decide_eq_true_eq] at hc    obtain ⟨⟨⟨⟨⟨heps, hslo0, hrBpos, hslo, hshi, hcheck := hc    have hslab := verify_expr_le_on_interval_dyadic (expSplitC P.c64)      (powRhs (P.Aq / (c.eps * P.rB)) P.k) c.slo, c.shi, hle (-50) 8      (by norm_num) hcheck    intro x hx    obtain hx_lo, hx_hi := hx    have hxpos : (0 : ) < x := lt_of_lt_of_le (exp_pos _) hx_lo    have hb_le : (c.b : )  Real.log x := (Real.le_log_iff_exp_le hxpos).mpr hx_lo    have hb'_ge : Real.log x  (c.b' : ) := (Real.log_le_iff_le_exp hxpos).mpr hx_hi    have hlog_nonneg : (0 : )  Real.log x := le_trans (Nat.cast_nonneg _) hb_le    set s :  := Real.sqrt (Real.log x) with hs_def    have h0lo : (0 : )  (c.slo : ) := by exact_mod_cast hslo0    have h0hi : (0 : )  (c.shi : ) := by      have : ((c.slo : ) : )  ((c.shi : ) : ) := by exact_mod_cast hle      linarith    have hs_lo : (c.slo : )  s := by      have h1 : ((c.slo : )) ^ 2  Real.log x := by        have hq : ((c.slo : )) * ((c.slo : ))  ((c.b : ) : ) := by exact_mod_cast hslo        calc ((c.slo : )) ^ 2 = ((c.slo : )) * ((c.slo : )) := pow_two _          _  ((c.b : ) : ) := hq          _  Real.log x := hb_le      calc (c.slo : ) = Real.sqrt (((c.slo : )) ^ 2) := (Real.sqrt_sq h0lo).symm        _  s := Real.sqrt_le_sqrt h1    have hs_hi : s  (c.shi : ) := by      have h1 : Real.log x  ((c.shi : )) ^ 2 := by        have hq : ((c.b' : ) : )  ((c.shi : )) * ((c.shi : )) := by exact_mod_cast hshi        calc Real.log x  ((c.b' : ) : ) := hb'_ge          _  ((c.shi : )) * ((c.shi : )) := hq          _ = ((c.shi : )) ^ 2 := (pow_two _).symm      calc s  Real.sqrt (((c.shi : )) ^ 2) := Real.sqrt_le_sqrt h1        _ = (c.shi : ) := Real.sqrt_sq h0hi    -- instantiate the slab inequality at s and rewrite evals    have hineq := hslab s hs_lo, hs_hi    rw [eval_expSplitC, eval_powRhs] at hineq    -- collapse (exp (c64·s))^64 = exp ((c64·64)·s)    have hexp64 : exp ((P.c64 : ) * s) ^ (64 : ) = exp (((P.c64 * 64 : ) : ) * s) := by      rw [ Real.exp_nat_mul]; congr 1; push_cast; ring    rw [hexp64] at hineq    have heps_pos : (0 : ) < (c.eps : ) := by exact_mod_cast heps    have hrBpos' : (0 : ) < (P.rB : ) := by exact_mod_cast hrBpos    have hs_nonneg : (0 : )  s := Real.sqrt_nonneg _    -- LHS: bound true exp by the checked (over-estimated) exp    have hCs : C / Real.sqrt R * s  ((P.c64 * 64 : ) : ) * s :=      mul_le_mul_of_nonneg_right hCge hs_nonneg    have hLHS : exp (C / Real.sqrt R * s)  exp (((P.c64 * 64 : ) : ) * s) :=      Real.exp_le_exp.mpr hCs    -- RHS coefficient: q = Aq/(eps·rB) ≤ A/(eps·R^B)    have hRBpos : (0 : ) < R ^ B := Real.rpow_pos_of_pos hRpos _    have hqle : ((P.Aq / (c.eps * P.rB) : ) : )  A / ((c.eps : ) * R ^ B) := by      rw [show ((P.Aq / (c.eps * P.rB) : ) : ) = A / ((c.eps : ) * (P.rB : )) by        push_cast [hAq]; ring]      exact div_le_div_of_nonneg_left hAnn (mul_pos heps_pos hRBpos)        (mul_le_mul_of_nonneg_left hrB heps_pos.le)    -- chain: exp(C/√R·s) ≤ exp(ĉ·s) ≤ q·s^k ≤ (A/(eps·R^B))·s^k    have hsk_nonneg : (0 : )  s ^ P.k := pow_nonneg hs_nonneg _    have hchain : exp (C / Real.sqrt R * s)  (A / ((c.eps : ) * R ^ B)) * s ^ P.k := by      calc exp (C / Real.sqrt R * s)           exp (((P.c64 * 64 : ) : ) * s) := hLHS        _  ((P.Aq / (c.eps * P.rB) : ) : ) * s ^ P.k := hineq        _  (A / ((c.eps : ) * R ^ B)) * s ^ P.k :=            mul_le_mul_of_nonneg_right hqle hsk_nonneg    -- multiply by eps, divide by exp, identify the curve    have hexp_pos : (0 : ) < exp (C / Real.sqrt R * s) := exp_pos _    have h2 : (c.eps : ) * exp (C / Real.sqrt R * s)  (A / R ^ B) * s ^ P.k := by      have := mul_le_mul_of_nonneg_left hchain heps_pos.le      calc (c.eps : ) * exp (C / Real.sqrt R * s)           (c.eps : ) * ((A / ((c.eps : ) * R ^ B)) * s ^ P.k) := this        _ = (A / R ^ B) * s ^ P.k := by field_simp    have key : (c.eps : )  (A / R ^ B) * s ^ P.k * exp (-(C / Real.sqrt R * s)) := by      have h4 := mul_le_mul_of_nonneg_right h2 (le_of_lt (inv_pos.mpr hexp_pos))      rw [mul_assoc, mul_inv_cancel₀ (ne_of_gt hexp_pos), mul_one] at h4      rw [Real.exp_neg]; exact h4    -- curve identity: admissible_bound A B C R x = (A/R^B)·s^k·exp(−(C/√R)·s)    have hs_rpow : s = Real.log x ^ ((1 : ) / 2) := by rw [hs_def, Real.sqrt_eq_rpow]    have hsqrtR : Real.sqrt R = R ^ ((1 : ) / 2) := Real.sqrt_eq_rpow R    have hRnn : (0 : )  R := hRpos.le    have hpowk : Real.log x ^ B = s ^ P.k := by      rw [hs_rpow,  Real.rpow_natCast (Real.log x ^ ((1 : ) / 2)) P.k,         Real.rpow_mul hlog_nonneg]      rw [show (1 : ) / 2 * (P.k : ) = B by rw [hk]; ring]    have hcurve : admissible_bound A B C R x        = (A / R ^ B) * s ^ P.k * exp (-(C / Real.sqrt R * s)) := by      unfold admissible_bound      have e1 : (Real.log x / R) ^ B = s ^ P.k / R ^ B := by        rw [Real.div_rpow hlog_nonneg hRnn, hpowk]      have e2 : (Real.log x / R) ^ ((1 : ) / 2) = s / Real.sqrt R := by        rw [Real.div_rpow hlog_nonneg hRnn,  hs_rpow, hsqrtR]      rw [e1, e2]      rw [show C / Real.sqrt R * s = C * (s / Real.sqrt R) by ring]      ring    rw [hcurve]    exact key