case m; simpl in |- *; auto.
unfold restrict_code in |- *.
intros a0 l c H H1.
absurd
(In
((fun x : A * nat => (fst x, find_code eqA_dec (fst x) c))
(a0, number_of_occurrences eqA_dec a0 (a0 :: l))) nil);
auto with datatypes.
rewrite <- H1.
apply
in_map with (f := fun x : A * nat => (fst x, find_code eqA_dec (fst x) c)).
apply frequency_number_of_occurrences; auto with datatypes.
Qed.

(* Specifications: *)
(* The leaves of the build tree from the restrict code are the keys of the frequency list *)
Theorem restrict_code_pbbuild :
forall c : code A,
not_null c ->
unique_prefix c ->
in_alphabet m c ->
m <> nil ->
permutation (map fst (frequency_list eqA_dec m))
(all_pbleaves (pbbuild empty (restrict_code m c))).