induction ls; intuition; simpl in *.
intuition.
intuition; subst.
destruct (eqd a0 a0); try congruence.
destruct (eqd a0 a); subst.
trivial.
eauto.
Qed.

Theorem map_ext_in :
forall (A B : Set)(ls : list A)(f1 f2 : A -> B),
(forall a, In a ls -> f1 a = f2 a) ->
map f1 ls = map f2 ls.