lean4-htt/tests/lean/run/discrRefinement.lean
2021-03-23 20:40:07 -07:00

16 lines
521 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.

inductive Vec (α : Type u) : Nat → Type u
| nil : Vec α 0
| cons : α → Vec α n → Vec α (n+1)
def Vec.map (xs : Vec α n) (f : α → β) : Vec β n :=
match xs with
| nil => nil
| cons a as => cons (f a) (map as f)
def Vec.map' (f : α → β) : Vec α n → Vec β n
| nil => nil
| cons a as => cons (f a) (map' f as)
def Vec.map2 (f : αα → β) : Vec α n → Vec α n → Vec β n
| nil, nil => nil
| cons a as, cons b bs => cons (f a b) (map2 f as bs)