(* conversion to/from list *)

Fixpoint to_list X (n: nat) (v: Vector.t X n) {struct v}: List.list X :=
  match v with
  | Vector.nil => List.nil | Vector.cons x _ v' => List.cons x (to_list v')
  end.Fixpoint from_list A (l: List.list A): Vector.t A (List.length l) :=
  match l return Vector.t A (List.length l) with
  | List.nil => Vector.nil | List.cons h t => Vector.cons h (from_list t)
  end.

Lemma double_rect A B (P: forall n, Vector.t A n -> Vector.t B n -> Prop): P 0 Vector.nil Vector.nil -> (forall n (v: Vector.t A n) (w: Vector.t B n) (x: A) (y: B), P n v w -> P (S n) (Vector.cons x v) (Vector.cons y w)) -> forall n (v: Vector.t A n) (w: Vector.t B n), P n v w.