(* 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_true_pbright : forall c, c <> nil -> pbbuild (map (fun x => (fst x, true :: snd x)) c) = pbright (pbbuild c).