(* Copyright 2012-2015 by Adam Petcher.				* * Use of this source code is governed by the license described	* * in the LICENSE file at the root of the source tree.		*)
Set Implicit Arguments.
Fixpoint splitVector(A : Set)(n m : nat) : Vector.t A (n + m) -> (Vector.t A n * Vector.t A m) :=
match n with
| 0 =>
fun (v : Vector.t A (O + m)) => (@Vector.nil A, v)
| S n' =>
fun (v : Vector.t A (S n' + m)) =>
let (v1, v2) := splitVector _ _ (Vector.tl v) in
(Vector.cons _ (Vector.hd v) _ v1, v2)
end.

(* Specifications: *)
Theorem splitVector_append :
forall (A : Set) n1 (v1 : Vector.t A n1) n2 (v2 : Vector.t A n2),
splitVector n1 n2 (Vector.append v1 v2) = (v1, v2).
Theorem splitVector_append :
forall (A : Set) n1 (v1 : Vector.t A n1) n2 (v2 : Vector.t A n2),
splitVector n1 n2 (Vector.append v1 v2) = (v1, v2).