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

Commit b812fb9

Browse files
committed
refactor(ring_theory/ideal): split off quotient.lean (#9850)
Both `ring_theory/ideal/basic.lean` and `ring_theory/ideal/operations.lean` were starting to get a bit long, so I split off the definition of `ideal.quotient` and the results that had no further dependencies. I also went through all the imports for files depending on either `ideal/basic.lean` or `ideal/operations.lean` to check whether they shouldn't depend on `ideal/quotient.lean` instead. Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
1 parent e6c516d commit b812fb9

File tree

18 files changed

+406
-375
lines changed

18 files changed

+406
-375
lines changed

src/algebra/ring_quot.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Scott Morrison
55
-/
66
import algebra.algebra.basic
7-
import ring_theory.ideal.basic
7+
import ring_theory.ideal.quotient
88

99
/-!
1010
# Quotients of non-commutative rings

src/linear_algebra/adic_completion.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Kenny Lau
55
-/
66

77
import linear_algebra.smodeq
8-
import ring_theory.ideal.operations
8+
import ring_theory.ideal.quotient
99
import ring_theory.jacobson_ideal
1010

1111
/-!

src/linear_algebra/invariant_basis_number.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Copyright (c) 2020 Markus Himmel. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Markus Himmel, Scott Morrison
55
-/
6+
import ring_theory.ideal.quotient
67
import ring_theory.principal_ideal_domain
7-
import ring_theory.ideal.basic
88

99
/-!
1010
# Invariant basis number property

src/linear_algebra/smodeq.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kenny Lau
55
-/
66

7-
import ring_theory.ideal.basic
87
import data.polynomial.eval
8+
import ring_theory.ideal.quotient
99

1010
/-!
1111
# modular equivalence for submodule

src/number_theory/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Johan Commelin, Kenny Lau
55
-/
66

77
import algebra.geom_sum
8-
import ring_theory.ideal.basic
8+
import ring_theory.ideal.quotient
99

1010
/-!
1111
# Basic results in number theory

src/ring_theory/finiteness.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johan Commelin
55
-/
66

7-
import ring_theory.noetherian
8-
import ring_theory.ideal.operations
9-
import ring_theory.algebra_tower
107
import group_theory.finiteness
8+
import ring_theory.algebra_tower
9+
import ring_theory.ideal.quotient
10+
import ring_theory.noetherian
1111

1212
/-!
1313
# Finiteness conditions in commutative algebra

src/ring_theory/ideal/basic.lean

Lines changed: 1 addition & 274 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kenny Lau, Chris Hughes, Mario Carneiro
55
-/
66
import algebra.associated
7-
import linear_algebra.quotient
7+
import linear_algebra.basic
88
import order.zorn
99
import order.atoms
1010
import order.compactly_generated
@@ -22,8 +22,6 @@ This file defines `ideal R`, the type of ideals over a commutative ring `R`.
2222
## TODO
2323
2424
Support one-sided ideals, and ideals over non-commutative rings.
25-
26-
See `algebra.ring_quot` for quotients of non-commutative rings.
2725
-/
2826

2927
universes u v w
@@ -437,277 +435,6 @@ begin
437435
exact I.add_mem (I.mul_mem_right _ h1) (I.mul_mem_left _ h2),
438436
end
439437

440-
variables [comm_ring α] (I : ideal α) {a b : α}
441-
442-
/-- The quotient `R/I` of a ring `R` by an ideal `I`.
443-
444-
The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`.
445-
This definition is marked `reducible` so that typeclass instances can be shared between
446-
`ideal.quotient I` and `submodule.quotient I`.
447-
-/
448-
-- Note that at present `ideal` means a left-ideal,
449-
-- so this quotient is only useful in a commutative ring.
450-
-- We should develop quotients by two-sided ideals as well.
451-
@[reducible]
452-
def quotient (I : ideal α) := I.quotient
453-
454-
namespace quotient
455-
variables {I} {x y : α}
456-
457-
instance (I : ideal α) : has_one I.quotient := ⟨submodule.quotient.mk 1
458-
459-
instance (I : ideal α) : has_mul I.quotient :=
460-
⟨λ a b, quotient.lift_on₂' a b (λ a b, submodule.quotient.mk (a * b)) $
461-
λ a₁ a₂ b₁ b₂ h₁ h₂, quot.sound $ begin
462-
have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂),
463-
have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁,
464-
{ rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] },
465-
rw ← this at F,
466-
change _ ∈ _, convert F,
467-
end
468-
469-
instance (I : ideal α) : comm_ring I.quotient :=
470-
{ mul := (*),
471-
one := 1,
472-
mul_assoc := λ a b c, quotient.induction_on₃' a b c $
473-
λ a b c, congr_arg submodule.quotient.mk (mul_assoc a b c),
474-
mul_comm := λ a b, quotient.induction_on₂' a b $
475-
λ a b, congr_arg submodule.quotient.mk (mul_comm a b),
476-
one_mul := λ a, quotient.induction_on' a $
477-
λ a, congr_arg submodule.quotient.mk (one_mul a),
478-
mul_one := λ a, quotient.induction_on' a $
479-
λ a, congr_arg submodule.quotient.mk (mul_one a),
480-
left_distrib := λ a b c, quotient.induction_on₃' a b c $
481-
λ a b c, congr_arg submodule.quotient.mk (left_distrib a b c),
482-
right_distrib := λ a b c, quotient.induction_on₃' a b c $
483-
λ a b c, congr_arg submodule.quotient.mk (right_distrib a b c),
484-
..submodule.quotient.add_comm_group I }
485-
486-
/-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/
487-
def mk (I : ideal α) : α →+* I.quotient :=
488-
⟨λ a, submodule.quotient.mk a, rfl, λ _ _, rfl, rfl, λ _ _, rfl⟩
489-
490-
/- Two `ring_homs`s from the quotient by an ideal are equal if their
491-
compositions with `ideal.quotient.mk'` are equal.
492-
493-
See note [partially-applied ext lemmas]. -/
494-
@[ext]
495-
lemma ring_hom_ext [non_assoc_semiring β] ⦃f g : I.quotient →+* β⦄
496-
(h : f.comp (mk I) = g.comp (mk I)) : f = g :=
497-
ring_hom.ext $ λ x, quotient.induction_on' x $ (ring_hom.congr_fun h : _)
498-
499-
instance : inhabited (quotient I) := ⟨mk I 37
500-
501-
protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := submodule.quotient.eq I
502-
503-
@[simp] theorem mk_eq_mk (x : α) : (submodule.quotient.mk x : quotient I) = mk I x := rfl
504-
505-
lemma eq_zero_iff_mem {I : ideal α} : mk I a = 0 ↔ a ∈ I :=
506-
by conv {to_rhs, rw ← sub_zero a }; exact quotient.eq'
507-
508-
theorem zero_eq_one_iff {I : ideal α} : (0 : I.quotient) = 1 ↔ I = ⊤ :=
509-
eq_comm.trans $ eq_zero_iff_mem.trans (eq_top_iff_one _).symm
510-
511-
theorem zero_ne_one_iff {I : ideal α} : (0 : I.quotient) ≠ 1 ↔ I ≠ ⊤ :=
512-
not_congr zero_eq_one_iff
513-
514-
protected theorem nontrivial {I : ideal α} (hI : I ≠ ⊤) : nontrivial I.quotient :=
515-
⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩
516-
517-
lemma mk_surjective : function.surjective (mk I) :=
518-
λ y, quotient.induction_on' y (λ x, exists.intro x rfl)
519-
520-
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if
521-
`s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/
522-
lemma quotient_ring_saturate (I : ideal α) (s : set α) :
523-
mk I ⁻¹' (mk I '' s) = (⋃ x : I, (λ y, x.1 + y) '' s) :=
524-
begin
525-
ext x,
526-
simp only [mem_preimage, mem_image, mem_Union, ideal.quotient.eq],
527-
exact ⟨λ ⟨a, a_in, h⟩, ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩,
528-
λ ⟨⟨i, hi⟩, a, ha, eq⟩,
529-
⟨a, ha, by rw [← eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩
530-
end
531-
532-
instance (I : ideal α) [hI : I.is_prime] : is_domain I.quotient :=
533-
{ eq_zero_or_eq_zero_of_mul_eq_zero := λ a b,
534-
quotient.induction_on₂' a b $ λ a b hab,
535-
(hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim
536-
(or.inl ∘ eq_zero_iff_mem.2)
537-
(or.inr ∘ eq_zero_iff_mem.2),
538-
.. quotient.nontrivial hI.1 }
539-
540-
lemma is_domain_iff_prime (I : ideal α) : is_domain I.quotient ↔ I.is_prime :=
541-
⟨ λ ⟨h1, h2⟩, ⟨zero_ne_one_iff.1 $ @zero_ne_one _ _ ⟨h2⟩, λ x y h,
542-
by { simp only [←eq_zero_iff_mem, (mk I).map_mul] at ⊢ h, exact h1 h}⟩,
543-
λ h, by { resetI, apply_instance }⟩
544-
545-
lemma exists_inv {I : ideal α} [hI : I.is_maximal] :
546-
∀ {a : I.quotient}, a ≠ 0 → ∃ b : I.quotient, a * b = 1 :=
547-
begin
548-
rintro ⟨a⟩ h,
549-
rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩,
550-
rw [mul_comm] at abc,
551-
refine ⟨mk _ b, quot.sound _⟩, --quot.sound hb
552-
rw ← eq_sub_iff_add_eq' at abc,
553-
rw [abc, ← neg_mem_iff, neg_sub] at hc,
554-
convert hc,
555-
end
556-
557-
/-- quotient by maximal ideal is a field. def rather than instance, since users will have
558-
computable inverses in some applications.
559-
See note [reducible non-instances]. -/
560-
@[reducible]
561-
protected noncomputable def field (I : ideal α) [hI : I.is_maximal] : field I.quotient :=
562-
{ inv := λ a, if ha : a = 0 then 0 else classical.some (exists_inv ha),
563-
mul_inv_cancel := λ a (ha : a ≠ 0), show a * dite _ _ _ = _,
564-
by rw dif_neg ha;
565-
exact classical.some_spec (exists_inv ha),
566-
inv_zero := dif_pos rfl,
567-
..quotient.comm_ring I,
568-
..quotient.is_domain I }
569-
570-
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/
571-
theorem maximal_of_is_field (I : ideal α)
572-
(hqf : is_field I.quotient) : I.is_maximal :=
573-
begin
574-
apply ideal.is_maximal_iff.2,
575-
split,
576-
{ intro h,
577-
rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩,
578-
exact hxy (ideal.quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) },
579-
{ intros J x hIJ hxnI hxJ,
580-
rcases hqf.mul_inv_cancel (mt ideal.quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩,
581-
rw [← zero_add (1 : α), ← sub_self (x * y), sub_add],
582-
refine J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (ideal.quotient.eq.1 hy)) }
583-
end
584-
585-
/-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/
586-
theorem maximal_ideal_iff_is_field_quotient (I : ideal α) :
587-
I.is_maximal ↔ is_field I.quotient :=
588-
⟨λ h, @field.to_is_field I.quotient (@ideal.quotient.field _ _ I h),
589-
λ h, maximal_of_is_field I h⟩
590-
591-
variable [comm_ring β]
592-
593-
/-- Given a ring homomorphism `f : α →+* β` sending all elements of an ideal to zero,
594-
lift it to the quotient by this ideal. -/
595-
def lift (S : ideal α) (f : α →+* β) (H : ∀ (a : α), a ∈ S → f a = 0) :
596-
quotient S →+* β :=
597-
{ to_fun := λ x, quotient.lift_on' x f $ λ (a b) (h : _ ∈ _),
598-
eq_of_sub_eq_zero $ by rw [← f.map_sub, H _ h],
599-
map_one' := f.map_one,
600-
map_zero' := f.map_zero,
601-
map_add' := λ a₁ a₂, quotient.induction_on₂' a₁ a₂ f.map_add,
602-
map_mul' := λ a₁ a₂, quotient.induction_on₂' a₁ a₂ f.map_mul }
603-
604-
@[simp] lemma lift_mk (S : ideal α) (f : α →+* β) (H : ∀ (a : α), a ∈ S → f a = 0) :
605-
lift S f H (mk S a) = f a := rfl
606-
607-
/-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal.
608-
609-
This is the `ideal.quotient` version of `quot.factor` -/
610-
def factor (S T : ideal α) (H : S ≤ T) : S.quotient →+* T.quotient :=
611-
ideal.quotient.lift S (T^.quotient.mk) (λ x hx, eq_zero_iff_mem.2 (H hx))
612-
613-
@[simp] lemma factor_mk (S T : ideal α) (H : S ≤ T) (x : α) :
614-
factor S T H (mk S x) = mk T x := rfl
615-
616-
@[simp] lemma factor_comp_mk (S T : ideal α) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T :=
617-
by { ext x, rw [ring_hom.comp_apply, factor_mk] }
618-
619-
end quotient
620-
621-
/-- Quotienting by equal ideals gives equivalent rings.
622-
623-
See also `submodule.quot_equiv_of_eq`.
624-
-/
625-
def quot_equiv_of_eq {R : Type*} [comm_ring R] {I J : ideal R} (h : I = J) :
626-
I.quotient ≃+* J.quotient :=
627-
{ map_mul' := by { rintro ⟨x⟩ ⟨y⟩, refl },
628-
.. submodule.quot_equiv_of_eq I J h }
629-
630-
@[simp]
631-
lemma quot_equiv_of_eq_mk {R : Type*} [comm_ring R] {I J : ideal R} (h : I = J) (x : R) :
632-
quot_equiv_of_eq h (ideal.quotient.mk I x) = ideal.quotient.mk J x :=
633-
rfl
634-
635-
section pi
636-
variables (ι : Type v)
637-
638-
/-- `R^n/I^n` is a `R/I`-module. -/
639-
instance module_pi : module (I.quotient) (I.pi ι).quotient :=
640-
{ smul := λ c m, quotient.lift_on₂' c m (λ r m, submodule.quotient.mk $ r • m) begin
641-
intros c₁ m₁ c₂ m₂ hc hm,
642-
apply ideal.quotient.eq.2,
643-
intro i,
644-
exact I.mul_sub_mul_mem hc (hm i),
645-
end,
646-
one_smul := begin
647-
rintro ⟨a⟩,
648-
change ideal.quotient.mk _ _ = ideal.quotient.mk _ _,
649-
congr' with i, exact one_mul (a i),
650-
end,
651-
mul_smul := begin
652-
rintro ⟨a⟩ ⟨b⟩ ⟨c⟩,
653-
change ideal.quotient.mk _ _ = ideal.quotient.mk _ _,
654-
simp only [(•)],
655-
congr' with i, exact mul_assoc a b (c i),
656-
end,
657-
smul_add := begin
658-
rintro ⟨a⟩ ⟨b⟩ ⟨c⟩,
659-
change ideal.quotient.mk _ _ = ideal.quotient.mk _ _,
660-
congr' with i, exact mul_add a (b i) (c i),
661-
end,
662-
smul_zero := begin
663-
rintro ⟨a⟩,
664-
change ideal.quotient.mk _ _ = ideal.quotient.mk _ _,
665-
congr' with i, exact mul_zero a,
666-
end,
667-
add_smul := begin
668-
rintro ⟨a⟩ ⟨b⟩ ⟨c⟩,
669-
change ideal.quotient.mk _ _ = ideal.quotient.mk _ _,
670-
congr' with i, exact add_mul a b (c i),
671-
end,
672-
zero_smul := begin
673-
rintro ⟨a⟩,
674-
change ideal.quotient.mk _ _ = ideal.quotient.mk _ _,
675-
congr' with i, exact zero_mul (a i),
676-
end, }
677-
678-
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/
679-
noncomputable def pi_quot_equiv : (I.pi ι).quotient ≃ₗ[I.quotient] (ι → I.quotient) :=
680-
{ to_fun := λ x, quotient.lift_on' x (λ f i, ideal.quotient.mk I (f i)) $
681-
λ a b hab, funext (λ i, ideal.quotient.eq.2 (hab i)),
682-
map_add' := by { rintros ⟨_⟩ ⟨_⟩, refl },
683-
map_smul' := by { rintros ⟨_⟩ ⟨_⟩, refl },
684-
inv_fun := λ x, ideal.quotient.mk (I.pi ι) $ λ i, quotient.out' (x i),
685-
left_inv :=
686-
begin
687-
rintro ⟨x⟩,
688-
exact ideal.quotient.eq.2 (λ i, ideal.quotient.eq.1 (quotient.out_eq' _))
689-
end,
690-
right_inv :=
691-
begin
692-
intro x,
693-
ext i,
694-
obtain ⟨r, hr⟩ := @quot.exists_rep _ _ (x i),
695-
simp_rw ←hr,
696-
convert quotient.out_eq' _
697-
end }
698-
699-
/-- If `f : R^n → R^m` is an `R`-linear map and `I ⊆ R` is an ideal, then the image of `I^n` is
700-
contained in `I^m`. -/
701-
lemma map_pi {ι} [fintype ι] {ι' : Type w} (x : ι → α) (hi : ∀ i, x i ∈ I)
702-
(f : (ι → α) →ₗ[α] (ι' → α)) (i : ι') : f x i ∈ I :=
703-
begin
704-
rw pi_eq_sum_univ x,
705-
simp only [finset.sum_apply, smul_eq_mul, linear_map.map_sum, pi.smul_apply, linear_map.map_smul],
706-
exact I.sum_mem (λ j hj, I.mul_mem_right _ (hi j))
707-
end
708-
709-
end pi
710-
711438
end ideal
712439

713440
end comm_ring

src/ring_theory/ideal/local_ring.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kenny Lau, Chris Hughes, Mario Carneiro
55
-/
66

7-
import ring_theory.ideal.operations
87
import algebra.algebra.basic
98
import algebra.category.CommRing.basic
9+
import ring_theory.ideal.operations
1010

1111
/-!
1212

0 commit comments

Comments
 (0)