Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Suffix-prefix avoidance bound · suffix_prefix_avoidance_weaker_bound

Source:Other sources
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

AA and BB are sets of words of length nn over alphabet with q≥1q \geq 1 letters. No suffix of a word in AA coincides with a prefix of a word in BB. Then ∣A∣⋅∣B∣|A| \cdot |B| is at most q2nn\frac{q^{2n}}{n}.

Subjects:Combinatorics (math.CO)
MSC classes:05
Tags:formal_proof
Cite as:NS.07206 [math.CO] · NS.07206v1 for this version
Declaration:SuffixPrefixAvoidance.suffix_prefix_avoidance_weaker_bound
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:324c5381593d09056b1e106483324db44bcc97affb19415490961a4d58ddd131
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/Other/SuffixPrefixAvoidance.lean

Formal statement

theorem suffix_prefix_avoidance_weaker_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) / n
Show the full Challenge.lean (99 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# 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](https://x.com/DmitryRybin1/status/2027278135847428577)
- [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](https://arxiv.org/abs/2602.20143)
  by *Dmitrii Zakharov* (2026)
-/

@[expose] public section

open Finset Real

namespace SuffixPrefixAvoidance

variable {n q : ℕ}

/-- The suffix of a word `w : Fin n → Fin q` of length `k + 1` (the last `k + 1` characters). -/
def wordSuffix (w : Fin n → Fin q) (k : Fin n) : Fin (k + 1) → Fin q :=
  fun i => w ⟨n - k - 1 + i, by omega⟩

/-- The prefix of a word `w : Fin n → Fin q` of length `k + 1` (the first `k + 1` characters). -/
def wordPrefix (w : Fin n → Fin q) (k : Fin n) : Fin (k + 1) → Fin q :=
  fun i => w ⟨i, by omega⟩

/-- Two sets of words $A, B$ over `Fin q` of length `n` are suffix-prefix avoiding if no
nonempty suffix of any word in $A$ equals any prefix of any word in $B$ of the same length. -/
def IsSuffixPrefixAvoiding (A B : Finset (Fin n → Fin q)) : Prop :=
  ∀ a ∈ A, ∀ b ∈ B, ∀ k : Fin n, wordSuffix a k ≠ wordPrefix b k

/--
$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}$.
-/
@[category test, AMS 5]
theorem words_naive_bound
    (A B : Finset (Fin n → Fin q)) :
    A.card * B.card ≤ q ^ (2 * n) := by
  simp [Nat.mul_le_mul, two_mul, pow_add, (Finset.card_le_univ _).trans_eq]

/--
$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*.
-/
@[category research solved, AMS 5]
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
  sorry

set_option linter.style.formal_proof_palomar false in
/--
$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}}{n}$.
-/
@[category research solved, AMS 5,
  formal_proof using formal_conjectures at "https://github.com/google-deepmind/formal-conjectures/blob/102e47fee802d461946e3a4e0b47fdbe7db4c1ed/FormalConjectures/Other/SuffixPrefixAvoidance.lean#L157"]
theorem suffix_prefix_avoidance_weaker_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) / n := by
  sorry

end SuffixPrefixAvoidance

To prove it: keep every definition of Challenge.lean unchanged and prove SuffixPrefixAvoidance.suffix_prefix_avoidance_weaker_bound with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_suffix_prefix_avoidance_weaker_bound : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch other-suffixprefixavoidance--suffix-prefix-avoidance-weaker-bound
nosorry submit other-suffixprefixavoidance--suffix-prefix-avoidance-weaker-bound nosorry/other-suffixprefixavoidance--suffix-prefix-avoidance-weaker-bound/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.