lean4-htt/tests/lean/run/471.lean
Leonardo de Moura 28b055463f fix: fixes #471
2021-05-22 15:42:52 -07:00

29 lines
733 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 : Nat → Type where
| nil : vec 0
| cons : Int → vec n → vec n.succ
def vec_len : vec n → Nat
| vec.nil => 0
| x@(vec.cons h t) => vec_len t + 1
def vec_len' : {n : Nat} → vec n → Nat
| _, vec.nil => 0
| _, x@(vec.cons h t) => vec_len' t + 1
def tst1 : vec (n+1) → Int × vec (n+1) × vec n
| x@(vec.cons h t) => (h, x, t)
def tst2 : vec n → Option (Int × vec n)
| x@(vec.cons h t) => some (h, x)
| _ => none
example (a : Int) (x : vec n) : tst2 (vec.cons a x) = some (a, vec.cons a x) :=
rfl
def vec_len_non_as : vec n → Nat
| vec.nil => 0
| vec.cons h t => vec_len_non_as t + 1
def list_len : List Int → Nat
| List.nil => 0
| x@(List.cons h t) => list_len t + 1