Proof using.
intros.
induction nms; simpl in *.
- apply NoDup_nil.
- invc_NoDup.
apply NoDup_cons.
* assert (forall nm, In nm nms -> snd nm = snd a).
intuition eauto.
destruct a.
apply snd_eq_not_in_map with (m := b); auto.
* apply IHnms; auto.
Qed.

(* Specifications: *)
Lemma in_fold_left_by_cons_in :
forall (l : list B) (g : B -> A) x acc,
In x (fold_left (fun a b => g b :: a) l acc) ->
In x acc \/ exists y, In y l /\ x = g y.