Skip to content

Instantly share code, notes, and snippets.

@lovely-error
Last active February 12, 2025 17:53
Show Gist options
  • Save lovely-error/57fde7ec56d53f85a9c0a15e74e90c6a to your computer and use it in GitHub Desktop.
Save lovely-error/57fde7ec56d53f85a9c0a15e74e90c6a to your computer and use it in GitHub Desktop.
Rewriting exprs the way I like in lean
macro "rwi" pat:term "=>" new:term ":=" prf:term : tactic =>
`(tactic| rewrite [let _eq : $pat = $new := $prf ; _eq ])
macro "rwi" pat:term "=>" new:term "at" loc:Lean.Parser.Tactic.locationHyp ":=" prf:term : tactic =>
`(tactic| rewrite [let _eq : $pat = $new := $prf ; _eq ] at $loc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment