(** ** Building the sorted list *)

  Inductive flat_spec (T:Tree) : Type :=
    flat_exist :
    forall l:list A,
      Sorted leA l ->
      (forall a:A, leA_Tree a T -> HdRel leA a l) ->
      meq (contents T) (list_contents _ eqA_dec l) -> flat_spec T.(** ** Building the sorted list *)

  Inductive flat_spec (T:Tree) : Type :=
    flat_exist :
    forall l:list A,
      Sorted leA l ->
      (forall a:A, leA_Tree a T -> HdRel leA a l) ->
      meq (contents T) (list_contents _ eqA_dec l) -> flat_spec T.

(* Specifications: *)
#[deprecated(since="8.3", note="Use mergesort.v")] Lemma heap_to_list : forall T:Tree, is_heap T -> flat_spec T.
#[deprecated(since="8.3", note="Use mergesort.v")] Theorem treesort : forall l:list A, {m : list A | Sorted leA m & permutation _ eqA_dec l m}.