Zulip Chat Archive

Stream: lean4

Topic: Lean 4 analogue with `decl_name`


Scott Morrison (Oct 24 2022 at 23:33):

In Lean 3 we had

/-- Name of the declaration currently being elaborated. -/
meta constant decl_name : tactic name

What is the Lean 4 analogue?

Mario Carneiro (Oct 24 2022 at 23:34):

decl_name%, a term macro which expands to a name literal (it's super convenient)

Mario Carneiro (Oct 24 2022 at 23:35):

there is also a plumbing version of the function if you need it

David Renshaw (Oct 24 2022 at 23:43):

https://github.com/leanprover/lean4/blob/d7d61bfb558ffcdff599249297c50d8b65c4aeb4/src/Lean/Elab/BuiltinTerm.lean#L216-L219
delegates to
https://github.com/leanprover/lean4/blob/d7d61bfb558ffcdff599249297c50d8b65c4aeb4/src/Lean/Elab/Term.lean#L399
which reads
https://github.com/leanprover/lean4/blob/d7d61bfb558ffcdff599249297c50d8b65c4aeb4/src/Lean/Elab/Term.lean#L157


Last updated: Dec 20 2023 at 11:08 UTC