Module E := X.Module Raw := Raw I X.#[universes(template)]
 Record bst (elt:Type) :=
  Bst {this :> Raw.tree elt; is_bst : Raw.bst this}.#[universes(template)]
 Record bst (elt:Type) :=
  Bst {this :> Raw.tree elt; is_bst : Raw.bst this}.#[universes(template)]
 Record bst (elt:Type) :=
  Bst {this :> Raw.tree elt; is_bst : Raw.bst this}.#[universes(template)]
 Record bst (elt:Type) :=
  Bst {this :> Raw.tree elt; is_bst : Raw.bst this}.Definition t := bst.Definition key := E.t.Implicit Types m : t elt.Implicit Types x y : key.Implicit Types e : elt.Definition empty : t elt := Bst (empty_bst elt).Definition is_empty m : bool := Raw.is_empty (this m).Definition add x e m : t elt := Bst (add_bst x e (is_bst m)).Definition remove x m : t elt := Bst (remove_bst x (is_bst m)).Definition mem x m : bool := Raw.mem x (this m).Definition find x m : option elt := Raw.find x (this m).Definition map f m : t elt' := Bst (map_bst f (is_bst m)).Definition mapi (f:key->elt->elt') m : t elt' :=
  Bst (mapi_bst f (is_bst m)).Definition map2 f m (m':t elt') : t elt'' :=
  Bst (map2_bst f (is_bst m) (is_bst m')).Definition elements m : list (key*elt) := Raw.elements (this m).Definition cardinal m := Raw.cardinal (this m).Definition fold (A:Type) (f:key->elt->A->A) m i := Raw.fold (A:=A) f (this m) i.Definition equal cmp m m' : bool := Raw.equal cmp (this m) (this m').Definition MapsTo x e m : Prop := Raw.MapsTo x e (this m).Definition In x m : Prop := Raw.In0 x (this m).Definition Empty m : Prop := Empty (this m).Definition eq_key : (key*elt) -> (key*elt) -> Prop := @PX.eqk elt.Definition eq_key_elt : (key*elt) -> (key*elt) -> Prop := @PX.eqke elt.Definition lt_key : (key*elt) -> (key*elt) -> Prop := @PX.ltk elt.

Lemma elements_1 : forall m x e, MapsTo x e m -> InA eq_key_elt (x,e) (elements m).