Definition normalize {X} `{Finite X} (d : dist X) : dist X.

Lemma list_sum_map_flip {X Y} (xs : list X) (ys : list Y) (f : X -> Y -> nat) : list_sum (map (fun x => list_sum (map (f x) ys)) xs) = list_sum (map (fun y => list_sum (map (fun x => f x y) xs)) ys).