FormalConjecturesForMathlib/Combinatorics/Basic.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1
22 declarations, 0 contain sorry, 0 declared as axioms
Maximal Sidon sets in an interval.
We follow the convention that IsMaximalSidonSetIn A N means A ⊆ {1, …, N} is Sidon and
is inclusion-maximal among subsets of Set.Icc 1 N with the Sidon property.
Imports (3)
Imported by 2 files
- def
IsProductFreeline 37 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Mul,SetProof uses:
Disjoint,HMul.hMul8 instances, coercions and auxiliary constants left out.
- theorem
isProductFree_iffline 40 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Mul,Set,Iff, IsProductFree,Membership.mem,Not,HMul.hMulProof uses:
Eq.mpr,Eq,id,congrFun',congrArg,Eq.trans,Disjoint,forall_congr,And,Exists,implies_congr,Eq.refl,Iff.intro,Aesop.BuiltinRules.not_intro,of_eq_true,False,True,eq_false,not_false_eq_true18 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- def
allUniqueSumsallUniqueSums Ais the set of elements inαthat can be written as the sum of exactly one unordered pair of elements fromAline 49 sourceSource documentation
allUniqueSums Ais the set of elements inαthat can be written as the sum of exactly one unordered pair of elements fromA.no axioms what this means
Statement uses:
AddCommMonoid,SetProof uses:
Set.ofPred,Exists,Prod,And,Membership.mem,Prod.fst,Prod.snd,Eq,HAdd.hAdd,Or5 instances, coercions and auxiliary constants left out.
def allUniqueSums (A : Set α) : Set α := …
- def
HasNoUniqueRepresentationDocumented declaration: HasNoUniqueRepresentation line 58 sourceSource documentation
A set
Ahas no unique representation in its sumsetA + Aif for every pair of elementsa₁, a₂ ∈ A, there exist another pair of elementsb₁, b₂ ∈ Asuch thata₁ + a₂ = b₁ + b₂and{a₁, a₂} ≠ {b₁, b₂}.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
AddCommMonoid,FinsetProof uses:
Eq,Set, allUniqueSums,EmptyCollection.emptyCollection3 instances, coercions and auxiliary constants left out.
def HasNoUniqueRepresentation {α : Type*} [AddCommMonoid α] (A : Finset α) : Prop := … - def
IsSyndeticA set $A$ of natural numbers is said to have bounded gaps if there exists an integer $p$ such that $A ∩ [n, n + 1, ..., n + p]$ is nonempty for all $n$ line 63 sourceSource documentation
A set $A$ of natural numbers is said to have bounded gaps if there exists an integer $p$ such that $A ∩ [n, n + 1, ..., n + p]$ is nonempty for all $n$.
no axioms what this means
Statement uses:
Set,NatProof uses:
Exists,Set.Nonempty,Inter.inter,Set.Icc,HAdd.hAdd4 instances, coercions and auxiliary constants left out.
def IsSyndetic (A : Set ℕ) : Prop := ∃ p, ∀ n, (A ∩ .Icc n (n + p)).Nonempty
- def
IsSidonA Sidon set is a set, such that such that all pairwise sums of elements are distinct apart from coincidences forced by the commutativity of addition line 67 sourceSource documentation
A Sidon set is a set, such that such that all pairwise sums of elements are distinct apart from coincidences forced by the commutativity of addition.
no axioms what this means
Statement uses:
AddCommMonoid,SetProof uses:
Membership.mem,Eq,HAdd.hAdd,Or,And5 instances, coercions and auxiliary constants left out.
def IsSidon (A : Set α) : Prop := ∀ᵉ (i₁ ∈ A) (j₁ ∈ A) (i₂ ∈ A) (j₂ ∈ A), …
- lemma
Set.IsSidon.avoids_isAPOfLength_threeline 72 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Set,Nat, IsSidon, Set.IsAPOfLength,OfNat.ofNat,ENat,LE.le,Set.ncard,Inter.interProof uses:
Eq,Set.encard,Exists,Set.ofPred,And,LT.lt,HAdd.hAdd,HMul.hMul,Eq.mp,Eq.trans, Set.IsAPOfLengthWith,congrArg,funext,HSMul.hSMul,propext,exists_prop_congr,Iff.of_eq,Eq.refl,of_eq_true,Trueand 97 more143 instances, coercions and auxiliary constants left out.
Tactic trace: 25 steps
Open to load the checked before-and-after goal states.
- theorem
Set.IsSidon.subsetline 90 sourceno axioms what this means
Statement uses:
AddCommMonoid,Set, IsSidon,LE.leProof uses:
Membership.mem,Eq,HAdd.hAdd7 instances, coercions and auxiliary constants left out.
- theorem
Set.IsSidon.insertline 93 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
AddCommMonoid,Set,IsRightCancelAdd,IsLeftCancelAdd, IsSidon,Iff,Union.union,Singleton.singleton,Or,Membership.mem,And,Ne,HAdd.hAddProof uses:
dite,Classical.propDecidable,Iff.intro,Or.inl,Eq.mpr,Insert.insert,id,Eq,congrArg,Set.union_singleton,Set.insert_eq_of_mem,Not,Or.inr,And.intro,Or.elim,False,of_eq_true,Eq.trans,True,congrFun'and 24 more24 instances, coercions and auxiliary constants left out.
Tactic trace: 56 steps
Open to load the checked before-and-after goal states.
- def
Set.IsMaximalSidonSetInIsMaximalSidonSetIn A NmeansA ⊆ {1, …, N}is Sidon and cannot be extended within{1, …, N}while remaining Sidon line 133 sourceSource documentation
IsMaximalSidonSetIn A NmeansA ⊆ {1, …, N}is Sidon and cannot be extended within{1, …, N}while remaining Sidon.standard axioms: propext what this means
Statement uses:
Set,NatProof uses:
And,LE.le,Set.Icc,OfNat.ofNat, IsSidon,Membership.mem,Not,Union.union,Singleton.singleton7 instances, coercions and auxiliary constants left out.
def IsMaximalSidonSetIn (A : Set ℕ) (N : ℕ) : Prop := …
- theorem
Set.IsMaximalSidonSetIn.subsetIfAis a maximal Sidon set in{1, …, N}, thenA ⊆ {1, …, N}line 140 sourceSource documentation
If
Ais a maximal Sidon set in{1, …, N}, thenA ⊆ {1, …, N}.standard axioms: propext what this means
Statement uses:
Set,Nat, Set.IsMaximalSidonSetIn,LE.le,Set.Icc,OfNat.ofNatProof uses:
And.left,And, IsSidon,Membership.mem,Not,Union.union,Singleton.singleton10 instances, coercions and auxiliary constants left out.
theorem subset {A : Set ℕ} {N : ℕ} (hA : IsMaximalSidonSetIn A N) : A ⊆ Set.Icc 1 N := hA.1Mentions: Set.IsMaximalSidonSetIn
- theorem
Set.IsMaximalSidonSetIn.isSidonIfAis a maximal Sidon set in{1, …, N}, thenAis Sidon line 144 sourceSource documentation
If
Ais a maximal Sidon set in{1, …, N}, thenAis Sidon.standard axioms: propext what this means
Statement uses:
Set,Nat, Set.IsMaximalSidonSetIn, IsSidonProof uses:
And.left,Membership.mem,Set.Icc,OfNat.ofNat,Not,Union.union,Singleton.singleton,And.right,LE.le,And8 instances, coercions and auxiliary constants left out.
theorem isSidon {A : Set ℕ} {N : ℕ} (hA : IsMaximalSidonSetIn A N) : IsSidon A := hA.2.1Mentions: Set.IsMaximalSidonSetIn, IsSidon
- theorem
Set.IsMaximalSidonSetIn.maximalMaximality condition unpacked line 147 sourceSource documentation
Maximality condition unpacked.
standard axioms: propext what this means
Statement uses:
Set,Nat, Set.IsMaximalSidonSetIn,Membership.mem,Set.Icc,OfNat.ofNat,Not, IsSidon,Union.union,Singleton.singletonProof uses:
And.right,LE.le,And13 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem maximal {A : Set ℕ} {N : ℕ} (hA : IsMaximalSidonSetIn A N) {x : ℕ} (hx : x ∈ Set.Icc 1 N) (hxA : x ∉ A) : ¬ IsSidon (A ∪ {x}) := hA.2.2 hx hxA …Mentions: Set.IsMaximalSidonSetIn, IsSidon
- instance
Finset.(instance at line 156)line 156 source - def
Finset.maxSidonSubsetCardThe maximum size of a Sidon set in the suppliedFinsetline 163 sourceSource documentation
The maximum size of a Sidon set in the supplied
Finset.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
AddCommMonoid,Finset,DecidableEq,NatProof uses:
Finset.sup,Finset.filter, IsSidon,Finset.powerset,Finset.card6 instances, coercions and auxiliary constants left out.
def maxSidonSubsetCard (A : Finset α) [DecidableEq α] : ℕ := …
- theorem
Finset.IsSidon.insert_ge_max'IfAis finite Sidon, thenA ∪ {s}is also Sidon provideds ≥ A.max + 1line 167 sourceSource documentation
If
Ais finite Sidon, thenA ∪ {s}is also Sidon provideds ≥ A.max + 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,Finset.Nonempty, IsSidon,LE.le,HAdd.hAdd,HMul.hMul,OfNat.ofNat,Finset.max',Union.union,Set,Singleton.singletonProof uses:
Membership.mem,LT.lt,lt_of_not_ge,Mathlib.Tactic.Linarith.lt_irrefl,Int,Eq.mp,Neg.neg,HSub.hSub,Exists.intro,congrArg,Mathlib.Tactic.Ring.of_eq,Mathlib.Tactic.Ring.Common.add_congr,HPow.hPow,Nat.rawCast,Mathlib.Meta.NormNum.instAddMonoidWithOne,inferInstance,Ring,Int.rawCast,Int.negOfNat,Mathlib.Tactic.Ring.Common.neg_congrand 77 more121 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
theorem IsSidon.insert_ge_max' {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon (A : Set ℕ)) {s : ℕ} (hs : 2 * A.max' h + 1 ≤ s) : IsSidon (A ∪ {s}) := by …Mentions: IsSidon
- theorem
Finset.IsSidon.exists_insertline 178 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,Finset.Nonempty, IsSidon,Exists,And,Not,Membership.mem,Union.union,Set,Singleton.singletonProof uses:
Exists.intro,HAdd.hAdd,HMul.hMul,OfNat.ofNat,Finset.max',And.intro,mt,LE.le,Finset.le_max',Iff.mpr,LT.lt,not_le,Finset.max'_lt_iff,lt_of_not_ge,Mathlib.Tactic.Linarith.lt_irrefl,Int,Eq.mp,Neg.neg,HSub.hSub,congrArgand 62 more87 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- theorem
Finset.IsSidon.exists_insert_geline 184 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,Finset.Nonempty, IsSidon,Exists,And,GE.ge,Not,Membership.mem,Union.union,Set,Singleton.singletonProof uses:
Exists.intro,ite,HAdd.hAdd,HMul.hMul,OfNat.ofNat,Finset.max',And.intro,dite,Eq.mpr,id,Eq,congrFun',congrArg,if_pos,le_of_not_gt,LT.lt,Mathlib.Tactic.Linarith.lt_irrefl,Int,Eq.mp,Neg.negand 74 more95 instances, coercions and auxiliary constants left out.
Tactic trace: 14 steps
Open to load the checked before-and-after goal states.
- def
Finset.greedySidon.goGiven a finite Sidon setAand a lower boundm,gofinds the smallest numberm' ≥ msuch thatA ∪ {m'}is Sidon line 198 sourceSource documentation
Given a finite Sidon set
Aand a lower boundm,gofinds the smallest numberm' ≥ msuch thatA ∪ {m'}is Sidon. IfAis empty then this returns the valuem. Note that the lower bound is required to avoid0being a contender in some cases.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat, IsSidon,Subtype,And,GE.ge,Not,Membership.mem,Union.union,Singleton.singletonProof uses:
dite,Finset.Nonempty,Exists,Subtype.mk,Nat.find25 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
def greedySidon.go (A : Finset ℕ) (hA : IsSidon (A : Set ℕ)) (m : ℕ) : {m' : ℕ // m' ≥ m ∧ m' ∉ A ∧ IsSidon (↑(A ∪ {m'}) : Set ℕ)} := …Mentions: IsSidon
- def
Finset.greedySidon.auxMain search loop for generating the greedy Sidon sequence line 211 sourceSource documentation
Main search loop for generating the greedy Sidon sequence. The return value for step
nis the finite set of numbers generated so far, a proof that it is Sidon, and the greatest element of the finite set at that point. This is initialised at{1}, thengreedySidon.gois called iteratively using the lower boundmax + 1to find the next smallest Sidon preserving number.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Prod,Subtype,Finset, IsSidon8 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
def greedySidon.aux (n : ℕ) : ({A : Finset ℕ // IsSidon (A : Set ℕ)} × ℕ) := …Mentions: IsSidon
- def
Finset.greedySidongreedySidonis the sequence obtained by the initial set $\{1\}$ and iteratively obtaining the next smallest integer that preserves the Sidon property of the set line 223 sourceSource documentation
greedySidonis the sequence obtained by the initial set $\{1\}$ and iteratively obtaining the next smallest integer that preserves the Sidon property of the set. This gives the sequence1, 2, 4, 8, 13, 21, 31, ....standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
Prod.snd,Subtype,Finset, IsSidon, Finset.greedySidon.aux3 instances, coercions and auxiliary constants left out.
def greedySidon (n : ℕ) : ℕ := greedySidon.aux n |>.2
Mentions: Finset.greedySidon.aux
- def
Finset.greedySidonBelowThe greedy Sidon set in{1, …, N}: starting from∅, iterate through1, …, Nand includexif and only ifA ∪ {x}remains Sidon line 228 sourceSource documentation
The greedy Sidon set in
{1, …, N}: starting from∅, iterate through1, …, Nand includexif and only ifA ∪ {x}remains Sidon. Alternatively, this is precisely the set of elements in the greedy Sidon sequence that are≤ N.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,FinsetProof uses:
Finset.filter,LE.le, IsSidon,Prod.fst,Subtype, Finset.greedySidon.aux6 instances, coercions and auxiliary constants left out.
def greedySidonBelow (N : ℕ) : Finset ℕ := …