Definition beq_X (x y: X): bool := unsum_bool (eq_X_dec x y).

(* Specifications: *)
Lemma counts_0_length_0 (l: list X): (forall i, count (beq_X i) l = 0%nat) -> length l = 0%nat.
Lemma counts_0_expec_length_0 t: (forall i, expec (count (beq_X i)) t = 0) -> expec (@length (_:Set)) t = 0.
Lemma exp_list_sum_le (fr: X -> R) (q: list X) (t: ne_tree.T (list X)): (forall i, In i q -> expec (count (beq_X i)) t <= fr i) -> (forall i, ~ In i q -> expec (count (beq_X i)) t = 0) -> expec (@length (_:Set)) t <= Rsum (map fr q).