Word Pattern Reflection, Avoidability, Free Sets, and Zimin Words #
A finite pattern u : List A is reflected by a word v : List B (Cslib.Word.Reflects v u)
if there is a map φ : A → List B sending every letter occurring in u to a nonempty word over
B such that u.flatMap φ occurs as a contiguous factor of v. Following Bean, Ehrenfeucht, and
McNulty [BEMcN79], a pattern w : List A is unavoidable
(Cslib.Word.IsUnavoidable) if for every finite alphabet B, only finitely many words over B
fail to reflect w; otherwise w is avoidable (Cslib.Word.IsAvoidable).
This module develops the foundational algebra of pattern reflection, avoidability of repeated
adjacent letters via Thue's ternary square-free words [Thu06], letter deletion and
identification, free letters and free sets via alternating 2-factor chains
[BeanEhrenfeuchtMcNulty1979, Definition 3.18], the Bean–Ehrenfeucht–McNulty telescoping morphism
lift across free-set deletion [BeanEhrenfeuchtMcNulty1979, Lemma 3.20], canonical Zimin words
Z_k (Cslib.Word.ziminWord) [Zim84], the equivalence between free-set reducibility and
reflection in Z_k [Sapir2014, Section 2.5], and the unavoidability of every Z_k under standard
Lean axioms.
Main definitions #
Cslib.Word.Reflects: non-erasing morphic factor relationu.flatMap φ <:+: v.Cslib.Word.IsUnavoidableFor: finiteness of non-reflecting words inside a languageL.Cslib.Word.IsUnavoidable/Cslib.Word.IsAvoidable: unavoidability and avoidability of a word pattern across all finite alphabets.Cslib.Word.deleteLetters/Cslib.Word.deleteLetter/Cslib.Word.identifyLetters: letter-set deletionw^X, single-letter deletionw^x, and letter identificationx ↦ y.Cslib.Word.HasAlternatingChain/Cslib.Word.IsFreeLetter/Cslib.Word.IsFreeSet: alternating2-factor chains, free letters, and free sets in a pattern.Cslib.Word.SameRightNeighbor: shared-right-neighbor relation on left components of2-factors.Cslib.Word.ziminWord: canonical Zimin wordsZ_0 = [],Z_{k+1} = Z_k ++ [k] ++ Z_k.Cslib.Word.IsFreeSetReducible/Cslib.Word.IsBEMReducible: Sapir/Zimin free-set reducibility and Bean–Ehrenfeucht–McNulty reducibility to[].
Main results #
Cslib.Word.Reflects.trans: word reflection is transitive across morphisms.Cslib.Word.isAvoidable_of_pair_infix: any pattern containing[x, x]as a factor is avoidable.Cslib.Word.hasAlternatingChain_iff_reflTransGen: reachability characterization of alternating2-factor chains.Cslib.Word.flatMap_telescoping: boundary-cancelling telescoping identity for word morphisms.Cslib.Word.reflects_append_singleton_of_isFreeSet: telescoping morphism lift across deletion of a free set.Cslib.Word.isFreeSetReducible_iff_exists_reflects_ziminWord: free-set reducibility is equivalent to reflection in some Zimin wordziminWord k.Cslib.Word.isUnavoidable_ziminWord: every canonical Zimin wordziminWord kis unavoidable.
Reflection is reflexive.
An injective letter-wise renaming reflects in both directions: w reflects w.map f.
Unfolded characterization of IsAvoidable.
Singleton-set characterization of deleteLetter.
Replace every occurrence of x in w by y (letter identification).
Deleting any letter set from [] yields [].
deleteLetters distributes over word concatenation.
deleteLetters X drops a head letter belonging to X.
deleteLetters X retains a head letter outside X.
Membership in deleteLetters X w holds iff the letter lies in w and outside X.
Deleting letters does not increase word length.
Computable List.filter characterization of deleteLetters under [DecidablePred (· ∈ X)].
Deleting X then Y equals deleting X ∪ Y.
If no letter of X occurs in w, deleteLetters X w = w.
Factor containment is preserved under deleteLetters.
Deleting x from [] yields [].
deleteLetter distributes over word concatenation.
deleteLetter x drops a matching head letter x.
deleteLetter x retains any head letter a ≠ x.
Membership in deleteLetter x w holds iff the letter lies in w and differs from x.
Computable List.filter characterization of deleteLetter under [DecidableEq A].
Letter identification on [] yields [].
identifyLetters distributes over word concatenation.
identifyLetters x y replaces a head x by y.
identifyLetters x y leaves any head a ≠ x unchanged.
Computable List.map characterization of identifyLetters under [DecidableEq A].
identifyLetters x y w always reflects w.
Existence of an alternating 2-factor chain x a₁, b₁ a₁, b₁ a₂, …, b_{n-1} a_n, b_n a_n, b_n y (n > 0) among the contiguous 2-factors of w.
Unfolded characterization of IsFreeLetter.
Unfolded characterization of IsFreeSet.
Every letter of a free set X that occurs in w is a free letter for w.
Any direct 2-factor [x, y] <:+: w yields a length-1 alternating chain from x to y.
Shared-right-neighbor step ∃ c, [u, c] <:+: w ∧ [v, c] <:+: w on left components of
2-factors of w.
Graph-reachability characterization of HasAlternatingChain: an alternating 2-factor chain
from x to y exists if and only if some b reachable from x via SameRightNeighbor w steps
satisfies [b, y] <:+: w.
Telescoping Block-Morphism Lemma: if X is a free set for w : List A and every letter
z ∈ w outside X maps under φ to a word a :: u z starting with a : B of length at least
2 (u z ≠ []), then there exists a morphism ψ : A → List B sending every letter of w to a
nonempty word such that w.flatMap ψ <:+: (deleteLetters X w).flatMap φ ++ [a].
If X is a free set for w and ziminWord k reflects deleteLetters X w, then
ziminWord (k + 1) reflects w.
Reducibility of a pattern to [] by iteratively deleting free sets
([Zim84]; [Sapir2014, Section 2.5]).
- nil {A : Type u_1} : IsFreeSetReducible []
- delete_freeSet {A : Type u_1} {w : List A} {X : Set A} : IsFreeSet w X → IsFreeSetReducible (deleteLetters X w) → IsFreeSetReducible w
Reducibility of a pattern to [] by iteratively deleting a free letter or identifying two
distinct letters occurring in the pattern ([BeanEhrenfeuchtMcNulty1979, Section 3, p. 284]).
- nil {A : Type u_1} : IsBEMReducible []
- delete_freeLetter {A : Type u_1} {w : List A} {x : A} : IsFreeLetter w x → IsBEMReducible (deleteLetter x w) → IsBEMReducible w
- identify_letters {A : Type u_1} {w : List A} {x y : A} : x ∈ w → y ∈ w → x ≠ y → IsBEMReducible (identifyLetters x y w) → IsBEMReducible w
Free-set reducibility is equivalent to reflection in some Zimin word ziminWord k.