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

Lemma length_remove_count_occ A eq_dec (a: A) l:
length l = length (remove eq_dec a l) + count_occ eq_dec l a.