proposition: Lemma sorted_filter_ge x s : sorted <=%O s -> [seq y <- s | x <= y] = drop (count (< x) s) s.
proof: Proof. move=> s_sorted; rewrite count_lt_ge -[LHS]revK -filter_rev. rewrite (@sorted_filter_le _ T^d); first by rewrite take_rev revK count_rev. by rewrite rev_sorted. Qed.
imports: HB(structures) mathcomp(ssreflect ssrfun ssrbool eqtype ssrnat choice seq) mathcomp(path fintype tuple bigop finset div prime finfun) mathcomp(finset)