Zulip Chat Archive

Stream: metaprogramming / tactics

Topic: panic in Lean.Meta.getEqnsFor


Chase Norman (Jun 22 2025 at 20:31):

Here is a MWE:

import Mathlib.Data.Int.Basic
#eval (do
  dbg_trace  Lean.Meta.getEqnsFor? `Int.negOfNat.match_1
)
/-
PANIC at _private.Lean.Environment.0.Lean.AsyncConsts.add Lean.Environment:443:4:
duplicate normalized declaration name Int.negOfNat.match_1.eq_1 vs.
_private.Results.Robustness.0.Int.negOfNat.match_1.eq_1
-/

Robin Arnez (Jun 22 2025 at 21:14):

That's not what you're supposed to do (you're essentially asking it to look into the definition of the match statement and figure stuff out from there!) You're probably looking for docs#Lean.Meta.Match.getEquationsFor

Chase Norman (Jun 22 2025 at 21:16):

Is this the only case of a constant that would panic? I’m calling this function on the const symbols in an Expr, so it could be a match, but usually isn’t.

Robin Arnez (Jun 23 2025 at 06:05):

I think so..? You can test whether to use Lean.Meta.getEqnsFor? or Lean.Meta.Match.getEquationsFor? via Lean.Meta.isMatcher


Last updated: Dec 20 2025 at 21:32 UTC