lean4-htt/tests/lean/run/beginEndAsMacro.lean
Leonardo de Moura 65dafaf07c fix: stdlib and tests
We also declare a few macros for the syntax command.
2020-11-12 07:12:30 -08:00

17 lines
567 B
Text

syntax[beginEndKind] "begin " sepByT(tactic, ", ") "end" : term
open Lean in
@[macro beginEndKind] def expandBeginEnd : Lean.Macro := fun stx =>
match_syntax stx with
| `(begin $ts* end) => do
let ts := ts.getSepElems.map fun t => mkNullNode #[t, mkNullNode]
let tseq := mkNode `Lean.Parser.Tactic.tacticSeqBracketed #[mkAtomFrom stx "{", mkNullNode ts, mkAtomFrom stx[2] "}"]
`(by $tseq:tacticSeqBracketed)
| _ => Macro.throwUnsupported
theorem ex1 (x : Nat) : x + 0 = 0 + x :=
begin
rw Nat.zeroAdd,
rw Nat.addZero,
rfl,
end