Section parametric.
Variable T : Type.
Inductive vector : nat -> Type :=
| Vnil : vector 0
| Vcons : forall {n}, T -> vector n -> vector (S n).
Definition vector_hd n (v : vector (S n)) : T :=
match v in vector n' return match n' with
| 0 => unit
| S _ => T
end with
| Vnil => tt
| Vcons _ x _ => x
end.
Definition vector_tl n (v : vector (S n)) : vector n :=
match v in vector n' return match n' with
| 0 => unit
| S n => vector n
end with
| Vnil => tt
| Vcons _ _ x => x
end.
Fixpoint get {n : nat} (f : fin n) : vector n -> T :=
match f in fin n return vector n -> T with
| F0 n => @vector_hd _
| FS n f => fun v => get f (vector_tl v)
end.
Fixpoint put {n : nat} (f : fin n) (t : T) : vector n -> vector n :=
match f in fin n return vector n -> vector n with
| F0 _ => fun v => Vcons t (vector_tl v)
| FS _ f => fun v => Vcons (vector_hd v) (put f t (vector_tl v))
end.

Theorem get_put_eq : forall {n} (v : vector n) (f : fin n) val,
get f (put f val v) = val.