(* 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 inpb_pbbuild_inv : forall a c, c <> nil -> inpb (pbleaf a) (pbbuild c) -> exists l : _, In (a, l) c.