Definition normalize {X} `{Finite X} (d : dist X) : dist X.
refine {|
dist_pmf := map (fun x => (x, eval_dist d (Classes.eqb x))) enum;
dist_law := _;
|}.

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).