Lemmas on lists #
Candidates for Mathlib's lemmas on lists, about the notions of core: filtering a list before
List.flatMap f changes nothing when every element x with f x ≠ [] passes the filter, the
counterpart of Finset.prod_filter_of_ne, next to List.flatMap_congr, and so a list without
duplicates within another one without duplicates that holds every x with f x ≠ [] gives a
permutation of its List.flatMap f; and a filter by a test that holds on all elements of a list
or on none keeps all of it or nothing.
Main statements #
List.flatMap_filter_of_ne: a filter beforeList.flatMapthat changes nothing.List.perm_flatMap_of_nodup: theList.flatMapof a list without duplicates of members of a listlwithout duplicates, in any order, that holds every member with a nonempty image, is a permutation of that ofl.List.filter_eq_ite_of_forall: a filter that keeps all of a list or nothing.
Filtering the list l by p before List.flatMap f changes nothing when every element x
of l with f x ≠ [] satisfies p; compare Finset.prod_filter_of_ne.
A list l' without duplicates whose members lie in the list l without duplicates, and which
holds every member x of l with f x ≠ [], gives a permutation of l.flatMap f, whatever the
order of l': l' is a permutation of the members of l that it holds
(List.perm_ext_iff_of_nodup), and the others give nothing (List.flatMap_filter_of_ne).