fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
lineCount_eq_lineCount [Finite P] [Finite L] (p q : P) : lineCount L p = lineCount L q := by cases nonempty_fintype P cases nonempty_fintype L obtain ⟨p₁, p₂, p₃, l₁, l₂, l₃, h₁₂, h₁₃, h₂₁, h₂₂, h₂₃, h₃₁, h₃₂, h₃₃⟩ := @exists_config P L _ _ have h := card_points_eq_card_lines P L let n := lineCount L p₂ have hp₂ : lineCount L p₂ = n := rfl have hl₁ : pointCount P l₁ = n := (HasLines.lineCount_eq_pointCount h h₂₁).symm.trans hp₂ have hp₃ : lineCount L p₃ = n := (HasLines.lineCount_eq_pointCount h h₃₁).trans hl₁ have hl₃ : pointCount P l₃ = n := (HasLines.lineCount_eq_pointCount h h₃₃).symm.trans hp₃ have hp₁ : lineCount L p₁ = n := (HasLines.lineCount_eq_pointCount h h₁₃).trans hl₃ have hl₂ : pointCount P l₂ = n := (HasLines.lineCount_eq_pointCount h h₁₂).symm.trans hp₁ suffices ∀ p : P, lineCount L p = n by exact (this p).trans (this q).symm refine fun p => or_not.elim (fun h₂ => ?_) fun h₂ => (HasLines.lineCount_eq_pointCount h h₂).trans hl₂ refine or_not.elim (fun h₃ => ?_) fun h₃ => (HasLines.lineCount_eq_pointCount h h₃).trans hl₃ rw [(eq_or_eq h₂ h₂₂ h₃ h₂₃).resolve_right fun h => h₃₃ ((congr_arg (p₃ ∈ ·) h).mp h₃₂)] variable (P) {L}
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
lineCount_eq_lineCount
null
pointCount_eq_pointCount [Finite P] [Finite L] (l m : L) : pointCount P l = pointCount P m := by apply lineCount_eq_lineCount (Dual P) variable {P}
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
pointCount_eq_pointCount
null
lineCount_eq_pointCount [Finite P] [Finite L] (p : P) (l : L) : lineCount L p = pointCount P l := Exists.elim (exists_point l) fun q hq => (lineCount_eq_lineCount L p q).trans <| by cases nonempty_fintype P cases nonempty_fintype L exact HasLines.lineCount_eq_pointCount (card_points_eq_card_lines P L) hq variable (P L)
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
lineCount_eq_pointCount
null
Dual.order [Finite P] [Finite L] : order (Dual L) (Dual P) = order P L := congr_arg (fun n => n - 1) (lineCount_eq_pointCount _ _) variable {P}
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
Dual.order
null
lineCount_eq [Finite P] [Finite L] (p : P) : lineCount L p = order P L + 1 := by classical obtain ⟨q, -, -, l, -, -, -, -, h, -⟩ := Classical.choose_spec (@exists_config P L _ _) cases nonempty_fintype { l : L // q ∈ l } rw [order, lineCount_eq_lineCount L p q, lineCount_eq_lineCount L (Classical.choose _) q, lineCount, Nat.card_eq_fintype_card, Nat.sub_add_cancel] exact Fintype.card_pos_iff.mpr ⟨⟨l, h⟩⟩ variable (P) {L}
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
lineCount_eq
null
pointCount_eq [Finite P] [Finite L] (l : L) : pointCount P l = order P L + 1 := (lineCount_eq (Dual P) _).trans (congr_arg (fun n => n + 1) (Dual.order P L)) variable (L)
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
pointCount_eq
null
one_lt_order [Finite P] [Finite L] : 1 < order P L := by obtain ⟨p₁, p₂, p₃, l₁, l₂, l₃, -, -, h₂₁, h₂₂, h₂₃, h₃₁, h₃₂, h₃₃⟩ := @exists_config P L _ _ cases nonempty_fintype { p : P // p ∈ l₂ } rw [← add_lt_add_iff_right 1, ← pointCount_eq _ l₂, pointCount, Nat.card_eq_fintype_card, Fintype.two_lt_card_iff] simp_rw [Ne, Subtype.ext_iff] have h := mkPoint_ax (P := P) (L := L) fun h => h₂₁ ((congr_arg (p₂ ∈ ·) h).mpr h₂₂) exact ⟨⟨mkPoint _, h.2⟩, ⟨p₂, h₂₂⟩, ⟨p₃, h₃₂⟩, ne_of_mem_of_not_mem h.1 h₂₁, ne_of_mem_of_not_mem h.1 h₃₁, ne_of_mem_of_not_mem h₂₃ h₃₃⟩ variable {P}
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
one_lt_order
null
two_lt_lineCount [Finite P] [Finite L] (p : P) : 2 < lineCount L p := by simpa only [lineCount_eq L p, Nat.succ_lt_succ_iff] using one_lt_order P L variable (P) {L}
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
two_lt_lineCount
null
two_lt_pointCount [Finite P] [Finite L] (l : L) : 2 < pointCount P l := by simpa only [pointCount_eq P l, Nat.succ_lt_succ_iff] using one_lt_order P L variable (L)
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
two_lt_pointCount
null
card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by cases nonempty_fintype L obtain ⟨p, -⟩ := @exists_config P L _ _ let ϕ : { q // q ≠ p } ≃ Σ l : { l : L // p ∈ l }, { q // q ∈ l.1 ∧ q ≠ p } := { toFun := fun q => ⟨⟨mkLine q.2, (mkLine_ax q.2).2⟩, q, (mkLine_ax q.2).1, q.2⟩ invFun := fun lq => ⟨lq.2, lq.2.2.2⟩ right_inv := fun lq => Sigma.subtype_ext (Subtype.ext ((eq_or_eq (mkLine_ax lq.2.2.2).1 (mkLine_ax lq.2.2.2).2 lq.2.2.1 lq.1.2).resolve_left lq.2.2.2)) rfl } classical have h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P := by apply (eq_tsub_iff_add_eq_of_le (Nat.succ_le_of_lt (Fintype.card_pos_iff.mpr ⟨p⟩))).mp convert (Fintype.card_subtype_compl _).trans (congr_arg _ (Fintype.card_subtype_eq p)) have h2 : ∀ l : { l : L // p ∈ l }, Fintype.card { q // q ∈ l.1 ∧ q ≠ p } = order P L := by intro l rw [← Fintype.card_congr (Equiv.subtypeSubtypeEquivSubtypeInter (· ∈ l.val) (· ≠ p)), Fintype.card_subtype_compl fun x : Subtype (· ∈ l.val) => x.val = p, ← Nat.card_eq_fintype_card] refine tsub_eq_of_eq_add ((pointCount_eq P l.1).trans ?_) rw [← Fintype.card_subtype_eq (⟨p, l.2⟩ : { q : P // q ∈ l.1 })] simp_rw [Subtype.ext_iff] simp_rw [← h1, Fintype.card_congr ϕ, Fintype.card_sigma, h2, Finset.sum_const, Finset.card_univ] rw [← Nat.card_eq_fintype_card, ← lineCount, lineCount_eq, smul_eq_mul, Nat.succ_mul, sq]
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
card_points
null
card_lines [Finite P] [Fintype L] : Fintype.card L = order P L ^ 2 + order P L + 1 := (card_points (Dual L) (Dual P)).trans (congr_arg (fun n => n ^ 2 + n + 1) (Dual.order P L))
theorem
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
card_lines
null
mem_iff (v w : ℙ K (Fin 3 → K)) : v ∈ w ↔ orthogonal v w := Iff.rfl
lemma
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
mem_iff
null
crossProduct_eq_zero_of_dotProduct_eq_zero {a b c d : Fin 3 → K} (hac : a ⬝ᵥ c = 0) (hbc : b ⬝ᵥ c = 0) (had : a ⬝ᵥ d = 0) (hbd : b ⬝ᵥ d = 0) : crossProduct a b = 0 ∨ crossProduct c d = 0 := by by_contra h simp_rw [not_or, ← ne_eq, crossProduct_ne_zero_iff_linearIndependent] at h rw [← Matrix.of_row (![a,b]), ← Matrix.of_row (![c,d])] at h let A : Matrix (Fin 2) (Fin 3) K := .of ![a, b] let B : Matrix (Fin 2) (Fin 3) K := .of ![c, d] have hAB : A * B.transpose = 0 := by ext i j fin_cases i <;> fin_cases j <;> assumption replace hAB := rank_add_rank_le_card_of_mul_eq_zero hAB rw [rank_transpose, h.1.rank_matrix, h.2.rank_matrix, Fintype.card_fin, Fintype.card_fin] at hAB contradiction
lemma
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
crossProduct_eq_zero_of_dotProduct_eq_zero
null
eq_or_eq_of_orthogonal {a b c d : ℙ K (Fin 3 → K)} (hac : a.orthogonal c) (hbc : b.orthogonal c) (had : a.orthogonal d) (hbd : b.orthogonal d) : a = b ∨ c = d := by induction a with | h a ha => induction b with | h b hb => induction c with | h c hc => induction d with | h d hd => rw [mk_eq_mk_iff_crossProduct_eq_zero, mk_eq_mk_iff_crossProduct_eq_zero] exact crossProduct_eq_zero_of_dotProduct_eq_zero hac hbc had hbd
lemma
Combinatorics
[ "Mathlib.Combinatorics.Hall.Basic", "Mathlib.LinearAlgebra.Matrix.Rank", "Mathlib.LinearAlgebra.Projectivization.Constructions" ]
Mathlib/Combinatorics/Configuration.lean
eq_or_eq_of_orthogonal
null
@[ext] Subspace (η α ι : Type*) where /-- The word representing a combinatorial subspace. `l.idxfun i = Sum.inr e` means that `l x i = x e` for all `x` and `l.idxfun i = some a` means that `l x i = a` for all `x`. -/ idxFun : ι → α ⊕ η /-- We require combinatorial subspaces to be nontrivial in the sense that `fun x ↦ l x i` is `fun x ↦ x e` for at least one coordinate `i`. -/ proper : ∀ e, ∃ i, idxFun i = Sum.inr e
structure
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
Subspace
The type of combinatorial subspaces. A subspace `l : Subspace η α ι` in the hypercube `ι → α` defines a function `(η → α) → ι → α` from `η → α` to the hypercube, such that for each coordinate `i : ι` and direction `e : η`, the function `fun x ↦ l x i` is either `fun x ↦ x e` for some direction `e : η` or constant. We require subspaces to be non-degenerate in the sense that, for every `e : η`, `fun x ↦ l x i` is `fun x ↦ x e` for at least one `i`. Formally, a subspace is represented by a word `l.idxFun : ι → α ⊕ η` which says whether `fun x ↦ l x i` is `fun x ↦ x e` (corresponding to `l.idxFun i = Sum.inr e`) or constantly `a` (corresponding to `l.idxFun i = Sum.inl a`). When `α` has size `1` there can be many elements of `Subspace η α ι` defining the same function.
@[coe] toFun (l : Subspace η α ι) (x : η → α) (i : ι) : α := (l.idxFun i).elim id x
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
toFun
The combinatorial subspace corresponding to the identity embedding `(ι → α) → (ι → α)`. -/ instance : Inhabited (Subspace ι α ι) := ⟨⟨Sum.inr, fun i ↦ ⟨i, rfl⟩⟩⟩ /-- Consider a subspace `l : Subspace η α ι` as a function `(η → α) → ι → α`.
instCoeFun : CoeFun (Subspace η α ι) (fun _ ↦ (η → α) → ι → α) := ⟨toFun⟩
instance
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
instCoeFun
null
coe_apply (l : Subspace η α ι) (x : η → α) (i : ι) : l x i = (l.idxFun i).elim id x := rfl
lemma
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
coe_apply
null
coe_injective [Nontrivial α] : Injective ((⇑) : Subspace η α ι → (η → α) → ι → α) := by classical rintro l m hlm ext i simp only [funext_iff] at hlm cases hl : idxFun l i with | inl a => obtain ⟨b, hba⟩ := exists_ne a cases hm : idxFun m i <;> simpa [hl, hm, hba.symm, coe_apply] using hlm (const _ b) i | inr e => cases hm : idxFun m i with | inl a => obtain ⟨b, hba⟩ := exists_ne a simpa [hl, hm, hba, coe_apply] using hlm (const _ b) i | inr f => obtain ⟨a, b, hab⟩ := exists_pair_ne α simp only [Sum.inr.injEq] by_contra! hef simpa [hl, hm, hef, hab, coe_apply] using hlm (Function.update (const _ a) f b) i
lemma
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
coe_injective
null
apply_def (l : Subspace η α ι) (x : η → α) (i : ι) : l x i = (l.idxFun i).elim id x := rfl
lemma
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
apply_def
null
apply_inl (h : l.idxFun i = Sum.inl a) : l x i = a := by simp [apply_def, h]
lemma
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
apply_inl
null
apply_inr (h : l.idxFun i = Sum.inr e) : l x i = x e := by simp [apply_def, h]
lemma
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
apply_inr
null
IsMono (C : (ι → α) → κ) (l : Subspace η α ι) : Prop := ∃ c, ∀ x, C (l x) = c variable {η' α' ι' : Type*}
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
IsMono
Given a coloring `C` of `ι → α` and a combinatorial subspace `l` of `ι → α`, `l.IsMono C` means that `l` is monochromatic with regard to `C`.
reindex (l : Subspace η α ι) (eη : η ≃ η') (eα : α ≃ α') (eι : ι ≃ ι') : Subspace η' α' ι' where idxFun i := (l.idxFun <| eι.symm i).map eα eη proper e := (eι.exists_congr fun i ↦ by cases h : idxFun l i <;> simp [*, Equiv.eq_symm_apply]).1 <| l.proper <| eη.symm e @[simp] lemma reindex_apply (l : Subspace η α ι) (eη : η ≃ η') (eα : α ≃ α') (eι : ι ≃ ι') (x i) : l.reindex eη eα eι x i = eα (l (eα.symm ∘ x ∘ eη) <| eι.symm i) := by cases h : l.idxFun (eι.symm i) <;> simp [h, reindex, coe_apply] @[simp] lemma reindex_isMono {eη : η ≃ η'} {eα : α ≃ α'} {eι : ι ≃ ι'} {C : (ι' → α') → κ} : (l.reindex eη eα eι).IsMono C ↔ l.IsMono fun x ↦ C <| eα ∘ x ∘ eι.symm := by simp only [IsMono, funext (reindex_apply _ _ _ _ _), coe_apply] exact exists_congr fun c ↦ (eη.arrowCongr eα).symm.forall_congr <| by aesop
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
reindex
Change the index types of a subspace.
protected IsMono.reindex {eη : η ≃ η'} {eα : α ≃ α'} {eι : ι ≃ ι'} {C : (ι → α) → κ} (hl : l.IsMono C) : (l.reindex eη eα eι).IsMono fun x ↦ C <| eα.symm ∘ x ∘ eι := by simp [reindex_isMono, Function.comp_assoc]; simpa [← Function.comp_assoc]
lemma
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
IsMono.reindex
null
@[ext] Line (α ι : Type*) where /-- The word representing a combinatorial line. `l.idxfun i = none` means that `l x i = x` for all `x` and `l.idxfun i = some y` means that `l x i = y`. -/ idxFun : ι → Option α /-- We require combinatorial lines to be nontrivial in the sense that `fun x ↦ l x i` is `id` for at least one coordinate `i`. -/ proper : ∃ i, idxFun i = none
structure
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
Line
The type of combinatorial lines. A line `l : Line α ι` in the hypercube `ι → α` defines a function `α → ι → α` from `α` to the hypercube, such that for each coordinate `i : ι`, the function `fun x ↦ l x i` is either `id` or constant. We require lines to be nontrivial in the sense that `fun x ↦ l x i` is `id` for at least one `i`. Formally, a line is represented by a word `l.idxFun : ι → Option α` which says whether `fun x ↦ l x i` is `id` (corresponding to `l.idxFun i = none`) or constantly `y` (corresponding to `l.idxFun i = some y`). When `α` has size `1` there can be many elements of `Line α ι` defining the same function.
@[coe] toFun (l : Line α ι) (x : α) (i : ι) : α := (l.idxFun i).getD x
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
toFun
Consider a line `l : Line α ι` as a function `α → ι → α`.
instCoeFun : CoeFun (Line α ι) fun _ => α → ι → α := ⟨toFun⟩ @[simp] lemma coe_apply (l : Line α ι) (x : α) (i : ι) : l x i = (l.idxFun i).getD x := rfl
instance
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
instCoeFun
null
coe_injective [Nontrivial α] : Injective ((⇑) : Line α ι → α → ι → α) := by rintro l m hlm ext i a obtain ⟨b, hba⟩ := exists_ne a simp only [funext_iff] at hlm ⊢ refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · cases hi : idxFun m i <;> simpa [@eq_comm _ a, hi, h, hba] using hlm b i · cases hi : idxFun l i <;> simpa [@eq_comm _ a, hi, h, hba] using hlm b i
lemma
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
coe_injective
null
IsMono {α ι κ} (C : (ι → α) → κ) (l : Line α ι) : Prop := ∃ c, ∀ x, C (l x) = c
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
IsMono
A line is monochromatic if all its points are the same color.
toSubspaceUnit (l : Line α ι) : Subspace Unit α ι where idxFun i := (l.idxFun i).elim (.inr ()) .inl proper _ := l.proper.imp fun i hi ↦ by simp [hi] @[simp] lemma toSubspaceUnit_apply (l : Line α ι) (a) : ⇑l.toSubspaceUnit a = l (a ()) := by ext i; cases h : l.idxFun i <;> simp [toSubspaceUnit, h, Subspace.coe_apply] @[simp] lemma toSubspaceUnit_isMono {C : (ι → α) → κ} : l.toSubspaceUnit.IsMono C ↔ l.IsMono C := by simp only [Subspace.IsMono, toSubspaceUnit_apply, IsMono] exact exists_congr fun c ↦ ⟨fun h a ↦ h fun _ ↦ a, fun h a ↦ h _⟩ protected alias ⟨_, IsMono.toSubspaceUnit⟩ := toSubspaceUnit_isMono
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
toSubspaceUnit
Consider a line as a one-dimensional subspace.
toSubspace (l : Line (η → α) ι) : Subspace η α (ι × η) where idxFun ie := (l.idxFun ie.1).elim (.inr ie.2) (fun f ↦ .inl <| f ie.2) proper e := let ⟨i, hi⟩ := l.proper; ⟨(i, e), by simp [hi]⟩ @[simp] lemma toSubspace_apply (l : Line (η → α) ι) (a ie) : ⇑l.toSubspace a ie = l a ie.1 ie.2 := by cases h : l.idxFun ie.1 <;> simp [toSubspace, h, coe_apply, Subspace.coe_apply] @[simp] lemma toSubspace_isMono {l : Line (η → α) ι} {C : (ι × η → α) → κ} : l.toSubspace.IsMono C ↔ l.IsMono fun x : ι → η → α ↦ C fun (i, e) ↦ x i e := by simp [Subspace.IsMono, IsMono, funext (toSubspace_apply _ _)] protected alias ⟨_, IsMono.toSubspace⟩ := toSubspace_isMono
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
toSubspace
Consider a line in `ι → η → α` as a `η`-dimensional subspace in `ι × η → α`.
diagonal (α ι) [Nonempty ι] : Line α ι where idxFun _ := none proper := ⟨Classical.arbitrary ι, rfl⟩
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
diagonal
The diagonal line. It is the identity at every coordinate.
AlmostMono {α ι κ : Type*} (C : (ι → Option α) → κ) where /-- The underlying line of an almost monochromatic line, where the coordinate dimension `α` is extended by an additional symbol `none`, thought to be marking the endpoint of the line. -/ line : Line (Option α) ι /-- The main color of an almost monochromatic line. -/ color : κ /-- The proposition that the underlying line of an almost monochromatic line assumes its main color except possibly at the endpoints. -/ has_color : ∀ x : α, C (line (some x)) = color
structure
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
AlmostMono
The type of lines that are only one color except possibly at their endpoints.
ColorFocused {α ι κ : Type*} (C : (ι → Option α) → κ) where /-- The underlying multiset of almost monochromatic lines of a color-focused collection. -/ lines : Multiset (AlmostMono C) /-- The common endpoint of the lines in the color-focused collection. -/ focus : ι → Option α /-- The proposition that all lines in a color-focused collection have the same endpoint. -/ is_focused : ∀ p ∈ lines, p.line none = focus /-- The proposition that all lines in a color-focused collection of lines have distinct colors. -/ distinct_colors : (lines.map AlmostMono.color).Nodup
structure
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
ColorFocused
The type of collections of lines such that - each line is only one color except possibly at its endpoint - the lines all have the same endpoint - the colors of the lines are distinct. Used in the proof `exists_mono_in_high_dimension`.
map {α α' ι} (f : α → α') (l : Line α ι) : Line α' ι where idxFun i := (l.idxFun i).map f proper := ⟨l.proper.choose, by simp only [l.proper.choose_spec, Option.map_none]⟩
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
map
A function `f : α → α'` determines a function `line α ι → line α' ι`. For a coordinate `i` `l.map f` is the identity at `i` if `l` is, and constantly `f y` if `l` is constantly `y` at `i`.
vertical {α ι ι'} (v : ι → α) (l : Line α ι') : Line α (ι ⊕ ι') where idxFun := Sum.elim (some ∘ v) l.idxFun proper := ⟨Sum.inr l.proper.choose, l.proper.choose_spec⟩
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
vertical
A point in `ι → α` and a line in `ι' → α` determine a line in `ι ⊕ ι' → α`.
horizontal {α ι ι'} (l : Line α ι) (v : ι' → α) : Line α (ι ⊕ ι') where idxFun := Sum.elim l.idxFun (some ∘ v) proper := ⟨Sum.inl l.proper.choose, l.proper.choose_spec⟩
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
horizontal
A line in `ι → α` and a point in `ι' → α` determine a line in `ι ⊕ ι' → α`.
prod {α ι ι'} (l : Line α ι) (l' : Line α ι') : Line α (ι ⊕ ι') where idxFun := Sum.elim l.idxFun l'.idxFun proper := ⟨Sum.inl l.proper.choose, l.proper.choose_spec⟩
def
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
prod
One line in `ι → α` and one in `ι' → α` together determine a line in `ι ⊕ ι' → α`.
apply_def (l : Line α ι) (x : α) : l x = fun i => (l.idxFun i).getD x := rfl
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
apply_def
null
apply_none {α ι} (l : Line α ι) (x : α) (i : ι) (h : l.idxFun i = none) : l x i = x := by simp only [Option.getD_none, h, l.apply_def]
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
apply_none
null
apply_some (h : l.idxFun i = some a) : l x i = a := by simp [h] @[simp]
lemma
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
apply_some
null
map_apply {α α' ι} (f : α → α') (l : Line α ι) (x : α) : l.map f (f x) = f ∘ l x := by simp only [Line.apply_def, Line.map, Option.getD_map, comp_def] @[simp]
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
map_apply
null
vertical_apply {α ι ι'} (v : ι → α) (l : Line α ι') (x : α) : l.vertical v x = Sum.elim v (l x) := by funext i cases i <;> rfl @[simp]
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
vertical_apply
null
horizontal_apply {α ι ι'} (l : Line α ι) (v : ι' → α) (x : α) : l.horizontal v x = Sum.elim (l x) v := by funext i cases i <;> rfl @[simp]
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
horizontal_apply
null
prod_apply {α ι ι'} (l : Line α ι) (l' : Line α ι') (x : α) : l.prod l' x = Sum.elim (l x) (l' x) := by funext i cases i <;> rfl @[simp]
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
prod_apply
null
diagonal_apply {α ι} [Nonempty ι] (x : α) : diagonal α ι x = fun _ => x := by ext; simp [diagonal]
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
diagonal_apply
null
private exists_mono_in_high_dimension' : ∀ (α : Type u) [Finite α] (κ : Type max v u) [Finite κ], ∃ (ι : Type) (_ : Fintype ι), ∀ C : (ι → α) → κ, ∃ l : Line α ι, l.IsMono C := Finite.induction_empty_option (-- We have to show that the theorem is invariant under `α ≃ α'` for the induction to work. fun {α α'} e => forall_imp fun κ => forall_imp fun _ => Exists.imp fun ι => Exists.imp fun _ h C => let ⟨l, c, lc⟩ := h fun v => C (e ∘ v) ⟨l.map e, c, e.forall_congr_right.mp fun x => by rw [← lc x, Line.map_apply]⟩) (by intro κ _ by_cases h : Nonempty κ · refine ⟨Unit, inferInstance, fun C => ⟨default, Classical.arbitrary _, PEmpty.rec⟩⟩ · exact ⟨Empty, inferInstance, fun C => (h ⟨C (Empty.rec)⟩).elim⟩) (by intro α _ ihα κ _ cases nonempty_fintype κ by_cases h : Nonempty α case neg => refine ⟨Unit, inferInstance, fun C => ⟨diagonal _ Unit, C fun _ => none, ?_⟩⟩ rintro (_ | ⟨a⟩) · rfl · exact (h ⟨a⟩).elim suffices key : ∀ r : ℕ, ∃ (ι : Type) (_ : Fintype ι), ∀ C : (ι → Option α) → κ, (∃ s : ColorFocused C, Multiset.card s.lines = r) ∨ ∃ l, IsMono C l by obtain ⟨ι, _inst, hι⟩ := key (Fintype.card κ + 1) refine ⟨ι, _inst, fun C => (hι C).resolve_left ?_⟩ rintro ⟨s, sr⟩ apply Nat.not_succ_le_self (Fintype.card κ) rw [← Nat.add_one, ← sr, ← Multiset.card_map, ← Finset.card_mk] exact Finset.card_le_univ ⟨_, s.distinct_colors⟩ intro r induction r with | zero => exact ⟨Empty, inferInstance, fun C => Or.inl ⟨default, Multiset.card_zero⟩⟩ | succ r ihr => obtain ⟨ι, _inst, hι⟩ := ihr specialize ihα ((ι → Option α) → κ) obtain ⟨ι', _inst, hι'⟩ := ihα refine ⟨ι ⊕ ι', inferInstance, ?_⟩ intro C specialize hι' fun v' v => C (Sum.elim v (some ∘ v')) obtain ⟨l', C', hl'⟩ := hι' have mono_of_mono : (∃ l, IsMono C' l) → ∃ l, IsMono C l := by rintro ⟨l, c, hl⟩ refine ⟨l.horizontal (some ∘ l' (Classical.arbitrary α)), c, fun x => ?_⟩ ...
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
exists_mono_in_high_dimension'
The **Hales-Jewett theorem**. This version has a restriction on universe levels which is necessary for the proof. See `exists_mono_in_high_dimension` for a fully universe-polymorphic version.
exists_mono_in_high_dimension (α : Type u) [Finite α] (κ : Type v) [Finite κ] : ∃ (ι : Type) (_ : Fintype ι), ∀ C : (ι → α) → κ, ∃ l : Line α ι, l.IsMono C := let ⟨ι, ιfin, hι⟩ := exists_mono_in_high_dimension'.{u,v} α (ULift.{u,v} κ) ⟨ι, ιfin, fun C => let ⟨l, c, hc⟩ := hι (ULift.up ∘ C) ⟨l, c.down, fun x => by rw [← hc x, Function.comp_apply]⟩⟩
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
exists_mono_in_high_dimension
The **Hales-Jewett theorem**: For any finite types `α` and `κ`, there exists a finite type `ι` such that whenever the hypercube `ι → α` is `κ`-colored, there is a monochromatic combinatorial line.
exists_mono_homothetic_copy {M κ : Type*} [AddCommMonoid M] (S : Finset M) [Finite κ] (C : M → κ) : ∃ a > 0, ∃ (b : M) (c : κ), ∀ s ∈ S, C (a • s + b) = c := by classical obtain ⟨ι, _inst, hι⟩ := Line.exists_mono_in_high_dimension S κ specialize hι fun v => C <| ∑ i, v i obtain ⟨l, c, hl⟩ := hι set s : Finset ι := {i | l.idxFun i = none} with hs refine ⟨#s, Finset.card_pos.mpr ⟨l.proper.choose, ?_⟩, ∑ i ∈ sᶜ, ((l.idxFun i).map ?_).getD 0, c, ?_⟩ · rw [hs, Finset.mem_filter] exact ⟨Finset.mem_univ _, l.proper.choose_spec⟩ · exact fun m => m intro x xs rw [← hl ⟨x, xs⟩] clear hl; congr rw [← Finset.sum_add_sum_compl s] congr 1 · rw [← Finset.sum_const] apply Finset.sum_congr rfl intro i hi rw [hs, Finset.mem_filter] at hi rw [l.apply_none _ _ hi.right, Subtype.coe_mk] · apply Finset.sum_congr rfl intro i hi rw [hs, Finset.compl_filter, Finset.mem_filter] at hi obtain ⟨y, hy⟩ := Option.ne_none_iff_exists.mp hi.right simp [← hy, Option.map_some, Option.getD]
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
exists_mono_homothetic_copy
A generalization of Van der Waerden's theorem: if `M` is a finitely colored commutative monoid, and `S` is a finite subset, then there exists a monochromatic homothetic copy of `S`.
exists_mono_in_high_dimension (α κ η) [Finite α] [Finite κ] [Finite η] : ∃ (ι : Type) (_ : Fintype ι), ∀ C : (ι → α) → κ, ∃ l : Subspace η α ι, l.IsMono C := by cases nonempty_fintype η obtain ⟨ι, _, hι⟩ := Line.exists_mono_in_high_dimension (Shrink.{0} η → α) κ refine ⟨ι × Shrink η, inferInstance, fun C ↦ ?_⟩ obtain ⟨l, hl⟩ := hι fun x ↦ C fun (i, e) ↦ x i e refine ⟨l.toSubspace.reindex (equivShrink.{0} η).symm (Equiv.refl _) (Equiv.refl _), ?_⟩ convert hl.toSubspace.reindex simp
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
exists_mono_in_high_dimension
The **multidimensional Hales-Jewett theorem**, aka **extended Hales-Jewett theorem**: For any finite types `η`, `α` and `κ`, there exists a finite type `ι` such that whenever the hypercube `ι → α` is `κ`-colored, there is a monochromatic combinatorial subspace of dimension `η`.
exists_mono_in_high_dimension_fin (α κ η) [Finite α] [Finite κ] [Finite η] : ∃ n, ∀ C : (Fin n → α) → κ, ∃ l : Subspace η α (Fin n), l.IsMono C := by obtain ⟨ι, ιfin, hι⟩ := exists_mono_in_high_dimension α κ η refine ⟨Fintype.card ι, fun C ↦ ?_⟩ obtain ⟨l, c, cl⟩ := hι fun v ↦ C (v ∘ (Fintype.equivFin _).symm) refine ⟨⟨l.idxFun ∘ (Fintype.equivFin _).symm, fun e ↦ ?_⟩, c, cl⟩ obtain ⟨i, hi⟩ := l.proper e use Fintype.equivFin _ i simpa using hi
theorem
Combinatorics
[ "Mathlib.Data.Fintype.Option", "Mathlib.Data.Fintype.Shrink", "Mathlib.Data.Fintype.Sum", "Mathlib.Data.Finite.Prod", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/HalesJewett.lean
exists_mono_in_high_dimension_fin
A variant of the **extended Hales-Jewett theorem** `exists_mono_in_high_dimension` where the returned type is some `Fin n` instead of a general fintype.
asserts that whenever the positive integers are finitely colored, there exists a sequence `a₀, a₁, a₂, …` such that `FS(a₀, …)` is monochromatic. There is also a stronger version, saying that whenever a set of the form `FS(a₀, …)` is finitely colored, there exists a sequence `b₀, b₁, b₂, …` such that `FS(b₀, …)` is monochromatic and contained in `FS(a₀, …)`. We prove both these versions for a general semigroup `M` instead of `ℕ+` since it is no harder, although this special case implies the general case. The idea of the proof is to extend the addition `(+) : M → M → M` to addition `(+) : βM → βM → βM` on the space `βM` of ultrafilters on `M`. One can prove that if `U` is an _idempotent_ ultrafilter, i.e. `U + U = U`, then any `U`-large subset of `M` contains some set `FS(a₀, …)` (see `exists_FS_of_large`). And with the help of a general topological argument one can show that any set of the form `FS(a₀, …)` is `U`-large according to some idempotent ultrafilter `U` (see `exists_idempotent_ultrafilter_le_FS`). This is enough to prove the theorem since in any finite partition of a `U`-large set, one of the parts is `U`-large.
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
asserts
null
@[to_additive /-- Addition of ultrafilters given by `∀ᶠ m in U+V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m+m')`. -/] Ultrafilter.mul {M} [Mul M] : Mul (Ultrafilter M) where mul U V := (· * ·) <$> U <*> V attribute [local instance] Ultrafilter.mul Ultrafilter.add /- We could have taken this as the definition of `U * V`, but then we would have to prove that it defines an ultrafilter. -/ @[to_additive]
def
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
Ultrafilter.mul
Multiplication of ultrafilters given by `∀ᶠ m in U*V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m*m')`.
Ultrafilter.eventually_mul {M} [Mul M] (U V : Ultrafilter M) (p : M → Prop) : (∀ᶠ m in ↑(U * V), p m) ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m * m') := Iff.rfl
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
Ultrafilter.eventually_mul
null
@[to_additive /-- Additive semigroup structure on `Ultrafilter M` induced by an additive semigroup structure on `M`. -/] Ultrafilter.semigroup {M} [Semigroup M] : Semigroup (Ultrafilter M) := { Ultrafilter.mul with mul_assoc := fun U V W => Ultrafilter.coe_inj.mp <| Filter.ext' fun p => by simp [Ultrafilter.eventually_mul, mul_assoc] } attribute [local instance] Ultrafilter.semigroup Ultrafilter.addSemigroup @[to_additive]
def
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
Ultrafilter.semigroup
Semigroup structure on `Ultrafilter M` induced by a semigroup structure on `M`.
Ultrafilter.continuous_mul_left {M} [Mul M] (V : Ultrafilter M) : Continuous (· * V) := ultrafilterBasis_is_basis.continuous_iff.2 <| Set.forall_mem_range.mpr fun s ↦ ultrafilter_isOpen_basic { m : M | ∀ᶠ m' in V, m * m' ∈ s }
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
Ultrafilter.continuous_mul_left
null
FS {M} [AddSemigroup M] : Stream' M → Set M | head' (a : Stream' M) : FS a a.head | tail' (a : Stream' M) (m : M) (h : FS a.tail m) : FS a m | cons' (a : Stream' M) (m : M) (h : FS a.tail m) : FS a (a.head + m)
inductive
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FS
`FS a` is the set of finite sums in `a`, i.e. `m ∈ FS a` if `m` is the sum of a nonempty subsequence of `a`. We give a direct inductive definition instead of talking about subsequences.
@[to_additive FS] FP {M} [Semigroup M] : Stream' M → Set M | head' (a : Stream' M) : FP a a.head | tail' (a : Stream' M) (m : M) (h : FP a.tail m) : FP a m | cons' (a : Stream' M) (m : M) (h : FP a.tail m) : FP a (a.head * m)
inductive
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP
`FP a` is the set of finite products in `a`, i.e. `m ∈ FP a` if `m` is the product of a nonempty subsequence of `a`. We give a direct inductive definition instead of talking about subsequences.
@[to_additive (attr := match_pattern, nolint defLemma) /-- Constructor for `FS`. This is the preferred spelling over `FS.head'`. -/] FP.head : a.head ∈ FP a := FP.head' a
abbrev
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP.head
Constructor for `FP`. This is the preferred spelling over `FP.head'`.
@[to_additive (attr := match_pattern, nolint defLemma) /-- Constructor for `FS`. This is the preferred spelling over `FS.tail'`. -/] FP.tail : m ∈ FP a := FP.tail' a m h
abbrev
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP.tail
Constructor for `FP`. This is the preferred spelling over `FP.tail'`.
@[to_additive (attr := match_pattern, nolint defLemma) /-- Constructor for `FS`. This is the preferred spelling over `FS.cons'`. -/] FP.cons : a.head * m ∈ FP a := FP.cons' a m h
abbrev
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP.cons
Constructor for `FP`. This is the preferred spelling over `FP.cons'`.
@[to_additive /-- If `m` and `m'` are finite sums in `M`, then so is `m + m'`, provided that `m'` is obtained from a subsequence of `M` starting sufficiently late. -/] FP.mul {M} [Semigroup M] {a : Stream' M} {m : M} (hm : m ∈ FP a) : ∃ n, ∀ m' ∈ FP (a.drop n), m * m' ∈ FP a := by induction hm with | head' a => exact ⟨1, fun m hm => FP.cons a m hm⟩ | tail' a m _ ih => obtain ⟨n, hn⟩ := ih use n + 1 intro m' hm' exact FP.tail _ _ (hn _ hm') | cons' a m _ ih => obtain ⟨n, hn⟩ := ih use n + 1 intro m' hm' rw [mul_assoc] exact FP.cons _ _ (hn _ hm') @[to_additive exists_idempotent_ultrafilter_le_FS]
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP.mul
If `m` and `m'` are finite products in `M`, then so is `m * m'`, provided that `m'` is obtained from a subsequence of `M` starting sufficiently late.
exists_idempotent_ultrafilter_le_FP {M} [Semigroup M] (a : Stream' M) : ∃ U : Ultrafilter M, U * U = U ∧ ∀ᶠ m in U, m ∈ FP a := by let S : Set (Ultrafilter M) := ⋂ n, { U | ∀ᶠ m in U, m ∈ FP (a.drop n) } have h := exists_idempotent_in_compact_subsemigroup ?_ S ?_ ?_ ?_ · rcases h with ⟨U, hU, U_idem⟩ refine ⟨U, U_idem, ?_⟩ convert Set.mem_iInter.mp hU 0 · exact Ultrafilter.continuous_mul_left · apply IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed · intro n U hU filter_upwards [hU] rw [← Stream'.drop_drop, ← Stream'.tail_eq_drop] exact FP.tail _ · intro n exact ⟨pure _, mem_pure.mpr <| FP.head _⟩ · exact (ultrafilter_isClosed_basic _).isCompact · intro n apply ultrafilter_isClosed_basic · exact IsClosed.isCompact (isClosed_iInter fun i => ultrafilter_isClosed_basic _) · intro U hU V hV rw [Set.mem_iInter] at * intro n rw [Set.mem_setOf_eq, Ultrafilter.eventually_mul] filter_upwards [hU n] with m hm obtain ⟨n', hn⟩ := FP.mul hm filter_upwards [hV (n' + n)] with m' hm' apply hn simpa only [Stream'.drop_drop, add_comm] using hm' @[to_additive exists_FS_of_large]
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
exists_idempotent_ultrafilter_le_FP
null
exists_FP_of_large {M} [Semigroup M] (U : Ultrafilter M) (U_idem : U * U = U) (s₀ : Set M) (sU : s₀ ∈ U) : ∃ a, FP a ⊆ s₀ := by /- Informally: given a `U`-large set `s₀`, the set `s₀ ∩ { m | ∀ᶠ m' in U, m * m' ∈ s₀ }` is also `U`-large (since `U` is idempotent). Thus in particular there is an `a₀` in this intersection. Now let `s₁` be the intersection `s₀ ∩ { m | a₀ * m ∈ s₀ }`. By choice of `a₀`, this is again `U`-large, so we can repeat the argument starting from `s₁`, obtaining `a₁`, `s₂`, etc. This gives the desired infinite sequence. -/ have exists_elem : ∀ {s : Set M} (_hs : s ∈ U), (s ∩ { m | ∀ᶠ m' in U, m * m' ∈ s }).Nonempty := fun {s} hs => Ultrafilter.nonempty_of_mem (inter_mem hs <| by rwa [← U_idem] at hs) let elem : { s // s ∈ U } → M := fun p => (exists_elem p.property).some let succ : {s // s ∈ U} → {s // s ∈ U} := fun (p : {s // s ∈ U}) => ⟨p.val ∩ {m : M | elem p * m ∈ p.val}, inter_mem p.property (show (exists_elem p.property).some ∈ {m : M | ∀ᶠ (m' : M) in ↑U, m * m' ∈ p.val} from p.val.inter_subset_right (exists_elem p.property).some_mem)⟩ use Stream'.corec elem succ (Subtype.mk s₀ sU) suffices ∀ (a : Stream' M), ∀ m ∈ FP a, ∀ p, a = Stream'.corec elem succ p → m ∈ p.val by intro m hm exact this _ m hm ⟨s₀, sU⟩ rfl clear sU s₀ intro a m h induction h with | head' b => rintro p rfl rw [Stream'.corec_eq, Stream'.head_cons] exact Set.inter_subset_left (Set.Nonempty.some_mem _) | tail' b n h ih => rintro p rfl refine Set.inter_subset_left (ih (succ p) ?_) rw [Stream'.corec_eq, Stream'.tail_cons] | cons' b n h ih => rintro p rfl have := Set.inter_subset_right (ih (succ p) ?_) · simpa only using this rw [Stream'.corec_eq, Stream'.tail_cons]
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
exists_FP_of_large
null
@[to_additive FS_partition_regular /-- The strong form of **Hindman's theorem**: in any finite cover of an FS-set, one the parts contains an FS-set. -/] FP_partition_regular {M} [Semigroup M] (a : Stream' M) (s : Set (Set M)) (sfin : s.Finite) (scov : FP a ⊆ ⋃₀ s) : ∃ c ∈ s, ∃ b : Stream' M, FP b ⊆ c := let ⟨U, idem, aU⟩ := exists_idempotent_ultrafilter_le_FP a let ⟨c, cs, hc⟩ := (Ultrafilter.finite_sUnion_mem_iff sfin).mp (mem_of_superset aU scov) ⟨c, cs, exists_FP_of_large U idem c hc⟩
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP_partition_regular
The strong form of **Hindman's theorem**: in any finite cover of an FP-set, one the parts contains an FP-set.
@[to_additive exists_FS_of_finite_cover /-- The weak form of **Hindman's theorem**: in any finite cover of a nonempty additive semigroup, one of the parts contains an FS-set. -/] exists_FP_of_finite_cover {M} [Semigroup M] [Nonempty M] (s : Set (Set M)) (sfin : s.Finite) (scov : ⊤ ⊆ ⋃₀ s) : ∃ c ∈ s, ∃ a : Stream' M, FP a ⊆ c := let ⟨U, hU⟩ := exists_idempotent_of_compact_t2_of_continuous_mul_left (@Ultrafilter.continuous_mul_left M _) let ⟨c, c_s, hc⟩ := (Ultrafilter.finite_sUnion_mem_iff sfin).mp (mem_of_superset univ_mem scov) ⟨c, c_s, exists_FP_of_large U hU c hc⟩ @[to_additive FS_iter_tail_sub_FS]
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
exists_FP_of_finite_cover
The weak form of **Hindman's theorem**: in any finite cover of a nonempty semigroup, one of the parts contains an FP-set.
FP_drop_subset_FP {M} [Semigroup M] (a : Stream' M) (n : ℕ) : FP (a.drop n) ⊆ FP a := by induction n with | zero => rfl | succ n ih => rw [← Stream'.drop_drop] exact _root_.trans (FP.tail _) ih @[to_additive]
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP_drop_subset_FP
null
FP.singleton {M} [Semigroup M] (a : Stream' M) (i : ℕ) : a.get i ∈ FP a := by induction i generalizing a with | zero => exact FP.head _ | succ i ih => exact FP.tail _ _ (ih _) @[to_additive]
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP.singleton
null
FP.mul_two {M} [Semigroup M] (a : Stream' M) (i j : ℕ) (ij : i < j) : a.get i * a.get j ∈ FP a := by refine FP_drop_subset_FP _ i ?_ rw [← Stream'.head_drop] apply FP.cons rcases Nat.exists_eq_add_of_le (Nat.succ_le_of_lt ij) with ⟨d, hd⟩ have := FP.singleton (a.drop i).tail d rw [Stream'.tail_eq_drop, Stream'.get_drop, Stream'.get_drop] at this convert this cutsat @[to_additive]
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP.mul_two
null
FP.finset_prod {M} [CommMonoid M] (a : Stream' M) (s : Finset ℕ) (hs : s.Nonempty) : (s.prod fun i => a.get i) ∈ FP a := by refine FP_drop_subset_FP _ (s.min' hs) ?_ induction s using Finset.eraseInduction with | H s ih => _ rw [← Finset.mul_prod_erase _ _ (s.min'_mem hs), ← Stream'.head_drop] rcases (s.erase (s.min' hs)).eq_empty_or_nonempty with h | h · rw [h, Finset.prod_empty, mul_one] exact FP.head _ · apply FP.cons rw [Stream'.tail_eq_drop, Stream'.drop_drop, add_comm] refine Set.mem_of_subset_of_mem ?_ (ih _ (s.min'_mem hs) h) have : s.min' hs + 1 ≤ (s.erase (s.min' hs)).min' h := Nat.succ_le_of_lt (Finset.min'_lt_of_mem_erase_min' _ _ <| Finset.min'_mem _ _) obtain ⟨d, hd⟩ := Nat.exists_eq_add_of_le this rw [hd, ← Stream'.drop_drop, add_comm] apply FP_drop_subset_FP
theorem
Combinatorics
[ "Mathlib.Data.Stream.Init", "Mathlib.Topology.Algebra.Semigroup", "Mathlib.Topology.Compactification.StoneCech", "Mathlib.Algebra.BigOperators.Group.Finset.Basic" ]
Mathlib/Combinatorics/Hindman.lean
FP.finset_prod
null
eq_zero_of_eval_zero_at_prod_finset {σ : Type*} [Finite σ] [IsDomain R] (P : MvPolynomial σ R) (S : σ → Finset R) (Hdeg : ∀ i, P.degreeOf i < #(S i)) (Heval : ∀ (x : σ → R), (∀ i, x i ∈ S i) → eval x P = 0) : P = 0 := by induction σ using Finite.induction_empty_option with | @of_equiv σ τ e h => suffices MvPolynomial.rename e.symm P = 0 by have that := MvPolynomial.rename_injective (R := R) e.symm (e.symm.injective) rw [RingHom.injective_iff_ker_eq_bot] at that rwa [← RingHom.mem_ker, that] at this apply h _ (fun i ↦ S (e i)) · intro i classical convert Hdeg (e i) conv_lhs => rw [← e.symm_apply_apply i, degreeOf_rename_of_injective e.symm.injective] · intro x hx simp only [MvPolynomial.eval_rename] apply Heval intro s simp only [Function.comp_apply] convert hx (e.symm s) simp only [Equiv.apply_symm_apply] | h_empty => suffices P = C (constantCoeff P) by specialize Heval default (fun i ↦ PEmpty.elim i) rw [this, eval_C] at Heval rw [this, Heval, C_0] ext m suffices m = 0 by simp [this, ← constantCoeff_eq] ext d; exact PEmpty.elim d | @h_option σ _ h => set Q := optionEquivLeft R σ P with hQ suffices Q = 0 by rw [← AlgEquiv.symm_apply_apply (optionEquivLeft R σ) P, ← hQ, this, map_zero] have Heval' (x : σ → R) (hx : ∀ i, x i ∈ S (some i)) : Polynomial.map (eval x) Q = 0 := by apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero' _ (S none) · intro y hy rw [← optionEquivLeft_elim_eval] apply Heval simp only [Option.forall, Option.elim_none, hy, Option.elim_some, hx, implies_true, and_self] · apply lt_of_le_of_lt _ (Hdeg none) rw [Polynomial.natDegree_le_iff_coeff_eq_zero] intro d hd simp only [hQ] rw [MvPolynomial.coeff_eval_eq_eval_coeff] convert map_zero (MvPolynomial.eval x) ext m simp only [coeff_zero] set n := (embDomain Function.Embedding.some m).update none d with hn ...
theorem
Combinatorics
[ "Mathlib.Algebra.MvPolynomial.Equiv", "Mathlib.Algebra.Polynomial.Degree.Definitions", "Mathlib.Data.Finsupp.MonomialOrder.DegLex", "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.MvPolynomial.Groebner", "Mathlib.RingTheory.MvPolynomial.Homogeneous", "Mathlib.RingTheory.MvPolynomial.MonomialOrder.D...
Mathlib/Combinatorics/Nullstellensatz.lean
eq_zero_of_eval_zero_at_prod_finset
A multivariate polynomial that vanishes on a large product finset is the zero polynomial.
private noncomputable Alon.P (S : Finset R) (i : σ) : MvPolynomial σ R := ∏ r ∈ S, (X i - C r)
def
Combinatorics
[ "Mathlib.Algebra.MvPolynomial.Equiv", "Mathlib.Algebra.Polynomial.Degree.Definitions", "Mathlib.Data.Finsupp.MonomialOrder.DegLex", "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.MvPolynomial.Groebner", "Mathlib.RingTheory.MvPolynomial.Homogeneous", "Mathlib.RingTheory.MvPolynomial.MonomialOrder.D...
Mathlib/Combinatorics/Nullstellensatz.lean
Alon.P
The polynomial in `X i` that vanishes at all elements of `S`.
private Alon.degree_P [Nontrivial R] (m : MonomialOrder σ) (S : Finset R) (i : σ) : m.degree (Alon.P S i) = single i #S := by simp only [P] rw [degree_prod_of_regular] · simp [Finset.sum_congr rfl (fun r _ ↦ m.degree_X_sub_C i r)] · intro r _ rw [m.monic_X_sub_C] exact isRegular_one
theorem
Combinatorics
[ "Mathlib.Algebra.MvPolynomial.Equiv", "Mathlib.Algebra.Polynomial.Degree.Definitions", "Mathlib.Data.Finsupp.MonomialOrder.DegLex", "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.MvPolynomial.Groebner", "Mathlib.RingTheory.MvPolynomial.Homogeneous", "Mathlib.RingTheory.MvPolynomial.MonomialOrder.D...
Mathlib/Combinatorics/Nullstellensatz.lean
Alon.degree_P
The degree of `Alon.P S i` with respect to `X i` is the cardinality of `S`, and `0` otherwise.
private Alon.monic_P [Nontrivial R] (m : MonomialOrder σ) (S : Finset R) (i : σ) : m.Monic (P S i) := Monic.prod (fun r _ ↦ m.monic_X_sub_C i r)
theorem
Combinatorics
[ "Mathlib.Algebra.MvPolynomial.Equiv", "Mathlib.Algebra.Polynomial.Degree.Definitions", "Mathlib.Data.Finsupp.MonomialOrder.DegLex", "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.MvPolynomial.Groebner", "Mathlib.RingTheory.MvPolynomial.Homogeneous", "Mathlib.RingTheory.MvPolynomial.MonomialOrder.D...
Mathlib/Combinatorics/Nullstellensatz.lean
Alon.monic_P
The leading coefficient of `Alon.P S i` is `1`.
private Alon.of_mem_P_support {ι : Type*} (i : ι) (S : Finset R) (m : ι →₀ ℕ) (hm : m ∈ (Alon.P S i).support) : ∃ e ≤ S.card, m = single i e := by classical have hP : Alon.P S i = .rename (fun _ ↦ i) (Alon.P S ()) := by simp [Alon.P, map_prod] rw [hP, support_rename_of_injective (Function.injective_of_subsingleton _)] at hm simp only [Finset.mem_image, mem_support_iff, ne_eq] at hm obtain ⟨e, he, hm⟩ := hm haveI : Nontrivial R := nontrivial_of_ne _ _ he refine ⟨e (), ?_, ?_⟩ · suffices e ≼[lex] single () #S by simpa [MonomialOrder.lex_le_iff_of_unique] using this rw [← Alon.degree_P] apply MonomialOrder.le_degree rw [mem_support_iff] convert he · rw [← hm] ext j by_cases hj : j = i · rw [hj, mapDomain_apply (Function.injective_of_subsingleton _), single_eq_same] · rw [mapDomain_notin_range, single_eq_of_ne hj] simp [Set.range_const, Set.mem_singleton_iff, hj] variable [Finite σ] open scoped BigOperators
lemma
Combinatorics
[ "Mathlib.Algebra.MvPolynomial.Equiv", "Mathlib.Algebra.Polynomial.Degree.Definitions", "Mathlib.Data.Finsupp.MonomialOrder.DegLex", "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.MvPolynomial.Groebner", "Mathlib.RingTheory.MvPolynomial.Homogeneous", "Mathlib.RingTheory.MvPolynomial.MonomialOrder.D...
Mathlib/Combinatorics/Nullstellensatz.lean
Alon.of_mem_P_support
The support of `Alon.P S i` is the set of exponents of the form `single i e`, for `e ≤ S.card`.
combinatorial_nullstellensatz_exists_linearCombination [IsDomain R] (S : σ → Finset R) (Sne : ∀ i, (S i).Nonempty) (f : MvPolynomial σ R) (Heval : ∀ (x : σ → R), (∀ i, x i ∈ S i) → eval x f = 0) : ∃ (h : σ →₀ MvPolynomial σ R), (∀ i, ((∏ s ∈ S i, (X i - C s)) * h i).totalDegree ≤ f.totalDegree) ∧ f = linearCombination (MvPolynomial σ R) (fun i ↦ ∏ r ∈ S i, (X i - C r)) h := by letI : LinearOrder σ := WellOrderingRel.isWellOrder.linearOrder obtain ⟨h, r, hf, hh, hr⟩ := degLex.div (b := fun i ↦ Alon.P (S i) i) (fun i ↦ by simp only [(Alon.monic_P ..).leadingCoeff_eq_one, isUnit_one]) f use h suffices r = 0 by rw [this, add_zero] at hf exact ⟨fun i ↦ degLex_totalDegree_monotone (hh i), hf⟩ apply eq_zero_of_eval_zero_at_prod_finset r S · intro i rw [degreeOf_eq_sup, Finset.sup_lt_iff (by simp [Sne i])] intro c hc rw [← not_le] intro h' apply hr c hc i intro j rw [Alon.degree_P, single_apply] split_ifs with hj · rw [← hj] exact h' · exact zero_le _ · intro x hx rw [Iff.symm sub_eq_iff_eq_add'] at hf rw [← hf, map_sub, Heval x hx, zero_sub, neg_eq_zero, linearCombination_apply, map_finsuppSum, Finsupp.sum, Finset.sum_eq_zero] intro i _ rw [smul_eq_mul, map_mul] convert mul_zero _ rw [Alon.P, map_prod] apply Finset.prod_eq_zero (hx i) simp
theorem
Combinatorics
[ "Mathlib.Algebra.MvPolynomial.Equiv", "Mathlib.Algebra.Polynomial.Degree.Definitions", "Mathlib.Data.Finsupp.MonomialOrder.DegLex", "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.MvPolynomial.Groebner", "Mathlib.RingTheory.MvPolynomial.Homogeneous", "Mathlib.RingTheory.MvPolynomial.MonomialOrder.D...
Mathlib/Combinatorics/Nullstellensatz.lean
combinatorial_nullstellensatz_exists_linearCombination
The **Combinatorial Nullstellensatz**. If `f` vanishes at every point `x : σ → R` such that `x s ∈ S s` for all `s`, then it can be written as a linear combination `f = linearCombination (MvPolynomial σ R) (fun i ↦ (∏ r ∈ S i, (X i - C r))) h`, for some `h : σ →₀ MvPolynomial σ R` such that `((∏ r ∈ S s, (X i - C r)) * h i).totalDegree ≤ f.totalDegree` for all `s`. [Alon_1999], theorem 1.
combinatorial_nullstellensatz_exists_eval_nonzero [IsDomain R] (f : MvPolynomial σ R) (t : σ →₀ ℕ) (ht : f.coeff t ≠ 0) (ht' : f.totalDegree = t.degree) (S : σ → Finset R) (htS : ∀ i, t i < #(S i)) : ∃ s : σ → R, (∀ i, s i ∈ S i) ∧ eval s f ≠ 0 := by let _ : LinearOrder σ := WellOrderingRel.isWellOrder.linearOrder classical by_contra Heval apply ht push_neg at Heval obtain ⟨h, hh, hf⟩ := combinatorial_nullstellensatz_exists_linearCombination S (fun i ↦ by rw [← Finset.card_pos]; exact Nat.zero_lt_of_lt (htS i)) f Heval rw [hf] rw [linearCombination_apply, Finsupp.sum, coeff_sum] apply Finset.sum_eq_zero intro i _ set g := h i * Alon.P (S i) i with hg by_cases hi : h i = 0 · simp [hi] have : g.totalDegree ≤ f.totalDegree := by rw [hg, mul_comm] exact hh i rw [hg, ← degree_degLexDegree, degree_mul_of_isRegular_right hi (by simp only [(Alon.monic_P ..).leadingCoeff_eq_one, isRegular_one]), Alon.degree_P, degree_add, degree_degLexDegree, degree_single, ht'] at this rw [smul_eq_mul, coeff_mul, Finset.sum_eq_zero] rintro ⟨p, q⟩ hpq simp only [Finset.mem_antidiagonal] at hpq simp only [mul_eq_zero, Classical.or_iff_not_imp_right] rw [← ne_eq, ← mem_support_iff] intro hq obtain ⟨e, hq', hq⟩ := Alon.of_mem_P_support _ _ _ hq apply coeff_eq_zero_of_totalDegree_lt rw [← Finsupp.degree] apply lt_of_add_lt_add_right (lt_of_le_of_lt this _) rw [← hpq, degree_add, add_lt_add_iff_left, hq, degree_single] apply lt_of_le_of_lt _ (htS i) simp [← hpq, hq]
theorem
Combinatorics
[ "Mathlib.Algebra.MvPolynomial.Equiv", "Mathlib.Algebra.Polynomial.Degree.Definitions", "Mathlib.Data.Finsupp.MonomialOrder.DegLex", "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.MvPolynomial.Groebner", "Mathlib.RingTheory.MvPolynomial.Homogeneous", "Mathlib.RingTheory.MvPolynomial.MonomialOrder.D...
Mathlib/Combinatorics/Nullstellensatz.lean
combinatorial_nullstellensatz_exists_eval_nonzero
The **Combinatorial Nullstellensatz**. Given a multi-index `t : σ →₀ ℕ` such that `t s < (S s).card` for all `s`, `f.totalDegree = t.degree` and `f.coeff t ≠ 0`, there exists a point `x : σ → R` such that `x s ∈ S s` for all `s` and `f.eval s ≠ 0`. [Alon_1999], theorem 2
exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum (hf : ∀ a ∈ s, f a ∈ t) (hb : #t • b < ∑ x ∈ s, w x) : ∃ y ∈ t, b < ∑ x ∈ s with f x = y, w x := exists_lt_of_sum_lt <| by simpa only [sum_fiberwise_of_maps_to hf, sum_const]
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum
The pigeonhole principle for finitely many pigeons counted by weight, strict inequality version: if the total weight of a finite set of pigeons is greater than `n • b`, and they are sorted into `n` pigeonholes, then for some pigeonhole, the total weight of the pigeons in this pigeonhole is greater than `b`.
exists_sum_fiber_lt_of_maps_to_of_sum_lt_nsmul (hf : ∀ a ∈ s, f a ∈ t) (hb : ∑ x ∈ s, w x < #t • b) : ∃ y ∈ t, ∑ x ∈ s with f x = y, w x < b := exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum (M := Mᵒᵈ) hf hb
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_sum_fiber_lt_of_maps_to_of_sum_lt_nsmul
The pigeonhole principle for finitely many pigeons counted by weight, strict inequality version: if the total weight of a finite set of pigeons is less than `n • b`, and they are sorted into `n` pigeonholes, then for some pigeonhole, the total weight of the pigeons in this pigeonhole is less than `b`.
exists_lt_sum_fiber_of_sum_fiber_nonpos_of_nsmul_lt_sum (ht : ∀ y ∉ t, ∑ x ∈ s with f x = y, w x ≤ 0) (hb : #t • b < ∑ x ∈ s, w x) : ∃ y ∈ t, b < ∑ x ∈ s with f x = y, w x := exists_lt_of_sum_lt <| calc ∑ _y ∈ t, b < ∑ x ∈ s, w x := by simpa _ ≤ ∑ y ∈ t, ∑ x ∈ s with f x = y, w x := sum_le_sum_fiberwise_of_sum_fiber_nonpos ht
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_lt_sum_fiber_of_sum_fiber_nonpos_of_nsmul_lt_sum
The pigeonhole principle for finitely many pigeons counted by weight, strict inequality version: if the total weight of a finite set of pigeons is greater than `n • b`, they are sorted into some pigeonholes, and for all but `n` pigeonholes the total weight of the pigeons there is nonpositive, then for at least one of these `n` pigeonholes, the total weight of the pigeons in this pigeonhole is greater than `b`.
exists_sum_fiber_lt_of_sum_fiber_nonneg_of_sum_lt_nsmul (ht : ∀ y ∉ t, (0 : M) ≤ ∑ x ∈ s with f x = y, w x) (hb : ∑ x ∈ s, w x < #t • b) : ∃ y ∈ t, ∑ x ∈ s with f x = y, w x < b := exists_lt_sum_fiber_of_sum_fiber_nonpos_of_nsmul_lt_sum (M := Mᵒᵈ) ht hb /-!
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_sum_fiber_lt_of_sum_fiber_nonneg_of_sum_lt_nsmul
The pigeonhole principle for finitely many pigeons counted by weight, strict inequality version: if the total weight of a finite set of pigeons is less than `n • b`, they are sorted into some pigeonholes, and for all but `n` pigeonholes the total weight of the pigeons there is nonnegative, then for at least one of these `n` pigeonholes, the total weight of the pigeons in this pigeonhole is less than `b`.
exists_le_sum_fiber_of_maps_to_of_nsmul_le_sum (hf : ∀ a ∈ s, f a ∈ t) (ht : t.Nonempty) (hb : #t • b ≤ ∑ x ∈ s, w x) : ∃ y ∈ t, b ≤ ∑ x ∈ s with f x = y, w x := exists_le_of_sum_le ht <| by simpa only [sum_fiberwise_of_maps_to hf, sum_const]
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_le_sum_fiber_of_maps_to_of_nsmul_le_sum
The pigeonhole principle for finitely many pigeons counted by weight, non-strict inequality version: if the total weight of a finite set of pigeons is greater than or equal to `n • b`, and they are sorted into `n > 0` pigeonholes, then for some pigeonhole, the total weight of the pigeons in this pigeonhole is greater than or equal to `b`.
exists_sum_fiber_le_of_maps_to_of_sum_le_nsmul (hf : ∀ a ∈ s, f a ∈ t) (ht : t.Nonempty) (hb : ∑ x ∈ s, w x ≤ #t • b) : ∃ y ∈ t, ∑ x ∈ s with f x = y, w x ≤ b := exists_le_sum_fiber_of_maps_to_of_nsmul_le_sum (M := Mᵒᵈ) hf ht hb
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_sum_fiber_le_of_maps_to_of_sum_le_nsmul
The pigeonhole principle for finitely many pigeons counted by weight, non-strict inequality version: if the total weight of a finite set of pigeons is less than or equal to `n • b`, and they are sorted into `n > 0` pigeonholes, then for some pigeonhole, the total weight of the pigeons in this pigeonhole is less than or equal to `b`.
exists_le_sum_fiber_of_sum_fiber_nonpos_of_nsmul_le_sum (hf : ∀ y ∉ t, ∑ x ∈ s with f x = y, w x ≤ 0) (ht : t.Nonempty) (hb : #t • b ≤ ∑ x ∈ s, w x) : ∃ y ∈ t, b ≤ ∑ x ∈ s with f x = y, w x := exists_le_of_sum_le ht <| calc ∑ _y ∈ t, b ≤ ∑ x ∈ s, w x := by simpa _ ≤ ∑ y ∈ t, ∑ x ∈ s with f x = y, w x := sum_le_sum_fiberwise_of_sum_fiber_nonpos hf
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_le_sum_fiber_of_sum_fiber_nonpos_of_nsmul_le_sum
The pigeonhole principle for finitely many pigeons counted by weight, non-strict inequality version: if the total weight of a finite set of pigeons is greater than or equal to `n • b`, they are sorted into some pigeonholes, and for all but `n > 0` pigeonholes the total weight of the pigeons there is nonpositive, then for at least one of these `n` pigeonholes, the total weight of the pigeons in this pigeonhole is greater than or equal to `b`.
exists_sum_fiber_le_of_sum_fiber_nonneg_of_sum_le_nsmul (hf : ∀ y ∉ t, (0 : M) ≤ ∑ x ∈ s with f x = y, w x) (ht : t.Nonempty) (hb : ∑ x ∈ s, w x ≤ #t • b) : ∃ y ∈ t, ∑ x ∈ s with f x = y, w x ≤ b := exists_le_sum_fiber_of_sum_fiber_nonpos_of_nsmul_le_sum (M := Mᵒᵈ) hf ht hb
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_sum_fiber_le_of_sum_fiber_nonneg_of_sum_le_nsmul
The pigeonhole principle for finitely many pigeons counted by weight, non-strict inequality version: if the total weight of a finite set of pigeons is less than or equal to `n • b`, they are sorted into some pigeonholes, and for all but `n > 0` pigeonholes the total weight of the pigeons there is nonnegative, then for at least one of these `n` pigeonholes, the total weight of the pigeons in this pigeonhole is less than or equal to `b`.
exists_lt_card_fiber_of_nsmul_lt_card_of_maps_to (hf : ∀ a ∈ s, f a ∈ t) (ht : #t • b < #s) : ∃ y ∈ t, b < #{x ∈ s | f x = y} := by simp_rw [cast_card] at ht ⊢ exact exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum hf ht
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_lt_card_fiber_of_nsmul_lt_card_of_maps_to
The pigeonhole principle for finitely many pigeons counted by heads: there is a pigeonhole with at least as many pigeons as the ceiling of the average number of pigeons across all pigeonholes.
exists_lt_card_fiber_of_mul_lt_card_of_maps_to (hf : ∀ a ∈ s, f a ∈ t) (hn : #t * n < #s) : ∃ y ∈ t, n < #{x ∈ s | f x = y} := exists_lt_card_fiber_of_nsmul_lt_card_of_maps_to hf hn
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_lt_card_fiber_of_mul_lt_card_of_maps_to
The pigeonhole principle for finitely many pigeons counted by heads: there is a pigeonhole with at least as many pigeons as the ceiling of the average number of pigeons across all pigeonholes. ("The maximum is at least the mean" specialized to integers.) More formally, given a function between finite sets `s` and `t` and a natural number `n` such that `#t * n < #s`, there exists `y ∈ t` such that its preimage in `s` has more than `n` elements.
exists_card_fiber_lt_of_card_lt_nsmul (ht : #s < #t • b) : ∃ y ∈ t, #{x ∈ s | f x = y} < b := by simp_rw [cast_card] at ht ⊢ exact exists_sum_fiber_lt_of_sum_fiber_nonneg_of_sum_lt_nsmul (fun _ _ => sum_nonneg fun _ _ => zero_le_one) ht
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_card_fiber_lt_of_card_lt_nsmul
The pigeonhole principle for finitely many pigeons counted by heads: there is a pigeonhole with at most as many pigeons as the floor of the average number of pigeons across all pigeonholes.
exists_card_fiber_lt_of_card_lt_mul (hn : #s < #t * n) : ∃ y ∈ t, #{x ∈ s | f x = y} < n := exists_card_fiber_lt_of_card_lt_nsmul hn
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_card_fiber_lt_of_card_lt_mul
The pigeonhole principle for finitely many pigeons counted by heads: there is a pigeonhole with at most as many pigeons as the floor of the average number of pigeons across all pigeonholes. ("The minimum is at most the mean" specialized to integers.) More formally, given a function `f`, a finite sets `s` in its domain, a finite set `t` in its codomain, and a natural number `n` such that `#s < #t * n`, there exists `y ∈ t` such that its preimage in `s` has less than `n` elements.
exists_le_card_fiber_of_nsmul_le_card_of_maps_to (hf : ∀ a ∈ s, f a ∈ t) (ht : t.Nonempty) (hb : #t • b ≤ #s) : ∃ y ∈ t, b ≤ #{x ∈ s | f x = y} := by simp_rw [cast_card] at hb ⊢ exact exists_le_sum_fiber_of_maps_to_of_nsmul_le_sum hf ht hb
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_le_card_fiber_of_nsmul_le_card_of_maps_to
The pigeonhole principle for finitely many pigeons counted by heads: given a function between finite sets `s` and `t` and a number `b` such that `#t • b ≤ #s`, there exists `y ∈ t` such that its preimage in `s` has at least `b` elements. See also `Finset.exists_lt_card_fiber_of_nsmul_lt_card_of_maps_to` for a stronger statement.
exists_le_card_fiber_of_mul_le_card_of_maps_to (hf : ∀ a ∈ s, f a ∈ t) (ht : t.Nonempty) (hn : #t * n ≤ #s) : ∃ y ∈ t, n ≤ #{x ∈ s | f x = y} := exists_le_card_fiber_of_nsmul_le_card_of_maps_to hf ht hn
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_le_card_fiber_of_mul_le_card_of_maps_to
The pigeonhole principle for finitely many pigeons counted by heads: given a function between finite sets `s` and `t` and a natural number `b` such that `#t * n ≤ #s`, there exists `y ∈ t` such that its preimage in `s` has at least `n` elements. See also `Finset.exists_lt_card_fiber_of_mul_lt_card_of_maps_to` for a stronger statement.
exists_card_fiber_le_of_card_le_nsmul (ht : t.Nonempty) (hb : #s ≤ #t • b) : ∃ y ∈ t, #{x ∈ s | f x = y} ≤ b := by simp_rw [cast_card] at hb ⊢ refine exists_sum_fiber_le_of_sum_fiber_nonneg_of_sum_le_nsmul (fun _ _ => sum_nonneg fun _ _ => zero_le_one) ht hb
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_card_fiber_le_of_card_le_nsmul
The pigeonhole principle for finitely many pigeons counted by heads: given a function `f`, a finite sets `s` and `t`, and a number `b` such that `#s ≤ #t • b`, there exists `y ∈ t` such that its preimage in `s` has no more than `b` elements. See also `Finset.exists_card_fiber_lt_of_card_lt_nsmul` for a stronger statement.
exists_card_fiber_le_of_card_le_mul (ht : t.Nonempty) (hn : #s ≤ #t * n) : ∃ y ∈ t, #{x ∈ s | f x = y} ≤ n := exists_card_fiber_le_of_card_le_nsmul ht hn
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_card_fiber_le_of_card_le_mul
The pigeonhole principle for finitely many pigeons counted by heads: given a function `f`, a finite sets `s` in its domain, a finite set `t` in its codomain, and a natural number `n` such that `#s ≤ #t * n`, there exists `y ∈ t` such that its preimage in `s` has no more than `n` elements. See also `Finset.exists_card_fiber_lt_of_card_lt_mul` for a stronger statement.
exists_lt_sum_fiber_of_nsmul_lt_sum (hb : card β • b < ∑ x, w x) : ∃ y, b < ∑ x with f x = y, w x := let ⟨y, _, hy⟩ := exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum (fun _ _ => mem_univ _) hb ⟨y, hy⟩
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_lt_sum_fiber_of_nsmul_lt_sum
The pigeonhole principle for finitely many pigeons of different weights, strict inequality version: there is a pigeonhole with the total weight of pigeons in it greater than `b` provided that the total number of pigeonholes times `b` is less than the total weight of all pigeons.
exists_le_sum_fiber_of_nsmul_le_sum [Nonempty β] (hb : card β • b ≤ ∑ x, w x) : ∃ y, b ≤ ∑ x with f x = y, w x := let ⟨y, _, hy⟩ := exists_le_sum_fiber_of_maps_to_of_nsmul_le_sum (fun _ _ => mem_univ _) univ_nonempty hb ⟨y, hy⟩
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_le_sum_fiber_of_nsmul_le_sum
The pigeonhole principle for finitely many pigeons of different weights, non-strict inequality version: there is a pigeonhole with the total weight of pigeons in it greater than or equal to `b` provided that the total number of pigeonholes times `b` is less than or equal to the total weight of all pigeons.
exists_sum_fiber_lt_of_sum_lt_nsmul (hb : ∑ x, w x < card β • b) : ∃ y, ∑ x with f x = y, w x < b := exists_lt_sum_fiber_of_nsmul_lt_sum (M := Mᵒᵈ) _ hb
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_sum_fiber_lt_of_sum_lt_nsmul
The pigeonhole principle for finitely many pigeons of different weights, strict inequality version: there is a pigeonhole with the total weight of pigeons in it less than `b` provided that the total number of pigeonholes times `b` is greater than the total weight of all pigeons.
exists_sum_fiber_le_of_sum_le_nsmul [Nonempty β] (hb : ∑ x, w x ≤ card β • b) : ∃ y, ∑ x with f x = y, w x ≤ b := exists_le_sum_fiber_of_nsmul_le_sum (M := Mᵒᵈ) _ hb
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_sum_fiber_le_of_sum_le_nsmul
The pigeonhole principle for finitely many pigeons of different weights, non-strict inequality version: there is a pigeonhole with the total weight of pigeons in it less than or equal to `b` provided that the total number of pigeonholes times `b` is greater than or equal to the total weight of all pigeons.
exists_lt_card_fiber_of_nsmul_lt_card (hb : card β • b < card α) : ∃ y : β, b < #{x | f x = y} := let ⟨y, _, h⟩ := exists_lt_card_fiber_of_nsmul_lt_card_of_maps_to (fun _ _ => mem_univ _) hb ⟨y, h⟩
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_lt_card_fiber_of_nsmul_lt_card
The strong pigeonhole principle for finitely many pigeons and pigeonholes. There is a pigeonhole with at least as many pigeons as the ceiling of the average number of pigeons across all pigeonholes.
exists_lt_card_fiber_of_mul_lt_card (hn : card β * n < card α) : ∃ y : β, n < #{x | f x = y} := exists_lt_card_fiber_of_nsmul_lt_card _ hn
theorem
Combinatorics
[ "Mathlib.Algebra.Module.BigOperators", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Data.Nat.ModEq", "Mathlib.Order.Preorder.Finite" ]
Mathlib/Combinatorics/Pigeonhole.lean
exists_lt_card_fiber_of_mul_lt_card
The strong pigeonhole principle for finitely many pigeons and pigeonholes. There is a pigeonhole with at least as many pigeons as the ceiling of the average number of pigeons across all pigeonholes. ("The maximum is at least the mean" specialized to integers.) More formally, given a function `f` between finite types `α` and `β` and a number `n` such that `card β * n < card α`, there exists an element `y : β` such that its preimage has more than `n` elements.