(* Restrict the code putting only codes of element in the frequency list *)
Definition restrict_code (m : list A) (c : code A) : 
  code A :=
  map (fun x => (fst x, find_code eqA_dec (fst x) c))
    (frequency_list eqA_dec m).

Theorem frequency_list_restric_code_map : forall c, map (fst (B:=_)) (frequency_list eqA_dec m) = map (fst (B:=_)) (restrict_code m c).