AlexKontorovich/PrimeNumberTheoremAnd
Source indexedtheorem · leanprover/lean4:v4.32.0
BrunTitchmarsh.IsBigO.nat_Top_of_atTop
PrimeNumberTheoremAnd.BrunTitchmarsh · PrimeNumberTheoremAnd/BrunTitchmarsh.lean:400 to 422
Mathematical statement
Exact Lean statement
theorem IsBigO.nat_Top_of_atTop (f g : ℕ → ℝ) (h : f =O[Filter.atTop] g)
(h0 : ∀ n, g n = 0 → f n = 0) : f =O[⊤] gComplete declaration
Lean source
Full Lean sourceLean 4
theorem IsBigO.nat_Top_of_atTop (f g : ℕ → ℝ) (h : f =O[Filter.atTop] g) (h0 : ∀ n, g n = 0 → f n = 0) : f =O[⊤] g := by simp only [Asymptotics.isBigO_top, Real.norm_eq_abs] rw [Asymptotics.isBigO_atTop_iff_eventually_exists] at h simp only [ge_iff_le, Real.norm_eq_abs, Filter.eventually_atTop] at h obtain ⟨N, hN⟩ := h specialize hN N le_rfl obtain ⟨c, hc⟩ := hN let C := Finset.max' (insert c ((Finset.range N).image (fun n ↦ |f n| * |g n|⁻¹))) (by simp) refine ⟨C, fun n ↦ ?_⟩ by_cases hn : N ≤ n · calc |f n| ≤ c * |g n| := hc n hn _ ≤ C * |g n| := by gcongr apply Finset.le_max' simp · by_cases hg : g n = 0 · simp [hg, h0] rw [← mul_inv_le_iff₀] · apply Finset.le_max' simp only [Finset.mem_insert, Finset.mem_image, Finset.mem_range] exact .inr ⟨n, by omega, rfl⟩ · simp [hg]