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.
(** Applying a function to all data of a tree. *)
Parameter map:
forall (A B: Type), (elt -> A -> B) -> t A -> t B.
(** Same as [map], but the function does not receive the [elt] argument. *)
Parameter map1:
forall (A B: Type), (A -> B) -> t A -> t B.
(** Applying a function pairwise to all data of two trees. *)
Parameter combine:
forall (A B C: Type), (option A -> option B -> option C) -> t A -> t B -> t C.
(** Enumerating the bindings of a tree. *)
Parameter elements:
forall (A: Type), t A -> list (elt * A).
(** Folding a function over all bindings of a tree. *)
Parameter fold:
forall (A B: Type), (B -> elt -> A -> B) -> t A -> B -> B.

Axiom fold_spec:
forall (A B: Type) (f: B -> elt -> A -> B) (v: B) (m: t A),
fold f m v =
List.fold_left (fun a p => f a (fst p) (snd p)) (elements m) v.