feat: add command norm_cast_add_elim

This commit is contained in:
Leonardo de Moura 2024-02-20 05:53:24 -08:00 committed by Leonardo de Moura
parent 15be8fc2a6
commit e1c176543a
2 changed files with 13 additions and 0 deletions

View file

@ -1156,6 +1156,11 @@ end
syntax (name := pushCast) "push_cast" (config)? (discharger)? (&" only")?
(" [" (simpStar <|> simpErase <|> simpLemma),* "]")? (location)? : tactic
/--
`norm_cast_add_elim foo` registers `foo` as an elim-lemma in `norm_cast`.
-/
syntax (name := normCastAddElim) "norm_cast_add_elim" ident : command
end Tactic
namespace Attr

View file

@ -262,4 +262,12 @@ def evalPushCast : Tactic := fun stx => do
dischargeWrapper.with fun discharge? =>
discard <| simpLocation ctx simprocs discharge? (expandOptLocation stx[5])
open Command in
@[builtin_command_elab Parser.Tactic.normCastAddElim] def elabAddElim : CommandElab := fun stx => do
match stx with
| `(norm_cast_add_elim $id:ident) =>
Elab.Command.liftCoreM do MetaM.run' do
addElim (← resolveGlobalConstNoOverload id)
| _ => throwUnsupportedSyntax
end Lean.Elab.Tactic.NormCast