Declaration `...` must be marked as `meta` error when adding an existing simproc to a custom simp attribute
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Description
Adding an existing simproc to a custom simp attribute causes an error "Declaration ... must be marked as meta".
Context
See the discussion on Zulip: #general > How to add simproc to custom simp attribute? @ 💬
Steps to Reproduce
When I try to do
attribute [my_simp] reduceCtorEq
I get the error
error: Cannot add attribute `[my_simp_proc]`: Declaration `reduceCtorEq` must be marked as `meta`
even if I do
public meta import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Core
I found the following as a workaround, but this seems quite hacky:
simproc [my_simp] reduceCtorEq_copy (_ = _) := reduceCtorEq
Here is a #mwe that does not work on the playground since it needs multiple files:
module
public import Lean
public meta import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Core
register_simp_attr my_simp
-- in different file:
-- error: Cannot add attribute `[my_simp_proc]`: Declaration `reduceCtorEq` must be marked as `meta`
attribute [my_simp] reduceCtorEq
-- hacky workaround:
simproc [my_simp] reduceCtorEq_copy (_ = _) := reduceCtorEq
Expected behavior: attribute [my_simp] reduceCtorEq succeeds
Actual behavior: attribute [my_simp] reduceCtorEq causes "Declaration reduceCtorEq must be marked as meta"
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the multi-file reproducer using register_simp_attr my_simp and attribute [my_simp] reduceCtorEq, then inspect the behavior around Lean.Meta.Tactic.Simp.BuiltinSimprocs.Core. Compare it with the simproc workaround. Done means the direct attribute command succeeds without requiring a copied simproc or producing the meta declaration error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100