@@ -5,6 +5,7 @@ Authors: Oliver Nash
55-/
66import Mathlib.Data.Nat.Choose.Sum
77import Mathlib.Algebra.Algebra.Bilinear
8+ import Mathlib.GroupTheory.Submonoid.ZeroDivisors
89import Mathlib.RingTheory.Ideal.Operations
910import Mathlib.Algebra.GeomSum
1011
@@ -43,7 +44,7 @@ theorem IsNilpotent.mk [Zero R] [Pow R ℕ] (x : R) (n : ℕ) (e : x ^ n = 0) :
4344 ⟨n, e⟩
4445#align is_nilpotent.mk IsNilpotent.mk
4546
46- theorem IsNilpotent.zero [MonoidWithZero R] : IsNilpotent (0 : R) :=
47+ @[simp] theorem IsNilpotent.zero [MonoidWithZero R] : IsNilpotent (0 : R) :=
4748 ⟨1 , pow_one 0 ⟩
4849#align is_nilpotent.zero IsNilpotent.zero
4950
@@ -172,17 +173,43 @@ theorem isNilpotent_add (hx : IsNilpotent x) (hy : IsNilpotent y) : IsNilpotent
172173 · rw [pow_eq_zero_of_le hj hm, MulZeroClass.mul_zero]
173174#align commute.is_nilpotent_add Commute.isNilpotent_add
174175
176+ protected lemma isNilpotent_sum {ι : Type _} {s : Finset ι} {f : ι → R}
177+ (hnp : ∀ i ∈ s, IsNilpotent (f i)) (h_comm : ∀ i j, i ∈ s → j ∈ s → Commute (f i) (f j)) :
178+ IsNilpotent (∑ i in s, f i) := by
179+ classical
180+ induction' s using Finset.induction with j s hj ih; simp
181+ rw [Finset.sum_insert hj]
182+ apply Commute.isNilpotent_add
183+ · exact Commute.sum_right _ _ _ (fun i hi ↦ h_comm _ _ (by simp) (by simp [hi]))
184+ · apply hnp; simp
185+ · exact ih (fun i hi ↦ hnp i (by simp [hi]))
186+ (fun i j hi hj ↦ h_comm i j (by simp [hi]) (by simp [hj]))
187+
175188theorem isNilpotent_mul_left (h : IsNilpotent x) : IsNilpotent (x * y) := by
176189 obtain ⟨n, hn⟩ := h
177190 use n
178191 rw [h_comm.mul_pow, hn, MulZeroClass.zero_mul]
179192#align commute.is_nilpotent_mul_left Commute.isNilpotent_mul_left
180193
194+ protected lemma isNilpotent_mul_left_iff (hy : y ∈ nonZeroDivisorsLeft R) :
195+ IsNilpotent (x * y) ↔ IsNilpotent x := by
196+ refine' ⟨_, h_comm.isNilpotent_mul_left⟩
197+ rintro ⟨k, hk⟩
198+ rw [mul_pow h_comm] at hk
199+ exact ⟨k, (nonZeroDivisorsLeft R).pow_mem hy k _ hk⟩
200+
181201theorem isNilpotent_mul_right (h : IsNilpotent y) : IsNilpotent (x * y) := by
182202 rw [h_comm.eq]
183203 exact h_comm.symm.isNilpotent_mul_left h
184204#align commute.is_nilpotent_mul_right Commute.isNilpotent_mul_right
185205
206+ protected lemma isNilpotent_mul_right_iff (hx : x ∈ nonZeroDivisorsRight R) :
207+ IsNilpotent (x * y) ↔ IsNilpotent y := by
208+ refine' ⟨_, h_comm.isNilpotent_mul_right⟩
209+ rintro ⟨k, hk⟩
210+ rw [mul_pow h_comm] at hk
211+ exact ⟨k, (nonZeroDivisorsRight R).pow_mem hx k _ hk⟩
212+
186213end Semiring
187214
188215section Ring
@@ -202,7 +229,12 @@ end Commute
202229
203230section CommSemiring
204231
205- variable [CommSemiring R]
232+ variable [CommSemiring R] {x y : R}
233+
234+ lemma isNilpotent_sum {ι : Type _} {s : Finset ι} {f : ι → R}
235+ (hnp : ∀ i ∈ s, IsNilpotent (f i)) :
236+ IsNilpotent (∑ i in s, f i) :=
237+ Commute.isNilpotent_sum hnp fun _ _ _ _ ↦ Commute.all _ _
206238
207239/-- The nilradical of a commutative semiring is the ideal of nilpotent elements. -/
208240def nilradical (R : Type _) [CommSemiring R] : Ideal R :=
0 commit comments