(* A code is unique_prefix, if there is no encoding that is prefix of another *)
Definition unique_prefix (l : code) :=
  (forall (a1 a2 : A) (lb1 lb2 : list bool),
   In (a1, lb1) l -> In (a2, lb2) l -> is_prefix lb1 lb2 -> a1 = a2) /\
  unique_key l.

Theorem unique_prefix_permutation : forall c1 c2 : code, permutation c1 c2 -> unique_prefix c1 -> unique_prefix c2.