/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import FormalConjecturesUtil /-! # Ben Green's Open Problem 40 *References:* - [Gr24] [Ben Green's Open Problem 40](https://people.maths.ox.ac.uk/greenbj/papers/open-problems.pdf#problem.40) - [Da90] Davydov, Alexander Abramovich. "Construction of linear covering codes." Problemy Peredachi Informatsii 26.4 (1990): 38-55. - [CHL97] Cohen, G., Honkala, I., Litsyn, S., & Lobstein, A. (1997). Covering codes (Vol. 54). Elsevier. - [St94] R. Struik, Covering codes, PhD Thesis, Eindhoven University of Technology, the Netherlands, 106 pp, 1994. -/ @[expose] public section open Filter Topology Fintype open scoped ENNReal Pointwise namespace Green40 /-- The Hamming ball of radius $r$ in $\mathbb{F}_2^n$. -/ def hammingBall (n r : β„•) : Set (𝔽₂ n) := {x | hammingNorm x ≀ r} /-- $V$ is a covering subspace of $\mathbb{F}_2^n$ by $H(r)$ if $V + H(r) = \mathbb{F}_2^n$. -/ def IsCoveringSubspace (n r : β„•) (V : Submodule (ZMod 2) (𝔽₂ n)) : Prop := (V : Set (𝔽₂ n)) + hammingBall n r = Set.univ /-- The minimal covering density over all covering subspaces for a given n and r. We compute in `ℝβ‰₯0∞` (ENNReal) to gracefully handle any potential divergence. -/ noncomputable def minDensity (n r : β„•) : ℝβ‰₯0∞ := β¨… (V : Submodule (ZMod 2) (𝔽₂ n)) (_ : IsCoveringSubspace n r V), (Nat.card V : ℝβ‰₯0∞) * (Nat.card (hammingBall n r) : ℝβ‰₯0∞) / (2 ^ n : ℝβ‰₯0∞) /-- Let $f(r)$ be the smallest constant such that there exists an infinite sequence of $n$'s together with subspaces $V_n \leq \mathbb{F}_2^n$ with $V_n + H(r) = \mathbb{F}_2^n$ and $|V_n| = \left(f(r) + o(1)\right) \frac{2^n}{|H(r)|}$. -/ noncomputable def f (r : β„•) : ℝβ‰₯0∞ := liminf (fun n ↦ minDensity n r) atTop /-- Does $f(r) \to \infty$? [Gr24]-/ @[category research open, question, AMS 5 94] theorem green_40 : Tendsto f atTop (𝓝 ⊀) := by sorry set_option linter.style.formal_proof_palomar false in /-- The only value known is $f(1) = 1$, which follows from the existence of the Hamming code [Gr24]. -/ @[category research solved, AMS 5 94, formal_proof using lean4 at "https://github.com/anatoliiohorodnyk/lean-fc-proofs/blob/5da9642575b26c2c816a49bcb56b33fed5456619/Proofs/T_Green40_green_40_sanity_f_one.lean#L216"] theorem green_40.sanity_f_one : f 1 = 1 := by sorry set_option linter.style.formal_proof_palomar false in /-- $f(r) \le r^r / r! \sim e^r$ [Gr24]. -/ @[category research solved, AMS 5 94, formal_proof using lean4 at "https://github.com/anatoliiohorodnyk/lean-fc-proofs/blob/5da9642575b26c2c816a49bcb56b33fed5456619/Proofs/T_Green40_green_40_upper_bound.lean#L245"] theorem green_40.upper_bound (r : β„•) : f r ≀ (r ^ r : ℝβ‰₯0∞) / (r.factorial : ℝβ‰₯0∞) := by sorry /-- The possibility that f(r) = 1 for all r has not been ruled out [Gr24] -/ @[category research open, question, AMS 5 94] theorem green_40.f_eq_one_for_all : βˆ€ r, f r = 1 := by sorry /-- It is not known whether f(2) = 1 [Gr24] -/ @[category research open, question, AMS 5 94] theorem green_40.f_two_eq_one : f 2 = 1 := by sorry /-- The best-known upper bound for $f(2)$ is $1.4238$ [CHL97]. -/ @[category research solved, AMS 5 94] theorem green_40.upper_bound_f_two : f 2 ≀ (1.4238 : ℝβ‰₯0∞) := by sorry -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- Variant with arbitrary subsets -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def hammingBallFinset (n r : β„•) : Finset (𝔽₂ n) := Finset.univ.filter (fun x => hammingNorm x ≀ r) def IsCoveringFinset (n r : β„•) (V : Finset (𝔽₂ n)) : Prop := V + hammingBallFinset n r = Finset.univ noncomputable def minDensityFinset (n r : β„•) : ℝβ‰₯0∞ := β¨… (V : Finset (𝔽₂ n)) (_ : IsCoveringFinset n r V), (V.card : ℝβ‰₯0∞) * (Nat.card (hammingBall n r) : ℝβ‰₯0∞) / (2 ^ n : ℝβ‰₯0∞) noncomputable def f_tilde (r : β„•) : ℝβ‰₯0∞ := liminf (fun n ↦ minDensityFinset n r) atTop /-- Does $\tilde{f}(r) \to \infty$? [Gr24] -/ @[category research open, question, AMS 5 94] theorem green_40.variants.arbitrary_subsets : Tendsto f_tilde atTop (𝓝 ⊀) := by sorry /-- It is known that $\tilde{f}(2) = 1$ [St94]. -/ @[category research solved, AMS 5 94] theorem green_40.variants.arbitrary_subsets_sanity_f_tilde_two : f_tilde 2 = 1 := by sorry /-- We evidently have $\tilde{f}(r) \le f(r)$ [Gr24]. -/ @[category research solved, AMS 5 94] theorem green_40.f_tilde_le_f (r : β„•) : f_tilde r ≀ f r := by refine Filter.liminf_le_liminf (Filter.Eventually.of_forall fun n => ?_) refine le_iInfβ‚‚ fun V hV => ?_ have hfin : (V : Set (𝔽₂ n)).Finite := Set.toFinite _ have hcov : IsCoveringFinset n r hfin.toFinset := by unfold IsCoveringFinset ext x simp only [Finset.mem_univ, iff_true] have hx : x ∈ (V : Set (𝔽₂ n)) + hammingBall n r := hV β–Έ Set.mem_univ x obtain ⟨a, ha, b, hb, hab⟩ := hx exact Finset.mem_add.mpr ⟨a, hfin.mem_toFinset.mpr ha, b, by simpa [hammingBallFinset, hammingBall] using hb, hab⟩ have hcard : (hfin.toFinset.card : ℝβ‰₯0∞) = (Nat.card V : ℝβ‰₯0∞) := by have h : Nat.card V = hfin.toFinset.card := by rw [show Nat.card V = Nat.card (V : Set (𝔽₂ n)) from rfl, Nat.card_coe_set_eq, Set.ncard_eq_toFinset_card _ hfin] exact_mod_cast congrArg Nat.cast h.symm calc minDensityFinset n r ≀ (hfin.toFinset.card : ℝβ‰₯0∞) * (Nat.card (hammingBall n r) : ℝβ‰₯0∞) / (2 ^ n : ℝβ‰₯0∞) := iInfβ‚‚_le hfin.toFinset hcov _ = (Nat.card V : ℝβ‰₯0∞) * (Nat.card (hammingBall n r) : ℝβ‰₯0∞) / (2 ^ n : ℝβ‰₯0∞) := by rw [hcard] -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- Variant for all n -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% noncomputable def f_all (r : β„•) : ℝβ‰₯0∞ := limsup (fun n ↦ minDensity n r) atTop /-- Does $f_{\text{all}}(r) \to \infty$? [Gr24] The target filter is `𝓝 ⊀`, as in `green_40` and `green_40.variants.arbitrary_subsets`. On `ℝβ‰₯0∞`, `atTop` is the principal ultrafilter at `⊀`, so `Tendsto f_all atTop atTop` would say that `f_all r = ⊀` for all large `r` rather than that `f_all r β†’ ∞`. -/ @[category research open, question, AMS 5 94] theorem green_40.variants.all_n : Tendsto f_all atTop (𝓝 ⊀) := by sorry end Green40