(* Transform a tree in a code *) 
Fixpoint compute_pbcode (a : pbtree) : code A :=
  match a with
  | pbleaf b => (b, nil) :: nil
  | pbleft l1 =>
      map
        (fun v : A * list bool =>
         match v with
         | (a1, b1) => (a1, false :: b1)
         end) (compute_pbcode l1)
  | pbright l1 =>
      map
        (fun v : A * list bool =>
         match v with
         | (a1, b1) => (a1, true :: b1)
         end) (compute_pbcode l1)
  | pbnode l1 l2 =>
      map
        (fun v : A * list bool =>
         match v with
         | (a1, b1) => (a1, false :: b1)
         end) (compute_pbcode l1) ++
      map
        (fun v : A * list bool =>
         match v with
         | (a1, b1) => (a1, true :: b1)
         end) (compute_pbcode l2)
  end.

Theorem in_pbcompute_inpb : forall (t : pbtree) (a : A) (l : list bool), In (a, l) (compute_pbcode t) -> inpb (pbleaf a) t.