Zulip Chat Archive
Stream: lean4
Topic: Optional delaborators
Eric Wieser (Dec 26 2024 at 00:42):
For debugging, it would have been helpful to me to have this delaborator:
/-- Delaborator for `no_index`. -/
@[delab mdata]
def delabNoIndex : Delab := do
let .mdata d e ← SubExpr.getExpr | failure
let .some (.ofBool .true) := d.find `noindex | failure
let d := d.erase `noindex
let inner ← withReader (fun s => {s with subExpr.expr := .mdata d e}) delab
`(no_index $inner)
Having this enabled by default would certainly be confusing; Is the appropriate thing to do here to hide this behind a new pp option, or make the delaborator attribute scoped?
Eric Wieser (Jun 05 2025 at 19:15):
I found myself needed this again while debugging another consumeMData issue; could anyone advise on the scope vs pp option?
Eric Wieser (Jun 05 2025 at 19:15):
Or should this be enabled as a default elaborator, since it can have visible effects on (buggy) tactics?
Eric Wieser (Jun 05 2025 at 19:16):
Example:
import Mathlib.Tactic.Linarith
example (b : Int) (h₀ : b = -2) : b = -2 := by linarith [h₀] -- ok
example (b : Int) (h₀ : b = -2) : b = no_index(-2) := by linarith [h₀] -- failure
Eric Wieser (Jun 05 2025 at 21:04):
#25500 adds a refined version of the above
Last updated: Dec 20 2025 at 21:32 UTC