Fixpoint filterMap {A B} (f : A -> option B) (l : list A) : list B :=
  match l with
    | [] => []
    | x :: xs => match f x with
                   | None => filterMap f xs
                   | Some y => y :: filterMap f xs
                 end
  end.

Lemma filterMap_NoDup_inj : forall (f : A -> option B) l, (forall x1 x2 y, f x1 = Some y -> f x2 = Some y -> x1 = x2) -> NoDup l -> NoDup (filterMap f l).