(* Ordered paths and sorting. *)
Section SortSeq.
Variable T : eqType.
Variable leT : rel T.
Definition sorted s := if s is x :: s' then path leT x s' else true.

(* Specifications: *)
Lemma path_sorted x s : path leT x s -> sorted s.
Lemma order_path_min x s : path leT x s -> all (leT x) s.
Lemma subseq_sorted s1 s2 : subseq s1 s2 -> sorted s2 -> sorted s1.
Lemma sorted_filter a s : sorted s -> sorted (filter a s).
Lemma eq_sorted : antisymmetric leT ->
forall s1 s2, sorted s1 -> sorted s2 -> perm_eq s1 s2 -> s1 = s2.
Lemma eq_sorted_irr : irreflexive leT ->
forall s1 s2, sorted s1 -> sorted s2 -> s1 =i s2 -> s1 = s2.