Section Sum.
(** Adding a valuation function on all elements of a set. *)
Definition sum (f:elt -> nat)(s:t) := fold (fun x => plus (f x)) s 0.
Notation compat_opL := (Proper (E.eq==>Logic.eq==>Logic.eq)).
Notation transposeL := (transpose Logic.eq).

Lemma sum_filter : forall f : elt -> bool, Proper (E.eq==>Logic.eq) f ->
forall s, (sum (fun x => if f x then 1 else 0) s) = (cardinal (filter f s)).