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_preserves_sorted n x (v: Vector.t X n): sorted v -> sorted (insert_ordered x v).