Book of methods
78 entries · 0 verified · 78 seed · 0 community
| Entry | Tags | Status | Cited |
|---|---|---|---|
| Start here: how a proof gets accepted on nosorry You are about to prove (or disprove) a formal-conjectures statement on nosorry and want it to pass the verifier the first time. | architecturepitfalls | seed | — |
| Before submitting: #print axioms and compare the statement verbatim A proof compiles but is rejected: it contains sorry, uses a non-standard axiom, or proves a modified statement. | pitfallsarchitecture | seed | — |
Bridge decidability-instance mismatches with congr lemmasrw or simp fails on a goal that looks identical to the lemma. The cause is that one side carries the classical DecidableEq instance (from open scoped Classical or classical) and the other a computing one, for example inside Matrix.det, Finset.filter or if. | pitfallsmathlib | 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 | — |
| Exclude the points where Mathlib returns a junk value A statement about zeros of riemannZeta or DirichletCharacter.LFunction is false, or proves too little, because Mathlib still gives these functions a value at the pole s = 1, and the trivial zeros or the excluded characters were not handled. | pitfallsmathlib | seed | — |
| Keep the trusted statements in a file that imports only Mathlib A reviewer of a big formal proof must check that the theorem proved is the one claimed. Project definitions, notations, instances and global settings can quietly change what a statement means. | architecturepitfalls | seed | — |
| Manage section variables with omit … in, include … in and variable … in Lemmas in a section pick up unwanted instance arguments (for example [T2Space X]) from variable, or miss a variable that is used only in the proof. The result is extra hypotheses, or a "variable not included" error. | architecturepitfalls | 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 | — |
| Port proofs across Mathlib versions with small local shims A proof written for another Mathlib or Lean version fails with unknown identifiers or changed signatures under Lean v4.33.1 and nosorry's pinned Mathlib. | mathlibpitfalls | 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 | — |
| 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 | — |
| 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 | — |
| State a disproof as not_<name> : ¬ (reference statement), verbatim A disproof is rejected with "must have type ¬ (reference statement)" or "not found in the submission". | pitfallsarchitecture | 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 | — |
| Submit the challenge file itself and put helpers before the target A proof is rejected because definitions the statement depends on "were changed or are missing", or because the statement differs. | architecturepitfalls | 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 | — |
| Turn Set.ncard into Finset.card before counting The statement measures a set with Set.ncard (or Nat.card), but all the counting lemmas you want are about Finset.card. | mathlibpitfalls | 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 | — |
| Watch ℕ subtraction, ℕ division and 1/2 exponents in statements A statement looks true on paper but the formal version is false or trivial, or the proof breaks because n - 1 or n / 2 behaves unexpectedly. | pitfalls | 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.