Module QcDoNotation.
Notation "'do!' X <- A ; B" :=
(bindGen A (fun X => B))
(at level 200, X ident, A at level 100, B at level 200).
Notation "'doM!' X <- A ; B" :=
(bindGenOpt A (fun X => B))
(at level 200, X ident, A at level 100, B at level 200).
End QcDoNotation.
(* CH: Reusing :: instead of ;; would have been nice, but I didn't manage *)
Instance bindOptMonotonicOpt
{A B} (g : G (option A)) (f : A -> G (option B))
`{SizeMonotonicOpt _ g} `{forall x, SizeMonotonicOpt (f x)} :
SizeMonotonicOpt (bindGenOpt g f).
Instance bindOptMonotonic
{A B} (g : G (option A)) (f : A -> G (option B))
`{SizeMonotonic _ g} `{forall x, SizeMonotonic (f x)} :
SizeMonotonic (bindGenOpt g f).

Lemma  semBindOptSizeOpt_subset_compat {A B : Type} (g g' : G (option A)) (f f' : A -> G (option B)) :
(forall s, isSome :&: semGenSize g s \subset isSome :&: semGenSize g' s) ->
(forall x s, isSome :&: semGenSize (f x) s \subset isSome :&: semGenSize (f' x) s) ->
(forall s, isSome :&: semGenSize (bindGenOpt g f) s \subset isSome :&: semGenSize (bindGenOpt g' f') s).