Proof with auto. (* todo: rename *)
induction l.
simpl. intros.
repeat rewrite mon_lunit.
rewrite H.
unfold compose...
intros.
simpl.
repeat rewrite mon_assoc.
apply e. intro.
repeat rewrite mon_assoc.
apply IHl.
intro. unfold compose.
repeat rewrite mon_lunit.
rewrite H.
unfold compose.
destruct x...
Qed.
Fixpoint simple_filter (c: T -> M bool) (l: list T): M (list T) :=
match l with
| nil => ret nil
| h :: t =>
t' <- simple_filter c t ;
b <- c h ;
ret (if b then h :: t' else t')
end.
Definition fold_filter (c: T -> M bool): list T -> M (list T) :=
foldrM (fun x l => b <- c x ; ret (if b then x :: l else l)) nil.

(* Specifications: *)
Lemma simple_fold_filter: forall c l, simple_filter c l = fold_filter c l.
Proof with auto.