Section quadratic.
Definition plain_leb: nat -> nat -> IdMonad.M bool := leb.
(*Eval compute in (isort _ plain_leb numbers).*)
Variables (T: Set) (le: T -> T -> bool).
Definition mle (x y: T): SimplyProfiled bool := (1, le x y).
Proof with auto with arith.
induction l...
intros.
rewrite insert_unfold, bind_cost.
destruct (result (mle x a)).
rewrite return_cost.
simpl...
rewrite bind_cost, return_cost.
deep_le_trans IHl...
simpl.
omega.
Qed.

Lemma fold_insert_cost : forall (x y: list T),
cost (foldlM (insert _ mle) y x) <= length y * length x + div2 (sqrd (length x)).