Skip to content

Commit 4f17c83

Browse files
committed
chore(OreLocalization): generalize some results from rings to monoids with zeros (#27174)
1 parent 31fb1c4 commit 4f17c83

File tree

4 files changed

+112
-73
lines changed

4 files changed

+112
-73
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5577,6 +5577,7 @@ import Mathlib.RingTheory.Nullstellensatz
55775577
import Mathlib.RingTheory.OrderOfVanishing
55785578
import Mathlib.RingTheory.OreLocalization.Basic
55795579
import Mathlib.RingTheory.OreLocalization.Cardinality
5580+
import Mathlib.RingTheory.OreLocalization.NonZeroDivisors
55805581
import Mathlib.RingTheory.OreLocalization.OreSet
55815582
import Mathlib.RingTheory.OreLocalization.Ring
55825583
import Mathlib.RingTheory.OrzechProperty

Mathlib/RingTheory/OreLocalization/Basic.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ instance : MonoidWithZero R[S⁻¹] where
4747
induction' x using OreLocalization.ind with r s
4848
rw [OreLocalization.zero_def, mul_div_one, mul_zero, zero_oreDiv', zero_oreDiv']
4949

50+
theorem subsingleton_iff :
51+
Subsingleton R[S⁻¹] ↔ 0 ∈ S := by
52+
rw [← subsingleton_iff_zero_eq_one, OreLocalization.one_def,
53+
OreLocalization.zero_def, oreDiv_eq_iff]
54+
simp
55+
56+
theorem nontrivial_iff :
57+
Nontrivial R[S⁻¹] ↔ 0 ∉ S := by
58+
rw [← not_subsingleton_iff_nontrivial, subsingleton_iff]
59+
5060
end MonoidWithZero
5161

5262
section CommMonoidWithZero
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/-
2+
Copyright (c) 2025 Anatole Dedecker. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Jakob von Raumer, Kevin Klinge, Andrew Yang
5+
-/
6+
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
7+
import Mathlib.RingTheory.OreLocalization.Basic
8+
9+
/-!
10+
# Ore Localization over nonZeroDivisors in monoids with zeros.
11+
-/
12+
13+
open scoped nonZeroDivisors
14+
15+
namespace OreLocalization
16+
17+
section MonoidWithZero
18+
19+
variable {R : Type*} [MonoidWithZero R] {S : Submonoid R} [OreSet S]
20+
21+
theorem nontrivial_of_nonZeroDivisorsLeft [Nontrivial R] (hS : S ≤ nonZeroDivisorsLeft R) :
22+
Nontrivial R[S⁻¹] :=
23+
nontrivial_iff.mpr (fun e ↦ one_ne_zero <| hS e 1 (zero_mul _))
24+
25+
theorem nontrivial_of_nonZeroDivisorsRight [Nontrivial R] (hS : S ≤ nonZeroDivisorsRight R) :
26+
Nontrivial R[S⁻¹] :=
27+
nontrivial_iff.mpr (fun e ↦ one_ne_zero <| hS e 1 (mul_zero _))
28+
29+
theorem nontrivial_of_nonZeroDivisors [Nontrivial R] (hS : S ≤ R⁰) :
30+
Nontrivial R[S⁻¹] :=
31+
nontrivial_of_nonZeroDivisorsLeft (hS.trans inf_le_left)
32+
33+
variable [Nontrivial R] [OreSet R⁰]
34+
35+
instance nontrivial : Nontrivial R[R⁰⁻¹] :=
36+
nontrivial_of_nonZeroDivisors (refl R⁰)
37+
38+
variable [NoZeroDivisors R]
39+
40+
open Classical in
41+
/-- The inversion of Ore fractions for a ring without zero divisors, satisfying `0⁻¹ = 0` and
42+
`(r /ₒ r')⁻¹ = r' /ₒ r` for `r ≠ 0`. -/
43+
@[irreducible]
44+
protected noncomputable def inv : R[R⁰⁻¹] → R[R⁰⁻¹] :=
45+
liftExpand
46+
(fun r s =>
47+
if hr : r = (0 : R) then (0 : R[R⁰⁻¹])
48+
else s /ₒ ⟨r, mem_nonZeroDivisors_of_ne_zero hr⟩)
49+
(by
50+
intro r t s hst
51+
by_cases hr : r = 0
52+
· simp [hr]
53+
· by_cases ht : t = 0
54+
· exfalso
55+
apply nonZeroDivisors.coe_ne_zero ⟨_, hst⟩
56+
simp [ht]
57+
· simp only [hr, ht, dif_neg, not_false_iff, or_self_iff, mul_eq_zero, smul_eq_mul]
58+
apply OreLocalization.expand)
59+
60+
noncomputable instance inv' : Inv R[R⁰⁻¹] :=
61+
⟨OreLocalization.inv⟩
62+
63+
open Classical in
64+
protected theorem inv_def {r : R} {s : R⁰} :
65+
(r /ₒ s)⁻¹ =
66+
if hr : r = (0 : R) then (0 : R[R⁰⁻¹])
67+
else s /ₒ ⟨r, mem_nonZeroDivisors_of_ne_zero hr⟩ := by
68+
with_unfolding_all rfl
69+
70+
protected theorem mul_inv_cancel (x : R[R⁰⁻¹]) (h : x ≠ 0) : x * x⁻¹ = 1 := by
71+
induction' x with r s
72+
rw [OreLocalization.inv_def, OreLocalization.one_def]
73+
have hr : r ≠ 0 := by
74+
rintro rfl
75+
simp at h
76+
simp only [hr]
77+
with_unfolding_all apply OreLocalization.mul_inv ⟨r, _⟩
78+
79+
protected theorem inv_zero : (0 : R[R⁰⁻¹])⁻¹ = 0 := by
80+
rw [OreLocalization.zero_def, OreLocalization.inv_def]
81+
simp
82+
83+
noncomputable instance : GroupWithZero R[R⁰⁻¹] where
84+
inv_zero := OreLocalization.inv_zero
85+
mul_inv_cancel := OreLocalization.mul_inv_cancel
86+
87+
end MonoidWithZero
88+
89+
section CommMonoidWithZero
90+
91+
variable {R : Type*} [CommMonoidWithZero R] [Nontrivial R] [OreSet R⁰] [NoZeroDivisors R]
92+
93+
noncomputable instance : CommGroupWithZero R[R⁰⁻¹] where
94+
95+
end CommMonoidWithZero
96+
97+
end OreLocalization

Mathlib/RingTheory/OreLocalization/Ring.lean

Lines changed: 4 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ Authors: Jakob von Raumer, Kevin Klinge, Andrew Yang
66

77
import Mathlib.Algebra.Algebra.Defs
88
import Mathlib.Algebra.Field.Defs
9-
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
109
import Mathlib.Algebra.Module.End
11-
import Mathlib.RingTheory.OreLocalization.Basic
10+
import Mathlib.RingTheory.OreLocalization.NonZeroDivisors
1211

1312
/-!
1413
@@ -70,9 +69,11 @@ variable {R : Type*} [Semiring R] {S : Submonoid R} [OreSet S]
7069

7170
attribute [local instance] OreLocalization.oreEqv
7271

72+
@[deprecated zero_mul (since := "2025-08-20")]
7373
protected theorem zero_mul (x : R[S⁻¹]) : 0 * x = 0 :=
7474
OreLocalization.zero_smul x
7575

76+
@[deprecated mul_zero (since := "2025-08-20")]
7677
protected theorem mul_zero (x : R[S⁻¹]) : x * 0 = 0 :=
7778
OreLocalization.smul_zero x
7879

@@ -204,83 +205,13 @@ theorem numeratorHom_inj (hS : S ≤ nonZeroDivisorsLeft R) :
204205
rw [← h₂, ← sub_eq_zero, ← mul_sub] at h₁
205206
exact (sub_eq_zero.mp (hS u.2 _ h₁)).symm
206207

207-
theorem subsingleton_iff :
208-
Subsingleton R[S⁻¹] ↔ 0 ∈ S := by
209-
rw [← subsingleton_iff_zero_eq_one, OreLocalization.one_def,
210-
OreLocalization.zero_def, oreDiv_eq_iff]
211-
simp
212-
213-
theorem nontrivial_iff :
214-
Nontrivial R[S⁻¹] ↔ 0 ∉ S := by
215-
rw [← not_subsingleton_iff_nontrivial, subsingleton_iff]
216-
217-
theorem nontrivial_of_nonZeroDivisorsLeft [Nontrivial R] (hS : S ≤ nonZeroDivisorsLeft R) :
218-
Nontrivial R[S⁻¹] :=
219-
nontrivial_iff.mpr (fun e ↦ one_ne_zero <| hS e 1 (zero_mul _))
220-
221-
theorem nontrivial_of_nonZeroDivisorsRight [Nontrivial R] (hS : S ≤ nonZeroDivisorsRight R) :
222-
Nontrivial R[S⁻¹] :=
223-
nontrivial_iff.mpr (fun e ↦ one_ne_zero <| hS e 1 (mul_zero _))
224-
225-
theorem nontrivial_of_nonZeroDivisors [Nontrivial R] (hS : S ≤ R⁰) :
226-
Nontrivial R[S⁻¹] :=
227-
nontrivial_of_nonZeroDivisorsLeft (hS.trans inf_le_left)
228-
229208
end Ring
230209

231210
noncomputable section DivisionRing
232211

233212
open nonZeroDivisors
234213

235-
variable {R : Type*} [Ring R] [Nontrivial R] [OreSet R⁰]
236-
237-
instance nontrivial : Nontrivial R[R⁰⁻¹] :=
238-
nontrivial_of_nonZeroDivisors (refl R⁰)
239-
240-
variable [NoZeroDivisors R]
241-
242-
open Classical in
243-
/-- The inversion of Ore fractions for a ring without zero divisors, satisfying `0⁻¹ = 0` and
244-
`(r /ₒ r')⁻¹ = r' /ₒ r` for `r ≠ 0`. -/
245-
@[irreducible]
246-
protected def inv : R[R⁰⁻¹] → R[R⁰⁻¹] :=
247-
liftExpand
248-
(fun r s =>
249-
if hr : r = (0 : R) then (0 : R[R⁰⁻¹])
250-
else s /ₒ ⟨r, mem_nonZeroDivisors_of_ne_zero hr⟩)
251-
(by
252-
intro r t s hst
253-
by_cases hr : r = 0
254-
· simp [hr]
255-
· by_cases ht : t = 0
256-
· exfalso
257-
apply nonZeroDivisors.coe_ne_zero ⟨_, hst⟩
258-
simp [ht]
259-
· simp only [hr, ht, dif_neg, not_false_iff, or_self_iff, mul_eq_zero, smul_eq_mul]
260-
apply OreLocalization.expand)
261-
262-
instance inv' : Inv R[R⁰⁻¹] :=
263-
⟨OreLocalization.inv⟩
264-
265-
open Classical in
266-
protected theorem inv_def {r : R} {s : R⁰} :
267-
(r /ₒ s)⁻¹ =
268-
if hr : r = (0 : R) then (0 : R[R⁰⁻¹])
269-
else s /ₒ ⟨r, mem_nonZeroDivisors_of_ne_zero hr⟩ := by
270-
with_unfolding_all rfl
271-
272-
protected theorem mul_inv_cancel (x : R[R⁰⁻¹]) (h : x ≠ 0) : x * x⁻¹ = 1 := by
273-
induction' x with r s
274-
rw [OreLocalization.inv_def, OreLocalization.one_def]
275-
have hr : r ≠ 0 := by
276-
rintro rfl
277-
simp at h
278-
simp only [hr]
279-
with_unfolding_all apply OreLocalization.mul_inv ⟨r, _⟩
280-
281-
protected theorem inv_zero : (0 : R[R⁰⁻¹])⁻¹ = 0 := by
282-
rw [OreLocalization.zero_def, OreLocalization.inv_def]
283-
simp
214+
variable {R : Type*} [Ring R] [Nontrivial R] [NoZeroDivisors R] [OreSet R⁰]
284215

285216
instance : DivisionRing R[R⁰⁻¹] where
286217
mul_inv_cancel := OreLocalization.mul_inv_cancel

0 commit comments

Comments
 (0)