(* Ravg *)

Definition Ravg (l: list R): R := Rsum l / INR (length l).

Lemma Ravg_comp_map X (f: X -> R) (m: list X -> R) (g: R -> R): (forall a b, g (a * b) = g a * b) -> (forall l, g (Rsum l) = Rsum (map g l)) -> (forall l: list X, Ravg (map f l) = g (m l)) -> forall u, Ravg (map (fun l => Ravg (map f l)) u) = g (Ravg (map m u)).