Skip to content

Commit 21ecf63

Browse files
committed
feat(RingTheory): More API for Ideal.ResidueField (leanprover-community#32375)
1 parent 66eafa5 commit 21ecf63

5 files changed

Lines changed: 78 additions & 24 deletions

File tree

Mathlib/RingTheory/LocalRing/ResidueField/Fiber.lean

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ variable (R S) in
6161
noncomputable def PrimeSpectrum.preimageEquivFiber (p : PrimeSpectrum R) :
6262
(algebraMap R S).specComap ⁻¹' {p} ≃ PrimeSpectrum (p.asIdeal.Fiber S) where
6363
toFun q := ⟨RingHom.ker (Algebra.TensorProduct.lift
64-
(Ideal.ResidueField.mapₐ p.asIdeal q.1.asIdeal congr($(q.2.symm).asIdeal))
65-
(IsScalarTower.toAlgHom _ _ _) (fun _ _ ↦ .all _ _)).toRingHom, RingHom.ker_isPrime _⟩
64+
(Ideal.ResidueField.mapₐ p.asIdeal q.1.asIdeal (Algebra.ofId _ _) congr($(q.2.symm).asIdeal))
65+
(IsScalarTower.toAlgHom _ _ _) fun _ _ ↦ .all _ _).toRingHom, RingHom.ker_isPrime _⟩
6666
invFun q := ⟨Algebra.TensorProduct.includeRight.toRingHom.specComap q, by
6767
simp only [AlgHom.toRingHom_eq_coe, Set.mem_preimage, ← specComap_comp_apply,
6868
AlgHom.comp_algebraMap_of_tower]
@@ -78,7 +78,8 @@ noncomputable def PrimeSpectrum.preimageEquivFiber (p : PrimeSpectrum R) :
7878
· rw [← Ideal.mem_comap, ← PrimeSpectrum.specComap_asIdeal]
7979
convert hr
8080
exact (residueField_specComap _).le ⟨(algebraMap _ _).specComap q, rfl⟩
81-
· simpa [-Algebra.algebraMap_self, -AlgHom.commutes, -AlgHom.map_algebraMap]
81+
· simpa [-Algebra.algebraMap_self, -AlgHom.commutes, -AlgHom.map_algebraMap,
82+
-Ideal.ResidueField.map_algebraMap]
8283

8384
variable (R S) in
8485
/-- The `OrderIso` between the fiber of `PrimeSpectrum S → PrimeSpectrum R` at a prime

Mathlib/RingTheory/LocalRing/ResidueField/Ideal.lean

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ and provide an `IsFractionRing (R ⧸ I) I.ResidueField` instance.
2020

2121
@[expose] public section
2222

23-
variable {R A} [CommRing R] [CommRing A] [Algebra R A]
24-
variable (I : Ideal R) [I.IsPrime]
23+
open scoped nonZeroDivisors
24+
25+
variable {R S A B : Type*} [CommRing R] [CommRing S] [CommRing A] [CommRing B]
26+
variable [Algebra R A] [Algebra R B] (I : Ideal R) [I.IsPrime]
2527

2628
/--
2729
The residue field at a prime ideal, defined to be the residue field of the local ring
@@ -33,25 +35,30 @@ abbrev Ideal.ResidueField : Type _ :=
3335

3436
/-- If `I = f⁻¹(J)`, then there is a canonical embedding `κ(I) ↪ κ(J)`. -/
3537
noncomputable
36-
abbrev Ideal.ResidueField.map (I : Ideal R) [I.IsPrime] (J : Ideal A) [J.IsPrime]
37-
(f : R →+* A) (hf : I = J.comap f) : I.ResidueField →+* J.ResidueField :=
38+
abbrev Ideal.ResidueField.map (I : Ideal R) [I.IsPrime] (J : Ideal S) [J.IsPrime]
39+
(f : R →+* S) (hf : I = J.comap f) : I.ResidueField →+* J.ResidueField :=
3840
IsLocalRing.ResidueField.map (Localization.localRingHom I J f hf)
3941

42+
@[simp]
43+
lemma Ideal.ResidueField.map_algebraMap (I : Ideal R) [I.IsPrime] (J : Ideal S) [J.IsPrime]
44+
(f : R →+* S) (hf : I = J.comap f) (r : R) :
45+
ResidueField.map I J f hf (algebraMap _ _ r) = algebraMap _ _ (f r) := by
46+
rw [IsScalarTower.algebraMap_apply R (Localization.AtPrime I)]
47+
simp [IsLocalRing.ResidueField.map_residue, Localization.localRingHom_to_map]
48+
rfl
49+
4050
/-- If `I = f⁻¹(J)`, then there is a canonical embedding `κ(I) ↪ κ(J)`. -/
4151
noncomputable
42-
def Ideal.ResidueField.mapₐ (I : Ideal R) [I.IsPrime] (J : Ideal A) [J.IsPrime]
43-
(hf : I = J.comap (algebraMap R A)) : I.ResidueField →ₐ[R] J.ResidueField where
44-
__ := Ideal.ResidueField.map I J (algebraMap R A) hf
52+
def Ideal.ResidueField.mapₐ (I : Ideal A) [I.IsPrime] (J : Ideal B) [J.IsPrime]
53+
(f : A →ₐ[R] B) (hf : I = J.comap f.toRingHom) : I.ResidueField →ₐ[R] J.ResidueField where
54+
__ := Ideal.ResidueField.map I J f hf
4555
commutes' r := by
46-
rw [IsScalarTower.algebraMap_apply R (Localization.AtPrime I),
47-
IsLocalRing.ResidueField.algebraMap_eq]
48-
simp only [RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe, MonoidHom.toOneHom_coe,
49-
MonoidHom.coe_coe, IsLocalRing.ResidueField.map_residue, Localization.localRingHom_to_map]
50-
rfl
56+
simp [IsScalarTower.algebraMap_apply R A I.ResidueField,
57+
IsScalarTower.algebraMap_apply R B J.ResidueField]
5158

52-
@[simp] lemma Ideal.ResidueField.mapₐ_apply (I : Ideal R) [I.IsPrime] (J : Ideal A) [J.IsPrime]
53-
(hf : I = J.comap (algebraMap R A)) (x) :
54-
Ideal.ResidueField.mapₐ I J hf x = Ideal.ResidueField.map I J _ hf x := rfl
59+
@[simp] lemma Ideal.ResidueField.mapₐ_apply (I : Ideal A) [I.IsPrime] (J : Ideal B) [J.IsPrime]
60+
(f : A →ₐ[R] B) (hf : I = J.comap f.toRingHom) (x) :
61+
Ideal.ResidueField.mapₐ I J f hf x = Ideal.ResidueField.map I J _ hf x := rfl
5562

5663
variable {I} in
5764
@[simp high] -- marked `high` to override the more general `FaithfulSMul.algebraMap_eq_zero_iff`
@@ -75,10 +82,13 @@ instance : IsScalarTower R (R ⧸ I) I.ResidueField :=
7582
IsScalarTower.of_algebraMap_eq fun _ ↦ rfl
7683

7784
@[simp]
78-
lemma algebraMap_mk (x) :
85+
lemma Ideal.algebraMap_quotient_residueField_mk (x) :
7986
algebraMap (R ⧸ I) I.ResidueField (Ideal.Quotient.mk _ x) =
8087
algebraMap R I.ResidueField x := rfl
8188

89+
@[deprecated (since := "2025-12-02")]
90+
alias algebraMap_mk := Ideal.algebraMap_quotient_residueField_mk
91+
8292
lemma Ideal.injective_algebraMap_quotient_residueField :
8393
Function.Injective (algebraMap (R ⧸ I) I.ResidueField) := by
8494
rw [RingHom.injective_iff_ker_eq_bot]
@@ -100,8 +110,9 @@ instance : IsFractionRing (R ⧸ I) I.ResidueField where
100110
obtain ⟨y, rfl⟩ := Ideal.Quotient.mk_surjective y
101111
rw [← sub_eq_zero, ← map_sub, ← map_sub] at e
102112
simp only [IsLocalRing.ResidueField.algebraMap_eq, IsLocalRing.residue_eq_zero_iff,
103-
IsScalarTower.algebraMap_apply R (Localization.AtPrime I) I.ResidueField, algebraMap_mk,
104-
IsLocalization.AtPrime.to_map_mem_maximal_iff _ I, ← Ideal.Quotient.mk_eq_mk_iff_sub_mem] at e
113+
IsScalarTower.algebraMap_apply R (Localization.AtPrime I) I.ResidueField,
114+
Ideal.algebraMap_quotient_residueField_mk, IsLocalization.AtPrime.to_map_mem_maximal_iff _ I,
115+
← Ideal.Quotient.mk_eq_mk_iff_sub_mem] at e
105116
use 1
106117
simp [e]
107118

@@ -118,3 +129,45 @@ lemma Ideal.surjectiveOnStalks_residueField (I : Ideal R) [I.IsPrime] :
118129
instance (p : Ideal R) [p.IsPrime] (q : Ideal A) [q.IsPrime] [q.LiesOver p] :
119130
IsLocalHom (algebraMap (Localization.AtPrime p) (Localization.AtPrime q)) :=
120131
Localization.isLocalHom_localRingHom _ _ _ (Ideal.over_def _ _)
132+
133+
/-- If `f` sends `I` to `0` and `Iᶜ` to units, then `f` lifts to `κ(I)`. -/
134+
noncomputable def Ideal.ResidueField.lift
135+
(f : R →+* S) (hf₁ : I ≤ RingHom.ker f)
136+
(hf₂ : I.primeCompl ≤ (IsUnit.submonoid S).comap f) : I.ResidueField →+* S :=
137+
IsLocalization.lift (M := (R ⧸ I)⁰) (g := Ideal.Quotient.lift I (f := f) hf₁) <| by
138+
simpa [Ideal.Quotient.mk_surjective.forall, Ideal.Quotient.eq_zero_iff_mem]
139+
140+
@[simp] lemma Ideal.ResidueField.lift_algebraMap
141+
(f : R →+* S) (hf₁ : I ≤ RingHom.ker f)
142+
(hf₂ : I.primeCompl ≤ (IsUnit.submonoid S).comap f) (r : R) :
143+
lift I f hf₁ hf₂ (algebraMap _ _ r) = f r := by
144+
rw [lift, IsScalarTower.algebraMap_apply R (R ⧸ I) I.ResidueField, IsLocalization.lift_eq]
145+
simp
146+
147+
/-- If `f` sends `I` to `0` and `Iᶜ` to units, then `f` lifts to `κ(I)`. -/
148+
noncomputable
149+
def Ideal.ResidueField.liftₐ (I : Ideal A) [I.IsPrime] (f : A →ₐ[R] B) (hf₁ : I ≤ RingHom.ker f)
150+
(hf₂ : I.primeCompl ≤ (IsUnit.submonoid B).comap f) : I.ResidueField →ₐ[R] B where
151+
__ := Ideal.ResidueField.lift I f.toRingHom hf₁ hf₂
152+
commutes' r := by simp [IsScalarTower.algebraMap_apply R A I.ResidueField]
153+
154+
@[simp]
155+
lemma Ideal.ResidueField.liftₐ_algebraMap (I : Ideal A) [I.IsPrime] (f : A →ₐ[R] B)
156+
(hf₁ : I ≤ RingHom.ker f) (hf₂ : I.primeCompl ≤ (IsUnit.submonoid B).comap f) (r : A) :
157+
liftₐ I f hf₁ hf₂ (algebraMap _ _ r) = f r :=
158+
lift_algebraMap _ _ _ hf₂ _
159+
160+
@[simp] lemma Ideal.ResidueField.liftₐ_comp_toAlgHom (I : Ideal A) [I.IsPrime] (f : A →ₐ[R] B)
161+
(hf₁ : I ≤ RingHom.ker f) (hf₂ : I.primeCompl ≤ (IsUnit.submonoid B).comap f) :
162+
(liftₐ I f hf₁ hf₂).comp (IsScalarTower.toAlgHom _ A _) = f :=
163+
AlgHom.ext fun _ ↦ liftₐ_algebraMap _ _ _ hf₂ _
164+
165+
@[ext high] -- higher than `RingHom.ext`.
166+
lemma Ideal.ResidueField.ringHom_ext {I : Ideal R} [I.IsPrime]
167+
{f g : I.ResidueField →+* S} (H : f.comp (algebraMap R _) = g.comp (algebraMap R _)) : f = g :=
168+
IsLocalization.ringHom_ext (R ⧸ I)⁰ (Ideal.Quotient.ringHom_ext H)
169+
170+
@[ext high] -- higher than `AlgHom.ext`.
171+
lemma Ideal.ResidueField.algHom_ext {I : Ideal A} [I.IsPrime] {f g : I.ResidueField →ₐ[R] B}
172+
(H : f.comp (IsScalarTower.toAlgHom R A _) = g.comp (IsScalarTower.toAlgHom R A _)) : f = g :=
173+
AlgHom.coe_ringHom_injective (ringHom_ext congr($H))

Mathlib/RingTheory/LocalRing/ResidueField/Instances.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ instance [p.IsMaximal] [q.IsMaximal] [Algebra.IsSeparable p.ResidueField q.Resid
3232
refine Algebra.IsSeparable.of_equiv_equiv
3333
(.symm <| .ofBijective _ p.bijective_algebraMap_quotient_residueField)
3434
(.symm <| .ofBijective _ q.bijective_algebraMap_quotient_residueField) ?_
35-
ext x
35+
apply RingHom.ext fun x ↦ ?_
3636
obtain ⟨x, rfl⟩ :=
3737
(RingEquiv.ofBijective _ p.bijective_algebraMap_quotient_residueField).surjective x
3838
obtain ⟨x, rfl⟩ := Ideal.Quotient.mk_surjective x

Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ lemma mem_image_comap_zeroLocus_sdiff (f : A) (s : Set A) (x) :
8383
q.asIdeal.ResidueField :=
8484
Algebra.TensorProduct.lift
8585
(Ideal.Quotient.liftₐ (Ideal.span s) (Algebra.ofId A _) hs)
86-
(Ideal.ResidueField.mapₐ _ _ rfl)
86+
(Ideal.ResidueField.mapₐ _ _ (Algebra.ofId _ _) rfl)
8787
fun _ _ ↦ .all _ _
8888
have := H.map F
8989
rw [AlgHom.commutes, isNilpotent_iff_eq_zero, ← RingHom.mem_ker,

Mathlib/RingTheory/Spectrum/Prime/RingHom.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ lemma PrimeSpectrum.nontrivial_iff_mem_rangeComap {S : Type*} [CommRing S]
279279
simp [Ideal.eq_bot_of_prime, k, ← RingHom.ker_eq_comap_bot]
280280
· obtain ⟨q, rfl⟩ := h
281281
let f : k ⊗[R] S →ₐ[R] q.asIdeal.ResidueField :=
282-
Algebra.TensorProduct.lift (Ideal.ResidueField.mapₐ _ _ rfl)
282+
Algebra.TensorProduct.lift (Ideal.ResidueField.mapₐ _ _ (Algebra.ofId _ _) rfl)
283283
(IsScalarTower.toAlgHom _ _ _) (fun _ _ ↦ Commute.all ..)
284284
exact RingHom.domain_nontrivial f.toRingHom
285285

0 commit comments

Comments
 (0)