(* "le" *)

Definition counted_cmp (x y: T): SimplyProfiled bool := (1, cmp x y).

(* Specifications: *)
Lemma filter_cost (p: T -> SimplyProfiled bool): (forall t, cost (p t) = 1) -> forall (l: list T), cost (filter _ p l) = length l.
Lemma exclusive_filtering (T: Set) (p q: T -> SimplyProfiled bool) (ex: forall x, result (p x) = false \/ result (q x) = false) (l: list T): length (proj1_sig (result (filter SimplyProfiled p l))) + length (proj1_sig (result (filter SimplyProfiled q l))) <= length l.
Lemma counted_cmp_excl (n x: T): result (counted_cmp n x) = false \/ result (gt _ counted_cmp n x) = false.
Lemma common_arith (n n3 n0 n1 n2: nat) (l0: n3 + n0 <= n) (p: n1 <= sqrd n3) (p0: n2 <= sqrd n0): n + n2 + n + n1 <= sqrd n + n + n + 1.
Theorem qs_quadratic (l: list T): cost (qs counted_cmp l) <= sqrd (length l).