intuition. simpl.
eapply eqRat_trans.
eapply sumList_comm.
eapply sumList_body_eq; intuition.
eapply eqRat_trans.
eapply sumList_factor_constant_l.
eapply ratMult_eqRat_compat; intuition.
eapply eqRat_symm.
eapply sumList_subset; intuition.
eapply getSupport_NoDup.
eapply getUnique_NoDup.
eapply (in_getUnique (flatten (map (fun b : B => getSupport (c2 b)) (getSupport c1)))).
eapply in_flatten.
econstructor.
split.
eapply in_map_iff.
econstructor.
split.
eapply eq_refl.
eauto.
eauto.
eapply getSupport_not_In_evalDist.
eauto.
Qed.
(* Lemma evalDist_sum_repeat_eq : forall (A : Set)(eqda : eq_dec A)(c : Comp A) P, let scale := (ratInverse (sumList (filter P (getSupport c)) (evalDist c))) in sumList (getSupport (Repeat c P)) (evalDist (Repeat c P)) == sumList (filter P (getSupport c1)) (fun b => scale * evalDist c1 b * (sumList (getSupport (c2 b)) (evalDist (c2 b)))).  intuition. simpl. eapply eqRat_trans. eapply sumList_comm. eapply sumList_body_eq; intuition.  eapply eqRat_trans. eapply sumList_factor_constant_l. eapply ratMult_eqRat_compat; intuition.  eapply eqRat_symm. eapply sumList_subset; intuition. eapply getSupport_NoDup. eapply getUnique_NoDup. eapply in_getUnique. eapply in_flatten. econstructor. split. eapply in_map_iff. econstructor. split. eapply eq_refl. eauto. eauto.  eapply getSupport_not_In_evalDist. eauto.  Qed. *)

(* Specifications: *)
Lemma ratInverse_scale_sum_1 : forall (A : Set)(ls : list A)(f : A -> Rat),
(forall a, In a ls -> ~f a == 0) ->
length ls > O ->
sumList ls (fun a => (ratInverse (sumList ls f)) * (f a)) == 1.