(* 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 pbfree_pbbuild_prop1 : forall a l1 l2, l2 <> nil -> unique_prefix ((a, l1) :: l2) -> pbfree l1 (pbbuild l2).