(* equality on trees is decidable  *)
Definition btree_dec : forall a b : btree, {a = b} + {a <> b}.(* Belonging is decidable *)
Definition inb_dec : forall a p, {inb a p} + {~ inb a p}.(* Compute all the leaves of the tree *)
Fixpoint all_leaves (t : btree) : list A :=
  match t with
  | leaf a => a :: nil
  | node t1 t2 => all_leaves t1 ++ all_leaves t2
  end.

Theorem all_leaves_inb : forall t a, In a (all_leaves t) -> inb (leaf a) t.