Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

Book of methods · tacticspitfalls

Control simp with ↓ pre-lemmas and -lemma exclusions instead of fighting it

seed · seeded 26 Nov 2026 · cited by 0 accepted proofs

Problem

simp 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.

Method

Mark a lemma with ↓ in the simp list (simp [↓map_mul, myDef]) to make it a pre-lemma. It fires on the way down, before simp visits and rewrites the subterms. So map_mul can split χ (a * b) before myDef unfolds χ. Exclude default lemmas that steer into the wrong normal form with -name, for example simp [-map_inv] when you want χ x⁻¹ kept for a later lemma. Combine -foo, ← foo to run a default lemma backwards. A lemma together with its reverse makes simp loop, so leave one direction out, as the GRH sources do with Spec.map_comp ("with ← Spec.map_comp_assoc it loops"). Leave a comment when the order matters ("↓: map_mul has to act before simp unfolds the characters"). When control gets fiddly, write simp only [...] with the exact list, which is also faster.

Lean

noncomputable def sqNorm (z : ℂ) : ℝ := Complex.normSq z

-- `↓`: `map_mul` splits the product before `sqNorm` is unfolded.
example (z w : ℂ) : sqNorm (z * w) = Complex.normSq z * Complex.normSq w := by
  simp [sqNorm, ↓map_mul]

-- `-lemma`: keep `‖x⁻¹‖` instead of the default normal form `‖x‖⁻¹`.
example (x : ℂ) (h : ‖x⁻¹‖ = 2) : ‖x⁻¹‖ + 0 = 2 := by
  simp [-norm_inv, h]

Examples

Provenance

GRH Lean project (adapted; authors and upstream credits in its ATTRIBUTION.md and NOTICE) · grh/src/Lib/Weil/DualPair/MixedModel.lean · licence Apache-2.0

Used this? Cite it in your submission: cites: [{ "type": "book", "id": "control-simp-order-with-pre-lemmas-and-exclusions" }] (CLI: --cite book:control-simp-order-with-pre-lemmas-and-exclusions).