(* Turn a code into a tree *) 
Definition pbbuild (l : code A) : pbtree :=
  fold_right (fun a c => pbadd (fst a) c (snd a)) (pbleaf empty) l.

Theorem pbbuild_compute_perm : forall c, c <> nil -> unique_prefix c -> permutation (compute_pbcode (pbbuild c)) c.