exists (cons x0 xs).
simpl.
split.
subst x;subst l;auto.
apply head_insertion.
destruct xs.
discriminate H1.
simpl in H1.
injection H1;clear H1;intros.
elim (IHinsertion _ _ _ H0 _ H1).
intro xss;intros.
elim H3;clear H3;intros.
exists (cons a xss).
simpl.
split.
subst y;subst l';auto.
apply tail_insertion.
auto.
Qed.

Lemma is_permutation_map : forall (B:Set)(ys1 ys2:list B),(is_permutation B ys1 ys2)->forall (A:Set)(f:A->B)(xs1:list A),(ys1 = map f xs1)->exists xs2:list A,(is_permutation A xs1 xs2)/\ys2 = map f xs2.
induction 1.