induction ls; intuition; simpl in *.
unfold sumList; simpl in *.
intuition.
repeat rewrite sumList_cons.
eapply ratAdd_eqRat_compat; intuition.
Qed.

(* Specifications: *)
Lemma sumList_filter_twice :
forall (A B : Set)(P : A -> bool)(ls : list A)(lsf : A -> list B)(f : A * B -> Rat),
sumList (filter (fun p => P (fst p)) (flatten (map (fun a => map (fun b => (a, b)) (lsf a)) ls))) f ==
sumList (filter P ls) (fun a => sumList (lsf a) (fun b => f (a, b))).