/- Copyright 2025 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. -/ import FormalConjecturesUtil open scoped Topologyopen Filternamespace Erdos36

The number of solutions to the equation $a - b = k$, for $a \in A$ and $b \in B$. This represents the "overlap" between sets $A$ and $B$ for a given difference $k$.

def Overlap (A B : Finset ) (k : ) : := ((A.product B).filter <| fun (a, b) => a - b = k).card

The maximum overlap for a given pair of sets $A$ and $B$, taken over all possible integer differences $k$.

noncomputable def MaxOverlap (A B : Finset ) : := iSup <| Overlap A B

Let $A$ and $B$ be two complementary subsets, a splitting of the numbers ${1, 2, \dots, 2n}$, such that both have the same cardinality $n$. Define $M(n)$ to be the minimum MaxOverlap that can be achieved, ranging over all such partitions $(A, B)$.

noncomputable def M (n : ) : := sInf {MaxOverlap A B | (A : Finset ) (B : Finset ) (_disjoint : Disjoint A B) (_union : A B = Finset.Icc (1 : ) (2 * n)) (_same_card : A.card = B.card)}

A small API lemma: every pair (a, b) ∈ A × B contributes to Overlap A B (a - b).

@[category API, AMS 5 11] private lemma one_le_overlap {A B : Finset } {a b : } (ha : a A) (hb : b B) : 1 Overlap A B (a - b) := Finset.card_pos.mpr (a, b), Finset.mem_filter.mpr Finset.mem_product.mpr ha, hb, rfl

MaxOverlap {1} {2} = 1: the only nonzero overlap is at k = -1.

@[category API, AMS 5 11] private lemma maxOverlap_singleton_one_two : MaxOverlap ({1} : Finset ) ({2} : Finset ) = 1 := MaxOverlap {1} {2} = 1 MaxOverlap {1} {2} 11 MaxOverlap {1} {2} MaxOverlap {1} {2} 1 MaxOverlap {1} {2} {(1, 2)}.card (x : ), Overlap {1} {2} x {(1, 2)}.card k:Overlap {1} {2} k {(1, 2)}.card k:{x {1}.product {2} | match x with | (a, b) => a - b = k} {(1, 2)} intro p k:p: × hp:p {x {1}.product {2} | match x with | (a, b) => a - b = k}p {(1, 2)} k:p: × hp:p {x {1}.product {2} | match x with | (a, b) => a - b = k}hp1:p {1}.product {2}right✝:match p with | (a, b) => a - b = kp {(1, 2)} k:p: × hp:p {x {1}.product {2} | match x with | (a, b) => a - b = k}hp1:p {1}.product {2}right✝:match p with | (a, b) => a - b = kha:p.1 {1}hb:p.2 {2}p {(1, 2)} k:p: × hp:p {x {1}.product {2} | match x with | (a, b) => a - b = k}hp1:p {1}.product {2}right✝:match p with | (a, b) => a - b = kha:p.1 = 1hb:p.2 = 2p {(1, 2)} All goals completed! 🐙 1 MaxOverlap {1} {2} BddAbove (Set.range (Overlap {1} {2}))1 Overlap {1} {2} (-1) BddAbove (Set.range (Overlap {1} {2})) 1 upperBounds (Set.range (Overlap {1} {2})) k:Overlap {1} {2} k 1 exact (Finset.card_filter_le _ _).trans (k:({1}.product {2}).card 1 All goals completed! 🐙) 1 Overlap {1} {2} (-1) All goals completed! 🐙

This example calculates the value of $M 1$. The set is ${1, 2}$, so the only partition is $A = {1}, B = {2}$ (or vice versa). The possible differences are $1 - 2 = -1$ and $2 - 1 = 1$. The Overlap for $k=-1$ is 1 (if $A={1}, B={2}$) and for $k=1$ also 1 (if $A={2}, B={1}$ ). The MaxOverlap is $1$, since the Overlap is $0$ for other $k$. Thus, $M 1 = 1$.

@[category test, AMS 5 11] theorem M_one : M 1 = 1 := M 1 = 1 M 1 11 M 1 M 1 1 1 {x | A B, (_ : Disjoint A B) (_ : A B = Finset.Icc 1 (2 * 1)) (_ : A.card = B.card), MaxOverlap A B = x} refine {1}, {2}, Disjoint {1} {2} All goals completed! 🐙, {1} {2} = Finset.Icc 1 (2 * 1) All goals completed! 🐙, {1}.card = {2}.card All goals completed! 🐙, maxOverlap_singleton_one_two 1 M 1 {x | A B, (_ : Disjoint A B) (_ : A B = Finset.Icc 1 (2 * 1)) (_ : A.card = B.card), MaxOverlap A B = x}.Nonempty b {x | A B, (_ : Disjoint A B) (_ : A B = Finset.Icc 1 (2 * 1)) (_ : A.card = B.card), MaxOverlap A B = x}, 1 b {x | A B, (_ : Disjoint A B) (_ : A B = Finset.Icc 1 (2 * 1)) (_ : A.card = B.card), MaxOverlap A B = x}.Nonempty exact _, {1}, {2}, Disjoint {1} {2} All goals completed! 🐙, {1} {2} = Finset.Icc 1 (2 * 1) All goals completed! 🐙, {1}.card = {2}.card All goals completed! 🐙, maxOverlap_singleton_one_two A:Finset B:Finset hd:Disjoint A Bhu:A B = Finset.Icc 1 (2 * 1)hsc:A.card = B.card1 MaxOverlap A B -- |A ∪ B| = 2 ∧ |A| = |B| ⇒ each is a singleton. have hcardsum : A.card + B.card = 2 := M 1 = 1 A:Finset B:Finset hd:Disjoint A Bhu:A B = Finset.Icc 1 (2 * 1)hsc:A.card = B.card(Finset.Icc 1 (2 * 1)).card = 2; All goals completed! 🐙 have hca : A.card = 1 := M 1 = 1 All goals completed! 🐙 have hcb : B.card = 1 := M 1 = 1 All goals completed! 🐙 B:Finset hcb:B.card = 1 := Decidable.byContradiction fun a => M_one._proof_2 _fvar.7426 B _fvar.7498 _fvar.7587 aa:hd:Disjoint {a} Bhu:{a} B = Finset.Icc 1 (2 * 1)hsc:{a}.card = B.cardhcardsum:{a}.card + B.card = 2hca:{a}.card = 11 MaxOverlap {a} B a:hca:{a}.card = 1b:hcb:{b}.card = 1hd:Disjoint {a} {b}hu:{a} {b} = Finset.Icc 1 (2 * 1)hsc:{a}.card = {b}.cardhcardsum:{a}.card + {b}.card = 21 MaxOverlap {a} {b} -- MaxOverlap ≥ Overlap at `k = a - b`, and that's ≥ 1. a:hca:{a}.card = 1b:hcb:{b}.card = 1hd:Disjoint {a} {b}hu:{a} {b} = Finset.Icc 1 (2 * 1)hsc:{a}.card = {b}.cardhcardsum:{a}.card + {b}.card = 2BddAbove (Set.range (Overlap {a} {b}))a:hca:{a}.card = 1b:hcb:{b}.card = 1hd:Disjoint {a} {b}hu:{a} {b} = Finset.Icc 1 (2 * 1)hsc:{a}.card = {b}.cardhcardsum:{a}.card + {b}.card = 21 Overlap {a} {b} (a - b) a:hca:{a}.card = 1b:hcb:{b}.card = 1hd:Disjoint {a} {b}hu:{a} {b} = Finset.Icc 1 (2 * 1)hsc:{a}.card = {b}.cardhcardsum:{a}.card + {b}.card = 2BddAbove (Set.range (Overlap {a} {b})) a:hca:{a}.card = 1b:hcb:{b}.card = 1hd:Disjoint {a} {b}hu:{a} {b} = Finset.Icc 1 (2 * 1)hsc:{a}.card = {b}.cardhcardsum:{a}.card + {b}.card = 21 upperBounds (Set.range (Overlap {a} {b})) a:hca:{a}.card = 1b:hcb:{b}.card = 1hd:Disjoint {a} {b}hu:{a} {b} = Finset.Icc 1 (2 * 1)hsc:{a}.card = {b}.cardhcardsum:{a}.card + {b}.card = 2k:Overlap {a} {b} k 1 a:hca:{a}.card = 1b:hcb:{b}.card = 1hd:Disjoint {a} {b}hu:{a} {b} = Finset.Icc 1 (2 * 1)hsc:{a}.card = {b}.cardhcardsum:{a}.card + {b}.card = 2k:({a}.product {b}).card 1 All goals completed! 🐙 a:hca:{a}.card = 1b:hcb:{b}.card = 1hd:Disjoint {a} {b}hu:{a} {b} = Finset.Icc 1 (2 * 1)hsc:{a}.card = {b}.cardhcardsum:{a}.card + {b}.card = 21 Overlap {a} {b} (a - b) All goals completed! 🐙

For $n = 2$, the set is ${1, 2, 3, 4}$. The balanced partition $A = {1, 4}, B = {2, 3}$ has all four pairwise differences ($\pm 1, \pm 2$) distinct, so MaxOverlap = 1. Any balanced partition has both pieces nonempty, so MaxOverlap \geq 1.

@[category test, AMS 5 11, formal_proof using formal_conjectures at "https://github.com/google-deepmind/formal-conjectures/pull/4153/commits/2ce2d6345d0fcf3b023fe35fde9a9a490b131a86"] theorem declaration uses 'sorry'M_two : M 2 = 1 := M 2 = 1 All goals completed! 🐙 @[category test, AMS 5 11] theorem declaration uses 'sorry'M_three : M 3 = 2 := M 3 = 2 All goals completed! 🐙 @[category test, AMS 5 11] theorem declaration uses 'sorry'M_four : M 4 = 2 := M 4 = 2 All goals completed! 🐙 @[category test, AMS 5 11] theorem declaration uses 'sorry'M_five : M 5 = 3 := M 5 = 3 All goals completed! 🐙

The quotient of the minimum maximum overlap $M(N)$ by $N$. The central question of the minimum overlap problem is to determine the asymptotic behavior of this quotient as $N \to \infty$.

noncomputable def MinOverlapQuotient (N : ) := (M N : ) / N

A lower bound of $\frac 1 4$. See Some remarks on number theory (in Hebrew) by Paul Erdős, Riveon Lematematika 9, p.45-48,1955

@[category textbook, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.lower.erdos_1955 : (1 : ) / 4 < atTop.liminf MinOverlapQuotient := 1 / 4 < liminf MinOverlapQuotient atTop All goals completed! 🐙

A lower bound of $1 - frac{1}{\sqrt 2}$. Scherk (written communication), see On the minimal overlap problem of Erdös by Leo Moser, Аста Аrithmetica V, p. 117-119, 1959

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.lower.scherk_1955 : 1 - (2)⁻¹ < atTop.liminf MinOverlapQuotient := 1 - (2)⁻¹ < liminf MinOverlapQuotient atTop All goals completed! 🐙

A lower bound of $\frac{4 - \sqrt{6}}{5}. See On the intersection of a linear set with the translation of its complement by Stanisław Świerczkowski1, Colloquium Mathematicum 5(2), p. 185-197, 1958

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.lower.swierczkowski_1958 : (4 - 6 ^ ((1 : ) / 2)) / 5 < atTop.liminf MinOverlapQuotient := (4 - 6 ^ (1 / 2)) / 5 < liminf MinOverlapQuotient atTop All goals completed! 🐙

A lower bound of $\sqrt{4 - \sqrt{15}}$.

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.lower.haugland_1996 : (4 - 15 ^((1 : ) / 2)) ^ ((1 : ) / 2) < atTop.liminf MinOverlapQuotient := (4 - 15 ^ (1 / 2)) ^ (1 / 2) < liminf MinOverlapQuotient atTop All goals completed! 🐙

A lower bound of $0.379005$. See Erdős' minimum overlap problem by Ethan Patrick White, 2022

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.lower.white_2022 : 0.379005 < atTop.liminf MinOverlapQuotient := 0.379005 < liminf MinOverlapQuotient atTop All goals completed! 🐙

The example (with $N$ even), $A = {\frac N 2 + 1, \dots, \frac{3N}{2}}$ shows an upper bound of $\frac 1 2$.

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.upper.erdos_1955 : atTop.limsup MinOverlapQuotient (1 : ) / 2 := limsup MinOverlapQuotient atTop 1 / 2 All goals completed! 🐙

An upper bound of $\frac 2 5$. See Minimal overlapping under translation. by T. S. Motzkin, K. E. Ralston and J. L. Selfridge, in "The summer meeting in Seattle" by V. L. Klee Jr., Bull. Amer. Math. Soc.62, p. 558, 1956

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.upper.MRS_1956 : atTop.limsup MinOverlapQuotient (2 : ) / 5 := limsup MinOverlapQuotient atTop 2 / 5 All goals completed! 🐙

An upper bound of $0.38200298812318988$. See Advances in the Minimum Overlap Problem by Jan Kristian Haugland, Journal of Number Theory Volume 58, Issue 1, p 71-78, 1996

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.upper.haugland_1996 : atTop.limsup MinOverlapQuotient 0.38200298812318988 := limsup MinOverlapQuotient atTop 0.38200298812318988 All goals completed! 🐙

An upper bound of $0.3809268534330870$. See The minimum overlap problem by Jan Kristian Haugland

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'minimum_overlap.variants.upper.haugland_2022 : atTop.limsup MinOverlapQuotient 0.3809268534330870 := limsup MinOverlapQuotient atTop 0.3809268534330870 All goals completed! 🐙

Find a better lower bound!

@[category research open, AMS 5 11] theorem declaration uses 'sorry'erdos_36.variants.lower: (c : ), 0.379005 < c c atTop.liminf MinOverlapQuotient c = answer(sorry) := c, 0.379005 < c c liminf MinOverlapQuotient atTop c = sorry All goals completed! 🐙

Find a better upper bound!

@[category research open, AMS 5 11] theorem declaration uses 'sorry'erdos_36.variants.upper : (c : ), c < 0.380926853433087 atTop.limsup MinOverlapQuotient c c = answer(sorry) := c < 0.380926853433087, limsup MinOverlapQuotient atTop c c = sorry All goals completed! 🐙

The limit of MinOverlapQuotient exists and it is less than $0.385694$.

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'erdos_36.variants.exists : c, atTop.Tendsto MinOverlapQuotient (𝓝 c) c < 0.385694 := c, Tendsto MinOverlapQuotient atTop (𝓝 c) c < 0.385694 All goals completed! 🐙

Find the value of the limit of MinOverlapQuotient!

@[category research open, AMS 5 11] theorem declaration uses 'sorry'erdos_36 : atTop.Tendsto MinOverlapQuotient (𝓝 answer(sorry)) := Tendsto MinOverlapQuotient atTop (𝓝 sorry) All goals completed! 🐙 end Erdos36