Proof using.
induction l; simpl; intros xs ys H.
- symmetry in H. apply app_eq_nil in H. break_and. subst.
exists [], []. auto.
- destruct xs; simpl in *.
+ exists [], (a :: l). intuition.
+ invc H. find_apply_hyp_hyp.
break_exists_name l1.
break_exists_name l2.
break_and.
exists (a :: l1), l2. subst.
intuition.
Qed.

(* Specifications: *)
Lemma map_partition :
forall p l (x : B) p' (f : A -> B),
map f l = (p ++ x :: p') ->
exists ap a ap',
l = ap ++ a :: ap' /\
map f ap = p /\
f a = x /\
map f ap' = p'.