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

Lemma Permutation_flat_map_ext A B  : forall l (f g : A -> list B),
(forall x, In x l -> Permutation (f x) (g x)) -> Permutation (flat_map f l) (flat_map g l).