forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPolynomial.lean
More file actions
148 lines (132 loc) · 7.22 KB
/
Copy pathPolynomial.lean
File metadata and controls
148 lines (132 loc) · 7.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/-
Copyright (c) 2025 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
module
public import Mathlib.FieldTheory.RatFunc.AsPolynomial
public import Mathlib.RingTheory.LocalRing.ResidueField.Fiber
/-!
# Residue field of primes in polynomial algebras
## Main results
- `Polynomial.residueFieldMapCAlgEquiv`: `κ(I[X]) ≃ₐ[κ(I)] κ(I)(X)`
- `Polynomial.fiberEquivQuotient`: `κ(p) ⊗[R] (R[X] ⧸ I) = κ(p)[X] / I`
-/
@[expose] public section
namespace Polynomial
open scoped nonZeroDivisors TensorProduct
variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S]
variable (I : Ideal R) [I.IsPrime] (J : Ideal R[X]) [J.IsPrime]
/-- `κ(I[X]) ≃ₐ[κ(I)] κ(I)(X)`. -/
noncomputable
def residueFieldMapCAlgEquiv [J.LiesOver I] (hJ : J = I.map C) :
J.ResidueField ≃ₐ[I.ResidueField] RatFunc I.ResidueField := by
letI f : J.ResidueField →+* RatFunc I.ResidueField := by
refine Ideal.ResidueField.lift _
((algebraMap I.ResidueField[X] _).comp (mapRingHom (algebraMap _ _))) ?_ ?_
· simp [hJ, Ideal.map_le_iff_le_comap, RingHom.comap_ker _ C, mapRingHom_comp_C,
RingHom.ker_comp_of_injective, C_injective,
FaithfulSMul.algebraMap_injective I.ResidueField[X] (RatFunc I.ResidueField)]
· rintro x (hx : x ∉ J)
suffices ∃ i, x.coeff i ∉ I by simpa [IsUnit.mem_submonoid_iff, Polynomial.ext_iff]
contrapose! hx
rwa [hJ, Ideal.mem_map_C_iff]
haveI hf : f.comp (algebraMap I.ResidueField _) = algebraMap _ _ := by
ext
simp [f, ← IsScalarTower.algebraMap_apply, IsScalarTower.algebraMap_apply R R[X] J.ResidueField]
refine .ofAlgHom ⟨f, fun r ↦ congr($hf r)⟩
(RatFunc.liftAlgHom (aeval (algebraMap R[X] _ X)) fun x ↦ ?_) ?_ ?_
· suffices Function.Injective (aeval (R := I.ResidueField) (algebraMap R[X] J.ResidueField X)) by
simp [← this.eq_iff]
rw [injective_iff_map_eq_zero]
intro x hx
obtain ⟨r, hr⟩ := map_surjective _ Ideal.Quotient.mk_surjective
(IsLocalization.integerNormalization (R ⧸ I)⁰ x)
obtain ⟨s, hs, hr⟩ : ∃ s ∉ I, r.map (algebraMap _ _) = s • x := by
obtain ⟨b, hb0, hb⟩ := IsLocalization.integerNormalization_spec (R ⧸ I)⁰ x
obtain ⟨s, rfl⟩ := Ideal.Quotient.mk_surjective b
refine ⟨s, by simpa [Ideal.Quotient.eq_zero_iff_mem] using hb0, ?_⟩
simpa [← hr, map_map, ← Ideal.Quotient.algebraMap_eq] using hb
replace hx : r ∈ J := by
apply_fun aeval (algebraMap R[X] J.ResidueField X) at hr
simpa [hx, aeval_map_algebraMap, aeval_algebraMap_apply, Algebra.smul_def] using hr
refine ((IsUnit.mk0 (algebraMap R I.ResidueField s) (by simpa)).map C).mul_right_injective ?_
simp only [← algebraMap_eq, ← Algebra.smul_def]
erw [algebraMap_smul]
simp only [← hr]
simpa [Polynomial.ext_iff, Ideal.mem_map_C_iff] using hJ.le hx
· apply AlgHom.coe_ringHom_injective
apply IsFractionRing.injective_comp_algebraMap (A := I.ResidueField[X])
dsimp [RatFunc.liftAlgHom]
simp only [AlgHom.comp_toRingHom, AlgHom.coe_ringHom_mk, RingHom.comp_assoc,
RatFunc.liftRingHom_comp_algebraMap, RingHomCompTriple.comp_eq, f]
ext <;> simp [← IsScalarTower.algebraMap_apply,
IsScalarTower.algebraMap_apply R R[X] J.ResidueField]
· apply AlgHom.coe_ringHom_injective
ext
· simp [f, RatFunc.liftAlgHom, ← IsScalarTower.algebraMap_apply]; rfl
· simp [f, RatFunc.liftAlgHom]
@[simp]
lemma residueFieldMapCAlgEquiv_algebraMap [J.LiesOver I] (hJ : J = I.map C) (p : R[X]) :
residueFieldMapCAlgEquiv I J hJ (algebraMap _ _ p) =
algebraMap _ _ (p.map (algebraMap R I.ResidueField)) := by
simp [residueFieldMapCAlgEquiv]
@[simp]
lemma residueFieldMapCAlgEquiv_symm_C [J.LiesOver I] (hJ : J = I.map C) (r) :
(residueFieldMapCAlgEquiv I J hJ).symm (.C r) = algebraMap _ _ r :=
(residueFieldMapCAlgEquiv I J hJ).symm.commutes r
@[simp]
lemma residueFieldMapCAlgEquiv_symm_X [J.LiesOver I] (hJ : J = I.map C) :
(residueFieldMapCAlgEquiv I J hJ).symm .X = algebraMap R[X] _ .X :=
(residueFieldMapCAlgEquiv I J hJ).injective (by simp)
/-- `κ(p) ⊗[R] (R[X] ⧸ I) = κ(p)[X] / I` -/
noncomputable
def fiberEquivQuotient (f : R[X] →ₐ[R] S) (hf : Function.Surjective f) (p : Ideal R) [p.IsPrime] :
p.Fiber S ≃ₐ[p.ResidueField] p.ResidueField[X] ⧸
((RingHom.ker (f : R[X] →+* S)).map (mapRingHom (algebraMap R p.ResidueField))) := by
refine .ofAlgHom (Algebra.TensorProduct.lift (Algebra.ofId _ _) (AlgHom.liftOfSurjective _ hf
((Ideal.Quotient.mkₐ _ _).comp (mapAlgHom (Algebra.ofId _ _))) ?_) fun _ _ ↦ .all _ _)
(Ideal.Quotient.liftₐ _ (aeval (1 ⊗ₜ f .X)) ?_) ?_ ?_
· simp [AlgHom.comp_toRingHom, ← RingHom.comap_ker, ← Ideal.map_le_iff_le_comap]
· change Ideal.map _ _ ≤ RingHom.ker (aeval _).toRingHom
rw [Ideal.map_le_iff_le_comap, RingHom.comap_ker]
have : ((aeval (1 ⊗ₜ[R] f X : p.Fiber S)).restrictScalars R).comp
(mapAlgHom (Algebra.ofId R p.ResidueField)) =
Algebra.TensorProduct.includeRight.comp f := by ext; simp
exact .trans_eq (by intro; aesop) congr(RingHom.ker $this).symm
· apply Ideal.Quotient.algHom_ext
ext
simp
· ext x
obtain ⟨x, rfl⟩ := hf x
simpa using aeval_algHom_apply
((Algebra.TensorProduct.includeRight : S →ₐ[_] p.Fiber S).comp f) X x
lemma fiberEquivQuotient_tmul
(f : R[X] →ₐ[R] S) (hf : Function.Surjective f) (p : Ideal R) [p.IsPrime] (a b) :
fiberEquivQuotient f hf p (a ⊗ₜ f b) = Ideal.Quotient.mk _ (C a * b.map (algebraMap _ _)) := by
simp [fiberEquivQuotient, ← Ideal.Quotient.mk_algebraMap]
/-- Given a prime `P` of `R` and an ideal `I` of `R[X]`, the image of `I` in `κ(P)[X]`
is generated by some `p ∈ I` (basically because `κ(P)[X]` is a PID). -/
theorem _root_.Ideal.exists_mem_span_singleton_map_residueField_eq
(P : Ideal R) [P.IsPrime] (I : Ideal R[X]) :
∃ p ∈ I, Ideal.span {p.map (algebraMap R P.ResidueField)} =
I.map (mapRingHom (algebraMap R P.ResidueField)) := by
obtain ⟨p, hp : _ = Ideal.span _⟩ := (inferInstance :
(I.map (mapRingHom (algebraMap R P.ResidueField))).IsPrincipal)
letI := (mapRingHom (algebraMap (R ⧸ P) P.ResidueField)).toAlgebra
have := Polynomial.isLocalization (R ⧸ P)⁰ P.ResidueField
have : p ∈ (I.map (mapRingHom (algebraMap R (R ⧸ P)))).map (algebraMap _ _) := by
rw [Ideal.map_map, RingHom.algebraMap_toAlgebra, mapRingHom_comp,
← IsScalarTower.algebraMap_eq, hp]
exact Ideal.mem_span_singleton_self _
obtain ⟨⟨⟨r, hr⟩, s⟩, e⟩ := (IsLocalization.mem_map_algebraMap_iff ((R ⧸ P)⁰.map C) _).mp this
obtain ⟨r, hr', rfl⟩ := (Ideal.mem_map_iff_of_surjective _
(Polynomial.map_surjective _ Ideal.Quotient.mk_surjective)).mp hr
simp only [algebraMap_def, coe_mapRingHom,
Polynomial.map_map, ← IsScalarTower.algebraMap_eq] at e
refine ⟨r, hr', le_antisymm ?_ ?_⟩
· simpa [-le_of_subsingleton, Ideal.span_le] using Ideal.mem_map_of_mem _ hr'
· simp only [hp, Ideal.span_le, Set.singleton_subset_iff, SetLike.mem_coe]
rw [(IsLocalization.map_units P.ResidueField[X] s).unit.eq_mul_inv_iff_mul_eq.mpr e]
exact Ideal.mul_mem_right _ _ (Ideal.mem_span_singleton_self _)
end Polynomial