2014-12-20 19:36:32 +00:00
|
|
|
open nat
|
|
|
|
|
|
|
|
inductive vec (A : Type) : nat → Type :=
|
2015-02-26 01:00:10 +00:00
|
|
|
| nil {} : vec A zero
|
|
|
|
| cons : Π {n}, A → vec A n → vec A (succ n)
|
2014-12-20 19:36:32 +00:00
|
|
|
|
|
|
|
namespace vec
|
|
|
|
variables {A B C : Type}
|
|
|
|
variables {n m : nat}
|
|
|
|
notation a :: b := cons a b
|
|
|
|
|
|
|
|
protected definition destruct (v : vec A (succ n)) {P : Π {n : nat}, vec A (succ n) → Type}
|
|
|
|
(H : Π {n : nat} (h : A) (t : vec A n), P (h :: t)) : P v :=
|
|
|
|
begin
|
2015-03-28 00:26:06 +00:00
|
|
|
cases v with [n', h', t'],
|
2014-12-20 19:36:32 +00:00
|
|
|
apply (H h' t')
|
|
|
|
end
|
|
|
|
|
|
|
|
end vec
|