Zulip Chat Archive
Stream: Is there code for X?
Topic: A ring is reduced if 0 has no nonzero square roots
Artie Khovanov (Jan 16 2026 at 04:02):
Pretty basic lemma, can't find it anywhere, am I duplicating a well-hidden argument?
Artie Khovanov (Jan 16 2026 at 04:24):
theorem IsReduced.of_sq_eq_zero_imp_eq_zero {R : Type*} [Semiring R]
(h : ∀ a : R, a ^ 2 = 0 → a = 0) : IsReduced R where
eq_zero x nx := by
have ind : ∀ {k}, x ^ (2 ^ k) = 0 → x = 0 := fun {k} hk ↦ by
induction k with
| zero => simp_all
| succ k ih =>
rw [Nat.pow_succ', mul_comm, pow_mul] at hk
exact ih (h _ hk)
rcases nx with ⟨n, hx⟩
exact ind <| pow_eq_zero_of_le Nat.lt_two_pow_self.le hx
Violeta Hernández (Jan 16 2026 at 04:37):
Violeta Hernández (Jan 16 2026 at 06:12):
Surely 2 in this argument generalizes to any natural n > 1?
Violeta Hernández (Jan 16 2026 at 06:14):
Also, this seems like a version of docs#isReduced_of_noZeroDivisors with weaker hypotheses, so I think you should add it and reprove the noZeroDivisors version using it.
Artie Khovanov (Jan 16 2026 at 06:16):
Do you mean 2 in the statement or in the proof? In the proof yes, and you can use strong induction on as well. In the statement no, it becomes false right? Let me think of an example.
Violeta Hernández (Jan 16 2026 at 06:19):
import Mathlib.Algebra.GroupWithZero.Basic
import Mathlib.Algebra.Ring.Nat
import Mathlib.Order.Basic
theorem IsReduced.of_sq_eq_zero_imp_eq_zero {R : Type*} [Semiring R]
{n : ℕ} (hn : 1 < n) (h : ∀ a : R, a ^ n = 0 → a = 0) : IsReduced R where
eq_zero x nx := by
have ind : ∀ {k}, x ^ (n ^ k) = 0 → x = 0 := fun {k} hk ↦ by
induction k with
| zero => simp_all
| succ k ih =>
rw [Nat.pow_succ', mul_comm, pow_mul] at hk
exact ih (h _ hk)
rcases nx with ⟨n, hx⟩
exact ind <| pow_eq_zero_of_le (Nat.lt_pow_self hn).le hx
Artie Khovanov (Jan 16 2026 at 06:19):
Oh lol fair thx
Artie Khovanov (Jan 16 2026 at 06:20):
I shouldn't think about maths at stupid o clock
Jakub Nowak (Jan 16 2026 at 06:56):
Technically it's not generalized because it's implied by the version with 2:
import Mathlib
theorem IsReduced.of_sq_eq_zero_imp_eq_zero {R : Type*} [Semiring R]
(h : ∀ a : R, a ^ 2 = 0 → a = 0) : IsReduced R where
eq_zero x nx := by
have ind : ∀ {k}, x ^ (2 ^ k) = 0 → x = 0 := fun {k} hk ↦ by
induction k with
| zero => simp_all
| succ k ih =>
rw [Nat.pow_succ', mul_comm, pow_mul] at hk
exact ih (h _ hk)
rcases nx with ⟨n, hx⟩
exact ind <| pow_eq_zero_of_le Nat.lt_two_pow_self.le hx
theorem IsReduced.of_pow_eq_zero_imp_eq_zero {R : Type*} [Semiring R]
(h : ∀ a : R, ∃ n > 1, a ^ n = 0 → a = 0) : IsReduced R :=
.of_sq_eq_zero_imp_eq_zero fun a h2 ↦ by
choose n hn h using h a
apply h
exact pow_eq_zero_of_le hn h2
theorem IsReduced.of_pow_n_eq_zero_imp_eq_zero {R : Type*} [Semiring R]
{n : ℕ} (hn : 1 < n) (h : ∀ a : R, a ^ n = 0 → a = 0) : IsReduced R :=
.of_pow_eq_zero_imp_eq_zero fun a ↦ ⟨n, ⟨hn, h a⟩⟩
Basically, a^2 = 0 is the strongest, because it just implies a^n = 0 for any n > 1.
Violeta Hernández (Jan 16 2026 at 09:28):
Sure, but changing 2 to n is such a trivial change that we might as well do it anyways.
Jakub Nowak (Jan 16 2026 at 10:10):
I'm not sure if it is any useful though.
Riccardo Brasca (Jan 16 2026 at 10:33):
I am not sure, but note that having r ^ 2 = 0 is not enough for grind to conclude that r ^ 3 = 0, so maybe we want the general version.
Jakub Nowak (Jan 16 2026 at 10:49):
Should we add docs#pow_eq_zero_of_le to grind?
Riccardo Brasca (Jan 16 2026 at 11:02):
I don't know, I am not familiar enough with grind annotations.
Artie Khovanov (Jan 16 2026 at 12:57):
Violeta Hernández said:
this seems like a version of docs#isReduced_of_noZeroDivisors with weaker hypotheses
I don't understand. The ring Z[X]/(XY) is reduced and therefore satisfies the hypothesis for all n>1, but X is a zero divisor.
Junyan Xu (Jan 16 2026 at 14:00):
isReduced_iff_pow_one_lt is already there (assuming MonoidWithZero is enough)
(turns out it was added by me in mathlib3#17002)
Artie Khovanov (Jan 16 2026 at 16:14):
Junyan Xu said:
isReduced_iff_pow_one_lt is already there (assuming MonoidWithZero is enough)
(turns out it was added by me in mathlib3#17002)
Nice, thanks! Honestly don't know how I thought it didn't generalise. Think I had a sign wrong in my head.
Artie Khovanov (Jan 16 2026 at 16:20):
Following the proof back, the general induction principle is docs#Nat.pow_imp_self_of_one_lt
Artie Khovanov (Jan 16 2026 at 16:20):
Mathlib is cool!
Jakub Nowak (Jan 16 2026 at 18:04):
Do you think this would be useful to add to mathlib? It lets you "come up" with n after you get element a:
theorem IsReduced.of_pow_eq_zero_imp_eq_zero [Monoid R]
(h : ∀ a : R, ∃ n > 1, a ^ n = 0 → a = 0) : IsReduced R
Artie Khovanov (Jan 16 2026 at 18:17):
This is just a logically vacuous restatement of the definition, right?
Jakub Nowak (Jan 16 2026 at 18:39):
I don't think so. You're thinking about ∀ a : R, (∃ n > 1, a ^ n = 0) → a = 0. It's not the same as ∀ a : R, ∃ n > 1, a ^ n = 0 → a = 0, which is parsed as ∀ a : R, ∃ n > 1, (a ^ n = 0 → a = 0).
Jakub Nowak (Jan 16 2026 at 18:46):
This is kinda a stronger version of {n : ℕ} (hn : 1 < n) (h : ∀ a : R, a ^ n = 0 → a = 0). In the latter you have to pick n and then prove a ^ n = 0 → a = 0 for every a.
With ∀ a : R, ∃ n > 1, a ^ n = 0 → a = 0, for every a you pick n and then prove a ^ n = 0 → a = 0. You can pick a different n for different as.
Jakub Nowak (Jan 16 2026 at 18:47):
From API perspective this is just a shorthand combination of IsReduced.of_sq_eq_zero_imp_eq_zero and pow_eq_zero_of_le.
Artie Khovanov (Jan 16 2026 at 18:53):
Oh yep, you're right - this is better, we should add it
Jakub Nowak (Jan 16 2026 at 19:04):
I'm not so sure about adding it tbh. This lemma is just combination of two different lemmas and it looks hard to find with loogle or existing interactive tactics I'm aware of.
Last updated: Feb 28 2026 at 14:05 UTC