Proof using.
intros a l; elim l; simpl in |- *; auto.
intros a0 l0 H H0; case (eqA_dec a a0); auto.
intros H1; case H0; auto.
Qed.

(* All the occurrences of an element can be gathered in the list *)
Theorem number_of_occurrences_permutation_ex :
forall (m : list A) (a : A),
exists m1 : list A,
permutation m (id_list a (number_of_occurrences a m) ++ m1) /\ ~ In a m1.