Section EqSortSeq.
Variables (T : eqType) (leT : rel T).
Let pop_stable s1 ss :
push_invariant (s1 :: ss) -> sorted lt_lex (merge_sort_pop leN s1 ss).
End Stability_iota.

Lemma sort_stable_in T (P : {pred T}) (leT leT' : rel T) :
{in P &, total leT} -> {in P & &, transitive leT'} ->
forall s : seq T, all P s -> sorted leT' s ->
sorted [rel x y | leT x y && (leT y x ==> leT' x y)] (sort leT s).