chars
int64
40
24k
content_type
stringclasses
9 values
id
stringlengths
13
64
source
stringclasses
5 values
subset
stringclasses
31 values
text
stringlengths
40
24k
249
leanexplore_declaration
leanexplore:385957
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- A set `A : Set M` is an asymptotic additive basis of order `2` if a cofinite set of `a : M` belongs to `A + A`. -/] lemma isAsymptoticMulBasisOfOrder_two_iff : IsAsymptoticMulBasisOfOrder A 2 ↔ ∀ᶠ a in cofinite, a ∈ A * A := by
420
leanexplore_declaration
leanexplore:385958
leanexplore_sqlite
leanexplore_declarations
/-- A set `A : Set M` is an asymptotic multiplicative basis of order `2` if a cofinite set of `a : M` belongs to `A * A`. -/ @[to_additive /-- A set `A : Set M` is an asymptotic additive basis of order `2` if a cofinite set of `a : M` belongs to `A + A`. -/] lemma isAsymptoticMulBasisOfOrder_two_iff : IsAsymptoticM...
337
leanexplore_declaration
leanexplore:385959
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- A set `A : Set M` is an asymptotic additive basis of order `n` if a cofinite set of `a : M` can be written as `a = a₁ + ... + aₙ`, where each `aᵢ ∈ A`. -/] lemma isAsymptoticMulBasisOfOrder_iff_prod : IsAsymptoticMulBasisOfOrder A n ↔ ∀ᶠ a in cofinite, ∃ (f : Fin n → M) (_ : ∀ i, f i ∈ A), ∏...
611
leanexplore_declaration
leanexplore:385960
leanexplore_sqlite
leanexplore_declarations
/-- A set `A : Set M` is an asymptotic multiplicative basis of order `n` if a cofinite set of `a : M` can be written as `a = a₁ * ... * aₙ`, where each `aᵢ ∈ A`. -/ @[to_additive /-- A set `A : Set M` is an asymptotic additive basis of order `n` if a cofinite set of `a : M` can be written as `a = a₁ + ... + aₙ`, where ...
103
leanexplore_declaration
leanexplore:385961
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma IsMulBasis.isAsymptoticMulBasis (hA : IsMulBasis A) : A.IsAsymptoticMulBasis := by
169
leanexplore_declaration
leanexplore:385962
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma IsMulBasis.isAsymptoticMulBasis (hA : IsMulBasis A) : A.IsAsymptoticMulBasis := by obtain ⟨n, hn⟩ := hA; exact ⟨n, hn.isAsymptoticMulBasisOfOrder⟩
150
leanexplore_declaration
leanexplore:385963
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma IsMulBasisOfOrder.isAsymptoticMulBasisOfOrder (hA : IsMulBasisOfOrder A n) : A.IsAsymptoticMulBasisOfOrder n := .of_forall hA
148
leanexplore_declaration
leanexplore:385965
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma IsAsymptoticMulBasisOfOrder.isAsymptoticMulBasis (hA : A.IsAsymptoticMulBasisOfOrder n) : A.IsAsymptoticMulBasis := ⟨n, hA⟩
149
leanexplore_declaration
leanexplore:385967
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- An asymptotic additive basis of some order. -/] def IsAsymptoticMulBasis (A : Set M) : Prop := ∃ n, A.IsAsymptoticMulBasisOfOrder n
206
leanexplore_declaration
leanexplore:385968
leanexplore_sqlite
leanexplore_declarations
/-- An asymptotic multiplicative basis of some order. -/ @[to_additive /-- An asymptotic additive basis of some order. -/] def IsAsymptoticMulBasis (A : Set M) : Prop := ∃ n, A.IsAsymptoticMulBasisOfOrder n
263
leanexplore_declaration
leanexplore:385969
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- A set `A : Set M` is an asymptotic additive basis of order `n` if the elements that can be expressed as a sum of `n` elements lying in `A` is cofinite. -/] def IsAsymptoticMulBasisOfOrder (A : Set M) (n : ℕ) : Prop := ∀ᶠ a in cofinite, a ∈ A ^ n
432
leanexplore_declaration
leanexplore:385970
leanexplore_sqlite
leanexplore_declarations
/-- A set `A : Set M` is an asymptotic multiplicative basis of order `n` if the elements that can be expressed as a product of `n` elements lying in `A` is cofinite. -/ @[to_additive /-- A set `A : Set M` is an asymptotic additive basis of order `n` if the elements that can be expressed as a sum of `n` elements lying i...
189
leanexplore_declaration
leanexplore:385971
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- A set `A : Set M` is an additive basis of order `2` if every `a : M` belongs to `A + A`. -/] lemma isMulBasisOfOrder_two_iff : A.IsMulBasisOfOrder 2 ↔ ∀ a, a ∈ A * A := by
326
leanexplore_declaration
leanexplore:385972
leanexplore_sqlite
leanexplore_declarations
/-- A set `A : Set M` is a multiplicative basis of order `2` if every `a : M` belongs to `A * A`. -/ @[to_additive /-- A set `A : Set M` is an additive basis of order `2` if every `a : M` belongs to `A + A`. -/] lemma isMulBasisOfOrder_two_iff : A.IsMulBasisOfOrder 2 ↔ ∀ a, a ∈ A * A := by simp [IsMulBasisOfOrder, po...
102
leanexplore_declaration
leanexplore:385973
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma isMulBasisOfOrder_one_iff : A.IsMulBasisOfOrder 1 ↔ A = univ := by
149
leanexplore_declaration
leanexplore:385974
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma isMulBasisOfOrder_one_iff : A.IsMulBasisOfOrder 1 ↔ A = univ := by simp [IsMulBasisOfOrder, eq_univ_iff_forall]
157
leanexplore_declaration
leanexplore:385975
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp) /-- No set is an additive basis of order `0`. -/] lemma not_isMulBasisOfOrder_zero [Nontrivial M] : ¬A.IsMulBasisOfOrder 0 := by
262
leanexplore_declaration
leanexplore:385976
leanexplore_sqlite
leanexplore_declarations
/-- No set is a multiplicative basis of order `0`. -/ @[to_additive (attr := simp) /-- No set is an additive basis of order `0`. -/] lemma not_isMulBasisOfOrder_zero [Nontrivial M] : ¬A.IsMulBasisOfOrder 0 := by simp [isMulBasisOfOrder_iff, eq_comm, exists_ne]
134
leanexplore_declaration
leanexplore:385977
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma isMulBasisOfOrder_iff : A.IsMulBasisOfOrder n ↔ ∀ a, ∃ (f : Fin n → M) (_ : ∀ i, f i ∈ A), ∏ i, f i = a := by
233
leanexplore_declaration
leanexplore:385978
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma isMulBasisOfOrder_iff : A.IsMulBasisOfOrder n ↔ ∀ a, ∃ (f : Fin n → M) (_ : ∀ i, f i ∈ A), ∏ i, f i = a := by have := Set.mem_finset_prod (t := .univ) (f := fun _ : Fin n ↦ A) simp_all [IsMulBasisOfOrder]
104
leanexplore_declaration
leanexplore:385979
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma IsMulBasisOfOrder.isMulBasis (hA : A.IsMulBasisOfOrder n) : A.IsMulBasis := ⟨n, hA⟩
118
leanexplore_declaration
leanexplore:385981
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- An additive basis of some order. -/] def IsMulBasis (A : Set M) : Prop := ∃ n, A.IsMulBasisOfOrder n
163
leanexplore_declaration
leanexplore:385982
leanexplore_sqlite
leanexplore_declarations
/-- A multiplicative basis of some order. -/ @[to_additive /-- An additive basis of some order. -/] def IsMulBasis (A : Set M) : Prop := ∃ n, A.IsMulBasisOfOrder n
227
leanexplore_declaration
leanexplore:385983
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- A set `A : Set M` is an additive basis of order `n` if for any element `a : M`, it can be expressed as a sum of `n` elements lying in `A`. -/] def IsMulBasisOfOrder (A : Set M) (n : ℕ) : Prop := ∀ a, a ∈ A ^ n
374
leanexplore_declaration
leanexplore:385984
leanexplore_sqlite
leanexplore_declarations
/-- A set `A : Set M` is a multiplicative basis of order `n` if any element `a : M` can be expressed as a product of `n` elements lying in `A`. -/ @[to_additive /-- A set `A : Set M` is an additive basis of order `n` if for any element `a : M`, it can be expressed as a sum of `n` elements lying in `A`. -/] def IsMulBas...
255
leanexplore_declaration
leanexplore:385985
leanexplore_sqlite
leanexplore_declarations
theorem sumRep_eq_powerSeries_coeff (A : Set ℕ) (n : ℕ) : (sumRep A n : ℕ) = ((PowerSeries.mk (𝟙_A)) * (PowerSeries.mk (𝟙_A)) : PowerSeries ℕ).coeff n := by simp [sumRep, sumConv, indicatorOne, indicator, PowerSeries.coeff_mul, PowerSeries.coeff_mk]
277
leanexplore_declaration
leanexplore:385986
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma sumRep_def (A : Set ℕ) (n : ℕ) : sumRep A n = ((antidiagonal n).filter (fun (p : ℕ × ℕ) ↦ p.1 ∈ A ∧ p.2 ∈ A)).card := by simp only [sumRep, sumConv, indicatorOne, indicator, mul_ite, mul_one, mul_zero] push_cast [← ite_and, card_filter, and_comm] congr!
182
leanexplore_declaration
leanexplore:385987
leanexplore_sqlite
leanexplore_declarations
/-- The number of sum representations is the sum convolution of `A`'s indicator function with itself: $1_A\ast 1_A(n)$. -/ noncomputable def sumRep (A : Set ℕ) : ℕ → ℕ := (𝟙_A ∗ 𝟙_A)
204
leanexplore_declaration
leanexplore:385989
leanexplore_sqlite
leanexplore_declarations
/-- The sum convolution of two functions `f, g : ℕ → R`, also known as the Cauchy product. `(f ∗ g) n = ∑_{a+b=n} f(a)g(b)`. -/ def sumConv (f g : ℕ → R) (n : ℕ) : R := ∑ p ∈ antidiagonal n, f p.1 * g p.2
225
leanexplore_declaration
leanexplore:385990
leanexplore_sqlite
leanexplore_declarations
/-- The restricted sumset of a set $S$, denoted $S \hat{+} S$, is the set $\lbrace s_1 + s_2 : s_1, s_2 \in S, s_1 \neq s_2 \rbrace$. -/ def restrictedSumset (S : Finset α) : Finset α := S.offDiag.image (fun p => p.1 + p.2)
115
leanexplore_declaration
leanexplore:385991
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma hasMulVCNDimAtMost_one : HasMulVCNDimAtMost A 1 d ↔ HasMulVCDimAtMost A d := by
446
leanexplore_declaration
leanexplore:385992
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma hasMulVCNDimAtMost_one : HasMulVCNDimAtMost A 1 d ↔ HasMulVCDimAtMost A d := by symm refine (Equiv.funUnique ..).symm.forall_congr fun x ↦ ((Equiv.Set.congr <| Equiv.funUnique ..).arrowCongr <| .refl _).symm.forall_congr fun y ↦ not_congr <| (Equiv.funUnique ..).symm.fora...
116
leanexplore_declaration
leanexplore:385993
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] protected lemma HasMulVCNDimAtMost.univ : HasMulVCNDimAtMost (.univ : Set G) n d := by
173
leanexplore_declaration
leanexplore:385994
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] protected lemma HasMulVCNDimAtMost.univ : HasMulVCNDimAtMost (.univ : Set G) n d := by simpa [HasMulVCNDimAtMost] using ⟨default, ∅, by simp⟩
113
leanexplore_declaration
leanexplore:385995
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] protected lemma HasMulVCNDimAtMost.empty : HasMulVCNDimAtMost (∅ : Set G) n d := by
174
leanexplore_declaration
leanexplore:385996
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] protected lemma HasMulVCNDimAtMost.empty : HasMulVCNDimAtMost (∅ : Set G) n d := by simpa [HasMulVCNDimAtMost] using ⟨default, .univ, by simp⟩
114
leanexplore_declaration
leanexplore:385997
leanexplore_sqlite
leanexplore_declarations
@[to_additive] protected alias ⟨HasMulVCNDimAtMost.of_compl, HasMulVCNDimAtMost.compl⟩ := hasMulVCNDimAtMost_compl
118
leanexplore_declaration
leanexplore:386001
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma hasMulVCNDimAtMost_compl : HasMulVCNDimAtMost Aᶜ n d ↔ HasMulVCNDimAtMost A n d :=
305
leanexplore_declaration
leanexplore:386002
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma hasMulVCNDimAtMost_compl : HasMulVCNDimAtMost Aᶜ n d ↔ HasMulVCNDimAtMost A n d := forall_congr' fun x ↦ (compl_involutive.toPerm.arrowCongr <| .refl _).forall_congr fun y ↦ not_congr <| forall_congr' fun i ↦ compl_involutive.toPerm.forall_congr <| by simp; tauto
127
leanexplore_declaration
leanexplore:386003
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma HasMulVCNDimAtMost.mono (h : d ≤ d') (hd : HasMulVCNDimAtMost A n d) : HasMulVCNDimAtMost A n d' := by
326
leanexplore_declaration
leanexplore:386004
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma HasMulVCNDimAtMost.mono (h : d ≤ d') (hd : HasMulVCNDimAtMost A n d) : HasMulVCNDimAtMost A n d' := by rintro x y hxy replace h : d + 1 ≤ d' + 1 := by omega exact hd (x · ∘ Fin.castLE h) (y ∘ Set.image (Fin.castLE h ∘ ·)) fun i s ↦ (hxy ..).trans <| by simp [funext_iff]; simp [← funex...
317
leanexplore_declaration
leanexplore:386005
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- A set `A` in an abelian group has VCₙ dimension at most `d` iff one cannot find two sequences `x` and `y` of elements indexed by `[n] × [d + 1]` and `2 ^ [d + 1]ⁿ` respectively such that `y s + ∑ k, x (k, i k) ∈ A ↔ i ∈ s` for all `i ∈ [d + 1]ⁿ`, `s ⊆ [d + 1]ⁿ`. -/] def HasMulVCNDimAtMost : Prop :=
704
leanexplore_declaration
leanexplore:386006
leanexplore_sqlite
leanexplore_declarations
/-- A set `A` in an abelian group has VCₙ dimension at most `d` iff one cannot find two sequences `x` and `y` of elements indexed by `[n] × [d + 1]` and `2 ^ [d + 1]ⁿ` respectively such that `y s * ∏ k, x (k, i k) ∈ A ↔ i ∈ s` for all `i ∈ [d + 1]ⁿ`, `s ⊆ [d + 1]ⁿ`. -/ @[to_additive /-- A set `A` in an abelian group ha...
120
leanexplore_declaration
leanexplore:386007
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma hasVCDimAtMost_smul : HasVCDimAtMost {t • A | t : G} d ↔ HasMulVCDimAtMost A d := by
322
leanexplore_declaration
leanexplore:386008
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma hasVCDimAtMost_smul : HasVCDimAtMost {t • A | t : G} d ↔ HasMulVCDimAtMost A d := by simpa [HasVCDimAtMost, HasMulVCDimAtMost, Classical.skolem (b := fun _ ↦ G), ← funext_iff, Set.mem_smul_set_iff_inv_smul_mem] using forall_congr' fun x ↦ (Equiv.inv _).forall_congr <| by si...
112
leanexplore_declaration
leanexplore:386009
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] protected lemma HasMulVCDimAtMost.univ : HasMulVCDimAtMost (.univ : Set G) d := by
168
leanexplore_declaration
leanexplore:386010
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] protected lemma HasMulVCDimAtMost.univ : HasMulVCDimAtMost (.univ : Set G) d := by simpa [HasMulVCDimAtMost] using ⟨default, ∅, by simp⟩
109
leanexplore_declaration
leanexplore:386011
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] protected lemma HasMulVCDimAtMost.empty : HasMulVCDimAtMost (∅ : Set G) d := by
169
leanexplore_declaration
leanexplore:386012
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] protected lemma HasMulVCDimAtMost.empty : HasMulVCDimAtMost (∅ : Set G) d := by simpa [HasMulVCDimAtMost] using ⟨default, .univ, by simp⟩
111
leanexplore_declaration
leanexplore:386013
leanexplore_sqlite
leanexplore_declarations
@[to_additive] protected alias ⟨HasMulVCDimAtMost.of_compl, HasMulVCDimAtMost.compl⟩ := hasMulVCDimAtMost_compl
111
leanexplore_declaration
leanexplore:386017
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma hasMulVCDimAtMost_compl : HasMulVCDimAtMost Aᶜ d ↔ HasMulVCDimAtMost A d :=
298
leanexplore_declaration
leanexplore:386018
leanexplore_sqlite
leanexplore_declarations
@[to_additive (attr := simp)] lemma hasMulVCDimAtMost_compl : HasMulVCDimAtMost Aᶜ d ↔ HasMulVCDimAtMost A d := forall_congr' fun x ↦ (compl_involutive.toPerm.arrowCongr <| .refl _).forall_congr fun y ↦ not_congr <| forall_congr' fun i ↦ compl_involutive.toPerm.forall_congr <| by simp; tauto
120
leanexplore_declaration
leanexplore:386019
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma HasMulVCDimAtMost.mono (h : d ≤ d') (hd : HasMulVCDimAtMost A d) : HasMulVCDimAtMost A d' := by
275
leanexplore_declaration
leanexplore:386020
leanexplore_sqlite
leanexplore_declarations
@[to_additive] lemma HasMulVCDimAtMost.mono (h : d ≤ d') (hd : HasMulVCDimAtMost A d) : HasMulVCDimAtMost A d' := by rintro x y hxy replace h : d + 1 ≤ d' + 1 := by omega exact hd (x ∘ Fin.castLE h) (y ∘ Set.image (Fin.castLE h)) fun i s ↦ (hxy ..).trans <| by simp
294
leanexplore_declaration
leanexplore:386021
leanexplore_sqlite
leanexplore_declarations
@[to_additive /-- A set `A` in an abelian group has VC dimension at most `d` iff one cannot find two sequences `x` and `y` of elements indexed by `[d + 1]` and `2 ^ [d + 1]` respectively such that `y s + x i ∈ A ↔ i ∈ s` for all `i ∈ [d + 1]`, `s ⊆ [d + 1]`. -/] def HasMulVCDimAtMost : Prop :=
628
leanexplore_declaration
leanexplore:386022
leanexplore_sqlite
leanexplore_declarations
/-- A set `A` in an abelian group has VC dimension at most `d` iff one cannot find two sequences `x` and `y` of elements indexed by `[d + 1]` and `2 ^ [d + 1]` respectively such that `y s * x i ∈ A ↔ i ∈ s` for all `i ∈ [d + 1]`, `s ⊆ [d + 1]`. -/ @[to_additive /-- A set `A` in an abelian group has VC dimension at most...
481
leanexplore_declaration
leanexplore:386023
leanexplore_sqlite
leanexplore_declarations
theorem IsSidon.exists_insert_ge {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon (A : Set ℕ)) (s : ℕ) : ∃ m ≥ s, m ∉ A ∧ IsSidon (A ∪ {m}) := by refine ⟨if s ≥ 2 * A.max' h + 1 then s else 2 * A.max' h + 1, ?_, ?_, ?_⟩ · split_ifs <;> linarith · split_ifs <;> exact mt (A.le_max' _) <| not_le.2 <| Finset.max...
301
leanexplore_declaration
leanexplore:386024
leanexplore_sqlite
leanexplore_declarations
theorem IsSidon.exists_insert {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon (A : Set ℕ)) : ∃ m ∉ A, IsSidon (A ∪ {m}) := by refine ⟨2 * A.max' h + 1, ?_, insert_ge_max' h hA le_rfl⟩ exact mt (A.le_max' _) <| not_le.2 <| Finset.max'_lt_iff _ ‹_› |>.2 fun a ha ↦ by linarith [A.le_max' _ ha]
692
leanexplore_declaration
leanexplore:386025
leanexplore_sqlite
leanexplore_declarations
/-- If `A` is finite Sidon, then `A ∪ {s}` is also Sidon provided `s ≥ A.max + 1`. -/ 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 have h₁ {a b c : ℕ} (ha : a ∈ A) (hb : b ∈ A) (hc : c ∈ A) : a +...
202
leanexplore_declaration
leanexplore:386026
leanexplore_sqlite
leanexplore_declarations
/-- The maximum size of a Sidon set in the supplied `Finset`. -/ def maxSidonSubsetCard (A : Finset α) [DecidableEq α] : ℕ := (A.powerset.filter fun B : Finset α ↦ IsSidon (B : Set α)).sup Finset.card
222
leanexplore_declaration
leanexplore:386027
leanexplore_sqlite
leanexplore_declarations
instance (A : Finset α) [DecidableEq α] : Decidable (IsSidon (A : Set α)) := by refine decidable_of_iff (∀ᵉ (i₁ ∈ A) (j₁ ∈ A) (i₂ ∈ A) (j₂ ∈ A), i₁ + i₂ = j₁ + j₂ → (i₁ = j₁ ∧ i₂ = j₂) ∨ (i₁ = j₂ ∧ i₂ = j₁)) ?_ rfl
192
leanexplore_declaration
leanexplore:386028
leanexplore_sqlite
leanexplore_declarations
/-- Maximality condition unpacked. -/ 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
160
leanexplore_declaration
leanexplore:386029
leanexplore_sqlite
leanexplore_declarations
/-- If `A` is a maximal Sidon set in `{1, …, N}`, then `A` is Sidon. -/ theorem isSidon {A : Set ℕ} {N : ℕ} (hA : IsMaximalSidonSetIn A N) : IsSidon A := hA.2.1
170
leanexplore_declaration
leanexplore:386030
leanexplore_sqlite
leanexplore_declarations
/-- If `A` is a maximal Sidon set in `{1, …, N}`, then `A ⊆ {1, …, N}`. -/ theorem subset {A : Set ℕ} {N : ℕ} (hA : IsMaximalSidonSetIn A N) : A ⊆ Set.Icc 1 N := hA.1
275
leanexplore_declaration
leanexplore:386031
leanexplore_sqlite
leanexplore_declarations
/-- `IsMaximalSidonSetIn A N` means `A ⊆ {1, …, N}` is Sidon and cannot be extended within `{1, …, N}` while remaining Sidon. -/ def IsMaximalSidonSetIn (A : Set ℕ) (N : ℕ) : Prop := A ⊆ Set.Icc 1 N ∧ IsSidon A ∧ ∀ ⦃x : ℕ⦄, x ∈ Set.Icc 1 N → x ∉ A → ¬ IsSidon (A ∪ {x})
1,458
leanexplore_declaration
leanexplore:386032
leanexplore_sqlite
leanexplore_declarations
theorem IsSidon.insert {A : Set α} {m : α} [IsRightCancelAdd α] [IsLeftCancelAdd α] (hA : IsSidon A) : IsSidon (A ∪ {m}) ↔ (m ∈ A ∨ ∀ᵉ (a ∈ A) (b ∈ A), m + m ≠ a + b ∧ ∀ c ∈ A, m + a ≠ b + c) := by by_cases h_mem : m ∈ A · exact ⟨fun _ ↦ .inl h_mem, fun _ ↦ by rwa [union_singleton, insert_eq_of_mem h_mem]⟩ ...
163
leanexplore_declaration
leanexplore:386033
leanexplore_sqlite
leanexplore_declarations
theorem IsSidon.subset {A B : Set α} (hB : IsSidon B) (hAB : A ⊆ B) : IsSidon A := fun _ _ _ _ _ _ _ _ _ ↦ hB _ (hAB ‹_›) _ (hAB ‹_›) _ (hAB ‹_›) _ (hAB ‹_›) ‹_›
911
leanexplore_declaration
leanexplore:386034
leanexplore_sqlite
leanexplore_declarations
lemma IsSidon.avoids_isAPOfLength_three {A : Set ℕ} (hA : IsSidon A) {Y : Set ℕ} (hY : Y.IsAPOfLength 3) : (A ∩ Y).ncard ≤ 2 := by simp [IsAPOfLength, IsAPOfLengthWith] at hY obtain ⟨hc, ⟨a, d, hY⟩⟩ := hY have hY_card : Y.ncard = 3 := by simp [ncard, hc] by_contra! h have hss : Y ⊆ A ∩ Y := by hav...
294
leanexplore_declaration
leanexplore:386035
leanexplore_sqlite
leanexplore_declarations
/-- 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. -/ def IsSidon (A : Set α) : Prop := ∀ᵉ (i₁ ∈ A) (j₁ ∈ A) (i₂ ∈ A) (j₂ ∈ A), i₁ + i₂ = j₁ + j₂ → (i₁ = j₁ ∧ i₂ = j₂) ∨ (i₁ = j₂ ∧ i₂ = j₁)
236
leanexplore_declaration
leanexplore:386036
leanexplore_sqlite
leanexplore_declarations
/-- 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$. -/ def IsSyndetic (A : Set ℕ) : Prop := ∃ p, ∀ n, (A ∩ .Icc n (n + p)).Nonempty
335
leanexplore_declaration
leanexplore:386037
leanexplore_sqlite
leanexplore_declarations
/-- A set `A` has no unique representation in its sumset `A + A` if for every pair of elements `a₁, a₂ ∈ A`, there exist another pair of elements `b₁, b₂ ∈ A` such that `a₁ + a₂ = b₁ + b₂` and `{a₁, a₂} ≠ {b₁, b₂}`. -/ def HasNoUniqueRepresentation {α : Type*} [AddCommMonoid α] (A : Finset α) : Prop := allUniqueSums ...
323
leanexplore_declaration
leanexplore:386038
leanexplore_sqlite
leanexplore_declarations
/-- `allUniqueSums A` is the set of elements in `α` that can be written as the sum of exactly one unordered pair of elements from `A`. -/ def allUniqueSums (A : Set α) : Set α := { n | ∃ p : α × α, p.1 ∈ A ∧ p.2 ∈ A ∧ p.1 + p.2 = n ∧ ∀ a₁ ∈ A, ∀ a₂ ∈ A, a₁ + a₂ = n → (a₁ = p.1 ∧ a₂ = p.2) ∨ (a₁ = p.2 ∧ a₂ = p.1...
209
leanexplore_declaration
leanexplore:386039
leanexplore_sqlite
leanexplore_declarations
/-- A set $A$ is said to be sum-free if the sumset $A + A$ is disjoint from $A$, i.e. if the equation $a + b = c$ has no solution with $a, b, c \in A$. -/ def IsSumFree (A : Set α) : Prop := Disjoint (A + A) A
268
leanexplore_declaration
leanexplore:386040
leanexplore_sqlite
leanexplore_declarations
/-- The number of transversals of a latin square `L`, defined as the cardinality of the type of column-selectors `σ : Fin n → Fin n` satisfying `IsTransversal L σ`. -/ def numTransversals (L : LatinSquare n) : ℕ := Fintype.card {σ : Fin n → Fin n // IsTransversal L σ}
497
leanexplore_declaration
leanexplore:386041
leanexplore_sqlite
leanexplore_declarations
/-- A near-transversal of a latin square `L` of order `n` is a selection of `n - 1` cells, given by a row-selector `ρ` and a column-selector `σ` (both `Fin (n - 1) → Fin n`), such that the selected rows are all distinct, the selected columns are all distinct, and the symbols at the selected cells are all distinct. -/ a...
354
leanexplore_declaration
leanexplore:386042
leanexplore_sqlite
leanexplore_declarations
/-- A transversal of a latin square `L` is a selection of one cell per row, given by a column-selector `σ`, such that the selected columns are all distinct and the symbols at the selected cells are all distinct. -/ abbrev IsTransversal (L : LatinSquare n) (σ : Fin n → Fin n) : Prop := Function.Injective σ ∧ Function....
623
leanexplore_declaration
leanexplore:386043
leanexplore_sqlite
leanexplore_declarations
/-- There are finitely many latin squares of order `n`, since each is determined by a matrix in the finite type `Matrix (Fin n) (Fin n) (Fin n)`. This is useful for defining the maximum number of transversals over all latin squares of order `n`. -/ instance : Fintype (LatinSquare n) := Fintype.ofEquiv {mat : Matr...
57
leanexplore_declaration
leanexplore:386044
leanexplore_sqlite
leanexplore_declarations
col_injective : ∀ j, Function.Injective (mat.transpose j)
47
leanexplore_declaration
leanexplore:386045
leanexplore_sqlite
leanexplore_declarations
row_injective : ∀ i, Function.Injective (mat i)
451
leanexplore_declaration
leanexplore:386047
leanexplore_sqlite
leanexplore_declarations
/-- A latin square of order `n` is an `n × n` matrix with entries in `Fin n` such that each symbol appears exactly once in every row and exactly once in every column. -/ structure LatinSquare (n : ℕ) where mat : Matrix (Fin n) (Fin n) (Fin n) /-- Each row is a permutation of `Fin n`. -/ row_injective : ∀ i, Funct...
591
leanexplore_declaration
leanexplore:386048
leanexplore_sqlite
leanexplore_declarations
/-- `hypergraphRamsey r r = r` for any `r`. -/ theorem hypergraphRamsey_self (r : ℕ) : hypergraphRamsey r r = r := by have h_mem : r ∈ { m | ∀ (c : Finset (Fin m) → Bool), ∃ (S : Finset (Fin m)), S.card = m ∧ ∃ (color : Bool), ∀ (e : Finset (Fin m)), e ⊆ S → e.card = r → c e = color } := by intro c ...
559
leanexplore_declaration
leanexplore:386049
leanexplore_sqlite
leanexplore_declarations
/-- `n ≤ hypergraphRamsey r n` when the set is nonempty. -/ theorem le_hypergraphRamsey (r n : ℕ) (hne : { m | ∀ (c : Finset (Fin m) → Bool), ∃ (S : Finset (Fin m)), S.card = n ∧ ∃ (color : Bool), ∀ (e : Finset (Fin m)), e ⊆ S → e.card = r → c e = color }.Nonempty) : n ≤ hypergraphRamsey r n := by apply...
421
leanexplore_declaration
leanexplore:386050
leanexplore_sqlite
leanexplore_declarations
/-- The `r`-uniform hypergraph Ramsey number `R_r(n)`. The smallest natural number `m` such that every 2-coloring of the `r`-subsets of a set of size `m` contains a monochromatic subset of size `n`. -/ noncomputable def hypergraphRamsey (r n : ℕ) : ℕ := sInf { m | ∀ (c : Finset (Fin m) → Bool), ∃ (S : Finset (Fin...
99
leanexplore_declaration
leanexplore:386051
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma HasVCDimAtMost.empty : HasVCDimAtMost (∅ : Set (Set α)) d := by simp [HasVCDimAtMost]
269
leanexplore_declaration
leanexplore:386052
leanexplore_sqlite
leanexplore_declarations
lemma HasVCDimAtMost.mono (h : d ≤ d') (hd : HasVCDimAtMost 𝒜 d) : HasVCDimAtMost 𝒜 d' := by rintro x A hA hxA replace h : d + 1 ≤ d' + 1 := by omega exact hd (x ∘ Fin.castLE h) (A ∘ Set.image (Fin.castLE h)) (by simp [hA]) fun i s ↦ (hxA ..).trans <| by simp
134
leanexplore_declaration
leanexplore:386053
leanexplore_sqlite
leanexplore_declarations
lemma HasVCDimAtMost.anti (h𝒜ℬ : 𝒜 ≤ ℬ) (hℬ : HasVCDimAtMost ℬ d) : HasVCDimAtMost 𝒜 d := fun _x _A hA ↦ hℬ _ _ fun _s ↦ h𝒜ℬ <| hA _
362
leanexplore_declaration
leanexplore:386054
leanexplore_sqlite
leanexplore_declarations
/-- A set family `𝒜` has VC dimension at most `d` if there are no families `x` of elements indexed by `[d + 1]` and `A` of sets of `𝒜` indexed by `2^[d + 1]` such that `x i ∈ A s ↔ i ∈ s` for all `i ∈ [d + 1], s ⊆ [d + 1]`. -/ def HasVCDimAtMost : Prop := ∀ (x : Fin (d + 1) → α) (A : Set (Fin (d + 1)) → Set α), ...
106
leanexplore_declaration
leanexplore:386055
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma shatters_univ : Shatters 𝒜 .univ ↔ 𝒜 = .univ := by simp [Shatters, Set.eq_univ_iff_forall]
70
leanexplore_declaration
leanexplore:386056
leanexplore_sqlite
leanexplore_declarations
lemma univ_shatters : Shatters .univ A := .of_forall_subset <| by simp
134
leanexplore_declaration
leanexplore:386057
leanexplore_sqlite
leanexplore_declarations
lemma shatters_iff : Shatters 𝒜 A ↔ (A ∩ ·) '' 𝒜 = A.powerset := ⟨fun h ↦ by ext B; simp [h.subset_iff], fun h B hB ↦ h.superset hB⟩
156
leanexplore_declaration
leanexplore:386058
leanexplore_sqlite
leanexplore_declarations
protected lemma Shatters.subset_iff (h : Shatters 𝒜 A) : B ⊆ A ↔ ∃ u ∈ 𝒜, A ∩ u = B := ⟨fun hB ↦ h hB, by rintro ⟨u, _, rfl⟩; exact Set.inter_subset_left⟩
138
leanexplore_declaration
leanexplore:386059
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma shatters_empty : Shatters 𝒜 ∅ ↔ 𝒜.Nonempty := ⟨Shatters.nonempty, fun ⟨A, hs⟩ B hB ↦ ⟨A, hs, by simpa [eq_comm] using hB⟩⟩
104
leanexplore_declaration
leanexplore:386060
leanexplore_sqlite
leanexplore_declarations
protected lemma Shatters.nonempty (h : Shatters 𝒜 A) : 𝒜.Nonempty := let ⟨B, hB, _⟩ := h .rfl; ⟨B, hB⟩
124
leanexplore_declaration
leanexplore:386061
leanexplore_sqlite
leanexplore_declarations
lemma Shatters.of_forall_subset (h : ∀ B, B ⊆ A → B ∈ 𝒜) : Shatters 𝒜 A := fun B hB ↦ ⟨B, h _ hB, Set.inter_eq_right.2 hB⟩
132
leanexplore_declaration
leanexplore:386062
leanexplore_sqlite
leanexplore_declarations
lemma Shatters.exists_superset (h : Shatters 𝒜 A) : ∃ B ∈ 𝒜, A ⊆ B := let ⟨B, hB, hst⟩ := h .rfl; ⟨B, hB, Set.inter_eq_left.1 hst⟩
188
leanexplore_declaration
leanexplore:386063
leanexplore_sqlite
leanexplore_declarations
lemma Shatters.mono_right (h : B ⊆ A) (hs : Shatters 𝒜 A) : Shatters 𝒜 B := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩
130
leanexplore_declaration
leanexplore:386064
leanexplore_sqlite
leanexplore_declarations
lemma Shatters.mono_left (h : 𝒜 ⊆ ℬ) (h𝒜 : Shatters 𝒜 A) : Shatters ℬ A := fun _B hB ↦ let ⟨u, hu, hut⟩ := h𝒜 hB; ⟨u, h hu, hut⟩
137
leanexplore_declaration
leanexplore:386065
leanexplore_sqlite
leanexplore_declarations
lemma Shatters.exists_inter_eq_singleton (hs : Shatters 𝒜 A) (ha : a ∈ A) : ∃ B ∈ 𝒜, A ∩ B = {a} := hs <| Set.singleton_subset_iff.2 ha
159
leanexplore_declaration
leanexplore:386066
leanexplore_sqlite
leanexplore_declarations
/-- A set family `𝒜` shatters a set `A` if restricting `𝒜` to `A` gives rise to all subsets of `A`. -/ def Shatters : Prop := ∀ ⦃B⦄, B ⊆ A → ∃ C ∈ 𝒜, A ∩ C = B
231
leanexplore_declaration
leanexplore:386067
leanexplore_sqlite
leanexplore_declarations
/-- We call a graph $D$-balanced (or $D$-almost-regular) if the maximum degree is at most $D$ times the minimum degree. -/ def IsBalanced (G : SimpleGraph V) (D : ℝ) [DecidableRel G.Adj] : Prop := G.maxDegree <= D * G.minDegree