/- 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 Pointwise namespace 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 declaration uses 'sorry'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 open, AMS 5 11] theorem declaration uses 'sorry'erdos_42.variants.constructive : answer(sorry) (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}.

@[category textbook, AMS 5 11] theorem example_maximal_sidon : IsMaximalSidonSetIn {1, 2, 4} 4 := {1, 2, 4}.IsMaximalSidonSetIn 4 {1, 2, 4} Icc 1 4IsSidon {1, 2, 4} x : ⦄, x Icc 1 4 x {1, 2, 4} ¬IsSidon ({1, 2, 4} {x}) {1, 2, 4} Icc 1 4 intro x x:hx:x {1, 2, 4}x Icc 1 4 x:hx:x = 1 x = 2 x = 4x Icc 1 4 1 Icc 1 42 Icc 1 44 Icc 1 4 1 Icc 1 42 Icc 1 44 Icc 1 4 All goals completed! 🐙 IsSidon {1, 2, 4} intro i₁ i₁:hi₁:i₁ {1, 2, 4} j₁ {1, 2, 4}, i₂ {1, 2, 4}, j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:j₁ {1, 2, 4} i₂ {1, 2, 4}, j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4} i₂ {1, 2, 4}, j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:i₂ {1, 2, 4} j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:hi₂:i₂ {1, 2, 4} j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:hi₂:i₂ {1, 2, 4}j₂:j₂ {1, 2, 4} i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:hi₂:i₂ {1, 2, 4}j₂:hj₂:j₂ {1, 2, 4}i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:hi₂:i₂ {1, 2, 4}j₂:hj₂:j₂ {1, 2, 4}hsum:i₁ + i₂ = j₁ + j₂i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:j₁:i₂:j₂:hsum:i₁ + i₂ = j₁ + j₂hi₁:i₁ = 1 i₁ = 2 i₁ = 4hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = j₁ + j₂1 = j₁ i₂ = j₂ 1 = j₂ i₂ = j₁j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = j₁ + j₂2 = j₁ i₂ = j₂ 2 = j₂ i₂ = j₁j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = j₁ + j₂4 = j₁ i₂ = j₂ 4 = j₂ i₂ = j₁ j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = j₁ + j₂1 = j₁ i₂ = j₂ 1 = j₂ i₂ = j₁j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = j₁ + j₂2 = j₁ i₂ = j₂ 2 = j₂ i₂ = j₁j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = j₁ + j₂4 = j₁ i₂ = j₂ 4 = j₂ i₂ = j₁ i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 1 + j₂4 = 1 i₂ = j₂ 4 = j₂ i₂ = 1i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 2 + j₂4 = 2 i₂ = j₂ 4 = j₂ i₂ = 2i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 4 + j₂4 = 4 i₂ = j₂ 4 = j₂ i₂ = 4 i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = 1 + j₂1 = 1 i₂ = j₂ 1 = j₂ i₂ = 1i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = 2 + j₂1 = 2 i₂ = j₂ 1 = j₂ i₂ = 2i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = 4 + j₂1 = 4 i₂ = j₂ 1 = j₂ i₂ = 4i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = 1 + j₂2 = 1 i₂ = j₂ 2 = j₂ i₂ = 1i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = 2 + j₂2 = 2 i₂ = j₂ 2 = j₂ i₂ = 2i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = 4 + j₂2 = 4 i₂ = j₂ 2 = j₂ i₂ = 4i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 1 + j₂4 = 1 i₂ = j₂ 4 = j₂ i₂ = 1i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 2 + j₂4 = 2 i₂ = j₂ 4 = j₂ i₂ = 2i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 4 + j₂4 = 4 i₂ = j₂ 4 = j₂ i₂ = 4 j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 1 = 4 + j₂4 = 4 1 = j₂ 4 = j₂ 1 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 2 = 4 + j₂4 = 4 2 = j₂ 4 = j₂ 2 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 4 = 4 + j₂4 = 4 4 = j₂ 4 = j₂ 4 = 4 j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 1 = 1 + j₂1 = 1 1 = j₂ 1 = j₂ 1 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 2 = 1 + j₂1 = 1 2 = j₂ 1 = j₂ 2 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 4 = 1 + j₂1 = 1 4 = j₂ 1 = j₂ 4 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 1 = 2 + j₂1 = 2 1 = j₂ 1 = j₂ 1 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 2 = 2 + j₂1 = 2 2 = j₂ 1 = j₂ 2 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 4 = 2 + j₂1 = 2 4 = j₂ 1 = j₂ 4 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 1 = 4 + j₂1 = 4 1 = j₂ 1 = j₂ 1 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 2 = 4 + j₂1 = 4 2 = j₂ 1 = j₂ 2 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 4 = 4 + j₂1 = 4 4 = j₂ 1 = j₂ 4 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 1 = 1 + j₂2 = 1 1 = j₂ 2 = j₂ 1 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 2 = 1 + j₂2 = 1 2 = j₂ 2 = j₂ 2 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 4 = 1 + j₂2 = 1 4 = j₂ 2 = j₂ 4 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 1 = 2 + j₂2 = 2 1 = j₂ 2 = j₂ 1 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 2 = 2 + j₂2 = 2 2 = j₂ 2 = j₂ 2 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 4 = 2 + j₂2 = 2 4 = j₂ 2 = j₂ 4 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 1 = 4 + j₂2 = 4 1 = j₂ 2 = j₂ 1 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 2 = 4 + j₂2 = 4 2 = j₂ 2 = j₂ 2 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 4 = 4 + j₂2 = 4 4 = j₂ 2 = j₂ 4 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 1 = 1 + j₂4 = 1 1 = j₂ 4 = j₂ 1 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 2 = 1 + j₂4 = 1 2 = j₂ 4 = j₂ 2 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 4 = 1 + j₂4 = 1 4 = j₂ 4 = j₂ 4 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 1 = 2 + j₂4 = 2 1 = j₂ 4 = j₂ 1 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 2 = 2 + j₂4 = 2 2 = j₂ 4 = j₂ 2 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 4 = 2 + j₂4 = 2 4 = j₂ 4 = j₂ 4 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 1 = 4 + j₂4 = 4 1 = j₂ 4 = j₂ 1 = 4j₂:hj₂:j₂ = 1 j₂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4 + 14 = 4 1 = 1 4 = 1 1 = 4hsum:4 + 1 = 4 + 24 = 4 1 = 2 4 = 2 1 = 4hsum:4 + 1 = 4 + 44 = 4 1 = 4 4 = 4 1 = 4hsum:4 + 2 = 4 + 14 = 4 2 = 1 4 = 1 2 = 4hsum:4 + 2 = 4 + 24 = 4 2 = 2 4 = 2 2 = 4hsum:4 + 2 = 4 + 44 = 4 2 = 4 4 = 4 2 = 4hsum:4 + 4 = 4 + 14 = 4 4 = 1 4 = 1 4 = 4hsum:4 + 4 = 4 + 24 = 4 4 = 2 4 = 2 4 = 4hsum:4 + 4 = 4 + 44 = 4 4 = 4 4 = 4 4 = 4 All goals completed! 🐙 x : ⦄, x Icc 1 4 x {1, 2, 4} ¬IsSidon ({1, 2, 4} {x}) intro x x:hx:x Icc 1 4x {1, 2, 4} ¬IsSidon ({1, 2, 4} {x}) x:hx:x Icc 1 4hxA:x {1, 2, 4}¬IsSidon ({1, 2, 4} {x}) x:hxA:x {1, 2, 4}hx:1 x x 4¬IsSidon ({1, 2, 4} {x}); x:hxA:x {1, 2, 4}hx1:1 xhx2:x 4¬IsSidon ({1, 2, 4} {x}) x:hx1:1 xhx2:x 4hxA:¬x = 1 ¬x = 2 ¬x = 4¬IsSidon ({1, 2, 4} {x}) x:hx1:1 xhx2:x 4hne1:¬x = 1hne2:¬x = 2hne4:¬x = 4¬IsSidon ({1, 2, 4} {x}) have hx3 : x = 3 := (x:hx1:1 xhx2:x 4hne1:¬x = 1hne2:¬x = 2hne4:¬x = 4x = 3 All goals completed! 🐙); hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4¬IsSidon ({1, 2, 4} {3}) hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})False have := hbad 1 (hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})1 {1, 2, 4} {3} All goals completed! 🐙) 2 (hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})2 {1, 2, 4} {3} All goals completed! 🐙) 3 (hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})3 {1, 2, 4} {3} All goals completed! 🐙) 2 (hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})2 {1, 2, 4} {3} All goals completed! 🐙) (hx1:1 3hx2:3 4hne1:¬3 = 1hne2:¬3 = 2hne4:¬3 = 4hbad:IsSidon ({1, 2, 4} {3})1 + 3 = 2 + 2 All goals completed! 🐙) 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.

@[category textbook, AMS 5 11] theorem maximal_sidon_contains_zero (A : Set ) (N : ) (hN : 1 N) (hA : IsMaximalSidonSetIn A N) : 0 A - A := A:Set N:hN:1 NhA:A.IsMaximalSidonSetIn N0 A - A A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})0 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.NonemptyA:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hne:A.Nonempty0 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.Nonempty A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:¬A.NonemptyFalse; A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = False exact hAmax (Set.mem_Icc.mpr le_refl 1, hN) (A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = 1 A A:Set N:hN:1 NhAsub:A Icc 1 NhAsidon:IsSidon AhAmax: x : ⦄, x Icc 1 N x A ¬IsSidon (A {x})hemp:A = 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})hemp:A = IsSidon (A {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 = 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 - A := Set.sub_mem_sub ha ha0 A - A rwa [Nat.sub_selfA: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 this end Erdos42