Fixpoint insert_ordered (x: X) n: Vector.t X n -> Vector.t X (S n) :=
    match n return Vector.t X n -> Vector.t X (S n) with
    | 0 => fun _ => Vector.cons x Vector.nil
    | S n' => fun v => if XleDec x (head v)
        then Vector.cons x v
        else Vector.cons (head v) (insert_ordered x (tail v))
    end.

Lemma insert_ordered_permutes x n (v: Vector.t X n): Permutation (insert_ordered x v) (Vector.cons x v).