summaryrefslogtreecommitdiff
path: root/backends/lean/Base/Primitives
diff options
context:
space:
mode:
authorSon Ho2023-09-18 19:56:27 +0200
committerSon Ho2023-09-18 19:56:27 +0200
commit0eb62047b052cb4fbf842525170dd916679e8b7e (patch)
treeda155463273c10c9a66338d0cd2e96101d211f59 /backends/lean/Base/Primitives
parent28f4ea9ffe02d4204bb60273b6a77db7ed48781b (diff)
Simplify some lemmas and prove that the scalars and Vec are inhabited
Diffstat (limited to '')
-rw-r--r--backends/lean/Base/Primitives/Scalar.lean3
1 files changed, 3 insertions, 0 deletions
diff --git a/backends/lean/Base/Primitives/Scalar.lean b/backends/lean/Base/Primitives/Scalar.lean
index 55227a9f..fecb0d1d 100644
--- a/backends/lean/Base/Primitives/Scalar.lean
+++ b/backends/lean/Base/Primitives/Scalar.lean
@@ -395,6 +395,9 @@ def Scalar.cast {src_ty : ScalarTy} (tgt_ty : ScalarTy) (x : Scalar src_ty) : Re
@[reducible] def U64 := Scalar .U64
@[reducible] def U128 := Scalar .U128
+instance (ty : ScalarTy) : Inhabited (Scalar ty) := by
+ constructor; cases ty <;> apply (Scalar.ofInt 0)
+
-- TODO: below: not sure this is the best way.
-- Should we rather overload operations like +, -, etc.?
-- Also, it is possible to automate the generation of those definitions