import Zeta23.Unconditional

open Zeta23

/-- Keep the same threshold and error term when lowering the certified coefficient.
    Choose the numerator count and window via counted and total. -/
theorem lowerCoefficient {k q : ℝ} {total counted : ℝ → ℕ}
    (hq : q ≤ k)
    (bound : ∀ ε > 0, ∃ T₀ : ℝ, ∀ T ≥ T₀, (k - ε) * (total T : ℝ) ≤ counted T) :
    ∀ ε > 0, ∃ T₀ : ℝ, ∀ T ≥ T₀, (q - ε) * (total T : ℝ) ≤ counted T := by
  intro ε hε
  obtain ⟨T₀, h⟩ := bound ε hε
  refine ⟨T₀, fun T hT => ?_⟩
  exact (mul_le_mul_of_nonneg_right (sub_le_sub_right hq ε) (Nat.cast_nonneg (total T))).trans (h T hT)

/-- Worked arithmetic with a historical bound. Substitute your own proven estimate
    and a rational that strictly beats the incumbent when preparing a submission. -/
example : ∀ ε > 0, ∃ T₀ : ℝ, ∀ T ≥ T₀,
    (666 / 1000 - ε) * (Ncount 0 T : ℝ) ≤ N0star 0 T :=
  lowerCoefficient (total := fun T => Ncount 0 T) (counted := fun T => N0star 0 T)
    (k := 2 / 3) (by norm_num) two_thirds_on_critical_line_cumulative
