Book of methods
78 entries · 0 verified · 78 seed · 0 community
| Entry | Tags | Status | Cited |
|---|---|---|---|
| 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 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 | — |
| Demote instances that start long failing searches Elaboration is slow in a big development because instance search tries some general Mathlib instances first, and they open long searches that fail. | performance | seed | — |
| Keep one heartbeat budget and fix slow steps instead of raising it everywhere A proof hits maximum number of heartbeats, and the obvious fix is to sprinkle set_option maxHeartbeats over the file. | performance | seed | — |
| Mark a definition irreducible once its characterising lemmas are proved A complicated definition, for example one built from choose, an integral or an operator, keeps getting unfolded by simp, rfl checks and instance search. Goals blow up and elaboration slows down. | performancearchitecture | 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 | — |
| Raise heartbeats per declaration, within nosorry's limits A lemma times out ( maxHeartbeats) or hits maxRecDepth, and the natural fix is a global set_option. | performancepitfalls | seed | — |
| Raise instance-search limits for one declaration, with a reason The error says failed to synthesize with a (deterministic) timeout at synthInstance, or the maximum instance size was reached. The types are deeply nested, for example matrices indexed by sums of sums. | performancepitfalls | seed | — |
Remove simp lemmas that match everything and then failsimp is slow because some default simp lemmas match very many terms, then fail on a side condition after an expensive attempt. | performance | 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 | — |
| 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 | — |
Seal Finset.sum and heavy definitions so defeq checks do not unfold themexact, rw or apply takes many heartbeats or times out. Unification is unfolding Finset.sum, Finset.univ or a big construction while it compares two terms. | performance | seed | — |
| Split big proofs into lemmas; raise maxHeartbeats only per declaration A proof hits "(deterministic) timeout ... maxHeartbeats 200000" or elaborates very slowly. | performancearchitecture | seed | — |
| Stop simp from trying to prove IsEmpty side goals Many simp lemmas carry an [IsEmpty α] hypothesis. When instance search does not find it, simp tries to prove it, which costs time on every call. | performancepitfalls | seed | — |
| Switch off an instance that leads a statement to the wrong path In a section with many variables, instance search finds a class (say IsDomain K) through an odd route via a section hypothesis. The statement then mentions an instance that does not match the one the lemmas you use expect. | pitfallsperformance | seed | — |
| Use Fintype.ofFinite as a low-priority local instance when summing over Finite types The statement assumes [Finite ι] (or the type is only known to be Finite), but ∑ i, f i and Finset.univ need a Fintype instance. | performancepitfalls | seed | — |
Use the ascription (t :) when exact times out unifying with the goalexact foo h₁ h₂ times out or is very slow, although have := foo h₁ h₂ is fast and the result matches the goal up to defeq. | performancetactics | seed | — |
| Write the reason above every set_option, seal and attribute line Local settings pile up in a file. Nobody, including later agents, knows which ones are still needed, and copying them into new proofs spreads slow or unsound habits. | architectureperformance | 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.