Fixpoint revflatten {A: Type} (xss: list (list A)) : list A :=
match xss with
| []       => []
| xs::xss' => revflatten xss' ++ xs
end.

Lemma Permutation_revflatten A B (f : A -> list B) l : Permutation(revflatten (map f l)) (flat_map f l).