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

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