Proof using.
intros l a H; case in_map_inv with (1 := H); auto.
intros (a1, l1) (Hl1, Hl2); simpl in |- *.
rewrite Hl2; apply frequency_list_in with (1 := Hl1).
Qed.
(* Compute the number of occurrences of an element in a message *)
Fixpoint number_of_occurrences (a : A) (l : list A) {struct l} : nat :=
match l with
| nil => 0
| b :: l1 =>
match eqA_dec a b with
| left _ => S (number_of_occurrences a l1)
| right _ => number_of_occurrences a l1
end
end.

(* Specifications: *)
(* If an element is not in a message, its number is 0 *)
Theorem number_of_occurrences_O :
forall a l, ~ In a l -> number_of_occurrences a l = 0.