List append boundaries and unary delimiters #
Main results #
List.rdropWhile_append: drop matching suffix elements across an append boundary.List.zip_tail_append_cons: split adjacent pairs at a shared boundary element.List.append_cons_inj_of_notMem_prefix: two splits of a list at an element that occurs in neither prefix coincide.List.exists_eq_append_cons_of_exists_mem: a list with an element satisfyingpsplits at its first such element.List.flatMap_singleton_injective: a substitution by singletons is injective on words whenever the underlying map is injective.List.replicate_not_append_cons_inj,List.replicate_true_append_false_inj: a unary block followed by its delimiter determines both its length and the remaining suffix.List.idxOf_replicate_append_cons_of_ne,List.idxOf_false_replicate_append,List.idxOf_true_replicate_false_append: the index of a delimiter following a unary block.List.eq_replicate_idxOf_false,List.eq_replicate_idxOf_true: canonical decomposition of a word by its first delimiter.
Dropping from the right of an appended list drops from the suffix first.
Split consecutive pairs at a boundary element shared by the two list segments.
theorem List.flatMap_singleton_injective {α : Type u_1} {β : Type u_2} {f : α → β} (hf : Function.Injective f) :
Function.Injective fun (w : List α) => flatMap (fun (a : α) => [f a]) w
A substitution by singletons is injective on words whenever the underlying map is injective.