Last active
December 22, 2022 13:49
-
-
Save forked-from-1kasper/732eb6d6ab0c62f3d9675698db4575b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Lean.Elab.Command | |
open Lean | |
elab "#defeq " σ₁:term " =?= " σ₂:term : command => | |
Elab.Command.liftTermElabM (do | |
let τ₁ ← Elab.Term.elabTerm σ₁ none | |
let τ₂ ← Elab.Term.elabTerm σ₂ none | |
unless (← Meta.isDefEq τ₁ τ₂) do throwError s!"{τ₁} ≠ {τ₂}") | |
#defeq [1, 2, 3, 4].reverse =?= [4, 3, 2, 1] | |
macro "#defeqEval " σ₁:term " =?= " σ₂:term : command => | |
`(#eval (unless ($σ₁ == $σ₂) | |
do throwError s!"{$σ₁} ≠ {$σ₂}" : Elab.Command.CommandElabM Unit)) | |
#defeqEval [1, 2, 3, 4].reverse =?= [4, 3, 2, 1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment