(* 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_all_leaves : forall t, all_leaves (to_btree t) = all_pbleaves t.