(* Uniqueleaf is decidable *)
Definition distinct_leaves_dec :
  forall a, {distinct_leaves a} + {~ distinct_leaves a}.(* Compute the code associated with a binary tree *)
Fixpoint compute_code (a : btree) : list (A * list bool) :=
  match a with
  | leaf b => (b, nil) :: nil
  | node l1 l2 =>
      map
        (fun v : A * list bool =>
         match v with
         | (a1, b1) => (a1, false :: b1)
         end) (compute_code l1) ++
      map
        (fun v : A * list bool =>
         match v with
         | (a1, b1) => (a1, true :: b1)
         end) (compute_code l2)
  end.

Theorem in_alphabet_compute_code : forall m t, (forall a : A, In a m -> inb (leaf a) t) -> in_alphabet m (compute_code t).