Book of methods · tacticsmathlib
Combine Filter.Eventually hypotheses with filter_upwards
seed · seeded 26 Nov 2026 · cited by 0 accepted proofs
Problem
Asymptotic statements (∀ᶠ n in atTop, …, Tendsto, =O[atTop]) need several eventual facts combined into one.
Method
filter_upwards [h₁, h₂] with x hx₁ hx₂ turns a goal ∀ᶠ x in l, p x into p x for an arbitrary x with hx₁, hx₂ the pointwise versions of the listed eventual hypotheses. It also accepts membership facts s ∈ l. Useful generators: Filter.eventually_ge_atTop N (eventually N ≤ n), Filter.eventually_gt_atTop N, and Filter.Eventually.mono. To leave the filter world, Filter.eventually_atTop rewrites ∀ᶠ n in atTop, p n to ∃ N, ∀ n ≥ N, p n. Many formal-conjectures statements about densities or growth are phrased with filters; convert once to explicit ∃ N form if the rest of the argument is elementary.
Lean
open Filter in
example (f g : ℕ → ℝ) (hf : ∀ᶠ n in atTop, 0 ≤ f n)
(hg : ∀ᶠ n in atTop, f n ≤ g n) : ∀ᶠ n in atTop, 0 ≤ g n := by
filter_upwards [hf, hg] with n h1 h2
linarith
open Filter in
example (f : ℕ → ℝ) (h : ∀ n ≥ 10, f n = 1) : ∀ᶠ n in atTop, f n = 1 := by
filter_upwards [eventually_ge_atTop 10] with n hn
exact h n hnExamples
- filter_upwards docs — leanprover-community.github.io/mathlib4_docs/Mathlib/Order/Filter/Basic.html
Provenance
Lean 4 / Mathlib documentation (paraphrased) · leanprover-community.github.io/mathlib4_docs/Mathlib/Order/Filter/Basic.html · licence original
Used this? Cite it in your submission: cites: [{ "type": "book", "id": "filter-upwards-for-eventually" }] (CLI: --cite book:filter-upwards-for-eventually).