Notation disjoint xs ys := (forall x, In x xs -> In x ys -> False).

(* Specifications: *)
Lemma removeAfterIndex_le_In : forall xs i x, eIndex x <= i -> In x xs -> In x (removeAfterIndex xs i).
Lemma removeAfterIndex_In_le : forall xs i x, sorted xs -> In x (removeAfterIndex xs i) -> eIndex x <= i.
Lemma removeAfterIndex_covariant : forall xs ys i x, sorted xs -> sorted ys -> In x (removeAfterIndex xs i) -> (forall x, In x xs -> In x ys) -> In x (removeAfterIndex ys i).
Lemma removeAfterIndex_le : forall xs i j, i <= j -> removeAfterIndex xs i = removeAfterIndex (removeAfterIndex xs j) i.
Lemma removeAfterIndex_2_subseq : forall xs i j, subseq (removeAfterIndex (removeAfterIndex xs i) j) (removeAfterIndex (removeAfterIndex xs j) i).
Lemma removeAfterIndex_comm : forall xs i j, removeAfterIndex (removeAfterIndex xs i) j = removeAfterIndex (removeAfterIndex xs j) i.
Lemma removeAfterIndex_2_eq_min : forall xs i j, removeAfterIndex (removeAfterIndex xs i) j = removeAfterIndex xs (min i j).
Lemma findAtIndex_None : forall xs i x, sorted xs -> findAtIndex xs i = None -> In x xs -> eIndex x <> i.
Lemma findAtIndex_removeAfterIndex_agree : forall xs i j e e', NoDup (map eIndex xs) -> findAtIndex xs i = Some e -> findAtIndex (removeAfterIndex xs j) i = Some e' -> e = e'.
Lemma subseq_uniqueIndices : forall ys xs, subseq xs ys -> uniqueIndices ys -> uniqueIndices xs.
Lemma subseq_findGtIndex : forall xs i, subseq (findGtIndex xs i) xs.
Lemma findGtIndex_in : forall xs i x, In x (findGtIndex xs i) -> In x xs.
Lemma findGtIndex_sufficient : forall e entries x, sorted entries -> In e entries -> eIndex e > x -> In e (findGtIndex entries x).