Proof using.
intros a l; generalize a; elim l; simpl in |- *; clear a l; auto.
intros (a, n) l H b.
case (eqA_dec b a); auto.
intros e; simpl in |- *; rewrite e; auto.
simpl in |- *.
intros e;
apply
permutation_trans
with
(id_list a n ++
(b :: nil) ++ flat_map (fun p => id_list (fst p) (snd p)) l);
[ idtac | simpl in |- *; auto ].
change
(permutation
((b :: nil) ++
id_list a n ++ flat_map (fun p => id_list (fst p) (snd p)) l)
(id_list a n ++
(b :: nil) ++ flat_map (fun p => id_list (fst p) (snd p)) l))
in |- *.
repeat rewrite <- app_ass; auto.
Qed.

(* Inversion theorem *)
Theorem add_frequency_list_in_inv :
forall (a1 a2 : A) (b1 : nat) l,
In (a1, b1) (add_frequency_list a2 l) -> a1 = a2 \/ In (a1, b1) l.