(* Turn a partial tree into a binary tree *)
Fixpoint to_btree (a : pbtree A) : btree A :=
  match a with
  | pbleaf b => leaf b
  | pbleft l1 => to_btree l1
  | pbright l1 => to_btree l1
  | pbnode l1 l2 => node (to_btree l1) (to_btree l2)
  end.

Theorem to_btree_smaller : forall t a, length (find_code eqA_dec a (compute_code (to_btree t))) <= length (find_code eqA_dec a (compute_pbcode t)).