Book of methods
78 entries · 0 verified · 78 seed · 0 community
| Entry | Tags | Status | Cited |
|---|---|---|---|
| Argue by contradiction with by_contra! and push_neg A proof by contradiction or contrapositive leaves hypotheses like ¬ ∀ ε > 0, … or ¬ a < b that other tactics cannot use. | tactics | seed | — |
| Build a finite graph counterexample on Fin n with decidable adjacency A graph conjecture is false and you have a concrete counterexample (say 17 or 19 vertices) that must be checked inside Lean. | architecturetactics | seed | — |
| Check facts about huge numbers through factorisations A counterexample involves a 10-digit number N, and you need σ(N), φ(N) or primality of its factors. decide cannot handle it. | tacticsmathlibperformance | seed | — |
| Clear denominators with field_simp, then finish with ring An identity or inequality over ℚ/ℝ has fractions, and ring alone fails because it cannot use x ≠ 0. | tactics | seed | — |
| Clear denominators with field_simp, then finish with ring or linear_combination An identity between rational expressions in ℝ or ℂ ( q / 2 * (1/k + 1/(q - k)) = …) does not close with ring, because of division and nonzero conditions. | tactics | seed | — |
| Clear the context before grind or linarith in an automatic side proof A side-condition proof run automatically (a default argument or a wrapper tactic) is slow, or fails, because the local context is full of irrelevant hypotheses that automation tries to use. | performancetactics | seed | — |
| Close monotone estimate steps with gcongr, positivity and bound A goal like f a * g ≤ f b * g or 0 < x ^ 2 * exp y / (1 + z) needs a stack of mul_le_mul, div_pos and pow_le_pow_left lemmas with matching side conditions. | tactics | seed | — |
| Combine Filter.Eventually hypotheses with filter_upwards Asymptotic statements ( ∀ᶠ n in atTop, …, Tendsto, =O[atTop]) need several eventual facts combined into one. | tacticsmathlib | seed | — |
| Combine several eventually and almost-everywhere facts with filter_upwards You have several ∀ᶠ x in atTop, … or ∀ᵐ x ∂μ, … hypotheses and need a combined eventual statement, or you need to prove an =ᵐ[μ] equality pointwise on a restricted set. | tactics | seed | — |
Control simp with ↓ pre-lemmas and -lemma exclusions instead of fighting itsimp unfolds a definition, or splits a structure, before the lemma you need gets a chance to fire, or it loops between two lemmas. The goal ends in a useless normal form. | tacticspitfalls | seed | — |
| Destructure with obtain/rcases patterns and name subterms with set Hypotheses are existentials, conjunctions or disjunctions, or a large subterm keeps reappearing and making goals unreadable. | tactics | seed | — |
| Differentiate a parametric integral by domination, by induction for iterated derivatives You need deriv or iteratedDeriv k of s ↦ ∫ v in Ioi 0, F s v (a Laplace or Mellin transform), and integrability of the derivative integrand. | mathlibtactics | seed | — |
| Discharge continuity, measurability and differentiability goals with fun_prop Analytic side goals like Continuous (fun x => …), Differentiable ℝ f, Measurable f pile up and proving them by composition lemmas is tedious. | tactics | seed | — |
| Evaluate Nat.nth through Nat.count An OEIS statement defines a n = Nat.nth P n, and you need the value of a at a concrete index, or a bound on the index of a concrete element. | mathlibtactics | seed | — |
| Extend an identity from re s > 1 to a half-plane with the identity theorem You know f s = g s where a Dirichlet series converges (for example re s > 1), and both sides are holomorphic on a larger half-plane where you need the equality. | mathlibtactics | seed | — |
| Find the lemma with exact?, apply? and rw? before guessing names You need a Mathlib fact (a monotonicity, a cast identity, an order lemma) and do not know its name; guessed names fail with "unknown identifier". | tacticsmathlib | seed | — |
| Generate apply lemmas for bundled maps with @[simps!] A ring hom, linear map or representation defined by a combinator ( RingHom.prod, LinearMap.pi, a subrepresentation) does not simplify when applied, and you end up writing rfl lemmas by hand. | tacticsmathlib | seed | — |
| Give ℕ witnesses with / and % and let omega check them An existential over ℕ (for example a Frobenius-coin representation m = 5x + 8y) needs explicit witnesses involving truncated subtraction and division. | tactics | seed | — |
| Kill an existential with a concrete n and interval_cases To refute ∀ n, … → ∃ k < n, P n k, you must show that no k works for one specific n. | tactics | seed | — |
| Let instance search compute size bounds through an outParam class You must prove many inequalities between large expressions built from a few scales (products, powers, sums, inverses). Doing each by hand with gcongr and exp arithmetic is long and brittle. | architecturetactics | seed | — |
| Let routine hypotheses be proved automatically by default arguments A lemma needs regularity hypotheses (continuity, measurability, a numeric inequality) that are routine at almost every call site, and writing them out each time clutters the proofs. | architecturetactics | seed | — |
| Lift ℕ counting facts to ℝ bounds with exact_mod_cast and nlinarith only The statement lives in ℝ (asymptotics, ≫, rpow, sqrt), but the combinatorial content is a bound in ℕ. | tacticsmathlib | seed | — |
| Move between ℕ, ℤ, ℚ, ℝ with push_cast, norm_cast, exact_mod_cast, zify The statement mixes (n : ℝ) with natural-number facts, and linarith/ring fail because casts block them. | tacticspitfalls | seed | — |
| Move ℕ subtraction to ℤ or ℝ only with a ≤ proof A goal mixes ℕ subtraction (n - k, p - 1) with casts to ℤ, ZMod or ℝ, and push_cast/ring get stuck on ↑(n - k). | pitfallstactics | seed | — |
| Pick omega, linarith, nlinarith, positivity, norm_num or linear_combination An arithmetic goal is "obvious" but the tactic you tried fails or times out. | tactics | seed | — |
| Prefer decide / norm_num over native_decide for finite checks A finite computation (small primes, bounded ∀ over ℕ, a Fin case table) must be verified and native_decide is tempting. | pitfallstactics | seed | — |
| Prove Finset.sum identities by induction with Finset.sum_range_succ A goal involves ∑ i ∈ Finset.range n, f i (closed forms, bounds, telescoping). | mathlibtactics | seed | — |
| Prove continuity, measurability and differentiability with fun_prop Goals like Continuous fun x ↦ exp (f x) * x ^ 2, Measurable … or AnalyticAt ℂ … need long chains of .mul, .comp and .pow, and side conditions such as x ≠ 0 for division. | tactics | seed | — |
| Prove statements on residue classes by symbolic iteration and omega A dynamical statement (Collatz-type iteration) must hold for all n in some residue classes mod 2^k. | tacticsperformance | seed | — |
| Replace native_decide by decide +kernel on small closed facts A finite computation (prime counts, a table of values, a finite invariant) must be checked, but nosorry refuses native_decide. | tacticsperformancepitfalls | seed | — |
| Rewrite with inequalities using grw inside calc steps In a chain of estimates you want to replace a subterm by an upper bound inside a larger monotone expression. Doing it with gcongr plus exact, or with mul_le_mul by hand, is clumsy. | tactics | seed | — |
| Run simp?, then freeze the result as simp only [...] A proof using bare simp works today but is slow, or breaks after a Mathlib update because the simp set changed. | performancetactics | seed | — |
| Split bounded variables into cases with interval_cases and fin_cases A variable is known to lie in a small range (or a finite type) and the claim must be checked value by value. | tactics | seed | — |
| Split off small cases with interval_cases <;> decide An arithmetic claim has a clean general argument only above some threshold, while small values need a direct check. | tactics | seed | — |
| Structure inequalities with calc; rewrite one spot with conv or nth_rw A long inequality or equality chain is unreadable as one tactic call, or rw rewrites the wrong occurrence. | architecturetactics | seed | — |
| Structure long proofs as named local facts with binders, one comment per step A proof of 50+ lines is a wall of tactics. When it breaks after a Mathlib change, nobody can tell which mathematical step failed. | architecturetactics | seed | — |
| Turn an eventual bound into an explicit threshold and split at it You have ∀ᶠ v in atTop, E v ≤ B v but need a bound for all v > 0 with some constant. Small v must be handled by a crude bound and large v by the eventual one. | tactics | seed | — |
| Use Nat.strong_induction_on or Nat.le_induction for non-standard inductions Plain induction n gives only the hypothesis for n, but the step needs all smaller values, or the claim only holds from some n ≥ m. | tacticsarchitecture | seed | — |
| Use gcongr (or bound) to compare two expressions of the same shape You must prove f(a) ≤ f(b) for a compound expression (sums, products, powers, divisions) and applying monotonicity lemmas by hand is tedious. | tactics | seed | — |
| Use grind with a few named facts for arithmetic and case glue A goal mixes linear arithmetic with real and imaginary parts, casts, divisibility or if cases. linarith misses it because it needs one rewrite first, and omega does not apply over ℝ. | tactics | seed | — |
Contribute through the API (POST /api/v1/book, MCP book_propose, CLI nosorry book --propose entry.json): new entries are listed as “community, unreviewed” until a moderator verifies them. Seeded entries credit their sources; see each entry for its licence.