Zimin's Theorem and the Bean–Ehrenfeucht–McNulty Characterization #
This module establishes the equivalence of four conditions characterizing unavoidable word patterns
([BeanEhrenfeuchtMcNulty1979, Theorem 3.22, pp. 284–285]; [Zimin1984, Theorem 1];
[Sapir2014, Theorem 2.5.14]): a finite pattern w : List A is unavoidable if and only if some
canonical Zimin word ziminWord k reflects w, if and only if w reduces to [] by iteratively
deleting free sets (Cslib.Word.IsFreeSetReducible), if and only if w reduces to [] by
iteratively deleting free letters and identifying distinct occurring letters
(Cslib.Word.IsBEMReducible).
Note the formalization conventions relative to the classical literature:
- Both
IsFreeSetReducibleandIsBEMReduciblestop at the empty word[](including the empty pattern) rather than at a 1-letter word (equivalent on nonempty words via one final free deletion of the remaining singleton). exists_reflects_ziminWordandisUnavoidable_iff_exists_reflects_ziminWordstate the existential-index characterization (∃ k, Reflects (ziminWord k) w) rather than fixingkto the number of distinct letters occurring inw(as in [Sapir2014, Theorem 2.5.14]).- Pattern reflection (
Reflects) uses a non-erasing substitution on letters occurring in the pattern together with contiguous factor containment (<:+:).
To establish necessity (IsUnavoidable w → ∃ k, Reflects (ziminWord k) w) constructively under
standard Lean axioms, we iterate a q-uniform affine-line block morphism over Fin q × Fin q for
q = w.length + 2, project along a boundary-safe coordinate slot found by pigeonhole, and lift
reflection in ziminWord k₀ across deleted non-occurring-slot letters via rainbow-padded Zimin
words. As corollaries we deduce that every nonempty unavoidable pattern admits a free letter and
that every unavoidable pattern over r letters has length at most 2 ^ r - 1.
Main results #
Cslib.Word.IsUnavoidable.exists_reflects_ziminWord: every unavoidable pattern is reflected by some canonical Zimin wordziminWord k.Cslib.Word.isUnavoidable_iff_exists_reflects_ziminWord: Zimin's Theorem —wis unavoidable iff someziminWord kreflectsw.Cslib.Word.isUnavoidable_iff_isFreeSetReducible: Zimin–Sapir Theorem —wis unavoidable iffwreduces to[]by iteratively deleting free sets.Cslib.Word.IsFreeSet.isUnavoidable_of_deleteLetters/Cslib.Word.IsFreeLetter.isUnavoidable_of_deleteLetter: deleting a free set or free letter reflects unavoidability backwards.Cslib.Word.isUnavoidable_iff_isBEMReducible: Bean–Ehrenfeucht–McNulty Theorem —wis unavoidable iffwreduces to[]by deleting free letters and identifying occurring letters.Cslib.Word.IsUnavoidable.exists_isFreeLetter: every nonempty unavoidable pattern has at least one free letter.Cslib.Word.IsUnavoidable.length_le_two_pow_card_sub_one: every unavoidable pattern whose letters lie ins : Finset Ahas length at most2 ^ s.card - 1.