Skip to content

Commit

Permalink
Prove that Vec is inhabited
Browse files Browse the repository at this point in the history
  • Loading branch information
sonmarcho committed Sep 18, 2023
1 parent 0eb6204 commit 92887b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backends/lean/Base/Primitives/Vec.lean
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 92887b8

Please sign in to comment.