Set Implicit Arguments.
Require fix_measure_utils.
Set Shrink Obligations.
Variables (T: Set) (cmp: T -> T -> bool). (* "le" *)
Definition counted_cmp (x y: T): SimplyProfiled bool := (1, cmp x y). (* lift *)
Proof with auto with arith.
intros pd.
induction l...
simpl.
destruct (filter SimplyProfiled p l)...
destruct s...
set (pd a).
clearbody e.
destruct (p a)...
simpl in *.
subst.
omega.
Qed.

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.