Section contents.
Variables (m: Monoid) (ms: m -> nat).
About MonoidMonadTrans.M .
Definition monoid_expec {A: Set}:
MonoidMonadTrans.M m ne_tree_monad.ext A -> R
:= expec (ms ∘ (fst (B:=_:Set))).
Hypothesis mh: monoidHomo m NatAddMonoid ms.
Definition monoid_expec_sum (T U: Set)
(g: T -> MonoidMonadTrans.M m ne_tree_monad.ext U): list T -> R
:= Rsum ∘ map (monoid_expec ∘ g).
Proof with auto.
unfold monoid_expec_sum.
intros.
intro.
unfold compose.
f_equal.
apply map_ext.
intro.
f_equal.
apply H.
Qed.

Lemma monoid_expec_Node_map (A B: Set) (f: A -> MonoidMonadTrans.M m ne_tree_monad.ext B) (l: ne_list.L A):
monoid_expec (ne_tree.Node (ne_list.map f l)) =
monoid_expec_sum f (ne_list.to_plain l) / INR (length (ne_list.to_plain l)).