Proof using.
intros p l x p' f H_m.
pose proof map_eq_inv f _ _ _ H_m.
break_exists_name l1.
break_exists_name l2.
break_and.
find_rewrite.
destruct l2; simpl in *.
- match goal with H : [] = _ :: _ |- _ => contradict H end.
auto with datatypes.
- repeat find_rewrite.
find_inversion.
exists l1, a, l2. auto.
Qed.

Lemma map_eq_inv_eq :
forall (f : A -> B),
(forall a a', f a = f a' -> a = a') ->
forall l l', map f l = map f l' -> l = l'.