lean4-htt/tests/lean/run/2901.lean
Kim Morrison c3948cba24
feat: upstream definition of Vector from Batteries (#6197)
This PR upstreams the definition of `Vector` from Batteries, along with
the basic functions.
2024-11-24 23:01:32 +00:00

14 lines
513 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def Vector' (α : Type u) (n : Nat) :=
{ l : List α // l.length = n }
inductive HVect : (n : Nat) -> (Vector' (Type v) n) -> Type (v+1) where
| Nil : HVect 0 ⟨ [], simp ⟩
| Cons : (t : Type v) -> (x : t) -> HVect n ⟨ts, p⟩ -> HVect (n+1) ⟨t::ts, by simp [p]⟩
def printHOK (v : HVect (n+1) ⟨String::ts, p'⟩) : String :=
match v with
| HVect.Cons _ x _ => (x : String)
def printHKO (v : HVect (n+1) ⟨String::ts, p'⟩) : String :=
match v with
| HVect.Cons _ x _ => "Hi"