(* Specifications: *)
Lemma simpler_same_values l d c: proj1_sig (simplerPartition ee (subscript d) (map (subscript (T:=ee) (ol:=ol)) l)) c = map (subscript (T:=ee) (ol:=ol)) (proj1_sig (simplerPartition (UE ee ol) d l) c).
Theorem qs_CM_U_expec_cost_eq (tl: list (Index ee ol)): expec cost (NDP.qs ee (map (@subscript ee ol) tl)) = monoid_expec (m:=U.monoid) length (U.qs tl).
Lemma arith_part n (b i j: nat): (b <= i)%nat -> (i < j)%nat -> (j < b + S n)%nat -> (2 * / INR (S (j - i)) * INR (i - b) + (1 + (0 + (1 + 2 * / INR (S (j - i)) * INR (b + n - j))))) / INR (S n) = 2 / INR (S (j - i)).
Lemma Index_In_dec (i: Index ee ol) l: { In i l } + { ~ In i l }.
Theorem qs_comp_prob: forall i j: Index ee ol, lt i j -> forall l b, IndexSeq b l -> monoid_expec (U.ijcount i j) (U.qs (e:=ee) (ol:=ol) l) <= 2 / INR (S (j - i)).
Lemma ndi: NoDup v.
Lemma not_In_flt (k: Index ee ol) (dr: comparison) (H0: dr <> Ecmp (UE ee ol) k (vec.nth v pi)): ~ In k (flt pi dr).
Lemma ndi_flt: forall x0 cr, NoDup (flt x0 cr).
Lemma partition_0: nb_val (vec.nth v pi) <> i -> nb_val (vec.nth v pi) <> j -> U.ijcount i j (map (fun i0: Index ee ol => U.unordered_nat_pair i0 (vec.nth v pi)) (vec.remove v pi)) = 0%nat.
Lemma pivot_not_In_flt cr: ~ In (vec.nth v pi) (flt pi cr).
Lemma NoDup_comparisons (x: Index ee ol) (l: list (Index ee ol)): NoDup (x :: l) -> NoDup (map (fun i: Index ee ol => U.unordered_nat_pair i x) l).
Lemma NeTree_In_Node_inv (A: Set) (r: A) (l: ne_list.L (ne_tree.T A)): ne_tree.In r (ne_tree.Node l) -> ne_tree.InL r l.
Lemma pair_eq_inv (X Y: Set) (x x': X) (y y': Y): (x, y) = (x', y') -> x' = x /\ y' = y.
Theorem qs_sound_cmps_2: forall l, forall r, ne_tree.In r (qs l) -> forall i j, In (i, j) (fst r) -> IndexIn i l /\ IndexIn j l.
Theorem qs_sound_cmps: forall l, forall r, ne_tree.In r (qs l) -> NoDup l -> forall i j, In (i, j) (fst r) -> i < j.
Lemma sound_cmp_expec_0 i j (l: list (Index ee ol)): (~ In i l \/ ~ In j l) -> monoid_expec (U.ijcount i j) (qs l) = 0.
Lemma expec_Leaf t: expec f (ne_tree.Leaf t) = INR (f t).
Lemma expec_Node l: expec f (ne_tree.Node l) = Ravg (ne_list.map (@expec _ f) l).
Lemma expec_Node_one x: expec f (ne_tree.Node (ne_list.one x)) = expec f x.
Lemma expec_Node_cons x t: expec f (ne_tree.Node (ne_list.cons x t)) = (expec f x + expec f (ne_tree.Node t) * INR (length t)) * / INR (S (length t)).
Lemma selectPivotPart_eq n m (t: Vector.t X (S n)) (t': Vector.t X (S m)): vec.to_list t = vec.to_list t' -> selectPivotPart t = selectPivotPart t'.
Lemma ranges (b i j l: nat): (b <= i -> i < j -> j < b + l -> exists i', exists j', exists r, b + i' = i /\ S (b + i' + j') = j /\ i' + S (j' + S r) = l)%nat.
Lemma vec_cons_eq_inv X (a c: X) n (b d: Vector.t X n): Vector.cons a b = Vector.cons c d -> a = c /\ b =d.
Lemma qs_permutes: forall l, Permutation.Permutation l (qs leb l).
Lemma qs_correct: forall l, vec.sorted Xle (qs leb l).