doc-next-gen

Mathlib.RingTheory.Ideal.Basic

Module docstring

{"# Ideals over a ring

This file contains an assortment of definitions and results for Ideal R, the type of (left) ideals over a ring R. Note that over commutative rings, left ideals and two-sided ideals are equivalent.

Implementation notes

Ideal R is implemented using Submodule R R, where is interpreted as *.

TODO

Support right ideals, and two-sided ideals over non-commutative rings. "}

Ideal.pi definition
: Ideal (Π i, α i)
Full source
/-- `Πᵢ Iᵢ` as an ideal of `Πᵢ Rᵢ`. -/
def pi : Ideal (Π i, α i) where
  carrier := { x | ∀ i, x i ∈ I i }
  zero_mem' i := (I i).zero_mem
  add_mem' ha hb i := (I i).add_mem (ha i) (hb i)
  smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)
Product of ideals in a product semiring
Informal description
Given a family of ideals $I_i$ in semirings $\alpha_i$ indexed by $i$, the product ideal $\prod_i I_i$ in the product semiring $\prod_i \alpha_i$ consists of all elements $x$ such that for each index $i$, the component $x_i$ belongs to the ideal $I_i$.
Ideal.mem_pi theorem
(x : Π i, α i) : x ∈ pi I ↔ ∀ i, x i ∈ I i
Full source
theorem mem_pi (x : Π i, α i) : x ∈ pi Ix ∈ pi I ↔ ∀ i, x i ∈ I i :=
  Iff.rfl
Membership Criterion for Product Ideal: $x \in \prod_i I_i \leftrightarrow \forall i, x_i \in I_i$
Informal description
Let $I_i$ be a family of ideals in semirings $\alpha_i$ indexed by $i$, and let $x$ be an element of the product semiring $\prod_i \alpha_i$. Then $x$ belongs to the product ideal $\prod_i I_i$ if and only if for each index $i$, the component $x_i$ belongs to the ideal $I_i$.
Ideal.instIsTwoSidedForallPi instance
[∀ i, (I i).IsTwoSided] : (pi I).IsTwoSided
Full source
instance (priority := low) [∀ i, (I i).IsTwoSided] : (pi I).IsTwoSided :=
  ⟨fun _b hb i ↦ mul_mem_right _ _ (hb i)⟩
Two-Sided Property of Product Ideals
Informal description
For a family of semirings $\alpha_i$ indexed by $i$, if each ideal $I_i$ in $\alpha_i$ is two-sided, then the product ideal $\prod_i I_i$ in the product semiring $\prod_i \alpha_i$ is also two-sided.
Ideal.add_pow_mem_of_pow_mem_of_le_of_commute theorem
{m n k : ℕ} (ha : a ^ m ∈ I) (hb : b ^ n ∈ I) (hk : m + n ≤ k + 1) (hab : Commute a b) : (a + b) ^ k ∈ I
Full source
theorem add_pow_mem_of_pow_mem_of_le_of_commute {m n k : }
    (ha : a ^ m ∈ I) (hb : b ^ n ∈ I) (hk : m + n ≤ k + 1)
    (hab : Commute a b) :
    (a + b) ^ k ∈ I := by
  simp_rw [hab.add_pow, ← Nat.cast_comm]
  apply I.sum_mem
  intro c _
  apply mul_mem_left
  by_cases h : m ≤ c
  · rw [hab.pow_pow]
    exact I.mul_mem_left _ (I.pow_mem_of_pow_mem ha h)
  · refine I.mul_mem_left _ (I.pow_mem_of_pow_mem hb ?_)
    omega
Ideal Membership of $(a + b)^k$ for Commuting Elements with Power Conditions
Informal description
Let $I$ be an ideal in a semiring $R$, and let $a, b \in R$ be commuting elements (i.e., $a \cdot b = b \cdot a$). For any natural numbers $m, n, k$ such that $m + n \leq k + 1$, if $a^m \in I$ and $b^n \in I$, then $(a + b)^k \in I$.
Ideal.add_pow_add_pred_mem_of_pow_mem_of_commute theorem
{m n : ℕ} (ha : a ^ m ∈ I) (hb : b ^ n ∈ I) (hab : Commute a b) : (a + b) ^ (m + n - 1) ∈ I
Full source
theorem add_pow_add_pred_mem_of_pow_mem_of_commute {m n : }
    (ha : a ^ m ∈ I) (hb : b ^ n ∈ I) (hab : Commute a b) :
    (a + b) ^ (m + n - 1) ∈ I :=
  I.add_pow_mem_of_pow_mem_of_le_of_commute ha hb (by rw [← Nat.sub_le_iff_le_add]) hab
Ideal Membership of $(a + b)^{m+n-1}$ for Commuting Elements with Power Conditions
Informal description
Let $I$ be an ideal in a semiring $R$, and let $a, b \in R$ be commuting elements (i.e., $a \cdot b = b \cdot a$). For any natural numbers $m, n$, if $a^m \in I$ and $b^n \in I$, then $(a + b)^{m + n - 1} \in I$.
Ideal.add_pow_mem_of_pow_mem_of_le theorem
{m n k : ℕ} (ha : a ^ m ∈ I) (hb : b ^ n ∈ I) (hk : m + n ≤ k + 1) : (a + b) ^ k ∈ I
Full source
theorem add_pow_mem_of_pow_mem_of_le {m n k : }
    (ha : a ^ m ∈ I) (hb : b ^ n ∈ I) (hk : m + n ≤ k + 1) :
    (a + b) ^ k ∈ I :=
  I.add_pow_mem_of_pow_mem_of_le_of_commute ha hb hk (Commute.all ..)
Ideal Membership of $(a + b)^k$ under Power Conditions
Informal description
Let $I$ be an ideal in a semiring $R$, and let $a, b \in R$. For any natural numbers $m, n, k$ such that $m + n \leq k + 1$, if $a^m \in I$ and $b^n \in I$, then $(a + b)^k \in I$.
Ideal.add_pow_add_pred_mem_of_pow_mem theorem
{m n : ℕ} (ha : a ^ m ∈ I) (hb : b ^ n ∈ I) : (a + b) ^ (m + n - 1) ∈ I
Full source
theorem add_pow_add_pred_mem_of_pow_mem {m n : }
    (ha : a ^ m ∈ I) (hb : b ^ n ∈ I) :
    (a + b) ^ (m + n - 1) ∈ I :=
  I.add_pow_add_pred_mem_of_pow_mem_of_commute ha hb (Commute.all ..)
Ideal membership of $(a + b)^{m+n-1}$ under power conditions
Informal description
Let $I$ be an ideal in a semiring $R$, and let $a, b \in R$. For any natural numbers $m, n$, if $a^m \in I$ and $b^n \in I$, then $(a + b)^{m + n - 1} \in I$.
Ideal.pow_multiset_sum_mem_span_pow theorem
[DecidableEq α] (s : Multiset α) (n : ℕ) : s.sum ^ (Multiset.card s * n + 1) ∈ span ((s.map fun (x : α) ↦ x ^ (n + 1)).toFinset : Set α)
Full source
theorem pow_multiset_sum_mem_span_pow [DecidableEq α] (s : Multiset α) (n : ) :
    s.sum ^ (Multiset.card s * n + 1) ∈
    span ((s.map fun (x : α) ↦ x ^ (n + 1)).toFinset : Set α) := by
  induction' s using Multiset.induction_on with a s hs
  · simp
  simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,
    Multiset.card_cons, add_pow]
  refine Submodule.sum_mem _ ?_
  intro c _hc
  rw [mem_span_insert]
  by_cases h : n + 1 ≤ c
  · refine ⟨a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *
      ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, ?_⟩
    rw [mul_comm _ (a ^ (n + 1))]
    simp_rw [← mul_assoc]
    rw [← pow_add, add_zero, add_tsub_cancel_of_le h]
  · use 0
    simp_rw [zero_mul, zero_add]
    refine ⟨_, ?_, rfl⟩
    replace h : c ≤ n := Nat.lt_succ_iff.mp (not_le.mp h)
    have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by
      rw [add_mul, one_mul, add_assoc, add_comm n 1, ← add_assoc, add_tsub_assoc_of_le h]
    rw [this, pow_add]
    simp_rw [mul_assoc, mul_comm (s.sum ^ (Multiset.card s * n + 1)), ← mul_assoc]
    exact mul_mem_left _ _ hs
Sum of Multiset Elements to Power in Ideal Generated by Element Powers: $\left(\sum x\right)^{|s|n + 1} \in \operatorname{span}\{x^{n+1}\}$
Informal description
Let $\alpha$ be a commutative semiring with decidable equality, and let $s$ be a multiset over $\alpha$. For any natural number $n$, the sum of the elements in $s$ raised to the power $|s| \cdot n + 1$ belongs to the ideal generated by the set of elements $x^{n+1}$ for $x \in s$. That is, \[ \left(\sum_{x \in s} x\right)^{|s| \cdot n + 1} \in \operatorname{span}\{x^{n+1} \mid x \in s\}. \]
Ideal.sum_pow_mem_span_pow theorem
{ι} (s : Finset ι) (f : ι → α) (n : ℕ) : (∑ i ∈ s, f i) ^ (s.card * n + 1) ∈ span ((fun i => f i ^ (n + 1)) '' s)
Full source
theorem sum_pow_mem_span_pow {ι} (s : Finset ι) (f : ι → α) (n : ) :
    (∑ i ∈ s, f i) ^ (s.card * n + 1) ∈ span ((fun i => f i ^ (n + 1)) '' s) := by
  classical
  simpa only [Multiset.card_map, Multiset.map_map, comp_apply, Multiset.toFinset_map,
    Finset.coe_image, Finset.val_toFinset] using pow_multiset_sum_mem_span_pow (s.1.map f) n
Sum-to-Power Membership in Ideal of Powers: $\left(\sum f(i)\right)^{|s|n+1} \in \operatorname{span}\{f(i)^{n+1}\}$
Informal description
Let $\alpha$ be a commutative semiring, $\iota$ a type, $s$ a finite set of indices in $\iota$, and $f : \iota \to \alpha$ a function. For any natural number $n$, the sum of the values of $f$ over $s$ raised to the power $|s| \cdot n + 1$ belongs to the ideal generated by the set of $(n+1)$-th powers of the values of $f$ over $s$. That is, \[ \left(\sum_{i \in s} f(i)\right)^{|s| \cdot n + 1} \in \operatorname{span}\{f(i)^{n+1} \mid i \in s\}. \]
Ideal.span_pow_eq_top theorem
(s : Set α) (hs : span s = ⊤) (n : ℕ) : span ((fun (x : α) => x ^ n) '' s) = ⊤
Full source
theorem span_pow_eq_top (s : Set α) (hs : span s = ) (n : ) :
    span ((fun (x : α) => x ^ n) '' s) =  := by
  rw [eq_top_iff_one]
  rcases n with - | n
  · obtain rfl | ⟨x, hx⟩ := eq_empty_or_nonempty s
    · rw [Set.image_empty, hs]
      trivial
    · exact subset_span ⟨_, hx, pow_zero _⟩
  rw [eq_top_iff_one, span, Finsupp.mem_span_iff_linearCombination] at hs
  rcases hs with ⟨f, hf⟩
  have hf : (f.support.sum fun a => f a * a) = 1 := hf -- Porting note: was `change ... at hf`
  have := sum_pow_mem_span_pow f.support (fun a => f a * a) n
  rw [hf, one_pow] at this
  refine span_le.mpr ?_ this
  rintro _ hx
  simp_rw [Set.mem_image] at hx
  rcases hx with ⟨x, _, rfl⟩
  have : span ({(x : α) ^ (n + 1)} : Set α) ≤ span ((fun x : α => x ^ (n + 1)) '' s) := by
    rw [span_le, Set.singleton_subset_iff]
    exact subset_span ⟨x, x.prop, rfl⟩
  refine this ?_
  rw [mul_pow, mem_span_singleton]
  exact ⟨f x ^ (n + 1), mul_comm _ _⟩
Ideal Generated by Powers of a Generating Set is the Entire Semiring
Informal description
Let $s$ be a subset of a commutative semiring $\alpha$ such that the ideal generated by $s$ is the entire semiring (i.e., $\operatorname{span}(s) = \top$). Then for any natural number $n$, the ideal generated by the set of $n$-th powers of elements in $s$ is also the entire semiring, i.e., \[ \operatorname{span}\{x^n \mid x \in s\} = \top. \]
Ideal.span_range_pow_eq_top theorem
(s : Set α) (hs : span s = ⊤) (n : s → ℕ) : span (Set.range fun x ↦ x.1 ^ n x) = ⊤
Full source
theorem span_range_pow_eq_top (s : Set α) (hs : span s = ) (n : s → ) :
    span (Set.range fun x ↦ x.1 ^ n x) =  := by
  have ⟨t, hts, mem⟩ := Submodule.mem_span_finite_of_mem_span ((eq_top_iff_one _).mp hs)
  refine top_unique ((span_pow_eq_top _ ((eq_top_iff_one _).mpr mem) <|
    t.attach.sup fun x ↦ n ⟨x, hts x.2⟩).ge.trans <| span_le.mpr ?_)
  rintro _ ⟨x, hxt, rfl⟩
  rw [← Nat.sub_add_cancel (Finset.le_sup <| t.mem_attach ⟨x, hxt⟩)]
  simp_rw [pow_add]
  exact mul_mem_left _ _ (subset_span ⟨_, rfl⟩)
Ideal Generated by Variable Powers of a Generating Set is the Entire Semiring
Informal description
Let $s$ be a subset of a commutative semiring $\alpha$ such that the ideal generated by $s$ is the entire semiring (i.e., $\operatorname{span}(s) = \top$). Then for any function $n : s \to \mathbb{N}$ assigning a natural number to each element of $s$, the ideal generated by the set $\{x^{n(x)} \mid x \in s\}$ is also the entire semiring, i.e., \[ \operatorname{span}\{x^{n(x)} \mid x \in s\} = \top. \]
Ideal.prod_mem theorem
{ι : Type*} {f : ι → α} {s : Finset ι} (I : Ideal α) {i : ι} (hi : i ∈ s) (hfi : f i ∈ I) : ∏ i ∈ s, f i ∈ I
Full source
theorem prod_mem {ι : Type*} {f : ι → α} {s : Finset ι}
    (I : Ideal α) {i : ι} (hi : i ∈ s) (hfi : f i ∈ I) :
    ∏ i ∈ s, f i∏ i ∈ s, f i ∈ I := by
  classical
  rw [Finset.prod_eq_prod_diff_singleton_mul hi]
  exact Ideal.mul_mem_left _ _ hfi
Product of Elements in Ideal Contains an Element from the Ideal
Informal description
Let $I$ be an ideal in a semiring $\alpha$, and let $f : \iota \to \alpha$ be a function indexed by a finite set $s \subseteq \iota$. If there exists an index $i \in s$ such that $f(i) \in I$, then the product $\prod_{i \in s} f(i)$ belongs to $I$.
Ideal.equivFinTwo definition
[DecidableEq (Ideal K)] : Ideal K ≃ Fin 2
Full source
/-- A bijection between (left) ideals of a division ring and `{0, 1}`, sending `⊥` to `0`
and `⊤` to `1`. -/
def equivFinTwo [DecidableEq (Ideal K)] : IdealIdeal K ≃ Fin 2 where
  toFun := fun I ↦ if I = ⊥ then 0 else 1
  invFun := ![⊥, ⊤]
  left_inv := fun I ↦ by rcases eq_bot_or_top I with rfl | rfl <;> simp
  right_inv := fun i ↦ by fin_cases i <;> simp
Bijection between ideals of a division ring and $\{0, 1\}$
Informal description
The function `Ideal.equivFinTwo` establishes a bijection between the ideals of a division ring $K$ and the two-element set $\{0, 1\}$. Specifically, it maps the zero ideal $\bot$ to $0$ and the entire ring $\top$ to $1$. The inverse function maps $0$ to $\bot$ and $1$ to $\top$.
Ideal.isSimpleOrder instance
: IsSimpleOrder (Ideal K)
Full source
/-- Ideals of a `DivisionSemiring` are a simple order. Thanks to the way abbreviations work,
this automatically gives an `IsSimpleModule K` instance. -/
instance isSimpleOrder : IsSimpleOrder (Ideal K) :=
  ⟨eq_bot_or_top⟩
Simple Order Structure on Ideals of a Division Semiring
Informal description
For any division semiring $K$, the lattice of ideals of $K$ is a simple order, consisting only of the zero ideal $\bot$ and the entire ring $\top$.
Ring.exists_not_isUnit_of_not_isField theorem
[Nontrivial R] (hf : ¬IsField R) : ∃ (x : R) (_hx : x ≠ (0 : R)), ¬IsUnit x
Full source
theorem exists_not_isUnit_of_not_isField [Nontrivial R] (hf : ¬IsField R) :
    ∃ (x : R) (_hx : x ≠ (0 : R)), ¬IsUnit x := by
  have : ¬_ := fun h => hf ⟨exists_pair_ne R, mul_comm, h⟩
  simp_rw [isUnit_iff_exists_inv]
  push_neg at this ⊢
  obtain ⟨x, hx, not_unit⟩ := this
  exact ⟨x, hx, not_unit⟩
Existence of Non-Unit Elements in Non-Field Rings
Informal description
For any nontrivial ring $R$ that is not a field, there exists a nonzero element $x \in R$ that is not a unit.
Ring.not_isField_iff_exists_ideal_bot_lt_and_lt_top theorem
[Nontrivial R] : ¬IsField R ↔ ∃ I : Ideal R, ⊥ < I ∧ I < ⊤
Full source
theorem not_isField_iff_exists_ideal_bot_lt_and_lt_top [Nontrivial R] :
    ¬IsField R¬IsField R ↔ ∃ I : Ideal R, ⊥ < I ∧ I < ⊤ := by
  constructor
  · intro h
    obtain ⟨x, nz, nu⟩ := exists_not_isUnit_of_not_isField h
    use Ideal.span {x}
    rw [bot_lt_iff_ne_bot, lt_top_iff_ne_top]
    exact ⟨mt Ideal.span_singleton_eq_bot.mp nz, mt Ideal.span_singleton_eq_top.mp nu⟩
  · rintro ⟨I, bot_lt, lt_top⟩ hf
    obtain ⟨x, mem, ne_zero⟩ := SetLike.exists_of_lt bot_lt
    rw [Submodule.mem_bot] at ne_zero
    obtain ⟨y, hy⟩ := hf.mul_inv_cancel ne_zero
    rw [lt_top_iff_ne_top, Ne, Ideal.eq_top_iff_one, ← hy] at lt_top
    exact lt_top (I.mul_mem_right _ mem)
Characterization of Non-Field Rings via Proper Nonzero Ideals: $\neg \text{IsField}(R) \leftrightarrow \exists I, \{0\} < I < R$
Informal description
For a nontrivial ring $R$, $R$ is not a field if and only if there exists a proper, nonzero ideal $I$ of $R$ (i.e., $\{0\} < I < R$).
Ring.not_isField_iff_exists_prime theorem
[Nontrivial R] : ¬IsField R ↔ ∃ p : Ideal R, p ≠ ⊥ ∧ p.IsPrime
Full source
theorem not_isField_iff_exists_prime [Nontrivial R] :
    ¬IsField R¬IsField R ↔ ∃ p : Ideal R, p ≠ ⊥ ∧ p.IsPrime :=
  not_isField_iff_exists_ideal_bot_lt_and_lt_top.trans
    ⟨fun ⟨I, bot_lt, lt_top⟩ =>
      let ⟨p, hp, le_p⟩ := I.exists_le_maximal (lt_top_iff_ne_top.mp lt_top)
      ⟨p, bot_lt_iff_ne_bot.mp (lt_of_lt_of_le bot_lt le_p), hp.isPrime⟩,
      fun ⟨p, ne_bot, Prime⟩ => ⟨p, bot_lt_iff_ne_bot.mpr ne_bot, lt_top_iff_ne_top.mpr Prime.1⟩⟩
Characterization of Non-Field Rings via Existence of Nonzero Prime Ideals: $\neg \text{IsField}(R) \leftrightarrow \exists p \neq \{0\}, p \text{ prime}$
Informal description
For a nontrivial ring $R$, $R$ is not a field if and only if there exists a prime ideal $p$ of $R$ such that $p$ is nonzero (i.e., $p \neq \{0\}$).
Ring.isField_iff_isSimpleOrder_ideal theorem
: IsField R ↔ IsSimpleOrder (Ideal R)
Full source
/-- Also see `Ideal.isSimpleOrder` for the forward direction as an instance when `R` is a
division (semi)ring.

This result actually holds for all division semirings, but we lack the predicate to state it. -/
theorem isField_iff_isSimpleOrder_ideal : IsFieldIsField R ↔ IsSimpleOrder (Ideal R) := by
  cases subsingleton_or_nontrivial R
  · exact
      ⟨fun h => (not_isField_of_subsingleton _ h).elim, fun h =>
        (false_of_nontrivial_of_subsingleton <| Ideal R).elim⟩
  rw [← not_iff_not, Ring.not_isField_iff_exists_ideal_bot_lt_and_lt_top, ← not_iff_not]
  push_neg
  simp_rw [lt_top_iff_ne_top, bot_lt_iff_ne_bot, ← or_iff_not_imp_left, not_ne_iff]
  exact ⟨fun h => ⟨h⟩, fun h => h.2⟩
Field Characterization via Simple Ideal Lattice: $R$ is a field $\leftrightarrow$ $\text{IsSimpleOrder}(\text{Ideal}(R))$
Informal description
A ring $R$ is a field if and only if the lattice of ideals of $R$ is simple (i.e., has exactly two distinct elements: the zero ideal $\{0\}$ and the entire ring $R$).
Ring.ne_bot_of_isMaximal_of_not_isField theorem
[Nontrivial R] {M : Ideal R} (max : M.IsMaximal) (not_field : ¬IsField R) : M ≠ ⊥
Full source
/-- When a ring is not a field, the maximal ideals are nontrivial. -/
theorem ne_bot_of_isMaximal_of_not_isField [Nontrivial R] {M : Ideal R} (max : M.IsMaximal)
    (not_field : ¬IsField R) : M ≠ ⊥ := by
  rintro h
  rw [h] at max
  rcases max with ⟨⟨_h1, h2⟩⟩
  obtain ⟨I, hIbot, hItop⟩ := not_isField_iff_exists_ideal_bot_lt_and_lt_top.mp not_field
  exact ne_of_lt hItop (h2 I hIbot)
Maximal ideals are nonzero in non-field rings
Informal description
For a nontrivial ring $R$, if $M$ is a maximal ideal of $R$ and $R$ is not a field, then $M$ is not the zero ideal (i.e., $M \neq \{0\}$).
Ideal.bot_lt_of_maximal theorem
(M : Ideal R) [hm : M.IsMaximal] (non_field : ¬IsField R) : ⊥ < M
Full source
theorem bot_lt_of_maximal (M : Ideal R) [hm : M.IsMaximal] (non_field : ¬IsField R) :  < M := by
  rcases Ring.not_isField_iff_exists_ideal_bot_lt_and_lt_top.1 non_field with ⟨I, Ibot, Itop⟩
  constructor; · simp
  intro mle
  apply lt_irrefl ( : Ideal R)
  have : M =  := eq_bot_iff.mpr mle
  rw [← this] at Ibot
  rwa [hm.1.2 I Ibot] at Itop
Nonzero Maximal Ideal in Non-Field Rings: $\{0\} < M$
Informal description
For a nontrivial ring $R$, if $M$ is a maximal ideal of $R$ and $R$ is not a field, then the zero ideal $\{0\}$ is strictly contained in $M$ (i.e., $\{0\} < M$).