/- 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

Erdős Problem 42: Maximal Sidon Sets and Disjoint Difference Sets

Reference: erdosproblems.com/42

This problem asks whether maximal Sidon sets can coexist with other Sidon sets that have disjoint difference sets (apart from 0).

open Function Set Filteropen scoped Pointwisenamespace Erdos42

Erdős Problem 42: Let M ≥ 1 and N be sufficiently large in terms of M. Is it true that for every maximal Sidon set A ⊆ {1,…,N} there is another Sidon set B ⊆ {1,…,N} of size M such that (A - A) ∩ (B - B) = {0}?

This was proved for all $M$ by GPT 5.5 Pro (prompted by Sandhu), see discussion thread for more details.

@[category research solved, AMS 5 11, formal_proof using lean4 at "https://github.com/Shashi456/erdos-formalizations/blob/main/Erdos/P42/CompactCayley/Proof.lean"] theorem erdos_42 : answer(True) M 1, ∀ᶠ N in atTop, (A : Set ) (_ : IsMaximalSidonSetIn A N), ∃ᵉ (B : Set ), B Set.Icc 1 N IsSidon B B.ncard = M ((A - A) (B - B)) = {0} := True M 1, ∀ᶠ (N : ) in atTop, (A : Set ), A.IsMaximalSidonSetIn N B Icc 1 N, IsSidon B B.ncard = M (A - A) (B - B) = {0} All goals completed! 🐙

A variant asking for explicit bounds on how large N needs to be in terms of M.

This version provides a constructive function f such that for all M ≥ 1 and N ≥ f(M), every maximal Sidon set A ⊆ {1,…,N} has another Sidon set B ⊆ {1,…,N} of size M with disjoint difference sets (apart from 0).

@[category research solved, AMS 5 11, formal_proof using formal_conjectures at "https://github.com/KitaKen1/erdos-42-constructive-variant/blob/1f82c76be43cb56f22e2f7f792e392d5fb3ff78c/lean/Erdos42Constructive.lean"] theorem erdos_42.variants.constructive : answer(True) (f : ), (M N : ) (_ : 1 M) (_ : f M N), (A : Set ) (_ : IsMaximalSidonSetIn A N), ∃ᵉ (B : Set ), B Set.Icc 1 N IsSidon B B.ncard = M ((A - A) (B - B)) = {0} := True f, (M N : ), 1 M f M N (A : Set ), A.IsMaximalSidonSetIn N B Icc 1 N, IsSidon B B.ncard = M (A - A) (B - B) = {0} All goals completed! 🐙

The set {1, 2, 4} is a maximal Sidon set in {1, ..., 4}.

hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})this:1 = 2 3 = 2 1 = 2 3 = 2False hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})h1:1 = 2h2:3 = 2Falsehx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})h1:1 = 2h2:3 = 2False hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})h1:1 = 2h2:3 = 2Falsehx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})h1:1 = 2h2:3 = 2False All goals completed! 🐙

The difference set of {1, 2, 4} is {0, 1, 2, 3}.

@[category textbook, AMS 5 11] theorem example_difference_set : ({1, 2, 4} : Set ) - {1, 2, 4} = {0, 1, 2, 3} := {1, 2, 4} - {1, 2, 4} = {0, 1, 2, 3} x:x {1, 2, 4} - {1, 2, 4} x {0, 1, 2, 3} x:(∃ x_1, (x_1 = 1 x_1 = 2 x_1 = 4) y, (y = 1 y = 2 y = 4) x_1 - y = x) x = 0 x = 1 x = 2 x = 3 x:(∃ x_1, (x_1 = 1 x_1 = 2 x_1 = 4) y, (y = 1 y = 2 y = 4) x_1 - y = x) x = 0 x = 1 x = 2 x = 3x:x = 0 x = 1 x = 2 x = 3 x_1, (x_1 = 1 x_1 = 2 x_1 = 4) y, (y = 1 y = 2 y = 4) x_1 - y = x x:(∃ x_1, (x_1 = 1 x_1 = 2 x_1 = 4) y, (y = 1 y = 2 y = 4) x_1 - y = x) x = 0 x = 1 x = 2 x = 3 a:ha:a = 1 a = 2 a = 4b:hb:b = 1 b = 2 b = 4a - b = 0 a - b = 1 a - b = 2 a - b = 3 b:hb:b = 1 b = 2 b = 41 - b = 0 1 - b = 1 1 - b = 2 1 - b = 3b:hb:b = 1 b = 2 b = 42 - b = 0 2 - b = 1 2 - b = 2 2 - b = 3b:hb:b = 1 b = 2 b = 44 - b = 0 4 - b = 1 4 - b = 2 4 - b = 3 b:hb:b = 1 b = 2 b = 41 - b = 0 1 - b = 1 1 - b = 2 1 - b = 3b:hb:b = 1 b = 2 b = 42 - b = 0 2 - b = 1 2 - b = 2 2 - b = 3b:hb:b = 1 b = 2 b = 44 - b = 0 4 - b = 1 4 - b = 2 4 - b = 3 4 - 1 = 0 4 - 1 = 1 4 - 1 = 2 4 - 1 = 34 - 2 = 0 4 - 2 = 1 4 - 2 = 2 4 - 2 = 34 - 4 = 0 4 - 4 = 1 4 - 4 = 2 4 - 4 = 3 1 - 1 = 0 1 - 1 = 1 1 - 1 = 2 1 - 1 = 31 - 2 = 0 1 - 2 = 1 1 - 2 = 2 1 - 2 = 31 - 4 = 0 1 - 4 = 1 1 - 4 = 2 1 - 4 = 32 - 1 = 0 2 - 1 = 1 2 - 1 = 2 2 - 1 = 32 - 2 = 0 2 - 2 = 1 2 - 2 = 2 2 - 2 = 32 - 4 = 0 2 - 4 = 1 2 - 4 = 2 2 - 4 = 34 - 1 = 0 4 - 1 = 1 4 - 1 = 2 4 - 1 = 34 - 2 = 0 4 - 2 = 1 4 - 2 = 2 4 - 2 = 34 - 4 = 0 4 - 4 = 1 4 - 4 = 2 4 - 4 = 3 All goals completed! 🐙 x:x = 0 x = 1 x = 2 x = 3 x_1, (x_1 = 1 x_1 = 2 x_1 = 4) y, (y = 1 y = 2 y = 4) x_1 - y = x x, (x = 1 x = 2 x = 4) y, (y = 1 y = 2 y = 4) x - y = 0 x, (x = 1 x = 2 x = 4) y, (y = 1 y = 2 y = 4) x - y = 1 x, (x = 1 x = 2 x = 4) y, (y = 1 y = 2 y = 4) x - y = 2 x, (x = 1 x = 2 x = 4) y, (y = 1 y = 2 y = 4) x - y = 3 x, (x = 1 x = 2 x = 4) y, (y = 1 y = 2 y = 4) x - y = 0 exact 1, 1 = 1 1 = 2 1 = 4 All goals completed! 🐙, 1, 1 = 1 1 = 2 1 = 4 All goals completed! 🐙, 1 - 1 = 0 All goals completed! 🐙 x, (x = 1 x = 2 x = 4) y, (y = 1 y = 2 y = 4) x - y = 1 exact 2, 2 = 1 2 = 2 2 = 4 All goals completed! 🐙, 1, 1 = 1 1 = 2 1 = 4 All goals completed! 🐙, 2 - 1 = 1 All goals completed! 🐙 x, (x = 1 x = 2 x = 4) y, (y = 1 y = 2 y = 4) x - y = 2 exact 4, 4 = 1 4 = 2 4 = 4 All goals completed! 🐙, 2, 2 = 1 2 = 2 2 = 4 All goals completed! 🐙, 4 - 2 = 2 All goals completed! 🐙 x, (x = 1 x = 2 x = 4) y, (y = 1 y = 2 y = 4) x - y = 3 exact 4, 4 = 1 4 = 2 4 = 4 All goals completed! 🐙, 1, 1 = 1 1 = 2 1 = 4 All goals completed! 🐙, 4 - 1 = 3 All goals completed! 🐙

For any maximal Sidon set, the difference set contains 0.

A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = IsSidon {1} exact fun _ hi _ hj _ hk _ hl _ => A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = x✝⁴:hi:x✝⁴ {1}x✝³:hj:x✝³ {1}x✝²:hk:x✝² {1}x✝¹:hl:x✝¹ {1}x✝:x✝⁴ + x✝² = x✝³ + x✝¹x✝⁴ = x✝³ x✝² = x✝¹ x✝⁴ = x✝¹ x✝² = x✝³ A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = x✝⁴:x✝³:x✝²:x✝¹:x✝:x✝⁴ + x✝² = x✝³ + x✝¹hi:x✝⁴ = 1hj:x✝³ = 1hk:x✝² = 1hl:x✝¹ = 1x✝⁴ = x✝³ x✝² = x✝¹ x✝⁴ = x✝¹ x✝² = x✝³ A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = x✝³:x✝²:x✝¹:hj:x✝³ = 1hk:x✝² = 1hl:x✝¹ = 1x✝:1 + x✝² = x✝³ + x✝¹1 = x✝³ x✝² = x✝¹ 1 = x✝¹ x✝² = x✝³ A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = x✝²:x✝¹:hk:x✝² = 1hl:x✝¹ = 1x✝:1 + x✝² = 1 + x✝¹1 = 1 x✝² = x✝¹ 1 = x✝¹ x✝² = 1 A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = x✝¹:hl:x✝¹ = 1x✝:1 + 1 = 1 + x✝¹1 = 1 1 = x✝¹ 1 = x✝¹ 1 = 1 A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = x✝:1 + 1 = 1 + 11 = 1 1 = 1 1 = 1 1 = 1 All goals completed! 🐙) A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})a:ha:a A0 A - A A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})a:ha:a Athis:a - a A - A0 A - A rwa [A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})a:ha:a Athis:0 A - A0 A - AA:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})a:ha:a Athis:0 A - A0 A - A at thisend Erdos42