(* 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_pbnode : forall c1 c2, c1 <> nil -> c2 <> nil -> pbbuild (map (fun x => (fst x, false :: snd x)) c1 ++ map (fun x => (fst x, true :: snd x)) c2) = pbnode (pbbuild c1) (pbbuild c2).