Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build error: failed to synthesize instance Lean.ToExpr Comparator #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions C0deine/Utils/Comparison.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Basic comparison operators that are used in numerous IRs.
- Thea Brick
-/
import Lean
namespace C0deine

inductive Comparator
Expand All @@ -27,3 +28,16 @@ def toString : Comparator → String
| less_equal => "<="
| greater_equal => ">="
instance : ToString Comparator where toString := Comparator.toString

instance : Lean.ToExpr Comparator :=
{
toExpr := fun c =>
match c with
| Comparator.less => Lean.mkConst ``Comparator.less
| Comparator.equal => Lean.mkConst ``Comparator.equal
| Comparator.greater => Lean.mkConst ``Comparator.greater
| Comparator.not_equal => Lean.mkConst ``Comparator.not_equal
| Comparator.less_equal => Lean.mkConst ``Comparator.less_equal
| Comparator.greater_equal => Lean.mkConst ``Comparator.greater_equal
toTypeExpr := Lean.mkConst ``Comparator
}