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

Commit 6721ddf

Browse files
committed
refactor(ring_theory): remove unbundled leftovers in ideal.quotient (#3467)
This PR aims to smooth some corners in the `ideal.quotient` namespace left by the move to bundled `ring_hom`s. The main irritation is the ambiguity between different ways to map `x : R` to the quotient ring: `quot.mk`, `quotient.mk`, `quotient.mk'`, `submodule.quotient.mk`, `ideal.quotient.mk` and `ideal.quotient.mk_hom`, which caused a lot of duplication and more awkward proofs. The specific changes are: * delete function `ideal_quotient.mk` * rename ring hom `ideal.quotient.mk_hom` to `ideal.quotient.mk` * make new `ideal_quotient.mk` the `simp` normal form * delete obsolete `mk_eq_mk_hom` * delete obsolete `mk_...` `simp` lemmas (use `ring_hom.map_...` instead) * delete `quotient.map_mk` which was unused and had no lemmas (`ideal.map quotient.mk` is used elsewhere)
1 parent 564ab02 commit 6721ddf

File tree

8 files changed

+45
-76
lines changed

8 files changed

+45
-76
lines changed

src/algebra/direct_limit.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ comm_ring.to_ring _
287287

288288
/-- The canonical map from a component to the direct limit. -/
289289
def of (i) (x : G i) : direct_limit G f :=
290-
ideal.quotient.mk _ $ of ⟨i, x⟩
290+
ideal.quotient.mk _ (of (⟨i, x⟩ : Σ i, G i))
291291

292292
variables {G f}
293293

src/number_theory/basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ begin
2020
rw [nat.pow_succ, pow_mul, pow_mul, ← geom_sum₂_mul, pow_succ],
2121
refine mul_dvd_mul _ ih,
2222
let I : ideal R := span {p},
23-
let f : R →+* ideal.quotient I := mk_hom I,
23+
let f : R →+* ideal.quotient I := mk I,
2424
have hp : (p : ideal.quotient I) = 0,
25-
{ rw [← f.map_nat_cast, ← mk_eq_mk_hom, eq_zero_iff_mem, mem_span_singleton] },
26-
rw [← mem_span_singleton, ← ideal.quotient.eq, mk_eq_mk_hom, mk_eq_mk_hom] at h,
27-
rw [← mem_span_singleton, ← eq_zero_iff_mem, mk_eq_mk_hom, ring_hom.map_geom_series₂,
25+
{ rw [← f.map_nat_cast, eq_zero_iff_mem, mem_span_singleton] },
26+
rw [← mem_span_singleton, ← ideal.quotient.eq] at h,
27+
rw [← mem_span_singleton, ← eq_zero_iff_mem, ring_hom.map_geom_series₂,
2828
ring_hom.map_pow, ring_hom.map_pow, h, geom_series₂_self, hp, zero_mul],
2929
end
3030

src/ring_theory/adjoin_root.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ instance : inhabited (adjoin_root f) := ⟨0⟩
5656
instance : decidable_eq (adjoin_root f) := classical.dec_eq _
5757

5858
/-- Ring homomorphism from `R[x]` to `adjoin_root f` sending `X` to the `root`. -/
59-
def mk : polynomial R →+* adjoin_root f := ideal.quotient.mk_hom _
59+
def mk : polynomial R →+* adjoin_root f := ideal.quotient.mk _
6060

6161
@[elab_as_eliminator]
6262
theorem induction_on {C : adjoin_root f → Prop} (x : adjoin_root f)

src/ring_theory/eisenstein_criterion.lean

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ namespace eisenstein_criterion_aux
2323

2424
lemma map_eq_C_mul_X_pow_of_forall_coeff_mem {f : polynomial R} {P : ideal R}
2525
(hfP : ∀ (n : ℕ), ↑n < f.degree → f.coeff n ∈ P) (hf0 : f ≠ 0) :
26-
map (mk_hom P) f = C ((mk_hom P) f.leading_coeff) * X ^ f.nat_degree :=
26+
map (mk P) f = C ((mk P) f.leading_coeff) * X ^ f.nat_degree :=
2727
polynomial.ext (λ n, begin
2828
rcases lt_trichotomy ↑n (degree f) with h | h | h,
29-
{ erw [coeff_map, ← mk_eq_mk_hom, eq_zero_iff_mem.2 (hfP n h),
30-
coeff_C_mul, coeff_X_pow, if_neg, mul_zero],
29+
{ erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg, mul_zero],
3130
rintro rfl, exact not_lt_of_ge degree_le_nat_degree h },
3231
{ have : nat_degree f = n, from nat_degree_eq_of_degree_eq_some h.symm,
3332
rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leading_coeff, this, coeff_map] },
@@ -39,17 +38,17 @@ end)
3938

4039
lemma le_nat_degree_of_map_eq_mul_X_pow {n : ℕ}
4140
{P : ideal R} (hP : P.is_prime) {q : polynomial R} {c : polynomial P.quotient}
42-
(hq : map (mk_hom P) q = c * X ^ n) (hc0 : c.degree = 0) : n ≤ q.nat_degree :=
41+
(hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) : n ≤ q.nat_degree :=
4342
with_bot.coe_le_coe.1
44-
(calc ↑n = degree (q.map (mk_hom P)) :
43+
(calc ↑n = degree (q.map (mk P)) :
4544
by rw [hq, degree_mul, hc0, zero_add, degree_pow, degree_X, nsmul_one, nat.cast_with_bot]
4645
... ≤ degree q : degree_map_le _
4746
... ≤ nat_degree q : degree_le_nat_degree)
4847

4948
lemma eval_zero_mem_ideal_of_eq_mul_X_pow {n : ℕ} {P : ideal R}
5049
{q : polynomial R} {c : polynomial P.quotient}
51-
(hq : map (mk_hom P) q = c * X ^ n) (hn0 : 0 < n) : eval 0 q ∈ P :=
52-
by rw [← coeff_zero_eq_eval_zero, ← eq_zero_iff_mem, mk_eq_mk_hom, ← coeff_map,
50+
(hq : map (mk P) q = c * X ^ n) (hn0 : 0 < n) : eval 0 q ∈ P :=
51+
by rw [← coeff_zero_eq_eval_zero, ← eq_zero_iff_mem, ← coeff_map,
5352
coeff_zero_eq_eval_zero, hq, eval_mul, eval_pow, eval_X, zero_pow hn0, mul_zero]
5453

5554
lemma is_unit_of_nat_degree_eq_zero_of_forall_dvd_is_unit {p q : polynomial R}
@@ -76,7 +75,7 @@ theorem irreducible_of_eisenstein_criterion {f : polynomial R} {P : ideal R} (hP
7675
(hfd0 : 0 < degree f) (h0 : f.coeff 0 ∉ P^2)
7776
(hu : ∀ x : R, C x ∣ f → is_unit x) : irreducible f :=
7877
have hf0 : f ≠ 0, from λ _, by simp only [*, not_true, submodule.zero_mem, coeff_zero] at *,
79-
have hf : f.map (mk_hom P) = C (mk_hom P (leading_coeff f)) * X ^ nat_degree f,
78+
have hf : f.map (mk P) = C (mk P (leading_coeff f)) * X ^ nat_degree f,
8079
from map_eq_C_mul_X_pow_of_forall_coeff_mem hfP hf0,
8180
have hfd0 : 0 < f.nat_degree, from with_bot.coe_lt_coe.1
8281
(lt_of_lt_of_le hfd0 degree_le_nat_degree),
@@ -94,8 +93,8 @@ begin
9493
exact ideal.mul_mem_mul
9594
(eval_zero_mem_ideal_of_eq_mul_X_pow hp hm0)
9695
(eval_zero_mem_ideal_of_eq_mul_X_pow hq hn0) },
97-
have hpql0 : (mk_hom P) (p * q).leading_coeff ≠ 0,
98-
{ rwa [← mk_eq_mk_hom, ne.def, eq_zero_iff_mem] },
96+
have hpql0 : (mk P) (p * q).leading_coeff ≠ 0,
97+
{ rwa [ne.def, eq_zero_iff_mem] },
9998
have hp0 : p ≠ 0, from λ h, by simp only [*, zero_mul, eq_self_iff_true, not_true, ne.def] at *,
10099
have hq0 : q ≠ 0, from λ h, by simp only [*, eq_self_iff_true, not_true, ne.def, mul_zero] at *,
101100
have hbc0 : degree b = 0 ∧ degree c = 0,

src/ring_theory/ideal_operations.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ begin
180180
{ split_ifs with h, { apply hg1 }, rw sub_self, exact (f i).zero_mem },
181181
{ intros hjs hji, rw dif_pos, { apply hg2 }, exact ⟨hjs, hji⟩ } },
182182
rcases this with ⟨g, hgi, hgj⟩, use (∏ x in s.erase i, g x), split,
183-
{ rw [← quotient.eq, quotient.mk_one, quotient.mk_prod],
184-
apply finset.prod_eq_one, intros, rw [← quotient.mk_one, quotient.eq], apply hgi },
185-
intros j hjs hji, rw [← quotient.eq_zero_iff_mem, quotient.mk_prod],
183+
{ rw [← quotient.eq, ring_hom.map_one, ring_hom.map_prod],
184+
apply finset.prod_eq_one, intros, rw [← ring_hom.map_one, quotient.eq], apply hgi },
185+
intros j hjs hji, rw [← quotient.eq_zero_iff_mem, ring_hom.map_prod],
186186
refine finset.prod_eq_zero (finset.mem_erase_of_ne_of_mem hji hjs) _,
187187
rw quotient.eq_zero_iff_mem, exact hgj j hjs hji
188188
end
@@ -199,20 +199,20 @@ begin
199199
rcases this with ⟨φ, hφ1, hφ2⟩,
200200
use ∑ i, g i * φ i,
201201
intros i,
202-
rw [← quotient.eq, quotient.mk_sum],
202+
rw [← quotient.eq, ring_hom.map_sum],
203203
refine eq.trans (finset.sum_eq_single i _ _) _,
204204
{ intros j _ hji, rw quotient.eq_zero_iff_mem, exact (f i).mul_mem_left (hφ2 j i hji) },
205205
{ intros hi, exact (hi $ finset.mem_univ i).elim },
206-
specialize hφ1 i, rw [← quotient.eq, quotient.mk_one] at1,
207-
rw [quotient.mk_mul, hφ1, mul_one]
206+
specialize hφ1 i, rw [← quotient.eq, ring_hom.map_one] at1,
207+
rw [ring_hom.map_mul, hφ1, mul_one]
208208
end
209209

210210
def quotient_inf_to_pi_quotient (f : ι → ideal R) :
211211
(⨅ i, f i).quotient →+* Π i, (f i).quotient :=
212212
begin
213213
refine quotient.lift (⨅ i, f i) _ _,
214214
{ convert @@pi.ring_hom (λ i, quotient (f i)) (λ i, ring.to_semiring) ring.to_semiring
215-
(λ i, quotient.mk_hom (f i)) },
215+
(λ i, quotient.mk (f i)) },
216216
{ intros r hr,
217217
rw submodule.mem_infi at hr,
218218
ext i,
@@ -552,7 +552,7 @@ le_antisymm (λ r ⟨n, hfrnk⟩, ⟨n, show f (r ^ n) ∈ K,
552552
(λ r ⟨n, hfrnk⟩, ⟨n, f.map_pow r n ▸ hfrnk⟩)
553553

554554
@[simp] lemma map_quotient_self :
555-
map (quotient.mk_hom I) I = ⊥ :=
555+
map (quotient.mk I) I = ⊥ :=
556556
eq_bot_iff.2 $ ideal.map_le_iff_le_comap.2 $ λ x hx,
557557
(submodule.mem_bot I.quotient).2 $ ideal.quotient.eq_zero_iff_mem.2 hx
558558

src/ring_theory/ideals.lean

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -180,72 +180,42 @@ def quotient (I : ideal α) := I.quotient
180180
namespace quotient
181181
variables {I} {x y : α}
182182

183-
/-- The map from a ring `R` to a quotient ring `R/I`. -/
184-
def mk (I : ideal α) (a : α) : I.quotient := submodule.quotient.mk a
185-
186-
instance : inhabited (quotient I) := ⟨mk I 37
187-
188-
protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := submodule.quotient.eq I
189-
190-
instance (I : ideal α) : has_one I.quotient := ⟨mk I 1
191-
192-
@[simp] lemma mk_one (I : ideal α) : mk I 1 = 1 := rfl
183+
instance (I : ideal α) : has_one I.quotient := ⟨submodule.quotient.mk 1
193184

194185
instance (I : ideal α) : has_mul I.quotient :=
195-
⟨λ a b, quotient.lift_on₂' a b (λ a b, mk I (a * b)) $
186+
⟨λ a b, quotient.lift_on₂' a b (λ a b, submodule.quotient.mk (a * b)) $
196187
λ a₁ a₂ b₁ b₂ h₁ h₂, quot.sound $ begin
197188
refine calc a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ : _
198189
... ∈ I : I.add_mem (I.mul_mem_left h₁) (I.mul_mem_right h₂),
199190
rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁]
200191
end
201192

202-
@[simp] theorem mk_mul : mk I (x * y) = mk I x * mk I y := rfl
203-
204193
instance (I : ideal α) : comm_ring I.quotient :=
205194
{ mul := (*),
206195
one := 1,
207196
mul_assoc := λ a b c, quotient.induction_on₃' a b c $
208-
λ a b c, congr_arg (mk _) (mul_assoc a b c),
197+
λ a b c, congr_arg submodule.quotient.mk (mul_assoc a b c),
209198
mul_comm := λ a b, quotient.induction_on₂' a b $
210-
λ a b, congr_arg (mk _) (mul_comm a b),
199+
λ a b, congr_arg submodule.quotient.mk (mul_comm a b),
211200
one_mul := λ a, quotient.induction_on' a $
212-
λ a, congr_arg (mk _) (one_mul a),
201+
λ a, congr_arg submodule.quotient.mk (one_mul a),
213202
mul_one := λ a, quotient.induction_on' a $
214-
λ a, congr_arg (mk _) (mul_one a),
203+
λ a, congr_arg submodule.quotient.mk (mul_one a),
215204
left_distrib := λ a b c, quotient.induction_on₃' a b c $
216-
λ a b c, congr_arg (mk _) (left_distrib a b c),
205+
λ a b c, congr_arg submodule.quotient.mk (left_distrib a b c),
217206
right_distrib := λ a b c, quotient.induction_on₃' a b c $
218-
λ a b c, congr_arg (mk _) (right_distrib a b c),
207+
λ a b c, congr_arg submodule.quotient.mk (right_distrib a b c),
219208
..submodule.quotient.add_comm_group I }
220209

221-
/-- `ideal.quotient.mk` as a `ring_hom` -/
222-
def mk_hom (I : ideal α) : α →+* I.quotient := ⟨mk I, rfl, λ _ _, rfl, rfl, λ _ _, rfl⟩
223-
224-
lemma mk_eq_mk_hom (I : ideal α) (x : α) : ideal.quotient.mk I x = ideal.quotient.mk_hom I x := rfl
225-
226-
/-- The image of an ideal J under the quotient map `R → R/I`. -/
227-
def map_mk (I J : ideal α) : ideal I.quotient :=
228-
{ carrier := mk I '' J,
229-
zero_mem' := ⟨0, J.zero_mem, rfl⟩,
230-
add_mem' := by rintro _ _ ⟨x, hx, rfl⟩ ⟨y, hy, rfl⟩;
231-
exact ⟨x + y, J.add_mem hx hy, rfl⟩,
232-
smul_mem' := by rintro ⟨c⟩ _ ⟨x, hx, rfl⟩;
233-
exact ⟨c * x, J.mul_mem_left hx, rfl⟩ }
210+
/-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/
211+
def mk (I : ideal α) : α →+* I.quotient :=
212+
⟨λ a, submodule.quotient.mk a, rfl, λ _ _, rfl, rfl, λ _ _, rfl⟩
234213

235-
@[simp] lemma mk_zero (I : ideal α) : mk I 0 = 0 := rfl
236-
@[simp] lemma mk_add (I : ideal α) (a b : α) : mk I (a + b) = mk I a + mk I b := rfl
237-
@[simp] lemma mk_neg (I : ideal α) (a : α) : mk I (-a : α) = -mk I a := rfl
238-
@[simp] lemma mk_sub (I : ideal α) (a b : α) : mk I (a - b : α) = mk I a - mk I b := rfl
239-
@[simp] lemma mk_pow (I : ideal α) (a : α) (n : ℕ) : mk I (a ^ n : α) = mk I a ^ n :=
240-
(mk_hom I).map_pow a n
214+
instance : inhabited (quotient I) := ⟨mk I 37
241215

242-
lemma mk_prod {ι} (I : ideal α) (s : finset ι) (f : ι → α) :
243-
mk I (∏ i in s, f i) = ∏ i in s, mk I (f i) :=
244-
(mk_hom I).map_prod f s
216+
protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := submodule.quotient.eq I
245217

246-
lemma mk_sum {ι} (I : ideal α) (s : finset ι) (f : ι → α) :
247-
mk I (∑ i in s, f i) = ∑ i in s, mk I (f i) :=
248-
(mk_hom I).map_sum f s
218+
@[simp] theorem mk_eq_mk (x : α) : (submodule.quotient.mk x : quotient I) = mk I x := rfl
249219

250220
lemma eq_zero_iff_mem {I : ideal α} : mk I a = 0 ↔ a ∈ I :=
251221
by conv {to_rhs, rw ← sub_zero a }; exact quotient.eq'
@@ -505,15 +475,15 @@ noncomputable instance : inhabited (residue_field α) := ⟨37⟩
505475

506476
/-- The quotient map from a local ring to its residue field. -/
507477
def residue : α →+* (residue_field α) :=
508-
ideal.quotient.mk_hom _
478+
ideal.quotient.mk _
509479

510480
namespace residue_field
511481

512482
variables {α β}
513483
/-- The map on residue fields induced by a local homomorphism between local rings -/
514484
noncomputable def map (f : α →+* β) [is_local_ring_hom f] :
515485
residue_field α →+* residue_field β :=
516-
ideal.quotient.lift (maximal_ideal α) ((ideal.quotient.mk_hom _).comp f) $
486+
ideal.quotient.lift (maximal_ideal α) ((ideal.quotient.mk _).comp f) $
517487
λ a ha,
518488
begin
519489
erw ideal.quotient.eq_zero_iff_mem,

src/ring_theory/noetherian.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ begin
9292
{ rw [sub_right_comm], exact I.sub_mem hr1 hci },
9393
{ rw [sub_smul, ← hyz, add_sub_cancel'], exact hz } },
9494
rcases this with ⟨c, hc1, hci⟩, refine ⟨c * r, _, _, hs.2⟩,
95-
{ rw [← ideal.quotient.eq, ideal.quotient.mk_one] at hr1 hc1 ⊢,
96-
rw [ideal.quotient.mk_mul, hc1, hr1, mul_one] },
95+
{ rw [← ideal.quotient.eq, ring_hom.map_one] at hr1 hc1 ⊢,
96+
rw [ring_hom.map_mul, hc1, hr1, mul_one] },
9797
{ intros n hn, specialize hrn hn, rw [mem_comap, mem_sup] at hrn,
9898
rcases hrn with ⟨y, hy, z, hz, hyz⟩, change y + z = r • n at hyz,
9999
rw mem_smul_span_singleton at hy, rcases hy with ⟨d, hdi, rfl⟩,

src/ring_theory/valuation/basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def on_quot {J : ideal R} (hJ : J ≤ supp v) :
339339
map_add' := λ xbar ybar, quotient.ind₂' v.map_add xbar ybar }
340340

341341
@[simp] lemma on_quot_comap_eq {J : ideal R} (hJ : J ≤ supp v) :
342-
(v.on_quot hJ).comap (ideal.quotient.mk_hom J) = v :=
342+
(v.on_quot hJ).comap (ideal.quotient.mk J) = v :=
343343
ext $ λ r,
344344
begin
345345
refine @quotient.lift_on_beta _ _ (J.quotient_rel) v (λ a b h, _) _,
@@ -356,16 +356,16 @@ begin
356356
end
357357

358358
lemma self_le_supp_comap (J : ideal R) (v : valuation (quotient J) Γ₀) :
359-
J ≤ (v.comap (ideal.quotient.mk_hom J)).supp :=
359+
J ≤ (v.comap (ideal.quotient.mk J)).supp :=
360360
by { rw [comap_supp, ← ideal.map_le_iff_le_comap], simp }
361361

362362
@[simp] lemma comap_on_quot_eq (J : ideal R) (v : valuation J.quotient Γ₀) :
363-
(v.comap (ideal.quotient.mk_hom J)).on_quot (v.self_le_supp_comap J) = v :=
363+
(v.comap (ideal.quotient.mk J)).on_quot (v.self_le_supp_comap J) = v :=
364364
ext $ by { rintro ⟨x⟩, refl }
365365

366366
/-- The quotient valuation on R/J has support supp(v)/J if J ⊆ supp v. -/
367367
lemma supp_quot {J : ideal R} (hJ : J ≤ supp v) :
368-
supp (v.on_quot hJ) = (supp v).map (ideal.quotient.mk_hom J) :=
368+
supp (v.on_quot hJ) = (supp v).map (ideal.quotient.mk J) :=
369369
begin
370370
apply le_antisymm,
371371
{ rintro ⟨x⟩ hx,

0 commit comments

Comments
 (0)