Proof with auto with real.
intros.
rewrite partition_0...
rewrite Rplus_0_l.
unfold U.M.
rewrite monoid_expec_bind_0_r...
apply sound_cmp_expec_0...
right.
apply not_In_flt.
intro.
apply (lt_asym _ _ H0).
symmetry in H1.
apply (IndicesCorrect _ _ H1).
intros.
rewrite monoid_expec_plus...
rewrite (monoid_expec_ret (U.hom_ijcount i j)).
rewrite Rplus_0_r.
apply sound_cmp_expec_0...
left.
apply not_In_flt.
intro.
cset (Ecmp_sym ee (subscript (vec.nth v pi)) (subscript i)).
simpl in H1. simpl in H2.
rewrite <- H1 in H2.
simpl in H2.
apply (lt_asym _ _ H).
apply (IndicesCorrect _ _ H2).
Qed.

(* Specifications: *)
Lemma case_BD: (i = vec.nth v pi \/ j = vec.nth v pi) ->
INR (U.ijcount i j (map (fun i0: Index ee ol => U.unordered_nat_pair i0 (vec.nth v pi)) (vec.remove v pi))) +
monoid_expec (U.ijcount i j)
(foo <- @U.qs ee ol (flt pi Lt);
bar <- @U.qs ee ol (flt pi Gt);
ret (foo ++ (vec.nth v pi :: flt pi Eq) ++ bar))
<= 1.