(* Create a frequency list from a message *)
Fixpoint frequency_list (l : list A) : list (A * nat) :=
  match l with
  | nil => nil
  | a :: l1 => add_frequency_list a (frequency_list l1)
  end.

Theorem frequency_list_perm : forall l : list A, permutation l (flat_map (fun p => id_list (fst p) (snd p)) (frequency_list l)).