Set Implicit Arguments.
Require Vector.
Require vec.
Section contents.
Variables (T: E) (ol: list T).
Definition Index := natBelow (length ol).
Definition subscript: Index -> T := vec.nth (vec.insertion_sort (@Ele T) (@Ele_le_dec T) ol).
Definition UE: E :=
Build_E (fun x y: Index => Ecmp T (subscript x) (subscript y))
(fun x y => Ecmp_sym T (subscript x) (subscript y))
(fun x y z => Ecmp_trans T (subscript x) (subscript y) (subscript z))
(fun x y z => Ecmp_eq_trans_l T (subscript x) (subscript y) (subscript z)).
Definition IndexIn (i: nat) (l: list Index): Prop := In i (map nb_val l).
Definition IndexSeq (b: nat) (l: list Index): Prop :=
forall i, b <= i -> i < b + length l -> IndexIn i l.
Definition IndexSeq_above (b: nat) (l: list Index): Prop := IndexSeq (b - length l) l.

(* Specifications: *)
Lemma IndicesCorrect e e': Ecmp UE e e' = Lt -> e < e'.
Lemma IndicesCorrect_inv (x y: Index): x < y -> @Ele UE x y.
Proof with try assumption.