Definition eq_count X (d: forall (x y: X), { x = y } + { x <> y }) (x: X): list X -> nat :=
 count (fun y => unsum_bool (d x y)).

(* Specifications: *)
Lemma eq_count_0 X (d: forall (x y: X), { x = y } + { x <> y }) (x: X) l: ~ In x l -> eq_count d x l = 0%nat.
Lemma eq_count_NoDup X (d: forall (x y: X), { x = y } + { x <> y }) (x: X) l: NoDup l -> eq_count d x l <= 1.
Lemma NoDup_incl_Permutation A (a b: list A): length a = length b -> NoDup a -> incl a b -> Permutation a b.
Lemma NoDup_map' A B (f: A -> B) (l: list A): (forall x y: A, In x l -> In y l -> x <> y -> f x <> f y) -> NoDup l -> NoDup (map f l).
Lemma NoDup_map A B (f: A -> B) l: (forall x y, In x l -> In y l -> f x = f y -> x = y) -> NoDup l -> NoDup (map f l).