Distinct items of mapped lists #
The items f i k for the distinct indices i of a list and the distinct entries k of lists
ks i are distinct when f determines both i and k (List.nodup_flatMap_map).
Main results #
List.nodup_flatMap_map: the flat map of the mapped lists has no duplicates.List.nodup_flatMap_zipIdx: numbering both levels distinguishes every occurrence.
References #
From VP ≠ VNP over every field [Ant26], Appendix J.3: the keys of the units that
the evaluator of the proof of Theorem J.3 writes (p. 54); source module Nc.Grp.StepBase.
theorem List.nodup_flatMap_map {ι : Type u_1} {κ : Type u_2} {β : Type u_3} {l : List ι} (hl : l.Nodup) {ks : ι → List κ} (hks : ∀ (i : ι), (ks i).Nodup) {f : ι → κ → β} (hf : ∀ (i : ι) (k : κ) (i' : ι) (k' : κ), f i k = f i' k' → i = i' ∧ k = k') :
The items f i k of several lists ks i, for the indices i of a list without duplicates,
are distinct if the lists have no duplicates and f i k determines i and k.
theorem List.nodup_flatMap_zipIdx {α : Type u_1} {β : Type u_2} {γ : Type u_3} (l : List α) (ks : α → List β) {f : α × ℕ → β × ℕ → γ} (key : γ → ℕ × ℕ) (hkey : ∀ (i : α × ℕ) (k : β × ℕ), key (f i k) = (i.2, k.2)) :
A flattened enumeration has distinct entries if each output identifies its two indices.