(** sorted *)
Fixpoint sorted {T : Type} (Ord : T -> T -> Prop) (s : seq T) :=
match s with
| [::] | [:: _] => True
| h0 :: (h1 :: t1) as t0 => Ord h0 h1 /\ sorted Ord t0
end.

Lemma sorted_nth {T : Type} (Ord : T -> T -> Prop) (s : seq T) :
sorted Ord s <-> (forall i : nat,
(i < Peano.pred (size s))%nat -> forall x0 : T, Ord (nth x0 s i) (nth x0 s (S i))).