Fixpoint insertion_sort n: Vector.t X n -> Vector.t X n :=
    match n return Vector.t X n -> Vector.t X n with
    | 0 => fun _ => Vector.nil
    | S n' => fun v => insert_ordered (head v) (insertion_sort (tail v))
    end.

(* Specifications: *)
Lemma insertion_sort_sorts n (l: Vector.t X n): sorted (insertion_sort l).
Lemma insertion_sort_permutes n (l: Vector.t X n): Permutation (insertion_sort l) l.