Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Mathlib/Combinatorics/Nullstellensatz) : Alon's Combinatorial Nullstellensatz #16177

Open
wants to merge 104 commits into
base: master
Choose a base branch
from

Conversation

AntoineChambert-Loir
Copy link
Collaborator

@AntoineChambert-Loir AntoineChambert-Loir commented Aug 27, 2024

Prove Alon's Combinatorial Nullstellensatz

Meanwhile, prove several results

  • a multivariate polynomial that vanishes on a too large product set vanishes identically

Probably, this file should belong to the RingTheory.MvPolynomial hierarchy.

Question :

  • The names Alon1 and Alon2 of the functions are not to stay, but I need suggestions.

Open in Gitpod

Copy link

github-actions bot commented Aug 27, 2024

PR summary 4d882612be

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Data.Finsupp.MonomialOrder.DegLex (new file) 872
Mathlib.RingTheory.MvPolynomial.MonomialOrder (new file) 1102
Mathlib.RingTheory.MvPolynomial.Groebner (new file) 1103
Mathlib.RingTheory.MvPolynomial.MonomialOrder.DegLex (new file) 1105
Mathlib.Combinatorics.Nullstellensatz (new file) 1120

Declarations diff

+ Alon1
+ Alon2
+ DegLex.exists_iff
+ DegLex.forall_iff
+ DegLex.isStrictOrder
+ DegLex.le_iff
+ DegLex.linearOrder
+ DegLex.lt_def
+ DegLex.lt_iff
+ DegLex.monotone_degree
+ DegLex.orderBot
+ DegLex.partialOrder
+ DegLex.rec
+ DegLex.single_antitone
+ DegLex.single_le_iff
+ DegLex.single_lt_iff
+ DegLex.single_strictAnti
+ DegLex.wellFounded
+ DegLex.wellFoundedLT
+ Lex.single_antitone
+ Lex.single_le_iff
+ Lex.single_lt_iff
+ Lex.single_strictAnti
+ MonomialOrder.degLex
+ MonomialOrder.degLex_le_iff
+ MonomialOrder.degLex_lt_iff
+ MonomialOrder.degLex_single_le_iff
+ MonomialOrder.degLex_single_lt_iff
+ MonomialOrder.lex_unit_le_iff
+ MonomialOrder.lex_unit_lt_iff
+ _root_.MonomialOrder.degree_binomial
+ _root_.MonomialOrder.lCoeff_binomial
+ _root_.MonomialOrder.prod_degree
+ _root_.Polynomial.eq_zero_of_eval_zero
+ coeff_degree_eq_zero_iff
+ coeff_degree_ne_zero_iff
+ coeff_eq_zero_of_lt
+ coeff_mul_of_add_of_degree_le
+ coeff_mul_of_degree_add
+ coeff_prod_of_sum_degree
+ degLex_def
+ degLex_degree_degree
+ degLex_totalDegree_monotone
+ degree_C
+ degree_X
+ degree_X_le
+ degree_add
+ degree_add_le
+ degree_add_of_lt
+ degree_add_of_ne
+ degree_apply_single
+ degree_eq_zero_iff_totalDegree_eq_zero
+ degree_le_iff
+ degree_lt_iff
+ degree_monomial
+ degree_monomial_le
+ degree_mul
+ degree_mul_le
+ degree_mul_of_isRegular_left
+ degree_mul_of_isRegular_right
+ degree_mul_of_nonzero_mul
+ degree_neg
+ degree_of_not_nontrivial
+ degree_prod
+ degree_prod_le
+ degree_prod_of_regular
+ degree_reduce_lt
+ degree_single
+ degree_smul
+ degree_smul_le
+ degree_sub_LTerm_le
+ degree_sub_LTerm_lt
+ degree_sub_le
+ degree_sub_of_lt
+ div
+ div_set
+ eq_C_of_degree_eq_zero
+ eq_zero_of_eval_zero_at_prod
+ eq_zero_of_eval_zero_at_prod_nat
+ instance :
+ instance : OrderedCancelAddCommMonoid (DegLex (α →₀ ℕ))
+ instance [AddCommMonoid α] :
+ instance [LT α] : LT (DegLex (α →₀ ℕ))
+ lCoeff
+ lCoeff_add_of_lt
+ lCoeff_eq_zero_iff
+ lCoeff_is_unit_iff
+ lCoeff_monomial
+ lCoeff_mul
+ lCoeff_mul_of_isRegular_left
+ lCoeff_mul_of_isRegular_right
+ lCoeff_ne_zero_iff
+ lCoeff_of_not_nontrivial
+ lCoeff_prod_of_regular
+ lCoeff_sub_of_lt
+ lCoeff_zero
+ le_degree
+ ofDegLex
+ ofDegLex_add
+ ofDegLex_inj
+ ofDegLex_injective
+ ofDegLex_symm_eq
+ ofDegLex_toDegLex
+ reduce
+ subLTerm
+ sup_mem_of_nonempty
+ toDegLex
+ toDegLex_add
+ toDegLex_inj
+ toDegLex_injective
+ toDegLex_ofDegLex
+ toDegLex_symm_eq
+ weight_apply_single
+ weight_single_apply
+ weight_single_one_apply
+ weightedTotalDegree_rename_of_injective
++ DegLex
-++ degree
-++ degree_zero

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

lint-style

[lint-style] reported by reviewdog 🐶

theorem eq_zero_of_eval_zero_at_prod_nat {n : ℕ} [IsDomain R]


[lint-style] reported by reviewdog 🐶

(Hdeg : ∀ i, P.weightedTotalDegree (Finsupp.single i 1) < (S i).ncard)
(Heval : ∀ (x : Fin n → R), (∀ i, x i ∈ S i) → eval x P = 0) :
P = 0 := by
induction n generalizing R with
| zero =>
suffices P = C (constantCoeff P) by


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

have Heval' : ∀ (x : Fin n → R) (_ : ∀ i, x i ∈ S i.succ),
Polynomial.map (eval x) Q = 0 := fun x hx ↦ by


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

noncomputable example (s : R) : Polynomial R := Polynomial.X (R := R) - Polynomial.C s


[lint-style] reported by reviewdog 🐶

noncomputable example (S : Finset R) : Polynomial R :=


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

lemma prod_support_le {ι : Type*} (i : ι) (s : Finset R) (m : ι →₀ ℕ)
(hm : m ∈ (s.prod (fun r ↦ X i - C r)).support) :


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

have hf : f = f' + monomial d (f.coeff d) := by


[lint-style] reported by reviewdog 🐶

have hf' : f'.support = f.support.erase d := by


[lint-style] reported by reviewdog 🐶

obtain ⟨h', r', Hf', Hh', Hr'⟩ := hrec f' hf'D


[lint-style] reported by reviewdog 🐶

rw [← ne_eq, ← mem_support_iff]


[lint-style] reported by reviewdog 🐶

-- write `monomial d (f.coeff d) = `monomial d' (f.coeff d) * _ + f''`


[lint-style] reported by reviewdog 🐶

have hf'' : monomial d (f.coeff d)


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

simp only [Finset.mem_antidiagonal]


[lint-style] reported by reviewdog 🐶

obtain ⟨h'', r'', Hf'', Hh'', Hr''⟩ := hrec f'' hf''2


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

(f : MvPolynomial (Fin n) R) (Heval : ∀ (x : Fin n → R), (∀ i, x i ∈ S i) → eval x f = 0) :


[lint-style] reported by reviewdog 🐶

apply eq_zero_of_eval_zero_at_prod_nat r (fun i ↦ S i)


[lint-style] reported by reviewdog 🐶

theorem Alon2 {n : ℕ} [IsDomain R]
(f : MvPolynomial (Fin n) R)
(t : Fin n →₀ ℕ) (ht : f.coeff t ≠ 0) (ht' : f.totalDegree = t.degree)
(S : Fin n → Finset R) (htS : ∀ i, t i < (S i).card) :
∃ (s : Fin n → R) (_ : ∀ i, s i ∈ S i), eval s f ≠ 0 := by


[lint-style] reported by reviewdog 🐶

obtain ⟨h, hh, hf⟩ := Alon1 S
(fun i ↦ by rw [← Finset.card_pos]; exact lt_of_le_of_lt (zero_le _) (htS i))

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

lint-style

[lint-style] reported by reviewdog 🐶

theorem eq_zero_of_eval_zero_at_prod_nat {n : ℕ} [IsDomain R]


[lint-style] reported by reviewdog 🐶

(Hdeg : ∀ i, P.weightedTotalDegree (Finsupp.single i 1) < (S i).ncard)
(Heval : ∀ (x : Fin n → R), (∀ i, x i ∈ S i) → eval x P = 0) :
P = 0 := by
induction n generalizing R with
| zero =>
suffices P = C (constantCoeff P) by


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

have Heval' : ∀ (x : Fin n → R) (_ : ∀ i, x i ∈ S i.succ),
Polynomial.map (eval x) Q = 0 := fun x hx ↦ by


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

noncomputable example (s : R) : Polynomial R := Polynomial.X (R := R) - Polynomial.C s


[lint-style] reported by reviewdog 🐶

noncomputable example (S : Finset R) : Polynomial R :=


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

lemma prod_support_le {ι : Type*} (i : ι) (s : Finset R) (m : ι →₀ ℕ)
(hm : m ∈ (s.prod (fun r ↦ X i - C r)).support) :


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

have hf : f = f' + monomial d (f.coeff d) := by


[lint-style] reported by reviewdog 🐶

have hf' : f'.support = f.support.erase d := by


[lint-style] reported by reviewdog 🐶

obtain ⟨h', r', Hf', Hh', Hr'⟩ := hrec f' hf'D


[lint-style] reported by reviewdog 🐶

rw [← ne_eq, ← mem_support_iff]


[lint-style] reported by reviewdog 🐶

-- write `monomial d (f.coeff d) = `monomial d' (f.coeff d) * _ + f''`


[lint-style] reported by reviewdog 🐶

have hf'' : monomial d (f.coeff d)


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

simp only [Finset.mem_antidiagonal]


[lint-style] reported by reviewdog 🐶

obtain ⟨h'', r'', Hf'', Hh'', Hr''⟩ := hrec f'' hf''2


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

(f : MvPolynomial (Fin n) R) (Heval : ∀ (x : Fin n → R), (∀ i, x i ∈ S i) → eval x f = 0) :


[lint-style] reported by reviewdog 🐶

apply eq_zero_of_eval_zero_at_prod_nat r (fun i ↦ S i)


[lint-style] reported by reviewdog 🐶

theorem Alon2 {n : ℕ} [IsDomain R]
(f : MvPolynomial (Fin n) R)
(t : Fin n →₀ ℕ) (ht : f.coeff t ≠ 0) (ht' : f.totalDegree = t.degree)
(S : Fin n → Finset R) (htS : ∀ i, t i < (S i).card) :
∃ (s : Fin n → R) (_ : ∀ i, s i ∈ S i), eval s f ≠ 0 := by


[lint-style] reported by reviewdog 🐶

obtain ⟨h, hh, hf⟩ := Alon1 S
(fun i ↦ by rw [← Finset.card_pos]; exact lt_of_le_of_lt (zero_le _) (htS i))

@grunweg grunweg changed the title Feat(Mathlib/Combinatorics/Nullstellensatz) : Alon's Combinatorial Nullstellensatz feat(Mathlib/Combinatorics/Nullstellensatz) : Alon's Combinatorial Nullstellensatz Aug 27, 2024
@grunweg grunweg added the t-combinatorics Combinatorics label Aug 27, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

lint-style

[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

/- theorem euclDivd {n : ℕ} (S : Fin n → Finset R) (Sne : ∀ i, (S i).Nonempty)


[lint-style] reported by reviewdog 🐶

have hf : f = f' + monomial d (f.coeff d) := by


[lint-style] reported by reviewdog 🐶

have hf' : f'.support = f.support.erase d := by


[lint-style] reported by reviewdog 🐶

obtain ⟨h', r', Hf', Hh', Hr'⟩ := hrec f' hf'D


[lint-style] reported by reviewdog 🐶

rw [← ne_eq, ← mem_support_iff]


[lint-style] reported by reviewdog 🐶

-- write `monomial d (f.coeff d) = `monomial d' (f.coeff d) * _ + f''`


[lint-style] reported by reviewdog 🐶

have hf'' : monomial d (f.coeff d)


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

simp only [Finset.mem_antidiagonal]


[lint-style] reported by reviewdog 🐶

obtain ⟨h'', r'', Hf'', Hh'', Hr''⟩ := hrec f'' hf''2


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶


[lint-style] reported by reviewdog 🐶

(f : MvPolynomial σ R) (Heval : ∀ (x : σ → R), (∀ i, x i ∈ S i) → eval x f = 0) :


[lint-style] reported by reviewdog 🐶

apply eq_zero_of_eval_zero_at_prod r (fun i ↦ S i)


[lint-style] reported by reviewdog 🐶

theorem Alon2 [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).card) :
∃ (s : σ → R) (_ : ∀ i, s i ∈ S i), eval s f ≠ 0 := by


[lint-style] reported by reviewdog 🐶

obtain ⟨h, hh, hf⟩ := Alon1 S
(fun i ↦ by rw [← Finset.card_pos]; exact lt_of_le_of_lt (zero_le _) (htS i))

@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 25, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 25, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 25, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Dec 4, 2024
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR to Mathlib (this label is automatically managed by a bot) label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-algebra Algebra (groups, rings, fields, etc) t-combinatorics Combinatorics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants