FormalConjectures/Other/SuffixPrefixAvoidance.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1
6 declarations, 2 contain sorry, 0 declared as axioms
Suffix-prefix avoidance bound
Let $A$ and $B$ be sets of words of length $n$ over an alphabet with $q$ letters. If no (nonempty) suffix of any word in $A$ coincides with a prefix of any word in $B$, then $$|A| \cdot |B| \leq \frac{q^{2n}}{en}.$$
References:
- X post by Dmitry Rybin
- [Maximal sets of strings with no prefix-suffix overlap] (https://mathoverflow.net/questions/508648/maximal-sets-of-strings-with-no-prefix-suffix-overlap) by Dmitry Rybin, MathOverflow (2026)
- An isoperimetric inequality for word overlap by Dmitrii Zakharov (2026)
Imports (1)
- def
SuffixPrefixAvoidance.wordSuffixThe suffix of a wordw : Fin n → Fin qof lengthk + 1(the lastk + 1characters) line 45 sourceSource documentation
The suffix of a word
w : Fin n → Fin qof lengthk + 1(the lastk + 1characters).standard axioms: Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNatProof uses:
Fin.mk,HSub.hSub11 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
def wordSuffix (w : Fin n → Fin q) (k : Fin n) : Fin (k + 1) → Fin q := …
- def
SuffixPrefixAvoidance.wordPrefixThe prefix of a wordw : Fin n → Fin qof lengthk + 1(the firstk + 1characters) line 49 sourceSource documentation
The prefix of a word
w : Fin n → Fin qof lengthk + 1(the firstk + 1characters).standard axioms: Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNatProof uses:
Fin.mk9 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
def wordPrefix (w : Fin n → Fin q) (k : Fin n) : Fin (k + 1) → Fin q := …
- def
SuffixPrefixAvoidance.IsSuffixPrefixAvoidingTwo sets of words $A, B$ overFin qof lengthnare suffix-prefix avoiding if no nonempty suffix of any word in $A$ equals any prefix of any word in $B$ of the same length line 54 sourceSource documentation
Two sets of words $A, B$ over
Fin qof lengthnare suffix-prefix avoiding if no nonempty suffix of any word in $A$ equals any prefix of any word in $B$ of the same length.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,FinProof uses:
Membership.mem,Ne,HAdd.hAdd,OfNat.ofNat, SuffixPrefixAvoidance.wordSuffix, SuffixPrefixAvoidance.wordPrefix6 instances, coercions and auxiliary constants left out.
def IsSuffixPrefixAvoiding (A B : Finset (Fin n → Fin q)) : Prop := …
- theorem
SuffixPrefixAvoidance.words_naive_bound$A$ and $B$ are sets of words of length $n$ over alphabet with $q$ letters line 62 sourceSource documentation
$A$ and $B$ are sets of words of length $n$ over alphabet with $q$ letters. Trivially then $|A| \cdot |B|$ is at most $q^{2n}$.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Fin,LE.le,HMul.hMul,Finset.card,HPow.hPow,OfNat.ofNatProof uses:
of_eq_true,Eq.trans,True,congrArg,HAdd.hAdd,two_mul,pow_add,Fintype,Eq,Fintype.card,eq_true,LE.le.trans_eq,Finset.card_le_univ,congrFun',Finset.prod,Finset.univ,Fintype.card_pi,Finset.prod_congr,Eq.refl,Membership.memand 3 more32 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
theorem words_naive_bound (A B : Finset (Fin n → Fin q)) : A.card * B.card ≤ q ^ (2 * n) := by … - theorem
SuffixPrefixAvoidance.suffix_prefix_avoidance_bound$A$ and $B$ are sets of words of length $n$ over alphabet with $q \geq 1$ letters sorry line 76 sourceSource documentation
$A$ and $B$ are sets of words of length $n$ over alphabet with $q \geq 1$ letters. No suffix of a word in $A$ coincides with a prefix of a word in $B$. Then $|A| \cdot |B|$ is at most $\frac{q^{2n}}{en}$.
This problem is from Maximal sets of strings with no prefix-suffix overlap and was proved in An isoperimetric inequality for word overlap.
depends on sorry what this means
Statement uses:
Nat,Finset,Fin,LT.lt,OfNat.ofNat, SuffixPrefixAvoidance.IsSuffixPrefixAvoiding,LE.le,Real,HMul.hMul,Finset.card,HDiv.hDiv,HPow.hPow,Real.expProof uses:
sorryAx,Lean.Name,Bool.false,Lean.Name.num,Lean.Name.str,Lean.Name.anonymous34 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
theorem suffix_prefix_avoidance_bound (A B : Finset (Fin n → Fin q)) (hq : 0 < q) (hn : 0 < n) (h : IsSuffixPrefixAvoiding A B) : (A.card : ℝ) * B.card ≤ (q : ℝ) ^ (2 * n) / (exp 1 * n) := by … - theorem
SuffixPrefixAvoidance.suffix_prefix_avoidance_weaker_boundsorry line 90 sourcedepends on sorry what this means
Statement uses:
Nat,Finset,Fin,LT.lt,OfNat.ofNat, SuffixPrefixAvoidance.IsSuffixPrefixAvoiding,LE.le,Rat,HMul.hMul,Finset.card,HDiv.hDiv,HPow.hPowProof uses:
sorryAx,Lean.Name,Bool.false,Lean.Name.num,Lean.Name.str,Lean.Name.anonymous24 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.