Section suml.
Fixpoint suml (l : list nat) : nat :=
match l with
| nil => 0
| n :: l' => n + suml l'
end.

Lemma maxl_le_suml_map (A B : Type) (f : A -> list B) (g : B -> nat) (h : A -> nat) (l : list A) :
(forall a, In a l -> maxl (map g (f a)) <= h a) ->
maxl (map g (flat_map f l)) <= suml (map h l).