We must erase macro scopes for tags in `case` as we do in `cases .. with ..` and `induction .. with ..`.
22 lines
463 B
Text
22 lines
463 B
Text
def f (n : Nat) := n + 1
|
|
|
|
macro "mymacro1 " h:ident : tactic =>
|
|
`(tactic| {
|
|
cases $h:ident with
|
|
| zero => decide
|
|
| succ => simp_arith [f]
|
|
})
|
|
|
|
example : f n > 0 := by
|
|
mymacro1 n -- works
|
|
|
|
macro "mymacro2 " h:ident : tactic =>
|
|
`(tactic| {
|
|
cases $h:ident
|
|
case zero => decide
|
|
case succ => simp_arith [f]
|
|
})
|
|
|
|
example : f n > 0 := by
|
|
-- Should **not** generate: Case tag 'zero._@.cases3._hyg.747' not found.
|
|
mymacro2 n
|