(* Vsorted *)

  Inductive sorted: forall n, Vector.t X n -> Prop := (* Coq.Sorting's definition sucks *)
    | sorted_nil: sorted Vector.nil
    | sorted_one x: sorted (Vector.cons x Vector.nil)
    | sorted_more (a b: X) n (t: Vector.t X n):
        Xle a b -> sorted (Vector.cons b t) -> sorted (Vector.cons a (Vector.cons b t)).(* Vsorted *)

  Inductive sorted: forall n, Vector.t X n -> Prop := (* Coq.Sorting's definition sucks *)
    | sorted_nil: sorted Vector.nil
    | sorted_one x: sorted (Vector.cons x Vector.nil)
    | sorted_more (a b: X) n (t: Vector.t X n):
        Xle a b -> sorted (Vector.cons b t) -> sorted (Vector.cons a (Vector.cons b t)).(* Vsorted *)

  Inductive sorted: forall n, Vector.t X n -> Prop := (* Coq.Sorting's definition sucks *)
    | sorted_nil: sorted Vector.nil
    | sorted_one x: sorted (Vector.cons x Vector.nil)
    | sorted_more (a b: X) n (t: Vector.t X n):
        Xle a b -> sorted (Vector.cons b t) -> sorted (Vector.cons a (Vector.cons b t)).(* Vsorted *)

  Inductive sorted: forall n, Vector.t X n -> Prop := (* Coq.Sorting's definition sucks *)
    | sorted_nil: sorted Vector.nil
    | sorted_one x: sorted (Vector.cons x Vector.nil)
    | sorted_more (a b: X) n (t: Vector.t X n):
        Xle a b -> sorted (Vector.cons b t) -> sorted (Vector.cons a (Vector.cons b t)).

(* Specifications: *)
Lemma sorted_cons x n (v: Vector.t X (S n)): Xle x (head v) -> sorted v -> sorted (Vector.cons x v).
Lemma sorted_cons' x n (v: Vector.t X n): (forall y, List.In y v -> Xle x y) -> sorted v -> sorted (Vector.cons x v).
Lemma sorted_cons_inv x n (v: Vector.t X (S n)): sorted (Vector.cons x v) -> Xle x (head v).
Lemma sorted_tail x n (v: Vector.t X n): sorted (Vector.cons x v) -> sorted v.
Lemma sorted_cons_inv' (x: X) n (xs: Vector.t X n): sorted (Vector.cons x xs) -> forall x', List.In x' xs -> Xle x x'.
Lemma sorted_app (v w: List.list X): sorted v -> sorted w -> (forall x y, List.In x v -> List.In y w -> Xle x y) -> sorted (List.app v w).
Lemma sorted_le_indices_le_values n (v: Vector.t X n): sorted v -> forall (i j: natBelow n), i <= j -> Xle (nth v i) (nth v j).
Lemma sorted_lt_values_lt_indices n (v: Vector.t X n): sorted v -> forall i j, Xlt (nth v i) (nth v j) -> i < j.