Definition indicate (b : bool) : Q :=
  if b then 1 else 0.Definition indicate_nat (b : bool) : nat :=
  if b then 1 else O.

Lemma filter_dist_flat_map {X Y} (f : X -> list (Y * Q)) (xs : list X) (p : Y -> bool) : filter_dist (flat_map f xs) p = flat_map (fun x => filter_dist (f x) p) xs.