Index of theproofnetwork/open-problems@860a535/Prove2Me/Definitions/Def_QED_M019.lean
qedmarket’s copy of theproofnetwork/open-problems@860a535, 3 Dec 2026original source ↗
/-From Prove2Me, definition `QED_M019` (https://prove2.me/definitions/cd613454-25ab-4f94-8663-2b15063c393c). Apache-2.0 per Prove2Me's terms.-/import Mathlib /-! QED-M019: Codes avoiding square distancesLet A(n) be the largest size of a set of binary strings of length n in which no two distinctstrings differ in a perfect-square number of positions (1, 4, 9, 16, ...). This is aHamming-cube analogue of the Sarkozy-Furstenberg theorem on sets without square differences.Known: exp(c n^{1/3}) <= A(n) <= (2 - delta)^n. The core open question is whether A(n) growsexponentially or is 2^{o(n)}.Informal statement: Let A(n) = max{|C| : C ⊆ {0,1}^n, d_H(x,y) ∉ {1,4,9,16,...} for all x ≠ y in C}.Decide whether A(n) = 2^{o(n)}, i.e. whether limsup (1/n) log_2 A(n) = 0.Formalization notes: Binary strings are `Fin n → Bool`; `hamming x y` counts coordinates wherethey differ. `SquareAvoiding C` says every pair of distinct elements of the finite set `C` has aHamming distance that is not a perfect square (`IsSquare` on ℕ; distance 0 never occurs fordistinct strings). To avoid junk values of `sSup`, the claim quantifies over all square-avoidingcodes directly: `Claim` says that for every ε > 0, for all sufficiently large n, everysquare-avoiding code in {0,1}^n has at most 2^{εn} elements, i.e. A(n) = 2^{o(n)}(subexponential). Proving `Claim` shows subexponential growth; proving `¬Claim` shows there areε > 0 and infinitely many n with a square-avoiding code of size > 2^{εn}, i.e.limsup (1/n) log_2 A(n) > 0. The finer question of whether liminf = limsup is not formalized here.Known bounds (not part of the claim): A(n) ≥ exp(c n^{1/3}) via constant-weight codes with alldistances strictly between consecutive squares; A(n) ≤ (2 - δ)^n via Frankl-Rödl.-/namespace OpenProblems.QEDM019 /-- Hamming distance between two binary strings of length `n`. -/def hamming {n : ℕ} (x y : Fin n → Bool) : ℕ := (Finset.univ.filter (fun i : Fin n => x i ≠ y i)).card /-- A code is square-avoiding if no two distinct codewords are at perfect-square Hamming distance. -/def SquareAvoiding {n : ℕ} (C : Finset (Fin n → Bool)) : Prop := ∀ x ∈ C, ∀ y ∈ C, x ≠ y → ¬ IsSquare (hamming x y) def Claim : Prop := ∀ ε : ℝ, 0 < ε → ∃ N : ℕ, ∀ n : ℕ, N ≤ n → ∀ C : Finset (Fin n → Bool), SquareAvoiding C → (C.card : ℝ) ≤ (2 : ℝ) ^ (ε * (n : ℝ)) end OpenProblems.QEDM019