(* extract a value from a distribution arbitrarily, in this case taking the first elt of the underlying list *)
Definition peek {X} (d : dist X) : X :=
match d with
| {| dist_pmf := dist; dist_law := law |} =>
match dist as l return ((sum_dist l == 1)%Q -> X) with
| [] => fun law =>
match zero_one_neq law with end
| (x,_) :: _ => fun _ => x
end law
end.
(* WARNING: distribution should contain non-zero weighted support *)
Definition dist_lift {X} (P : X -> Prop) (d : dist X) : Prop.

Lemma dist_lift_bind (X Y : Type) (P : X -> Prop)
(Q : Y -> Prop) (mx : dist X) (f : X -> dist Y) :
dist_lift P mx ->
(forall x : X, P x -> dist_lift Q (f x)) ->
dist_lift Q (x <- mx;; f x).