(** Wrapping in a dependent type *)

Definition t := { h: R.heap | R.bst h }.(** Operations *)

Program Definition empty : t := R.Empty.Program Definition insert (x: E.t) (h: t) : t := R.insert x h.Program Definition findMin (h: t) : option E.t := R.findMin h.Program Definition deleteMin (h: t) : t := R.deleteMin h.Program Definition findMax (h: t) : option E.t := R.findMax h.Program Definition deleteMax (h: t) : t := R.deleteMax h.(** Membership (for specification) *)

Program Definition In (x: E.t) (h: t) : Prop := R.In x h.

Lemma In_empty: forall x, ~In x empty.