Lean4
/-- Implementation of the `lemma` command, by macro expansion to `theorem`. -/
@[macro «lemma»]
def expandLemma : Macro :=
fun stx =>
-- Not using a macro match, to be more resilient against changes to `lemma`.
-- This implementation ensures that any future changes to `theorem` are reflected in `lemma`
let stx :=
stx.modifyArg 1 fun stx =>
let stx := stx.modifyArg 0 (mkAtomFrom · "theorem" (canonical := true))
stx.setKind ``Parser.Command.theorem
pure <| stx.setKind ``Parser.Command.declaration