Section FoldLeft.
Variables (T R : Type) (f : R -> T -> R).
Fixpoint foldl z s := if s is x :: s' then foldl (f z x) s' else z.
End Flatten.
Prenex Implicits flatten shape reshape.

Lemma sumn_flatten (ss : seq (seq nat)) :
sumn (flatten ss) = sumn (map sumn ss).