Proof with auto.
intros.
apply Rle_trans with (RsumOver (ijs (length ol)) (fun ij => 2 / INR (S (snd ij - fst ij)))).
destruct (indices ee ol).
destruct H.
rewrite H.
cset (@qs_CM_U_expec_cost_eq.qs_CM_U_expec_cost_eq ee ol x).
simpl monoid_type in H1.
rewrite H1.
rewrite map_length.
apply Umonoid_expec_qs_bounded_by_sumOver_ijs...
apply sumOver_ijs_bound.
Qed.
End contents.

(* Specifications: *)
Theorem qs_avg_complexity (ee: E):
over (@length (_:Set)), expec cost ∘ @NDP.qs ee =O(fun n => INR (n * log2ceil n)).