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 ulist_unique_key : forall (A B : Type) (l : list (A * B)), ulist (map (fst (B:=_)) l) -> unique_key l.