Literal positions in a flat-mapped list #
A position in a selected block is shifted by the length of the actual preceding blocks. The intervals are bounded, disjoint and exhaustive, even when some blocks are empty or values repeat. The getter retains the selected occurrence rather than locating its value.
theorem List.flatMap_prefix_add_injective {α : Type u_1} {β : Type u_2} (l : List α) (f : α → List β) {i j k q : ℕ} (hi : i < l.length) (hj : j < (f l[i]).length) (hk : k < l.length) (hq : q < (f l[k]).length) (he : (flatMap f (take i l)).length + j = (flatMap f (take k l)).length + q) :
Flat positions retain their original block and local position, independently of values.
theorem List.exists_flatMap_prefix_add {α : Type u_1} {β : Type u_2} (l : List α) (f : α → List β) {index : ℕ} (hindex : index < (flatMap f l).length) :
Every flat-list position lies in an actual block at its literal prefix offset. Empty blocks supply no positions, and no distinctness assumption on values is used.