Section Stability_subseq_in.
Variables (T : eqType) (leT : rel T).
End Stability_subseq_in.
Arguments sort_sorted {T leT} leT_total s.
Arguments sort_sorted_in {T P leT} leT_total {s}.

Lemma homo_sort_map_in
(T : Type) (T' : eqType) (P : {pred T}) (f : T -> T') leT leT' :
{in P &, antisymmetric (relpre f leT')} ->
{in P & &, transitive (relpre f leT')} -> {in P &, total leT} ->
{in P &, {homo f : x y / leT x y >-> leT' x y}} ->
forall s : seq T, all P s ->
sort leT' [seq f x | x <- s] = [seq f x | x <- sort leT s].