Module Type TREE.
Parameter elt: Type.
Parameter elt_eq: forall (a b: elt), {a = b} + {a <> b}.
Parameter t: Type -> Type.
Parameter empty: forall (A: Type), t A.
Parameter get: forall (A: Type), elt -> t A -> option A.
Parameter set: forall (A: Type), elt -> A -> t A -> t A.
Parameter remove: forall (A: Type), elt -> t A -> t A.
(** Extensional equality between trees. *)
Parameter beq: forall (A: Type), (A -> A -> bool) -> t A -> t A -> bool.

Axiom beq_correct:
forall (A: Type) (eqA: A -> A -> bool) (t1 t2: t A),
beq eqA t1 t2 = true <->
(forall (x: elt),
match get x t1, get x t2 with
| None, None => True
| Some y1, Some y2 => eqA y1 y2 = true
| _, _ => False
end).