Section expec_ctors.
Variables (T: Set) (f: T -> nat).
End expec_ctors.
(* misc expec *)
Add Parametric Morphism (A: Set): (@expec A)
with signature (@ext_eq A nat) ==> (@ext_eq (ne_tree.T A) R)
as expec_ext_morph.
Proof with auto.
induction t.
repeat rewrite expec_Leaf.
apply plus_INR.
repeat rewrite expec_Node_one...
repeat rewrite expec_Node_cons.
rewrite IHt.
rewrite IHt0.
field...
Qed.
Hint Resolve expec_nonneg.

Lemma expec_le (X: Set) (f g: X -> nat) (t: ne_tree.T X):
(forall x, ne_tree.In x t -> (f x <= g x)%nat) -> expec f t <= expec g t.