summaryrefslogtreecommitdiff
path: root/backends/lean/Base/Primitives
diff options
context:
space:
mode:
authorSon Ho2023-09-18 19:59:19 +0200
committerSon Ho2023-09-18 19:59:19 +0200
commit92887b89e35607e99bae2f19e4c5b2f162683d02 (patch)
treef2547abe4f19a8474dd8af07e8e69369064fd41a /backends/lean/Base/Primitives
parent0eb62047b052cb4fbf842525170dd916679e8b7e (diff)
Prove that Vec is inhabited
Diffstat (limited to 'backends/lean/Base/Primitives')
-rw-r--r--backends/lean/Base/Primitives/Vec.lean4
1 files changed, 4 insertions, 0 deletions
diff --git a/backends/lean/Base/Primitives/Vec.lean b/backends/lean/Base/Primitives/Vec.lean
index c4c4d9f2..2d48a641 100644
--- a/backends/lean/Base/Primitives/Vec.lean
+++ b/backends/lean/Base/Primitives/Vec.lean
@@ -35,6 +35,10 @@ example {a: Type u} (v : Vec a) : v.length ≤ Scalar.max ScalarTy.Usize := by
def Vec.new (α : Type u): Vec α := ⟨ [], by apply Scalar.cMax_suffices .Usize; simp ⟩
+instance (α : Type u) : Inhabited (Vec α) := by
+ constructor
+ apply Vec.new
+
-- TODO: very annoying that the α is an explicit parameter
def Vec.len (α : Type u) (v : Vec α) : Usize :=
Usize.ofIntCore v.val.len (by scalar_tac) (by scalar_tac)