Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit db7a53a

Browse files
refactor(ring_theory/ideals): make local_ring a prop class (#3171)
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
1 parent afc1c24 commit db7a53a

File tree

2 files changed

+64
-55
lines changed

2 files changed

+64
-55
lines changed

src/ring_theory/ideals.lean

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ theorem eq_top_iff_one : I = ⊤ ↔ (1:α) ∈ I :=
3636
theorem ne_top_iff_one : I ≠ ⊤ ↔ (1:α) ∉ I :=
3737
not_congr I.eq_top_iff_one
3838

39+
/-- The ideal generated by a subset of a ring -/
3940
def span (s : set α) : ideal α := submodule.span α s
4041

4142
lemma subset_span {s : set α} : s ⊆ span s := submodule.subset_span
@@ -73,6 +74,7 @@ lemma span_singleton_eq_bot {x} : span ({x} : set α) = ⊥ ↔ x = 0 := submodu
7374
lemma span_singleton_eq_top {x} : span ({x} : set α) = ⊤ ↔ is_unit x :=
7475
by rw [is_unit_iff_dvd_one, ← span_singleton_le_span_singleton, span_singleton_one, eq_top_iff]
7576

77+
/-- An ideal `P` of a ring `R` is prime if `P ≠ R` and `xy ∈ P → x ∈ P ∨ y ∈ P` -/
7678
@[class] def is_prime (I : ideal α) : Prop :=
7779
I ≠ ⊤ ∧ ∀ {x y : α}, x * y ∈ I → x ∈ I ∨ y ∈ I
7880

@@ -98,6 +100,7 @@ theorem span_singleton_prime {p : α} (hp : p ≠ 0) :
98100
is_prime (span ({p} : set α)) ↔ prime p :=
99101
by simp [is_prime, prime, span_singleton_eq_top, hp, mem_span_singleton]
100102

103+
/-- An ideal is maximal if it is maximal in the collection of proper ideals. -/
101104
@[class] def is_maximal (I : ideal α) : Prop :=
102105
I ≠ ⊤ ∧ ∀ J, I < J → J = ⊤
103106

@@ -165,12 +168,17 @@ lt_of_le_not_le (ideal.span_le.2 $ singleton_subset_iff.2 $
165168
h₂ $ is_unit_of_dvd_one _ $ (mul_dvd_mul_iff_left h₁).1 $
166169
by rwa [mul_one, ← ideal.span_singleton_le_span_singleton]
167170

171+
/-- The quotient `R/I` of a ring `R` by an ideal `I`. -/
168172
def quotient (I : ideal α) := I.quotient
169173

170174
namespace quotient
171175
variables {I} {x y : α}
176+
177+
/-- The map from a ring `R` to a quotient ring `R/I`. -/
172178
def mk (I : ideal α) (a : α) : I.quotient := submodule.quotient.mk a
173179

180+
instance : inhabited (quotient I) := ⟨mk I 37
181+
174182
protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := submodule.quotient.eq I
175183

176184
instance (I : ideal α) : has_one I.quotient := ⟨mk I 1
@@ -209,6 +217,7 @@ def mk_hom (I : ideal α) : α →+* I.quotient := ⟨mk I, rfl, λ _ _, rfl, rf
209217

210218
lemma mk_eq_mk_hom (I : ideal α) (x : α) : ideal.quotient.mk I x = ideal.quotient.mk_hom I x := rfl
211219

220+
/-- The image of an ideal J under the quotient map `R → R/I`. -/
212221
def map_mk (I J : ideal α) : ideal I.quotient :=
213222
{ carrier := mk I '' J,
214223
zero_mem' := ⟨0, J.zero_mem, rfl⟩,
@@ -353,12 +362,15 @@ end
353362

354363
section prio
355364
set_option default_priority 100 -- see Note [default priority]
356-
class local_ring (α : Type u) extends comm_ring α, nonzero α :=
365+
/-- A commutative ring is local if it has a unique maximal ideal. Note that
366+
`local_ring` is a predicate. -/
367+
class local_ring (α : Type u) [comm_ring α] extends nonzero α : Prop :=
357368
(is_local : ∀ (a : α), (is_unit a) ∨ (is_unit (1 - a)))
358369
end prio
359370

360371
namespace local_ring
361-
variable [local_ring α]
372+
373+
variables [comm_ring α] [local_ring α]
362374

363375
lemma is_unit_or_is_unit_one_sub_self (a : α) :
364376
(is_unit a) ∨ (is_unit (1 - a)) :=
@@ -393,13 +405,13 @@ end
393405
variable (α)
394406

395407
/-- The ideal of elements that are not units. -/
396-
def nonunits_ideal : ideal α :=
408+
def maximal_ideal : ideal α :=
397409
{ carrier := nonunits α,
398410
zero_mem' := zero_mem_nonunits.2 $ zero_ne_one,
399411
add_mem' := λ x y hx hy, nonunits_add hx hy,
400412
smul_mem' := λ a x, mul_mem_nonunits_right }
401413

402-
instance nonunits_ideal.is_maximal : (nonunits_ideal α).is_maximal :=
414+
instance maximal_ideal.is_maximal : (maximal_ideal α).is_maximal :=
403415
begin
404416
rw ideal.is_maximal_iff,
405417
split,
@@ -412,40 +424,28 @@ end
412424

413425
lemma max_ideal_unique :
414426
∃! I : ideal α, I.is_maximal :=
415-
nonunits_ideal α, nonunits_ideal.is_maximal α,
416-
λ I hI, hI.eq_of_le (nonunits_ideal.is_maximal α).1 $
427+
maximal_ideal α, maximal_ideal.is_maximal α,
428+
λ I hI, hI.eq_of_le (maximal_ideal.is_maximal α).1 $
417429
λ x hx, hI.1 ∘ I.eq_top_of_is_unit_mem hx⟩
418430

419431
variable {α}
420432

421-
@[simp] lemma mem_nonunits_ideal (x) :
422-
x ∈ nonunits_ideal α ↔ x ∈ nonunits α := iff.rfl
433+
@[simp] lemma mem_maximal_ideal (x) :
434+
x ∈ maximal_ideal α ↔ x ∈ nonunits α := iff.rfl
423435

424436
end local_ring
425437

426-
def is_local_ring (α : Type u) [comm_ring α] : Prop :=
427-
((0:α) ≠ 1) ∧ ∀ (a : α), (is_unit a) ∨ (is_unit (1 - a))
428-
429-
def local_of_is_local_ring [comm_ring α] (h : is_local_ring α) : local_ring α :=
430-
{ zero_ne_one := h.1,
431-
is_local := h.2,
432-
.. ‹comm_ring α› }
433-
434-
def local_of_unit_or_unit_one_sub [comm_ring α] (hnze : (0:α) ≠ 1)
435-
(h : ∀ x : α, is_unit x ∨ is_unit (1 - x)) : local_ring α :=
436-
local_of_is_local_ring ⟨hnze, h⟩
437-
438-
def local_of_nonunits_ideal [comm_ring α] (hnze : (0:α) ≠ 1)
438+
lemma local_of_nonunits_ideal [comm_ring α] (hnze : (0:α) ≠ 1)
439439
(h : ∀ x y ∈ nonunits α, x + y ∈ nonunits α) : local_ring α :=
440-
local_of_is_local_ring ⟨hnze,
441-
λ x, or_iff_not_imp_left.mpr $ λ hx,
440+
{ zero_ne_one := hnze,
441+
is_local := λ x, or_iff_not_imp_left.mpr $ λ hx,
442442
begin
443443
by_contra H,
444444
apply h _ _ hx H,
445445
simp [-sub_eq_add_neg, add_sub_cancel'_right]
446-
end
446+
end}
447447

448-
def local_of_unique_max_ideal [comm_ring α] (h : ∃! I : ideal α, I.is_maximal) :
448+
lemma local_of_unique_max_ideal [comm_ring α] (h : ∃! I : ideal α, I.is_maximal) :
449449
local_ring α :=
450450
local_of_nonunits_ideal
451451
(let ⟨I, Imax, _⟩ := h in (λ (H : 0 = 1), Imax.1 $ I.eq_top_iff_one.2 $ H ▸ I.zero_mem))
@@ -459,6 +459,9 @@ Imax.1 $ I.eq_top_of_is_unit_mem (I.add_mem xmemI ymemI) H
459459

460460
section prio
461461
set_option default_priority 100 -- see Note [default priority]
462+
/-- A local ring homomorphism is a homomorphism between local rings
463+
such that the image of the maximal ideal of the source is contained within
464+
the maximal ideal of the target. -/
462465
class is_local_ring_hom [semiring α] [semiring β] (f : α →+* β) : Prop :=
463466
(map_nonunit : ∀ a, is_unit (f a) → is_unit a)
464467
end prio
@@ -469,33 +472,37 @@ is_local_ring_hom.map_nonunit a h
469472

470473
section
471474
open local_ring
472-
variables [local_ring α] [local_ring β]
475+
variables [comm_ring α] [local_ring α] [comm_ring β] [local_ring β]
473476
variables (f : α →+* β) [is_local_ring_hom f]
474477

475-
lemma map_nonunit (a) (h : a ∈ nonunits_ideal α) : f a ∈ nonunits_ideal β :=
478+
lemma map_nonunit (a) (h : a ∈ maximal_ideal α) : f a ∈ maximal_ideal β :=
476479
λ H, h $ is_unit_of_map_unit f a H
477480

478481
end
479482

480483
namespace local_ring
481-
variables [local_ring α] [local_ring β]
484+
variables [comm_ring α] [local_ring α] [comm_ring β] [local_ring β]
482485

483486
variable (α)
484-
def residue_field := (nonunits_ideal α).quotient
487+
/-- The residue field of a local ring is the quotient of the ring by its maximal ideal. -/
488+
def residue_field := (maximal_ideal α).quotient
485489

486490
noncomputable instance residue_field.field : field (residue_field α) :=
487-
ideal.quotient.field (nonunits_ideal α)
491+
ideal.quotient.field (maximal_ideal α)
492+
493+
noncomputable instance : inhabited (residue_field α) := ⟨37
488494

489-
/-- The quotient map from a local ring to it's residue field. -/
495+
/-- The quotient map from a local ring to its residue field. -/
490496
def residue : α →+* (residue_field α) :=
491497
ideal.quotient.mk_hom _
492498

493499
namespace residue_field
494500

495501
variables {α β}
502+
/-- The map on residue fields induced by a local homomorphism between local rings -/
496503
noncomputable def map (f : α →+* β) [is_local_ring_hom f] :
497504
residue_field α →+* residue_field β :=
498-
ideal.quotient.lift (nonunits_ideal α) ((ideal.quotient.mk_hom _).comp f) $
505+
ideal.quotient.lift (maximal_ideal α) ((ideal.quotient.mk_hom _).comp f) $
499506
λ a ha,
500507
begin
501508
erw ideal.quotient.eq_zero_iff_mem,

src/ring_theory/power_series.lean

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ end map
424424
section trunc
425425
variables [comm_semiring α] (n : σ →₀ ℕ)
426426

427-
-- Auxiliary definition for the truncation function.
427+
/-- Auxiliary definition for the truncation function. -/
428428
def trunc_fun (φ : mv_power_series σ α) : mv_polynomial σ α :=
429429
{ support := (n.antidiagonal.support.image prod.fst).filter (λ m, coeff α m φ ≠ 0),
430430
to_fun := λ m, if m ≤ n then coeff α m φ else 0,
@@ -600,15 +600,13 @@ section comm_ring
600600
variable [comm_ring α]
601601

602602
/-- Multivariate formal power series over a local ring form a local ring.-/
603-
lemma is_local_ring (h : is_local_ring α) : is_local_ring (mv_power_series σ α) :=
604-
begin
605-
split,
606-
{ have H : (0:α) ≠ 1 := ‹is_local_ring α›.1, contrapose! H,
603+
instance is_local_ring [local_ring α] : local_ring (mv_power_series σ α) :=
604+
{ zero_ne_one := by { have H : (0:α) ≠ 1 := ‹local_ring α›.zero_ne_one, contrapose! H,
607605
simpa using congr_arg (constant_coeff σ α) H },
608-
{ intro φ, rcases ‹is_local_ring α›.2 (constant_coeff σ α φ) with ⟨u,h⟩|⟨u,h⟩; [left, right];
606+
is_local := by { intro φ, rcases local_ring.is_local (constant_coeff σ α φ) with ⟨u,h⟩|⟨u,h⟩;
607+
[left, right];
609608
{ refine is_unit_of_mul_eq_one _ _ (mul_inv_of_unit _ u _),
610-
simpa using h.symm } }
611-
end
609+
simpa using h.symm } } }
612610

613611
-- TODO(jmc): once adic topology lands, show that this is complete
614612

@@ -632,11 +630,13 @@ end, congr_arg X⟩
632630
end nonzero
633631

634632
section local_ring
635-
variables {β : Type*} [local_ring α] [local_ring β] (f : α →+* β) [is_local_ring_hom f]
633+
variables {β : Type*} [comm_ring α] [comm_ring β] (f : α →+* β)
634+
[is_local_ring_hom f]
636635

637-
instance : local_ring (mv_power_series σ α) :=
638-
local_of_is_local_ring $ is_local_ring ⟨zero_ne_one, local_ring.is_local⟩
636+
-- Thanks to the linter for informing us that this instance does
637+
-- not actually need α and β to be local rings!
639638

639+
/-- The map `A[[X]] → B[[X]]` induced by a local ring hom `A → B` is local -/
640640
instance map.is_local_ring_hom : is_local_ring_hom (map σ f) :=
641641
begin
642642
rintros φ ⟨ψ, h⟩,
@@ -648,11 +648,18 @@ instance map.is_local_ring_hom : is_local_ring_hom (map σ f) :=
648648
exact is_unit_of_mul_eq_one φ (inv_of_unit φ c) (mul_inv_of_unit φ c hc.symm)
649649
end
650650

651+
variables [local_ring α] [local_ring β]
652+
653+
instance : local_ring (mv_power_series σ α) :=
654+
{ zero_ne_one := zero_ne_one,
655+
is_local := local_ring.is_local }
656+
651657
end local_ring
652658

653659
section field
654660
variables [field α]
655661

662+
/-- The inverse `1/f` of a multivariable power series `f` over a field -/
656663
protected def inv (φ : mv_power_series σ α) : mv_power_series σ α :=
657664
inv.aux (constant_coeff σ α φ)⁻¹ φ
658665

@@ -1051,6 +1058,7 @@ end comm_semiring
10511058
section ring
10521059
variables [ring α]
10531060

1061+
/-- Auxiliary function used for computing inverse of a power series -/
10541062
protected def inv.aux : α → power_series α → power_series α :=
10551063
mv_power_series.inv.aux
10561064

@@ -1164,29 +1172,23 @@ end
11641172
end integral_domain
11651173

11661174
section local_ring
1167-
variables [comm_ring α]
1175+
variables {β : Type*} [comm_ring α] [comm_ring β]
1176+
(f : α →+* β) [is_local_ring_hom f]
11681177

1169-
lemma is_local_ring (h : is_local_ring α) :
1170-
is_local_ring (power_series α) :=
1171-
mv_power_series.is_local_ring h
1172-
1173-
end local_ring
1178+
instance map.is_local_ring_hom : is_local_ring_hom (map f) :=
1179+
mv_power_series.map.is_local_ring_hom f
11741180

1175-
section local_ring
1176-
variables {β : Type*} [local_ring α] [local_ring β] (f : α →+* β) [is_local_ring_hom f]
1181+
variables [local_ring α] [local_ring β]
11771182

11781183
instance : local_ring (power_series α) :=
11791184
mv_power_series.local_ring
11801185

1181-
instance map.is_local_ring_hom :
1182-
is_local_ring_hom (map f) :=
1183-
mv_power_series.map.is_local_ring_hom f
1184-
11851186
end local_ring
11861187

11871188
section field
11881189
variables [field α]
11891190

1191+
/-- The inverse 1/f of a power series f defined over a field -/
11901192
protected def inv : power_series α → power_series α :=
11911193
mv_power_series.inv
11921194

0 commit comments

Comments
 (0)