state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
α : Type u_1 β : Type u_2 p a b : ℕ hp : p ≠ 1 hle : multiplicity p a ≤ multiplicity p b hab : Coprime a b ⊢ multiplicity p a = 0
/- Copyright (c) 2018 Robert Y. Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Y. Lewis, Chris Hughes -/ import Mathlib.Algebra.Associated import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.PartENat import Mathlib.Tactic.Linarith #align_import ring_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Multiplicity of a divisor For a commutative monoid, this file introduces the notion of multiplicity of a divisor and proves several basic results on it. ## Main definitions * `multiplicity a b`: for two elements `a` and `b` of a commutative monoid returns the largest number `n` such that `a ^ n ∣ b` or infinity, written `⊤`, if `a ^ n ∣ b` for all natural numbers `n`. * `multiplicity.Finite a b`: a predicate denoting that the multiplicity of `a` in `b` is finite. -/ variable {α β : Type*} open Nat Part open BigOperators /-- `multiplicity a b` returns the largest natural number `n` such that `a ^ n ∣ b`, as a `PartENat` or natural with infinity. If `∀ n, a ^ n ∣ b`, then it returns `⊤`-/ def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat := PartENat.find fun n => ¬a ^ (n + 1) ∣ b #align multiplicity multiplicity namespace multiplicity section Monoid variable [Monoid α] [Monoid β] /-- `multiplicity.Finite a b` indicates that the multiplicity of `a` in `b` is finite. -/ @[reducible] def Finite (a b : α) : Prop := ∃ n : ℕ, ¬a ^ (n + 1) ∣ b #align multiplicity.finite multiplicity.Finite theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} : Finite a b ↔ (multiplicity a b).Dom := Iff.rfl #align multiplicity.finite_iff_dom multiplicity.finite_iff_dom theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b := Iff.rfl #align multiplicity.finite_def multiplicity.finite_def theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 := fun ⟨n, hn⟩ ⟨d, hd⟩ => hn ⟨d ^ (n + 1), (pow_mul_pow_eq_one (n + 1) hd.symm).symm⟩ #align multiplicity.not_dvd_one_of_finite_one_right multiplicity.not_dvd_one_of_finite_one_right @[norm_cast] theorem Int.coe_nat_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b := by apply Part.ext' · rw [← @finite_iff_dom ℕ, @finite_def ℕ, ← @finite_iff_dom ℤ, @finite_def ℤ] norm_cast · intro h1 h2 apply _root_.le_antisymm <;> · apply Nat.find_mono norm_cast simp #align multiplicity.int.coe_nat_multiplicity multiplicity.Int.coe_nat_multiplicity theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b := ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) (by simpa [Finite, Classical.not_not] using h), by simp [Finite, multiplicity, Classical.not_not]; tauto⟩ #align multiplicity.not_finite_iff_forall multiplicity.not_finite_iff_forall theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a := let ⟨n, hn⟩ := h hn ∘ IsUnit.dvd ∘ IsUnit.pow (n + 1) #align multiplicity.not_unit_of_finite multiplicity.not_unit_of_finite theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b := fun ⟨n, hn⟩ => ⟨n, fun h => hn (h.trans (dvd_mul_right _ _))⟩ #align multiplicity.finite_of_finite_mul_right multiplicity.finite_of_finite_mul_right variable [DecidableRel ((· ∣ ·) : α → α → Prop)] [DecidableRel ((· ∣ ·) : β → β → Prop)] theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} : (k : PartENat) ≤ multiplicity a b → a ^ k ∣ b := by rw [← PartENat.some_eq_natCast] exact Nat.casesOn k (fun _ => by rw [_root_.pow_zero] exact one_dvd _) fun k ⟨_, h₂⟩ => by_contradiction fun hk => Nat.find_min _ (lt_of_succ_le (h₂ ⟨k, hk⟩)) hk #align multiplicity.pow_dvd_of_le_multiplicity multiplicity.pow_dvd_of_le_multiplicity theorem pow_multiplicity_dvd {a b : α} (h : Finite a b) : a ^ get (multiplicity a b) h ∣ b := pow_dvd_of_le_multiplicity (by rw [PartENat.natCast_get]) #align multiplicity.pow_multiplicity_dvd multiplicity.pow_multiplicity_dvd theorem is_greatest {a b : α} {m : ℕ} (hm : multiplicity a b < m) : ¬a ^ m ∣ b := fun h => by rw [PartENat.lt_coe_iff] at hm; exact Nat.find_spec hm.fst ((pow_dvd_pow _ hm.snd).trans h) #align multiplicity.is_greatest multiplicity.is_greatest theorem is_greatest' {a b : α} {m : ℕ} (h : Finite a b) (hm : get (multiplicity a b) h < m) : ¬a ^ m ∣ b := is_greatest (by rwa [← PartENat.coe_lt_coe, PartENat.natCast_get] at hm) #align multiplicity.is_greatest' multiplicity.is_greatest' theorem pos_of_dvd {a b : α} (hfin : Finite a b) (hdiv : a ∣ b) : 0 < (multiplicity a b).get hfin := by refine' zero_lt_iff.2 fun h => _ simpa [hdiv] using is_greatest' hfin (lt_one_iff.mpr h) #align multiplicity.pos_of_dvd multiplicity.pos_of_dvd theorem unique {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : (k : PartENat) = multiplicity a b := le_antisymm (le_of_not_gt fun hk' => is_greatest hk' hk) <| by have : Finite a b := ⟨k, hsucc⟩ rw [PartENat.le_coe_iff] exact ⟨this, Nat.find_min' _ hsucc⟩ #align multiplicity.unique multiplicity.unique theorem unique' {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : k = get (multiplicity a b) ⟨k, hsucc⟩ := by rw [← PartENat.natCast_inj, PartENat.natCast_get, unique hk hsucc] #align multiplicity.unique' multiplicity.unique' theorem le_multiplicity_of_pow_dvd {a b : α} {k : ℕ} (hk : a ^ k ∣ b) : (k : PartENat) ≤ multiplicity a b := le_of_not_gt fun hk' => is_greatest hk' hk #align multiplicity.le_multiplicity_of_pow_dvd multiplicity.le_multiplicity_of_pow_dvd theorem pow_dvd_iff_le_multiplicity {a b : α} {k : ℕ} : a ^ k ∣ b ↔ (k : PartENat) ≤ multiplicity a b := ⟨le_multiplicity_of_pow_dvd, pow_dvd_of_le_multiplicity⟩ #align multiplicity.pow_dvd_iff_le_multiplicity multiplicity.pow_dvd_iff_le_multiplicity theorem multiplicity_lt_iff_not_dvd {a b : α} {k : ℕ} : multiplicity a b < (k : PartENat) ↔ ¬a ^ k ∣ b := by rw [pow_dvd_iff_le_multiplicity, not_le] #align multiplicity.multiplicity_lt_iff_neg_dvd multiplicity.multiplicity_lt_iff_not_dvd theorem eq_coe_iff {a b : α} {n : ℕ} : multiplicity a b = (n : PartENat) ↔ a ^ n ∣ b ∧ ¬a ^ (n + 1) ∣ b := by rw [← PartENat.some_eq_natCast] exact ⟨fun h => let ⟨h₁, h₂⟩ := eq_some_iff.1 h h₂ ▸ ⟨pow_multiplicity_dvd _, is_greatest (by rw [PartENat.lt_coe_iff] exact ⟨h₁, lt_succ_self _⟩)⟩, fun h => eq_some_iff.2 ⟨⟨n, h.2⟩, Eq.symm <| unique' h.1 h.2⟩⟩ #align multiplicity.eq_coe_iff multiplicity.eq_coe_iff theorem eq_top_iff {a b : α} : multiplicity a b = ⊤ ↔ ∀ n : ℕ, a ^ n ∣ b := (PartENat.find_eq_top_iff _).trans <| by simp only [Classical.not_not] exact ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) fun n => h _, fun h n => h _⟩ #align multiplicity.eq_top_iff multiplicity.eq_top_iff @[simp] theorem isUnit_left {a : α} (b : α) (ha : IsUnit a) : multiplicity a b = ⊤ := eq_top_iff.2 fun _ => IsUnit.dvd (ha.pow _) #align multiplicity.is_unit_left multiplicity.isUnit_left -- @[simp] Porting note: simp can prove this theorem one_left (b : α) : multiplicity 1 b = ⊤ := isUnit_left b isUnit_one #align multiplicity.one_left multiplicity.one_left @[simp] theorem get_one_right {a : α} (ha : Finite a 1) : get (multiplicity a 1) ha = 0 := by rw [PartENat.get_eq_iff_eq_coe, eq_coe_iff, _root_.pow_zero] simp [not_dvd_one_of_finite_one_right ha] #align multiplicity.get_one_right multiplicity.get_one_right -- @[simp] Porting note: simp can prove this theorem unit_left (a : α) (u : αˣ) : multiplicity (u : α) a = ⊤ := isUnit_left a u.isUnit #align multiplicity.unit_left multiplicity.unit_left theorem multiplicity_eq_zero {a b : α} : multiplicity a b = 0 ↔ ¬a ∣ b := by rw [← Nat.cast_zero, eq_coe_iff] simp only [_root_.pow_zero, isUnit_one, IsUnit.dvd, zero_add, pow_one, true_and] #align multiplicity.multiplicity_eq_zero multiplicity.multiplicity_eq_zero theorem multiplicity_ne_zero {a b : α} : multiplicity a b ≠ 0 ↔ a ∣ b := multiplicity_eq_zero.not_left #align multiplicity.multiplicity_ne_zero multiplicity.multiplicity_ne_zero theorem eq_top_iff_not_finite {a b : α} : multiplicity a b = ⊤ ↔ ¬Finite a b := Part.eq_none_iff' #align multiplicity.eq_top_iff_not_finite multiplicity.eq_top_iff_not_finite theorem ne_top_iff_finite {a b : α} : multiplicity a b ≠ ⊤ ↔ Finite a b := by rw [Ne.def, eq_top_iff_not_finite, Classical.not_not] #align multiplicity.ne_top_iff_finite multiplicity.ne_top_iff_finite theorem lt_top_iff_finite {a b : α} : multiplicity a b < ⊤ ↔ Finite a b := by rw [lt_top_iff_ne_top, ne_top_iff_finite] #align multiplicity.lt_top_iff_finite multiplicity.lt_top_iff_finite theorem exists_eq_pow_mul_and_not_dvd {a b : α} (hfin : Finite a b) : ∃ c : α, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c := by obtain ⟨c, hc⟩ := multiplicity.pow_multiplicity_dvd hfin refine' ⟨c, hc, _⟩ rintro ⟨k, hk⟩ rw [hk, ← mul_assoc, ← _root_.pow_succ'] at hc have h₁ : a ^ ((multiplicity a b).get hfin + 1) ∣ b := ⟨k, hc⟩ exact (multiplicity.eq_coe_iff.1 (by simp)).2 h₁ #align multiplicity.exists_eq_pow_mul_and_not_dvd multiplicity.exists_eq_pow_mul_and_not_dvd theorem multiplicity_le_multiplicity_iff {a b : α} {c d : β} : multiplicity a b ≤ multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b → c ^ n ∣ d := ⟨fun h n hab => pow_dvd_of_le_multiplicity (le_trans (le_multiplicity_of_pow_dvd hab) h), fun h => letI := Classical.dec (Finite a b) if hab : Finite a b then by rw [← PartENat.natCast_get (finite_iff_dom.1 hab)]; exact le_multiplicity_of_pow_dvd (h _ (pow_multiplicity_dvd _)) else by have : ∀ n : ℕ, c ^ n ∣ d := fun n => h n (not_finite_iff_forall.1 hab _) rw [eq_top_iff_not_finite.2 hab, eq_top_iff_not_finite.2 (not_finite_iff_forall.2 this)]⟩ #align multiplicity.multiplicity_le_multiplicity_iff multiplicity.multiplicity_le_multiplicity_iff theorem multiplicity_eq_multiplicity_iff {a b : α} {c d : β} : multiplicity a b = multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b ↔ c ^ n ∣ d := ⟨fun h n => ⟨multiplicity_le_multiplicity_iff.mp h.le n, multiplicity_le_multiplicity_iff.mp h.ge n⟩, fun h => le_antisymm (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mp) (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mpr)⟩ #align multiplicity.multiplicity_eq_multiplicity_iff multiplicity.multiplicity_eq_multiplicity_iff theorem le_multiplicity_map {F : Type*} [MonoidHomClass F α β] (f : F) {a b : α} : multiplicity a b ≤ multiplicity (f a) (f b) := multiplicity_le_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd f theorem multiplicity_map_eq {F : Type*} [MulEquivClass F α β] (f : F) {a b : α} : multiplicity (f a) (f b) = multiplicity a b := multiplicity_eq_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd_iff f theorem multiplicity_le_multiplicity_of_dvd_right {a b c : α} (h : b ∣ c) : multiplicity a b ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun _ hb => hb.trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_right multiplicity.multiplicity_le_multiplicity_of_dvd_right theorem eq_of_associated_right {a b c : α} (h : Associated b c) : multiplicity a b = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_right h.dvd) (multiplicity_le_multiplicity_of_dvd_right h.symm.dvd) #align multiplicity.eq_of_associated_right multiplicity.eq_of_associated_right theorem dvd_of_multiplicity_pos {a b : α} (h : (0 : PartENat) < multiplicity a b) : a ∣ b := by rw [← pow_one a] apply pow_dvd_of_le_multiplicity simpa only [Nat.cast_one, PartENat.pos_iff_one_le] using h #align multiplicity.dvd_of_multiplicity_pos multiplicity.dvd_of_multiplicity_pos theorem dvd_iff_multiplicity_pos {a b : α} : (0 : PartENat) < multiplicity a b ↔ a ∣ b := ⟨dvd_of_multiplicity_pos, fun hdvd => lt_of_le_of_ne (zero_le _) fun heq => is_greatest (show multiplicity a b < ↑1 by simpa only [heq, Nat.cast_zero] using PartENat.coe_lt_coe.mpr zero_lt_one) (by rwa [pow_one a])⟩ #align multiplicity.dvd_iff_multiplicity_pos multiplicity.dvd_iff_multiplicity_pos theorem finite_nat_iff {a b : ℕ} : Finite a b ↔ a ≠ 1 ∧ 0 < b := by rw [← not_iff_not, not_finite_iff_forall, not_and_or, Ne.def, Classical.not_not, not_lt, le_zero_iff] exact ⟨fun h => or_iff_not_imp_right.2 fun hb => have ha : a ≠ 0 := fun ha => hb <| zero_dvd_iff.mp <| by rw [ha] at h; exact h 1 Classical.by_contradiction fun ha1 : a ≠ 1 => have ha_gt_one : 1 < a := lt_of_not_ge fun _ => match a with | 0 => ha rfl | 1 => ha1 rfl | b+2 => by linarith not_lt_of_ge (le_of_dvd (Nat.pos_of_ne_zero hb) (h b)) (lt_pow_self ha_gt_one b), fun h => by cases h <;> simp [*]⟩ #align multiplicity.finite_nat_iff multiplicity.finite_nat_iff alias ⟨_, _root_.has_dvd.dvd.multiplicity_pos⟩ := dvd_iff_multiplicity_pos end Monoid section CommMonoid variable [CommMonoid α] theorem finite_of_finite_mul_left {a b c : α} : Finite a (b * c) → Finite a c := by rw [mul_comm]; exact finite_of_finite_mul_right #align multiplicity.finite_of_finite_mul_left multiplicity.finite_of_finite_mul_left variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem isUnit_right {a b : α} (ha : ¬IsUnit a) (hb : IsUnit b) : multiplicity a b = 0 := eq_coe_iff.2 ⟨show a ^ 0 ∣ b by simp only [_root_.pow_zero, one_dvd], by rw [pow_one] exact fun h => mt (isUnit_of_dvd_unit h) ha hb⟩ #align multiplicity.is_unit_right multiplicity.isUnit_right theorem one_right {a : α} (ha : ¬IsUnit a) : multiplicity a 1 = 0 := isUnit_right ha isUnit_one #align multiplicity.one_right multiplicity.one_right theorem unit_right {a : α} (ha : ¬IsUnit a) (u : αˣ) : multiplicity a u = 0 := isUnit_right ha u.isUnit #align multiplicity.unit_right multiplicity.unit_right open Classical theorem multiplicity_le_multiplicity_of_dvd_left {a b c : α} (hdvd : a ∣ b) : multiplicity b c ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun n h => (pow_dvd_pow_of_dvd hdvd n).trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_left multiplicity.multiplicity_le_multiplicity_of_dvd_left theorem eq_of_associated_left {a b c : α} (h : Associated a b) : multiplicity b c = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_left h.dvd) (multiplicity_le_multiplicity_of_dvd_left h.symm.dvd) #align multiplicity.eq_of_associated_left multiplicity.eq_of_associated_left -- Porting note: this was doing nothing in mathlib3 also -- alias dvd_iff_multiplicity_pos ↔ _ _root_.has_dvd.dvd.multiplicity_pos end CommMonoid section MonoidWithZero variable [MonoidWithZero α] theorem ne_zero_of_finite {a b : α} (h : Finite a b) : b ≠ 0 := let ⟨n, hn⟩ := h fun hb => by simp [hb] at hn #align multiplicity.ne_zero_of_finite multiplicity.ne_zero_of_finite variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem zero (a : α) : multiplicity a 0 = ⊤ := Part.eq_none_iff.2 fun _ ⟨⟨_, hk⟩, _⟩ => hk (dvd_zero _) #align multiplicity.zero multiplicity.zero @[simp] theorem multiplicity_zero_eq_zero_of_ne_zero (a : α) (ha : a ≠ 0) : multiplicity 0 a = 0 := multiplicity.multiplicity_eq_zero.2 <| mt zero_dvd_iff.1 ha #align multiplicity.multiplicity_zero_eq_zero_of_ne_zero multiplicity.multiplicity_zero_eq_zero_of_ne_zero end MonoidWithZero section CommMonoidWithZero variable [CommMonoidWithZero α] variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem multiplicity_mk_eq_multiplicity [DecidableRel ((· ∣ ·) : Associates α → Associates α → Prop)] {a b : α} : multiplicity (Associates.mk a) (Associates.mk b) = multiplicity a b := by by_cases h : Finite a b · rw [← PartENat.natCast_get (finite_iff_dom.mp h)] refine' (multiplicity.unique (show Associates.mk a ^ (multiplicity a b).get h ∣ Associates.mk b from _) _).symm <;> rw [← Associates.mk_pow, Associates.mk_dvd_mk] · exact pow_multiplicity_dvd h · exact is_greatest ((PartENat.lt_coe_iff _ _).mpr (Exists.intro (finite_iff_dom.mp h) (Nat.lt_succ_self _))) · suffices ¬Finite (Associates.mk a) (Associates.mk b) by rw [finite_iff_dom, PartENat.not_dom_iff_eq_top] at h this rw [h, this] refine' not_finite_iff_forall.mpr fun n => by rw [← Associates.mk_pow, Associates.mk_dvd_mk] exact not_finite_iff_forall.mp h n #align multiplicity.multiplicity_mk_eq_multiplicity multiplicity.multiplicity_mk_eq_multiplicity end CommMonoidWithZero section Semiring variable [Semiring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem min_le_multiplicity_add {p a b : α} : min (multiplicity p a) (multiplicity p b) ≤ multiplicity p (a + b) := (le_total (multiplicity p a) (multiplicity p b)).elim (fun h => by rw [min_eq_left h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add hn (multiplicity_le_multiplicity_iff.1 h n hn)) fun h => by rw [min_eq_right h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add (multiplicity_le_multiplicity_iff.1 h n hn) hn #align multiplicity.min_le_multiplicity_add multiplicity.min_le_multiplicity_add end Semiring section Ring variable [Ring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem neg (a b : α) : multiplicity a (-b) = multiplicity a b := Part.ext' (by simp only [multiplicity, PartENat.find, dvd_neg]) fun h₁ h₂ => PartENat.natCast_inj.1 (by rw [PartENat.natCast_get] exact Eq.symm (unique (pow_multiplicity_dvd _).neg_right (mt dvd_neg.1 (is_greatest' _ (lt_succ_self _))))) #align multiplicity.neg multiplicity.neg theorem Int.natAbs (a : ℕ) (b : ℤ) : multiplicity a b.natAbs = multiplicity (a : ℤ) b := by cases' Int.natAbs_eq b with h h <;> conv_rhs => rw [h] · rw [Int.coe_nat_multiplicity] · rw [multiplicity.neg, Int.coe_nat_multiplicity] #align multiplicity.int.nat_abs multiplicity.Int.natAbs theorem multiplicity_add_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a + b) = multiplicity p b := by apply le_antisymm · apply PartENat.le_of_lt_add_one cases' PartENat.ne_top_iff.mp (PartENat.ne_top_of_lt h) with k hk rw [hk] rw_mod_cast [multiplicity_lt_iff_not_dvd, dvd_add_right] intro h_dvd · apply multiplicity.is_greatest _ h_dvd rw [hk, ← Nat.succ_eq_add_one] norm_cast apply Nat.lt_succ_self k · rw [pow_dvd_iff_le_multiplicity, Nat.cast_add, ← hk, Nat.cast_one] exact PartENat.add_one_le_of_lt h · have := @min_le_multiplicity_add α _ _ p a b rwa [← min_eq_right (le_of_lt h)] #align multiplicity.multiplicity_add_of_gt multiplicity.multiplicity_add_of_gt theorem multiplicity_sub_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a - b) = multiplicity p b := by rw [sub_eq_add_neg, multiplicity_add_of_gt] <;> rw [multiplicity.neg]; assumption #align multiplicity.multiplicity_sub_of_gt multiplicity.multiplicity_sub_of_gt theorem multiplicity_add_eq_min {p a b : α} (h : multiplicity p a ≠ multiplicity p b) : multiplicity p (a + b) = min (multiplicity p a) (multiplicity p b) := by rcases lt_trichotomy (multiplicity p a) (multiplicity p b) with (hab | hab | hab) · rw [add_comm, multiplicity_add_of_gt hab, min_eq_left] exact le_of_lt hab · contradiction · rw [multiplicity_add_of_gt hab, min_eq_right] exact le_of_lt hab #align multiplicity.multiplicity_add_eq_min multiplicity.multiplicity_add_eq_min end Ring section CancelCommMonoidWithZero variable [CancelCommMonoidWithZero α] /- Porting note: removed previous wf recursion hints and added termination_by Also pulled a b intro parameters since Lean parses that more easily -/ theorem finite_mul_aux {p : α} (hp : Prime p) {a b : α} : ∀ {n m : ℕ}, ¬p ^ (n + 1) ∣ a → ¬p ^ (m + 1) ∣ b → ¬p ^ (n + m + 1) ∣ a * b | n, m => fun ha hb ⟨s, hs⟩ => have : p ∣ a * b := ⟨p ^ (n + m) * s, by simp [hs, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩ (hp.2.2 a b this).elim (fun ⟨x, hx⟩ => have hn0 : 0 < n := Nat.pos_of_ne_zero fun hn0 => by simp [hx, hn0] at ha have hpx : ¬p ^ (n - 1 + 1) ∣ x := fun ⟨y, hy⟩ => ha (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hn0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) have : 1 ≤ n + m := le_trans hn0 (Nat.le_add_right n m) finite_mul_aux hp hpx hb ⟨s, mul_right_cancel₀ hp.1 (by rw [tsub_add_eq_add_tsub (succ_le_of_lt hn0), tsub_add_cancel_of_le this] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩) fun ⟨x, hx⟩ => have hm0 : 0 < m := Nat.pos_of_ne_zero fun hm0 => by simp [hx, hm0] at hb have hpx : ¬p ^ (m - 1 + 1) ∣ x := fun ⟨y, hy⟩ => hb (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hm0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) finite_mul_aux hp ha hpx ⟨s, mul_right_cancel₀ hp.1 (by rw [add_assoc, tsub_add_cancel_of_le (succ_le_of_lt hm0)] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩ termination_by finite_mul_aux _ _ n m => n+m #align multiplicity.finite_mul_aux multiplicity.finite_mul_aux theorem finite_mul {p a b : α} (hp : Prime p) : Finite p a → Finite p b → Finite p (a * b) := fun ⟨n, hn⟩ ⟨m, hm⟩ => ⟨n + m, finite_mul_aux hp hn hm⟩ #align multiplicity.finite_mul multiplicity.finite_mul theorem finite_mul_iff {p a b : α} (hp : Prime p) : Finite p (a * b) ↔ Finite p a ∧ Finite p b := ⟨fun h => ⟨finite_of_finite_mul_right h, finite_of_finite_mul_left h⟩, fun h => finite_mul hp h.1 h.2⟩ #align multiplicity.finite_mul_iff multiplicity.finite_mul_iff theorem finite_pow {p a : α} (hp : Prime p) : ∀ {k : ℕ} (_ : Finite p a), Finite p (a ^ k) | 0, _ => ⟨0, by simp [mt isUnit_iff_dvd_one.2 hp.2.1]⟩ | k + 1, ha => by rw [_root_.pow_succ]; exact finite_mul hp ha (finite_pow hp ha) #align multiplicity.finite_pow multiplicity.finite_pow variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] theorem multiplicity_self {a : α} (ha : ¬IsUnit a) (ha0 : a ≠ 0) : multiplicity a a = 1 := by rw [← Nat.cast_one] exact eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => ha (isUnit_iff_dvd_one.2 ⟨b, mul_left_cancel₀ ha0 <| by simpa [_root_.pow_succ, mul_assoc] using hb⟩)⟩ #align multiplicity.multiplicity_self multiplicity.multiplicity_self @[simp] theorem get_multiplicity_self {a : α} (ha : Finite a a) : get (multiplicity a a) ha = 1 := PartENat.get_eq_iff_eq_coe.2 (eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => by rw [← mul_one a, pow_add, pow_one, mul_assoc, mul_assoc, mul_right_inj' (ne_zero_of_finite ha)] at hb; exact mt isUnit_iff_dvd_one.2 (not_unit_of_finite ha) ⟨b, by simp_all⟩⟩) #align multiplicity.get_multiplicity_self multiplicity.get_multiplicity_self protected theorem mul' {p a b : α} (hp : Prime p) (h : (multiplicity p (a * b)).Dom) : get (multiplicity p (a * b)) h = get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by have hdiva : p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 ∣ a := pow_multiplicity_dvd _ have hdivb : p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 ∣ b := pow_multiplicity_dvd _ have hpoweq : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) = p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 * p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by simp [pow_add] have hdiv : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) ∣ a * b := by rw [hpoweq]; apply mul_dvd_mul <;> assumption have hsucc : ¬p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 + 1) ∣ a * b := fun h => not_or_of_not (is_greatest' _ (lt_succ_self _)) (is_greatest' _ (lt_succ_self _)) (_root_.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul hp hdiva hdivb h) rw [← PartENat.natCast_inj, PartENat.natCast_get, eq_coe_iff]; exact ⟨hdiv, hsucc⟩ #align multiplicity.mul' multiplicity.mul' open Classical protected theorem mul {p a b : α} (hp : Prime p) : multiplicity p (a * b) = multiplicity p a + multiplicity p b := if h : Finite p a ∧ Finite p b then by rw [← PartENat.natCast_get (finite_iff_dom.1 h.1), ← PartENat.natCast_get (finite_iff_dom.1 h.2), ← PartENat.natCast_get (finite_iff_dom.1 (finite_mul hp h.1 h.2)), ← Nat.cast_add, PartENat.natCast_inj, multiplicity.mul' hp] else by rw [eq_top_iff_not_finite.2 (mt (finite_mul_iff hp).1 h)] cases' not_and_or.1 h with h h <;> simp [eq_top_iff_not_finite.2 h] #align multiplicity.mul multiplicity.mul theorem Finset.prod {β : Type*} {p : α} (hp : Prime p) (s : Finset β) (f : β → α) : multiplicity p (∏ x in s, f x) = ∑ x in s, multiplicity p (f x) := by classical induction' s using Finset.induction with a s has ih h · simp only [Finset.sum_empty, Finset.prod_empty] convert one_right hp.not_unit · simp [has, ← ih] convert multiplicity.mul hp #align multiplicity.finset.prod multiplicity.Finset.prod -- Porting note: with protected could not use pow' k in the succ branch protected theorem pow' {p a : α} (hp : Prime p) (ha : Finite p a) : ∀ {k : ℕ}, get (multiplicity p (a ^ k)) (finite_pow hp ha) = k * get (multiplicity p a) ha := by intro k induction' k with k hk · simp [one_right hp.not_unit] · have : multiplicity p (a ^ (k + 1)) = multiplicity p (a * a ^ k) := by rw [_root_.pow_succ] rw [succ_eq_add_one, get_eq_get_of_eq _ _ this, multiplicity.mul' hp, hk, add_mul, one_mul, add_comm] #align multiplicity.pow' multiplicity.pow' theorem pow {p a : α} (hp : Prime p) : ∀ {k : ℕ}, multiplicity p (a ^ k) = k • multiplicity p a | 0 => by simp [one_right hp.not_unit] | succ k => by simp [_root_.pow_succ, succ_nsmul, pow hp, multiplicity.mul hp] #align multiplicity.pow multiplicity.pow theorem multiplicity_pow_self {p : α} (h0 : p ≠ 0) (hu : ¬IsUnit p) (n : ℕ) : multiplicity p (p ^ n) = n := by rw [eq_coe_iff] use dvd_rfl rw [pow_dvd_pow_iff h0 hu] apply Nat.not_succ_le_self #align multiplicity.multiplicity_pow_self multiplicity.multiplicity_pow_self theorem multiplicity_pow_self_of_prime {p : α} (hp : Prime p) (n : ℕ) : multiplicity p (p ^ n) = n := multiplicity_pow_self hp.ne_zero hp.not_unit n #align multiplicity.multiplicity_pow_self_of_prime multiplicity.multiplicity_pow_self_of_prime end CancelCommMonoidWithZero end multiplicity section Nat open multiplicity theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by
rw [multiplicity_le_multiplicity_iff] at hle
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by
Mathlib.RingTheory.Multiplicity.640_0.uTHZeAJqYiw3Jx8
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0
Mathlib_RingTheory_Multiplicity
α : Type u_1 β : Type u_2 p a b : ℕ hp : p ≠ 1 hle : ∀ (n : ℕ), p ^ n ∣ a → p ^ n ∣ b hab : Coprime a b ⊢ multiplicity p a = 0
/- Copyright (c) 2018 Robert Y. Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Y. Lewis, Chris Hughes -/ import Mathlib.Algebra.Associated import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.PartENat import Mathlib.Tactic.Linarith #align_import ring_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Multiplicity of a divisor For a commutative monoid, this file introduces the notion of multiplicity of a divisor and proves several basic results on it. ## Main definitions * `multiplicity a b`: for two elements `a` and `b` of a commutative monoid returns the largest number `n` such that `a ^ n ∣ b` or infinity, written `⊤`, if `a ^ n ∣ b` for all natural numbers `n`. * `multiplicity.Finite a b`: a predicate denoting that the multiplicity of `a` in `b` is finite. -/ variable {α β : Type*} open Nat Part open BigOperators /-- `multiplicity a b` returns the largest natural number `n` such that `a ^ n ∣ b`, as a `PartENat` or natural with infinity. If `∀ n, a ^ n ∣ b`, then it returns `⊤`-/ def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat := PartENat.find fun n => ¬a ^ (n + 1) ∣ b #align multiplicity multiplicity namespace multiplicity section Monoid variable [Monoid α] [Monoid β] /-- `multiplicity.Finite a b` indicates that the multiplicity of `a` in `b` is finite. -/ @[reducible] def Finite (a b : α) : Prop := ∃ n : ℕ, ¬a ^ (n + 1) ∣ b #align multiplicity.finite multiplicity.Finite theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} : Finite a b ↔ (multiplicity a b).Dom := Iff.rfl #align multiplicity.finite_iff_dom multiplicity.finite_iff_dom theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b := Iff.rfl #align multiplicity.finite_def multiplicity.finite_def theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 := fun ⟨n, hn⟩ ⟨d, hd⟩ => hn ⟨d ^ (n + 1), (pow_mul_pow_eq_one (n + 1) hd.symm).symm⟩ #align multiplicity.not_dvd_one_of_finite_one_right multiplicity.not_dvd_one_of_finite_one_right @[norm_cast] theorem Int.coe_nat_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b := by apply Part.ext' · rw [← @finite_iff_dom ℕ, @finite_def ℕ, ← @finite_iff_dom ℤ, @finite_def ℤ] norm_cast · intro h1 h2 apply _root_.le_antisymm <;> · apply Nat.find_mono norm_cast simp #align multiplicity.int.coe_nat_multiplicity multiplicity.Int.coe_nat_multiplicity theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b := ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) (by simpa [Finite, Classical.not_not] using h), by simp [Finite, multiplicity, Classical.not_not]; tauto⟩ #align multiplicity.not_finite_iff_forall multiplicity.not_finite_iff_forall theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a := let ⟨n, hn⟩ := h hn ∘ IsUnit.dvd ∘ IsUnit.pow (n + 1) #align multiplicity.not_unit_of_finite multiplicity.not_unit_of_finite theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b := fun ⟨n, hn⟩ => ⟨n, fun h => hn (h.trans (dvd_mul_right _ _))⟩ #align multiplicity.finite_of_finite_mul_right multiplicity.finite_of_finite_mul_right variable [DecidableRel ((· ∣ ·) : α → α → Prop)] [DecidableRel ((· ∣ ·) : β → β → Prop)] theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} : (k : PartENat) ≤ multiplicity a b → a ^ k ∣ b := by rw [← PartENat.some_eq_natCast] exact Nat.casesOn k (fun _ => by rw [_root_.pow_zero] exact one_dvd _) fun k ⟨_, h₂⟩ => by_contradiction fun hk => Nat.find_min _ (lt_of_succ_le (h₂ ⟨k, hk⟩)) hk #align multiplicity.pow_dvd_of_le_multiplicity multiplicity.pow_dvd_of_le_multiplicity theorem pow_multiplicity_dvd {a b : α} (h : Finite a b) : a ^ get (multiplicity a b) h ∣ b := pow_dvd_of_le_multiplicity (by rw [PartENat.natCast_get]) #align multiplicity.pow_multiplicity_dvd multiplicity.pow_multiplicity_dvd theorem is_greatest {a b : α} {m : ℕ} (hm : multiplicity a b < m) : ¬a ^ m ∣ b := fun h => by rw [PartENat.lt_coe_iff] at hm; exact Nat.find_spec hm.fst ((pow_dvd_pow _ hm.snd).trans h) #align multiplicity.is_greatest multiplicity.is_greatest theorem is_greatest' {a b : α} {m : ℕ} (h : Finite a b) (hm : get (multiplicity a b) h < m) : ¬a ^ m ∣ b := is_greatest (by rwa [← PartENat.coe_lt_coe, PartENat.natCast_get] at hm) #align multiplicity.is_greatest' multiplicity.is_greatest' theorem pos_of_dvd {a b : α} (hfin : Finite a b) (hdiv : a ∣ b) : 0 < (multiplicity a b).get hfin := by refine' zero_lt_iff.2 fun h => _ simpa [hdiv] using is_greatest' hfin (lt_one_iff.mpr h) #align multiplicity.pos_of_dvd multiplicity.pos_of_dvd theorem unique {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : (k : PartENat) = multiplicity a b := le_antisymm (le_of_not_gt fun hk' => is_greatest hk' hk) <| by have : Finite a b := ⟨k, hsucc⟩ rw [PartENat.le_coe_iff] exact ⟨this, Nat.find_min' _ hsucc⟩ #align multiplicity.unique multiplicity.unique theorem unique' {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : k = get (multiplicity a b) ⟨k, hsucc⟩ := by rw [← PartENat.natCast_inj, PartENat.natCast_get, unique hk hsucc] #align multiplicity.unique' multiplicity.unique' theorem le_multiplicity_of_pow_dvd {a b : α} {k : ℕ} (hk : a ^ k ∣ b) : (k : PartENat) ≤ multiplicity a b := le_of_not_gt fun hk' => is_greatest hk' hk #align multiplicity.le_multiplicity_of_pow_dvd multiplicity.le_multiplicity_of_pow_dvd theorem pow_dvd_iff_le_multiplicity {a b : α} {k : ℕ} : a ^ k ∣ b ↔ (k : PartENat) ≤ multiplicity a b := ⟨le_multiplicity_of_pow_dvd, pow_dvd_of_le_multiplicity⟩ #align multiplicity.pow_dvd_iff_le_multiplicity multiplicity.pow_dvd_iff_le_multiplicity theorem multiplicity_lt_iff_not_dvd {a b : α} {k : ℕ} : multiplicity a b < (k : PartENat) ↔ ¬a ^ k ∣ b := by rw [pow_dvd_iff_le_multiplicity, not_le] #align multiplicity.multiplicity_lt_iff_neg_dvd multiplicity.multiplicity_lt_iff_not_dvd theorem eq_coe_iff {a b : α} {n : ℕ} : multiplicity a b = (n : PartENat) ↔ a ^ n ∣ b ∧ ¬a ^ (n + 1) ∣ b := by rw [← PartENat.some_eq_natCast] exact ⟨fun h => let ⟨h₁, h₂⟩ := eq_some_iff.1 h h₂ ▸ ⟨pow_multiplicity_dvd _, is_greatest (by rw [PartENat.lt_coe_iff] exact ⟨h₁, lt_succ_self _⟩)⟩, fun h => eq_some_iff.2 ⟨⟨n, h.2⟩, Eq.symm <| unique' h.1 h.2⟩⟩ #align multiplicity.eq_coe_iff multiplicity.eq_coe_iff theorem eq_top_iff {a b : α} : multiplicity a b = ⊤ ↔ ∀ n : ℕ, a ^ n ∣ b := (PartENat.find_eq_top_iff _).trans <| by simp only [Classical.not_not] exact ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) fun n => h _, fun h n => h _⟩ #align multiplicity.eq_top_iff multiplicity.eq_top_iff @[simp] theorem isUnit_left {a : α} (b : α) (ha : IsUnit a) : multiplicity a b = ⊤ := eq_top_iff.2 fun _ => IsUnit.dvd (ha.pow _) #align multiplicity.is_unit_left multiplicity.isUnit_left -- @[simp] Porting note: simp can prove this theorem one_left (b : α) : multiplicity 1 b = ⊤ := isUnit_left b isUnit_one #align multiplicity.one_left multiplicity.one_left @[simp] theorem get_one_right {a : α} (ha : Finite a 1) : get (multiplicity a 1) ha = 0 := by rw [PartENat.get_eq_iff_eq_coe, eq_coe_iff, _root_.pow_zero] simp [not_dvd_one_of_finite_one_right ha] #align multiplicity.get_one_right multiplicity.get_one_right -- @[simp] Porting note: simp can prove this theorem unit_left (a : α) (u : αˣ) : multiplicity (u : α) a = ⊤ := isUnit_left a u.isUnit #align multiplicity.unit_left multiplicity.unit_left theorem multiplicity_eq_zero {a b : α} : multiplicity a b = 0 ↔ ¬a ∣ b := by rw [← Nat.cast_zero, eq_coe_iff] simp only [_root_.pow_zero, isUnit_one, IsUnit.dvd, zero_add, pow_one, true_and] #align multiplicity.multiplicity_eq_zero multiplicity.multiplicity_eq_zero theorem multiplicity_ne_zero {a b : α} : multiplicity a b ≠ 0 ↔ a ∣ b := multiplicity_eq_zero.not_left #align multiplicity.multiplicity_ne_zero multiplicity.multiplicity_ne_zero theorem eq_top_iff_not_finite {a b : α} : multiplicity a b = ⊤ ↔ ¬Finite a b := Part.eq_none_iff' #align multiplicity.eq_top_iff_not_finite multiplicity.eq_top_iff_not_finite theorem ne_top_iff_finite {a b : α} : multiplicity a b ≠ ⊤ ↔ Finite a b := by rw [Ne.def, eq_top_iff_not_finite, Classical.not_not] #align multiplicity.ne_top_iff_finite multiplicity.ne_top_iff_finite theorem lt_top_iff_finite {a b : α} : multiplicity a b < ⊤ ↔ Finite a b := by rw [lt_top_iff_ne_top, ne_top_iff_finite] #align multiplicity.lt_top_iff_finite multiplicity.lt_top_iff_finite theorem exists_eq_pow_mul_and_not_dvd {a b : α} (hfin : Finite a b) : ∃ c : α, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c := by obtain ⟨c, hc⟩ := multiplicity.pow_multiplicity_dvd hfin refine' ⟨c, hc, _⟩ rintro ⟨k, hk⟩ rw [hk, ← mul_assoc, ← _root_.pow_succ'] at hc have h₁ : a ^ ((multiplicity a b).get hfin + 1) ∣ b := ⟨k, hc⟩ exact (multiplicity.eq_coe_iff.1 (by simp)).2 h₁ #align multiplicity.exists_eq_pow_mul_and_not_dvd multiplicity.exists_eq_pow_mul_and_not_dvd theorem multiplicity_le_multiplicity_iff {a b : α} {c d : β} : multiplicity a b ≤ multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b → c ^ n ∣ d := ⟨fun h n hab => pow_dvd_of_le_multiplicity (le_trans (le_multiplicity_of_pow_dvd hab) h), fun h => letI := Classical.dec (Finite a b) if hab : Finite a b then by rw [← PartENat.natCast_get (finite_iff_dom.1 hab)]; exact le_multiplicity_of_pow_dvd (h _ (pow_multiplicity_dvd _)) else by have : ∀ n : ℕ, c ^ n ∣ d := fun n => h n (not_finite_iff_forall.1 hab _) rw [eq_top_iff_not_finite.2 hab, eq_top_iff_not_finite.2 (not_finite_iff_forall.2 this)]⟩ #align multiplicity.multiplicity_le_multiplicity_iff multiplicity.multiplicity_le_multiplicity_iff theorem multiplicity_eq_multiplicity_iff {a b : α} {c d : β} : multiplicity a b = multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b ↔ c ^ n ∣ d := ⟨fun h n => ⟨multiplicity_le_multiplicity_iff.mp h.le n, multiplicity_le_multiplicity_iff.mp h.ge n⟩, fun h => le_antisymm (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mp) (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mpr)⟩ #align multiplicity.multiplicity_eq_multiplicity_iff multiplicity.multiplicity_eq_multiplicity_iff theorem le_multiplicity_map {F : Type*} [MonoidHomClass F α β] (f : F) {a b : α} : multiplicity a b ≤ multiplicity (f a) (f b) := multiplicity_le_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd f theorem multiplicity_map_eq {F : Type*} [MulEquivClass F α β] (f : F) {a b : α} : multiplicity (f a) (f b) = multiplicity a b := multiplicity_eq_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd_iff f theorem multiplicity_le_multiplicity_of_dvd_right {a b c : α} (h : b ∣ c) : multiplicity a b ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun _ hb => hb.trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_right multiplicity.multiplicity_le_multiplicity_of_dvd_right theorem eq_of_associated_right {a b c : α} (h : Associated b c) : multiplicity a b = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_right h.dvd) (multiplicity_le_multiplicity_of_dvd_right h.symm.dvd) #align multiplicity.eq_of_associated_right multiplicity.eq_of_associated_right theorem dvd_of_multiplicity_pos {a b : α} (h : (0 : PartENat) < multiplicity a b) : a ∣ b := by rw [← pow_one a] apply pow_dvd_of_le_multiplicity simpa only [Nat.cast_one, PartENat.pos_iff_one_le] using h #align multiplicity.dvd_of_multiplicity_pos multiplicity.dvd_of_multiplicity_pos theorem dvd_iff_multiplicity_pos {a b : α} : (0 : PartENat) < multiplicity a b ↔ a ∣ b := ⟨dvd_of_multiplicity_pos, fun hdvd => lt_of_le_of_ne (zero_le _) fun heq => is_greatest (show multiplicity a b < ↑1 by simpa only [heq, Nat.cast_zero] using PartENat.coe_lt_coe.mpr zero_lt_one) (by rwa [pow_one a])⟩ #align multiplicity.dvd_iff_multiplicity_pos multiplicity.dvd_iff_multiplicity_pos theorem finite_nat_iff {a b : ℕ} : Finite a b ↔ a ≠ 1 ∧ 0 < b := by rw [← not_iff_not, not_finite_iff_forall, not_and_or, Ne.def, Classical.not_not, not_lt, le_zero_iff] exact ⟨fun h => or_iff_not_imp_right.2 fun hb => have ha : a ≠ 0 := fun ha => hb <| zero_dvd_iff.mp <| by rw [ha] at h; exact h 1 Classical.by_contradiction fun ha1 : a ≠ 1 => have ha_gt_one : 1 < a := lt_of_not_ge fun _ => match a with | 0 => ha rfl | 1 => ha1 rfl | b+2 => by linarith not_lt_of_ge (le_of_dvd (Nat.pos_of_ne_zero hb) (h b)) (lt_pow_self ha_gt_one b), fun h => by cases h <;> simp [*]⟩ #align multiplicity.finite_nat_iff multiplicity.finite_nat_iff alias ⟨_, _root_.has_dvd.dvd.multiplicity_pos⟩ := dvd_iff_multiplicity_pos end Monoid section CommMonoid variable [CommMonoid α] theorem finite_of_finite_mul_left {a b c : α} : Finite a (b * c) → Finite a c := by rw [mul_comm]; exact finite_of_finite_mul_right #align multiplicity.finite_of_finite_mul_left multiplicity.finite_of_finite_mul_left variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem isUnit_right {a b : α} (ha : ¬IsUnit a) (hb : IsUnit b) : multiplicity a b = 0 := eq_coe_iff.2 ⟨show a ^ 0 ∣ b by simp only [_root_.pow_zero, one_dvd], by rw [pow_one] exact fun h => mt (isUnit_of_dvd_unit h) ha hb⟩ #align multiplicity.is_unit_right multiplicity.isUnit_right theorem one_right {a : α} (ha : ¬IsUnit a) : multiplicity a 1 = 0 := isUnit_right ha isUnit_one #align multiplicity.one_right multiplicity.one_right theorem unit_right {a : α} (ha : ¬IsUnit a) (u : αˣ) : multiplicity a u = 0 := isUnit_right ha u.isUnit #align multiplicity.unit_right multiplicity.unit_right open Classical theorem multiplicity_le_multiplicity_of_dvd_left {a b c : α} (hdvd : a ∣ b) : multiplicity b c ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun n h => (pow_dvd_pow_of_dvd hdvd n).trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_left multiplicity.multiplicity_le_multiplicity_of_dvd_left theorem eq_of_associated_left {a b c : α} (h : Associated a b) : multiplicity b c = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_left h.dvd) (multiplicity_le_multiplicity_of_dvd_left h.symm.dvd) #align multiplicity.eq_of_associated_left multiplicity.eq_of_associated_left -- Porting note: this was doing nothing in mathlib3 also -- alias dvd_iff_multiplicity_pos ↔ _ _root_.has_dvd.dvd.multiplicity_pos end CommMonoid section MonoidWithZero variable [MonoidWithZero α] theorem ne_zero_of_finite {a b : α} (h : Finite a b) : b ≠ 0 := let ⟨n, hn⟩ := h fun hb => by simp [hb] at hn #align multiplicity.ne_zero_of_finite multiplicity.ne_zero_of_finite variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem zero (a : α) : multiplicity a 0 = ⊤ := Part.eq_none_iff.2 fun _ ⟨⟨_, hk⟩, _⟩ => hk (dvd_zero _) #align multiplicity.zero multiplicity.zero @[simp] theorem multiplicity_zero_eq_zero_of_ne_zero (a : α) (ha : a ≠ 0) : multiplicity 0 a = 0 := multiplicity.multiplicity_eq_zero.2 <| mt zero_dvd_iff.1 ha #align multiplicity.multiplicity_zero_eq_zero_of_ne_zero multiplicity.multiplicity_zero_eq_zero_of_ne_zero end MonoidWithZero section CommMonoidWithZero variable [CommMonoidWithZero α] variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem multiplicity_mk_eq_multiplicity [DecidableRel ((· ∣ ·) : Associates α → Associates α → Prop)] {a b : α} : multiplicity (Associates.mk a) (Associates.mk b) = multiplicity a b := by by_cases h : Finite a b · rw [← PartENat.natCast_get (finite_iff_dom.mp h)] refine' (multiplicity.unique (show Associates.mk a ^ (multiplicity a b).get h ∣ Associates.mk b from _) _).symm <;> rw [← Associates.mk_pow, Associates.mk_dvd_mk] · exact pow_multiplicity_dvd h · exact is_greatest ((PartENat.lt_coe_iff _ _).mpr (Exists.intro (finite_iff_dom.mp h) (Nat.lt_succ_self _))) · suffices ¬Finite (Associates.mk a) (Associates.mk b) by rw [finite_iff_dom, PartENat.not_dom_iff_eq_top] at h this rw [h, this] refine' not_finite_iff_forall.mpr fun n => by rw [← Associates.mk_pow, Associates.mk_dvd_mk] exact not_finite_iff_forall.mp h n #align multiplicity.multiplicity_mk_eq_multiplicity multiplicity.multiplicity_mk_eq_multiplicity end CommMonoidWithZero section Semiring variable [Semiring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem min_le_multiplicity_add {p a b : α} : min (multiplicity p a) (multiplicity p b) ≤ multiplicity p (a + b) := (le_total (multiplicity p a) (multiplicity p b)).elim (fun h => by rw [min_eq_left h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add hn (multiplicity_le_multiplicity_iff.1 h n hn)) fun h => by rw [min_eq_right h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add (multiplicity_le_multiplicity_iff.1 h n hn) hn #align multiplicity.min_le_multiplicity_add multiplicity.min_le_multiplicity_add end Semiring section Ring variable [Ring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem neg (a b : α) : multiplicity a (-b) = multiplicity a b := Part.ext' (by simp only [multiplicity, PartENat.find, dvd_neg]) fun h₁ h₂ => PartENat.natCast_inj.1 (by rw [PartENat.natCast_get] exact Eq.symm (unique (pow_multiplicity_dvd _).neg_right (mt dvd_neg.1 (is_greatest' _ (lt_succ_self _))))) #align multiplicity.neg multiplicity.neg theorem Int.natAbs (a : ℕ) (b : ℤ) : multiplicity a b.natAbs = multiplicity (a : ℤ) b := by cases' Int.natAbs_eq b with h h <;> conv_rhs => rw [h] · rw [Int.coe_nat_multiplicity] · rw [multiplicity.neg, Int.coe_nat_multiplicity] #align multiplicity.int.nat_abs multiplicity.Int.natAbs theorem multiplicity_add_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a + b) = multiplicity p b := by apply le_antisymm · apply PartENat.le_of_lt_add_one cases' PartENat.ne_top_iff.mp (PartENat.ne_top_of_lt h) with k hk rw [hk] rw_mod_cast [multiplicity_lt_iff_not_dvd, dvd_add_right] intro h_dvd · apply multiplicity.is_greatest _ h_dvd rw [hk, ← Nat.succ_eq_add_one] norm_cast apply Nat.lt_succ_self k · rw [pow_dvd_iff_le_multiplicity, Nat.cast_add, ← hk, Nat.cast_one] exact PartENat.add_one_le_of_lt h · have := @min_le_multiplicity_add α _ _ p a b rwa [← min_eq_right (le_of_lt h)] #align multiplicity.multiplicity_add_of_gt multiplicity.multiplicity_add_of_gt theorem multiplicity_sub_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a - b) = multiplicity p b := by rw [sub_eq_add_neg, multiplicity_add_of_gt] <;> rw [multiplicity.neg]; assumption #align multiplicity.multiplicity_sub_of_gt multiplicity.multiplicity_sub_of_gt theorem multiplicity_add_eq_min {p a b : α} (h : multiplicity p a ≠ multiplicity p b) : multiplicity p (a + b) = min (multiplicity p a) (multiplicity p b) := by rcases lt_trichotomy (multiplicity p a) (multiplicity p b) with (hab | hab | hab) · rw [add_comm, multiplicity_add_of_gt hab, min_eq_left] exact le_of_lt hab · contradiction · rw [multiplicity_add_of_gt hab, min_eq_right] exact le_of_lt hab #align multiplicity.multiplicity_add_eq_min multiplicity.multiplicity_add_eq_min end Ring section CancelCommMonoidWithZero variable [CancelCommMonoidWithZero α] /- Porting note: removed previous wf recursion hints and added termination_by Also pulled a b intro parameters since Lean parses that more easily -/ theorem finite_mul_aux {p : α} (hp : Prime p) {a b : α} : ∀ {n m : ℕ}, ¬p ^ (n + 1) ∣ a → ¬p ^ (m + 1) ∣ b → ¬p ^ (n + m + 1) ∣ a * b | n, m => fun ha hb ⟨s, hs⟩ => have : p ∣ a * b := ⟨p ^ (n + m) * s, by simp [hs, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩ (hp.2.2 a b this).elim (fun ⟨x, hx⟩ => have hn0 : 0 < n := Nat.pos_of_ne_zero fun hn0 => by simp [hx, hn0] at ha have hpx : ¬p ^ (n - 1 + 1) ∣ x := fun ⟨y, hy⟩ => ha (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hn0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) have : 1 ≤ n + m := le_trans hn0 (Nat.le_add_right n m) finite_mul_aux hp hpx hb ⟨s, mul_right_cancel₀ hp.1 (by rw [tsub_add_eq_add_tsub (succ_le_of_lt hn0), tsub_add_cancel_of_le this] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩) fun ⟨x, hx⟩ => have hm0 : 0 < m := Nat.pos_of_ne_zero fun hm0 => by simp [hx, hm0] at hb have hpx : ¬p ^ (m - 1 + 1) ∣ x := fun ⟨y, hy⟩ => hb (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hm0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) finite_mul_aux hp ha hpx ⟨s, mul_right_cancel₀ hp.1 (by rw [add_assoc, tsub_add_cancel_of_le (succ_le_of_lt hm0)] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩ termination_by finite_mul_aux _ _ n m => n+m #align multiplicity.finite_mul_aux multiplicity.finite_mul_aux theorem finite_mul {p a b : α} (hp : Prime p) : Finite p a → Finite p b → Finite p (a * b) := fun ⟨n, hn⟩ ⟨m, hm⟩ => ⟨n + m, finite_mul_aux hp hn hm⟩ #align multiplicity.finite_mul multiplicity.finite_mul theorem finite_mul_iff {p a b : α} (hp : Prime p) : Finite p (a * b) ↔ Finite p a ∧ Finite p b := ⟨fun h => ⟨finite_of_finite_mul_right h, finite_of_finite_mul_left h⟩, fun h => finite_mul hp h.1 h.2⟩ #align multiplicity.finite_mul_iff multiplicity.finite_mul_iff theorem finite_pow {p a : α} (hp : Prime p) : ∀ {k : ℕ} (_ : Finite p a), Finite p (a ^ k) | 0, _ => ⟨0, by simp [mt isUnit_iff_dvd_one.2 hp.2.1]⟩ | k + 1, ha => by rw [_root_.pow_succ]; exact finite_mul hp ha (finite_pow hp ha) #align multiplicity.finite_pow multiplicity.finite_pow variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] theorem multiplicity_self {a : α} (ha : ¬IsUnit a) (ha0 : a ≠ 0) : multiplicity a a = 1 := by rw [← Nat.cast_one] exact eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => ha (isUnit_iff_dvd_one.2 ⟨b, mul_left_cancel₀ ha0 <| by simpa [_root_.pow_succ, mul_assoc] using hb⟩)⟩ #align multiplicity.multiplicity_self multiplicity.multiplicity_self @[simp] theorem get_multiplicity_self {a : α} (ha : Finite a a) : get (multiplicity a a) ha = 1 := PartENat.get_eq_iff_eq_coe.2 (eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => by rw [← mul_one a, pow_add, pow_one, mul_assoc, mul_assoc, mul_right_inj' (ne_zero_of_finite ha)] at hb; exact mt isUnit_iff_dvd_one.2 (not_unit_of_finite ha) ⟨b, by simp_all⟩⟩) #align multiplicity.get_multiplicity_self multiplicity.get_multiplicity_self protected theorem mul' {p a b : α} (hp : Prime p) (h : (multiplicity p (a * b)).Dom) : get (multiplicity p (a * b)) h = get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by have hdiva : p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 ∣ a := pow_multiplicity_dvd _ have hdivb : p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 ∣ b := pow_multiplicity_dvd _ have hpoweq : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) = p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 * p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by simp [pow_add] have hdiv : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) ∣ a * b := by rw [hpoweq]; apply mul_dvd_mul <;> assumption have hsucc : ¬p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 + 1) ∣ a * b := fun h => not_or_of_not (is_greatest' _ (lt_succ_self _)) (is_greatest' _ (lt_succ_self _)) (_root_.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul hp hdiva hdivb h) rw [← PartENat.natCast_inj, PartENat.natCast_get, eq_coe_iff]; exact ⟨hdiv, hsucc⟩ #align multiplicity.mul' multiplicity.mul' open Classical protected theorem mul {p a b : α} (hp : Prime p) : multiplicity p (a * b) = multiplicity p a + multiplicity p b := if h : Finite p a ∧ Finite p b then by rw [← PartENat.natCast_get (finite_iff_dom.1 h.1), ← PartENat.natCast_get (finite_iff_dom.1 h.2), ← PartENat.natCast_get (finite_iff_dom.1 (finite_mul hp h.1 h.2)), ← Nat.cast_add, PartENat.natCast_inj, multiplicity.mul' hp] else by rw [eq_top_iff_not_finite.2 (mt (finite_mul_iff hp).1 h)] cases' not_and_or.1 h with h h <;> simp [eq_top_iff_not_finite.2 h] #align multiplicity.mul multiplicity.mul theorem Finset.prod {β : Type*} {p : α} (hp : Prime p) (s : Finset β) (f : β → α) : multiplicity p (∏ x in s, f x) = ∑ x in s, multiplicity p (f x) := by classical induction' s using Finset.induction with a s has ih h · simp only [Finset.sum_empty, Finset.prod_empty] convert one_right hp.not_unit · simp [has, ← ih] convert multiplicity.mul hp #align multiplicity.finset.prod multiplicity.Finset.prod -- Porting note: with protected could not use pow' k in the succ branch protected theorem pow' {p a : α} (hp : Prime p) (ha : Finite p a) : ∀ {k : ℕ}, get (multiplicity p (a ^ k)) (finite_pow hp ha) = k * get (multiplicity p a) ha := by intro k induction' k with k hk · simp [one_right hp.not_unit] · have : multiplicity p (a ^ (k + 1)) = multiplicity p (a * a ^ k) := by rw [_root_.pow_succ] rw [succ_eq_add_one, get_eq_get_of_eq _ _ this, multiplicity.mul' hp, hk, add_mul, one_mul, add_comm] #align multiplicity.pow' multiplicity.pow' theorem pow {p a : α} (hp : Prime p) : ∀ {k : ℕ}, multiplicity p (a ^ k) = k • multiplicity p a | 0 => by simp [one_right hp.not_unit] | succ k => by simp [_root_.pow_succ, succ_nsmul, pow hp, multiplicity.mul hp] #align multiplicity.pow multiplicity.pow theorem multiplicity_pow_self {p : α} (h0 : p ≠ 0) (hu : ¬IsUnit p) (n : ℕ) : multiplicity p (p ^ n) = n := by rw [eq_coe_iff] use dvd_rfl rw [pow_dvd_pow_iff h0 hu] apply Nat.not_succ_le_self #align multiplicity.multiplicity_pow_self multiplicity.multiplicity_pow_self theorem multiplicity_pow_self_of_prime {p : α} (hp : Prime p) (n : ℕ) : multiplicity p (p ^ n) = n := multiplicity_pow_self hp.ne_zero hp.not_unit n #align multiplicity.multiplicity_pow_self_of_prime multiplicity.multiplicity_pow_self_of_prime end CancelCommMonoidWithZero end multiplicity section Nat open multiplicity theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle
rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity]
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle
Mathlib.RingTheory.Multiplicity.640_0.uTHZeAJqYiw3Jx8
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0
Mathlib_RingTheory_Multiplicity
α : Type u_1 β : Type u_2 p a b : ℕ hp : p ≠ 1 hle : ∀ (n : ℕ), p ^ n ∣ a → p ^ n ∣ b hab : Coprime a b ⊢ ¬p ^ 1 ∣ a
/- Copyright (c) 2018 Robert Y. Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Y. Lewis, Chris Hughes -/ import Mathlib.Algebra.Associated import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.PartENat import Mathlib.Tactic.Linarith #align_import ring_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Multiplicity of a divisor For a commutative monoid, this file introduces the notion of multiplicity of a divisor and proves several basic results on it. ## Main definitions * `multiplicity a b`: for two elements `a` and `b` of a commutative monoid returns the largest number `n` such that `a ^ n ∣ b` or infinity, written `⊤`, if `a ^ n ∣ b` for all natural numbers `n`. * `multiplicity.Finite a b`: a predicate denoting that the multiplicity of `a` in `b` is finite. -/ variable {α β : Type*} open Nat Part open BigOperators /-- `multiplicity a b` returns the largest natural number `n` such that `a ^ n ∣ b`, as a `PartENat` or natural with infinity. If `∀ n, a ^ n ∣ b`, then it returns `⊤`-/ def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat := PartENat.find fun n => ¬a ^ (n + 1) ∣ b #align multiplicity multiplicity namespace multiplicity section Monoid variable [Monoid α] [Monoid β] /-- `multiplicity.Finite a b` indicates that the multiplicity of `a` in `b` is finite. -/ @[reducible] def Finite (a b : α) : Prop := ∃ n : ℕ, ¬a ^ (n + 1) ∣ b #align multiplicity.finite multiplicity.Finite theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} : Finite a b ↔ (multiplicity a b).Dom := Iff.rfl #align multiplicity.finite_iff_dom multiplicity.finite_iff_dom theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b := Iff.rfl #align multiplicity.finite_def multiplicity.finite_def theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 := fun ⟨n, hn⟩ ⟨d, hd⟩ => hn ⟨d ^ (n + 1), (pow_mul_pow_eq_one (n + 1) hd.symm).symm⟩ #align multiplicity.not_dvd_one_of_finite_one_right multiplicity.not_dvd_one_of_finite_one_right @[norm_cast] theorem Int.coe_nat_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b := by apply Part.ext' · rw [← @finite_iff_dom ℕ, @finite_def ℕ, ← @finite_iff_dom ℤ, @finite_def ℤ] norm_cast · intro h1 h2 apply _root_.le_antisymm <;> · apply Nat.find_mono norm_cast simp #align multiplicity.int.coe_nat_multiplicity multiplicity.Int.coe_nat_multiplicity theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b := ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) (by simpa [Finite, Classical.not_not] using h), by simp [Finite, multiplicity, Classical.not_not]; tauto⟩ #align multiplicity.not_finite_iff_forall multiplicity.not_finite_iff_forall theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a := let ⟨n, hn⟩ := h hn ∘ IsUnit.dvd ∘ IsUnit.pow (n + 1) #align multiplicity.not_unit_of_finite multiplicity.not_unit_of_finite theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b := fun ⟨n, hn⟩ => ⟨n, fun h => hn (h.trans (dvd_mul_right _ _))⟩ #align multiplicity.finite_of_finite_mul_right multiplicity.finite_of_finite_mul_right variable [DecidableRel ((· ∣ ·) : α → α → Prop)] [DecidableRel ((· ∣ ·) : β → β → Prop)] theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} : (k : PartENat) ≤ multiplicity a b → a ^ k ∣ b := by rw [← PartENat.some_eq_natCast] exact Nat.casesOn k (fun _ => by rw [_root_.pow_zero] exact one_dvd _) fun k ⟨_, h₂⟩ => by_contradiction fun hk => Nat.find_min _ (lt_of_succ_le (h₂ ⟨k, hk⟩)) hk #align multiplicity.pow_dvd_of_le_multiplicity multiplicity.pow_dvd_of_le_multiplicity theorem pow_multiplicity_dvd {a b : α} (h : Finite a b) : a ^ get (multiplicity a b) h ∣ b := pow_dvd_of_le_multiplicity (by rw [PartENat.natCast_get]) #align multiplicity.pow_multiplicity_dvd multiplicity.pow_multiplicity_dvd theorem is_greatest {a b : α} {m : ℕ} (hm : multiplicity a b < m) : ¬a ^ m ∣ b := fun h => by rw [PartENat.lt_coe_iff] at hm; exact Nat.find_spec hm.fst ((pow_dvd_pow _ hm.snd).trans h) #align multiplicity.is_greatest multiplicity.is_greatest theorem is_greatest' {a b : α} {m : ℕ} (h : Finite a b) (hm : get (multiplicity a b) h < m) : ¬a ^ m ∣ b := is_greatest (by rwa [← PartENat.coe_lt_coe, PartENat.natCast_get] at hm) #align multiplicity.is_greatest' multiplicity.is_greatest' theorem pos_of_dvd {a b : α} (hfin : Finite a b) (hdiv : a ∣ b) : 0 < (multiplicity a b).get hfin := by refine' zero_lt_iff.2 fun h => _ simpa [hdiv] using is_greatest' hfin (lt_one_iff.mpr h) #align multiplicity.pos_of_dvd multiplicity.pos_of_dvd theorem unique {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : (k : PartENat) = multiplicity a b := le_antisymm (le_of_not_gt fun hk' => is_greatest hk' hk) <| by have : Finite a b := ⟨k, hsucc⟩ rw [PartENat.le_coe_iff] exact ⟨this, Nat.find_min' _ hsucc⟩ #align multiplicity.unique multiplicity.unique theorem unique' {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : k = get (multiplicity a b) ⟨k, hsucc⟩ := by rw [← PartENat.natCast_inj, PartENat.natCast_get, unique hk hsucc] #align multiplicity.unique' multiplicity.unique' theorem le_multiplicity_of_pow_dvd {a b : α} {k : ℕ} (hk : a ^ k ∣ b) : (k : PartENat) ≤ multiplicity a b := le_of_not_gt fun hk' => is_greatest hk' hk #align multiplicity.le_multiplicity_of_pow_dvd multiplicity.le_multiplicity_of_pow_dvd theorem pow_dvd_iff_le_multiplicity {a b : α} {k : ℕ} : a ^ k ∣ b ↔ (k : PartENat) ≤ multiplicity a b := ⟨le_multiplicity_of_pow_dvd, pow_dvd_of_le_multiplicity⟩ #align multiplicity.pow_dvd_iff_le_multiplicity multiplicity.pow_dvd_iff_le_multiplicity theorem multiplicity_lt_iff_not_dvd {a b : α} {k : ℕ} : multiplicity a b < (k : PartENat) ↔ ¬a ^ k ∣ b := by rw [pow_dvd_iff_le_multiplicity, not_le] #align multiplicity.multiplicity_lt_iff_neg_dvd multiplicity.multiplicity_lt_iff_not_dvd theorem eq_coe_iff {a b : α} {n : ℕ} : multiplicity a b = (n : PartENat) ↔ a ^ n ∣ b ∧ ¬a ^ (n + 1) ∣ b := by rw [← PartENat.some_eq_natCast] exact ⟨fun h => let ⟨h₁, h₂⟩ := eq_some_iff.1 h h₂ ▸ ⟨pow_multiplicity_dvd _, is_greatest (by rw [PartENat.lt_coe_iff] exact ⟨h₁, lt_succ_self _⟩)⟩, fun h => eq_some_iff.2 ⟨⟨n, h.2⟩, Eq.symm <| unique' h.1 h.2⟩⟩ #align multiplicity.eq_coe_iff multiplicity.eq_coe_iff theorem eq_top_iff {a b : α} : multiplicity a b = ⊤ ↔ ∀ n : ℕ, a ^ n ∣ b := (PartENat.find_eq_top_iff _).trans <| by simp only [Classical.not_not] exact ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) fun n => h _, fun h n => h _⟩ #align multiplicity.eq_top_iff multiplicity.eq_top_iff @[simp] theorem isUnit_left {a : α} (b : α) (ha : IsUnit a) : multiplicity a b = ⊤ := eq_top_iff.2 fun _ => IsUnit.dvd (ha.pow _) #align multiplicity.is_unit_left multiplicity.isUnit_left -- @[simp] Porting note: simp can prove this theorem one_left (b : α) : multiplicity 1 b = ⊤ := isUnit_left b isUnit_one #align multiplicity.one_left multiplicity.one_left @[simp] theorem get_one_right {a : α} (ha : Finite a 1) : get (multiplicity a 1) ha = 0 := by rw [PartENat.get_eq_iff_eq_coe, eq_coe_iff, _root_.pow_zero] simp [not_dvd_one_of_finite_one_right ha] #align multiplicity.get_one_right multiplicity.get_one_right -- @[simp] Porting note: simp can prove this theorem unit_left (a : α) (u : αˣ) : multiplicity (u : α) a = ⊤ := isUnit_left a u.isUnit #align multiplicity.unit_left multiplicity.unit_left theorem multiplicity_eq_zero {a b : α} : multiplicity a b = 0 ↔ ¬a ∣ b := by rw [← Nat.cast_zero, eq_coe_iff] simp only [_root_.pow_zero, isUnit_one, IsUnit.dvd, zero_add, pow_one, true_and] #align multiplicity.multiplicity_eq_zero multiplicity.multiplicity_eq_zero theorem multiplicity_ne_zero {a b : α} : multiplicity a b ≠ 0 ↔ a ∣ b := multiplicity_eq_zero.not_left #align multiplicity.multiplicity_ne_zero multiplicity.multiplicity_ne_zero theorem eq_top_iff_not_finite {a b : α} : multiplicity a b = ⊤ ↔ ¬Finite a b := Part.eq_none_iff' #align multiplicity.eq_top_iff_not_finite multiplicity.eq_top_iff_not_finite theorem ne_top_iff_finite {a b : α} : multiplicity a b ≠ ⊤ ↔ Finite a b := by rw [Ne.def, eq_top_iff_not_finite, Classical.not_not] #align multiplicity.ne_top_iff_finite multiplicity.ne_top_iff_finite theorem lt_top_iff_finite {a b : α} : multiplicity a b < ⊤ ↔ Finite a b := by rw [lt_top_iff_ne_top, ne_top_iff_finite] #align multiplicity.lt_top_iff_finite multiplicity.lt_top_iff_finite theorem exists_eq_pow_mul_and_not_dvd {a b : α} (hfin : Finite a b) : ∃ c : α, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c := by obtain ⟨c, hc⟩ := multiplicity.pow_multiplicity_dvd hfin refine' ⟨c, hc, _⟩ rintro ⟨k, hk⟩ rw [hk, ← mul_assoc, ← _root_.pow_succ'] at hc have h₁ : a ^ ((multiplicity a b).get hfin + 1) ∣ b := ⟨k, hc⟩ exact (multiplicity.eq_coe_iff.1 (by simp)).2 h₁ #align multiplicity.exists_eq_pow_mul_and_not_dvd multiplicity.exists_eq_pow_mul_and_not_dvd theorem multiplicity_le_multiplicity_iff {a b : α} {c d : β} : multiplicity a b ≤ multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b → c ^ n ∣ d := ⟨fun h n hab => pow_dvd_of_le_multiplicity (le_trans (le_multiplicity_of_pow_dvd hab) h), fun h => letI := Classical.dec (Finite a b) if hab : Finite a b then by rw [← PartENat.natCast_get (finite_iff_dom.1 hab)]; exact le_multiplicity_of_pow_dvd (h _ (pow_multiplicity_dvd _)) else by have : ∀ n : ℕ, c ^ n ∣ d := fun n => h n (not_finite_iff_forall.1 hab _) rw [eq_top_iff_not_finite.2 hab, eq_top_iff_not_finite.2 (not_finite_iff_forall.2 this)]⟩ #align multiplicity.multiplicity_le_multiplicity_iff multiplicity.multiplicity_le_multiplicity_iff theorem multiplicity_eq_multiplicity_iff {a b : α} {c d : β} : multiplicity a b = multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b ↔ c ^ n ∣ d := ⟨fun h n => ⟨multiplicity_le_multiplicity_iff.mp h.le n, multiplicity_le_multiplicity_iff.mp h.ge n⟩, fun h => le_antisymm (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mp) (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mpr)⟩ #align multiplicity.multiplicity_eq_multiplicity_iff multiplicity.multiplicity_eq_multiplicity_iff theorem le_multiplicity_map {F : Type*} [MonoidHomClass F α β] (f : F) {a b : α} : multiplicity a b ≤ multiplicity (f a) (f b) := multiplicity_le_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd f theorem multiplicity_map_eq {F : Type*} [MulEquivClass F α β] (f : F) {a b : α} : multiplicity (f a) (f b) = multiplicity a b := multiplicity_eq_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd_iff f theorem multiplicity_le_multiplicity_of_dvd_right {a b c : α} (h : b ∣ c) : multiplicity a b ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun _ hb => hb.trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_right multiplicity.multiplicity_le_multiplicity_of_dvd_right theorem eq_of_associated_right {a b c : α} (h : Associated b c) : multiplicity a b = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_right h.dvd) (multiplicity_le_multiplicity_of_dvd_right h.symm.dvd) #align multiplicity.eq_of_associated_right multiplicity.eq_of_associated_right theorem dvd_of_multiplicity_pos {a b : α} (h : (0 : PartENat) < multiplicity a b) : a ∣ b := by rw [← pow_one a] apply pow_dvd_of_le_multiplicity simpa only [Nat.cast_one, PartENat.pos_iff_one_le] using h #align multiplicity.dvd_of_multiplicity_pos multiplicity.dvd_of_multiplicity_pos theorem dvd_iff_multiplicity_pos {a b : α} : (0 : PartENat) < multiplicity a b ↔ a ∣ b := ⟨dvd_of_multiplicity_pos, fun hdvd => lt_of_le_of_ne (zero_le _) fun heq => is_greatest (show multiplicity a b < ↑1 by simpa only [heq, Nat.cast_zero] using PartENat.coe_lt_coe.mpr zero_lt_one) (by rwa [pow_one a])⟩ #align multiplicity.dvd_iff_multiplicity_pos multiplicity.dvd_iff_multiplicity_pos theorem finite_nat_iff {a b : ℕ} : Finite a b ↔ a ≠ 1 ∧ 0 < b := by rw [← not_iff_not, not_finite_iff_forall, not_and_or, Ne.def, Classical.not_not, not_lt, le_zero_iff] exact ⟨fun h => or_iff_not_imp_right.2 fun hb => have ha : a ≠ 0 := fun ha => hb <| zero_dvd_iff.mp <| by rw [ha] at h; exact h 1 Classical.by_contradiction fun ha1 : a ≠ 1 => have ha_gt_one : 1 < a := lt_of_not_ge fun _ => match a with | 0 => ha rfl | 1 => ha1 rfl | b+2 => by linarith not_lt_of_ge (le_of_dvd (Nat.pos_of_ne_zero hb) (h b)) (lt_pow_self ha_gt_one b), fun h => by cases h <;> simp [*]⟩ #align multiplicity.finite_nat_iff multiplicity.finite_nat_iff alias ⟨_, _root_.has_dvd.dvd.multiplicity_pos⟩ := dvd_iff_multiplicity_pos end Monoid section CommMonoid variable [CommMonoid α] theorem finite_of_finite_mul_left {a b c : α} : Finite a (b * c) → Finite a c := by rw [mul_comm]; exact finite_of_finite_mul_right #align multiplicity.finite_of_finite_mul_left multiplicity.finite_of_finite_mul_left variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem isUnit_right {a b : α} (ha : ¬IsUnit a) (hb : IsUnit b) : multiplicity a b = 0 := eq_coe_iff.2 ⟨show a ^ 0 ∣ b by simp only [_root_.pow_zero, one_dvd], by rw [pow_one] exact fun h => mt (isUnit_of_dvd_unit h) ha hb⟩ #align multiplicity.is_unit_right multiplicity.isUnit_right theorem one_right {a : α} (ha : ¬IsUnit a) : multiplicity a 1 = 0 := isUnit_right ha isUnit_one #align multiplicity.one_right multiplicity.one_right theorem unit_right {a : α} (ha : ¬IsUnit a) (u : αˣ) : multiplicity a u = 0 := isUnit_right ha u.isUnit #align multiplicity.unit_right multiplicity.unit_right open Classical theorem multiplicity_le_multiplicity_of_dvd_left {a b c : α} (hdvd : a ∣ b) : multiplicity b c ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun n h => (pow_dvd_pow_of_dvd hdvd n).trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_left multiplicity.multiplicity_le_multiplicity_of_dvd_left theorem eq_of_associated_left {a b c : α} (h : Associated a b) : multiplicity b c = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_left h.dvd) (multiplicity_le_multiplicity_of_dvd_left h.symm.dvd) #align multiplicity.eq_of_associated_left multiplicity.eq_of_associated_left -- Porting note: this was doing nothing in mathlib3 also -- alias dvd_iff_multiplicity_pos ↔ _ _root_.has_dvd.dvd.multiplicity_pos end CommMonoid section MonoidWithZero variable [MonoidWithZero α] theorem ne_zero_of_finite {a b : α} (h : Finite a b) : b ≠ 0 := let ⟨n, hn⟩ := h fun hb => by simp [hb] at hn #align multiplicity.ne_zero_of_finite multiplicity.ne_zero_of_finite variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem zero (a : α) : multiplicity a 0 = ⊤ := Part.eq_none_iff.2 fun _ ⟨⟨_, hk⟩, _⟩ => hk (dvd_zero _) #align multiplicity.zero multiplicity.zero @[simp] theorem multiplicity_zero_eq_zero_of_ne_zero (a : α) (ha : a ≠ 0) : multiplicity 0 a = 0 := multiplicity.multiplicity_eq_zero.2 <| mt zero_dvd_iff.1 ha #align multiplicity.multiplicity_zero_eq_zero_of_ne_zero multiplicity.multiplicity_zero_eq_zero_of_ne_zero end MonoidWithZero section CommMonoidWithZero variable [CommMonoidWithZero α] variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem multiplicity_mk_eq_multiplicity [DecidableRel ((· ∣ ·) : Associates α → Associates α → Prop)] {a b : α} : multiplicity (Associates.mk a) (Associates.mk b) = multiplicity a b := by by_cases h : Finite a b · rw [← PartENat.natCast_get (finite_iff_dom.mp h)] refine' (multiplicity.unique (show Associates.mk a ^ (multiplicity a b).get h ∣ Associates.mk b from _) _).symm <;> rw [← Associates.mk_pow, Associates.mk_dvd_mk] · exact pow_multiplicity_dvd h · exact is_greatest ((PartENat.lt_coe_iff _ _).mpr (Exists.intro (finite_iff_dom.mp h) (Nat.lt_succ_self _))) · suffices ¬Finite (Associates.mk a) (Associates.mk b) by rw [finite_iff_dom, PartENat.not_dom_iff_eq_top] at h this rw [h, this] refine' not_finite_iff_forall.mpr fun n => by rw [← Associates.mk_pow, Associates.mk_dvd_mk] exact not_finite_iff_forall.mp h n #align multiplicity.multiplicity_mk_eq_multiplicity multiplicity.multiplicity_mk_eq_multiplicity end CommMonoidWithZero section Semiring variable [Semiring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem min_le_multiplicity_add {p a b : α} : min (multiplicity p a) (multiplicity p b) ≤ multiplicity p (a + b) := (le_total (multiplicity p a) (multiplicity p b)).elim (fun h => by rw [min_eq_left h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add hn (multiplicity_le_multiplicity_iff.1 h n hn)) fun h => by rw [min_eq_right h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add (multiplicity_le_multiplicity_iff.1 h n hn) hn #align multiplicity.min_le_multiplicity_add multiplicity.min_le_multiplicity_add end Semiring section Ring variable [Ring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem neg (a b : α) : multiplicity a (-b) = multiplicity a b := Part.ext' (by simp only [multiplicity, PartENat.find, dvd_neg]) fun h₁ h₂ => PartENat.natCast_inj.1 (by rw [PartENat.natCast_get] exact Eq.symm (unique (pow_multiplicity_dvd _).neg_right (mt dvd_neg.1 (is_greatest' _ (lt_succ_self _))))) #align multiplicity.neg multiplicity.neg theorem Int.natAbs (a : ℕ) (b : ℤ) : multiplicity a b.natAbs = multiplicity (a : ℤ) b := by cases' Int.natAbs_eq b with h h <;> conv_rhs => rw [h] · rw [Int.coe_nat_multiplicity] · rw [multiplicity.neg, Int.coe_nat_multiplicity] #align multiplicity.int.nat_abs multiplicity.Int.natAbs theorem multiplicity_add_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a + b) = multiplicity p b := by apply le_antisymm · apply PartENat.le_of_lt_add_one cases' PartENat.ne_top_iff.mp (PartENat.ne_top_of_lt h) with k hk rw [hk] rw_mod_cast [multiplicity_lt_iff_not_dvd, dvd_add_right] intro h_dvd · apply multiplicity.is_greatest _ h_dvd rw [hk, ← Nat.succ_eq_add_one] norm_cast apply Nat.lt_succ_self k · rw [pow_dvd_iff_le_multiplicity, Nat.cast_add, ← hk, Nat.cast_one] exact PartENat.add_one_le_of_lt h · have := @min_le_multiplicity_add α _ _ p a b rwa [← min_eq_right (le_of_lt h)] #align multiplicity.multiplicity_add_of_gt multiplicity.multiplicity_add_of_gt theorem multiplicity_sub_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a - b) = multiplicity p b := by rw [sub_eq_add_neg, multiplicity_add_of_gt] <;> rw [multiplicity.neg]; assumption #align multiplicity.multiplicity_sub_of_gt multiplicity.multiplicity_sub_of_gt theorem multiplicity_add_eq_min {p a b : α} (h : multiplicity p a ≠ multiplicity p b) : multiplicity p (a + b) = min (multiplicity p a) (multiplicity p b) := by rcases lt_trichotomy (multiplicity p a) (multiplicity p b) with (hab | hab | hab) · rw [add_comm, multiplicity_add_of_gt hab, min_eq_left] exact le_of_lt hab · contradiction · rw [multiplicity_add_of_gt hab, min_eq_right] exact le_of_lt hab #align multiplicity.multiplicity_add_eq_min multiplicity.multiplicity_add_eq_min end Ring section CancelCommMonoidWithZero variable [CancelCommMonoidWithZero α] /- Porting note: removed previous wf recursion hints and added termination_by Also pulled a b intro parameters since Lean parses that more easily -/ theorem finite_mul_aux {p : α} (hp : Prime p) {a b : α} : ∀ {n m : ℕ}, ¬p ^ (n + 1) ∣ a → ¬p ^ (m + 1) ∣ b → ¬p ^ (n + m + 1) ∣ a * b | n, m => fun ha hb ⟨s, hs⟩ => have : p ∣ a * b := ⟨p ^ (n + m) * s, by simp [hs, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩ (hp.2.2 a b this).elim (fun ⟨x, hx⟩ => have hn0 : 0 < n := Nat.pos_of_ne_zero fun hn0 => by simp [hx, hn0] at ha have hpx : ¬p ^ (n - 1 + 1) ∣ x := fun ⟨y, hy⟩ => ha (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hn0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) have : 1 ≤ n + m := le_trans hn0 (Nat.le_add_right n m) finite_mul_aux hp hpx hb ⟨s, mul_right_cancel₀ hp.1 (by rw [tsub_add_eq_add_tsub (succ_le_of_lt hn0), tsub_add_cancel_of_le this] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩) fun ⟨x, hx⟩ => have hm0 : 0 < m := Nat.pos_of_ne_zero fun hm0 => by simp [hx, hm0] at hb have hpx : ¬p ^ (m - 1 + 1) ∣ x := fun ⟨y, hy⟩ => hb (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hm0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) finite_mul_aux hp ha hpx ⟨s, mul_right_cancel₀ hp.1 (by rw [add_assoc, tsub_add_cancel_of_le (succ_le_of_lt hm0)] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩ termination_by finite_mul_aux _ _ n m => n+m #align multiplicity.finite_mul_aux multiplicity.finite_mul_aux theorem finite_mul {p a b : α} (hp : Prime p) : Finite p a → Finite p b → Finite p (a * b) := fun ⟨n, hn⟩ ⟨m, hm⟩ => ⟨n + m, finite_mul_aux hp hn hm⟩ #align multiplicity.finite_mul multiplicity.finite_mul theorem finite_mul_iff {p a b : α} (hp : Prime p) : Finite p (a * b) ↔ Finite p a ∧ Finite p b := ⟨fun h => ⟨finite_of_finite_mul_right h, finite_of_finite_mul_left h⟩, fun h => finite_mul hp h.1 h.2⟩ #align multiplicity.finite_mul_iff multiplicity.finite_mul_iff theorem finite_pow {p a : α} (hp : Prime p) : ∀ {k : ℕ} (_ : Finite p a), Finite p (a ^ k) | 0, _ => ⟨0, by simp [mt isUnit_iff_dvd_one.2 hp.2.1]⟩ | k + 1, ha => by rw [_root_.pow_succ]; exact finite_mul hp ha (finite_pow hp ha) #align multiplicity.finite_pow multiplicity.finite_pow variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] theorem multiplicity_self {a : α} (ha : ¬IsUnit a) (ha0 : a ≠ 0) : multiplicity a a = 1 := by rw [← Nat.cast_one] exact eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => ha (isUnit_iff_dvd_one.2 ⟨b, mul_left_cancel₀ ha0 <| by simpa [_root_.pow_succ, mul_assoc] using hb⟩)⟩ #align multiplicity.multiplicity_self multiplicity.multiplicity_self @[simp] theorem get_multiplicity_self {a : α} (ha : Finite a a) : get (multiplicity a a) ha = 1 := PartENat.get_eq_iff_eq_coe.2 (eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => by rw [← mul_one a, pow_add, pow_one, mul_assoc, mul_assoc, mul_right_inj' (ne_zero_of_finite ha)] at hb; exact mt isUnit_iff_dvd_one.2 (not_unit_of_finite ha) ⟨b, by simp_all⟩⟩) #align multiplicity.get_multiplicity_self multiplicity.get_multiplicity_self protected theorem mul' {p a b : α} (hp : Prime p) (h : (multiplicity p (a * b)).Dom) : get (multiplicity p (a * b)) h = get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by have hdiva : p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 ∣ a := pow_multiplicity_dvd _ have hdivb : p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 ∣ b := pow_multiplicity_dvd _ have hpoweq : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) = p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 * p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by simp [pow_add] have hdiv : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) ∣ a * b := by rw [hpoweq]; apply mul_dvd_mul <;> assumption have hsucc : ¬p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 + 1) ∣ a * b := fun h => not_or_of_not (is_greatest' _ (lt_succ_self _)) (is_greatest' _ (lt_succ_self _)) (_root_.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul hp hdiva hdivb h) rw [← PartENat.natCast_inj, PartENat.natCast_get, eq_coe_iff]; exact ⟨hdiv, hsucc⟩ #align multiplicity.mul' multiplicity.mul' open Classical protected theorem mul {p a b : α} (hp : Prime p) : multiplicity p (a * b) = multiplicity p a + multiplicity p b := if h : Finite p a ∧ Finite p b then by rw [← PartENat.natCast_get (finite_iff_dom.1 h.1), ← PartENat.natCast_get (finite_iff_dom.1 h.2), ← PartENat.natCast_get (finite_iff_dom.1 (finite_mul hp h.1 h.2)), ← Nat.cast_add, PartENat.natCast_inj, multiplicity.mul' hp] else by rw [eq_top_iff_not_finite.2 (mt (finite_mul_iff hp).1 h)] cases' not_and_or.1 h with h h <;> simp [eq_top_iff_not_finite.2 h] #align multiplicity.mul multiplicity.mul theorem Finset.prod {β : Type*} {p : α} (hp : Prime p) (s : Finset β) (f : β → α) : multiplicity p (∏ x in s, f x) = ∑ x in s, multiplicity p (f x) := by classical induction' s using Finset.induction with a s has ih h · simp only [Finset.sum_empty, Finset.prod_empty] convert one_right hp.not_unit · simp [has, ← ih] convert multiplicity.mul hp #align multiplicity.finset.prod multiplicity.Finset.prod -- Porting note: with protected could not use pow' k in the succ branch protected theorem pow' {p a : α} (hp : Prime p) (ha : Finite p a) : ∀ {k : ℕ}, get (multiplicity p (a ^ k)) (finite_pow hp ha) = k * get (multiplicity p a) ha := by intro k induction' k with k hk · simp [one_right hp.not_unit] · have : multiplicity p (a ^ (k + 1)) = multiplicity p (a * a ^ k) := by rw [_root_.pow_succ] rw [succ_eq_add_one, get_eq_get_of_eq _ _ this, multiplicity.mul' hp, hk, add_mul, one_mul, add_comm] #align multiplicity.pow' multiplicity.pow' theorem pow {p a : α} (hp : Prime p) : ∀ {k : ℕ}, multiplicity p (a ^ k) = k • multiplicity p a | 0 => by simp [one_right hp.not_unit] | succ k => by simp [_root_.pow_succ, succ_nsmul, pow hp, multiplicity.mul hp] #align multiplicity.pow multiplicity.pow theorem multiplicity_pow_self {p : α} (h0 : p ≠ 0) (hu : ¬IsUnit p) (n : ℕ) : multiplicity p (p ^ n) = n := by rw [eq_coe_iff] use dvd_rfl rw [pow_dvd_pow_iff h0 hu] apply Nat.not_succ_le_self #align multiplicity.multiplicity_pow_self multiplicity.multiplicity_pow_self theorem multiplicity_pow_self_of_prime {p : α} (hp : Prime p) (n : ℕ) : multiplicity p (p ^ n) = n := multiplicity_pow_self hp.ne_zero hp.not_unit n #align multiplicity.multiplicity_pow_self_of_prime multiplicity.multiplicity_pow_self_of_prime end CancelCommMonoidWithZero end multiplicity section Nat open multiplicity theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity]
intro h
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity]
Mathlib.RingTheory.Multiplicity.640_0.uTHZeAJqYiw3Jx8
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0
Mathlib_RingTheory_Multiplicity
α : Type u_1 β : Type u_2 p a b : ℕ hp : p ≠ 1 hle : ∀ (n : ℕ), p ^ n ∣ a → p ^ n ∣ b hab : Coprime a b h : p ^ 1 ∣ a ⊢ False
/- Copyright (c) 2018 Robert Y. Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Y. Lewis, Chris Hughes -/ import Mathlib.Algebra.Associated import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.PartENat import Mathlib.Tactic.Linarith #align_import ring_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Multiplicity of a divisor For a commutative monoid, this file introduces the notion of multiplicity of a divisor and proves several basic results on it. ## Main definitions * `multiplicity a b`: for two elements `a` and `b` of a commutative monoid returns the largest number `n` such that `a ^ n ∣ b` or infinity, written `⊤`, if `a ^ n ∣ b` for all natural numbers `n`. * `multiplicity.Finite a b`: a predicate denoting that the multiplicity of `a` in `b` is finite. -/ variable {α β : Type*} open Nat Part open BigOperators /-- `multiplicity a b` returns the largest natural number `n` such that `a ^ n ∣ b`, as a `PartENat` or natural with infinity. If `∀ n, a ^ n ∣ b`, then it returns `⊤`-/ def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat := PartENat.find fun n => ¬a ^ (n + 1) ∣ b #align multiplicity multiplicity namespace multiplicity section Monoid variable [Monoid α] [Monoid β] /-- `multiplicity.Finite a b` indicates that the multiplicity of `a` in `b` is finite. -/ @[reducible] def Finite (a b : α) : Prop := ∃ n : ℕ, ¬a ^ (n + 1) ∣ b #align multiplicity.finite multiplicity.Finite theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} : Finite a b ↔ (multiplicity a b).Dom := Iff.rfl #align multiplicity.finite_iff_dom multiplicity.finite_iff_dom theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b := Iff.rfl #align multiplicity.finite_def multiplicity.finite_def theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 := fun ⟨n, hn⟩ ⟨d, hd⟩ => hn ⟨d ^ (n + 1), (pow_mul_pow_eq_one (n + 1) hd.symm).symm⟩ #align multiplicity.not_dvd_one_of_finite_one_right multiplicity.not_dvd_one_of_finite_one_right @[norm_cast] theorem Int.coe_nat_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b := by apply Part.ext' · rw [← @finite_iff_dom ℕ, @finite_def ℕ, ← @finite_iff_dom ℤ, @finite_def ℤ] norm_cast · intro h1 h2 apply _root_.le_antisymm <;> · apply Nat.find_mono norm_cast simp #align multiplicity.int.coe_nat_multiplicity multiplicity.Int.coe_nat_multiplicity theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b := ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) (by simpa [Finite, Classical.not_not] using h), by simp [Finite, multiplicity, Classical.not_not]; tauto⟩ #align multiplicity.not_finite_iff_forall multiplicity.not_finite_iff_forall theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a := let ⟨n, hn⟩ := h hn ∘ IsUnit.dvd ∘ IsUnit.pow (n + 1) #align multiplicity.not_unit_of_finite multiplicity.not_unit_of_finite theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b := fun ⟨n, hn⟩ => ⟨n, fun h => hn (h.trans (dvd_mul_right _ _))⟩ #align multiplicity.finite_of_finite_mul_right multiplicity.finite_of_finite_mul_right variable [DecidableRel ((· ∣ ·) : α → α → Prop)] [DecidableRel ((· ∣ ·) : β → β → Prop)] theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} : (k : PartENat) ≤ multiplicity a b → a ^ k ∣ b := by rw [← PartENat.some_eq_natCast] exact Nat.casesOn k (fun _ => by rw [_root_.pow_zero] exact one_dvd _) fun k ⟨_, h₂⟩ => by_contradiction fun hk => Nat.find_min _ (lt_of_succ_le (h₂ ⟨k, hk⟩)) hk #align multiplicity.pow_dvd_of_le_multiplicity multiplicity.pow_dvd_of_le_multiplicity theorem pow_multiplicity_dvd {a b : α} (h : Finite a b) : a ^ get (multiplicity a b) h ∣ b := pow_dvd_of_le_multiplicity (by rw [PartENat.natCast_get]) #align multiplicity.pow_multiplicity_dvd multiplicity.pow_multiplicity_dvd theorem is_greatest {a b : α} {m : ℕ} (hm : multiplicity a b < m) : ¬a ^ m ∣ b := fun h => by rw [PartENat.lt_coe_iff] at hm; exact Nat.find_spec hm.fst ((pow_dvd_pow _ hm.snd).trans h) #align multiplicity.is_greatest multiplicity.is_greatest theorem is_greatest' {a b : α} {m : ℕ} (h : Finite a b) (hm : get (multiplicity a b) h < m) : ¬a ^ m ∣ b := is_greatest (by rwa [← PartENat.coe_lt_coe, PartENat.natCast_get] at hm) #align multiplicity.is_greatest' multiplicity.is_greatest' theorem pos_of_dvd {a b : α} (hfin : Finite a b) (hdiv : a ∣ b) : 0 < (multiplicity a b).get hfin := by refine' zero_lt_iff.2 fun h => _ simpa [hdiv] using is_greatest' hfin (lt_one_iff.mpr h) #align multiplicity.pos_of_dvd multiplicity.pos_of_dvd theorem unique {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : (k : PartENat) = multiplicity a b := le_antisymm (le_of_not_gt fun hk' => is_greatest hk' hk) <| by have : Finite a b := ⟨k, hsucc⟩ rw [PartENat.le_coe_iff] exact ⟨this, Nat.find_min' _ hsucc⟩ #align multiplicity.unique multiplicity.unique theorem unique' {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : k = get (multiplicity a b) ⟨k, hsucc⟩ := by rw [← PartENat.natCast_inj, PartENat.natCast_get, unique hk hsucc] #align multiplicity.unique' multiplicity.unique' theorem le_multiplicity_of_pow_dvd {a b : α} {k : ℕ} (hk : a ^ k ∣ b) : (k : PartENat) ≤ multiplicity a b := le_of_not_gt fun hk' => is_greatest hk' hk #align multiplicity.le_multiplicity_of_pow_dvd multiplicity.le_multiplicity_of_pow_dvd theorem pow_dvd_iff_le_multiplicity {a b : α} {k : ℕ} : a ^ k ∣ b ↔ (k : PartENat) ≤ multiplicity a b := ⟨le_multiplicity_of_pow_dvd, pow_dvd_of_le_multiplicity⟩ #align multiplicity.pow_dvd_iff_le_multiplicity multiplicity.pow_dvd_iff_le_multiplicity theorem multiplicity_lt_iff_not_dvd {a b : α} {k : ℕ} : multiplicity a b < (k : PartENat) ↔ ¬a ^ k ∣ b := by rw [pow_dvd_iff_le_multiplicity, not_le] #align multiplicity.multiplicity_lt_iff_neg_dvd multiplicity.multiplicity_lt_iff_not_dvd theorem eq_coe_iff {a b : α} {n : ℕ} : multiplicity a b = (n : PartENat) ↔ a ^ n ∣ b ∧ ¬a ^ (n + 1) ∣ b := by rw [← PartENat.some_eq_natCast] exact ⟨fun h => let ⟨h₁, h₂⟩ := eq_some_iff.1 h h₂ ▸ ⟨pow_multiplicity_dvd _, is_greatest (by rw [PartENat.lt_coe_iff] exact ⟨h₁, lt_succ_self _⟩)⟩, fun h => eq_some_iff.2 ⟨⟨n, h.2⟩, Eq.symm <| unique' h.1 h.2⟩⟩ #align multiplicity.eq_coe_iff multiplicity.eq_coe_iff theorem eq_top_iff {a b : α} : multiplicity a b = ⊤ ↔ ∀ n : ℕ, a ^ n ∣ b := (PartENat.find_eq_top_iff _).trans <| by simp only [Classical.not_not] exact ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) fun n => h _, fun h n => h _⟩ #align multiplicity.eq_top_iff multiplicity.eq_top_iff @[simp] theorem isUnit_left {a : α} (b : α) (ha : IsUnit a) : multiplicity a b = ⊤ := eq_top_iff.2 fun _ => IsUnit.dvd (ha.pow _) #align multiplicity.is_unit_left multiplicity.isUnit_left -- @[simp] Porting note: simp can prove this theorem one_left (b : α) : multiplicity 1 b = ⊤ := isUnit_left b isUnit_one #align multiplicity.one_left multiplicity.one_left @[simp] theorem get_one_right {a : α} (ha : Finite a 1) : get (multiplicity a 1) ha = 0 := by rw [PartENat.get_eq_iff_eq_coe, eq_coe_iff, _root_.pow_zero] simp [not_dvd_one_of_finite_one_right ha] #align multiplicity.get_one_right multiplicity.get_one_right -- @[simp] Porting note: simp can prove this theorem unit_left (a : α) (u : αˣ) : multiplicity (u : α) a = ⊤ := isUnit_left a u.isUnit #align multiplicity.unit_left multiplicity.unit_left theorem multiplicity_eq_zero {a b : α} : multiplicity a b = 0 ↔ ¬a ∣ b := by rw [← Nat.cast_zero, eq_coe_iff] simp only [_root_.pow_zero, isUnit_one, IsUnit.dvd, zero_add, pow_one, true_and] #align multiplicity.multiplicity_eq_zero multiplicity.multiplicity_eq_zero theorem multiplicity_ne_zero {a b : α} : multiplicity a b ≠ 0 ↔ a ∣ b := multiplicity_eq_zero.not_left #align multiplicity.multiplicity_ne_zero multiplicity.multiplicity_ne_zero theorem eq_top_iff_not_finite {a b : α} : multiplicity a b = ⊤ ↔ ¬Finite a b := Part.eq_none_iff' #align multiplicity.eq_top_iff_not_finite multiplicity.eq_top_iff_not_finite theorem ne_top_iff_finite {a b : α} : multiplicity a b ≠ ⊤ ↔ Finite a b := by rw [Ne.def, eq_top_iff_not_finite, Classical.not_not] #align multiplicity.ne_top_iff_finite multiplicity.ne_top_iff_finite theorem lt_top_iff_finite {a b : α} : multiplicity a b < ⊤ ↔ Finite a b := by rw [lt_top_iff_ne_top, ne_top_iff_finite] #align multiplicity.lt_top_iff_finite multiplicity.lt_top_iff_finite theorem exists_eq_pow_mul_and_not_dvd {a b : α} (hfin : Finite a b) : ∃ c : α, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c := by obtain ⟨c, hc⟩ := multiplicity.pow_multiplicity_dvd hfin refine' ⟨c, hc, _⟩ rintro ⟨k, hk⟩ rw [hk, ← mul_assoc, ← _root_.pow_succ'] at hc have h₁ : a ^ ((multiplicity a b).get hfin + 1) ∣ b := ⟨k, hc⟩ exact (multiplicity.eq_coe_iff.1 (by simp)).2 h₁ #align multiplicity.exists_eq_pow_mul_and_not_dvd multiplicity.exists_eq_pow_mul_and_not_dvd theorem multiplicity_le_multiplicity_iff {a b : α} {c d : β} : multiplicity a b ≤ multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b → c ^ n ∣ d := ⟨fun h n hab => pow_dvd_of_le_multiplicity (le_trans (le_multiplicity_of_pow_dvd hab) h), fun h => letI := Classical.dec (Finite a b) if hab : Finite a b then by rw [← PartENat.natCast_get (finite_iff_dom.1 hab)]; exact le_multiplicity_of_pow_dvd (h _ (pow_multiplicity_dvd _)) else by have : ∀ n : ℕ, c ^ n ∣ d := fun n => h n (not_finite_iff_forall.1 hab _) rw [eq_top_iff_not_finite.2 hab, eq_top_iff_not_finite.2 (not_finite_iff_forall.2 this)]⟩ #align multiplicity.multiplicity_le_multiplicity_iff multiplicity.multiplicity_le_multiplicity_iff theorem multiplicity_eq_multiplicity_iff {a b : α} {c d : β} : multiplicity a b = multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b ↔ c ^ n ∣ d := ⟨fun h n => ⟨multiplicity_le_multiplicity_iff.mp h.le n, multiplicity_le_multiplicity_iff.mp h.ge n⟩, fun h => le_antisymm (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mp) (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mpr)⟩ #align multiplicity.multiplicity_eq_multiplicity_iff multiplicity.multiplicity_eq_multiplicity_iff theorem le_multiplicity_map {F : Type*} [MonoidHomClass F α β] (f : F) {a b : α} : multiplicity a b ≤ multiplicity (f a) (f b) := multiplicity_le_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd f theorem multiplicity_map_eq {F : Type*} [MulEquivClass F α β] (f : F) {a b : α} : multiplicity (f a) (f b) = multiplicity a b := multiplicity_eq_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd_iff f theorem multiplicity_le_multiplicity_of_dvd_right {a b c : α} (h : b ∣ c) : multiplicity a b ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun _ hb => hb.trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_right multiplicity.multiplicity_le_multiplicity_of_dvd_right theorem eq_of_associated_right {a b c : α} (h : Associated b c) : multiplicity a b = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_right h.dvd) (multiplicity_le_multiplicity_of_dvd_right h.symm.dvd) #align multiplicity.eq_of_associated_right multiplicity.eq_of_associated_right theorem dvd_of_multiplicity_pos {a b : α} (h : (0 : PartENat) < multiplicity a b) : a ∣ b := by rw [← pow_one a] apply pow_dvd_of_le_multiplicity simpa only [Nat.cast_one, PartENat.pos_iff_one_le] using h #align multiplicity.dvd_of_multiplicity_pos multiplicity.dvd_of_multiplicity_pos theorem dvd_iff_multiplicity_pos {a b : α} : (0 : PartENat) < multiplicity a b ↔ a ∣ b := ⟨dvd_of_multiplicity_pos, fun hdvd => lt_of_le_of_ne (zero_le _) fun heq => is_greatest (show multiplicity a b < ↑1 by simpa only [heq, Nat.cast_zero] using PartENat.coe_lt_coe.mpr zero_lt_one) (by rwa [pow_one a])⟩ #align multiplicity.dvd_iff_multiplicity_pos multiplicity.dvd_iff_multiplicity_pos theorem finite_nat_iff {a b : ℕ} : Finite a b ↔ a ≠ 1 ∧ 0 < b := by rw [← not_iff_not, not_finite_iff_forall, not_and_or, Ne.def, Classical.not_not, not_lt, le_zero_iff] exact ⟨fun h => or_iff_not_imp_right.2 fun hb => have ha : a ≠ 0 := fun ha => hb <| zero_dvd_iff.mp <| by rw [ha] at h; exact h 1 Classical.by_contradiction fun ha1 : a ≠ 1 => have ha_gt_one : 1 < a := lt_of_not_ge fun _ => match a with | 0 => ha rfl | 1 => ha1 rfl | b+2 => by linarith not_lt_of_ge (le_of_dvd (Nat.pos_of_ne_zero hb) (h b)) (lt_pow_self ha_gt_one b), fun h => by cases h <;> simp [*]⟩ #align multiplicity.finite_nat_iff multiplicity.finite_nat_iff alias ⟨_, _root_.has_dvd.dvd.multiplicity_pos⟩ := dvd_iff_multiplicity_pos end Monoid section CommMonoid variable [CommMonoid α] theorem finite_of_finite_mul_left {a b c : α} : Finite a (b * c) → Finite a c := by rw [mul_comm]; exact finite_of_finite_mul_right #align multiplicity.finite_of_finite_mul_left multiplicity.finite_of_finite_mul_left variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem isUnit_right {a b : α} (ha : ¬IsUnit a) (hb : IsUnit b) : multiplicity a b = 0 := eq_coe_iff.2 ⟨show a ^ 0 ∣ b by simp only [_root_.pow_zero, one_dvd], by rw [pow_one] exact fun h => mt (isUnit_of_dvd_unit h) ha hb⟩ #align multiplicity.is_unit_right multiplicity.isUnit_right theorem one_right {a : α} (ha : ¬IsUnit a) : multiplicity a 1 = 0 := isUnit_right ha isUnit_one #align multiplicity.one_right multiplicity.one_right theorem unit_right {a : α} (ha : ¬IsUnit a) (u : αˣ) : multiplicity a u = 0 := isUnit_right ha u.isUnit #align multiplicity.unit_right multiplicity.unit_right open Classical theorem multiplicity_le_multiplicity_of_dvd_left {a b c : α} (hdvd : a ∣ b) : multiplicity b c ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun n h => (pow_dvd_pow_of_dvd hdvd n).trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_left multiplicity.multiplicity_le_multiplicity_of_dvd_left theorem eq_of_associated_left {a b c : α} (h : Associated a b) : multiplicity b c = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_left h.dvd) (multiplicity_le_multiplicity_of_dvd_left h.symm.dvd) #align multiplicity.eq_of_associated_left multiplicity.eq_of_associated_left -- Porting note: this was doing nothing in mathlib3 also -- alias dvd_iff_multiplicity_pos ↔ _ _root_.has_dvd.dvd.multiplicity_pos end CommMonoid section MonoidWithZero variable [MonoidWithZero α] theorem ne_zero_of_finite {a b : α} (h : Finite a b) : b ≠ 0 := let ⟨n, hn⟩ := h fun hb => by simp [hb] at hn #align multiplicity.ne_zero_of_finite multiplicity.ne_zero_of_finite variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem zero (a : α) : multiplicity a 0 = ⊤ := Part.eq_none_iff.2 fun _ ⟨⟨_, hk⟩, _⟩ => hk (dvd_zero _) #align multiplicity.zero multiplicity.zero @[simp] theorem multiplicity_zero_eq_zero_of_ne_zero (a : α) (ha : a ≠ 0) : multiplicity 0 a = 0 := multiplicity.multiplicity_eq_zero.2 <| mt zero_dvd_iff.1 ha #align multiplicity.multiplicity_zero_eq_zero_of_ne_zero multiplicity.multiplicity_zero_eq_zero_of_ne_zero end MonoidWithZero section CommMonoidWithZero variable [CommMonoidWithZero α] variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem multiplicity_mk_eq_multiplicity [DecidableRel ((· ∣ ·) : Associates α → Associates α → Prop)] {a b : α} : multiplicity (Associates.mk a) (Associates.mk b) = multiplicity a b := by by_cases h : Finite a b · rw [← PartENat.natCast_get (finite_iff_dom.mp h)] refine' (multiplicity.unique (show Associates.mk a ^ (multiplicity a b).get h ∣ Associates.mk b from _) _).symm <;> rw [← Associates.mk_pow, Associates.mk_dvd_mk] · exact pow_multiplicity_dvd h · exact is_greatest ((PartENat.lt_coe_iff _ _).mpr (Exists.intro (finite_iff_dom.mp h) (Nat.lt_succ_self _))) · suffices ¬Finite (Associates.mk a) (Associates.mk b) by rw [finite_iff_dom, PartENat.not_dom_iff_eq_top] at h this rw [h, this] refine' not_finite_iff_forall.mpr fun n => by rw [← Associates.mk_pow, Associates.mk_dvd_mk] exact not_finite_iff_forall.mp h n #align multiplicity.multiplicity_mk_eq_multiplicity multiplicity.multiplicity_mk_eq_multiplicity end CommMonoidWithZero section Semiring variable [Semiring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem min_le_multiplicity_add {p a b : α} : min (multiplicity p a) (multiplicity p b) ≤ multiplicity p (a + b) := (le_total (multiplicity p a) (multiplicity p b)).elim (fun h => by rw [min_eq_left h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add hn (multiplicity_le_multiplicity_iff.1 h n hn)) fun h => by rw [min_eq_right h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add (multiplicity_le_multiplicity_iff.1 h n hn) hn #align multiplicity.min_le_multiplicity_add multiplicity.min_le_multiplicity_add end Semiring section Ring variable [Ring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem neg (a b : α) : multiplicity a (-b) = multiplicity a b := Part.ext' (by simp only [multiplicity, PartENat.find, dvd_neg]) fun h₁ h₂ => PartENat.natCast_inj.1 (by rw [PartENat.natCast_get] exact Eq.symm (unique (pow_multiplicity_dvd _).neg_right (mt dvd_neg.1 (is_greatest' _ (lt_succ_self _))))) #align multiplicity.neg multiplicity.neg theorem Int.natAbs (a : ℕ) (b : ℤ) : multiplicity a b.natAbs = multiplicity (a : ℤ) b := by cases' Int.natAbs_eq b with h h <;> conv_rhs => rw [h] · rw [Int.coe_nat_multiplicity] · rw [multiplicity.neg, Int.coe_nat_multiplicity] #align multiplicity.int.nat_abs multiplicity.Int.natAbs theorem multiplicity_add_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a + b) = multiplicity p b := by apply le_antisymm · apply PartENat.le_of_lt_add_one cases' PartENat.ne_top_iff.mp (PartENat.ne_top_of_lt h) with k hk rw [hk] rw_mod_cast [multiplicity_lt_iff_not_dvd, dvd_add_right] intro h_dvd · apply multiplicity.is_greatest _ h_dvd rw [hk, ← Nat.succ_eq_add_one] norm_cast apply Nat.lt_succ_self k · rw [pow_dvd_iff_le_multiplicity, Nat.cast_add, ← hk, Nat.cast_one] exact PartENat.add_one_le_of_lt h · have := @min_le_multiplicity_add α _ _ p a b rwa [← min_eq_right (le_of_lt h)] #align multiplicity.multiplicity_add_of_gt multiplicity.multiplicity_add_of_gt theorem multiplicity_sub_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a - b) = multiplicity p b := by rw [sub_eq_add_neg, multiplicity_add_of_gt] <;> rw [multiplicity.neg]; assumption #align multiplicity.multiplicity_sub_of_gt multiplicity.multiplicity_sub_of_gt theorem multiplicity_add_eq_min {p a b : α} (h : multiplicity p a ≠ multiplicity p b) : multiplicity p (a + b) = min (multiplicity p a) (multiplicity p b) := by rcases lt_trichotomy (multiplicity p a) (multiplicity p b) with (hab | hab | hab) · rw [add_comm, multiplicity_add_of_gt hab, min_eq_left] exact le_of_lt hab · contradiction · rw [multiplicity_add_of_gt hab, min_eq_right] exact le_of_lt hab #align multiplicity.multiplicity_add_eq_min multiplicity.multiplicity_add_eq_min end Ring section CancelCommMonoidWithZero variable [CancelCommMonoidWithZero α] /- Porting note: removed previous wf recursion hints and added termination_by Also pulled a b intro parameters since Lean parses that more easily -/ theorem finite_mul_aux {p : α} (hp : Prime p) {a b : α} : ∀ {n m : ℕ}, ¬p ^ (n + 1) ∣ a → ¬p ^ (m + 1) ∣ b → ¬p ^ (n + m + 1) ∣ a * b | n, m => fun ha hb ⟨s, hs⟩ => have : p ∣ a * b := ⟨p ^ (n + m) * s, by simp [hs, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩ (hp.2.2 a b this).elim (fun ⟨x, hx⟩ => have hn0 : 0 < n := Nat.pos_of_ne_zero fun hn0 => by simp [hx, hn0] at ha have hpx : ¬p ^ (n - 1 + 1) ∣ x := fun ⟨y, hy⟩ => ha (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hn0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) have : 1 ≤ n + m := le_trans hn0 (Nat.le_add_right n m) finite_mul_aux hp hpx hb ⟨s, mul_right_cancel₀ hp.1 (by rw [tsub_add_eq_add_tsub (succ_le_of_lt hn0), tsub_add_cancel_of_le this] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩) fun ⟨x, hx⟩ => have hm0 : 0 < m := Nat.pos_of_ne_zero fun hm0 => by simp [hx, hm0] at hb have hpx : ¬p ^ (m - 1 + 1) ∣ x := fun ⟨y, hy⟩ => hb (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hm0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) finite_mul_aux hp ha hpx ⟨s, mul_right_cancel₀ hp.1 (by rw [add_assoc, tsub_add_cancel_of_le (succ_le_of_lt hm0)] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩ termination_by finite_mul_aux _ _ n m => n+m #align multiplicity.finite_mul_aux multiplicity.finite_mul_aux theorem finite_mul {p a b : α} (hp : Prime p) : Finite p a → Finite p b → Finite p (a * b) := fun ⟨n, hn⟩ ⟨m, hm⟩ => ⟨n + m, finite_mul_aux hp hn hm⟩ #align multiplicity.finite_mul multiplicity.finite_mul theorem finite_mul_iff {p a b : α} (hp : Prime p) : Finite p (a * b) ↔ Finite p a ∧ Finite p b := ⟨fun h => ⟨finite_of_finite_mul_right h, finite_of_finite_mul_left h⟩, fun h => finite_mul hp h.1 h.2⟩ #align multiplicity.finite_mul_iff multiplicity.finite_mul_iff theorem finite_pow {p a : α} (hp : Prime p) : ∀ {k : ℕ} (_ : Finite p a), Finite p (a ^ k) | 0, _ => ⟨0, by simp [mt isUnit_iff_dvd_one.2 hp.2.1]⟩ | k + 1, ha => by rw [_root_.pow_succ]; exact finite_mul hp ha (finite_pow hp ha) #align multiplicity.finite_pow multiplicity.finite_pow variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] theorem multiplicity_self {a : α} (ha : ¬IsUnit a) (ha0 : a ≠ 0) : multiplicity a a = 1 := by rw [← Nat.cast_one] exact eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => ha (isUnit_iff_dvd_one.2 ⟨b, mul_left_cancel₀ ha0 <| by simpa [_root_.pow_succ, mul_assoc] using hb⟩)⟩ #align multiplicity.multiplicity_self multiplicity.multiplicity_self @[simp] theorem get_multiplicity_self {a : α} (ha : Finite a a) : get (multiplicity a a) ha = 1 := PartENat.get_eq_iff_eq_coe.2 (eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => by rw [← mul_one a, pow_add, pow_one, mul_assoc, mul_assoc, mul_right_inj' (ne_zero_of_finite ha)] at hb; exact mt isUnit_iff_dvd_one.2 (not_unit_of_finite ha) ⟨b, by simp_all⟩⟩) #align multiplicity.get_multiplicity_self multiplicity.get_multiplicity_self protected theorem mul' {p a b : α} (hp : Prime p) (h : (multiplicity p (a * b)).Dom) : get (multiplicity p (a * b)) h = get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by have hdiva : p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 ∣ a := pow_multiplicity_dvd _ have hdivb : p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 ∣ b := pow_multiplicity_dvd _ have hpoweq : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) = p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 * p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by simp [pow_add] have hdiv : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) ∣ a * b := by rw [hpoweq]; apply mul_dvd_mul <;> assumption have hsucc : ¬p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 + 1) ∣ a * b := fun h => not_or_of_not (is_greatest' _ (lt_succ_self _)) (is_greatest' _ (lt_succ_self _)) (_root_.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul hp hdiva hdivb h) rw [← PartENat.natCast_inj, PartENat.natCast_get, eq_coe_iff]; exact ⟨hdiv, hsucc⟩ #align multiplicity.mul' multiplicity.mul' open Classical protected theorem mul {p a b : α} (hp : Prime p) : multiplicity p (a * b) = multiplicity p a + multiplicity p b := if h : Finite p a ∧ Finite p b then by rw [← PartENat.natCast_get (finite_iff_dom.1 h.1), ← PartENat.natCast_get (finite_iff_dom.1 h.2), ← PartENat.natCast_get (finite_iff_dom.1 (finite_mul hp h.1 h.2)), ← Nat.cast_add, PartENat.natCast_inj, multiplicity.mul' hp] else by rw [eq_top_iff_not_finite.2 (mt (finite_mul_iff hp).1 h)] cases' not_and_or.1 h with h h <;> simp [eq_top_iff_not_finite.2 h] #align multiplicity.mul multiplicity.mul theorem Finset.prod {β : Type*} {p : α} (hp : Prime p) (s : Finset β) (f : β → α) : multiplicity p (∏ x in s, f x) = ∑ x in s, multiplicity p (f x) := by classical induction' s using Finset.induction with a s has ih h · simp only [Finset.sum_empty, Finset.prod_empty] convert one_right hp.not_unit · simp [has, ← ih] convert multiplicity.mul hp #align multiplicity.finset.prod multiplicity.Finset.prod -- Porting note: with protected could not use pow' k in the succ branch protected theorem pow' {p a : α} (hp : Prime p) (ha : Finite p a) : ∀ {k : ℕ}, get (multiplicity p (a ^ k)) (finite_pow hp ha) = k * get (multiplicity p a) ha := by intro k induction' k with k hk · simp [one_right hp.not_unit] · have : multiplicity p (a ^ (k + 1)) = multiplicity p (a * a ^ k) := by rw [_root_.pow_succ] rw [succ_eq_add_one, get_eq_get_of_eq _ _ this, multiplicity.mul' hp, hk, add_mul, one_mul, add_comm] #align multiplicity.pow' multiplicity.pow' theorem pow {p a : α} (hp : Prime p) : ∀ {k : ℕ}, multiplicity p (a ^ k) = k • multiplicity p a | 0 => by simp [one_right hp.not_unit] | succ k => by simp [_root_.pow_succ, succ_nsmul, pow hp, multiplicity.mul hp] #align multiplicity.pow multiplicity.pow theorem multiplicity_pow_self {p : α} (h0 : p ≠ 0) (hu : ¬IsUnit p) (n : ℕ) : multiplicity p (p ^ n) = n := by rw [eq_coe_iff] use dvd_rfl rw [pow_dvd_pow_iff h0 hu] apply Nat.not_succ_le_self #align multiplicity.multiplicity_pow_self multiplicity.multiplicity_pow_self theorem multiplicity_pow_self_of_prime {p : α} (hp : Prime p) (n : ℕ) : multiplicity p (p ^ n) = n := multiplicity_pow_self hp.ne_zero hp.not_unit n #align multiplicity.multiplicity_pow_self_of_prime multiplicity.multiplicity_pow_self_of_prime end CancelCommMonoidWithZero end multiplicity section Nat open multiplicity theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity] intro h
have := Nat.dvd_gcd h (hle _ h)
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity] intro h
Mathlib.RingTheory.Multiplicity.640_0.uTHZeAJqYiw3Jx8
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0
Mathlib_RingTheory_Multiplicity
α : Type u_1 β : Type u_2 p a b : ℕ hp : p ≠ 1 hle : ∀ (n : ℕ), p ^ n ∣ a → p ^ n ∣ b hab : Coprime a b h : p ^ 1 ∣ a this : p ^ 1 ∣ gcd a b ⊢ False
/- Copyright (c) 2018 Robert Y. Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Y. Lewis, Chris Hughes -/ import Mathlib.Algebra.Associated import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.PartENat import Mathlib.Tactic.Linarith #align_import ring_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Multiplicity of a divisor For a commutative monoid, this file introduces the notion of multiplicity of a divisor and proves several basic results on it. ## Main definitions * `multiplicity a b`: for two elements `a` and `b` of a commutative monoid returns the largest number `n` such that `a ^ n ∣ b` or infinity, written `⊤`, if `a ^ n ∣ b` for all natural numbers `n`. * `multiplicity.Finite a b`: a predicate denoting that the multiplicity of `a` in `b` is finite. -/ variable {α β : Type*} open Nat Part open BigOperators /-- `multiplicity a b` returns the largest natural number `n` such that `a ^ n ∣ b`, as a `PartENat` or natural with infinity. If `∀ n, a ^ n ∣ b`, then it returns `⊤`-/ def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat := PartENat.find fun n => ¬a ^ (n + 1) ∣ b #align multiplicity multiplicity namespace multiplicity section Monoid variable [Monoid α] [Monoid β] /-- `multiplicity.Finite a b` indicates that the multiplicity of `a` in `b` is finite. -/ @[reducible] def Finite (a b : α) : Prop := ∃ n : ℕ, ¬a ^ (n + 1) ∣ b #align multiplicity.finite multiplicity.Finite theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} : Finite a b ↔ (multiplicity a b).Dom := Iff.rfl #align multiplicity.finite_iff_dom multiplicity.finite_iff_dom theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b := Iff.rfl #align multiplicity.finite_def multiplicity.finite_def theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 := fun ⟨n, hn⟩ ⟨d, hd⟩ => hn ⟨d ^ (n + 1), (pow_mul_pow_eq_one (n + 1) hd.symm).symm⟩ #align multiplicity.not_dvd_one_of_finite_one_right multiplicity.not_dvd_one_of_finite_one_right @[norm_cast] theorem Int.coe_nat_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b := by apply Part.ext' · rw [← @finite_iff_dom ℕ, @finite_def ℕ, ← @finite_iff_dom ℤ, @finite_def ℤ] norm_cast · intro h1 h2 apply _root_.le_antisymm <;> · apply Nat.find_mono norm_cast simp #align multiplicity.int.coe_nat_multiplicity multiplicity.Int.coe_nat_multiplicity theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b := ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) (by simpa [Finite, Classical.not_not] using h), by simp [Finite, multiplicity, Classical.not_not]; tauto⟩ #align multiplicity.not_finite_iff_forall multiplicity.not_finite_iff_forall theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a := let ⟨n, hn⟩ := h hn ∘ IsUnit.dvd ∘ IsUnit.pow (n + 1) #align multiplicity.not_unit_of_finite multiplicity.not_unit_of_finite theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b := fun ⟨n, hn⟩ => ⟨n, fun h => hn (h.trans (dvd_mul_right _ _))⟩ #align multiplicity.finite_of_finite_mul_right multiplicity.finite_of_finite_mul_right variable [DecidableRel ((· ∣ ·) : α → α → Prop)] [DecidableRel ((· ∣ ·) : β → β → Prop)] theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} : (k : PartENat) ≤ multiplicity a b → a ^ k ∣ b := by rw [← PartENat.some_eq_natCast] exact Nat.casesOn k (fun _ => by rw [_root_.pow_zero] exact one_dvd _) fun k ⟨_, h₂⟩ => by_contradiction fun hk => Nat.find_min _ (lt_of_succ_le (h₂ ⟨k, hk⟩)) hk #align multiplicity.pow_dvd_of_le_multiplicity multiplicity.pow_dvd_of_le_multiplicity theorem pow_multiplicity_dvd {a b : α} (h : Finite a b) : a ^ get (multiplicity a b) h ∣ b := pow_dvd_of_le_multiplicity (by rw [PartENat.natCast_get]) #align multiplicity.pow_multiplicity_dvd multiplicity.pow_multiplicity_dvd theorem is_greatest {a b : α} {m : ℕ} (hm : multiplicity a b < m) : ¬a ^ m ∣ b := fun h => by rw [PartENat.lt_coe_iff] at hm; exact Nat.find_spec hm.fst ((pow_dvd_pow _ hm.snd).trans h) #align multiplicity.is_greatest multiplicity.is_greatest theorem is_greatest' {a b : α} {m : ℕ} (h : Finite a b) (hm : get (multiplicity a b) h < m) : ¬a ^ m ∣ b := is_greatest (by rwa [← PartENat.coe_lt_coe, PartENat.natCast_get] at hm) #align multiplicity.is_greatest' multiplicity.is_greatest' theorem pos_of_dvd {a b : α} (hfin : Finite a b) (hdiv : a ∣ b) : 0 < (multiplicity a b).get hfin := by refine' zero_lt_iff.2 fun h => _ simpa [hdiv] using is_greatest' hfin (lt_one_iff.mpr h) #align multiplicity.pos_of_dvd multiplicity.pos_of_dvd theorem unique {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : (k : PartENat) = multiplicity a b := le_antisymm (le_of_not_gt fun hk' => is_greatest hk' hk) <| by have : Finite a b := ⟨k, hsucc⟩ rw [PartENat.le_coe_iff] exact ⟨this, Nat.find_min' _ hsucc⟩ #align multiplicity.unique multiplicity.unique theorem unique' {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : k = get (multiplicity a b) ⟨k, hsucc⟩ := by rw [← PartENat.natCast_inj, PartENat.natCast_get, unique hk hsucc] #align multiplicity.unique' multiplicity.unique' theorem le_multiplicity_of_pow_dvd {a b : α} {k : ℕ} (hk : a ^ k ∣ b) : (k : PartENat) ≤ multiplicity a b := le_of_not_gt fun hk' => is_greatest hk' hk #align multiplicity.le_multiplicity_of_pow_dvd multiplicity.le_multiplicity_of_pow_dvd theorem pow_dvd_iff_le_multiplicity {a b : α} {k : ℕ} : a ^ k ∣ b ↔ (k : PartENat) ≤ multiplicity a b := ⟨le_multiplicity_of_pow_dvd, pow_dvd_of_le_multiplicity⟩ #align multiplicity.pow_dvd_iff_le_multiplicity multiplicity.pow_dvd_iff_le_multiplicity theorem multiplicity_lt_iff_not_dvd {a b : α} {k : ℕ} : multiplicity a b < (k : PartENat) ↔ ¬a ^ k ∣ b := by rw [pow_dvd_iff_le_multiplicity, not_le] #align multiplicity.multiplicity_lt_iff_neg_dvd multiplicity.multiplicity_lt_iff_not_dvd theorem eq_coe_iff {a b : α} {n : ℕ} : multiplicity a b = (n : PartENat) ↔ a ^ n ∣ b ∧ ¬a ^ (n + 1) ∣ b := by rw [← PartENat.some_eq_natCast] exact ⟨fun h => let ⟨h₁, h₂⟩ := eq_some_iff.1 h h₂ ▸ ⟨pow_multiplicity_dvd _, is_greatest (by rw [PartENat.lt_coe_iff] exact ⟨h₁, lt_succ_self _⟩)⟩, fun h => eq_some_iff.2 ⟨⟨n, h.2⟩, Eq.symm <| unique' h.1 h.2⟩⟩ #align multiplicity.eq_coe_iff multiplicity.eq_coe_iff theorem eq_top_iff {a b : α} : multiplicity a b = ⊤ ↔ ∀ n : ℕ, a ^ n ∣ b := (PartENat.find_eq_top_iff _).trans <| by simp only [Classical.not_not] exact ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) fun n => h _, fun h n => h _⟩ #align multiplicity.eq_top_iff multiplicity.eq_top_iff @[simp] theorem isUnit_left {a : α} (b : α) (ha : IsUnit a) : multiplicity a b = ⊤ := eq_top_iff.2 fun _ => IsUnit.dvd (ha.pow _) #align multiplicity.is_unit_left multiplicity.isUnit_left -- @[simp] Porting note: simp can prove this theorem one_left (b : α) : multiplicity 1 b = ⊤ := isUnit_left b isUnit_one #align multiplicity.one_left multiplicity.one_left @[simp] theorem get_one_right {a : α} (ha : Finite a 1) : get (multiplicity a 1) ha = 0 := by rw [PartENat.get_eq_iff_eq_coe, eq_coe_iff, _root_.pow_zero] simp [not_dvd_one_of_finite_one_right ha] #align multiplicity.get_one_right multiplicity.get_one_right -- @[simp] Porting note: simp can prove this theorem unit_left (a : α) (u : αˣ) : multiplicity (u : α) a = ⊤ := isUnit_left a u.isUnit #align multiplicity.unit_left multiplicity.unit_left theorem multiplicity_eq_zero {a b : α} : multiplicity a b = 0 ↔ ¬a ∣ b := by rw [← Nat.cast_zero, eq_coe_iff] simp only [_root_.pow_zero, isUnit_one, IsUnit.dvd, zero_add, pow_one, true_and] #align multiplicity.multiplicity_eq_zero multiplicity.multiplicity_eq_zero theorem multiplicity_ne_zero {a b : α} : multiplicity a b ≠ 0 ↔ a ∣ b := multiplicity_eq_zero.not_left #align multiplicity.multiplicity_ne_zero multiplicity.multiplicity_ne_zero theorem eq_top_iff_not_finite {a b : α} : multiplicity a b = ⊤ ↔ ¬Finite a b := Part.eq_none_iff' #align multiplicity.eq_top_iff_not_finite multiplicity.eq_top_iff_not_finite theorem ne_top_iff_finite {a b : α} : multiplicity a b ≠ ⊤ ↔ Finite a b := by rw [Ne.def, eq_top_iff_not_finite, Classical.not_not] #align multiplicity.ne_top_iff_finite multiplicity.ne_top_iff_finite theorem lt_top_iff_finite {a b : α} : multiplicity a b < ⊤ ↔ Finite a b := by rw [lt_top_iff_ne_top, ne_top_iff_finite] #align multiplicity.lt_top_iff_finite multiplicity.lt_top_iff_finite theorem exists_eq_pow_mul_and_not_dvd {a b : α} (hfin : Finite a b) : ∃ c : α, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c := by obtain ⟨c, hc⟩ := multiplicity.pow_multiplicity_dvd hfin refine' ⟨c, hc, _⟩ rintro ⟨k, hk⟩ rw [hk, ← mul_assoc, ← _root_.pow_succ'] at hc have h₁ : a ^ ((multiplicity a b).get hfin + 1) ∣ b := ⟨k, hc⟩ exact (multiplicity.eq_coe_iff.1 (by simp)).2 h₁ #align multiplicity.exists_eq_pow_mul_and_not_dvd multiplicity.exists_eq_pow_mul_and_not_dvd theorem multiplicity_le_multiplicity_iff {a b : α} {c d : β} : multiplicity a b ≤ multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b → c ^ n ∣ d := ⟨fun h n hab => pow_dvd_of_le_multiplicity (le_trans (le_multiplicity_of_pow_dvd hab) h), fun h => letI := Classical.dec (Finite a b) if hab : Finite a b then by rw [← PartENat.natCast_get (finite_iff_dom.1 hab)]; exact le_multiplicity_of_pow_dvd (h _ (pow_multiplicity_dvd _)) else by have : ∀ n : ℕ, c ^ n ∣ d := fun n => h n (not_finite_iff_forall.1 hab _) rw [eq_top_iff_not_finite.2 hab, eq_top_iff_not_finite.2 (not_finite_iff_forall.2 this)]⟩ #align multiplicity.multiplicity_le_multiplicity_iff multiplicity.multiplicity_le_multiplicity_iff theorem multiplicity_eq_multiplicity_iff {a b : α} {c d : β} : multiplicity a b = multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b ↔ c ^ n ∣ d := ⟨fun h n => ⟨multiplicity_le_multiplicity_iff.mp h.le n, multiplicity_le_multiplicity_iff.mp h.ge n⟩, fun h => le_antisymm (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mp) (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mpr)⟩ #align multiplicity.multiplicity_eq_multiplicity_iff multiplicity.multiplicity_eq_multiplicity_iff theorem le_multiplicity_map {F : Type*} [MonoidHomClass F α β] (f : F) {a b : α} : multiplicity a b ≤ multiplicity (f a) (f b) := multiplicity_le_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd f theorem multiplicity_map_eq {F : Type*} [MulEquivClass F α β] (f : F) {a b : α} : multiplicity (f a) (f b) = multiplicity a b := multiplicity_eq_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd_iff f theorem multiplicity_le_multiplicity_of_dvd_right {a b c : α} (h : b ∣ c) : multiplicity a b ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun _ hb => hb.trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_right multiplicity.multiplicity_le_multiplicity_of_dvd_right theorem eq_of_associated_right {a b c : α} (h : Associated b c) : multiplicity a b = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_right h.dvd) (multiplicity_le_multiplicity_of_dvd_right h.symm.dvd) #align multiplicity.eq_of_associated_right multiplicity.eq_of_associated_right theorem dvd_of_multiplicity_pos {a b : α} (h : (0 : PartENat) < multiplicity a b) : a ∣ b := by rw [← pow_one a] apply pow_dvd_of_le_multiplicity simpa only [Nat.cast_one, PartENat.pos_iff_one_le] using h #align multiplicity.dvd_of_multiplicity_pos multiplicity.dvd_of_multiplicity_pos theorem dvd_iff_multiplicity_pos {a b : α} : (0 : PartENat) < multiplicity a b ↔ a ∣ b := ⟨dvd_of_multiplicity_pos, fun hdvd => lt_of_le_of_ne (zero_le _) fun heq => is_greatest (show multiplicity a b < ↑1 by simpa only [heq, Nat.cast_zero] using PartENat.coe_lt_coe.mpr zero_lt_one) (by rwa [pow_one a])⟩ #align multiplicity.dvd_iff_multiplicity_pos multiplicity.dvd_iff_multiplicity_pos theorem finite_nat_iff {a b : ℕ} : Finite a b ↔ a ≠ 1 ∧ 0 < b := by rw [← not_iff_not, not_finite_iff_forall, not_and_or, Ne.def, Classical.not_not, not_lt, le_zero_iff] exact ⟨fun h => or_iff_not_imp_right.2 fun hb => have ha : a ≠ 0 := fun ha => hb <| zero_dvd_iff.mp <| by rw [ha] at h; exact h 1 Classical.by_contradiction fun ha1 : a ≠ 1 => have ha_gt_one : 1 < a := lt_of_not_ge fun _ => match a with | 0 => ha rfl | 1 => ha1 rfl | b+2 => by linarith not_lt_of_ge (le_of_dvd (Nat.pos_of_ne_zero hb) (h b)) (lt_pow_self ha_gt_one b), fun h => by cases h <;> simp [*]⟩ #align multiplicity.finite_nat_iff multiplicity.finite_nat_iff alias ⟨_, _root_.has_dvd.dvd.multiplicity_pos⟩ := dvd_iff_multiplicity_pos end Monoid section CommMonoid variable [CommMonoid α] theorem finite_of_finite_mul_left {a b c : α} : Finite a (b * c) → Finite a c := by rw [mul_comm]; exact finite_of_finite_mul_right #align multiplicity.finite_of_finite_mul_left multiplicity.finite_of_finite_mul_left variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem isUnit_right {a b : α} (ha : ¬IsUnit a) (hb : IsUnit b) : multiplicity a b = 0 := eq_coe_iff.2 ⟨show a ^ 0 ∣ b by simp only [_root_.pow_zero, one_dvd], by rw [pow_one] exact fun h => mt (isUnit_of_dvd_unit h) ha hb⟩ #align multiplicity.is_unit_right multiplicity.isUnit_right theorem one_right {a : α} (ha : ¬IsUnit a) : multiplicity a 1 = 0 := isUnit_right ha isUnit_one #align multiplicity.one_right multiplicity.one_right theorem unit_right {a : α} (ha : ¬IsUnit a) (u : αˣ) : multiplicity a u = 0 := isUnit_right ha u.isUnit #align multiplicity.unit_right multiplicity.unit_right open Classical theorem multiplicity_le_multiplicity_of_dvd_left {a b c : α} (hdvd : a ∣ b) : multiplicity b c ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun n h => (pow_dvd_pow_of_dvd hdvd n).trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_left multiplicity.multiplicity_le_multiplicity_of_dvd_left theorem eq_of_associated_left {a b c : α} (h : Associated a b) : multiplicity b c = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_left h.dvd) (multiplicity_le_multiplicity_of_dvd_left h.symm.dvd) #align multiplicity.eq_of_associated_left multiplicity.eq_of_associated_left -- Porting note: this was doing nothing in mathlib3 also -- alias dvd_iff_multiplicity_pos ↔ _ _root_.has_dvd.dvd.multiplicity_pos end CommMonoid section MonoidWithZero variable [MonoidWithZero α] theorem ne_zero_of_finite {a b : α} (h : Finite a b) : b ≠ 0 := let ⟨n, hn⟩ := h fun hb => by simp [hb] at hn #align multiplicity.ne_zero_of_finite multiplicity.ne_zero_of_finite variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem zero (a : α) : multiplicity a 0 = ⊤ := Part.eq_none_iff.2 fun _ ⟨⟨_, hk⟩, _⟩ => hk (dvd_zero _) #align multiplicity.zero multiplicity.zero @[simp] theorem multiplicity_zero_eq_zero_of_ne_zero (a : α) (ha : a ≠ 0) : multiplicity 0 a = 0 := multiplicity.multiplicity_eq_zero.2 <| mt zero_dvd_iff.1 ha #align multiplicity.multiplicity_zero_eq_zero_of_ne_zero multiplicity.multiplicity_zero_eq_zero_of_ne_zero end MonoidWithZero section CommMonoidWithZero variable [CommMonoidWithZero α] variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem multiplicity_mk_eq_multiplicity [DecidableRel ((· ∣ ·) : Associates α → Associates α → Prop)] {a b : α} : multiplicity (Associates.mk a) (Associates.mk b) = multiplicity a b := by by_cases h : Finite a b · rw [← PartENat.natCast_get (finite_iff_dom.mp h)] refine' (multiplicity.unique (show Associates.mk a ^ (multiplicity a b).get h ∣ Associates.mk b from _) _).symm <;> rw [← Associates.mk_pow, Associates.mk_dvd_mk] · exact pow_multiplicity_dvd h · exact is_greatest ((PartENat.lt_coe_iff _ _).mpr (Exists.intro (finite_iff_dom.mp h) (Nat.lt_succ_self _))) · suffices ¬Finite (Associates.mk a) (Associates.mk b) by rw [finite_iff_dom, PartENat.not_dom_iff_eq_top] at h this rw [h, this] refine' not_finite_iff_forall.mpr fun n => by rw [← Associates.mk_pow, Associates.mk_dvd_mk] exact not_finite_iff_forall.mp h n #align multiplicity.multiplicity_mk_eq_multiplicity multiplicity.multiplicity_mk_eq_multiplicity end CommMonoidWithZero section Semiring variable [Semiring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem min_le_multiplicity_add {p a b : α} : min (multiplicity p a) (multiplicity p b) ≤ multiplicity p (a + b) := (le_total (multiplicity p a) (multiplicity p b)).elim (fun h => by rw [min_eq_left h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add hn (multiplicity_le_multiplicity_iff.1 h n hn)) fun h => by rw [min_eq_right h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add (multiplicity_le_multiplicity_iff.1 h n hn) hn #align multiplicity.min_le_multiplicity_add multiplicity.min_le_multiplicity_add end Semiring section Ring variable [Ring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem neg (a b : α) : multiplicity a (-b) = multiplicity a b := Part.ext' (by simp only [multiplicity, PartENat.find, dvd_neg]) fun h₁ h₂ => PartENat.natCast_inj.1 (by rw [PartENat.natCast_get] exact Eq.symm (unique (pow_multiplicity_dvd _).neg_right (mt dvd_neg.1 (is_greatest' _ (lt_succ_self _))))) #align multiplicity.neg multiplicity.neg theorem Int.natAbs (a : ℕ) (b : ℤ) : multiplicity a b.natAbs = multiplicity (a : ℤ) b := by cases' Int.natAbs_eq b with h h <;> conv_rhs => rw [h] · rw [Int.coe_nat_multiplicity] · rw [multiplicity.neg, Int.coe_nat_multiplicity] #align multiplicity.int.nat_abs multiplicity.Int.natAbs theorem multiplicity_add_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a + b) = multiplicity p b := by apply le_antisymm · apply PartENat.le_of_lt_add_one cases' PartENat.ne_top_iff.mp (PartENat.ne_top_of_lt h) with k hk rw [hk] rw_mod_cast [multiplicity_lt_iff_not_dvd, dvd_add_right] intro h_dvd · apply multiplicity.is_greatest _ h_dvd rw [hk, ← Nat.succ_eq_add_one] norm_cast apply Nat.lt_succ_self k · rw [pow_dvd_iff_le_multiplicity, Nat.cast_add, ← hk, Nat.cast_one] exact PartENat.add_one_le_of_lt h · have := @min_le_multiplicity_add α _ _ p a b rwa [← min_eq_right (le_of_lt h)] #align multiplicity.multiplicity_add_of_gt multiplicity.multiplicity_add_of_gt theorem multiplicity_sub_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a - b) = multiplicity p b := by rw [sub_eq_add_neg, multiplicity_add_of_gt] <;> rw [multiplicity.neg]; assumption #align multiplicity.multiplicity_sub_of_gt multiplicity.multiplicity_sub_of_gt theorem multiplicity_add_eq_min {p a b : α} (h : multiplicity p a ≠ multiplicity p b) : multiplicity p (a + b) = min (multiplicity p a) (multiplicity p b) := by rcases lt_trichotomy (multiplicity p a) (multiplicity p b) with (hab | hab | hab) · rw [add_comm, multiplicity_add_of_gt hab, min_eq_left] exact le_of_lt hab · contradiction · rw [multiplicity_add_of_gt hab, min_eq_right] exact le_of_lt hab #align multiplicity.multiplicity_add_eq_min multiplicity.multiplicity_add_eq_min end Ring section CancelCommMonoidWithZero variable [CancelCommMonoidWithZero α] /- Porting note: removed previous wf recursion hints and added termination_by Also pulled a b intro parameters since Lean parses that more easily -/ theorem finite_mul_aux {p : α} (hp : Prime p) {a b : α} : ∀ {n m : ℕ}, ¬p ^ (n + 1) ∣ a → ¬p ^ (m + 1) ∣ b → ¬p ^ (n + m + 1) ∣ a * b | n, m => fun ha hb ⟨s, hs⟩ => have : p ∣ a * b := ⟨p ^ (n + m) * s, by simp [hs, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩ (hp.2.2 a b this).elim (fun ⟨x, hx⟩ => have hn0 : 0 < n := Nat.pos_of_ne_zero fun hn0 => by simp [hx, hn0] at ha have hpx : ¬p ^ (n - 1 + 1) ∣ x := fun ⟨y, hy⟩ => ha (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hn0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) have : 1 ≤ n + m := le_trans hn0 (Nat.le_add_right n m) finite_mul_aux hp hpx hb ⟨s, mul_right_cancel₀ hp.1 (by rw [tsub_add_eq_add_tsub (succ_le_of_lt hn0), tsub_add_cancel_of_le this] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩) fun ⟨x, hx⟩ => have hm0 : 0 < m := Nat.pos_of_ne_zero fun hm0 => by simp [hx, hm0] at hb have hpx : ¬p ^ (m - 1 + 1) ∣ x := fun ⟨y, hy⟩ => hb (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hm0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) finite_mul_aux hp ha hpx ⟨s, mul_right_cancel₀ hp.1 (by rw [add_assoc, tsub_add_cancel_of_le (succ_le_of_lt hm0)] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩ termination_by finite_mul_aux _ _ n m => n+m #align multiplicity.finite_mul_aux multiplicity.finite_mul_aux theorem finite_mul {p a b : α} (hp : Prime p) : Finite p a → Finite p b → Finite p (a * b) := fun ⟨n, hn⟩ ⟨m, hm⟩ => ⟨n + m, finite_mul_aux hp hn hm⟩ #align multiplicity.finite_mul multiplicity.finite_mul theorem finite_mul_iff {p a b : α} (hp : Prime p) : Finite p (a * b) ↔ Finite p a ∧ Finite p b := ⟨fun h => ⟨finite_of_finite_mul_right h, finite_of_finite_mul_left h⟩, fun h => finite_mul hp h.1 h.2⟩ #align multiplicity.finite_mul_iff multiplicity.finite_mul_iff theorem finite_pow {p a : α} (hp : Prime p) : ∀ {k : ℕ} (_ : Finite p a), Finite p (a ^ k) | 0, _ => ⟨0, by simp [mt isUnit_iff_dvd_one.2 hp.2.1]⟩ | k + 1, ha => by rw [_root_.pow_succ]; exact finite_mul hp ha (finite_pow hp ha) #align multiplicity.finite_pow multiplicity.finite_pow variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] theorem multiplicity_self {a : α} (ha : ¬IsUnit a) (ha0 : a ≠ 0) : multiplicity a a = 1 := by rw [← Nat.cast_one] exact eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => ha (isUnit_iff_dvd_one.2 ⟨b, mul_left_cancel₀ ha0 <| by simpa [_root_.pow_succ, mul_assoc] using hb⟩)⟩ #align multiplicity.multiplicity_self multiplicity.multiplicity_self @[simp] theorem get_multiplicity_self {a : α} (ha : Finite a a) : get (multiplicity a a) ha = 1 := PartENat.get_eq_iff_eq_coe.2 (eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => by rw [← mul_one a, pow_add, pow_one, mul_assoc, mul_assoc, mul_right_inj' (ne_zero_of_finite ha)] at hb; exact mt isUnit_iff_dvd_one.2 (not_unit_of_finite ha) ⟨b, by simp_all⟩⟩) #align multiplicity.get_multiplicity_self multiplicity.get_multiplicity_self protected theorem mul' {p a b : α} (hp : Prime p) (h : (multiplicity p (a * b)).Dom) : get (multiplicity p (a * b)) h = get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by have hdiva : p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 ∣ a := pow_multiplicity_dvd _ have hdivb : p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 ∣ b := pow_multiplicity_dvd _ have hpoweq : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) = p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 * p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by simp [pow_add] have hdiv : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) ∣ a * b := by rw [hpoweq]; apply mul_dvd_mul <;> assumption have hsucc : ¬p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 + 1) ∣ a * b := fun h => not_or_of_not (is_greatest' _ (lt_succ_self _)) (is_greatest' _ (lt_succ_self _)) (_root_.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul hp hdiva hdivb h) rw [← PartENat.natCast_inj, PartENat.natCast_get, eq_coe_iff]; exact ⟨hdiv, hsucc⟩ #align multiplicity.mul' multiplicity.mul' open Classical protected theorem mul {p a b : α} (hp : Prime p) : multiplicity p (a * b) = multiplicity p a + multiplicity p b := if h : Finite p a ∧ Finite p b then by rw [← PartENat.natCast_get (finite_iff_dom.1 h.1), ← PartENat.natCast_get (finite_iff_dom.1 h.2), ← PartENat.natCast_get (finite_iff_dom.1 (finite_mul hp h.1 h.2)), ← Nat.cast_add, PartENat.natCast_inj, multiplicity.mul' hp] else by rw [eq_top_iff_not_finite.2 (mt (finite_mul_iff hp).1 h)] cases' not_and_or.1 h with h h <;> simp [eq_top_iff_not_finite.2 h] #align multiplicity.mul multiplicity.mul theorem Finset.prod {β : Type*} {p : α} (hp : Prime p) (s : Finset β) (f : β → α) : multiplicity p (∏ x in s, f x) = ∑ x in s, multiplicity p (f x) := by classical induction' s using Finset.induction with a s has ih h · simp only [Finset.sum_empty, Finset.prod_empty] convert one_right hp.not_unit · simp [has, ← ih] convert multiplicity.mul hp #align multiplicity.finset.prod multiplicity.Finset.prod -- Porting note: with protected could not use pow' k in the succ branch protected theorem pow' {p a : α} (hp : Prime p) (ha : Finite p a) : ∀ {k : ℕ}, get (multiplicity p (a ^ k)) (finite_pow hp ha) = k * get (multiplicity p a) ha := by intro k induction' k with k hk · simp [one_right hp.not_unit] · have : multiplicity p (a ^ (k + 1)) = multiplicity p (a * a ^ k) := by rw [_root_.pow_succ] rw [succ_eq_add_one, get_eq_get_of_eq _ _ this, multiplicity.mul' hp, hk, add_mul, one_mul, add_comm] #align multiplicity.pow' multiplicity.pow' theorem pow {p a : α} (hp : Prime p) : ∀ {k : ℕ}, multiplicity p (a ^ k) = k • multiplicity p a | 0 => by simp [one_right hp.not_unit] | succ k => by simp [_root_.pow_succ, succ_nsmul, pow hp, multiplicity.mul hp] #align multiplicity.pow multiplicity.pow theorem multiplicity_pow_self {p : α} (h0 : p ≠ 0) (hu : ¬IsUnit p) (n : ℕ) : multiplicity p (p ^ n) = n := by rw [eq_coe_iff] use dvd_rfl rw [pow_dvd_pow_iff h0 hu] apply Nat.not_succ_le_self #align multiplicity.multiplicity_pow_self multiplicity.multiplicity_pow_self theorem multiplicity_pow_self_of_prime {p : α} (hp : Prime p) (n : ℕ) : multiplicity p (p ^ n) = n := multiplicity_pow_self hp.ne_zero hp.not_unit n #align multiplicity.multiplicity_pow_self_of_prime multiplicity.multiplicity_pow_self_of_prime end CancelCommMonoidWithZero end multiplicity section Nat open multiplicity theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity] intro h have := Nat.dvd_gcd h (hle _ h)
rw [Coprime.gcd_eq_one hab, Nat.dvd_one, pow_one] at this
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity] intro h have := Nat.dvd_gcd h (hle _ h)
Mathlib.RingTheory.Multiplicity.640_0.uTHZeAJqYiw3Jx8
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0
Mathlib_RingTheory_Multiplicity
α : Type u_1 β : Type u_2 p a b : ℕ hp : p ≠ 1 hle : ∀ (n : ℕ), p ^ n ∣ a → p ^ n ∣ b hab : Coprime a b h : p ^ 1 ∣ a this : p = 1 ⊢ False
/- Copyright (c) 2018 Robert Y. Lewis. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robert Y. Lewis, Chris Hughes -/ import Mathlib.Algebra.Associated import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.PartENat import Mathlib.Tactic.Linarith #align_import ring_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" /-! # Multiplicity of a divisor For a commutative monoid, this file introduces the notion of multiplicity of a divisor and proves several basic results on it. ## Main definitions * `multiplicity a b`: for two elements `a` and `b` of a commutative monoid returns the largest number `n` such that `a ^ n ∣ b` or infinity, written `⊤`, if `a ^ n ∣ b` for all natural numbers `n`. * `multiplicity.Finite a b`: a predicate denoting that the multiplicity of `a` in `b` is finite. -/ variable {α β : Type*} open Nat Part open BigOperators /-- `multiplicity a b` returns the largest natural number `n` such that `a ^ n ∣ b`, as a `PartENat` or natural with infinity. If `∀ n, a ^ n ∣ b`, then it returns `⊤`-/ def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat := PartENat.find fun n => ¬a ^ (n + 1) ∣ b #align multiplicity multiplicity namespace multiplicity section Monoid variable [Monoid α] [Monoid β] /-- `multiplicity.Finite a b` indicates that the multiplicity of `a` in `b` is finite. -/ @[reducible] def Finite (a b : α) : Prop := ∃ n : ℕ, ¬a ^ (n + 1) ∣ b #align multiplicity.finite multiplicity.Finite theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} : Finite a b ↔ (multiplicity a b).Dom := Iff.rfl #align multiplicity.finite_iff_dom multiplicity.finite_iff_dom theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b := Iff.rfl #align multiplicity.finite_def multiplicity.finite_def theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 := fun ⟨n, hn⟩ ⟨d, hd⟩ => hn ⟨d ^ (n + 1), (pow_mul_pow_eq_one (n + 1) hd.symm).symm⟩ #align multiplicity.not_dvd_one_of_finite_one_right multiplicity.not_dvd_one_of_finite_one_right @[norm_cast] theorem Int.coe_nat_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b := by apply Part.ext' · rw [← @finite_iff_dom ℕ, @finite_def ℕ, ← @finite_iff_dom ℤ, @finite_def ℤ] norm_cast · intro h1 h2 apply _root_.le_antisymm <;> · apply Nat.find_mono norm_cast simp #align multiplicity.int.coe_nat_multiplicity multiplicity.Int.coe_nat_multiplicity theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b := ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) (by simpa [Finite, Classical.not_not] using h), by simp [Finite, multiplicity, Classical.not_not]; tauto⟩ #align multiplicity.not_finite_iff_forall multiplicity.not_finite_iff_forall theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a := let ⟨n, hn⟩ := h hn ∘ IsUnit.dvd ∘ IsUnit.pow (n + 1) #align multiplicity.not_unit_of_finite multiplicity.not_unit_of_finite theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b := fun ⟨n, hn⟩ => ⟨n, fun h => hn (h.trans (dvd_mul_right _ _))⟩ #align multiplicity.finite_of_finite_mul_right multiplicity.finite_of_finite_mul_right variable [DecidableRel ((· ∣ ·) : α → α → Prop)] [DecidableRel ((· ∣ ·) : β → β → Prop)] theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} : (k : PartENat) ≤ multiplicity a b → a ^ k ∣ b := by rw [← PartENat.some_eq_natCast] exact Nat.casesOn k (fun _ => by rw [_root_.pow_zero] exact one_dvd _) fun k ⟨_, h₂⟩ => by_contradiction fun hk => Nat.find_min _ (lt_of_succ_le (h₂ ⟨k, hk⟩)) hk #align multiplicity.pow_dvd_of_le_multiplicity multiplicity.pow_dvd_of_le_multiplicity theorem pow_multiplicity_dvd {a b : α} (h : Finite a b) : a ^ get (multiplicity a b) h ∣ b := pow_dvd_of_le_multiplicity (by rw [PartENat.natCast_get]) #align multiplicity.pow_multiplicity_dvd multiplicity.pow_multiplicity_dvd theorem is_greatest {a b : α} {m : ℕ} (hm : multiplicity a b < m) : ¬a ^ m ∣ b := fun h => by rw [PartENat.lt_coe_iff] at hm; exact Nat.find_spec hm.fst ((pow_dvd_pow _ hm.snd).trans h) #align multiplicity.is_greatest multiplicity.is_greatest theorem is_greatest' {a b : α} {m : ℕ} (h : Finite a b) (hm : get (multiplicity a b) h < m) : ¬a ^ m ∣ b := is_greatest (by rwa [← PartENat.coe_lt_coe, PartENat.natCast_get] at hm) #align multiplicity.is_greatest' multiplicity.is_greatest' theorem pos_of_dvd {a b : α} (hfin : Finite a b) (hdiv : a ∣ b) : 0 < (multiplicity a b).get hfin := by refine' zero_lt_iff.2 fun h => _ simpa [hdiv] using is_greatest' hfin (lt_one_iff.mpr h) #align multiplicity.pos_of_dvd multiplicity.pos_of_dvd theorem unique {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : (k : PartENat) = multiplicity a b := le_antisymm (le_of_not_gt fun hk' => is_greatest hk' hk) <| by have : Finite a b := ⟨k, hsucc⟩ rw [PartENat.le_coe_iff] exact ⟨this, Nat.find_min' _ hsucc⟩ #align multiplicity.unique multiplicity.unique theorem unique' {a b : α} {k : ℕ} (hk : a ^ k ∣ b) (hsucc : ¬a ^ (k + 1) ∣ b) : k = get (multiplicity a b) ⟨k, hsucc⟩ := by rw [← PartENat.natCast_inj, PartENat.natCast_get, unique hk hsucc] #align multiplicity.unique' multiplicity.unique' theorem le_multiplicity_of_pow_dvd {a b : α} {k : ℕ} (hk : a ^ k ∣ b) : (k : PartENat) ≤ multiplicity a b := le_of_not_gt fun hk' => is_greatest hk' hk #align multiplicity.le_multiplicity_of_pow_dvd multiplicity.le_multiplicity_of_pow_dvd theorem pow_dvd_iff_le_multiplicity {a b : α} {k : ℕ} : a ^ k ∣ b ↔ (k : PartENat) ≤ multiplicity a b := ⟨le_multiplicity_of_pow_dvd, pow_dvd_of_le_multiplicity⟩ #align multiplicity.pow_dvd_iff_le_multiplicity multiplicity.pow_dvd_iff_le_multiplicity theorem multiplicity_lt_iff_not_dvd {a b : α} {k : ℕ} : multiplicity a b < (k : PartENat) ↔ ¬a ^ k ∣ b := by rw [pow_dvd_iff_le_multiplicity, not_le] #align multiplicity.multiplicity_lt_iff_neg_dvd multiplicity.multiplicity_lt_iff_not_dvd theorem eq_coe_iff {a b : α} {n : ℕ} : multiplicity a b = (n : PartENat) ↔ a ^ n ∣ b ∧ ¬a ^ (n + 1) ∣ b := by rw [← PartENat.some_eq_natCast] exact ⟨fun h => let ⟨h₁, h₂⟩ := eq_some_iff.1 h h₂ ▸ ⟨pow_multiplicity_dvd _, is_greatest (by rw [PartENat.lt_coe_iff] exact ⟨h₁, lt_succ_self _⟩)⟩, fun h => eq_some_iff.2 ⟨⟨n, h.2⟩, Eq.symm <| unique' h.1 h.2⟩⟩ #align multiplicity.eq_coe_iff multiplicity.eq_coe_iff theorem eq_top_iff {a b : α} : multiplicity a b = ⊤ ↔ ∀ n : ℕ, a ^ n ∣ b := (PartENat.find_eq_top_iff _).trans <| by simp only [Classical.not_not] exact ⟨fun h n => Nat.casesOn n (by rw [_root_.pow_zero] exact one_dvd _) fun n => h _, fun h n => h _⟩ #align multiplicity.eq_top_iff multiplicity.eq_top_iff @[simp] theorem isUnit_left {a : α} (b : α) (ha : IsUnit a) : multiplicity a b = ⊤ := eq_top_iff.2 fun _ => IsUnit.dvd (ha.pow _) #align multiplicity.is_unit_left multiplicity.isUnit_left -- @[simp] Porting note: simp can prove this theorem one_left (b : α) : multiplicity 1 b = ⊤ := isUnit_left b isUnit_one #align multiplicity.one_left multiplicity.one_left @[simp] theorem get_one_right {a : α} (ha : Finite a 1) : get (multiplicity a 1) ha = 0 := by rw [PartENat.get_eq_iff_eq_coe, eq_coe_iff, _root_.pow_zero] simp [not_dvd_one_of_finite_one_right ha] #align multiplicity.get_one_right multiplicity.get_one_right -- @[simp] Porting note: simp can prove this theorem unit_left (a : α) (u : αˣ) : multiplicity (u : α) a = ⊤ := isUnit_left a u.isUnit #align multiplicity.unit_left multiplicity.unit_left theorem multiplicity_eq_zero {a b : α} : multiplicity a b = 0 ↔ ¬a ∣ b := by rw [← Nat.cast_zero, eq_coe_iff] simp only [_root_.pow_zero, isUnit_one, IsUnit.dvd, zero_add, pow_one, true_and] #align multiplicity.multiplicity_eq_zero multiplicity.multiplicity_eq_zero theorem multiplicity_ne_zero {a b : α} : multiplicity a b ≠ 0 ↔ a ∣ b := multiplicity_eq_zero.not_left #align multiplicity.multiplicity_ne_zero multiplicity.multiplicity_ne_zero theorem eq_top_iff_not_finite {a b : α} : multiplicity a b = ⊤ ↔ ¬Finite a b := Part.eq_none_iff' #align multiplicity.eq_top_iff_not_finite multiplicity.eq_top_iff_not_finite theorem ne_top_iff_finite {a b : α} : multiplicity a b ≠ ⊤ ↔ Finite a b := by rw [Ne.def, eq_top_iff_not_finite, Classical.not_not] #align multiplicity.ne_top_iff_finite multiplicity.ne_top_iff_finite theorem lt_top_iff_finite {a b : α} : multiplicity a b < ⊤ ↔ Finite a b := by rw [lt_top_iff_ne_top, ne_top_iff_finite] #align multiplicity.lt_top_iff_finite multiplicity.lt_top_iff_finite theorem exists_eq_pow_mul_and_not_dvd {a b : α} (hfin : Finite a b) : ∃ c : α, b = a ^ (multiplicity a b).get hfin * c ∧ ¬a ∣ c := by obtain ⟨c, hc⟩ := multiplicity.pow_multiplicity_dvd hfin refine' ⟨c, hc, _⟩ rintro ⟨k, hk⟩ rw [hk, ← mul_assoc, ← _root_.pow_succ'] at hc have h₁ : a ^ ((multiplicity a b).get hfin + 1) ∣ b := ⟨k, hc⟩ exact (multiplicity.eq_coe_iff.1 (by simp)).2 h₁ #align multiplicity.exists_eq_pow_mul_and_not_dvd multiplicity.exists_eq_pow_mul_and_not_dvd theorem multiplicity_le_multiplicity_iff {a b : α} {c d : β} : multiplicity a b ≤ multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b → c ^ n ∣ d := ⟨fun h n hab => pow_dvd_of_le_multiplicity (le_trans (le_multiplicity_of_pow_dvd hab) h), fun h => letI := Classical.dec (Finite a b) if hab : Finite a b then by rw [← PartENat.natCast_get (finite_iff_dom.1 hab)]; exact le_multiplicity_of_pow_dvd (h _ (pow_multiplicity_dvd _)) else by have : ∀ n : ℕ, c ^ n ∣ d := fun n => h n (not_finite_iff_forall.1 hab _) rw [eq_top_iff_not_finite.2 hab, eq_top_iff_not_finite.2 (not_finite_iff_forall.2 this)]⟩ #align multiplicity.multiplicity_le_multiplicity_iff multiplicity.multiplicity_le_multiplicity_iff theorem multiplicity_eq_multiplicity_iff {a b : α} {c d : β} : multiplicity a b = multiplicity c d ↔ ∀ n : ℕ, a ^ n ∣ b ↔ c ^ n ∣ d := ⟨fun h n => ⟨multiplicity_le_multiplicity_iff.mp h.le n, multiplicity_le_multiplicity_iff.mp h.ge n⟩, fun h => le_antisymm (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mp) (multiplicity_le_multiplicity_iff.mpr fun n => (h n).mpr)⟩ #align multiplicity.multiplicity_eq_multiplicity_iff multiplicity.multiplicity_eq_multiplicity_iff theorem le_multiplicity_map {F : Type*} [MonoidHomClass F α β] (f : F) {a b : α} : multiplicity a b ≤ multiplicity (f a) (f b) := multiplicity_le_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd f theorem multiplicity_map_eq {F : Type*} [MulEquivClass F α β] (f : F) {a b : α} : multiplicity (f a) (f b) = multiplicity a b := multiplicity_eq_multiplicity_iff.mpr fun n ↦ by rw [← map_pow]; exact map_dvd_iff f theorem multiplicity_le_multiplicity_of_dvd_right {a b c : α} (h : b ∣ c) : multiplicity a b ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun _ hb => hb.trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_right multiplicity.multiplicity_le_multiplicity_of_dvd_right theorem eq_of_associated_right {a b c : α} (h : Associated b c) : multiplicity a b = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_right h.dvd) (multiplicity_le_multiplicity_of_dvd_right h.symm.dvd) #align multiplicity.eq_of_associated_right multiplicity.eq_of_associated_right theorem dvd_of_multiplicity_pos {a b : α} (h : (0 : PartENat) < multiplicity a b) : a ∣ b := by rw [← pow_one a] apply pow_dvd_of_le_multiplicity simpa only [Nat.cast_one, PartENat.pos_iff_one_le] using h #align multiplicity.dvd_of_multiplicity_pos multiplicity.dvd_of_multiplicity_pos theorem dvd_iff_multiplicity_pos {a b : α} : (0 : PartENat) < multiplicity a b ↔ a ∣ b := ⟨dvd_of_multiplicity_pos, fun hdvd => lt_of_le_of_ne (zero_le _) fun heq => is_greatest (show multiplicity a b < ↑1 by simpa only [heq, Nat.cast_zero] using PartENat.coe_lt_coe.mpr zero_lt_one) (by rwa [pow_one a])⟩ #align multiplicity.dvd_iff_multiplicity_pos multiplicity.dvd_iff_multiplicity_pos theorem finite_nat_iff {a b : ℕ} : Finite a b ↔ a ≠ 1 ∧ 0 < b := by rw [← not_iff_not, not_finite_iff_forall, not_and_or, Ne.def, Classical.not_not, not_lt, le_zero_iff] exact ⟨fun h => or_iff_not_imp_right.2 fun hb => have ha : a ≠ 0 := fun ha => hb <| zero_dvd_iff.mp <| by rw [ha] at h; exact h 1 Classical.by_contradiction fun ha1 : a ≠ 1 => have ha_gt_one : 1 < a := lt_of_not_ge fun _ => match a with | 0 => ha rfl | 1 => ha1 rfl | b+2 => by linarith not_lt_of_ge (le_of_dvd (Nat.pos_of_ne_zero hb) (h b)) (lt_pow_self ha_gt_one b), fun h => by cases h <;> simp [*]⟩ #align multiplicity.finite_nat_iff multiplicity.finite_nat_iff alias ⟨_, _root_.has_dvd.dvd.multiplicity_pos⟩ := dvd_iff_multiplicity_pos end Monoid section CommMonoid variable [CommMonoid α] theorem finite_of_finite_mul_left {a b c : α} : Finite a (b * c) → Finite a c := by rw [mul_comm]; exact finite_of_finite_mul_right #align multiplicity.finite_of_finite_mul_left multiplicity.finite_of_finite_mul_left variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem isUnit_right {a b : α} (ha : ¬IsUnit a) (hb : IsUnit b) : multiplicity a b = 0 := eq_coe_iff.2 ⟨show a ^ 0 ∣ b by simp only [_root_.pow_zero, one_dvd], by rw [pow_one] exact fun h => mt (isUnit_of_dvd_unit h) ha hb⟩ #align multiplicity.is_unit_right multiplicity.isUnit_right theorem one_right {a : α} (ha : ¬IsUnit a) : multiplicity a 1 = 0 := isUnit_right ha isUnit_one #align multiplicity.one_right multiplicity.one_right theorem unit_right {a : α} (ha : ¬IsUnit a) (u : αˣ) : multiplicity a u = 0 := isUnit_right ha u.isUnit #align multiplicity.unit_right multiplicity.unit_right open Classical theorem multiplicity_le_multiplicity_of_dvd_left {a b c : α} (hdvd : a ∣ b) : multiplicity b c ≤ multiplicity a c := multiplicity_le_multiplicity_iff.2 fun n h => (pow_dvd_pow_of_dvd hdvd n).trans h #align multiplicity.multiplicity_le_multiplicity_of_dvd_left multiplicity.multiplicity_le_multiplicity_of_dvd_left theorem eq_of_associated_left {a b c : α} (h : Associated a b) : multiplicity b c = multiplicity a c := le_antisymm (multiplicity_le_multiplicity_of_dvd_left h.dvd) (multiplicity_le_multiplicity_of_dvd_left h.symm.dvd) #align multiplicity.eq_of_associated_left multiplicity.eq_of_associated_left -- Porting note: this was doing nothing in mathlib3 also -- alias dvd_iff_multiplicity_pos ↔ _ _root_.has_dvd.dvd.multiplicity_pos end CommMonoid section MonoidWithZero variable [MonoidWithZero α] theorem ne_zero_of_finite {a b : α} (h : Finite a b) : b ≠ 0 := let ⟨n, hn⟩ := h fun hb => by simp [hb] at hn #align multiplicity.ne_zero_of_finite multiplicity.ne_zero_of_finite variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem zero (a : α) : multiplicity a 0 = ⊤ := Part.eq_none_iff.2 fun _ ⟨⟨_, hk⟩, _⟩ => hk (dvd_zero _) #align multiplicity.zero multiplicity.zero @[simp] theorem multiplicity_zero_eq_zero_of_ne_zero (a : α) (ha : a ≠ 0) : multiplicity 0 a = 0 := multiplicity.multiplicity_eq_zero.2 <| mt zero_dvd_iff.1 ha #align multiplicity.multiplicity_zero_eq_zero_of_ne_zero multiplicity.multiplicity_zero_eq_zero_of_ne_zero end MonoidWithZero section CommMonoidWithZero variable [CommMonoidWithZero α] variable [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem multiplicity_mk_eq_multiplicity [DecidableRel ((· ∣ ·) : Associates α → Associates α → Prop)] {a b : α} : multiplicity (Associates.mk a) (Associates.mk b) = multiplicity a b := by by_cases h : Finite a b · rw [← PartENat.natCast_get (finite_iff_dom.mp h)] refine' (multiplicity.unique (show Associates.mk a ^ (multiplicity a b).get h ∣ Associates.mk b from _) _).symm <;> rw [← Associates.mk_pow, Associates.mk_dvd_mk] · exact pow_multiplicity_dvd h · exact is_greatest ((PartENat.lt_coe_iff _ _).mpr (Exists.intro (finite_iff_dom.mp h) (Nat.lt_succ_self _))) · suffices ¬Finite (Associates.mk a) (Associates.mk b) by rw [finite_iff_dom, PartENat.not_dom_iff_eq_top] at h this rw [h, this] refine' not_finite_iff_forall.mpr fun n => by rw [← Associates.mk_pow, Associates.mk_dvd_mk] exact not_finite_iff_forall.mp h n #align multiplicity.multiplicity_mk_eq_multiplicity multiplicity.multiplicity_mk_eq_multiplicity end CommMonoidWithZero section Semiring variable [Semiring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] theorem min_le_multiplicity_add {p a b : α} : min (multiplicity p a) (multiplicity p b) ≤ multiplicity p (a + b) := (le_total (multiplicity p a) (multiplicity p b)).elim (fun h => by rw [min_eq_left h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add hn (multiplicity_le_multiplicity_iff.1 h n hn)) fun h => by rw [min_eq_right h, multiplicity_le_multiplicity_iff]; exact fun n hn => dvd_add (multiplicity_le_multiplicity_iff.1 h n hn) hn #align multiplicity.min_le_multiplicity_add multiplicity.min_le_multiplicity_add end Semiring section Ring variable [Ring α] [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] protected theorem neg (a b : α) : multiplicity a (-b) = multiplicity a b := Part.ext' (by simp only [multiplicity, PartENat.find, dvd_neg]) fun h₁ h₂ => PartENat.natCast_inj.1 (by rw [PartENat.natCast_get] exact Eq.symm (unique (pow_multiplicity_dvd _).neg_right (mt dvd_neg.1 (is_greatest' _ (lt_succ_self _))))) #align multiplicity.neg multiplicity.neg theorem Int.natAbs (a : ℕ) (b : ℤ) : multiplicity a b.natAbs = multiplicity (a : ℤ) b := by cases' Int.natAbs_eq b with h h <;> conv_rhs => rw [h] · rw [Int.coe_nat_multiplicity] · rw [multiplicity.neg, Int.coe_nat_multiplicity] #align multiplicity.int.nat_abs multiplicity.Int.natAbs theorem multiplicity_add_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a + b) = multiplicity p b := by apply le_antisymm · apply PartENat.le_of_lt_add_one cases' PartENat.ne_top_iff.mp (PartENat.ne_top_of_lt h) with k hk rw [hk] rw_mod_cast [multiplicity_lt_iff_not_dvd, dvd_add_right] intro h_dvd · apply multiplicity.is_greatest _ h_dvd rw [hk, ← Nat.succ_eq_add_one] norm_cast apply Nat.lt_succ_self k · rw [pow_dvd_iff_le_multiplicity, Nat.cast_add, ← hk, Nat.cast_one] exact PartENat.add_one_le_of_lt h · have := @min_le_multiplicity_add α _ _ p a b rwa [← min_eq_right (le_of_lt h)] #align multiplicity.multiplicity_add_of_gt multiplicity.multiplicity_add_of_gt theorem multiplicity_sub_of_gt {p a b : α} (h : multiplicity p b < multiplicity p a) : multiplicity p (a - b) = multiplicity p b := by rw [sub_eq_add_neg, multiplicity_add_of_gt] <;> rw [multiplicity.neg]; assumption #align multiplicity.multiplicity_sub_of_gt multiplicity.multiplicity_sub_of_gt theorem multiplicity_add_eq_min {p a b : α} (h : multiplicity p a ≠ multiplicity p b) : multiplicity p (a + b) = min (multiplicity p a) (multiplicity p b) := by rcases lt_trichotomy (multiplicity p a) (multiplicity p b) with (hab | hab | hab) · rw [add_comm, multiplicity_add_of_gt hab, min_eq_left] exact le_of_lt hab · contradiction · rw [multiplicity_add_of_gt hab, min_eq_right] exact le_of_lt hab #align multiplicity.multiplicity_add_eq_min multiplicity.multiplicity_add_eq_min end Ring section CancelCommMonoidWithZero variable [CancelCommMonoidWithZero α] /- Porting note: removed previous wf recursion hints and added termination_by Also pulled a b intro parameters since Lean parses that more easily -/ theorem finite_mul_aux {p : α} (hp : Prime p) {a b : α} : ∀ {n m : ℕ}, ¬p ^ (n + 1) ∣ a → ¬p ^ (m + 1) ∣ b → ¬p ^ (n + m + 1) ∣ a * b | n, m => fun ha hb ⟨s, hs⟩ => have : p ∣ a * b := ⟨p ^ (n + m) * s, by simp [hs, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩ (hp.2.2 a b this).elim (fun ⟨x, hx⟩ => have hn0 : 0 < n := Nat.pos_of_ne_zero fun hn0 => by simp [hx, hn0] at ha have hpx : ¬p ^ (n - 1 + 1) ∣ x := fun ⟨y, hy⟩ => ha (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hn0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) have : 1 ≤ n + m := le_trans hn0 (Nat.le_add_right n m) finite_mul_aux hp hpx hb ⟨s, mul_right_cancel₀ hp.1 (by rw [tsub_add_eq_add_tsub (succ_le_of_lt hn0), tsub_add_cancel_of_le this] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩) fun ⟨x, hx⟩ => have hm0 : 0 < m := Nat.pos_of_ne_zero fun hm0 => by simp [hx, hm0] at hb have hpx : ¬p ^ (m - 1 + 1) ∣ x := fun ⟨y, hy⟩ => hb (hx.symm ▸ ⟨y, mul_right_cancel₀ hp.1 <| by rw [tsub_add_cancel_of_le (succ_le_of_lt hm0)] at hy; simp [hy, pow_add, mul_comm, mul_assoc, mul_left_comm]⟩) finite_mul_aux hp ha hpx ⟨s, mul_right_cancel₀ hp.1 (by rw [add_assoc, tsub_add_cancel_of_le (succ_le_of_lt hm0)] simp_all [mul_comm, mul_assoc, mul_left_comm, pow_add])⟩ termination_by finite_mul_aux _ _ n m => n+m #align multiplicity.finite_mul_aux multiplicity.finite_mul_aux theorem finite_mul {p a b : α} (hp : Prime p) : Finite p a → Finite p b → Finite p (a * b) := fun ⟨n, hn⟩ ⟨m, hm⟩ => ⟨n + m, finite_mul_aux hp hn hm⟩ #align multiplicity.finite_mul multiplicity.finite_mul theorem finite_mul_iff {p a b : α} (hp : Prime p) : Finite p (a * b) ↔ Finite p a ∧ Finite p b := ⟨fun h => ⟨finite_of_finite_mul_right h, finite_of_finite_mul_left h⟩, fun h => finite_mul hp h.1 h.2⟩ #align multiplicity.finite_mul_iff multiplicity.finite_mul_iff theorem finite_pow {p a : α} (hp : Prime p) : ∀ {k : ℕ} (_ : Finite p a), Finite p (a ^ k) | 0, _ => ⟨0, by simp [mt isUnit_iff_dvd_one.2 hp.2.1]⟩ | k + 1, ha => by rw [_root_.pow_succ]; exact finite_mul hp ha (finite_pow hp ha) #align multiplicity.finite_pow multiplicity.finite_pow variable [DecidableRel ((· ∣ ·) : α → α → Prop)] @[simp] theorem multiplicity_self {a : α} (ha : ¬IsUnit a) (ha0 : a ≠ 0) : multiplicity a a = 1 := by rw [← Nat.cast_one] exact eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => ha (isUnit_iff_dvd_one.2 ⟨b, mul_left_cancel₀ ha0 <| by simpa [_root_.pow_succ, mul_assoc] using hb⟩)⟩ #align multiplicity.multiplicity_self multiplicity.multiplicity_self @[simp] theorem get_multiplicity_self {a : α} (ha : Finite a a) : get (multiplicity a a) ha = 1 := PartENat.get_eq_iff_eq_coe.2 (eq_coe_iff.2 ⟨by simp, fun ⟨b, hb⟩ => by rw [← mul_one a, pow_add, pow_one, mul_assoc, mul_assoc, mul_right_inj' (ne_zero_of_finite ha)] at hb; exact mt isUnit_iff_dvd_one.2 (not_unit_of_finite ha) ⟨b, by simp_all⟩⟩) #align multiplicity.get_multiplicity_self multiplicity.get_multiplicity_self protected theorem mul' {p a b : α} (hp : Prime p) (h : (multiplicity p (a * b)).Dom) : get (multiplicity p (a * b)) h = get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by have hdiva : p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 ∣ a := pow_multiplicity_dvd _ have hdivb : p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 ∣ b := pow_multiplicity_dvd _ have hpoweq : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) = p ^ get (multiplicity p a) ((finite_mul_iff hp).1 h).1 * p ^ get (multiplicity p b) ((finite_mul_iff hp).1 h).2 := by simp [pow_add] have hdiv : p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2) ∣ a * b := by rw [hpoweq]; apply mul_dvd_mul <;> assumption have hsucc : ¬p ^ (get (multiplicity p a) ((finite_mul_iff hp).1 h).1 + get (multiplicity p b) ((finite_mul_iff hp).1 h).2 + 1) ∣ a * b := fun h => not_or_of_not (is_greatest' _ (lt_succ_self _)) (is_greatest' _ (lt_succ_self _)) (_root_.succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul hp hdiva hdivb h) rw [← PartENat.natCast_inj, PartENat.natCast_get, eq_coe_iff]; exact ⟨hdiv, hsucc⟩ #align multiplicity.mul' multiplicity.mul' open Classical protected theorem mul {p a b : α} (hp : Prime p) : multiplicity p (a * b) = multiplicity p a + multiplicity p b := if h : Finite p a ∧ Finite p b then by rw [← PartENat.natCast_get (finite_iff_dom.1 h.1), ← PartENat.natCast_get (finite_iff_dom.1 h.2), ← PartENat.natCast_get (finite_iff_dom.1 (finite_mul hp h.1 h.2)), ← Nat.cast_add, PartENat.natCast_inj, multiplicity.mul' hp] else by rw [eq_top_iff_not_finite.2 (mt (finite_mul_iff hp).1 h)] cases' not_and_or.1 h with h h <;> simp [eq_top_iff_not_finite.2 h] #align multiplicity.mul multiplicity.mul theorem Finset.prod {β : Type*} {p : α} (hp : Prime p) (s : Finset β) (f : β → α) : multiplicity p (∏ x in s, f x) = ∑ x in s, multiplicity p (f x) := by classical induction' s using Finset.induction with a s has ih h · simp only [Finset.sum_empty, Finset.prod_empty] convert one_right hp.not_unit · simp [has, ← ih] convert multiplicity.mul hp #align multiplicity.finset.prod multiplicity.Finset.prod -- Porting note: with protected could not use pow' k in the succ branch protected theorem pow' {p a : α} (hp : Prime p) (ha : Finite p a) : ∀ {k : ℕ}, get (multiplicity p (a ^ k)) (finite_pow hp ha) = k * get (multiplicity p a) ha := by intro k induction' k with k hk · simp [one_right hp.not_unit] · have : multiplicity p (a ^ (k + 1)) = multiplicity p (a * a ^ k) := by rw [_root_.pow_succ] rw [succ_eq_add_one, get_eq_get_of_eq _ _ this, multiplicity.mul' hp, hk, add_mul, one_mul, add_comm] #align multiplicity.pow' multiplicity.pow' theorem pow {p a : α} (hp : Prime p) : ∀ {k : ℕ}, multiplicity p (a ^ k) = k • multiplicity p a | 0 => by simp [one_right hp.not_unit] | succ k => by simp [_root_.pow_succ, succ_nsmul, pow hp, multiplicity.mul hp] #align multiplicity.pow multiplicity.pow theorem multiplicity_pow_self {p : α} (h0 : p ≠ 0) (hu : ¬IsUnit p) (n : ℕ) : multiplicity p (p ^ n) = n := by rw [eq_coe_iff] use dvd_rfl rw [pow_dvd_pow_iff h0 hu] apply Nat.not_succ_le_self #align multiplicity.multiplicity_pow_self multiplicity.multiplicity_pow_self theorem multiplicity_pow_self_of_prime {p : α} (hp : Prime p) (n : ℕ) : multiplicity p (p ^ n) = n := multiplicity_pow_self hp.ne_zero hp.not_unit n #align multiplicity.multiplicity_pow_self_of_prime multiplicity.multiplicity_pow_self_of_prime end CancelCommMonoidWithZero end multiplicity section Nat open multiplicity theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity] intro h have := Nat.dvd_gcd h (hle _ h) rw [Coprime.gcd_eq_one hab, Nat.dvd_one, pow_one] at this
exact hp this
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0 := by rw [multiplicity_le_multiplicity_iff] at hle rw [← nonpos_iff_eq_zero, ← not_lt, PartENat.pos_iff_one_le, ← Nat.cast_one, ← pow_dvd_iff_le_multiplicity] intro h have := Nat.dvd_gcd h (hle _ h) rw [Coprime.gcd_eq_one hab, Nat.dvd_one, pow_one] at this
Mathlib.RingTheory.Multiplicity.640_0.uTHZeAJqYiw3Jx8
theorem multiplicity_eq_zero_of_coprime {p a b : ℕ} (hp : p ≠ 1) (hle : multiplicity p a ≤ multiplicity p b) (hab : Nat.Coprime a b) : multiplicity p a = 0
Mathlib_RingTheory_Multiplicity
α : Type u_1 β : Type u_2 inst✝ : LinearOrderedCommMonoid α a : α h : ¬1 ≤ a ⊢ ¬1 ≤ a * a
/- Copyright (c) 2016 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl -/ import Mathlib.Algebra.Order.Monoid.Lemmas import Mathlib.Order.BoundedOrder #align_import algebra.order.monoid.defs from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Ordered monoids This file provides the definitions of ordered monoids. -/ open Function variable {α β : Type*} /-- An ordered (additive) commutative monoid is a commutative monoid with a partial order such that addition is monotone. -/ class OrderedAddCommMonoid (α : Type*) extends AddCommMonoid α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c, c + a ≤ c + b #align ordered_add_comm_monoid OrderedAddCommMonoid /-- An ordered commutative monoid is a commutative monoid with a partial order such that multiplication is monotone. -/ @[to_additive] class OrderedCommMonoid (α : Type*) extends CommMonoid α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c, c * a ≤ c * b #align ordered_comm_monoid OrderedCommMonoid section OrderedCommMonoid variable [OrderedCommMonoid α] @[to_additive] instance OrderedCommMonoid.toCovariantClassLeft : CovariantClass α α (· * ·) (· ≤ ·) where elim := fun a _ _ bc ↦ OrderedCommMonoid.mul_le_mul_left _ _ bc a #align ordered_comm_monoid.to_covariant_class_left OrderedCommMonoid.toCovariantClassLeft #align ordered_add_comm_monoid.to_covariant_class_left OrderedAddCommMonoid.toCovariantClassLeft /- This instance can be proven with `by infer_instance`. However, `WithBot ℕ` does not pick up a `CovariantClass M M (Function.swap (*)) (≤)` instance without it (see PR mathlib#7940). -/ @[to_additive] instance OrderedCommMonoid.toCovariantClassRight (M : Type*) [OrderedCommMonoid M] : CovariantClass M M (swap (· * ·)) (· ≤ ·) := covariant_swap_mul_of_covariant_mul M _ #align ordered_comm_monoid.to_covariant_class_right OrderedCommMonoid.toCovariantClassRight #align ordered_add_comm_monoid.to_covariant_class_right OrderedAddCommMonoid.toCovariantClassRight end OrderedCommMonoid /-- An ordered cancellative additive commutative monoid is a partially ordered commutative additive monoid in which addition is cancellative and monotone. -/ class OrderedCancelAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α where protected le_of_add_le_add_left : ∀ a b c : α, a + b ≤ a + c → b ≤ c #align ordered_cancel_add_comm_monoid OrderedCancelAddCommMonoid /-- An ordered cancellative commutative monoid is a partially ordered commutative monoid in which multiplication is cancellative and monotone. -/ @[to_additive OrderedCancelAddCommMonoid] class OrderedCancelCommMonoid (α : Type*) extends OrderedCommMonoid α where protected le_of_mul_le_mul_left : ∀ a b c : α, a * b ≤ a * c → b ≤ c #align ordered_cancel_comm_monoid OrderedCancelCommMonoid #align ordered_cancel_comm_monoid.to_ordered_comm_monoid OrderedCancelCommMonoid.toOrderedCommMonoid #align ordered_cancel_add_comm_monoid.to_ordered_add_comm_monoid OrderedCancelAddCommMonoid.toOrderedAddCommMonoid section OrderedCancelCommMonoid variable [OrderedCancelCommMonoid α] -- See note [lower instance priority] @[to_additive] instance (priority := 200) OrderedCancelCommMonoid.toContravariantClassLeLeft : ContravariantClass α α (· * ·) (· ≤ ·) := ⟨OrderedCancelCommMonoid.le_of_mul_le_mul_left⟩ #align ordered_cancel_comm_monoid.to_contravariant_class_le_left OrderedCancelCommMonoid.toContravariantClassLeLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_le_left OrderedCancelAddCommMonoid.toContravariantClassLeLeft #noalign ordered_cancel_comm_monoid.lt_of_mul_lt_mul_left #noalign ordered_cancel_add_comm_monoid.lt_of_add_lt_add_left @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassLeft : ContravariantClass α α (· * ·) (· < ·) where elim := contravariant_lt_of_contravariant_le α α _ ContravariantClass.elim #align ordered_cancel_comm_monoid.to_contravariant_class_left OrderedCancelCommMonoid.toContravariantClassLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_left OrderedCancelAddCommMonoid.toContravariantClassLeft /- This instance can be proven with `by infer_instance`. However, by analogy with the instance `OrderedCancelCommMonoid.to_covariantClass_right` above, I imagine that without this instance, some Type would not have a `ContravariantClass M M (function.swap (*)) (<)` instance. -/ @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassRight : ContravariantClass α α (swap (· * ·)) (· < ·) := contravariant_swap_mul_of_contravariant_mul α _ #align ordered_cancel_comm_monoid.to_contravariant_class_right OrderedCancelCommMonoid.toContravariantClassRight #align ordered_cancel_add_comm_monoid.to_contravariant_class_right OrderedCancelAddCommMonoid.toContravariantClassRight -- See note [lower instance priority] @[to_additive OrderedCancelAddCommMonoid.toCancelAddCommMonoid] instance (priority := 100) OrderedCancelCommMonoid.toCancelCommMonoid : CancelCommMonoid α := { ‹OrderedCancelCommMonoid α› with mul_left_cancel := fun a b c h => (le_of_mul_le_mul_left' h.le).antisymm <| le_of_mul_le_mul_left' h.ge } #align ordered_cancel_comm_monoid.to_cancel_comm_monoid OrderedCancelCommMonoid.toCancelCommMonoid #align ordered_cancel_add_comm_monoid.to_cancel_add_comm_monoid OrderedCancelAddCommMonoid.toCancelAddCommMonoid #noalign has_mul.to_covariant_class_left #noalign has_add.to_covariant_class_left #noalign has_mul.to_covariant_class_right #noalign has_add.to_covariant_class_right end OrderedCancelCommMonoid set_option linter.deprecated false in @[deprecated] theorem bit0_pos [OrderedAddCommMonoid α] {a : α} (h : 0 < a) : 0 < bit0 a := add_pos' h h #align bit0_pos bit0_pos /-- A linearly ordered additive commutative monoid. -/ class LinearOrderedAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α, LinearOrder α #align linear_ordered_add_comm_monoid LinearOrderedAddCommMonoid /-- A linearly ordered commutative monoid. -/ @[to_additive] class LinearOrderedCommMonoid (α : Type*) extends OrderedCommMonoid α, LinearOrder α #align linear_ordered_comm_monoid LinearOrderedCommMonoid /-- A linearly ordered cancellative additive commutative monoid is an additive commutative monoid with a decidable linear order in which addition is cancellative and monotone. -/ class LinearOrderedCancelAddCommMonoid (α : Type*) extends OrderedCancelAddCommMonoid α, LinearOrderedAddCommMonoid α #align linear_ordered_cancel_add_comm_monoid LinearOrderedCancelAddCommMonoid /-- A linearly ordered cancellative commutative monoid is a commutative monoid with a linear order in which multiplication is cancellative and monotone. -/ @[to_additive LinearOrderedCancelAddCommMonoid] class LinearOrderedCancelCommMonoid (α : Type*) extends OrderedCancelCommMonoid α, LinearOrderedCommMonoid α #align linear_ordered_cancel_comm_monoid LinearOrderedCancelCommMonoid attribute [to_additive existing] LinearOrderedCancelCommMonoid.toLinearOrderedCommMonoid /-- A linearly ordered commutative monoid with an additively absorbing `⊤` element. Instances should include number systems with an infinite element adjoined. -/ class LinearOrderedAddCommMonoidWithTop (α : Type*) extends LinearOrderedAddCommMonoid α, OrderTop α where /-- In a `LinearOrderedAddCommMonoidWithTop`, the `⊤` element is invariant under addition. -/ protected top_add' : ∀ x : α, ⊤ + x = ⊤ #align linear_ordered_add_comm_monoid_with_top LinearOrderedAddCommMonoidWithTop #align linear_ordered_add_comm_monoid_with_top.to_order_top LinearOrderedAddCommMonoidWithTop.toOrderTop section LinearOrderedAddCommMonoidWithTop variable [LinearOrderedAddCommMonoidWithTop α] {a b : α} @[simp] theorem top_add (a : α) : ⊤ + a = ⊤ := LinearOrderedAddCommMonoidWithTop.top_add' a #align top_add top_add @[simp] theorem add_top (a : α) : a + ⊤ = ⊤ := Trans.trans (add_comm _ _) (top_add _) #align add_top add_top end LinearOrderedAddCommMonoidWithTop variable [LinearOrderedCommMonoid α] {a : α} @[to_additive (attr := simp)] theorem one_le_mul_self_iff : 1 ≤ a * a ↔ 1 ≤ a := ⟨(fun h ↦ by
push_neg at h ⊢
@[to_additive (attr := simp)] theorem one_le_mul_self_iff : 1 ≤ a * a ↔ 1 ≤ a := ⟨(fun h ↦ by
Mathlib.Algebra.Order.Monoid.Defs.176_0.P9s7TI8QJTWokXI
@[to_additive (attr
Mathlib_Algebra_Order_Monoid_Defs
α : Type u_1 β : Type u_2 inst✝ : LinearOrderedCommMonoid α a : α h : a < 1 ⊢ a * a < 1
/- Copyright (c) 2016 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl -/ import Mathlib.Algebra.Order.Monoid.Lemmas import Mathlib.Order.BoundedOrder #align_import algebra.order.monoid.defs from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Ordered monoids This file provides the definitions of ordered monoids. -/ open Function variable {α β : Type*} /-- An ordered (additive) commutative monoid is a commutative monoid with a partial order such that addition is monotone. -/ class OrderedAddCommMonoid (α : Type*) extends AddCommMonoid α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c, c + a ≤ c + b #align ordered_add_comm_monoid OrderedAddCommMonoid /-- An ordered commutative monoid is a commutative monoid with a partial order such that multiplication is monotone. -/ @[to_additive] class OrderedCommMonoid (α : Type*) extends CommMonoid α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c, c * a ≤ c * b #align ordered_comm_monoid OrderedCommMonoid section OrderedCommMonoid variable [OrderedCommMonoid α] @[to_additive] instance OrderedCommMonoid.toCovariantClassLeft : CovariantClass α α (· * ·) (· ≤ ·) where elim := fun a _ _ bc ↦ OrderedCommMonoid.mul_le_mul_left _ _ bc a #align ordered_comm_monoid.to_covariant_class_left OrderedCommMonoid.toCovariantClassLeft #align ordered_add_comm_monoid.to_covariant_class_left OrderedAddCommMonoid.toCovariantClassLeft /- This instance can be proven with `by infer_instance`. However, `WithBot ℕ` does not pick up a `CovariantClass M M (Function.swap (*)) (≤)` instance without it (see PR mathlib#7940). -/ @[to_additive] instance OrderedCommMonoid.toCovariantClassRight (M : Type*) [OrderedCommMonoid M] : CovariantClass M M (swap (· * ·)) (· ≤ ·) := covariant_swap_mul_of_covariant_mul M _ #align ordered_comm_monoid.to_covariant_class_right OrderedCommMonoid.toCovariantClassRight #align ordered_add_comm_monoid.to_covariant_class_right OrderedAddCommMonoid.toCovariantClassRight end OrderedCommMonoid /-- An ordered cancellative additive commutative monoid is a partially ordered commutative additive monoid in which addition is cancellative and monotone. -/ class OrderedCancelAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α where protected le_of_add_le_add_left : ∀ a b c : α, a + b ≤ a + c → b ≤ c #align ordered_cancel_add_comm_monoid OrderedCancelAddCommMonoid /-- An ordered cancellative commutative monoid is a partially ordered commutative monoid in which multiplication is cancellative and monotone. -/ @[to_additive OrderedCancelAddCommMonoid] class OrderedCancelCommMonoid (α : Type*) extends OrderedCommMonoid α where protected le_of_mul_le_mul_left : ∀ a b c : α, a * b ≤ a * c → b ≤ c #align ordered_cancel_comm_monoid OrderedCancelCommMonoid #align ordered_cancel_comm_monoid.to_ordered_comm_monoid OrderedCancelCommMonoid.toOrderedCommMonoid #align ordered_cancel_add_comm_monoid.to_ordered_add_comm_monoid OrderedCancelAddCommMonoid.toOrderedAddCommMonoid section OrderedCancelCommMonoid variable [OrderedCancelCommMonoid α] -- See note [lower instance priority] @[to_additive] instance (priority := 200) OrderedCancelCommMonoid.toContravariantClassLeLeft : ContravariantClass α α (· * ·) (· ≤ ·) := ⟨OrderedCancelCommMonoid.le_of_mul_le_mul_left⟩ #align ordered_cancel_comm_monoid.to_contravariant_class_le_left OrderedCancelCommMonoid.toContravariantClassLeLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_le_left OrderedCancelAddCommMonoid.toContravariantClassLeLeft #noalign ordered_cancel_comm_monoid.lt_of_mul_lt_mul_left #noalign ordered_cancel_add_comm_monoid.lt_of_add_lt_add_left @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassLeft : ContravariantClass α α (· * ·) (· < ·) where elim := contravariant_lt_of_contravariant_le α α _ ContravariantClass.elim #align ordered_cancel_comm_monoid.to_contravariant_class_left OrderedCancelCommMonoid.toContravariantClassLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_left OrderedCancelAddCommMonoid.toContravariantClassLeft /- This instance can be proven with `by infer_instance`. However, by analogy with the instance `OrderedCancelCommMonoid.to_covariantClass_right` above, I imagine that without this instance, some Type would not have a `ContravariantClass M M (function.swap (*)) (<)` instance. -/ @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassRight : ContravariantClass α α (swap (· * ·)) (· < ·) := contravariant_swap_mul_of_contravariant_mul α _ #align ordered_cancel_comm_monoid.to_contravariant_class_right OrderedCancelCommMonoid.toContravariantClassRight #align ordered_cancel_add_comm_monoid.to_contravariant_class_right OrderedCancelAddCommMonoid.toContravariantClassRight -- See note [lower instance priority] @[to_additive OrderedCancelAddCommMonoid.toCancelAddCommMonoid] instance (priority := 100) OrderedCancelCommMonoid.toCancelCommMonoid : CancelCommMonoid α := { ‹OrderedCancelCommMonoid α› with mul_left_cancel := fun a b c h => (le_of_mul_le_mul_left' h.le).antisymm <| le_of_mul_le_mul_left' h.ge } #align ordered_cancel_comm_monoid.to_cancel_comm_monoid OrderedCancelCommMonoid.toCancelCommMonoid #align ordered_cancel_add_comm_monoid.to_cancel_add_comm_monoid OrderedCancelAddCommMonoid.toCancelAddCommMonoid #noalign has_mul.to_covariant_class_left #noalign has_add.to_covariant_class_left #noalign has_mul.to_covariant_class_right #noalign has_add.to_covariant_class_right end OrderedCancelCommMonoid set_option linter.deprecated false in @[deprecated] theorem bit0_pos [OrderedAddCommMonoid α] {a : α} (h : 0 < a) : 0 < bit0 a := add_pos' h h #align bit0_pos bit0_pos /-- A linearly ordered additive commutative monoid. -/ class LinearOrderedAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α, LinearOrder α #align linear_ordered_add_comm_monoid LinearOrderedAddCommMonoid /-- A linearly ordered commutative monoid. -/ @[to_additive] class LinearOrderedCommMonoid (α : Type*) extends OrderedCommMonoid α, LinearOrder α #align linear_ordered_comm_monoid LinearOrderedCommMonoid /-- A linearly ordered cancellative additive commutative monoid is an additive commutative monoid with a decidable linear order in which addition is cancellative and monotone. -/ class LinearOrderedCancelAddCommMonoid (α : Type*) extends OrderedCancelAddCommMonoid α, LinearOrderedAddCommMonoid α #align linear_ordered_cancel_add_comm_monoid LinearOrderedCancelAddCommMonoid /-- A linearly ordered cancellative commutative monoid is a commutative monoid with a linear order in which multiplication is cancellative and monotone. -/ @[to_additive LinearOrderedCancelAddCommMonoid] class LinearOrderedCancelCommMonoid (α : Type*) extends OrderedCancelCommMonoid α, LinearOrderedCommMonoid α #align linear_ordered_cancel_comm_monoid LinearOrderedCancelCommMonoid attribute [to_additive existing] LinearOrderedCancelCommMonoid.toLinearOrderedCommMonoid /-- A linearly ordered commutative monoid with an additively absorbing `⊤` element. Instances should include number systems with an infinite element adjoined. -/ class LinearOrderedAddCommMonoidWithTop (α : Type*) extends LinearOrderedAddCommMonoid α, OrderTop α where /-- In a `LinearOrderedAddCommMonoidWithTop`, the `⊤` element is invariant under addition. -/ protected top_add' : ∀ x : α, ⊤ + x = ⊤ #align linear_ordered_add_comm_monoid_with_top LinearOrderedAddCommMonoidWithTop #align linear_ordered_add_comm_monoid_with_top.to_order_top LinearOrderedAddCommMonoidWithTop.toOrderTop section LinearOrderedAddCommMonoidWithTop variable [LinearOrderedAddCommMonoidWithTop α] {a b : α} @[simp] theorem top_add (a : α) : ⊤ + a = ⊤ := LinearOrderedAddCommMonoidWithTop.top_add' a #align top_add top_add @[simp] theorem add_top (a : α) : a + ⊤ = ⊤ := Trans.trans (add_comm _ _) (top_add _) #align add_top add_top end LinearOrderedAddCommMonoidWithTop variable [LinearOrderedCommMonoid α] {a : α} @[to_additive (attr := simp)] theorem one_le_mul_self_iff : 1 ≤ a * a ↔ 1 ≤ a := ⟨(fun h ↦ by push_neg at h ⊢;
exact mul_lt_one' h h
@[to_additive (attr := simp)] theorem one_le_mul_self_iff : 1 ≤ a * a ↔ 1 ≤ a := ⟨(fun h ↦ by push_neg at h ⊢;
Mathlib.Algebra.Order.Monoid.Defs.176_0.P9s7TI8QJTWokXI
@[to_additive (attr
Mathlib_Algebra_Order_Monoid_Defs
α : Type u_1 β : Type u_2 inst✝ : LinearOrderedCommMonoid α a : α h : ¬1 < a ⊢ ¬1 < a * a
/- Copyright (c) 2016 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl -/ import Mathlib.Algebra.Order.Monoid.Lemmas import Mathlib.Order.BoundedOrder #align_import algebra.order.monoid.defs from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Ordered monoids This file provides the definitions of ordered monoids. -/ open Function variable {α β : Type*} /-- An ordered (additive) commutative monoid is a commutative monoid with a partial order such that addition is monotone. -/ class OrderedAddCommMonoid (α : Type*) extends AddCommMonoid α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c, c + a ≤ c + b #align ordered_add_comm_monoid OrderedAddCommMonoid /-- An ordered commutative monoid is a commutative monoid with a partial order such that multiplication is monotone. -/ @[to_additive] class OrderedCommMonoid (α : Type*) extends CommMonoid α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c, c * a ≤ c * b #align ordered_comm_monoid OrderedCommMonoid section OrderedCommMonoid variable [OrderedCommMonoid α] @[to_additive] instance OrderedCommMonoid.toCovariantClassLeft : CovariantClass α α (· * ·) (· ≤ ·) where elim := fun a _ _ bc ↦ OrderedCommMonoid.mul_le_mul_left _ _ bc a #align ordered_comm_monoid.to_covariant_class_left OrderedCommMonoid.toCovariantClassLeft #align ordered_add_comm_monoid.to_covariant_class_left OrderedAddCommMonoid.toCovariantClassLeft /- This instance can be proven with `by infer_instance`. However, `WithBot ℕ` does not pick up a `CovariantClass M M (Function.swap (*)) (≤)` instance without it (see PR mathlib#7940). -/ @[to_additive] instance OrderedCommMonoid.toCovariantClassRight (M : Type*) [OrderedCommMonoid M] : CovariantClass M M (swap (· * ·)) (· ≤ ·) := covariant_swap_mul_of_covariant_mul M _ #align ordered_comm_monoid.to_covariant_class_right OrderedCommMonoid.toCovariantClassRight #align ordered_add_comm_monoid.to_covariant_class_right OrderedAddCommMonoid.toCovariantClassRight end OrderedCommMonoid /-- An ordered cancellative additive commutative monoid is a partially ordered commutative additive monoid in which addition is cancellative and monotone. -/ class OrderedCancelAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α where protected le_of_add_le_add_left : ∀ a b c : α, a + b ≤ a + c → b ≤ c #align ordered_cancel_add_comm_monoid OrderedCancelAddCommMonoid /-- An ordered cancellative commutative monoid is a partially ordered commutative monoid in which multiplication is cancellative and monotone. -/ @[to_additive OrderedCancelAddCommMonoid] class OrderedCancelCommMonoid (α : Type*) extends OrderedCommMonoid α where protected le_of_mul_le_mul_left : ∀ a b c : α, a * b ≤ a * c → b ≤ c #align ordered_cancel_comm_monoid OrderedCancelCommMonoid #align ordered_cancel_comm_monoid.to_ordered_comm_monoid OrderedCancelCommMonoid.toOrderedCommMonoid #align ordered_cancel_add_comm_monoid.to_ordered_add_comm_monoid OrderedCancelAddCommMonoid.toOrderedAddCommMonoid section OrderedCancelCommMonoid variable [OrderedCancelCommMonoid α] -- See note [lower instance priority] @[to_additive] instance (priority := 200) OrderedCancelCommMonoid.toContravariantClassLeLeft : ContravariantClass α α (· * ·) (· ≤ ·) := ⟨OrderedCancelCommMonoid.le_of_mul_le_mul_left⟩ #align ordered_cancel_comm_monoid.to_contravariant_class_le_left OrderedCancelCommMonoid.toContravariantClassLeLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_le_left OrderedCancelAddCommMonoid.toContravariantClassLeLeft #noalign ordered_cancel_comm_monoid.lt_of_mul_lt_mul_left #noalign ordered_cancel_add_comm_monoid.lt_of_add_lt_add_left @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassLeft : ContravariantClass α α (· * ·) (· < ·) where elim := contravariant_lt_of_contravariant_le α α _ ContravariantClass.elim #align ordered_cancel_comm_monoid.to_contravariant_class_left OrderedCancelCommMonoid.toContravariantClassLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_left OrderedCancelAddCommMonoid.toContravariantClassLeft /- This instance can be proven with `by infer_instance`. However, by analogy with the instance `OrderedCancelCommMonoid.to_covariantClass_right` above, I imagine that without this instance, some Type would not have a `ContravariantClass M M (function.swap (*)) (<)` instance. -/ @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassRight : ContravariantClass α α (swap (· * ·)) (· < ·) := contravariant_swap_mul_of_contravariant_mul α _ #align ordered_cancel_comm_monoid.to_contravariant_class_right OrderedCancelCommMonoid.toContravariantClassRight #align ordered_cancel_add_comm_monoid.to_contravariant_class_right OrderedCancelAddCommMonoid.toContravariantClassRight -- See note [lower instance priority] @[to_additive OrderedCancelAddCommMonoid.toCancelAddCommMonoid] instance (priority := 100) OrderedCancelCommMonoid.toCancelCommMonoid : CancelCommMonoid α := { ‹OrderedCancelCommMonoid α› with mul_left_cancel := fun a b c h => (le_of_mul_le_mul_left' h.le).antisymm <| le_of_mul_le_mul_left' h.ge } #align ordered_cancel_comm_monoid.to_cancel_comm_monoid OrderedCancelCommMonoid.toCancelCommMonoid #align ordered_cancel_add_comm_monoid.to_cancel_add_comm_monoid OrderedCancelAddCommMonoid.toCancelAddCommMonoid #noalign has_mul.to_covariant_class_left #noalign has_add.to_covariant_class_left #noalign has_mul.to_covariant_class_right #noalign has_add.to_covariant_class_right end OrderedCancelCommMonoid set_option linter.deprecated false in @[deprecated] theorem bit0_pos [OrderedAddCommMonoid α] {a : α} (h : 0 < a) : 0 < bit0 a := add_pos' h h #align bit0_pos bit0_pos /-- A linearly ordered additive commutative monoid. -/ class LinearOrderedAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α, LinearOrder α #align linear_ordered_add_comm_monoid LinearOrderedAddCommMonoid /-- A linearly ordered commutative monoid. -/ @[to_additive] class LinearOrderedCommMonoid (α : Type*) extends OrderedCommMonoid α, LinearOrder α #align linear_ordered_comm_monoid LinearOrderedCommMonoid /-- A linearly ordered cancellative additive commutative monoid is an additive commutative monoid with a decidable linear order in which addition is cancellative and monotone. -/ class LinearOrderedCancelAddCommMonoid (α : Type*) extends OrderedCancelAddCommMonoid α, LinearOrderedAddCommMonoid α #align linear_ordered_cancel_add_comm_monoid LinearOrderedCancelAddCommMonoid /-- A linearly ordered cancellative commutative monoid is a commutative monoid with a linear order in which multiplication is cancellative and monotone. -/ @[to_additive LinearOrderedCancelAddCommMonoid] class LinearOrderedCancelCommMonoid (α : Type*) extends OrderedCancelCommMonoid α, LinearOrderedCommMonoid α #align linear_ordered_cancel_comm_monoid LinearOrderedCancelCommMonoid attribute [to_additive existing] LinearOrderedCancelCommMonoid.toLinearOrderedCommMonoid /-- A linearly ordered commutative monoid with an additively absorbing `⊤` element. Instances should include number systems with an infinite element adjoined. -/ class LinearOrderedAddCommMonoidWithTop (α : Type*) extends LinearOrderedAddCommMonoid α, OrderTop α where /-- In a `LinearOrderedAddCommMonoidWithTop`, the `⊤` element is invariant under addition. -/ protected top_add' : ∀ x : α, ⊤ + x = ⊤ #align linear_ordered_add_comm_monoid_with_top LinearOrderedAddCommMonoidWithTop #align linear_ordered_add_comm_monoid_with_top.to_order_top LinearOrderedAddCommMonoidWithTop.toOrderTop section LinearOrderedAddCommMonoidWithTop variable [LinearOrderedAddCommMonoidWithTop α] {a b : α} @[simp] theorem top_add (a : α) : ⊤ + a = ⊤ := LinearOrderedAddCommMonoidWithTop.top_add' a #align top_add top_add @[simp] theorem add_top (a : α) : a + ⊤ = ⊤ := Trans.trans (add_comm _ _) (top_add _) #align add_top add_top end LinearOrderedAddCommMonoidWithTop variable [LinearOrderedCommMonoid α] {a : α} @[to_additive (attr := simp)] theorem one_le_mul_self_iff : 1 ≤ a * a ↔ 1 ≤ a := ⟨(fun h ↦ by push_neg at h ⊢; exact mul_lt_one' h h).mtr, fun h ↦ one_le_mul h h⟩ @[to_additive (attr := simp)] theorem one_lt_mul_self_iff : 1 < a * a ↔ 1 < a := ⟨(fun h ↦ by
push_neg at h ⊢
@[to_additive (attr := simp)] theorem one_lt_mul_self_iff : 1 < a * a ↔ 1 < a := ⟨(fun h ↦ by
Mathlib.Algebra.Order.Monoid.Defs.180_0.P9s7TI8QJTWokXI
@[to_additive (attr
Mathlib_Algebra_Order_Monoid_Defs
α : Type u_1 β : Type u_2 inst✝ : LinearOrderedCommMonoid α a : α h : a ≤ 1 ⊢ a * a ≤ 1
/- Copyright (c) 2016 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl -/ import Mathlib.Algebra.Order.Monoid.Lemmas import Mathlib.Order.BoundedOrder #align_import algebra.order.monoid.defs from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Ordered monoids This file provides the definitions of ordered monoids. -/ open Function variable {α β : Type*} /-- An ordered (additive) commutative monoid is a commutative monoid with a partial order such that addition is monotone. -/ class OrderedAddCommMonoid (α : Type*) extends AddCommMonoid α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c, c + a ≤ c + b #align ordered_add_comm_monoid OrderedAddCommMonoid /-- An ordered commutative monoid is a commutative monoid with a partial order such that multiplication is monotone. -/ @[to_additive] class OrderedCommMonoid (α : Type*) extends CommMonoid α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c, c * a ≤ c * b #align ordered_comm_monoid OrderedCommMonoid section OrderedCommMonoid variable [OrderedCommMonoid α] @[to_additive] instance OrderedCommMonoid.toCovariantClassLeft : CovariantClass α α (· * ·) (· ≤ ·) where elim := fun a _ _ bc ↦ OrderedCommMonoid.mul_le_mul_left _ _ bc a #align ordered_comm_monoid.to_covariant_class_left OrderedCommMonoid.toCovariantClassLeft #align ordered_add_comm_monoid.to_covariant_class_left OrderedAddCommMonoid.toCovariantClassLeft /- This instance can be proven with `by infer_instance`. However, `WithBot ℕ` does not pick up a `CovariantClass M M (Function.swap (*)) (≤)` instance without it (see PR mathlib#7940). -/ @[to_additive] instance OrderedCommMonoid.toCovariantClassRight (M : Type*) [OrderedCommMonoid M] : CovariantClass M M (swap (· * ·)) (· ≤ ·) := covariant_swap_mul_of_covariant_mul M _ #align ordered_comm_monoid.to_covariant_class_right OrderedCommMonoid.toCovariantClassRight #align ordered_add_comm_monoid.to_covariant_class_right OrderedAddCommMonoid.toCovariantClassRight end OrderedCommMonoid /-- An ordered cancellative additive commutative monoid is a partially ordered commutative additive monoid in which addition is cancellative and monotone. -/ class OrderedCancelAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α where protected le_of_add_le_add_left : ∀ a b c : α, a + b ≤ a + c → b ≤ c #align ordered_cancel_add_comm_monoid OrderedCancelAddCommMonoid /-- An ordered cancellative commutative monoid is a partially ordered commutative monoid in which multiplication is cancellative and monotone. -/ @[to_additive OrderedCancelAddCommMonoid] class OrderedCancelCommMonoid (α : Type*) extends OrderedCommMonoid α where protected le_of_mul_le_mul_left : ∀ a b c : α, a * b ≤ a * c → b ≤ c #align ordered_cancel_comm_monoid OrderedCancelCommMonoid #align ordered_cancel_comm_monoid.to_ordered_comm_monoid OrderedCancelCommMonoid.toOrderedCommMonoid #align ordered_cancel_add_comm_monoid.to_ordered_add_comm_monoid OrderedCancelAddCommMonoid.toOrderedAddCommMonoid section OrderedCancelCommMonoid variable [OrderedCancelCommMonoid α] -- See note [lower instance priority] @[to_additive] instance (priority := 200) OrderedCancelCommMonoid.toContravariantClassLeLeft : ContravariantClass α α (· * ·) (· ≤ ·) := ⟨OrderedCancelCommMonoid.le_of_mul_le_mul_left⟩ #align ordered_cancel_comm_monoid.to_contravariant_class_le_left OrderedCancelCommMonoid.toContravariantClassLeLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_le_left OrderedCancelAddCommMonoid.toContravariantClassLeLeft #noalign ordered_cancel_comm_monoid.lt_of_mul_lt_mul_left #noalign ordered_cancel_add_comm_monoid.lt_of_add_lt_add_left @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassLeft : ContravariantClass α α (· * ·) (· < ·) where elim := contravariant_lt_of_contravariant_le α α _ ContravariantClass.elim #align ordered_cancel_comm_monoid.to_contravariant_class_left OrderedCancelCommMonoid.toContravariantClassLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_left OrderedCancelAddCommMonoid.toContravariantClassLeft /- This instance can be proven with `by infer_instance`. However, by analogy with the instance `OrderedCancelCommMonoid.to_covariantClass_right` above, I imagine that without this instance, some Type would not have a `ContravariantClass M M (function.swap (*)) (<)` instance. -/ @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassRight : ContravariantClass α α (swap (· * ·)) (· < ·) := contravariant_swap_mul_of_contravariant_mul α _ #align ordered_cancel_comm_monoid.to_contravariant_class_right OrderedCancelCommMonoid.toContravariantClassRight #align ordered_cancel_add_comm_monoid.to_contravariant_class_right OrderedCancelAddCommMonoid.toContravariantClassRight -- See note [lower instance priority] @[to_additive OrderedCancelAddCommMonoid.toCancelAddCommMonoid] instance (priority := 100) OrderedCancelCommMonoid.toCancelCommMonoid : CancelCommMonoid α := { ‹OrderedCancelCommMonoid α› with mul_left_cancel := fun a b c h => (le_of_mul_le_mul_left' h.le).antisymm <| le_of_mul_le_mul_left' h.ge } #align ordered_cancel_comm_monoid.to_cancel_comm_monoid OrderedCancelCommMonoid.toCancelCommMonoid #align ordered_cancel_add_comm_monoid.to_cancel_add_comm_monoid OrderedCancelAddCommMonoid.toCancelAddCommMonoid #noalign has_mul.to_covariant_class_left #noalign has_add.to_covariant_class_left #noalign has_mul.to_covariant_class_right #noalign has_add.to_covariant_class_right end OrderedCancelCommMonoid set_option linter.deprecated false in @[deprecated] theorem bit0_pos [OrderedAddCommMonoid α] {a : α} (h : 0 < a) : 0 < bit0 a := add_pos' h h #align bit0_pos bit0_pos /-- A linearly ordered additive commutative monoid. -/ class LinearOrderedAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α, LinearOrder α #align linear_ordered_add_comm_monoid LinearOrderedAddCommMonoid /-- A linearly ordered commutative monoid. -/ @[to_additive] class LinearOrderedCommMonoid (α : Type*) extends OrderedCommMonoid α, LinearOrder α #align linear_ordered_comm_monoid LinearOrderedCommMonoid /-- A linearly ordered cancellative additive commutative monoid is an additive commutative monoid with a decidable linear order in which addition is cancellative and monotone. -/ class LinearOrderedCancelAddCommMonoid (α : Type*) extends OrderedCancelAddCommMonoid α, LinearOrderedAddCommMonoid α #align linear_ordered_cancel_add_comm_monoid LinearOrderedCancelAddCommMonoid /-- A linearly ordered cancellative commutative monoid is a commutative monoid with a linear order in which multiplication is cancellative and monotone. -/ @[to_additive LinearOrderedCancelAddCommMonoid] class LinearOrderedCancelCommMonoid (α : Type*) extends OrderedCancelCommMonoid α, LinearOrderedCommMonoid α #align linear_ordered_cancel_comm_monoid LinearOrderedCancelCommMonoid attribute [to_additive existing] LinearOrderedCancelCommMonoid.toLinearOrderedCommMonoid /-- A linearly ordered commutative monoid with an additively absorbing `⊤` element. Instances should include number systems with an infinite element adjoined. -/ class LinearOrderedAddCommMonoidWithTop (α : Type*) extends LinearOrderedAddCommMonoid α, OrderTop α where /-- In a `LinearOrderedAddCommMonoidWithTop`, the `⊤` element is invariant under addition. -/ protected top_add' : ∀ x : α, ⊤ + x = ⊤ #align linear_ordered_add_comm_monoid_with_top LinearOrderedAddCommMonoidWithTop #align linear_ordered_add_comm_monoid_with_top.to_order_top LinearOrderedAddCommMonoidWithTop.toOrderTop section LinearOrderedAddCommMonoidWithTop variable [LinearOrderedAddCommMonoidWithTop α] {a b : α} @[simp] theorem top_add (a : α) : ⊤ + a = ⊤ := LinearOrderedAddCommMonoidWithTop.top_add' a #align top_add top_add @[simp] theorem add_top (a : α) : a + ⊤ = ⊤ := Trans.trans (add_comm _ _) (top_add _) #align add_top add_top end LinearOrderedAddCommMonoidWithTop variable [LinearOrderedCommMonoid α] {a : α} @[to_additive (attr := simp)] theorem one_le_mul_self_iff : 1 ≤ a * a ↔ 1 ≤ a := ⟨(fun h ↦ by push_neg at h ⊢; exact mul_lt_one' h h).mtr, fun h ↦ one_le_mul h h⟩ @[to_additive (attr := simp)] theorem one_lt_mul_self_iff : 1 < a * a ↔ 1 < a := ⟨(fun h ↦ by push_neg at h ⊢;
exact mul_le_one' h h
@[to_additive (attr := simp)] theorem one_lt_mul_self_iff : 1 < a * a ↔ 1 < a := ⟨(fun h ↦ by push_neg at h ⊢;
Mathlib.Algebra.Order.Monoid.Defs.180_0.P9s7TI8QJTWokXI
@[to_additive (attr
Mathlib_Algebra_Order_Monoid_Defs
α : Type u_1 β : Type u_2 inst✝ : LinearOrderedCommMonoid α a : α ⊢ a * a ≤ 1 ↔ a ≤ 1
/- Copyright (c) 2016 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl -/ import Mathlib.Algebra.Order.Monoid.Lemmas import Mathlib.Order.BoundedOrder #align_import algebra.order.monoid.defs from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Ordered monoids This file provides the definitions of ordered monoids. -/ open Function variable {α β : Type*} /-- An ordered (additive) commutative monoid is a commutative monoid with a partial order such that addition is monotone. -/ class OrderedAddCommMonoid (α : Type*) extends AddCommMonoid α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c, c + a ≤ c + b #align ordered_add_comm_monoid OrderedAddCommMonoid /-- An ordered commutative monoid is a commutative monoid with a partial order such that multiplication is monotone. -/ @[to_additive] class OrderedCommMonoid (α : Type*) extends CommMonoid α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c, c * a ≤ c * b #align ordered_comm_monoid OrderedCommMonoid section OrderedCommMonoid variable [OrderedCommMonoid α] @[to_additive] instance OrderedCommMonoid.toCovariantClassLeft : CovariantClass α α (· * ·) (· ≤ ·) where elim := fun a _ _ bc ↦ OrderedCommMonoid.mul_le_mul_left _ _ bc a #align ordered_comm_monoid.to_covariant_class_left OrderedCommMonoid.toCovariantClassLeft #align ordered_add_comm_monoid.to_covariant_class_left OrderedAddCommMonoid.toCovariantClassLeft /- This instance can be proven with `by infer_instance`. However, `WithBot ℕ` does not pick up a `CovariantClass M M (Function.swap (*)) (≤)` instance without it (see PR mathlib#7940). -/ @[to_additive] instance OrderedCommMonoid.toCovariantClassRight (M : Type*) [OrderedCommMonoid M] : CovariantClass M M (swap (· * ·)) (· ≤ ·) := covariant_swap_mul_of_covariant_mul M _ #align ordered_comm_monoid.to_covariant_class_right OrderedCommMonoid.toCovariantClassRight #align ordered_add_comm_monoid.to_covariant_class_right OrderedAddCommMonoid.toCovariantClassRight end OrderedCommMonoid /-- An ordered cancellative additive commutative monoid is a partially ordered commutative additive monoid in which addition is cancellative and monotone. -/ class OrderedCancelAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α where protected le_of_add_le_add_left : ∀ a b c : α, a + b ≤ a + c → b ≤ c #align ordered_cancel_add_comm_monoid OrderedCancelAddCommMonoid /-- An ordered cancellative commutative monoid is a partially ordered commutative monoid in which multiplication is cancellative and monotone. -/ @[to_additive OrderedCancelAddCommMonoid] class OrderedCancelCommMonoid (α : Type*) extends OrderedCommMonoid α where protected le_of_mul_le_mul_left : ∀ a b c : α, a * b ≤ a * c → b ≤ c #align ordered_cancel_comm_monoid OrderedCancelCommMonoid #align ordered_cancel_comm_monoid.to_ordered_comm_monoid OrderedCancelCommMonoid.toOrderedCommMonoid #align ordered_cancel_add_comm_monoid.to_ordered_add_comm_monoid OrderedCancelAddCommMonoid.toOrderedAddCommMonoid section OrderedCancelCommMonoid variable [OrderedCancelCommMonoid α] -- See note [lower instance priority] @[to_additive] instance (priority := 200) OrderedCancelCommMonoid.toContravariantClassLeLeft : ContravariantClass α α (· * ·) (· ≤ ·) := ⟨OrderedCancelCommMonoid.le_of_mul_le_mul_left⟩ #align ordered_cancel_comm_monoid.to_contravariant_class_le_left OrderedCancelCommMonoid.toContravariantClassLeLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_le_left OrderedCancelAddCommMonoid.toContravariantClassLeLeft #noalign ordered_cancel_comm_monoid.lt_of_mul_lt_mul_left #noalign ordered_cancel_add_comm_monoid.lt_of_add_lt_add_left @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassLeft : ContravariantClass α α (· * ·) (· < ·) where elim := contravariant_lt_of_contravariant_le α α _ ContravariantClass.elim #align ordered_cancel_comm_monoid.to_contravariant_class_left OrderedCancelCommMonoid.toContravariantClassLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_left OrderedCancelAddCommMonoid.toContravariantClassLeft /- This instance can be proven with `by infer_instance`. However, by analogy with the instance `OrderedCancelCommMonoid.to_covariantClass_right` above, I imagine that without this instance, some Type would not have a `ContravariantClass M M (function.swap (*)) (<)` instance. -/ @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassRight : ContravariantClass α α (swap (· * ·)) (· < ·) := contravariant_swap_mul_of_contravariant_mul α _ #align ordered_cancel_comm_monoid.to_contravariant_class_right OrderedCancelCommMonoid.toContravariantClassRight #align ordered_cancel_add_comm_monoid.to_contravariant_class_right OrderedCancelAddCommMonoid.toContravariantClassRight -- See note [lower instance priority] @[to_additive OrderedCancelAddCommMonoid.toCancelAddCommMonoid] instance (priority := 100) OrderedCancelCommMonoid.toCancelCommMonoid : CancelCommMonoid α := { ‹OrderedCancelCommMonoid α› with mul_left_cancel := fun a b c h => (le_of_mul_le_mul_left' h.le).antisymm <| le_of_mul_le_mul_left' h.ge } #align ordered_cancel_comm_monoid.to_cancel_comm_monoid OrderedCancelCommMonoid.toCancelCommMonoid #align ordered_cancel_add_comm_monoid.to_cancel_add_comm_monoid OrderedCancelAddCommMonoid.toCancelAddCommMonoid #noalign has_mul.to_covariant_class_left #noalign has_add.to_covariant_class_left #noalign has_mul.to_covariant_class_right #noalign has_add.to_covariant_class_right end OrderedCancelCommMonoid set_option linter.deprecated false in @[deprecated] theorem bit0_pos [OrderedAddCommMonoid α] {a : α} (h : 0 < a) : 0 < bit0 a := add_pos' h h #align bit0_pos bit0_pos /-- A linearly ordered additive commutative monoid. -/ class LinearOrderedAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α, LinearOrder α #align linear_ordered_add_comm_monoid LinearOrderedAddCommMonoid /-- A linearly ordered commutative monoid. -/ @[to_additive] class LinearOrderedCommMonoid (α : Type*) extends OrderedCommMonoid α, LinearOrder α #align linear_ordered_comm_monoid LinearOrderedCommMonoid /-- A linearly ordered cancellative additive commutative monoid is an additive commutative monoid with a decidable linear order in which addition is cancellative and monotone. -/ class LinearOrderedCancelAddCommMonoid (α : Type*) extends OrderedCancelAddCommMonoid α, LinearOrderedAddCommMonoid α #align linear_ordered_cancel_add_comm_monoid LinearOrderedCancelAddCommMonoid /-- A linearly ordered cancellative commutative monoid is a commutative monoid with a linear order in which multiplication is cancellative and monotone. -/ @[to_additive LinearOrderedCancelAddCommMonoid] class LinearOrderedCancelCommMonoid (α : Type*) extends OrderedCancelCommMonoid α, LinearOrderedCommMonoid α #align linear_ordered_cancel_comm_monoid LinearOrderedCancelCommMonoid attribute [to_additive existing] LinearOrderedCancelCommMonoid.toLinearOrderedCommMonoid /-- A linearly ordered commutative monoid with an additively absorbing `⊤` element. Instances should include number systems with an infinite element adjoined. -/ class LinearOrderedAddCommMonoidWithTop (α : Type*) extends LinearOrderedAddCommMonoid α, OrderTop α where /-- In a `LinearOrderedAddCommMonoidWithTop`, the `⊤` element is invariant under addition. -/ protected top_add' : ∀ x : α, ⊤ + x = ⊤ #align linear_ordered_add_comm_monoid_with_top LinearOrderedAddCommMonoidWithTop #align linear_ordered_add_comm_monoid_with_top.to_order_top LinearOrderedAddCommMonoidWithTop.toOrderTop section LinearOrderedAddCommMonoidWithTop variable [LinearOrderedAddCommMonoidWithTop α] {a b : α} @[simp] theorem top_add (a : α) : ⊤ + a = ⊤ := LinearOrderedAddCommMonoidWithTop.top_add' a #align top_add top_add @[simp] theorem add_top (a : α) : a + ⊤ = ⊤ := Trans.trans (add_comm _ _) (top_add _) #align add_top add_top end LinearOrderedAddCommMonoidWithTop variable [LinearOrderedCommMonoid α] {a : α} @[to_additive (attr := simp)] theorem one_le_mul_self_iff : 1 ≤ a * a ↔ 1 ≤ a := ⟨(fun h ↦ by push_neg at h ⊢; exact mul_lt_one' h h).mtr, fun h ↦ one_le_mul h h⟩ @[to_additive (attr := simp)] theorem one_lt_mul_self_iff : 1 < a * a ↔ 1 < a := ⟨(fun h ↦ by push_neg at h ⊢; exact mul_le_one' h h).mtr, fun h ↦ one_lt_mul'' h h⟩ @[to_additive (attr := simp)] theorem mul_self_le_one_iff : a * a ≤ 1 ↔ a ≤ 1 := by
simp [← not_iff_not]
@[to_additive (attr := simp)] theorem mul_self_le_one_iff : a * a ≤ 1 ↔ a ≤ 1 := by
Mathlib.Algebra.Order.Monoid.Defs.184_0.P9s7TI8QJTWokXI
@[to_additive (attr
Mathlib_Algebra_Order_Monoid_Defs
α : Type u_1 β : Type u_2 inst✝ : LinearOrderedCommMonoid α a : α ⊢ a * a < 1 ↔ a < 1
/- Copyright (c) 2016 Jeremy Avigad. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Avigad, Leonardo de Moura, Mario Carneiro, Johannes Hölzl -/ import Mathlib.Algebra.Order.Monoid.Lemmas import Mathlib.Order.BoundedOrder #align_import algebra.order.monoid.defs from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Ordered monoids This file provides the definitions of ordered monoids. -/ open Function variable {α β : Type*} /-- An ordered (additive) commutative monoid is a commutative monoid with a partial order such that addition is monotone. -/ class OrderedAddCommMonoid (α : Type*) extends AddCommMonoid α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c, c + a ≤ c + b #align ordered_add_comm_monoid OrderedAddCommMonoid /-- An ordered commutative monoid is a commutative monoid with a partial order such that multiplication is monotone. -/ @[to_additive] class OrderedCommMonoid (α : Type*) extends CommMonoid α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c, c * a ≤ c * b #align ordered_comm_monoid OrderedCommMonoid section OrderedCommMonoid variable [OrderedCommMonoid α] @[to_additive] instance OrderedCommMonoid.toCovariantClassLeft : CovariantClass α α (· * ·) (· ≤ ·) where elim := fun a _ _ bc ↦ OrderedCommMonoid.mul_le_mul_left _ _ bc a #align ordered_comm_monoid.to_covariant_class_left OrderedCommMonoid.toCovariantClassLeft #align ordered_add_comm_monoid.to_covariant_class_left OrderedAddCommMonoid.toCovariantClassLeft /- This instance can be proven with `by infer_instance`. However, `WithBot ℕ` does not pick up a `CovariantClass M M (Function.swap (*)) (≤)` instance without it (see PR mathlib#7940). -/ @[to_additive] instance OrderedCommMonoid.toCovariantClassRight (M : Type*) [OrderedCommMonoid M] : CovariantClass M M (swap (· * ·)) (· ≤ ·) := covariant_swap_mul_of_covariant_mul M _ #align ordered_comm_monoid.to_covariant_class_right OrderedCommMonoid.toCovariantClassRight #align ordered_add_comm_monoid.to_covariant_class_right OrderedAddCommMonoid.toCovariantClassRight end OrderedCommMonoid /-- An ordered cancellative additive commutative monoid is a partially ordered commutative additive monoid in which addition is cancellative and monotone. -/ class OrderedCancelAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α where protected le_of_add_le_add_left : ∀ a b c : α, a + b ≤ a + c → b ≤ c #align ordered_cancel_add_comm_monoid OrderedCancelAddCommMonoid /-- An ordered cancellative commutative monoid is a partially ordered commutative monoid in which multiplication is cancellative and monotone. -/ @[to_additive OrderedCancelAddCommMonoid] class OrderedCancelCommMonoid (α : Type*) extends OrderedCommMonoid α where protected le_of_mul_le_mul_left : ∀ a b c : α, a * b ≤ a * c → b ≤ c #align ordered_cancel_comm_monoid OrderedCancelCommMonoid #align ordered_cancel_comm_monoid.to_ordered_comm_monoid OrderedCancelCommMonoid.toOrderedCommMonoid #align ordered_cancel_add_comm_monoid.to_ordered_add_comm_monoid OrderedCancelAddCommMonoid.toOrderedAddCommMonoid section OrderedCancelCommMonoid variable [OrderedCancelCommMonoid α] -- See note [lower instance priority] @[to_additive] instance (priority := 200) OrderedCancelCommMonoid.toContravariantClassLeLeft : ContravariantClass α α (· * ·) (· ≤ ·) := ⟨OrderedCancelCommMonoid.le_of_mul_le_mul_left⟩ #align ordered_cancel_comm_monoid.to_contravariant_class_le_left OrderedCancelCommMonoid.toContravariantClassLeLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_le_left OrderedCancelAddCommMonoid.toContravariantClassLeLeft #noalign ordered_cancel_comm_monoid.lt_of_mul_lt_mul_left #noalign ordered_cancel_add_comm_monoid.lt_of_add_lt_add_left @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassLeft : ContravariantClass α α (· * ·) (· < ·) where elim := contravariant_lt_of_contravariant_le α α _ ContravariantClass.elim #align ordered_cancel_comm_monoid.to_contravariant_class_left OrderedCancelCommMonoid.toContravariantClassLeft #align ordered_cancel_add_comm_monoid.to_contravariant_class_left OrderedCancelAddCommMonoid.toContravariantClassLeft /- This instance can be proven with `by infer_instance`. However, by analogy with the instance `OrderedCancelCommMonoid.to_covariantClass_right` above, I imagine that without this instance, some Type would not have a `ContravariantClass M M (function.swap (*)) (<)` instance. -/ @[to_additive] instance OrderedCancelCommMonoid.toContravariantClassRight : ContravariantClass α α (swap (· * ·)) (· < ·) := contravariant_swap_mul_of_contravariant_mul α _ #align ordered_cancel_comm_monoid.to_contravariant_class_right OrderedCancelCommMonoid.toContravariantClassRight #align ordered_cancel_add_comm_monoid.to_contravariant_class_right OrderedCancelAddCommMonoid.toContravariantClassRight -- See note [lower instance priority] @[to_additive OrderedCancelAddCommMonoid.toCancelAddCommMonoid] instance (priority := 100) OrderedCancelCommMonoid.toCancelCommMonoid : CancelCommMonoid α := { ‹OrderedCancelCommMonoid α› with mul_left_cancel := fun a b c h => (le_of_mul_le_mul_left' h.le).antisymm <| le_of_mul_le_mul_left' h.ge } #align ordered_cancel_comm_monoid.to_cancel_comm_monoid OrderedCancelCommMonoid.toCancelCommMonoid #align ordered_cancel_add_comm_monoid.to_cancel_add_comm_monoid OrderedCancelAddCommMonoid.toCancelAddCommMonoid #noalign has_mul.to_covariant_class_left #noalign has_add.to_covariant_class_left #noalign has_mul.to_covariant_class_right #noalign has_add.to_covariant_class_right end OrderedCancelCommMonoid set_option linter.deprecated false in @[deprecated] theorem bit0_pos [OrderedAddCommMonoid α] {a : α} (h : 0 < a) : 0 < bit0 a := add_pos' h h #align bit0_pos bit0_pos /-- A linearly ordered additive commutative monoid. -/ class LinearOrderedAddCommMonoid (α : Type*) extends OrderedAddCommMonoid α, LinearOrder α #align linear_ordered_add_comm_monoid LinearOrderedAddCommMonoid /-- A linearly ordered commutative monoid. -/ @[to_additive] class LinearOrderedCommMonoid (α : Type*) extends OrderedCommMonoid α, LinearOrder α #align linear_ordered_comm_monoid LinearOrderedCommMonoid /-- A linearly ordered cancellative additive commutative monoid is an additive commutative monoid with a decidable linear order in which addition is cancellative and monotone. -/ class LinearOrderedCancelAddCommMonoid (α : Type*) extends OrderedCancelAddCommMonoid α, LinearOrderedAddCommMonoid α #align linear_ordered_cancel_add_comm_monoid LinearOrderedCancelAddCommMonoid /-- A linearly ordered cancellative commutative monoid is a commutative monoid with a linear order in which multiplication is cancellative and monotone. -/ @[to_additive LinearOrderedCancelAddCommMonoid] class LinearOrderedCancelCommMonoid (α : Type*) extends OrderedCancelCommMonoid α, LinearOrderedCommMonoid α #align linear_ordered_cancel_comm_monoid LinearOrderedCancelCommMonoid attribute [to_additive existing] LinearOrderedCancelCommMonoid.toLinearOrderedCommMonoid /-- A linearly ordered commutative monoid with an additively absorbing `⊤` element. Instances should include number systems with an infinite element adjoined. -/ class LinearOrderedAddCommMonoidWithTop (α : Type*) extends LinearOrderedAddCommMonoid α, OrderTop α where /-- In a `LinearOrderedAddCommMonoidWithTop`, the `⊤` element is invariant under addition. -/ protected top_add' : ∀ x : α, ⊤ + x = ⊤ #align linear_ordered_add_comm_monoid_with_top LinearOrderedAddCommMonoidWithTop #align linear_ordered_add_comm_monoid_with_top.to_order_top LinearOrderedAddCommMonoidWithTop.toOrderTop section LinearOrderedAddCommMonoidWithTop variable [LinearOrderedAddCommMonoidWithTop α] {a b : α} @[simp] theorem top_add (a : α) : ⊤ + a = ⊤ := LinearOrderedAddCommMonoidWithTop.top_add' a #align top_add top_add @[simp] theorem add_top (a : α) : a + ⊤ = ⊤ := Trans.trans (add_comm _ _) (top_add _) #align add_top add_top end LinearOrderedAddCommMonoidWithTop variable [LinearOrderedCommMonoid α] {a : α} @[to_additive (attr := simp)] theorem one_le_mul_self_iff : 1 ≤ a * a ↔ 1 ≤ a := ⟨(fun h ↦ by push_neg at h ⊢; exact mul_lt_one' h h).mtr, fun h ↦ one_le_mul h h⟩ @[to_additive (attr := simp)] theorem one_lt_mul_self_iff : 1 < a * a ↔ 1 < a := ⟨(fun h ↦ by push_neg at h ⊢; exact mul_le_one' h h).mtr, fun h ↦ one_lt_mul'' h h⟩ @[to_additive (attr := simp)] theorem mul_self_le_one_iff : a * a ≤ 1 ↔ a ≤ 1 := by simp [← not_iff_not] @[to_additive (attr := simp)] theorem mul_self_lt_one_iff : a * a < 1 ↔ a < 1 := by
simp [← not_iff_not]
@[to_additive (attr := simp)] theorem mul_self_lt_one_iff : a * a < 1 ↔ a < 1 := by
Mathlib.Algebra.Order.Monoid.Defs.187_0.P9s7TI8QJTWokXI
@[to_additive (attr
Mathlib_Algebra_Order_Monoid_Defs
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R src✝ : AddCon R := QuotientAddGroup.con (Submodule.toAddSubgroup I) a₁ b₁ a₂ b₂ : R h₁ : Setoid.r a₁ b₁ h₂ : Setoid.r a₂ b₂ ⊢ Setoid.r (a₁ * a₂) (b₁ * b₂)
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by
rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by
Mathlib.RingTheory.Ideal.Quotient.61_0.TwNAv7Pc4PYOWjX
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R src✝ : AddCon R := QuotientAddGroup.con (Submodule.toAddSubgroup I) a₁ b₁ a₂ b₂ : R h₁ : a₁ - b₁ ∈ I h₂ : a₂ - b₂ ∈ I ⊢ a₁ * a₂ - b₁ * b₂ ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢
have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂)
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢
Mathlib.RingTheory.Ideal.Quotient.61_0.TwNAv7Pc4PYOWjX
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R src✝ : AddCon R := QuotientAddGroup.con (Submodule.toAddSubgroup I) a₁ b₁ a₂ b₂ : R h₁ : a₁ - b₁ ∈ I h₂ : a₂ - b₂ ∈ I F : a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ ∈ I ⊢ a₁ * a₂ - b₁ * b₂ ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂)
have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁]
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂)
Mathlib.RingTheory.Ideal.Quotient.61_0.TwNAv7Pc4PYOWjX
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R src✝ : AddCon R := QuotientAddGroup.con (Submodule.toAddSubgroup I) a₁ b₁ a₂ b₂ : R h₁ : a₁ - b₁ ∈ I h₂ : a₂ - b₂ ∈ I F : a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ ∈ I ⊢ a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by
rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁]
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by
Mathlib.RingTheory.Ideal.Quotient.61_0.TwNAv7Pc4PYOWjX
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R src✝ : AddCon R := QuotientAddGroup.con (Submodule.toAddSubgroup I) a₁ b₁ a₂ b₂ : R h₁ : a₁ - b₁ ∈ I h₂ : a₂ - b₂ ∈ I F : a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ ∈ I this : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ ⊢ a₁ * a₂ - b₁ * b₂ ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁]
rwa [← this] at F
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁]
Mathlib.RingTheory.Ideal.Quotient.61_0.TwNAv7Pc4PYOWjX
/-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S : Type v x✝ y✝ x y : R ⊢ (mk (span {x})) y = 0 ↔ x ∣ y
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by
rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton]
theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by
Mathlib.RingTheory.Ideal.Quotient.133_0.TwNAv7Pc4PYOWjX
theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S : Type v x✝ y✝ x y : R ⊢ (mk I) x = (mk I) y ↔ x - y ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by
rw [← eq_zero_iff_mem, map_sub, sub_eq_zero]
theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by
Mathlib.RingTheory.Ideal.Quotient.137_0.TwNAv7Pc4PYOWjX
theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R ⊢ Subsingleton (R ⧸ I) ↔ I = ⊤
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by
rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem]
theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by
Mathlib.RingTheory.Ideal.Quotient.152_0.TwNAv7Pc4PYOWjX
theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S : Type v x y : R ⊢ ∀ (a : R ⧸ ⊤), a = default
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by
rintro ⟨x⟩
instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by
Mathlib.RingTheory.Ideal.Quotient.157_0.TwNAv7Pc4PYOWjX
instance : Unique (R ⧸ (⊤ : Ideal R))
Mathlib_RingTheory_Ideal_Quotient
case mk R : Type u inst✝ : CommRing R I : Ideal R a b : R S : Type v x✝ y : R a✝ : R ⧸ ⊤ x : R ⊢ Quot.mk Setoid.r x = default
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩;
exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top
instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩;
Mathlib.RingTheory.Ideal.Quotient.157_0.TwNAv7Pc4PYOWjX
instance : Unique (R ⧸ (⊤ : Ideal R))
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R s : Set R ⊢ ⇑(mk I) ⁻¹' (⇑(mk I) '' s) = ⋃ x, (fun y => ↑x + y) '' s
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by
ext x
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by
Mathlib.RingTheory.Ideal.Quotient.167_0.TwNAv7Pc4PYOWjX
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s
Mathlib_RingTheory_Ideal_Quotient
case h R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y : R I : Ideal R s : Set R x : R ⊢ x ∈ ⇑(mk I) ⁻¹' (⇑(mk I) '' s) ↔ x ∈ ⋃ x, (fun y => ↑x + y) '' s
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x
simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq]
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x
Mathlib.RingTheory.Ideal.Quotient.167_0.TwNAv7Pc4PYOWjX
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s
Mathlib_RingTheory_Ideal_Quotient
case h R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y : R I : Ideal R s : Set R x : R ⊢ (∃ x_1 ∈ s, x_1 - x ∈ I) ↔ ∃ i, ∃ x_1 ∈ s, ↑i + x_1 = x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq]
exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq]
Mathlib.RingTheory.Ideal.Quotient.167_0.TwNAv7Pc4PYOWjX
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a✝ b : R S : Type v x✝¹ y : R I : Ideal R s : Set R x : R x✝ : ∃ x_1 ∈ s, x_1 - x ∈ I a : R a_in : a ∈ s h : a - x ∈ I ⊢ ↑{ val := -(a - x), property := (_ : -(a - x) ∈ I) } + a = x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by
simp
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by
Mathlib.RingTheory.Ideal.Quotient.167_0.TwNAv7Pc4PYOWjX
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a✝ b : R S : Type v x✝¹ y : R I : Ideal R s : Set R x : R x✝ : ∃ i, ∃ x_1 ∈ s, ↑i + x_1 = x i : R hi : i ∈ I a : R ha : a ∈ s Eq : ↑{ val := i, property := hi } + a = x ⊢ a - x ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by
rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by
Mathlib.RingTheory.Ideal.Quotient.167_0.TwNAv7Pc4PYOWjX
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a✝ b : R S : Type v x✝¹ y : R I : Ideal R s : Set R x : R x✝ : ∃ i, ∃ x_1 ∈ s, ↑i + x_1 = x i : R hi : i ∈ I a : R ha : a ∈ s Eq : ↑{ val := i, property := hi } + a = x ⊢ -↑{ val := i, property := hi } ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub];
exact I.neg_mem hi
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub];
Mathlib.RingTheory.Ideal.Quotient.167_0.TwNAv7Pc4PYOWjX
/-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R ⊢ IsDomain (R ⧸ I) ↔ IsPrime I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by
refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by
Mathlib.RingTheory.Ideal.Quotient.189_0.TwNAv7Pc4PYOWjX
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime
Mathlib_RingTheory_Ideal_Quotient
case refine'_1 R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R H : IsDomain (R ⧸ I) ⊢ 0 ≠ 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ ·
haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ ·
Mathlib.RingTheory.Ideal.Quotient.189_0.TwNAv7Pc4PYOWjX
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime
Mathlib_RingTheory_Ideal_Quotient
case refine'_1 R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R H : IsDomain (R ⧸ I) this : Nontrivial (R ⧸ I) ⊢ 0 ≠ 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩
exact zero_ne_one
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩
Mathlib.RingTheory.Ideal.Quotient.189_0.TwNAv7Pc4PYOWjX
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime
Mathlib_RingTheory_Ideal_Quotient
case refine'_2 R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y✝ : R I : Ideal R H : IsDomain (R ⧸ I) x y : R h : x * y ∈ I ⊢ x ∈ I ∨ y ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one ·
simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one ·
Mathlib.RingTheory.Ideal.Quotient.189_0.TwNAv7Pc4PYOWjX
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime
Mathlib_RingTheory_Ideal_Quotient
case refine'_2 R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y✝ : R I : Ideal R H : IsDomain (R ⧸ I) x y : R h : (mk I) x * (mk I) y = 0 ⊢ (mk I) x = 0 ∨ (mk I) y = 0
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢
haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢
Mathlib.RingTheory.Ideal.Quotient.189_0.TwNAv7Pc4PYOWjX
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime
Mathlib_RingTheory_Ideal_Quotient
case refine'_2 R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y✝ : R I : Ideal R H : IsDomain (R ⧸ I) x y : R h : (mk I) x * (mk I) y = 0 this : NoZeroDivisors (R ⧸ I) ⊢ (mk I) x = 0 ∨ (mk I) y = 0
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H
exact eq_zero_or_eq_zero_of_mul_eq_zero h
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H
Mathlib.RingTheory.Ideal.Quotient.189_0.TwNAv7Pc4PYOWjX
theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R hI : IsMaximal I ⊢ ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b, a * b = 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by
rintro ⟨a⟩ h
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by
Mathlib.RingTheory.Ideal.Quotient.198_0.TwNAv7Pc4PYOWjX
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1
Mathlib_RingTheory_Ideal_Quotient
case mk R : Type u inst✝ : CommRing R I✝ : Ideal R a✝¹ b : R S : Type v x y : R I : Ideal R hI : IsMaximal I a✝ : R ⧸ I a : R h : Quot.mk Setoid.r a ≠ 0 ⊢ ∃ b, Quot.mk Setoid.r a * b = 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h
rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h
Mathlib.RingTheory.Ideal.Quotient.198_0.TwNAv7Pc4PYOWjX
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1
Mathlib_RingTheory_Ideal_Quotient
case mk.intro.intro.intro R : Type u inst✝ : CommRing R I✝ : Ideal R a✝¹ b✝ : R S : Type v x y : R I : Ideal R hI : IsMaximal I a✝ : R ⧸ I a : R h : Quot.mk Setoid.r a ≠ 0 b c : R hc : c ∈ I abc : b * a + c = 1 ⊢ ∃ b, Quot.mk Setoid.r a * b = 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩
rw [mul_comm] at abc
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩
Mathlib.RingTheory.Ideal.Quotient.198_0.TwNAv7Pc4PYOWjX
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1
Mathlib_RingTheory_Ideal_Quotient
case mk.intro.intro.intro R : Type u inst✝ : CommRing R I✝ : Ideal R a✝¹ b✝ : R S : Type v x y : R I : Ideal R hI : IsMaximal I a✝ : R ⧸ I a : R h : Quot.mk Setoid.r a ≠ 0 b c : R hc : c ∈ I abc : a * b + c = 1 ⊢ ∃ b, Quot.mk Setoid.r a * b = 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc
refine' ⟨mk _ b, Quot.sound _⟩
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc
Mathlib.RingTheory.Ideal.Quotient.198_0.TwNAv7Pc4PYOWjX
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1
Mathlib_RingTheory_Ideal_Quotient
case mk.intro.intro.intro R : Type u inst✝ : CommRing R I✝ : Ideal R a✝¹ b✝ : R S : Type v x y : R I : Ideal R hI : IsMaximal I a✝ : R ⧸ I a : R h : Quot.mk Setoid.r a ≠ 0 b c : R hc : c ∈ I abc : a * b + c = 1 ⊢ Setoid.r ((fun x x_1 => x * x_1) a b) 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩
simp only [Submodule.quotientRel_r_def]
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩
Mathlib.RingTheory.Ideal.Quotient.198_0.TwNAv7Pc4PYOWjX
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1
Mathlib_RingTheory_Ideal_Quotient
case mk.intro.intro.intro R : Type u inst✝ : CommRing R I✝ : Ideal R a✝¹ b✝ : R S : Type v x y : R I : Ideal R hI : IsMaximal I a✝ : R ⧸ I a : R h : Quot.mk Setoid.r a ≠ 0 b c : R hc : c ∈ I abc : a * b + c = 1 ⊢ a * b - 1 ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def]
rw [← eq_sub_iff_add_eq'] at abc
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def]
Mathlib.RingTheory.Ideal.Quotient.198_0.TwNAv7Pc4PYOWjX
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1
Mathlib_RingTheory_Ideal_Quotient
case mk.intro.intro.intro R : Type u inst✝ : CommRing R I✝ : Ideal R a✝¹ b✝ : R S : Type v x y : R I : Ideal R hI : IsMaximal I a✝ : R ⧸ I a : R h : Quot.mk Setoid.r a ≠ 0 b c : R hc : c ∈ I abc : c = 1 - a * b ⊢ a * b - 1 ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc
rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc
Mathlib.RingTheory.Ideal.Quotient.198_0.TwNAv7Pc4PYOWjX
theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a✝ b : R S : Type v x y : R I : Ideal R hI : IsMaximal I a : R ⧸ I ha : a ≠ 0 ⊢ (a * if ha : a = 0 then 0 else choose (_ : ∃ b, a * b = 1)) = 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by
rw [dif_neg ha]
/-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by
Mathlib.RingTheory.Ideal.Quotient.211_0.TwNAv7Pc4PYOWjX
/-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I)
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a✝ b : R S : Type v x y : R I : Ideal R hI : IsMaximal I a : R ⧸ I ha : a ≠ 0 ⊢ a * choose (_ : ∃ b, a * b = 1) = 1
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha];
exact Classical.choose_spec (exists_inv ha)
/-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha];
Mathlib.RingTheory.Ideal.Quotient.211_0.TwNAv7Pc4PYOWjX
/-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I)
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R hqf : IsField (R ⧸ I) ⊢ IsMaximal I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by
apply Ideal.isMaximal_iff.2
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R hqf : IsField (R ⧸ I) ⊢ 1 ∉ I ∧ ∀ (J : Ideal R) (x : R), I ≤ J → x ∉ I → x ∈ J → 1 ∈ J
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2
constructor
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
case left R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R hqf : IsField (R ⧸ I) ⊢ 1 ∉ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor ·
intro h
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor ·
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
case left R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R hqf : IsField (R ⧸ I) h : 1 ∈ I ⊢ False
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h
rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
case left.intro.mk.intro.mk R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y✝ : R I : Ideal R hqf : IsField (R ⧸ I) h : 1 ∈ I w✝¹ : R ⧸ I x : R w✝ : R ⧸ I y : R hxy : Quot.mk Setoid.r x ≠ Quot.mk Setoid.r y ⊢ False
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩
exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h))
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
case right R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R I : Ideal R hqf : IsField (R ⧸ I) ⊢ ∀ (J : Ideal R) (x : R), I ≤ J → x ∉ I → x ∈ J → 1 ∈ J
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) ·
intro J x hIJ hxnI hxJ
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) ·
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
case right R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y : R I : Ideal R hqf : IsField (R ⧸ I) J : Ideal R x : R hIJ : I ≤ J hxnI : x ∉ I hxJ : x ∈ J ⊢ 1 ∈ J
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ
rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
case right.intro.mk R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y✝ : R I : Ideal R hqf : IsField (R ⧸ I) J : Ideal R x : R hIJ : I ≤ J hxnI : x ∉ I hxJ : x ∈ J w✝ : R ⧸ I y : R hy : (mk I) x * Quot.mk Setoid.r y = 1 ⊢ 1 ∈ J
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩
rw [← zero_add (1 : R), ← sub_self (x * y), sub_add]
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
case right.intro.mk R : Type u inst✝ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y✝ : R I : Ideal R hqf : IsField (R ⧸ I) J : Ideal R x : R hIJ : I ≤ J hxnI : x ∉ I hxJ : x ∈ J w✝ : R ⧸ I y : R hy : (mk I) x * Quot.mk Setoid.r y = 1 ⊢ x * y - (x * y - 1) ∈ J
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add]
refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy))
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add]
Mathlib.RingTheory.Ideal.Quotient.233_0.TwNAv7Pc4PYOWjX
/-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝¹ : CommRing R I✝ : Ideal R a b : R S : Type v x y : R inst✝ : CommRing S I : Ideal R f : R →+* S H : ∀ a ∈ I, f a = 0 hf : Function.Surjective ⇑f ⊢ Function.Surjective ⇑(lift I f H)
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by
intro y
theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by
Mathlib.RingTheory.Ideal.Quotient.270_0.TwNAv7Pc4PYOWjX
theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H)
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝¹ : CommRing R I✝ : Ideal R a b : R S : Type v x y✝ : R inst✝ : CommRing S I : Ideal R f : R →+* S H : ∀ a ∈ I, f a = 0 hf : Function.Surjective ⇑f y : S ⊢ ∃ a, (lift I f H) a = y
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y
obtain ⟨x, rfl⟩ := hf y
theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y
Mathlib.RingTheory.Ideal.Quotient.270_0.TwNAv7Pc4PYOWjX
theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H)
Mathlib_RingTheory_Ideal_Quotient
case intro R : Type u inst✝¹ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y : R inst✝ : CommRing S I : Ideal R f : R →+* S H : ∀ a ∈ I, f a = 0 hf : Function.Surjective ⇑f x : R ⊢ ∃ a, (lift I f H) a = f x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y
use Ideal.Quotient.mk I x
theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y
Mathlib.RingTheory.Ideal.Quotient.270_0.TwNAv7Pc4PYOWjX
theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H)
Mathlib_RingTheory_Ideal_Quotient
case h R : Type u inst✝¹ : CommRing R I✝ : Ideal R a b : R S : Type v x✝ y : R inst✝ : CommRing S I : Ideal R f : R →+* S H : ∀ a ∈ I, f a = 0 hf : Function.Surjective ⇑f x : R ⊢ (lift I f H) ((mk I) x) = f x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x
simp only [Ideal.Quotient.lift_mk]
theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x
Mathlib.RingTheory.Ideal.Quotient.270_0.TwNAv7Pc4PYOWjX
theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H)
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝¹ : CommRing R I : Ideal R a b : R S✝ : Type v x y : R inst✝ : CommRing S✝ S T : Ideal R H : S ≤ T ⊢ RingHom.comp (factor S T H) (mk S) = mk T
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by
ext x
@[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by
Mathlib.RingTheory.Ideal.Quotient.290_0.TwNAv7Pc4PYOWjX
@[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T
Mathlib_RingTheory_Ideal_Quotient
case a R : Type u inst✝¹ : CommRing R I : Ideal R a b : R S✝ : Type v x✝ y : R inst✝ : CommRing S✝ S T : Ideal R H : S ≤ T x : R ⊢ (RingHom.comp (factor S T H) (mk S)) x = (mk T) x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x
rw [RingHom.comp_apply, factor_mk]
@[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x
Mathlib.RingTheory.Ideal.Quotient.290_0.TwNAv7Pc4PYOWjX
@[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T
Mathlib_RingTheory_Ideal_Quotient
R✝ : Type u inst✝¹ : CommRing R✝ I✝ : Ideal R✝ a b : R✝ S : Type v R : Type u_1 inst✝ : CommRing R I J : Ideal R h : I = J src✝ : (R ⧸ I) ≃ₗ[R] R ⧸ J := Submodule.quotEquivOfEq I J h ⊢ ∀ (x y : R ⧸ I), Equiv.toFun { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun), right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) } (x * y) = Equiv.toFun { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun), right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) } x * Equiv.toFun { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun), right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) } y
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by
rintro ⟨x⟩ ⟨y⟩
/-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by
Mathlib.RingTheory.Ideal.Quotient.298_0.TwNAv7Pc4PYOWjX
/-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J
Mathlib_RingTheory_Ideal_Quotient
case mk.mk R✝ : Type u inst✝¹ : CommRing R✝ I✝ : Ideal R✝ a b : R✝ S : Type v R : Type u_1 inst✝ : CommRing R I J : Ideal R h : I = J src✝ : (R ⧸ I) ≃ₗ[R] R ⧸ J := Submodule.quotEquivOfEq I J h x✝ : R ⧸ I x : R y✝ : R ⧸ I y : R ⊢ Equiv.toFun { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun), right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) } (Quot.mk Setoid.r x * Quot.mk Setoid.r y) = Equiv.toFun { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun), right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) } (Quot.mk Setoid.r x) * Equiv.toFun { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun), right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) } (Quot.mk Setoid.r y)
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩
rfl
/-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩
Mathlib.RingTheory.Ideal.Quotient.298_0.TwNAv7Pc4PYOWjX
/-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J
Mathlib_RingTheory_Ideal_Quotient
R✝ : Type u inst✝¹ : CommRing R✝ I✝ : Ideal R✝ a b : R✝ S : Type v R : Type u_1 inst✝ : CommRing R I J : Ideal R h : I = J ⊢ RingEquiv.symm (quotEquivOfEq h) = quotEquivOfEq (_ : J = I)
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by
ext
@[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by
Mathlib.RingTheory.Ideal.Quotient.315_0.TwNAv7Pc4PYOWjX
@[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm
Mathlib_RingTheory_Ideal_Quotient
case h R✝ : Type u inst✝¹ : CommRing R✝ I✝ : Ideal R✝ a b : R✝ S : Type v R : Type u_1 inst✝ : CommRing R I J : Ideal R h : I = J x✝ : R ⧸ J ⊢ (RingEquiv.symm (quotEquivOfEq h)) x✝ = (quotEquivOfEq (_ : J = I)) x✝
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext;
rfl
@[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext;
Mathlib.RingTheory.Ideal.Quotient.315_0.TwNAv7Pc4PYOWjX
@[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v c : R ⧸ I m : (ι → R) ⧸ pi I ι ⊢ ∀ (a₁ : R) (a₂ : ι → R) (b₁ : R) (b₂ : ι → R), Setoid.r a₁ b₁ → Setoid.r a₂ b₂ → (fun r m => Submodule.Quotient.mk (r • m)) a₁ a₂ = (fun r m => Submodule.Quotient.mk (r • m)) b₁ b₂
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by
intro c₁ m₁ c₂ m₂ hc hm
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v c : R ⧸ I m : (ι → R) ⧸ pi I ι c₁ : R m₁ : ι → R c₂ : R m₂ : ι → R hc : Setoid.r c₁ c₂ hm : Setoid.r m₁ m₂ ⊢ (fun r m => Submodule.Quotient.mk (r • m)) c₁ m₁ = (fun r m => Submodule.Quotient.mk (r • m)) c₂ m₂
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm
apply Ideal.Quotient.eq.2
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v c : R ⧸ I m : (ι → R) ⧸ pi I ι c₁ : R m₁ : ι → R c₂ : R m₂ : ι → R hc : Setoid.r c₁ c₂ hm : Setoid.r m₁ m₂ ⊢ c₁ • m₁ - c₂ • m₂ ∈ pi I ι
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2
rw [Submodule.quotientRel_r_def] at hc hm
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v c : R ⧸ I m : (ι → R) ⧸ pi I ι c₁ : R m₁ : ι → R c₂ : R m₂ : ι → R hc : c₁ - c₂ ∈ I hm : m₁ - m₂ ∈ pi I ι ⊢ c₁ • m₁ - c₂ • m₂ ∈ pi I ι
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm
intro i
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v c : R ⧸ I m : (ι → R) ⧸ pi I ι c₁ : R m₁ : ι → R c₂ : R m₂ : ι → R hc : c₁ - c₂ ∈ I hm : m₁ - m₂ ∈ pi I ι i : ι ⊢ (c₁ • m₁ - c₂ • m₂) i ∈ I
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i
exact I.mul_sub_mul_mem hc (hm i)
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ ∀ (b : (ι → R) ⧸ pi I ι), 1 • b = b
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by
rintro ⟨a⟩
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk R : Type u inst✝ : CommRing R I : Ideal R a✝ b : R S ι : Type v b✝ : (ι → R) ⧸ pi I ι a : ι → R ⊢ 1 • Quot.mk Setoid.r a = Quot.mk Setoid.r a
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩
convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.convert_3 R : Type u inst✝ : CommRing R I : Ideal R a✝ b : R S ι : Type v b✝ : (ι → R) ⧸ pi I ι a : ι → R ⊢ (Quotient.mk (pi I ι)) (1 • a) = (Quotient.mk (pi I ι)) a
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
congr with i
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.convert_3.h.e_6.h.h R : Type u inst✝ : CommRing R I : Ideal R a✝ b : R S ι : Type v b✝ : (ι → R) ⧸ pi I ι a : ι → R i : ι ⊢ (1 • a) i = a i
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i;
exact one_mul (a i)
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i;
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ ∀ (x y : R ⧸ I) (b : (ι → R) ⧸ pi I ι), (x * y) • b = x • y • b
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by
rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk R : Type u inst✝ : CommRing R I : Ideal R a✝ b✝¹ : R S ι : Type v x✝ : R ⧸ I a : R y✝ : R ⧸ I b : R b✝ : (ι → R) ⧸ pi I ι c : ι → R ⊢ (Quot.mk Setoid.r a * Quot.mk Setoid.r b) • Quot.mk Setoid.r c = Quot.mk Setoid.r a • Quot.mk Setoid.r b • Quot.mk Setoid.r c
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk.convert_3 R : Type u inst✝ : CommRing R I : Ideal R a✝ b✝¹ : R S ι : Type v x✝ : R ⧸ I a : R y✝ : R ⧸ I b : R b✝ : (ι → R) ⧸ pi I ι c : ι → R ⊢ (Quotient.mk (pi I ι)) ((fun x x_1 => x * x_1) a b • c) = (Quotient.mk (pi I ι)) (a • b • c)
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
congr 1
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk.convert_3.h.e_6.h R : Type u inst✝ : CommRing R I : Ideal R a✝ b✝¹ : R S ι : Type v x✝ : R ⧸ I a : R y✝ : R ⧸ I b : R b✝ : (ι → R) ⧸ pi I ι c : ι → R ⊢ (fun x x_1 => x * x_1) a b • c = a • b • c
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1;
funext i
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1;
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk.convert_3.h.e_6.h.h R : Type u inst✝ : CommRing R I : Ideal R a✝ b✝¹ : R S ι : Type v x✝ : R ⧸ I a : R y✝ : R ⧸ I b : R b✝ : (ι → R) ⧸ pi I ι c : ι → R i : ι ⊢ ((fun x x_1 => x * x_1) a b • c) i = (a • b • c) i
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i;
exact mul_assoc a b (c i)
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i;
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ ∀ (a : R ⧸ I), a • 0 = 0
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by
rintro ⟨a⟩
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk R : Type u inst✝ : CommRing R I : Ideal R a✝¹ b : R S ι : Type v a✝ : R ⧸ I a : R ⊢ Quot.mk Setoid.r a • 0 = 0
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩
convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.convert_3 R : Type u inst✝ : CommRing R I : Ideal R a✝¹ b : R S ι : Type v a✝ : R ⧸ I a : R ⊢ (Quotient.mk (pi I ι)) (a • 0) = (Quotient.mk (pi I ι)) 0
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
congr with _
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.convert_3.h.e_6.h.h R : Type u inst✝ : CommRing R I : Ideal R a✝¹ b : R S ι : Type v a✝ : R ⧸ I a : R x✝ : ι ⊢ (a • 0) x✝ = OfNat.ofNat 0 x✝
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _;
exact mul_zero a
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _;
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ ∀ (a : R ⧸ I) (x y : (ι → R) ⧸ pi I ι), a • (x + y) = a • x + a • y
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by
rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk R : Type u inst✝ : CommRing R I : Ideal R a✝¹ b✝ : R S ι : Type v a✝ : R ⧸ I a : R x✝ : (ι → R) ⧸ pi I ι b : ι → R y✝ : (ι → R) ⧸ pi I ι c : ι → R ⊢ Quot.mk Setoid.r a • (Quot.mk Setoid.r b + Quot.mk Setoid.r c) = Quot.mk Setoid.r a • Quot.mk Setoid.r b + Quot.mk Setoid.r a • Quot.mk Setoid.r c
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk.convert_3 R : Type u inst✝ : CommRing R I : Ideal R a✝¹ b✝ : R S ι : Type v a✝ : R ⧸ I a : R x✝ : (ι → R) ⧸ pi I ι b : ι → R y✝ : (ι → R) ⧸ pi I ι c : ι → R ⊢ (Quotient.mk (pi I ι)) (a • (fun x x_1 => x + x_1) b c) = (Quotient.mk (pi I ι)) ((fun x x_1 => x + x_1) (a • b) (a • c))
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
congr with i
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk.convert_3.h.e_6.h.h R : Type u inst✝ : CommRing R I : Ideal R a✝¹ b✝ : R S ι : Type v a✝ : R ⧸ I a : R x✝ : (ι → R) ⧸ pi I ι b : ι → R y✝ : (ι → R) ⧸ pi I ι c : ι → R i : ι ⊢ (a • (fun x x_1 => x + x_1) b c) i = (fun x x_1 => x + x_1) (a • b) (a • c) i
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i;
exact mul_add a (b i) (c i)
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i;
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ ∀ (r s : R ⧸ I) (x : (ι → R) ⧸ pi I ι), (r + s) • x = r • x + s • x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by
rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk R : Type u inst✝ : CommRing R I : Ideal R a✝ b✝ : R S ι : Type v r✝ : R ⧸ I a : R s✝ : R ⧸ I b : R x✝ : (ι → R) ⧸ pi I ι c : ι → R ⊢ (Quot.mk Setoid.r a + Quot.mk Setoid.r b) • Quot.mk Setoid.r c = Quot.mk Setoid.r a • Quot.mk Setoid.r c + Quot.mk Setoid.r b • Quot.mk Setoid.r c
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk.convert_3 R : Type u inst✝ : CommRing R I : Ideal R a✝ b✝ : R S ι : Type v r✝ : R ⧸ I a : R s✝ : R ⧸ I b : R x✝ : (ι → R) ⧸ pi I ι c : ι → R ⊢ (Quotient.mk (pi I ι)) ((fun x x_1 => x + x_1) a b • c) = (Quotient.mk (pi I ι)) ((fun x x_1 => x + x_1) (a • c) (b • c))
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
congr with i
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.mk.mk.convert_3.h.e_6.h.h R : Type u inst✝ : CommRing R I : Ideal R a✝ b✝ : R S ι : Type v r✝ : R ⧸ I a : R s✝ : R ⧸ I b : R x✝ : (ι → R) ⧸ pi I ι c : ι → R i : ι ⊢ ((fun x x_1 => x + x_1) a b • c) i = (fun x x_1 => x + x_1) (a • c) (b • c) i
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i;
exact add_mul a b (c i)
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i;
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ ∀ (x : (ι → R) ⧸ pi I ι), 0 • x = 0
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by
rintro ⟨a⟩
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk R : Type u inst✝ : CommRing R I : Ideal R a✝ b : R S ι : Type v x✝ : (ι → R) ⧸ pi I ι a : ι → R ⊢ 0 • Quot.mk Setoid.r a = 0
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩
convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.convert_3 R : Type u inst✝ : CommRing R I : Ideal R a✝ b : R S ι : Type v x✝ : (ι → R) ⧸ pi I ι a : ι → R ⊢ (Quotient.mk (pi I ι)) (0 • a) = (Quotient.mk (pi I ι)) 0
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
congr with i
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
case mk.convert_3.h.e_6.h.h R : Type u inst✝ : CommRing R I : Ideal R a✝ b : R S ι : Type v x✝ : (ι → R) ⧸ pi I ι a : ι → R i : ι ⊢ (0 • a) i = OfNat.ofNat 0 i
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i;
exact zero_mul (a i)
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i;
Mathlib.RingTheory.Ideal.Quotient.324_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact zero_mul (a i) #align ideal.module_pi Ideal.modulePi /-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by
rintro ⟨_⟩ ⟨_⟩
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by
Mathlib.RingTheory.Ideal.Quotient.359_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun
Mathlib_RingTheory_Ideal_Quotient
case mk.mk R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v x✝ : (ι → R) ⧸ pi I ι a✝¹ : ι → R y✝ : (ι → R) ⧸ pi I ι a✝ : ι → R ⊢ (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (Quot.mk Setoid.r a✝¹ + Quot.mk Setoid.r a✝) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (Quot.mk Setoid.r a✝¹) + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (Quot.mk Setoid.r a✝)
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact zero_mul (a i) #align ideal.module_pi Ideal.modulePi /-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩;
rfl
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩;
Mathlib.RingTheory.Ideal.Quotient.359_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ ∀ (r : R ⧸ I) (x : (ι → R) ⧸ pi I ι), AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } (r • x) = (RingHom.id (R ⧸ I)) r • AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact zero_mul (a i) #align ideal.module_pi Ideal.modulePi /-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by
rintro ⟨_⟩ ⟨_⟩
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by
Mathlib.RingTheory.Ideal.Quotient.359_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun
Mathlib_RingTheory_Ideal_Quotient
case mk.mk R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v r✝ : R ⧸ I a✝¹ : R x✝ : (ι → R) ⧸ pi I ι a✝ : ι → R ⊢ AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } (Quot.mk Setoid.r a✝¹ • Quot.mk Setoid.r a✝) = (RingHom.id (R ⧸ I)) (Quot.mk Setoid.r a✝¹) • AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } (Quot.mk Setoid.r a✝)
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact zero_mul (a i) #align ideal.module_pi Ideal.modulePi /-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩;
rfl
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩;
Mathlib.RingTheory.Ideal.Quotient.359_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ Function.LeftInverse (fun x => (Quotient.mk (pi I ι)) fun i => Quotient.out' (x i)) { toAddHom := { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) }, map_smul' := (_ : ∀ (r : R ⧸ I) (x : (ι → R) ⧸ pi I ι), AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } (r • x) = (RingHom.id (R ⧸ I)) r • AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } x) }.toAddHom.toFun
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact zero_mul (a i) #align ideal.module_pi Ideal.modulePi /-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩; rfl invFun := fun x ↦ Ideal.Quotient.mk (I.pi ι) fun i ↦ Quotient.out' (x i) left_inv := by
rintro ⟨x⟩
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩; rfl invFun := fun x ↦ Ideal.Quotient.mk (I.pi ι) fun i ↦ Quotient.out' (x i) left_inv := by
Mathlib.RingTheory.Ideal.Quotient.359_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun
Mathlib_RingTheory_Ideal_Quotient
case mk R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v x✝ : (ι → R) ⧸ pi I ι x : ι → R ⊢ (fun x => (Quotient.mk (pi I ι)) fun i => Quotient.out' (x i)) (AddHom.toFun { toAddHom := { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) }, map_smul' := (_ : ∀ (r : R ⧸ I) (x : (ι → R) ⧸ pi I ι), AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } (r • x) = (RingHom.id (R ⧸ I)) r • AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } x) }.toAddHom (Quot.mk Setoid.r x)) = Quot.mk Setoid.r x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact zero_mul (a i) #align ideal.module_pi Ideal.modulePi /-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩; rfl invFun := fun x ↦ Ideal.Quotient.mk (I.pi ι) fun i ↦ Quotient.out' (x i) left_inv := by rintro ⟨x⟩
exact Ideal.Quotient.eq.2 fun i => Ideal.Quotient.eq.1 (Quotient.out_eq' _)
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩; rfl invFun := fun x ↦ Ideal.Quotient.mk (I.pi ι) fun i ↦ Quotient.out' (x i) left_inv := by rintro ⟨x⟩
Mathlib.RingTheory.Ideal.Quotient.359_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v ⊢ Function.RightInverse (fun x => (Quotient.mk (pi I ι)) fun i => Quotient.out' (x i)) { toAddHom := { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) }, map_smul' := (_ : ∀ (r : R ⧸ I) (x : (ι → R) ⧸ pi I ι), AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } (r • x) = (RingHom.id (R ⧸ I)) r • AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } x) }.toAddHom.toFun
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact zero_mul (a i) #align ideal.module_pi Ideal.modulePi /-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩; rfl invFun := fun x ↦ Ideal.Quotient.mk (I.pi ι) fun i ↦ Quotient.out' (x i) left_inv := by rintro ⟨x⟩ exact Ideal.Quotient.eq.2 fun i => Ideal.Quotient.eq.1 (Quotient.out_eq' _) right_inv := by
intro x
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩; rfl invFun := fun x ↦ Ideal.Quotient.mk (I.pi ι) fun i ↦ Quotient.out' (x i) left_inv := by rintro ⟨x⟩ exact Ideal.Quotient.eq.2 fun i => Ideal.Quotient.eq.1 (Quotient.out_eq' _) right_inv := by
Mathlib.RingTheory.Ideal.Quotient.359_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun
Mathlib_RingTheory_Ideal_Quotient
R : Type u inst✝ : CommRing R I : Ideal R a b : R S ι : Type v x : ι → R ⧸ I ⊢ AddHom.toFun { toAddHom := { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) }, map_smul' := (_ : ∀ (r : R ⧸ I) (x : (ι → R) ⧸ pi I ι), AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } (r • x) = (RingHom.id (R ⧸ I)) r • AddHom.toFun { toFun := fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b), map_add' := (_ : ∀ (x y : (ι → R) ⧸ pi I ι), (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) (x + y) = (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) x + (fun x => Quotient.liftOn' x (fun f i => (Quotient.mk I) (f i)) (_ : ∀ (a b : ι → R), Setoid.r a b → (fun f i => (Quotient.mk I) (f i)) a = (fun f i => (Quotient.mk I) (f i)) b)) y) } x) }.toAddHom ((fun x => (Quotient.mk (pi I ι)) fun i => Quotient.out' (x i)) x) = x
/- Copyright (c) 2018 Kenny Lau. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kenny Lau, Chris Hughes, Mario Carneiro, Anne Baanen -/ import Mathlib.Algebra.Ring.Fin import Mathlib.Algebra.Ring.Prod import Mathlib.LinearAlgebra.Quotient import Mathlib.RingTheory.Congruence import Mathlib.RingTheory.Ideal.Basic import Mathlib.Tactic.FinCases #align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69" /-! # Ideal quotients This file defines ideal quotients as a special case of submodule quotients and proves some basic results about these quotients. See `Algebra.RingQuot` for quotients of non-commutative rings. ## Main definitions - `Ideal.Quotient`: the quotient of a commutative ring `R` by an ideal `I : Ideal R` -/ universe u v w namespace Ideal open Set open BigOperators variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R} variable {S : Type v} -- Note that at present `Ideal` means a left-ideal, -- so this quotient is only useful in a commutative ring. -- We should develop quotients by two-sided ideals as well. /-- The quotient `R/I` of a ring `R` by an ideal `I`. The ideal quotient of `I` is defined to equal the quotient of `I` as an `R`-submodule of `R`. This definition is marked `reducible` so that typeclass instances can be shared between `Ideal.Quotient I` and `Submodule.Quotient I`. -/ @[reducible] instance : HasQuotient R (Ideal R) := Submodule.hasQuotient namespace Quotient variable {I} {x y : R} instance one (I : Ideal R) : One (R ⧸ I) := ⟨Submodule.Quotient.mk 1⟩ #align ideal.quotient.has_one Ideal.Quotient.one /-- On `Ideal`s, `Submodule.quotientRel` is a ring congruence. -/ protected def ringCon (I : Ideal R) : RingCon R := { QuotientAddGroup.con I.toAddSubgroup with mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢ have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂) have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁] rwa [← this] at F } #align ideal.quotient.ring_con Ideal.Quotient.ringCon instance commRing (I : Ideal R) : CommRing (R ⧸ I) := inferInstanceAs (CommRing (Quotient.ringCon I).Quotient) #align ideal.quotient.comm_ring Ideal.Quotient.commRing -- Sanity test to make sure no diamonds have emerged in `commRing` example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl -- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] : IsScalarTower α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).isScalarTower_right #align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] : SMulCommClass α (R ⧸ I) (R ⧸ I) := (Quotient.ringCon I).smulCommClass #align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] : SMulCommClass (R ⧸ I) α (R ⧸ I) := (Quotient.ringCon I).smulCommClass' #align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass' /-- The ring homomorphism from a ring `R` to a quotient ring `R/I`. -/ def mk (I : Ideal R) : R →+* R ⧸ I where toFun a := Submodule.Quotient.mk a map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add' _ _ := rfl #align ideal.quotient.mk Ideal.Quotient.mk instance {I : Ideal R} : Coe R (R ⧸ I) := ⟨Ideal.Quotient.mk I⟩ /-- Two `RingHom`s from the quotient by an ideal are equal if their compositions with `Ideal.Quotient.mk'` are equal. See note [partially-applied ext lemmas]. -/ @[ext 1100] theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) : f = g := RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _) #align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext instance inhabited : Inhabited (R ⧸ I) := ⟨mk I 37⟩ #align ideal.quotient.inhabited Ideal.Quotient.inhabited protected theorem eq : mk I x = mk I y ↔ x - y ∈ I := Submodule.Quotient.eq I #align ideal.quotient.eq Ideal.Quotient.eq @[simp] theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl #align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I := Submodule.Quotient.mk_eq_zero _ #align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton] -- Porting note: new theorem theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by rw [← eq_zero_iff_mem, map_sub, sub_eq_zero] theorem zero_eq_one_iff {I : Ideal R} : (0 : R ⧸ I) = 1 ↔ I = ⊤ := eq_comm.trans <| eq_zero_iff_mem.trans (eq_top_iff_one _).symm #align ideal.quotient.zero_eq_one_iff Ideal.Quotient.zero_eq_one_iff theorem zero_ne_one_iff {I : Ideal R} : (0 : R ⧸ I) ≠ 1 ↔ I ≠ ⊤ := not_congr zero_eq_one_iff #align ideal.quotient.zero_ne_one_iff Ideal.Quotient.zero_ne_one_iff protected theorem nontrivial {I : Ideal R} (hI : I ≠ ⊤) : Nontrivial (R ⧸ I) := ⟨⟨0, 1, zero_ne_one_iff.2 hI⟩⟩ #align ideal.quotient.nontrivial Ideal.Quotient.nontrivial theorem subsingleton_iff {I : Ideal R} : Subsingleton (R ⧸ I) ↔ I = ⊤ := by rw [eq_top_iff_one, ← subsingleton_iff_zero_eq_one, eq_comm, ← (mk I).map_one, Quotient.eq_zero_iff_mem] #align ideal.quotient.subsingleton_iff Ideal.Quotient.subsingleton_iff instance : Unique (R ⧸ (⊤ : Ideal R)) := ⟨⟨0⟩, by rintro ⟨x⟩; exact Quotient.eq_zero_iff_mem.mpr Submodule.mem_top⟩ theorem mk_surjective : Function.Surjective (mk I) := fun y => Quotient.inductionOn' y fun x => Exists.intro x rfl #align ideal.quotient.mk_surjective Ideal.Quotient.mk_surjective instance : RingHomSurjective (mk I) := ⟨mk_surjective⟩ /-- If `I` is an ideal of a commutative ring `R`, if `q : R → R/I` is the quotient map, and if `s ⊆ R` is a subset, then `q⁻¹(q(s)) = ⋃ᵢ(i + s)`, the union running over all `i ∈ I`. -/ theorem quotient_ring_saturate (I : Ideal R) (s : Set R) : mk I ⁻¹' (mk I '' s) = ⋃ x : I, (fun y => x.1 + y) '' s := by ext x simp only [mem_preimage, mem_image, mem_iUnion, Ideal.Quotient.eq] exact ⟨fun ⟨a, a_in, h⟩ => ⟨⟨_, I.neg_mem h⟩, a, a_in, by simp⟩, fun ⟨⟨i, hi⟩, a, ha, Eq⟩ => ⟨a, ha, by rw [← Eq, sub_add_eq_sub_sub_swap, sub_self, zero_sub]; exact I.neg_mem hi⟩⟩ #align ideal.quotient.quotient_ring_saturate Ideal.Quotient.quotient_ring_saturate instance noZeroDivisors (I : Ideal R) [hI : I.IsPrime] : NoZeroDivisors (R ⧸ I) where eq_zero_or_eq_zero_of_mul_eq_zero {a b} := Quotient.inductionOn₂' a b fun {_ _} hab => (hI.mem_or_mem (eq_zero_iff_mem.1 hab)).elim (Or.inl ∘ eq_zero_iff_mem.2) (Or.inr ∘ eq_zero_iff_mem.2) #align ideal.quotient.no_zero_divisors Ideal.Quotient.noZeroDivisors instance isDomain (I : Ideal R) [hI : I.IsPrime] : IsDomain (R ⧸ I) := let _ := Quotient.nontrivial hI.1 NoZeroDivisors.to_isDomain _ #align ideal.quotient.is_domain Ideal.Quotient.isDomain theorem isDomain_iff_prime (I : Ideal R) : IsDomain (R ⧸ I) ↔ I.IsPrime := by refine' ⟨fun H => ⟨zero_ne_one_iff.1 _, fun {x y} h => _⟩, fun h => inferInstance⟩ · haveI : Nontrivial (R ⧸ I) := ⟨H.2.1⟩ exact zero_ne_one · simp only [← eq_zero_iff_mem, (mk I).map_mul] at h ⊢ haveI := @IsDomain.to_noZeroDivisors (R ⧸ I) _ H exact eq_zero_or_eq_zero_of_mul_eq_zero h #align ideal.quotient.is_domain_iff_prime Ideal.Quotient.isDomain_iff_prime theorem exists_inv {I : Ideal R} [hI : I.IsMaximal] : ∀ {a : R ⧸ I}, a ≠ 0 → ∃ b : R ⧸ I, a * b = 1 := by rintro ⟨a⟩ h rcases hI.exists_inv (mt eq_zero_iff_mem.2 h) with ⟨b, c, hc, abc⟩ rw [mul_comm] at abc refine' ⟨mk _ b, Quot.sound _⟩ simp only [Submodule.quotientRel_r_def] rw [← eq_sub_iff_add_eq'] at abc rwa [abc, ← neg_mem_iff (G := R) (H := I), neg_sub] at hc #align ideal.quotient.exists_inv Ideal.Quotient.exists_inv open Classical /-- The quotient by a maximal ideal is a group with zero. This is a `def` rather than `instance`, since users will have computable inverses in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def groupWithZero (I : Ideal R) [hI : I.IsMaximal] : GroupWithZero (R ⧸ I) := { inv := fun a => if ha : a = 0 then 0 else Classical.choose (exists_inv ha) mul_inv_cancel := fun a (ha : a ≠ 0) => show a * dite _ _ _ = _ by rw [dif_neg ha]; exact Classical.choose_spec (exists_inv ha) inv_zero := dif_pos rfl } #align ideal.quotient.group_with_zero Ideal.Quotient.groupWithZero /-- The quotient by a maximal ideal is a field. This is a `def` rather than `instance`, since users will have computable inverses (and `qsmul`, `rat_cast`) in some applications. See note [reducible non-instances]. -/ @[reducible] protected noncomputable def field (I : Ideal R) [hI : I.IsMaximal] : Field (R ⧸ I) := { Quotient.commRing I, Quotient.groupWithZero I with } #align ideal.quotient.field Ideal.Quotient.field /-- If the quotient by an ideal is a field, then the ideal is maximal. -/ theorem maximal_of_isField (I : Ideal R) (hqf : IsField (R ⧸ I)) : I.IsMaximal := by apply Ideal.isMaximal_iff.2 constructor · intro h rcases hqf.exists_pair_ne with ⟨⟨x⟩, ⟨y⟩, hxy⟩ exact hxy (Ideal.Quotient.eq.2 (mul_one (x - y) ▸ I.mul_mem_left _ h)) · intro J x hIJ hxnI hxJ rcases hqf.mul_inv_cancel (mt Ideal.Quotient.eq_zero_iff_mem.1 hxnI) with ⟨⟨y⟩, hy⟩ rw [← zero_add (1 : R), ← sub_self (x * y), sub_add] refine' J.sub_mem (J.mul_mem_right _ hxJ) (hIJ (Ideal.Quotient.eq.1 hy)) #align ideal.quotient.maximal_of_is_field Ideal.Quotient.maximal_of_isField /-- The quotient of a ring by an ideal is a field iff the ideal is maximal. -/ theorem maximal_ideal_iff_isField_quotient (I : Ideal R) : I.IsMaximal ↔ IsField (R ⧸ I) := ⟨fun h => let _i := @Quotient.field _ _ I h Field.toIsField _, maximal_of_isField _⟩ #align ideal.quotient.maximal_ideal_iff_is_field_quotient Ideal.Quotient.maximal_ideal_iff_isField_quotient variable [CommRing S] /-- Given a ring homomorphism `f : R →+* S` sending all elements of an ideal to zero, lift it to the quotient by this ideal. -/ def lift (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : R ⧸ I →+* S := { QuotientAddGroup.lift I.toAddSubgroup f.toAddMonoidHom H with map_one' := f.map_one map_mul' := fun a₁ a₂ => Quotient.inductionOn₂' a₁ a₂ f.map_mul } #align ideal.quotient.lift Ideal.Quotient.lift @[simp] theorem lift_mk (I : Ideal R) (f : R →+* S) (H : ∀ a : R, a ∈ I → f a = 0) : lift I f H (mk I a) = f a := rfl #align ideal.quotient.lift_mk Ideal.Quotient.lift_mk theorem lift_surjective_of_surjective (I : Ideal R) {f : R →+* S} (H : ∀ a : R, a ∈ I → f a = 0) (hf : Function.Surjective f) : Function.Surjective (Ideal.Quotient.lift I f H) := by intro y obtain ⟨x, rfl⟩ := hf y use Ideal.Quotient.mk I x simp only [Ideal.Quotient.lift_mk] #align ideal.quotient.lift_surjective_of_surjective Ideal.Quotient.lift_surjective_of_surjective /-- The ring homomorphism from the quotient by a smaller ideal to the quotient by a larger ideal. This is the `Ideal.Quotient` version of `Quot.Factor` -/ def factor (S T : Ideal R) (H : S ≤ T) : R ⧸ S →+* R ⧸ T := Ideal.Quotient.lift S (mk T) fun _ hx => eq_zero_iff_mem.2 (H hx) #align ideal.quotient.factor Ideal.Quotient.factor @[simp] theorem factor_mk (S T : Ideal R) (H : S ≤ T) (x : R) : factor S T H (mk S x) = mk T x := rfl #align ideal.quotient.factor_mk Ideal.Quotient.factor_mk @[simp] theorem factor_comp_mk (S T : Ideal R) (H : S ≤ T) : (factor S T H).comp (mk S) = mk T := by ext x rw [RingHom.comp_apply, factor_mk] #align ideal.quotient.factor_comp_mk Ideal.Quotient.factor_comp_mk end Quotient /-- Quotienting by equal ideals gives equivalent rings. See also `Submodule.quotEquivOfEq` and `Ideal.quotientEquivAlgOfEq`. -/ def quotEquivOfEq {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : R ⧸ I ≃+* R ⧸ J := { Submodule.quotEquivOfEq I J h with map_mul' := by rintro ⟨x⟩ ⟨y⟩ rfl } #align ideal.quot_equiv_of_eq Ideal.quotEquivOfEq @[simp] theorem quotEquivOfEq_mk {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) (x : R) : quotEquivOfEq h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x := rfl #align ideal.quot_equiv_of_eq_mk Ideal.quotEquivOfEq_mk @[simp] theorem quotEquivOfEq_symm {R : Type*} [CommRing R] {I J : Ideal R} (h : I = J) : (Ideal.quotEquivOfEq h).symm = Ideal.quotEquivOfEq h.symm := by ext; rfl #align ideal.quot_equiv_of_eq_symm Ideal.quotEquivOfEq_symm section Pi variable (ι : Type v) /-- `R^n/I^n` is a `R/I`-module. -/ instance modulePi : Module (R ⧸ I) ((ι → R) ⧸ I.pi ι) where smul c m := Quotient.liftOn₂' c m (fun r m => Submodule.Quotient.mk <| r • m) $ by intro c₁ m₁ c₂ m₂ hc hm apply Ideal.Quotient.eq.2 rw [Submodule.quotientRel_r_def] at hc hm intro i exact I.mul_sub_mul_mem hc (hm i) one_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact one_mul (a i) mul_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr 1; funext i; exact mul_assoc a b (c i) smul_add := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact mul_add a (b i) (c i) smul_zero := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with _; exact mul_zero a add_smul := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact add_mul a b (c i) zero_smul := by rintro ⟨a⟩ convert_to Ideal.Quotient.mk (I.pi ι) _ = Ideal.Quotient.mk (I.pi ι) _ congr with i; exact zero_mul (a i) #align ideal.module_pi Ideal.modulePi /-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩; rfl invFun := fun x ↦ Ideal.Quotient.mk (I.pi ι) fun i ↦ Quotient.out' (x i) left_inv := by rintro ⟨x⟩ exact Ideal.Quotient.eq.2 fun i => Ideal.Quotient.eq.1 (Quotient.out_eq' _) right_inv := by intro x
ext i
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun := fun x ↦ Quotient.liftOn' x (fun f i => Ideal.Quotient.mk I (f i)) fun a b hab => funext fun i => (Submodule.Quotient.eq' _).2 (QuotientAddGroup.leftRel_apply.mp hab i) map_add' := by rintro ⟨_⟩ ⟨_⟩; rfl map_smul' := by rintro ⟨_⟩ ⟨_⟩; rfl invFun := fun x ↦ Ideal.Quotient.mk (I.pi ι) fun i ↦ Quotient.out' (x i) left_inv := by rintro ⟨x⟩ exact Ideal.Quotient.eq.2 fun i => Ideal.Quotient.eq.1 (Quotient.out_eq' _) right_inv := by intro x
Mathlib.RingTheory.Ideal.Quotient.359_0.TwNAv7Pc4PYOWjX
/-- `R^n/I^n` is isomorphic to `(R/I)^n` as an `R/I`-module. -/ noncomputable def piQuotEquiv : ((ι → R) ⧸ I.pi ι) ≃ₗ[R ⧸ I] ι → (R ⧸ I) where toFun
Mathlib_RingTheory_Ideal_Quotient