proposition: Lemma creasoning_by_cases (U : finType) (P : {fdist U}) (A B C : finType) (X : {RV P -> A}) (Y : {RV P -> B}) (Z : {RV P -> C}) E F : `Pr[ X \in E | Z \in F ] = \sum_(b <- fin_img Y) `Pr[ [% X, Y] \in (E `* [set b]) | Z \in F].
proof: Proof. rewrite cpr_inE; under eq_bigr do rewrite cpr_inE. rewrite -big_distrl /= (reasoning_by_cases _ Y); congr (_ / _). by apply eq_bigr => b _; rewrite pr_in_pairAC. Qed.
imports: mathcomp(all_ssreflect ssralg ssrnum matrix) mathcomp(Rstruct reals) Reals Lra ssrR Reals_ext realType_ext logb ssr_ext ssralg_ext bigop_ext fdist