Skip to content

Commit 5198248

Browse files
committed
feat(Algebra/MvPolynomial/Variables): add some lemmas about vars (#37791)
These lemmas are used in #36103
1 parent 49f1034 commit 5198248

4 files changed

Lines changed: 29 additions & 11 deletions

File tree

Mathlib/Algebra/MvPolynomial/Monad.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ theorem vars_bind₁ [DecidableEq τ] (f : σ → MvPolynomial τ R) (φ : MvPol
319319
· intro j
320320
simp_rw [Finset.mem_biUnion]
321321
rintro ⟨d, hd, ⟨i, hi, hj⟩⟩
322-
exact ⟨i, (mem_vars _).mpr ⟨d, hd, hi⟩, hj⟩
322+
exact ⟨i, (mem_vars_iff_mem_support _).mpr ⟨d, hd, hi⟩, hj⟩
323323

324324
end
325325

Mathlib/Algebra/MvPolynomial/Variables.lean

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,30 @@ theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by
9090
theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by
9191
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)]
9292

93-
theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by
93+
theorem mem_vars_iff_mem_support (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by
9494
classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff]
9595

96+
@[deprecated (since := "2026-04-24")] alias mem_vars := mem_vars_iff_mem_support
97+
98+
theorem mem_vars_iff_degreeOf_ne_zero {i : σ} : i ∈ p.vars ↔ p.degreeOf i ≠ 0 := by
99+
classical simp [degreeOf, vars_def]
100+
96101
theorem mem_support_notMem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support)
97102
{v : σ} (h : v ∉ vars f) : x v = 0 := by
98103
contrapose! h
99-
exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩
104+
exact (mem_vars_iff_mem_support v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩
105+
106+
theorem support_subset_vars_of_mem_support {s : σ →₀ ℕ} (h : s ∈ p.support) :
107+
s.support ⊆ p.vars := fun i hi ↦ by
108+
contrapose! hi
109+
simp [mem_support_notMem_vars_zero h hi]
110+
111+
theorem vars_eq_empty_iff_eq_C : p.vars = ∅ ↔ p = C (p.coeff 0) := by
112+
refine ⟨fun h ↦ ?_, fun h ↦ by rw [h]; simp⟩
113+
rw [← totalDegree_eq_zero_iff_eq_C]
114+
suffices p.degrees.card = 0 by grind [totalDegree_le_degrees_card p]
115+
classical rw [vars_def, Multiset.toFinset_eq_empty] at h
116+
simp_all
100117

101118
theorem vars_add_subset [DecidableEq σ] (p q : MvPolynomial σ R) :
102119
(p + q).vars ⊆ p.vars ∪ q.vars := by
@@ -149,7 +166,7 @@ variable {A : Type*} [CommRing A] [NoZeroDivisors A]
149166
theorem vars_C_mul (a : A) (ha : a ≠ 0) (φ : MvPolynomial σ A) :
150167
(C a * φ : MvPolynomial σ A).vars = φ.vars := by
151168
ext1 i
152-
simp only [mem_vars, mem_support_iff]
169+
simp only [mem_vars_iff_mem_support, mem_support_iff]
153170
apply exists_congr
154171
intro d
155172
rw [coeff_C_mul, mul_ne_zero_iff, eq_true ha, true_and]
@@ -206,7 +223,7 @@ theorem vars_monomial_single (i : σ) {e : ℕ} {r : R} (he : e ≠ 0) (hr : r
206223
theorem vars_eq_support_biUnion_support [DecidableEq σ] :
207224
p.vars = p.support.biUnion Finsupp.support := by
208225
ext i
209-
rw [mem_vars, Finset.mem_biUnion]
226+
rw [mem_vars_iff_mem_support, Finset.mem_biUnion]
210227

211228
end Map
212229

@@ -244,7 +261,7 @@ theorem eval₂Hom_eq_constantCoeff_of_vars (f : R →+* S) {g : σ → S} {p :
244261
contradiction
245262
rw [Finsupp.prod, Finset.prod_eq_zero hi, mul_zero]
246263
rw [hp, zero_pow (Finsupp.mem_support_iff.1 hi)]
247-
rw [mem_vars]
264+
rw [mem_vars_iff_mem_support]
248265
exact ⟨d, hd, hi⟩
249266

250267
theorem aeval_eq_constantCoeff_of_vars [Algebra R S] {g : σ → S} {p : MvPolynomial σ R}
@@ -265,7 +282,7 @@ theorem eval₂Hom_congr' {f₁ f₂ : R →+* S} {g₁ g₂ : σ → S} {p₁ p
265282
apply Finset.prod_congr rfl
266283
intro i hi
267284
have : i ∈ p₁.vars := by
268-
rw [mem_vars]
285+
rw [mem_vars_iff_mem_support]
269286
exact ⟨d, hd, hi⟩
270287
rw [h i this this]
271288

@@ -312,7 +329,7 @@ lemma aeval_ite_mem_eq_self (q : MvPolynomial σ R) {s : Set σ} (hs : (q.vars :
312329
refine Finset.sum_congr rfl fun u hu ↦ ?_
313330
rw [MvPolynomial.aeval_monomial, MvPolynomial.monomial_eq]
314331
congr 1
315-
exact Finsupp.prod_congr (fun i hi ↦ by simp [hs ((MvPolynomial.mem_vars _).mpr ⟨u, hu, hi⟩)])
332+
exact Finsupp.prod_congr (fun i hi ↦ by simp [hs ((mem_vars_iff_mem_support _).mpr ⟨u, hu, hi⟩)])
316333

317334
end EvalVars
318335

Mathlib/FieldTheory/SeparablyGenerated.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ theorem coeff_toPolynomialAdjoinImageCompl_ne_zero
126126
theorem isAlgebraic_of_mem_vars_of_forall_totalDegree_le (hFa : F.aeval a = 0) (i : ι)
127127
(hi : i ∈ F.vars) : IsAlgebraic (Algebra.adjoin k (a '' {i}ᶜ)) (a i) := by
128128
classical
129-
have ⟨σ, hσ, hσi⟩ := (mem_vars i).mp hi
129+
have ⟨σ, hσ, hσi⟩ := (mem_vars_iff_mem_support i).mp hi
130130
refine ⟨toPolynomialAdjoinImageCompl F a i,
131131
fun h ↦ coeff_toPolynomialAdjoinImageCompl_ne_zero HF σ hσ i
132132
(Finsupp.mem_support_iff.mp hσi) ?_, aeval_toPolynomialAdjoinImageCompl_eq_zero hFa ..⟩
@@ -212,7 +212,7 @@ lemma exists_isTranscendenceBasis_and_isSeparable_of_linearIndepOn_pow
212212
obtain ⟨i, σ, hσ, hi⟩ := exists_mem_support_not_dvd_of_forall_totalDegree_le p hp H hFmin hF₀ hFa
213213
have hσi : σ i ≠ 0 := by aesop
214214
have alg := isAlgebraic_of_mem_vars_of_forall_totalDegree_le hFmin hFa i <|
215-
(mem_vars i).mpr ⟨σ, hσ, by simpa⟩
215+
(mem_vars_iff_mem_support i).mpr ⟨σ, hσ, by simpa⟩
216216
have Hi := ha'.of_isAlgebraic_adjoin_image_compl _ i _ alg
217217
refine ⟨i, Hi, ?_⟩
218218
let k' := adjoin k (a '' {i}ᶜ)

Mathlib/RingTheory/MvPolynomial/IrreducibleQuadratic.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ lemma irreducible_of_disjoint_support [IsDomain R]
108108
apply irreducible_mul_X_add
109109
· grind only [monomial_eq_zero]
110110
· simp [φ, hfd, d₀, hdi]
111-
· suffices ∀ x, d ≠ x → x ∈ f.support → i ∉ x.support by simpa [mem_vars, hdψ] using this
111+
· suffices ∀ x, d ≠ x → x ∈ f.support → i ∉ x.support by
112+
simpa [mem_vars_iff_mem_support, hdψ] using this
112113
exact fun x hxd hx hix ↦
113114
Finset.disjoint_iff_ne.mp (disjoint hd hx hxd) i (by simp [hdi]) _ hix rfl
114115
· rintro p hpφ ⟨q, hq⟩

0 commit comments

Comments
 (0)