doc-next-gen

Mathlib.RingTheory.Ideal.Operations

Module docstring

{"# More operations on modules and ideals "}

Submodule.coe_span_smul theorem
{R' M' : Type*} [CommSemiring R'] [AddCommMonoid M'] [Module R' M'] (s : Set R') (N : Submodule R' M') : (Ideal.span s : Set R') • N = s • N
Full source
lemma coe_span_smul {R' M' : Type*} [CommSemiring R'] [AddCommMonoid M'] [Module R' M']
    (s : Set R') (N : Submodule R' M') :
    (Ideal.span s : Set R') • N = s • N :=
  set_smul_eq_of_le _ _ _
    (by rintro r n hr hn
        induction hr using Submodule.span_induction with
        | mem _ h => exact mem_set_smul_of_mem_mem h hn
        | zero => rw [zero_smul]; exact Submodule.zero_mem _
        | add _ _ _ _ ihr ihs => rw [add_smul]; exact Submodule.add_mem _ ihr ihs
        | smul _ _ hr =>
          rw [mem_span_set] at hr
          obtain ⟨c, hc, rfl⟩ := hr
          rw [Finsupp.sum, Finset.smul_sum, Finset.sum_smul]
          refine Submodule.sum_mem _ fun i hi => ?_
          rw [← mul_smul, smul_eq_mul, mul_comm, mul_smul]
          exact mem_set_smul_of_mem_mem (hc hi) <| Submodule.smul_mem _ _ hn) <|
    set_smul_mono_left _ Submodule.subset_span
Equality of Ideal-Submodule Product and Set-Submodule Product
Informal description
Let $R'$ be a commutative semiring, $M'$ an additive commutative monoid equipped with an $R'$-module structure, $s$ a subset of $R'$, and $N$ a submodule of $M'$. Then the product of the ideal generated by $s$ (viewed as a subset of $R'$) with $N$ is equal to the product of $s$ with $N$, i.e., $(\operatorname{span}_R s) \cdot N = s \cdot N$.
Submodule.span_singleton_toAddSubgroup_eq_zmultiples theorem
(a : ℤ) : (span ℤ { a }).toAddSubgroup = AddSubgroup.zmultiples a
Full source
lemma span_singleton_toAddSubgroup_eq_zmultiples (a : ) :
    (span  {a}).toAddSubgroup = AddSubgroup.zmultiples a := by
  ext i
  simp [Ideal.mem_span_singleton', AddSubgroup.mem_zmultiples_iff]
Span of Singleton in $\mathbb{Z}$-Module Corresponds to Integer Multiples
Informal description
For any integer $a$, the additive subgroup generated by the $\mathbb{Z}$-submodule spanned by the singleton set $\{a\}$ is equal to the subgroup of integer multiples of $a$, i.e., $\text{span}_{\mathbb{Z}}\{a\}.toAddSubgroup = \mathbb{Z}a$.
Ideal.span_singleton_toAddSubgroup_eq_zmultiples theorem
(a : ℤ) : (Ideal.span { a }).toAddSubgroup = AddSubgroup.zmultiples a
Full source
@[simp] lemma _root_.Ideal.span_singleton_toAddSubgroup_eq_zmultiples (a : ) :
   (Ideal.span {a}).toAddSubgroup = AddSubgroup.zmultiples a :=
  Submodule.span_singleton_toAddSubgroup_eq_zmultiples _
Additive Subgroup of Ideal Span Equals Integer Multiples
Informal description
For any integer $a$, the additive subgroup generated by the ideal spanned by the singleton set $\{a\}$ is equal to the subgroup of integer multiples of $a$, i.e., $(\text{span}_{\mathbb{Z}}\{a\}).\text{toAddSubgroup} = \mathbb{Z}a$.
Ideal.smul_eq_mul theorem
(I J : Ideal R) : I • J = I * J
Full source
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I • J = I * J :=
  rfl
Scalar Multiplication of Ideals Equals Product Ideal
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the scalar multiplication $I \bullet J$ is equal to the product ideal $I \cdot J$.
Submodule.smul_le_right theorem
: I • N ≤ N
Full source
theorem smul_le_right : I • N ≤ N :=
  smul_le.2 fun r _ _ ↦ N.smul_mem r
Inclusion of Scalar Multiplication in Submodule: $I \bullet N \leq N$
Informal description
For any ideal $I$ in a semiring $R$ and any submodule $N$ of an $R$-module, the scalar multiplication $I \bullet N$ is contained in $N$, i.e., $I \bullet N \leq N$.
Submodule.map_le_smul_top theorem
(I : Ideal R) (f : R →ₗ[R] M) : Submodule.map f I ≤ I • (⊤ : Submodule R M)
Full source
theorem map_le_smul_top (I : Ideal R) (f : R →ₗ[R] M) :
    Submodule.map f I ≤ I • ( : Submodule R M) := by
  rintro _ ⟨y, hy, rfl⟩
  rw [← mul_one y, ← smul_eq_mul, f.map_smul]
  exact smul_mem_smul hy mem_top
Image of Ideal under Linear Map is Contained in Scalar Product with Top Submodule
Informal description
For any ideal $I$ in a semiring $R$ and any $R$-linear map $f \colon R \to M$, the image of $I$ under $f$ is contained in the scalar product of $I$ with the top submodule of $M$, i.e., $f(I) \subseteq I \cdot (\top \colon \text{Submodule } R M)$.
Submodule.top_smul theorem
: (⊤ : Ideal R) • N = N
Full source
@[simp]
theorem top_smul : ( : Ideal R) • N = N :=
  le_antisymm smul_le_right fun r hri => one_smul R r ▸ smul_mem_smul mem_top hri
Scalar Multiplication by Top Ideal Preserves Submodule: $\top \bullet N = N$
Informal description
For any submodule $N$ of an $R$-module, the scalar multiplication of the top ideal $\top$ of $R$ with $N$ is equal to $N$, i.e., $\top \bullet N = N$.
Submodule.mul_smul theorem
: (I * J) • N = I • J • N
Full source
protected theorem mul_smul : (I * J) • N = I • J • N :=
  Submodule.smul_assoc _ _ _
Associativity of ideal-submodule scalar multiplication: $(I \cdot J) \cdot N = I \cdot (J \cdot N)$
Informal description
For any ideals $I$ and $J$ in a semiring $R$ and any submodule $N$ of an $R$-module, the scalar multiplication satisfies $(I \cdot J) \cdot N = I \cdot (J \cdot N)$.
Submodule.mem_of_span_top_of_smul_mem theorem
(M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤) (x : M) (H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M'
Full source
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ) (x : M)
    (H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M' := by
  suffices LinearMap.range (LinearMap.toSpanSingleton R M x) ≤ M' by
    rw [← LinearMap.toSpanSingleton_one R M x]
    exact this (LinearMap.mem_range_self _ 1)
  rw [LinearMap.range_eq_map, ← hs, map_le_iff_le_comap, Ideal.span, span_le]
  exact fun r hr ↦ H ⟨r, hr⟩
Membership Criterion via Scalar Multiplication with Spanning Set: $x \in M'$ when $\operatorname{span}_R s = \top$ and $r \cdot x \in M'$ for all $r \in s$
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $M'$ a submodule of $M$, and $s$ a subset of $R$ such that the ideal generated by $s$ is the entire ring (i.e., $\operatorname{span}_R s = \top$). If for every element $r$ in $s$, the scalar multiple $r \cdot x$ belongs to $M'$, then $x$ itself belongs to $M'$.
Submodule.map_smul'' theorem
(f : M →ₗ[R] M') : (I • N).map f = I • N.map f
Full source
@[simp]
theorem map_smul'' (f : M →ₗ[R] M') : (I • N).map f = I • N.map f :=
  le_antisymm
    (map_le_iff_le_comap.2 <|
      smul_le.2 fun r hr n hn =>
        show f (r • n) ∈ I • N.map f from
          (f.map_smul r n).symmsmul_mem_smul hr (mem_map_of_mem hn)) <|
    smul_le.2 fun r hr _ hn =>
      let ⟨p, hp, hfp⟩ := mem_map.1 hn
      hfp ▸ f.map_smul r p ▸ mem_map_of_mem (smul_mem_smul hr hp)
Equality of Images under Scalar Multiplication: $f(I \cdot N) = I \cdot f(N)$
Informal description
Let $R$ be a semiring, $M$ and $M'$ be $R$-modules, $I$ be an ideal of $R$, $N$ be a submodule of $M$, and $f : M \to M'$ be an $R$-linear map. Then the image of the scalar multiplication $I \cdot N$ under $f$ equals the scalar multiplication of $I$ with the image of $N$ under $f$, i.e., $f(I \cdot N) = I \cdot f(N)$.
Submodule.mem_smul_top_iff theorem
(N : Submodule R M) (x : N) : x ∈ I • (⊤ : Submodule R N) ↔ (x : M) ∈ I • N
Full source
theorem mem_smul_top_iff (N : Submodule R M) (x : N) :
    x ∈ I • (⊤ : Submodule R N)x ∈ I • (⊤ : Submodule R N) ↔ (x : M) ∈ I • N := by
  have : Submodule.map N.subtype (I • ) = I • N := by
    rw [Submodule.map_smul'', Submodule.map_top, Submodule.range_subtype]
  simp [← this, -map_smul'']
Equivalence of Membership in Scalar Multiplication of Top Submodule and Original Module
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $I$ an ideal of $R$, and $N$ a submodule of $M$. For any element $x$ of $N$, we have $x \in I \cdot (\top : \text{Submodule } R N)$ if and only if $x \in I \cdot N$ when viewed as an element of $M$.
Submodule.smul_comap_le_comap_smul theorem
(f : M →ₗ[R] M') (S : Submodule R M') (I : Ideal R) : I • S.comap f ≤ (I • S).comap f
Full source
@[simp]
theorem smul_comap_le_comap_smul (f : M →ₗ[R] M') (S : Submodule R M') (I : Ideal R) :
    I • S.comap f ≤ (I • S).comap f := by
  refine Submodule.smul_le.mpr fun r hr x hx => ?_
  rw [Submodule.mem_comap] at hx ⊢
  rw [f.map_smul]
  exact Submodule.smul_mem_smul hr hx
Inclusion of Scalar Multiplication with Preimage under Linear Maps
Informal description
Let $R$ be a semiring, $M$ and $M'$ be $R$-modules, and $f : M \to M'$ be an $R$-linear map. For any ideal $I$ of $R$ and any submodule $S$ of $M'$, the image of the scalar multiplication $I \cdot (f^{-1}(S))$ under $f$ is contained in the preimage of $I \cdot S$ under $f$, i.e., $$ I \cdot (f^{-1}(S)) \subseteq f^{-1}(I \cdot S). $$
Submodule.mem_smul_span_singleton theorem
{I : Ideal R} {m : M} {x : M} : x ∈ I • span R ({ m } : Set M) ↔ ∃ y ∈ I, y • m = x
Full source
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
    x ∈ I • span R ({m} : Set M)x ∈ I • span R ({m} : Set M) ↔ ∃ y ∈ I, y • m = x :=
  ⟨fun hx =>
    smul_induction_on hx
      (fun r hri _ hnm =>
        let ⟨s, hs⟩ := mem_span_singleton.1 hnm
        ⟨r * s, I.mul_mem_right _ hri, hs ▸ mul_smul r s m⟩)
      fun m1 m2 ⟨y1, hyi1, hy1⟩ ⟨y2, hyi2, hy2⟩ =>
      ⟨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]⟩,
    fun ⟨_, hyi, hy⟩ => hy ▸ smul_mem_smul hyi (subset_span <| Set.mem_singleton m)⟩
Characterization of Membership in Scalar Multiplication of Span of Singleton: $x \in I \cdot \operatorname{span}_R(\{m\}) \leftrightarrow \exists y \in I, y \cdot m = x$
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $I$ an ideal of $R$, and $m \in M$. For any $x \in M$, we have $x \in I \cdot \operatorname{span}_R(\{m\})$ if and only if there exists $y \in I$ such that $y \cdot m = x$.
Submodule.smul_eq_map₂ theorem
: I • N = Submodule.map₂ (LinearMap.lsmul R M) I N
Full source
theorem smul_eq_map₂ : I • N = Submodule.map₂ (LinearMap.lsmul R M) I N :=
  le_antisymm (smul_le.mpr fun _m hm _n ↦ Submodule.apply_mem_map₂ _ hm)
    (map₂_le.mpr fun _m hm _n ↦ smul_mem_smul hm)
Scalar Multiplication as Image of Bilinear Map: $I \cdot N = \text{map}_2(\text{lsmul}_R^M)(I, N)$
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $I$ an ideal of $R$, and $N$ a submodule of $M$. Then the scalar multiplication $I \cdot N$ is equal to the image of the bilinear map $\text{lsmul}_R^M$ applied to $I$ and $N$, where $\text{lsmul}_R^M$ is the scalar multiplication operation viewed as a bilinear map $R \to M \to M$.
Submodule.span_smul_span theorem
: Ideal.span S • span R T = span R (⋃ (s ∈ S) (t ∈ T), {s • t})
Full source
theorem span_smul_span : Ideal.span S • span R T = span R (⋃ (s ∈ S) (t ∈ T), {s • t}) := by
  rw [smul_eq_map₂]
  exact (map₂_span_span _ _ _ _).trans <| congr_arg _ <| Set.image2_eq_iUnion _ _ _
Span of Scalar Multiplication: $\text{span}(S) \cdot \text{span}(T) = \text{span}(\{s \cdot t \mid s \in S, t \in T\})$
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $S \subseteq R$, and $T \subseteq M$. Then the scalar multiplication of the ideal generated by $S$ with the submodule generated by $T$ equals the submodule generated by all scalar multiples $s \cdot t$ where $s \in S$ and $t \in T$. In other words: \[ \text{span}(S) \cdot \text{span}(T) = \text{span}\left(\bigcup_{s \in S} \bigcup_{t \in T} \{s \cdot t\}\right) \]
Submodule.ideal_span_singleton_smul theorem
(r : R) (N : Submodule R M) : (Ideal.span { r } : Ideal R) • N = r • N
Full source
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
    (Ideal.span {r} : Ideal R) • N = r • N := by
  have : span R (⋃ (t : M) (_ : t ∈ N), {r • t}) = r • N := by
    convert span_eq (r • N)
    exact (Set.image_eq_iUnion _ (N : Set M)).symm
  conv_lhs => rw [← span_eq N, span_smul_span]
  simpa
Scalar Multiplication by Principal Ideal: $\text{span}(\{r\}) \cdot N = r \cdot N$
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $r \in R$, and $N$ a submodule of $M$. Then the scalar multiplication of the ideal generated by $\{r\}$ with $N$ equals the scalar multiplication of $r$ with $N$, i.e., $$ \text{span}_R(\{r\}) \cdot N = r \cdot N. $$
Submodule.mem_of_span_eq_top_of_smul_pow_mem theorem
(M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤) (x : M) (H : ∀ r : s, ∃ n : ℕ, ((r : R) ^ n : R) • x ∈ M') : x ∈ M'
Full source
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n • x ∈ M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = )
    (x : M) (H : ∀ r : s, ∃ n : ℕ, ((r : R) ^ n : R) • x ∈ M') : x ∈ M' := by
  choose f hf using H
  apply M'.mem_of_span_top_of_smul_mem _ (Ideal.span_range_pow_eq_top s hs f)
  rintro ⟨_, r, hr, rfl⟩
  exact hf r
Membership Criterion via Powers of Scalar Multiplication with Spanning Set
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $M'$ a submodule of $M$, and $s$ a subset of $R$ such that the ideal generated by $s$ is the entire ring (i.e., $\operatorname{span}_R s = \top$). For an element $x \in M$, if for every $r \in s$ there exists a natural number $n$ such that $r^n \cdot x \in M'$, then $x \in M'$.
Submodule.map_pointwise_smul theorem
(r : R) (N : Submodule R M) (f : M →ₗ[R] M') : (r • N).map f = r • N.map f
Full source
@[simp]
theorem map_pointwise_smul (r : R) (N : Submodule R M) (f : M →ₗ[R] M') :
    (r • N).map f = r • N.map f := by
  simp_rw [← ideal_span_singleton_smul, map_smul'']
Image of Scalar Multiplication under Linear Map: $f(r \cdot N) = r \cdot f(N)$
Informal description
Let $R$ be a semiring, $M$ and $M'$ be $R$-modules, $N$ be a submodule of $M$, and $f : M \to M'$ be an $R$-linear map. For any element $r \in R$, the image of the scalar multiple $r \cdot N$ under $f$ equals the scalar multiple $r \cdot f(N)$, i.e., $f(r \cdot N) = r \cdot f(N)$.
Submodule.mem_smul_span theorem
{s : Set M} {x : M} : x ∈ I • Submodule.span R s ↔ x ∈ Submodule.span R (⋃ (a ∈ I) (b ∈ s), ({a • b} : Set M))
Full source
theorem mem_smul_span {s : Set M} {x : M} :
    x ∈ I • Submodule.span R sx ∈ I • Submodule.span R s ↔ x ∈ Submodule.span R (⋃ (a ∈ I) (b ∈ s), ({a • b} : Set M)) := by
  rw [← I.span_eq, Submodule.span_smul_span, I.span_eq]
  simp
Membership Criterion for Scalar Multiple of Module Span: $x \in I \cdot \operatorname{span}(s) \leftrightarrow x \in \operatorname{span}(\{a \cdot b \mid a \in I, b \in s\})$
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $I$ an ideal of $R$, and $s$ a subset of $M$. For any element $x \in M$, we have that $x$ belongs to the scalar multiple $I \cdot \operatorname{span}_R(s)$ if and only if $x$ belongs to the span of all scalar multiples $a \cdot b$ where $a \in I$ and $b \in s$. In other words: \[ x \in I \cdot \operatorname{span}_R(s) \leftrightarrow x \in \operatorname{span}_R\left(\bigcup_{a \in I} \bigcup_{b \in s} \{a \cdot b\}\right) \]
Submodule.mem_ideal_smul_span_iff_exists_sum theorem
{ι : Type*} (f : ι → M) (x : M) : x ∈ I • span R (Set.range f) ↔ ∃ (a : ι →₀ R) (_ : ∀ i, a i ∈ I), (a.sum fun i c => c • f i) = x
Full source
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
theorem mem_ideal_smul_span_iff_exists_sum {ι : Type*} (f : ι → M) (x : M) :
    x ∈ I • span R (Set.range f)x ∈ I • span R (Set.range f) ↔
      ∃ (a : ι →₀ R) (_ : ∀ i, a i ∈ I), (a.sum fun i c => c • f i) = x := by
  constructor; swap
  · rintro ⟨a, ha, rfl⟩
    exact Submodule.sum_mem _ fun c _ => smul_mem_smul (ha c) <| subset_span <| Set.mem_range_self _
  refine fun hx => span_induction ?_ ?_ ?_ ?_ (mem_smul_span.mp hx)
  · simp only [Set.mem_iUnion, Set.mem_range, Set.mem_singleton_iff]
    rintro x ⟨y, hy, x, ⟨i, rfl⟩, rfl⟩
    refine ⟨Finsupp.single i y, fun j => ?_, ?_⟩
    · letI := Classical.decEq ι
      rw [Finsupp.single_apply]
      split_ifs
      · assumption
      · exact I.zero_mem
    refine @Finsupp.sum_single_index ι R M _ _ i _ (fun i y => y • f i) ?_
    simp
  · exact ⟨0, fun _ => I.zero_mem, Finsupp.sum_zero_index⟩
  · rintro x y - - ⟨ax, hax, rfl⟩ ⟨ay, hay, rfl⟩
    refine ⟨ax + ay, fun i => I.add_mem (hax i) (hay i), Finsupp.sum_add_index' ?_ ?_⟩ <;>
      intros <;> simp only [zero_smul, add_smul]
  · rintro c x - ⟨a, ha, rfl⟩
    refine ⟨c • a, fun i => I.mul_mem_left c (ha i), ?_⟩
    rw [Finsupp.sum_smul_index, Finsupp.smul_sum] <;> intros <;> simp only [zero_smul, mul_smul]
Decomposition of Elements in Ideal-Scalar Multiple of Module Span
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $I$ an ideal of $R$, and $f : \iota \to M$ a family of elements in $M$. For any $x \in M$, the following are equivalent: 1. $x$ belongs to the submodule $I \cdot \operatorname{span}_R(\mathrm{range}(f))$. 2. There exists a finitely supported function $a : \iota \to_{\text{f}} R$ such that $a(i) \in I$ for all $i \in \iota$, and $x = \sum_{i \in \iota} a(i) \cdot f(i)$. In mathematical notation: \[ x \in I \cdot \operatorname{span}_R(\mathrm{range}(f)) \leftrightarrow \exists (a : \iota \to_{\text{f}} R), (\forall i, a(i) \in I) \land \left(\sum_{i} a(i) \cdot f(i) = x\right) \]
Submodule.mem_ideal_smul_span_iff_exists_sum' theorem
{ι : Type*} (s : Set ι) (f : ι → M) (x : M) : x ∈ I • span R (f '' s) ↔ ∃ (a : s →₀ R) (_ : ∀ i, a i ∈ I), (a.sum fun i c => c • f i) = x
Full source
theorem mem_ideal_smul_span_iff_exists_sum' {ι : Type*} (s : Set ι) (f : ι → M) (x : M) :
    x ∈ I • span R (f '' s)x ∈ I • span R (f '' s) ↔
    ∃ (a : s →₀ R) (_ : ∀ i, a i ∈ I), (a.sum fun i c => c • f i) = x := by
  rw [← Submodule.mem_ideal_smul_span_iff_exists_sum, ← Set.image_eq_range]
Decomposition of Elements in Ideal-Scalar Multiple of Module Span over a Subset
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $I$ an ideal of $R$, $s$ a subset of $\iota$, and $f : \iota \to M$ a family of elements in $M$. For any $x \in M$, the following are equivalent: 1. $x$ belongs to the submodule $I \cdot \operatorname{span}_R(f(s))$. 2. There exists a finitely supported function $a : s \to_{\text{f}} R$ such that $a(i) \in I$ for all $i \in s$, and $x = \sum_{i \in s} a(i) \cdot f(i)$. In mathematical notation: \[ x \in I \cdot \operatorname{span}_R(f(s)) \leftrightarrow \exists (a : s \to_{\text{f}} R), (\forall i \in s, a(i) \in I) \land \left(\sum_{i \in s} a(i) \cdot f(i) = x\right) \]
Ideal.add_eq_sup theorem
{I J : Ideal R} : I + J = I ⊔ J
Full source
@[simp]
theorem add_eq_sup {I J : Ideal R} : I + J = I ⊔ J :=
  rfl
Sum of Ideals Equals Their Supremum
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the sum of ideals $I + J$ is equal to their supremum $I \sqcup J$.
Ideal.zero_eq_bot theorem
: (0 : Ideal R) = ⊥
Full source
@[simp]
theorem zero_eq_bot : (0 : Ideal R) =  :=
  rfl
Zero Ideal Equals Bottom Ideal
Informal description
The zero ideal in a semiring $R$ is equal to the bottom ideal $\bot$, i.e., $0 = \bot$.
Ideal.sum_eq_sup theorem
{ι : Type*} (s : Finset ι) (f : ι → Ideal R) : s.sum f = s.sup f
Full source
@[simp]
theorem sum_eq_sup {ι : Type*} (s : Finset ι) (f : ι → Ideal R) : s.sum f = s.sup f :=
  rfl
Sum of Finite Family of Ideals Equals Their Supremum
Informal description
For any finite set $s$ indexed by a type $\iota$ and any function $f$ mapping elements of $\iota$ to ideals in a semiring $R$, the sum of the ideals $f(i)$ over $i \in s$ is equal to the supremum of these ideals, i.e., $\sum_{i \in s} f(i) = \bigsqcup_{i \in s} f(i)$.
Ideal.add_eq_one_iff theorem
: I + J = 1 ↔ ∃ i ∈ I, ∃ j ∈ J, i + j = 1
Full source
theorem add_eq_one_iff : I + J = 1 ↔ ∃ i ∈ I, ∃ j ∈ J, i + j = 1 := by
  rw [one_eq_top, eq_top_iff_one, add_eq_sup, Submodule.mem_sup]
Sum of Ideals Equals Unit Ideal iff Elements Sum to One
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the sum of ideals $I + J$ equals the unit ideal $(1)$ if and only if there exist elements $i \in I$ and $j \in J$ such that $i + j = 1$.
Ideal.mul_mem_mul theorem
{r s} (hr : r ∈ I) (hs : s ∈ J) : r * s ∈ I * J
Full source
theorem mul_mem_mul {r s} (hr : r ∈ I) (hs : s ∈ J) : r * s ∈ I * J :=
  Submodule.smul_mem_smul hr hs
Product of Ideal Elements Belongs to Product Ideal
Informal description
For any elements $r$ and $s$ in a semiring $R$, if $r$ belongs to an ideal $I$ and $s$ belongs to an ideal $J$, then their product $r \cdot s$ belongs to the product ideal $I \cdot J$.
Ideal.pow_mem_pow theorem
{x : R} (hx : x ∈ I) (n : ℕ) : x ^ n ∈ I ^ n
Full source
theorem pow_mem_pow {x : R} (hx : x ∈ I) (n : ) : x ^ n ∈ I ^ n :=
  Submodule.pow_mem_pow _ hx _
Power of Ideal Element Belongs to Power of Ideal
Informal description
For any element $x$ in an ideal $I$ of a semiring $R$ and any natural number $n$, the power $x^n$ belongs to the ideal $I^n$.
Ideal.mul_le theorem
: I * J ≤ K ↔ ∀ r ∈ I, ∀ s ∈ J, r * s ∈ K
Full source
theorem mul_le : I * J ≤ K ↔ ∀ r ∈ I, ∀ s ∈ J, r * s ∈ K :=
  Submodule.smul_le
Product Ideal Containment Criterion: $I \cdot J \leq K \leftrightarrow \forall r \in I, \forall s \in J, r \cdot s \in K$
Informal description
For ideals $I$, $J$, and $K$ in a semiring $R$, the product ideal $I \cdot J$ is contained in $K$ if and only if for every $r \in I$ and $s \in J$, the product $r \cdot s$ belongs to $K$.
Ideal.mul_le_left theorem
: I * J ≤ J
Full source
theorem mul_le_left : I * J ≤ J :=
  mul_le.2 fun _ _ _ => J.mul_mem_left _
Left Product Ideal Containment: $I \cdot J \leq J$
Informal description
For any ideals $I$ and $J$ in a semiring $R$, the product ideal $I \cdot J$ is contained in $J$.
Ideal.sup_mul_left_self theorem
: I ⊔ J * I = I
Full source
@[simp]
theorem sup_mul_left_self : I ⊔ J * I = I :=
  sup_eq_left.2 mul_le_left
Supremum Absorption Identity: $I \sqcup (J \cdot I) = I$
Informal description
For any ideals $I$ and $J$ in a semiring $R$, the supremum of $I$ and the product ideal $J \cdot I$ equals $I$, i.e., $I \sqcup (J \cdot I) = I$.
Ideal.mul_left_self_sup theorem
: J * I ⊔ I = I
Full source
@[simp]
theorem mul_left_self_sup : J * I ⊔ I = I :=
  sup_eq_right.2 mul_le_left
Supremum of Left Product Ideal with Itself Equals Itself
Informal description
For any ideals $I$ and $J$ in a semiring $R$, the supremum of the product ideal $J \cdot I$ and $I$ equals $I$, i.e., $J \cdot I \sqcup I = I$.
Ideal.mul_le_right theorem
[I.IsTwoSided] : I * J ≤ I
Full source
theorem mul_le_right [I.IsTwoSided] : I * J ≤ I :=
  mul_le.2 fun _ hr _ _ ↦ I.mul_mem_right _ hr
Containment of Right Product Ideal in Two-Sided Ideal
Informal description
For a two-sided ideal $I$ in a semiring $R$ and any ideal $J$ in $R$, the product ideal $I \cdot J$ is contained in $I$.
Ideal.sup_mul_right_self theorem
[I.IsTwoSided] : I ⊔ I * J = I
Full source
@[simp]
theorem sup_mul_right_self [I.IsTwoSided] : I ⊔ I * J = I :=
  sup_eq_left.2 mul_le_right
Supremum Absorption Property for Two-Sided Ideal: $I \sqcup (I \cdot J) = I$
Informal description
For a two-sided ideal $I$ in a semiring $R$ and any ideal $J$ in $R$, the supremum of $I$ and the product ideal $I \cdot J$ equals $I$, i.e., $I \sqcup (I \cdot J) = I$.
Ideal.mul_right_self_sup theorem
[I.IsTwoSided] : I * J ⊔ I = I
Full source
@[simp]
theorem mul_right_self_sup [I.IsTwoSided] : I * J ⊔ I = I :=
  sup_eq_right.2 mul_le_right
Supremum of Product Ideal and Two-Sided Ideal Equals the Two-Sided Ideal
Informal description
For a two-sided ideal $I$ in a semiring $R$ and any ideal $J$ in $R$, the supremum of the product ideal $I \cdot J$ and $I$ equals $I$, i.e., $I \cdot J \sqcup I = I$.
Ideal.mul_assoc theorem
: I * J * K = I * (J * K)
Full source
protected theorem mul_assoc : I * J * K = I * (J * K) :=
  Submodule.smul_assoc I J K
Associativity of Ideal Multiplication: $(I \cdot J) \cdot K = I \cdot (J \cdot K)$
Informal description
For any three ideals $I$, $J$, and $K$ in a semiring $R$, the product of ideals is associative, i.e., $(I \cdot J) \cdot K = I \cdot (J \cdot K)$.
Ideal.mul_bot theorem
: I * ⊥ = ⊥
Full source
theorem mul_bot : I *  =  := by simp
Right Multiplication by Zero Ideal: $I \cdot \bot = \bot$
Informal description
For any ideal $I$ in a semiring $R$, the product of $I$ with the zero ideal $\bot$ is equal to the zero ideal, i.e., $I \cdot \bot = \bot$.
Ideal.bot_mul theorem
: ⊥ * I = ⊥
Full source
theorem bot_mul :  * I =  := by simp
Zero Ideal Absorbs Multiplication: $\bot \cdot I = \bot$
Informal description
For any ideal $I$ in a semiring $R$, the product of the zero ideal $\bot$ with $I$ is equal to the zero ideal, i.e., $\bot \cdot I = \bot$.
Ideal.top_mul theorem
: ⊤ * I = I
Full source
@[simp]
theorem top_mul :  * I = I :=
  Submodule.top_smul I
Top Ideal Acts as Identity in Ideal Multiplication: $\top \cdot I = I$
Informal description
For any ideal $I$ in a semiring $R$, the product of the top ideal $\top$ with $I$ is equal to $I$, i.e., $\top \cdot I = I$.
Ideal.mul_mono theorem
(hik : I ≤ K) (hjl : J ≤ L) : I * J ≤ K * L
Full source
theorem mul_mono (hik : I ≤ K) (hjl : J ≤ L) : I * J ≤ K * L :=
  Submodule.smul_mono hik hjl
Monotonicity of Ideal Multiplication: $I \leq K$ and $J \leq L$ implies $I \cdot J \leq K \cdot L$
Informal description
For any ideals $I$, $J$, $K$, and $L$ in a semiring $R$, if $I \leq K$ and $J \leq L$, then the product ideal $I \cdot J$ is contained in the product ideal $K \cdot L$, i.e., $I \cdot J \leq K \cdot L$.
Ideal.mul_mono_left theorem
(h : I ≤ J) : I * K ≤ J * K
Full source
theorem mul_mono_left (h : I ≤ J) : I * K ≤ J * K :=
  Submodule.smul_mono_left h
Left Monotonicity of Ideal Multiplication: $I \subseteq J \Rightarrow I \cdot K \subseteq J \cdot K$
Informal description
For any ideals $I$, $J$, and $K$ in a semiring $R$, if $I \subseteq J$, then the product ideal $I \cdot K$ is contained in the product ideal $J \cdot K$, i.e., $I \cdot K \subseteq J \cdot K$.
Ideal.mul_mono_right theorem
(h : J ≤ K) : I * J ≤ I * K
Full source
theorem mul_mono_right (h : J ≤ K) : I * J ≤ I * K :=
  smul_mono_right I h
Right Monotonicity of Ideal Multiplication
Informal description
For any ideals $I$, $J$, and $K$ in a semiring $R$, if $J$ is contained in $K$ (i.e., $J \leq K$), then the product ideal $I \cdot J$ is contained in $I \cdot K$ (i.e., $I \cdot J \leq I \cdot K$).
Ideal.mul_sup theorem
: I * (J ⊔ K) = I * J ⊔ I * K
Full source
theorem mul_sup : I * (J ⊔ K) = I * J ⊔ I * K :=
  Submodule.smul_sup I J K
Right Distributivity of Ideal Multiplication over Supremum
Informal description
For any ideals $I$, $J$, and $K$ in a semiring $R$, the product of $I$ with the supremum of $J$ and $K$ is equal to the supremum of the products $I \cdot J$ and $I \cdot K$, i.e., $I \cdot (J \sqcup K) = (I \cdot J) \sqcup (I \cdot K)$.
Ideal.sup_mul theorem
: (I ⊔ J) * K = I * K ⊔ J * K
Full source
theorem sup_mul : (I ⊔ J) * K = I * K ⊔ J * K :=
  Submodule.sup_smul I J K
Distributivity of Ideal Multiplication over Supremum
Informal description
For any ideals $I$, $J$, and $K$ in a semiring $R$, the product of the supremum of $I$ and $J$ with $K$ is equal to the supremum of the products $I \cdot K$ and $J \cdot K$, i.e., $(I \sqcup J) \cdot K = I \cdot K \sqcup J \cdot K$.
Ideal.pow_le_pow_right theorem
{m n : ℕ} (h : m ≤ n) : I ^ n ≤ I ^ m
Full source
theorem pow_le_pow_right {m n : } (h : m ≤ n) : I ^ n ≤ I ^ m := by
  obtain _ | m := m
  · rw [Submodule.pow_zero, one_eq_top]; exact le_top
  obtain ⟨n, rfl⟩ := Nat.exists_eq_add_of_le h
  rw [add_comm, Submodule.pow_add _ m.add_one_ne_zero]
  exact mul_le_left
Monotonicity of Ideal Powers: $I^n \leq I^m$ for $m \leq n$
Informal description
For any natural numbers $m$ and $n$ such that $m \leq n$, and for any ideal $I$ in a semiring $R$, the $n$-th power of $I$ is contained in the $m$-th power of $I$, i.e., $I^n \leq I^m$.
Ideal.pow_le_self theorem
{n : ℕ} (hn : n ≠ 0) : I ^ n ≤ I
Full source
theorem pow_le_self {n : } (hn : n ≠ 0) : I ^ n ≤ I :=
  calc
    I ^ n ≤ I ^ 1 := pow_le_pow_right (Nat.pos_of_ne_zero hn)
    _ = I := Submodule.pow_one _
Ideal Powers are Contained in the Original Ideal for $n \neq 0$
Informal description
For any natural number $n \neq 0$ and any ideal $I$ in a semiring $R$, the $n$-th power of $I$ is contained in $I$ itself, i.e., $I^n \leq I$.
Ideal.pow_right_mono theorem
(e : I ≤ J) (n : ℕ) : I ^ n ≤ J ^ n
Full source
theorem pow_right_mono (e : I ≤ J) (n : ) : I ^ n ≤ J ^ n := by
  induction' n with _ hn
  · rw [Submodule.pow_zero, Submodule.pow_zero]
  · rw [Submodule.pow_succ, Submodule.pow_succ]
    exact Ideal.mul_mono hn e
Monotonicity of Ideal Powers: $I \leq J$ implies $I^n \leq J^n$ for all $n \in \mathbb{N}$
Informal description
For any ideals $I$ and $J$ in a semiring $R$, if $I \leq J$, then for any natural number $n$, the $n$-th power ideal $I^n$ is contained in the $n$-th power ideal $J^n$, i.e., $I^n \leq J^n$.
Ideal.IsTwoSided.instHMul instance
[J.IsTwoSided] : (I * J).IsTwoSided
Full source
instance (priority := low) [J.IsTwoSided] : (I * J).IsTwoSided :=
  ⟨fun b ha ↦ Submodule.mul_induction_on ha
    (fun i hi j hj ↦ by rw [mul_assoc]; exact mul_mem_mul hi (mul_mem_right _ _ hj))
    fun x y hx hy ↦ by rw [right_distrib]; exact add_mem hx hy⟩
Product of Two-Sided Ideals is Two-Sided
Informal description
For any two-sided ideals $I$ and $J$ in a semiring, the product ideal $I \cdot J$ is also a two-sided ideal.
Ideal.IsTwoSided.mul_one theorem
: I * 1 = I
Full source
protected theorem mul_one : I * 1 = I :=
  mul_le_right.antisymm
    fun i hi ↦ mul_one i ▸ mul_mem_mul hi (one_eq_top (R := R) ▸ Submodule.mem_top)
Product of Two-Sided Ideal with Unit Ideal
Informal description
For a two-sided ideal $I$ in a semiring $R$, the product of $I$ with the unit ideal $(1)$ equals $I$, i.e., $I \cdot (1) = I$.
Ideal.IsTwoSided.pow_add theorem
: I ^ (m + n) = I ^ m * I ^ n
Full source
protected theorem pow_add : I ^ (m + n) = I ^ m * I ^ n := by
  obtain rfl | h := eq_or_ne n 0
  · rw [add_zero, Submodule.pow_zero, IsTwoSided.mul_one]
  · exact Submodule.pow_add _ h
Additive Exponent Law for Powers of Two-Sided Ideals
Informal description
For any two-sided ideal $I$ in a semiring and any natural numbers $m$ and $n$, the $(m+n)$-th power of $I$ equals the product of the $m$-th power and the $n$-th power of $I$, i.e., $I^{m+n} = I^m \cdot I^n$.
Ideal.IsTwoSided.pow_succ theorem
: I ^ (n + 1) = I * I ^ n
Full source
protected theorem pow_succ : I ^ (n + 1) = I * I ^ n := by
  rw [add_comm, IsTwoSided.pow_add, Submodule.pow_one]
Recursive Power Law for Two-Sided Ideals: $I^{n+1} = I \cdot I^n$
Informal description
For any two-sided ideal $I$ in a semiring and any natural number $n$, the $(n+1)$-th power of $I$ equals the product of $I$ with the $n$-th power of $I$, i.e., $I^{n+1} = I \cdot I^n$.
Ideal.mul_eq_bot theorem
[NoZeroDivisors R] : I * J = ⊥ ↔ I = ⊥ ∨ J = ⊥
Full source
@[simp]
theorem mul_eq_bot [NoZeroDivisors R] : I * J = ⊥ ↔ I = ⊥ ∨ J = ⊥ :=
  ⟨fun hij =>
    or_iff_not_imp_left.mpr fun I_ne_bot =>
      J.eq_bot_iff.mpr fun j hj =>
        let ⟨i, hi, ne0⟩ := I.ne_bot_iff.mp I_ne_bot
        Or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0,
    fun h => by obtain rfl | rfl := h; exacts [bot_mul _, mul_bot _]⟩
Product of Ideals is Zero iff One Ideal is Zero (No Zero Divisors Case)
Informal description
Let $R$ be a semiring with no zero divisors. For any two ideals $I$ and $J$ of $R$, the product ideal $I \cdot J$ is equal to the zero ideal $\bot$ if and only if either $I$ is the zero ideal or $J$ is the zero ideal.
Ideal.instNoZeroDivisors instance
[NoZeroDivisors R] : NoZeroDivisors (Ideal R)
Full source
instance [NoZeroDivisors R] : NoZeroDivisors (Ideal R) where
  eq_zero_or_eq_zero_of_mul_eq_zero := mul_eq_bot.1
Ideals in a Semiring with No Zero Divisors Have No Zero Divisors
Informal description
For any semiring $R$ with no zero divisors, the semiring of ideals of $R$ also has no zero divisors.
Ideal.instNoZeroSMulDivisorsSubtypeMemSubmodule instance
{S A : Type*} [Semiring S] [SMul R S] [AddCommMonoid A] [Module R A] [Module S A] [IsScalarTower R S A] [NoZeroSMulDivisors R A] {I : Submodule S A} : NoZeroSMulDivisors R I
Full source
instance {S A : Type*} [Semiring S] [SMul R S] [AddCommMonoid A] [Module R A] [Module S A]
    [IsScalarTower R S A] [NoZeroSMulDivisors R A] {I : Submodule S A} : NoZeroSMulDivisors R I :=
  Submodule.noZeroSMulDivisors (Submodule.restrictScalars R I)
Submodules Inherit No Zero Scalar Divisors Property
Informal description
For any semiring $S$, $R$-module $A$, and submodule $I$ of $A$ as an $S$-module, if $A$ has no zero scalar divisors with respect to $R$, then $I$ also has no zero scalar divisors with respect to $R$.
Ideal.pow_eq_zero_of_mem theorem
{I : Ideal R} {n m : ℕ} (hnI : I ^ n = 0) (hmn : n ≤ m) {x : R} (hx : x ∈ I) : x ^ m = 0
Full source
theorem pow_eq_zero_of_mem {I : Ideal R} {n m : } (hnI : I ^ n = 0) (hmn : n ≤ m) {x : R}
    (hx : x ∈ I) : x ^ m = 0 := by
  simpa [hnI] using pow_le_pow_right hmn <| pow_mem_pow hx m
Vanishing of Powers in Nilpotent Ideals: $x^m = 0$ for $x \in I$ and $m \geq n$ when $I^n = 0$
Informal description
Let $I$ be an ideal in a semiring $R$ such that $I^n = 0$ for some natural number $n$. For any natural number $m \geq n$ and any element $x \in I$, we have $x^m = 0$.
Ideal.mul_mem_mul_rev theorem
{r s} (hr : r ∈ I) (hs : s ∈ J) : s * r ∈ I * J
Full source
theorem mul_mem_mul_rev {r s} (hr : r ∈ I) (hs : s ∈ J) : s * r ∈ I * J :=
  mul_comm r s ▸ mul_mem_mul hr hs
Reversed Product of Ideal Elements Belongs to Product Ideal
Informal description
For any elements $r$ and $s$ in a semiring $R$, if $r$ belongs to an ideal $I$ and $s$ belongs to an ideal $J$, then their product $s \cdot r$ belongs to the product ideal $I \cdot J$.
Ideal.prod_mem_prod theorem
{ι : Type*} {s : Finset ι} {I : ι → Ideal R} {x : ι → R} : (∀ i ∈ s, x i ∈ I i) → (∏ i ∈ s, x i) ∈ ∏ i ∈ s, I i
Full source
theorem prod_mem_prod {ι : Type*} {s : Finset ι} {I : ι → Ideal R} {x : ι → R} :
    (∀ i ∈ s, x i ∈ I i) → (∏ i ∈ s, x i) ∈ ∏ i ∈ s, I i := by
  classical
    refine Finset.induction_on s ?_ ?_
    · intro
      rw [Finset.prod_empty, Finset.prod_empty, one_eq_top]
      exact Submodule.mem_top
    · intro a s ha IH h
      rw [Finset.prod_insert ha, Finset.prod_insert ha]
      exact
        mul_mem_mul (h a <| Finset.mem_insert_self a s)
          (IH fun i hi => h i <| Finset.mem_insert_of_mem hi)
Product of Elements in Ideals Belongs to Product of Ideals
Informal description
Let $R$ be a semiring, $\iota$ a type, $s$ a finite subset of $\iota$, $I : \iota \to \text{Ideal}(R)$ a family of ideals, and $x : \iota \to R$ a family of elements. If for every $i \in s$ we have $x_i \in I_i$, then the product $\prod_{i \in s} x_i$ belongs to the product ideal $\prod_{i \in s} I_i$.
Ideal.sup_pow_add_le_pow_sup_pow theorem
{n m : ℕ} : (I ⊔ J) ^ (n + m) ≤ I ^ n ⊔ J ^ m
Full source
lemma sup_pow_add_le_pow_sup_pow {n m : } : (I ⊔ J) ^ (n + m) ≤ I ^ n ⊔ J ^ m := by
  rw [← Ideal.add_eq_sup, ← Ideal.add_eq_sup, add_pow, Ideal.sum_eq_sup]
  apply Finset.sup_le
  intros i hi
  by_cases hn : n ≤ i
  · exact (Ideal.mul_le_right.trans (Ideal.mul_le_right.trans
      ((Ideal.pow_le_pow_right hn).trans le_sup_left)))
  · refine (Ideal.mul_le_right.trans (Ideal.mul_le_left.trans
      ((Ideal.pow_le_pow_right ?_).trans le_sup_right)))
    omega
Containment of Supremum Power in Powers of Ideals: $(I \sqcup J)^{n+m} \leq I^n \sqcup J^m$
Informal description
For any two ideals $I$ and $J$ in a semiring $R$ and any natural numbers $n$ and $m$, the $(n+m)$-th power of the supremum $I \sqcup J$ is contained in the supremum of the $n$-th power of $I$ and the $m$-th power of $J$, i.e., \[ (I \sqcup J)^{n+m} \leq I^n \sqcup J^m. \]
Ideal.mul_comm theorem
: I * J = J * I
Full source
protected theorem mul_comm : I * J = J * I :=
  le_antisymm (mul_le.2 fun _ hrI _ hsJ => mul_mem_mul_rev hsJ hrI)
    (mul_le.2 fun _ hrJ _ hsI => mul_mem_mul_rev hsI hrJ)
Commutativity of Ideal Product: $I \cdot J = J \cdot I$
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the product ideals $I \cdot J$ and $J \cdot I$ are equal.
Ideal.span_mul_span theorem
(S T : Set R) : span S * span T = span (⋃ (s ∈ S) (t ∈ T), {s * t})
Full source
theorem span_mul_span (S T : Set R) : span S * span T = span (⋃ (s ∈ S) (t ∈ T), {s * t}) :=
  Submodule.span_smul_span S T
Product of Spans Equals Span of Pairwise Products
Informal description
For any subsets $S$ and $T$ of a semiring $R$, the product of the ideals generated by $S$ and $T$ equals the ideal generated by all pairwise products $\{s \cdot t \mid s \in S, t \in T\}$. In other words: \[ \text{span}(S) \cdot \text{span}(T) = \text{span}\left(\bigcup_{s \in S} \bigcup_{t \in T} \{s \cdot t\}\right) \]
Ideal.span_mul_span' theorem
(S T : Set R) : span S * span T = span (S * T)
Full source
theorem span_mul_span' (S T : Set R) : span S * span T = span (S * T) := by
  unfold span
  rw [Submodule.span_mul_span]
Product of Spans Equals Span of Products
Informal description
For any subsets $S$ and $T$ of a semiring $R$, the product of the ideals generated by $S$ and $T$ is equal to the ideal generated by the product set $S \cdot T = \{s \cdot t \mid s \in S, t \in T\}$. In other words, $(\text{span } S) \cdot (\text{span } T) = \text{span } (S \cdot T)$.
Ideal.span_singleton_mul_span_singleton theorem
(r s : R) : span { r } * span { s } = (span {r * s} : Ideal R)
Full source
theorem span_singleton_mul_span_singleton (r s : R) :
    span {r} * span {s} = (span {r * s} : Ideal R) := by
  unfold span
  rw [Submodule.span_mul_span, Set.singleton_mul_singleton]
Product of Principal Ideals Equals Principal Ideal of Product
Informal description
For any elements $r$ and $s$ in a semiring $R$, the product of the principal ideals generated by $\{r\}$ and $\{s\}$ equals the principal ideal generated by $\{r \cdot s\}$. In other words, $(\{r\}) \cdot (\{s\}) = (\{r \cdot s\})$.
Ideal.span_singleton_pow theorem
(s : R) (n : ℕ) : span { s } ^ n = (span {s ^ n} : Ideal R)
Full source
theorem span_singleton_pow (s : R) (n : ) : span {s} ^ n = (span {s ^ n} : Ideal R) := by
  induction' n with n ih; · simp [Set.singleton_one]
  simp only [pow_succ, ih, span_singleton_mul_span_singleton]
Power of Principal Ideal is Principal Ideal of Power
Informal description
For any element $s$ in a semiring $R$ and any natural number $n$, the $n$-th power of the principal ideal generated by $\{s\}$ is equal to the principal ideal generated by $\{s^n\}$. In symbols: $$ (\{s\})^n = (\{s^n\}) $$
Ideal.mem_mul_span_singleton theorem
{x y : R} {I : Ideal R} : x ∈ I * span { y } ↔ ∃ z ∈ I, z * y = x
Full source
theorem mem_mul_span_singleton {x y : R} {I : Ideal R} : x ∈ I * span {y}x ∈ I * span {y} ↔ ∃ z ∈ I, z * y = x :=
  Submodule.mem_smul_span_singleton
Characterization of Membership in Product of Ideal with Principal Ideal
Informal description
Let $R$ be a semiring, $x, y \in R$, and $I$ an ideal of $R$. Then $x$ belongs to the product of $I$ with the principal ideal generated by $\{y\}$ if and only if there exists $z \in I$ such that $z \cdot y = x$. In symbols: $$ x \in I \cdot (y) \iff \exists z \in I,\ z \cdot y = x $$
Ideal.mem_span_singleton_mul theorem
{x y : R} {I : Ideal R} : x ∈ span { y } * I ↔ ∃ z ∈ I, y * z = x
Full source
theorem mem_span_singleton_mul {x y : R} {I : Ideal R} : x ∈ span {y} * Ix ∈ span {y} * I ↔ ∃ z ∈ I, y * z = x := by
  simp only [mul_comm, mem_mul_span_singleton]
Characterization of Membership in Product of Principal Ideal with Another Ideal
Informal description
Let $R$ be a semiring, $x, y \in R$, and $I$ an ideal of $R$. Then $x$ belongs to the product of the principal ideal generated by $\{y\}$ with $I$ if and only if there exists $z \in I$ such that $y \cdot z = x$. In symbols: $$ x \in (y) \cdot I \iff \exists z \in I,\ y \cdot z = x $$
Ideal.le_span_singleton_mul_iff theorem
{x : R} {I J : Ideal R} : I ≤ span { x } * J ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zJ = zI
Full source
theorem le_span_singleton_mul_iff {x : R} {I J : Ideal R} :
    I ≤ span {x} * J ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zJ = zI :=
  show (∀ {zI} (_ : zI ∈ I), zI ∈ span {x} * J) ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zJ = zI by
    simp only [mem_span_singleton_mul]
Containment in Product of Principal Ideal with Another Ideal
Informal description
Let $R$ be a semiring, $x \in R$, and $I, J$ be ideals of $R$. Then $I$ is contained in the product of the principal ideal generated by $\{x\}$ with $J$ if and only if for every $z_I \in I$, there exists $z_J \in J$ such that $x \cdot z_J = z_I$. In symbols: $$ I \subseteq (x) \cdot J \iff \forall z_I \in I,\ \exists z_J \in J,\ x \cdot z_J = z_I $$
Ideal.span_singleton_mul_le_iff theorem
{x : R} {I J : Ideal R} : span { x } * I ≤ J ↔ ∀ z ∈ I, x * z ∈ J
Full source
theorem span_singleton_mul_le_iff {x : R} {I J : Ideal R} :
    spanspan {x} * I ≤ J ↔ ∀ z ∈ I, x * z ∈ J := by
  simp only [mul_le, mem_span_singleton_mul, mem_span_singleton]
  constructor
  · intro h zI hzI
    exact h x (dvd_refl x) zI hzI
  · rintro h _ ⟨z, rfl⟩ zI hzI
    rw [mul_comm x z, mul_assoc]
    exact J.mul_mem_left _ (h zI hzI)
Containment Criterion for Product of Principal Ideal with Another Ideal
Informal description
Let $R$ be a semiring, $x \in R$, and $I, J$ be ideals of $R$. The product of the principal ideal generated by $\{x\}$ with $I$ is contained in $J$ if and only if for every $z \in I$, the product $x \cdot z$ belongs to $J$. In symbols: $$ (x) \cdot I \subseteq J \iff \forall z \in I,\ x \cdot z \in J $$
Ideal.span_singleton_mul_le_span_singleton_mul theorem
{x y : R} {I J : Ideal R} : span { x } * I ≤ span { y } * J ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zI = y * zJ
Full source
theorem span_singleton_mul_le_span_singleton_mul {x y : R} {I J : Ideal R} :
    spanspan {x} * I ≤ span {y} * J ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zI = y * zJ := by
  simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
Inclusion Criterion for Products of Principal Ideals with Ideals
Informal description
For any elements $x, y$ in a semiring $R$ and any ideals $I, J$ of $R$, the inclusion $\langle x \rangle \cdot I \subseteq \langle y \rangle \cdot J$ holds if and only if for every element $z_I \in I$, there exists an element $z_J \in J$ such that $x \cdot z_I = y \cdot z_J$.
Ideal.span_singleton_mul_right_mono theorem
[IsDomain R] {x : R} (hx : x ≠ 0) : span { x } * I ≤ span { x } * J ↔ I ≤ J
Full source
theorem span_singleton_mul_right_mono [IsDomain R] {x : R} (hx : x ≠ 0) :
    spanspan {x} * I ≤ span {x} * J ↔ I ≤ J := by
  simp_rw [span_singleton_mul_le_span_singleton_mul, mul_right_inj' hx,
    exists_eq_right', SetLike.le_def]
Right Multiplication by Principal Ideal Preserves Ideal Inclusion in Integral Domains
Informal description
Let $R$ be an integral domain and $x \in R$ a nonzero element. For any two ideals $I$ and $J$ of $R$, the inequality $\langle x \rangle \cdot I \leq \langle x \rangle \cdot J$ holds if and only if $I \leq J$.
Ideal.span_singleton_mul_left_mono theorem
[IsDomain R] {x : R} (hx : x ≠ 0) : I * span { x } ≤ J * span { x } ↔ I ≤ J
Full source
theorem span_singleton_mul_left_mono [IsDomain R] {x : R} (hx : x ≠ 0) :
    I * span {x} ≤ J * span {x} ↔ I ≤ J := by
  simpa only [mul_comm I, mul_comm J] using span_singleton_mul_right_mono hx
Left Multiplication by Principal Ideal Preserves Ideal Inclusion in Integral Domains
Informal description
Let $R$ be an integral domain and $x \in R$ a nonzero element. For any two ideals $I$ and $J$ of $R$, the inequality $I \cdot \langle x \rangle \leq J \cdot \langle x \rangle$ holds if and only if $I \leq J$.
Ideal.span_singleton_mul_right_inj theorem
[IsDomain R] {x : R} (hx : x ≠ 0) : span { x } * I = span { x } * J ↔ I = J
Full source
theorem span_singleton_mul_right_inj [IsDomain R] {x : R} (hx : x ≠ 0) :
    spanspan {x} * I = span {x} * J ↔ I = J := by
  simp only [le_antisymm_iff, span_singleton_mul_right_mono hx]
Injectivity of Right Multiplication by Principal Ideal in Integral Domains
Informal description
Let $R$ be an integral domain and $x \in R$ a nonzero element. For any two ideals $I$ and $J$ of $R$, the equality $\langle x \rangle \cdot I = \langle x \rangle \cdot J$ holds if and only if $I = J$.
Ideal.span_singleton_mul_left_inj theorem
[IsDomain R] {x : R} (hx : x ≠ 0) : I * span { x } = J * span { x } ↔ I = J
Full source
theorem span_singleton_mul_left_inj [IsDomain R] {x : R} (hx : x ≠ 0) :
    I * span {x} = J * span {x} ↔ I = J := by
  simp only [le_antisymm_iff, span_singleton_mul_left_mono hx]
Injectivity of Left Multiplication by Principal Ideal in Integral Domains
Informal description
Let $R$ be an integral domain and $x \in R$ a nonzero element. For any two ideals $I$ and $J$ of $R$, the equality $I \cdot \langle x \rangle = J \cdot \langle x \rangle$ holds if and only if $I = J$.
Ideal.span_singleton_mul_right_injective theorem
[IsDomain R] {x : R} (hx : x ≠ 0) : Function.Injective ((span { x } : Ideal R) * ·)
Full source
theorem span_singleton_mul_right_injective [IsDomain R] {x : R} (hx : x ≠ 0) :
    Function.Injective ((span {x} : Ideal R) * ·) := fun _ _ =>
  (span_singleton_mul_right_inj hx).mp
Injectivity of Right Multiplication by Principal Ideal in Integral Domains
Informal description
Let $R$ be an integral domain and $x \in R$ a nonzero element. The function that maps an ideal $I$ of $R$ to the product $\langle x \rangle \cdot I$ is injective.
Ideal.span_singleton_mul_left_injective theorem
[IsDomain R] {x : R} (hx : x ≠ 0) : Function.Injective fun I : Ideal R => I * span { x }
Full source
theorem span_singleton_mul_left_injective [IsDomain R] {x : R} (hx : x ≠ 0) :
    Function.Injective fun I : Ideal R => I * span {x} := fun _ _ =>
  (span_singleton_mul_left_inj hx).mp
Injectivity of Left Multiplication by Principal Ideal in Integral Domains
Informal description
Let $R$ be an integral domain and $x \in R$ a nonzero element. The function that maps an ideal $I$ of $R$ to the product $I \cdot \langle x \rangle$ is injective.
Ideal.span_singleton_mul_eq_span_singleton_mul theorem
{x y : R} (I J : Ideal R) : span { x } * I = span { y } * J ↔ (∀ zI ∈ I, ∃ zJ ∈ J, x * zI = y * zJ) ∧ ∀ zJ ∈ J, ∃ zI ∈ I, x * zI = y * zJ
Full source
theorem span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : Ideal R) :
    spanspan {x} * I = span {y} * J ↔
      (∀ zI ∈ I, ∃ zJ ∈ J, x * zI = y * zJ) ∧ ∀ zJ ∈ J, ∃ zI ∈ I, x * zI = y * zJ := by
  simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
Equality of Ideal Products with Principal Ideals
Informal description
For any elements $x, y$ in a semiring $R$ and any ideals $I, J$ of $R$, the equality of the products of the principal ideals generated by $\{x\}$ and $\{y\}$ with $I$ and $J$ respectively, i.e., $\langle x \rangle \cdot I = \langle y \rangle \cdot J$, holds if and only if for every $z_I \in I$ there exists $z_J \in J$ such that $x \cdot z_I = y \cdot z_J$, and conversely for every $z_J \in J$ there exists $z_I \in I$ such that $x \cdot z_I = y \cdot z_J$.
Ideal.prod_span theorem
{ι : Type*} (s : Finset ι) (I : ι → Set R) : (∏ i ∈ s, Ideal.span (I i)) = Ideal.span (∏ i ∈ s, I i)
Full source
theorem prod_span {ι : Type*} (s : Finset ι) (I : ι → Set R) :
    (∏ i ∈ s, Ideal.span (I i)) = Ideal.span (∏ i ∈ s, I i) :=
  Submodule.prod_span s I
Product of Spans Equals Span of Products in Semiring Ideals
Informal description
Let $R$ be a semiring, $\iota$ a type, $s$ a finite subset of $\iota$, and $I : \iota \to \text{Set } R$ a family of subsets of $R$. Then the product of the ideals generated by each $I(i)$ for $i \in s$ is equal to the ideal generated by the product of the sets $I(i)$ for $i \in s$. That is, \[ \prod_{i \in s} \text{span}(I(i)) = \text{span}\left(\prod_{i \in s} I(i)\right). \]
Ideal.prod_span_singleton theorem
{ι : Type*} (s : Finset ι) (I : ι → R) : (∏ i ∈ s, Ideal.span ({I i} : Set R)) = Ideal.span {∏ i ∈ s, I i}
Full source
theorem prod_span_singleton {ι : Type*} (s : Finset ι) (I : ι → R) :
    (∏ i ∈ s, Ideal.span ({I i} : Set R)) = Ideal.span {∏ i ∈ s, I i} :=
  Submodule.prod_span_singleton s I
Product of Principal Ideals Equals Principal Ideal of Product
Informal description
Let $R$ be a semiring, $\iota$ a type, $s$ a finite subset of $\iota$, and $I : \iota \to R$ a function. The product of the principal ideals generated by the elements $I(i)$ for $i \in s$ is equal to the principal ideal generated by the product $\prod_{i \in s} I(i)$. In other words, \[ \prod_{i \in s} \text{span}\{I(i)\} = \text{span}\left\{\prod_{i \in s} I(i)\right\}. \]
Ideal.multiset_prod_span_singleton theorem
(m : Multiset R) : (m.map fun x => Ideal.span { x }).prod = Ideal.span ({Multiset.prod m} : Set R)
Full source
@[simp]
theorem multiset_prod_span_singleton (m : Multiset R) :
    (m.map fun x => Ideal.span {x}).prod = Ideal.span ({Multiset.prod m} : Set R) :=
  Multiset.induction_on m (by simp) fun a m ih => by
    simp only [Multiset.map_cons, Multiset.prod_cons, ih, ← Ideal.span_singleton_mul_span_singleton]
Product of Principal Ideals from Multiset Equals Principal Ideal of Product
Informal description
For any multiset $m$ of elements in a semiring $R$, the product of the principal ideals generated by each element of $m$ is equal to the principal ideal generated by the product of all elements in $m$. That is, \[ \prod_{x \in m} \operatorname{span}\{x\} = \operatorname{span}\left\{\prod_{x \in m} x\right\}. \]
Ideal.finset_inf_span_singleton theorem
{ι : Type*} (s : Finset ι) (I : ι → R) (hI : Set.Pairwise (↑s) (IsCoprime on I)) : (s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {∏ i ∈ s, I i}
Full source
theorem finset_inf_span_singleton {ι : Type*} (s : Finset ι) (I : ι → R)
    (hI : Set.Pairwise (↑s) (IsCoprimeIsCoprime on I)) :
    (s.inf fun i => Ideal.span ({I i} : Set R)) = Ideal.span {∏ i ∈ s, I i} := by
  ext x
  simp only [Submodule.mem_finset_inf, Ideal.mem_span_singleton]
  exact ⟨Finset.prod_dvd_of_coprime hI, fun h i hi => (Finset.dvd_prod_of_mem _ hi).trans h⟩
Infimum of Coprime Principal Ideals Equals Principal Ideal of Product
Informal description
Let $R$ be a commutative ring, $\iota$ a type, $s$ a finite subset of $\iota$, and $I \colon \iota \to R$ a family of elements in $R$. If the elements $(I_i)_{i \in s}$ are pairwise coprime (i.e., $I_i$ and $I_j$ are coprime for all distinct $i, j \in s$), then the infimum of the ideals generated by each $I_i$ is equal to the ideal generated by the product $\prod_{i \in s} I_i$. In other words, \[ \bigsqcap_{i \in s} \text{span}\{I_i\} = \text{span}\left\{\prod_{i \in s} I_i\right\}. \]
Ideal.iInf_span_singleton theorem
{ι : Type*} [Fintype ι] {I : ι → R} (hI : ∀ (i j) (_ : i ≠ j), IsCoprime (I i) (I j)) : ⨅ i, span ({I i} : Set R) = span {∏ i, I i}
Full source
theorem iInf_span_singleton {ι : Type*} [Fintype ι] {I : ι → R}
    (hI : ∀ (i j) (_ : i ≠ j), IsCoprime (I i) (I j)) :
    ⨅ i, span ({I i} : Set R) = span {∏ i, I i} := by
  rw [← Finset.inf_univ_eq_iInf, finset_inf_span_singleton]
  rwa [Finset.coe_univ, Set.pairwise_univ]
Infimum of Pairwise Coprime Principal Ideals Equals Principal Ideal of Product
Informal description
Let $R$ be a commutative semiring, $\iota$ a finite type, and $I \colon \iota \to R$ a family of elements in $R$. If the elements $(I_i)_{i \in \iota}$ are pairwise coprime (i.e., $I_i$ and $I_j$ are coprime for all distinct $i, j \in \iota$), then the infimum of the principal ideals generated by each $I_i$ is equal to the principal ideal generated by the product $\prod_{i \in \iota} I_i$. In other words, \[ \bigsqcap_{i \in \iota} (I_i) = \left(\prod_{i \in \iota} I_i\right). \]
Ideal.iInf_span_singleton_natCast theorem
{R : Type*} [CommRing R] {ι : Type*} [Fintype ι] {I : ι → ℕ} (hI : Pairwise fun i j => (I i).Coprime (I j)) : ⨅ (i : ι), span {(I i : R)} = span {((∏ i : ι, I i : ℕ) : R)}
Full source
theorem iInf_span_singleton_natCast {R : Type*} [CommRing R] {ι : Type*} [Fintype ι]
    {I : ι → } (hI : Pairwise fun i j => (I i).Coprime (I j)) :
    ⨅ (i : ι), span {(I i : R)} = span {((∏ i : ι, I i : ℕ) : R)} := by
  rw [iInf_span_singleton, Nat.cast_prod]
  exact fun i j h ↦ (hI h).cast
Infimum of Coprime Natural Number Principal Ideals Equals Principal Ideal of Product in Commutative Ring
Informal description
Let $R$ be a commutative ring, $\iota$ a finite type, and $I \colon \iota \to \mathbb{N}$ a family of natural numbers such that the elements $(I_i)_{i \in \iota}$ are pairwise coprime (i.e., $\gcd(I_i, I_j) = 1$ for all distinct $i, j \in \iota$). Then the infimum of the principal ideals generated by each $I_i$ (viewed as elements of $R$ via the canonical homomorphism $\mathbb{N} \to R$) is equal to the principal ideal generated by the product $\prod_{i \in \iota} I_i$ (also viewed in $R$). In other words, \[ \bigsqcap_{i \in \iota} (I_i) = \left(\prod_{i \in \iota} I_i\right). \]
Ideal.sup_eq_top_iff_isCoprime theorem
{R : Type*} [CommSemiring R] (x y : R) : span ({ x } : Set R) ⊔ span { y } = ⊤ ↔ IsCoprime x y
Full source
theorem sup_eq_top_iff_isCoprime {R : Type*} [CommSemiring R] (x y : R) :
    spanspan ({x} : Set R) ⊔ span {y}span ({x} : Set R) ⊔ span {y} = ⊤ ↔ IsCoprime x y := by
  rw [eq_top_iff_one, Submodule.mem_sup]
  constructor
  · rintro ⟨u, hu, v, hv, h1⟩
    rw [mem_span_singleton'] at hu hv
    rw [← hu.choose_spec, ← hv.choose_spec] at h1
    exact ⟨_, _, h1⟩
  · exact fun ⟨u, v, h1⟩ =>
      ⟨_, mem_span_singleton'.mpr ⟨_, rfl⟩, _, mem_span_singleton'.mpr ⟨_, rfl⟩, h1⟩
Coprimality Criterion via Ideal Supremum: $(x) \sqcup (y) = R \leftrightarrow \text{IsCoprime}(x, y)$
Informal description
Let $R$ be a commutative semiring and $x, y \in R$. The supremum of the principal ideals generated by $x$ and $y$ equals the top ideal (i.e., the entire semiring) if and only if $x$ and $y$ are coprime. In other words, \[ (x) \sqcup (y) = R \leftrightarrow \exists a, b \in R, a \cdot x + b \cdot y = 1. \]
Ideal.mul_le_inf theorem
: I * J ≤ I ⊓ J
Full source
theorem mul_le_inf : I * J ≤ I ⊓ J :=
  mul_le.2 fun r hri s hsj => ⟨I.mul_mem_right s hri, J.mul_mem_left r hsj⟩
Product Ideal Contained in Intersection: $I \cdot J \leq I \cap J$
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the product ideal $I \cdot J$ is contained in the intersection $I \cap J$.
Ideal.multiset_prod_le_inf theorem
{s : Multiset (Ideal R)} : s.prod ≤ s.inf
Full source
theorem multiset_prod_le_inf {s : Multiset (Ideal R)} : s.prod ≤ s.inf := by
  classical
    refine s.induction_on ?_ ?_
    · rw [Multiset.inf_zero]
      exact le_top
    intro a s ih
    rw [Multiset.prod_cons, Multiset.inf_cons]
    exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
Product of Multiset of Ideals is Contained in Their Infimum
Informal description
For any multiset $s$ of ideals in a semiring $R$, the product of the ideals in $s$ is contained in their infimum, i.e., $\prod s \leq \inf s$.
Ideal.prod_le_inf theorem
{s : Finset ι} {f : ι → Ideal R} : s.prod f ≤ s.inf f
Full source
theorem prod_le_inf {s : Finset ι} {f : ι → Ideal R} : s.prod f ≤ s.inf f :=
  multiset_prod_le_inf
Product of Finitely Many Ideals is Contained in Their Infimum
Informal description
For any finite set $s$ and any function $f$ mapping elements of $s$ to ideals in a semiring $R$, the product of the ideals in the image of $f$ is contained in their infimum, i.e., $\prod_{i \in s} f(i) \leq \inf_{i \in s} f(i)$.
Ideal.mul_eq_inf_of_coprime theorem
(h : I ⊔ J = ⊤) : I * J = I ⊓ J
Full source
theorem mul_eq_inf_of_coprime (h : I ⊔ J = ) : I * J = I ⊓ J :=
  le_antisymm mul_le_inf fun r ⟨hri, hrj⟩ =>
    let ⟨s, hsi, t, htj, hst⟩ := Submodule.mem_sup.1 ((eq_top_iff_one _).1 h)
    mul_one r ▸
      hst ▸
        (mul_add r s t).symmIdeal.add_mem (I * J) (mul_mem_mul_rev hsi hrj) (mul_mem_mul hri htj)
Product of Coprime Ideals Equals Their Intersection
Informal description
For two ideals $I$ and $J$ in a semiring $R$, if $I$ and $J$ are coprime (i.e., $I \sqcup J = \top$), then their product equals their intersection, i.e., $I \cdot J = I \cap J$.
Ideal.sup_mul_eq_of_coprime_left theorem
(h : I ⊔ J = ⊤) : I ⊔ J * K = I ⊔ K
Full source
theorem sup_mul_eq_of_coprime_left (h : I ⊔ J = ) : I ⊔ J * K = I ⊔ K :=
  le_antisymm (sup_le_sup_left mul_le_left _) fun i hi => by
    rw [eq_top_iff_one] at h; rw [Submodule.mem_sup] at h hi ⊢
    obtain ⟨i1, hi1, j, hj, h⟩ := h; obtain ⟨i', hi', k, hk, hi⟩ := hi
    refine ⟨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, ?_⟩
    rw [add_assoc, ← add_mul, h, one_mul, hi]
Coprime Ideal Supremum-Product Identity: $I \sqcup J = \top \Rightarrow I \sqcup (J \cdot K) = I \sqcup K$
Informal description
For ideals $I$, $J$, and $K$ in a semiring $R$, if $I$ and $J$ are coprime (i.e., $I \sqcup J = \top$), then $I \sqcup (J \cdot K) = I \sqcup K$.
Ideal.sup_mul_eq_of_coprime_right theorem
(h : I ⊔ K = ⊤) : I ⊔ J * K = I ⊔ J
Full source
theorem sup_mul_eq_of_coprime_right (h : I ⊔ K = ) : I ⊔ J * K = I ⊔ J := by
  rw [mul_comm]
  exact sup_mul_eq_of_coprime_left h
Coprime Ideal Supremum-Product Identity (Right Version): $I \sqcup K = \top \Rightarrow I \sqcup (J \cdot K) = I \sqcup J$
Informal description
For ideals $I$, $J$, and $K$ in a semiring $R$, if $I$ and $K$ are coprime (i.e., $I \sqcup K = \top$), then $I \sqcup (J \cdot K) = I \sqcup J$.
Ideal.mul_sup_eq_of_coprime_left theorem
(h : I ⊔ J = ⊤) : I * K ⊔ J = K ⊔ J
Full source
theorem mul_sup_eq_of_coprime_left (h : I ⊔ J = ) : I * K ⊔ J = K ⊔ J := by
  rw [sup_comm] at h
  rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm]
Coprime Ideal Product-Supremum Identity: $I \sqcup J = \top \Rightarrow (I \cdot K) \sqcup J = K \sqcup J$
Informal description
For ideals $I$, $J$, and $K$ in a semiring $R$, if $I$ and $J$ are coprime (i.e., $I \sqcup J = \top$), then $(I \cdot K) \sqcup J = K \sqcup J$.
Ideal.mul_sup_eq_of_coprime_right theorem
(h : K ⊔ J = ⊤) : I * K ⊔ J = I ⊔ J
Full source
theorem mul_sup_eq_of_coprime_right (h : K ⊔ J = ) : I * K ⊔ J = I ⊔ J := by
  rw [sup_comm] at h
  rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm]
Coprime Ideal Product-Supremum Identity (Right Version): $(I \cdot K) \sqcup J = I \sqcup J$ when $K \sqcup J = \top$
Informal description
For ideals $I$, $J$, and $K$ in a semiring $R$, if $K$ and $J$ are coprime (i.e., $K \sqcup J = \top$), then $(I \cdot K) \sqcup J = I \sqcup J$.
Ideal.sup_prod_eq_top theorem
{s : Finset ι} {J : ι → Ideal R} (h : ∀ i, i ∈ s → I ⊔ J i = ⊤) : (I ⊔ ∏ i ∈ s, J i) = ⊤
Full source
theorem sup_prod_eq_top {s : Finset ι} {J : ι → Ideal R} (h : ∀ i, i ∈ sI ⊔ J i = ) :
    (I ⊔ ∏ i ∈ s, J i) =  :=
  Finset.prod_induction _ (fun J => I ⊔ J = )
    (fun _ _ hJ hK => (sup_mul_eq_of_coprime_left hJ).trans hK)
    (by simp_rw [one_eq_top, sup_top_eq]) h
Coprimality of Ideal with Finite Product of Coprime Ideals
Informal description
Let $R$ be a semiring, $I$ an ideal of $R$, and $\{J_i\}_{i \in s}$ a finite family of ideals of $R$ indexed by a finite set $s$. If for every $i \in s$, the ideals $I$ and $J_i$ are coprime (i.e., $I \sqcup J_i = \top$), then $I$ is also coprime with the product of the $J_i$ over $s$, i.e., $I \sqcup \prod_{i \in s} J_i = \top$.
Ideal.sup_multiset_prod_eq_top theorem
{s : Multiset (Ideal R)} (h : ∀ p ∈ s, I ⊔ p = ⊤) : I ⊔ Multiset.prod s = ⊤
Full source
theorem sup_multiset_prod_eq_top {s : Multiset (Ideal R)} (h : ∀ p ∈ s, I ⊔ p = ⊤) :
    I ⊔ Multiset.prod s =  :=
  Multiset.prod_induction (I ⊔ · = ) s (fun _ _ hp hq ↦ (sup_mul_eq_of_coprime_left hp).trans hq)
    (by simp only [one_eq_top, ge_iff_le, top_le_iff, le_top, sup_of_le_right]) h
Coprime Ideal Supremum-Product Identity for Multisets: $I \sqcup \prod s = \top$ when $I \sqcup J = \top$ for all $J \in s$
Informal description
Let $R$ be a semiring and $I$ an ideal in $R$. Given a multiset $s$ of ideals in $R$ such that $I \sqcup J = \top$ for every $J \in s$, then $I \sqcup \prod s = \top$, where $\prod s$ denotes the product of all ideals in the multiset $s$.
Ideal.sup_iInf_eq_top theorem
{s : Finset ι} {J : ι → Ideal R} (h : ∀ i, i ∈ s → I ⊔ J i = ⊤) : (I ⊔ ⨅ i ∈ s, J i) = ⊤
Full source
theorem sup_iInf_eq_top {s : Finset ι} {J : ι → Ideal R} (h : ∀ i, i ∈ sI ⊔ J i = ) :
    (I ⊔ ⨅ i ∈ s, J i) =  :=
  eq_top_iff.mpr <|
    le_of_eq_of_le (sup_prod_eq_top h).symm <|
      sup_le_sup_left (le_of_le_of_eq prod_le_inf <| Finset.inf_eq_iInf _ _) _
Coprime Ideal Supremum-Infimum Identity: $I \sqcup \bigsqcap_{i \in s} J_i = \top$ when $I \sqcup J_i = \top$ for all $i \in s$
Informal description
Let $R$ be a semiring, $I$ an ideal of $R$, and $\{J_i\}_{i \in s}$ a finite family of ideals of $R$ indexed by a finite set $s$. If for every $i \in s$, the ideals $I$ and $J_i$ are coprime (i.e., $I \sqcup J_i = \top$), then $I$ is also coprime with the infimum of the $J_i$ over $s$, i.e., $I \sqcup \bigsqcap_{i \in s} J_i = \top$.
Ideal.prod_sup_eq_top theorem
{s : Finset ι} {J : ι → Ideal R} (h : ∀ i, i ∈ s → J i ⊔ I = ⊤) : (∏ i ∈ s, J i) ⊔ I = ⊤
Full source
theorem prod_sup_eq_top {s : Finset ι} {J : ι → Ideal R} (h : ∀ i, i ∈ sJ i ⊔ I = ) :
    (∏ i ∈ s, J i) ⊔ I =  := by rw [sup_comm, sup_prod_eq_top]; intro i hi; rw [sup_comm, h i hi]
Product of Coprime Ideals Remains Coprime with Original Ideal
Informal description
Let $R$ be a semiring, $I$ an ideal of $R$, and $\{J_i\}_{i \in s}$ a finite family of ideals of $R$ indexed by a finite set $s$. If for every $i \in s$, the ideals $J_i$ and $I$ are coprime (i.e., $J_i \sqcup I = \top$), then the product of the $J_i$ over $s$ is also coprime with $I$, i.e., $(\prod_{i \in s} J_i) \sqcup I = \top$.
Ideal.iInf_sup_eq_top theorem
{s : Finset ι} {J : ι → Ideal R} (h : ∀ i, i ∈ s → J i ⊔ I = ⊤) : (⨅ i ∈ s, J i) ⊔ I = ⊤
Full source
theorem iInf_sup_eq_top {s : Finset ι} {J : ι → Ideal R} (h : ∀ i, i ∈ sJ i ⊔ I = ) :
    (⨅ i ∈ s, J i) ⊔ I =  := by rw [sup_comm, sup_iInf_eq_top]; intro i hi; rw [sup_comm, h i hi]
Infimum of Coprime Ideals Remains Coprime with Original Ideal
Informal description
Let $R$ be a semiring, $I$ an ideal of $R$, and $\{J_i\}_{i \in s}$ a finite family of ideals of $R$ indexed by a finite set $s$. If for every $i \in s$, the ideals $J_i$ and $I$ are coprime (i.e., $J_i \sqcup I = \top$), then the infimum of the $J_i$ over $s$ is also coprime with $I$, i.e., $(\bigsqcap_{i \in s} J_i) \sqcup I = \top$.
Ideal.sup_pow_eq_top theorem
{n : ℕ} (h : I ⊔ J = ⊤) : I ⊔ J ^ n = ⊤
Full source
theorem sup_pow_eq_top {n : } (h : I ⊔ J = ) : I ⊔ J ^ n =  := by
  rw [← Finset.card_range n, ← Finset.prod_const]
  exact sup_prod_eq_top fun _ _ => h
Coprimality Preserved Under Powers: $I \sqcup J^n = \top$ when $I \sqcup J = \top$
Informal description
Let $I$ and $J$ be ideals in a semiring $R$ such that $I \sqcup J = \top$ (i.e., they are coprime). Then for any natural number $n$, the ideals $I$ and $J^n$ are also coprime, i.e., $I \sqcup J^n = \top$.
Ideal.pow_sup_eq_top theorem
{n : ℕ} (h : I ⊔ J = ⊤) : I ^ n ⊔ J = ⊤
Full source
theorem pow_sup_eq_top {n : } (h : I ⊔ J = ) : I ^ n ⊔ J =  := by
  rw [← Finset.card_range n, ← Finset.prod_const]
  exact prod_sup_eq_top fun _ _ => h
Coprimality Preserved Under Powers: $I^n \sqcup J = \top$ when $I \sqcup J = \top$
Informal description
Let $I$ and $J$ be ideals in a semiring $R$ such that $I \sqcup J = \top$ (i.e., they are coprime). Then for any natural number $n$, the ideals $I^n$ and $J$ are also coprime, i.e., $I^n \sqcup J = \top$.
Ideal.pow_sup_pow_eq_top theorem
{m n : ℕ} (h : I ⊔ J = ⊤) : I ^ m ⊔ J ^ n = ⊤
Full source
theorem pow_sup_pow_eq_top {m n : } (h : I ⊔ J = ) : I ^ m ⊔ J ^ n =  :=
  sup_pow_eq_top (pow_sup_eq_top h)
Coprimality Preserved Under Powers: $I^m \sqcup J^n = \top$ when $I \sqcup J = \top$
Informal description
Let $I$ and $J$ be ideals in a semiring $R$ such that $I \sqcup J = \top$ (i.e., they are coprime). Then for any natural numbers $m$ and $n$, the ideals $I^m$ and $J^n$ are also coprime, i.e., $I^m \sqcup J^n = \top$.
Ideal.mul_top theorem
: I * ⊤ = I
Full source
@[simp]
theorem mul_top : I *  = I :=
  Ideal.mul_comm  I ▸ Submodule.top_smul I
Right Multiplication by Top Ideal Preserves Ideal: $I \cdot \top = I$
Informal description
For any ideal $I$ in a semiring $R$, the product of $I$ with the top ideal $\top$ is equal to $I$, i.e., $I \cdot \top = I$.
Ideal.multiset_prod_eq_bot theorem
{R : Type*} [CommSemiring R] [IsDomain R] {s : Multiset (Ideal R)} : s.prod = ⊥ ↔ ⊥ ∈ s
Full source
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
@[simp]
lemma multiset_prod_eq_bot {R : Type*} [CommSemiring R] [IsDomain R] {s : Multiset (Ideal R)} :
    s.prod = ⊥ ↔ ⊥ ∈ s :=
  Multiset.prod_eq_zero_iff
Product of Ideals in an Integral Domain is Zero iff One Ideal is Zero
Informal description
Let $R$ be a commutative semiring that is an integral domain, and let $s$ be a multiset of ideals in $R$. The product of all ideals in $s$ is the zero ideal if and only if at least one of the ideals in $s$ is the zero ideal.
Ideal.span_pair_mul_span_pair theorem
(w x y z : R) : (span { w, x } : Ideal R) * span { y, z } = span {w * y, w * z, x * y, x * z}
Full source
theorem span_pair_mul_span_pair (w x y z : R) :
    (span {w, x} : Ideal R) * span {y, z} = span {w * y, w * z, x * y, x * z} := by
  simp_rw [span_insert, sup_mul, mul_sup, span_singleton_mul_span_singleton, sup_assoc]
Product of Ideals Generated by Two Elements Each is Generated by All Pairwise Products
Informal description
For any elements $w, x, y, z$ in a semiring $R$, the product of the ideals generated by $\{w, x\}$ and $\{y, z\}$ is equal to the ideal generated by the products $\{w \cdot y, w \cdot z, x \cdot y, x \cdot z\}$. In other words, $$(\{w, x\}) \cdot (\{y, z\}) = (\{w \cdot y, w \cdot z, x \cdot y, x \cdot z\}).$$
Ideal.isCoprime_iff_codisjoint theorem
: IsCoprime I J ↔ Codisjoint I J
Full source
theorem isCoprime_iff_codisjoint : IsCoprimeIsCoprime I J ↔ Codisjoint I J := by
  rw [IsCoprime, codisjoint_iff]
  constructor
  · rintro ⟨x, y, hxy⟩
    rw [eq_top_iff_one]
    apply (show x * I + y * J ≤ I ⊔ J from
      sup_le (mul_le_left.trans le_sup_left) (mul_le_left.trans le_sup_right))
    rw [hxy]
    simp only [one_eq_top, Submodule.mem_top]
  · intro h
    refine ⟨1, 1, ?_⟩
    simpa only [one_eq_top, top_mul, Submodule.add_eq_sup]
Coprimality of Ideals is Equivalent to Codisjointness: $I + J = R$
Informal description
Two ideals $I$ and $J$ in a semiring $R$ are coprime if and only if they are codisjoint, i.e., $I + J = R$ (or equivalently, $I \sqcup J = \top$ in the lattice of ideals).
Ideal.isCoprime_of_isMaximal theorem
[I.IsMaximal] [J.IsMaximal] (ne : I ≠ J) : IsCoprime I J
Full source
theorem isCoprime_of_isMaximal [I.IsMaximal] [J.IsMaximal] (ne : I ≠ J) : IsCoprime I J := by
  rw [isCoprime_iff_codisjoint, isMaximal_def] at *
  exact IsCoatom.codisjoint_of_ne ‹_› ‹_› ne
Distinct Maximal Ideals are Coprime
Informal description
For any two distinct maximal ideals $I$ and $J$ in a ring, $I$ and $J$ are coprime, i.e., there exist elements $i \in I$ and $j \in J$ such that $i + j = 1$.
Ideal.isCoprime_tfae theorem
: TFAE [IsCoprime I J, Codisjoint I J, I + J = 1, ∃ i ∈ I, ∃ j ∈ J, i + j = 1, I ⊔ J = ⊤]
Full source
theorem isCoprime_tfae : TFAE [IsCoprime I J, Codisjoint I J, I + J = 1,
    ∃ i ∈ I, ∃ j ∈ J, i + j = 1, I ⊔ J = ⊤] := by
  rw [← isCoprime_iff_codisjoint, ← isCoprime_iff_add, ← isCoprime_iff_exists,
      ← isCoprime_iff_sup_eq]
  simp
Equivalent Characterizations of Coprime Ideals
Informal description
For two ideals $I$ and $J$ in a semiring $R$, the following statements are equivalent: 1. $I$ and $J$ are coprime. 2. $I$ and $J$ are codisjoint (i.e., $I + J = R$). 3. The sum of $I$ and $J$ equals the unit ideal (i.e., $I + J = (1)$). 4. There exist elements $i \in I$ and $j \in J$ such that $i + j = 1$. 5. The supremum of $I$ and $J$ in the lattice of ideals equals the top element (i.e., $I \sqcup J = \top$).
IsCoprime.add_eq theorem
(h : IsCoprime I J) : I + J = 1
Full source
theorem _root_.IsCoprime.add_eq (h : IsCoprime I J) : I + J = 1 := isCoprime_iff_add.mp h
Sum of Coprime Ideals is Unit Ideal
Informal description
If two ideals $I$ and $J$ in a semiring $R$ are coprime, then their sum equals the unit ideal, i.e., $I + J = (1)$.
IsCoprime.sup_eq theorem
(h : IsCoprime I J) : I ⊔ J = ⊤
Full source
theorem _root_.IsCoprime.sup_eq (h : IsCoprime I J) : I ⊔ J =  := isCoprime_iff_sup_eq.mp h
Supremum of Coprime Ideals Equals Top
Informal description
If two ideals $I$ and $J$ in a semiring $R$ are coprime, then their supremum equals the top ideal, i.e., $I \sqcup J = \top$.
Ideal.inf_eq_mul_of_isCoprime theorem
(coprime : IsCoprime I J) : I ⊓ J = I * J
Full source
theorem inf_eq_mul_of_isCoprime (coprime : IsCoprime I J) : I ⊓ J = I * J :=
  (Ideal.mul_eq_inf_of_coprime coprime.sup_eq).symm
Intersection of Coprime Ideals Equals Their Product
Informal description
For two coprime ideals $I$ and $J$ in a semiring $R$, their intersection equals their product, i.e., $I \cap J = I \cdot J$.
Ideal.isCoprime_span_singleton_iff theorem
(x y : R) : IsCoprime (span <| singleton x) (span <| singleton y) ↔ IsCoprime x y
Full source
theorem isCoprime_span_singleton_iff (x y : R) :
    IsCoprimeIsCoprime (span <| singleton x) (span <| singleton y) ↔ IsCoprime x y := by
  simp_rw [isCoprime_iff_codisjoint, codisjoint_iff, eq_top_iff_one, mem_span_singleton_sup,
    mem_span_singleton]
  constructor
  · rintro ⟨a, _, ⟨b, rfl⟩, e⟩; exact ⟨a, b, mul_comm b y ▸ e⟩
  · rintro ⟨a, b, e⟩; exact ⟨a, _, ⟨b, rfl⟩, mul_comm y b ▸ e⟩
Coprimality of Principal Ideals $\leftrightarrow$ Coprimality of Generators
Informal description
For any elements $x$ and $y$ in a semiring $R$, the ideals generated by $\{x\}$ and $\{y\}$ are coprime if and only if $x$ and $y$ are coprime. That is, $\text{IsCoprime}(\text{span}\{x\}, \text{span}\{y\}) \leftrightarrow \text{IsCoprime}(x, y)$.
Ideal.isCoprime_biInf theorem
{J : ι → Ideal R} {s : Finset ι} (hf : ∀ j ∈ s, IsCoprime I (J j)) : IsCoprime I (⨅ j ∈ s, J j)
Full source
theorem isCoprime_biInf {J : ι → Ideal R} {s : Finset ι}
    (hf : ∀ j ∈ s, IsCoprime I (J j)) : IsCoprime I (⨅ j ∈ s, J j) := by
  classical
  simp_rw [isCoprime_iff_add] at *
  induction s using Finset.induction with
  | empty =>
      simp
  | insert i s _ hs =>
      rw [Finset.iInf_insert, inf_comm, one_eq_top, eq_top_iff, ← one_eq_top]
      set K := ⨅ j ∈ s, J j
      calc
        1 = I + K            := (hs fun j hj ↦ hf j (Finset.mem_insert_of_mem hj)).symm
        _ = I + K*(I + J i)  := by rw [hf i (Finset.mem_insert_self i s), mul_one]
        _ = (1+K)*I + K*J i  := by ring
        _ ≤ I + K ⊓ J i      := add_le_add mul_le_left mul_le_inf
Coprimality is preserved under infima of finite families of ideals
Informal description
Let $R$ be a semiring, $I$ an ideal of $R$, and $\{J_j\}_{j \in \iota}$ a family of ideals of $R$ indexed by a finite set $s \subseteq \iota$. If for every $j \in s$, the ideals $I$ and $J_j$ are coprime, then $I$ is coprime with the infimum $\bigsqcap_{j \in s} J_j$ of the family $\{J_j\}_{j \in s}$.
Ideal.radical definition
(I : Ideal R) : Ideal R
Full source
/-- The radical of an ideal `I` consists of the elements `r` such that `r ^ n ∈ I` for some `n`. -/
def radical (I : Ideal R) : Ideal R where
  carrier := { r | ∃ n : ℕ, r ^ n ∈ I }
  zero_mem' := ⟨1, (pow_one (0 : R)).symm ▸ I.zero_mem⟩
  add_mem' := fun {_ _} ⟨m, hxmi⟩ ⟨n, hyni⟩ =>
    ⟨m + n - 1, add_pow_add_pred_mem_of_pow_mem I hxmi hyni⟩
  smul_mem' {r s} := fun ⟨n, h⟩ ↦ ⟨n, (mul_pow r s n).symm ▸ I.mul_mem_left (r ^ n) h⟩
Radical of an ideal
Informal description
The radical of an ideal $I$ in a semiring $R$ is the ideal consisting of all elements $r \in R$ for which there exists a natural number $n$ such that $r^n \in I$.
Ideal.mem_radical_iff theorem
{r : R} : r ∈ I.radical ↔ ∃ n : ℕ, r ^ n ∈ I
Full source
theorem mem_radical_iff {r : R} : r ∈ I.radicalr ∈ I.radical ↔ ∃ n : ℕ, r ^ n ∈ I := Iff.rfl
Characterization of Elements in the Radical of an Ideal
Informal description
An element $r$ of a semiring $R$ belongs to the radical of an ideal $I$ if and only if there exists a natural number $n$ such that $r^n \in I$. In other words, $r \in \sqrt{I} \leftrightarrow \exists n \in \mathbb{N}, r^n \in I$.
Ideal.IsRadical definition
(I : Ideal R) : Prop
Full source
/-- An ideal is radical if it contains its radical. -/
def IsRadical (I : Ideal R) : Prop :=
  I.radical ≤ I
Radical ideal
Informal description
An ideal $I$ in a semiring $R$ is called *radical* if it contains its radical, i.e., if every element $r \in R$ for which there exists a natural number $n$ with $r^n \in I$ must already belong to $I$. In other words, $I$ is radical if $\sqrt{I} \subseteq I$.
Ideal.le_radical theorem
: I ≤ radical I
Full source
theorem le_radical : I ≤ radical I := fun r hri => ⟨1, (pow_one r).symm ▸ hri⟩
Inclusion of Ideal in its Radical: $I \subseteq \sqrt{I}$
Informal description
For any ideal $I$ in a semiring $R$, the ideal $I$ is contained in its radical $\sqrt{I}$.
Ideal.radical_eq_iff theorem
: I.radical = I ↔ I.IsRadical
Full source
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I ↔ I.IsRadical := by
  rw [le_antisymm_iff, and_iff_left le_radical, IsRadical]
Characterization of Radical Ideals: $\sqrt{I} = I \leftrightarrow I \text{ is radical}$
Informal description
An ideal $I$ in a semiring $R$ is equal to its radical $\sqrt{I}$ if and only if $I$ is a radical ideal, i.e., $\sqrt{I} = I \leftrightarrow I \text{ is radical}$.
Ideal.isRadical_iff_pow_one_lt theorem
(k : ℕ) (hk : 1 < k) : I.IsRadical ↔ ∀ r, r ^ k ∈ I → r ∈ I
Full source
theorem isRadical_iff_pow_one_lt (k : ) (hk : 1 < k) : I.IsRadical ↔ ∀ r, r ^ k ∈ I → r ∈ I :=
  ⟨fun h _r hr ↦ h ⟨k, hr⟩, fun h x ⟨n, hx⟩ ↦
    k.pow_imp_self_of_one_lt hk _ (fun _ _ ↦ .inr ∘ I.smul_mem _) h n x hx⟩
Characterization of Radical Ideals via Powers: $I$ is radical $\leftrightarrow$ ($r^k \in I \Rightarrow r \in I$ for $k > 1$)
Informal description
Let $I$ be an ideal in a semiring $R$ and let $k$ be a natural number with $k > 1$. Then $I$ is a radical ideal if and only if for every element $r \in R$, if $r^k \in I$ then $r \in I$.
Ideal.radical_top theorem
: (radical ⊤ : Ideal R) = ⊤
Full source
theorem radical_top : (radical  : Ideal R) =  :=
  (eq_top_iff_one _).2 ⟨0, Submodule.mem_top⟩
Radical of the Top Ideal is the Top Ideal
Informal description
The radical of the top ideal in a semiring $R$ is equal to the top ideal itself, i.e., $\sqrt{(1)} = (1)$.
Ideal.radical_mono theorem
(H : I ≤ J) : radical I ≤ radical J
Full source
theorem radical_mono (H : I ≤ J) : radical I ≤ radical J := fun _ ⟨n, hrni⟩ => ⟨n, H hrni⟩
Monotonicity of Radical: $\sqrt{I} \subseteq \sqrt{J}$ when $I \subseteq J$
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, if $I \subseteq J$, then the radical of $I$ is contained in the radical of $J$, i.e., $\sqrt{I} \subseteq \sqrt{J}$.
Ideal.radical_idem theorem
: radical (radical I) = radical I
Full source
@[simp]
theorem radical_idem : radical (radical I) = radical I :=
  (radical_isRadical I).radical
Idempotence of Radical: $\sqrt{\sqrt{I}} = \sqrt{I}$
Informal description
For any ideal $I$ in a semiring $R$, the radical of the radical of $I$ is equal to the radical of $I$, i.e., $\sqrt{\sqrt{I}} = \sqrt{I}$.
Ideal.IsRadical.radical_le_iff theorem
(hJ : J.IsRadical) : I.radical ≤ J ↔ I ≤ J
Full source
theorem IsRadical.radical_le_iff (hJ : J.IsRadical) : I.radical ≤ J ↔ I ≤ J :=
  ⟨le_trans le_radical, fun h => hJ.radical ▸ radical_mono h⟩
Radical Ideal Containment Criterion: $\sqrt{I} \subseteq J \leftrightarrow I \subseteq J$ for radical $J$
Informal description
For any radical ideal $J$ in a semiring $R$, the radical of an ideal $I$ is contained in $J$ if and only if $I$ itself is contained in $J$. In other words, $\sqrt{I} \subseteq J \leftrightarrow I \subseteq J$.
Ideal.radical_le_radical_iff theorem
: radical I ≤ radical J ↔ I ≤ radical J
Full source
theorem radical_le_radical_iff : radicalradical I ≤ radical J ↔ I ≤ radical J :=
  (radical_isRadical J).radical_le_iff
Radical Containment Criterion: $\sqrt{I} \subseteq \sqrt{J} \leftrightarrow I \subseteq \sqrt{J}$
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the radical of $I$ is contained in the radical of $J$ if and only if $I$ is contained in the radical of $J$. In other words, $\sqrt{I} \subseteq \sqrt{J} \leftrightarrow I \subseteq \sqrt{J}$.
Ideal.radical_eq_top theorem
: radical I = ⊤ ↔ I = ⊤
Full source
theorem radical_eq_top : radicalradical I = ⊤ ↔ I = ⊤ :=
  ⟨fun h =>
    (eq_top_iff_one _).2 <|
      let ⟨n, hn⟩ := (eq_top_iff_one _).1 h
      @one_pow R _ n ▸ hn,
    fun h => h.symm ▸ radical_top R⟩
Radical of Ideal Equals Top Ideal if and only if Ideal is Top Ideal
Informal description
For an ideal $I$ in a semiring $R$, the radical of $I$ equals the top ideal $\top$ if and only if $I$ itself equals $\top$. In other words, $\sqrt{I} = (1)$ if and only if $I = (1)$.
Ideal.IsPrime.isRadical theorem
(H : IsPrime I) : I.IsRadical
Full source
theorem IsPrime.isRadical (H : IsPrime I) : I.IsRadical := fun _ ⟨n, hrni⟩ =>
  H.mem_of_pow_mem n hrni
Prime Ideals are Radical
Informal description
If $I$ is a prime ideal in a ring $R$, then $I$ is a radical ideal. That is, for any $r \in R$ and $n \in \mathbb{N}$, if $r^n \in I$, then $r \in I$.
Ideal.IsPrime.radical theorem
(H : IsPrime I) : radical I = I
Full source
theorem IsPrime.radical (H : IsPrime I) : radical I = I :=
  IsRadical.radical H.isRadical
Radical of a Prime Ideal Equals Itself
Informal description
If $I$ is a prime ideal in a ring $R$, then the radical of $I$ is equal to $I$ itself, i.e., $\sqrt{I} = I$.
Ideal.mem_radical_of_pow_mem theorem
{I : Ideal R} {x : R} {m : ℕ} (hx : x ^ m ∈ radical I) : x ∈ radical I
Full source
theorem mem_radical_of_pow_mem {I : Ideal R} {x : R} {m : } (hx : x ^ m ∈ radical I) :
    x ∈ radical I :=
  radical_idem I ▸ ⟨m, hx⟩
Radical Ideal Membership via Powers: $x^m \in \sqrt{I} \Rightarrow x \in \sqrt{I}$
Informal description
For any ideal $I$ in a semiring $R$, if $x^m$ belongs to the radical of $I$ for some natural number $m$, then $x$ itself belongs to the radical of $I$.
Ideal.disjoint_powers_iff_not_mem theorem
(y : R) (hI : I.IsRadical) : Disjoint (Submonoid.powers y : Set R) ↑I ↔ y ∉ I.1
Full source
theorem disjoint_powers_iff_not_mem (y : R) (hI : I.IsRadical) :
    DisjointDisjoint (Submonoid.powers y : Set R) ↑I ↔ y ∉ I.1 := by
  refine ⟨fun h => Set.disjoint_left.1 h (Submonoid.mem_powers _),
      fun h => disjoint_iff.mpr (eq_bot_iff.mpr ?_)⟩
  rintro x ⟨⟨n, rfl⟩, hx'⟩
  exact h (hI <| mem_radical_of_pow_mem <| le_radical hx')
Disjointness of Powers Submonoid and Radical Ideal: $\{y^n\} \cap I = \emptyset \leftrightarrow y \notin I$
Informal description
For any element $y$ in a semiring $R$ and a radical ideal $I$ of $R$, the submonoid generated by the powers of $y$ is disjoint from $I$ if and only if $y$ does not belong to $I$. In other words, the sets $\{y^n \mid n \in \mathbb{N}\}$ and $I$ have empty intersection precisely when $y \notin I$.
Ideal.radical_sup theorem
: radical (I ⊔ J) = radical (radical I ⊔ radical J)
Full source
theorem radical_sup : radical (I ⊔ J) = radical (radicalradical I ⊔ radical J) :=
  le_antisymm (radical_mono <| sup_le_sup le_radical le_radical) <|
    radical_le_radical_iff.2 <| sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
Radical of Supremum Equals Radical of Supremum of Radicals: $\sqrt{I \sqcup J} = \sqrt{\sqrt{I} \sqcup \sqrt{J}}$
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the radical of their supremum equals the radical of the supremum of their radicals, i.e., $\sqrt{I \sqcup J} = \sqrt{\sqrt{I} \sqcup \sqrt{J}}$.
Ideal.radical_inf theorem
: radical (I ⊓ J) = radical I ⊓ radical J
Full source
theorem radical_inf : radical (I ⊓ J) = radicalradical I ⊓ radical J :=
  le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
    fun r ⟨⟨m, hrm⟩, ⟨n, hrn⟩⟩ =>
    ⟨m + n, (pow_add r m n).symm ▸ I.mul_mem_right _ hrm,
      (pow_add r m n).symm ▸ J.mul_mem_left _ hrn⟩
Radical of Intersection Equals Intersection of Radicals
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the radical of their intersection equals the intersection of their radicals, i.e., $\sqrt{I \cap J} = \sqrt{I} \cap \sqrt{J}$.
Ideal.IsRadical.inf theorem
(hI : IsRadical I) (hJ : IsRadical J) : IsRadical (I ⊓ J)
Full source
theorem IsRadical.inf (hI : IsRadical I) (hJ : IsRadical J) : IsRadical (I ⊓ J) := by
  rw [IsRadical, radical_inf]; exact inf_le_inf hI hJ
Intersection of Radical Ideals is Radical
Informal description
If $I$ and $J$ are radical ideals in a semiring $R$, then their intersection $I \cap J$ is also a radical ideal.
Ideal.radicalInfTopHom definition
: InfTopHom (Ideal R) (Ideal R)
Full source
/-- `Ideal.radical` as an `InfTopHom`, bundling in that it distributes over `inf`. -/
def radicalInfTopHom : InfTopHom (Ideal R) (Ideal R) where
  toFun := radical
  map_inf' := radical_inf
  map_top' := radical_top _
Radical as an infimum- and top-preserving homomorphism
Informal description
The function that maps an ideal $I$ in a semiring $R$ to its radical $\sqrt{I}$, viewed as an infimum- and top-preserving homomorphism on the lattice of ideals. Specifically, it satisfies $\sqrt{I \cap J} = \sqrt{I} \cap \sqrt{J}$ for any two ideals $I$ and $J$, and $\sqrt{(1)} = (1)$.
Ideal.radicalInfTopHom_apply theorem
(I : Ideal R) : radicalInfTopHom I = radical I
Full source
@[simp]
lemma radicalInfTopHom_apply (I : Ideal R) : radicalInfTopHom I = radical I := rfl
Radical Homomorphism Application Equals Radical of Ideal
Informal description
For any ideal $I$ in a semiring $R$, the application of the radical homomorphism to $I$ equals the radical of $I$, i.e., $\text{radicalInfTopHom}(I) = \sqrt{I}$.
Ideal.radical_finset_inf theorem
{ι} {s : Finset ι} {f : ι → Ideal R} {i : ι} (hi : i ∈ s) (hs : ∀ ⦃y⦄, y ∈ s → (f y).radical = (f i).radical) : (s.inf f).radical = (f i).radical
Full source
lemma radical_finset_inf {ι} {s : Finset ι} {f : ι → Ideal R} {i : ι} (hi : i ∈ s)
    (hs : ∀ ⦃y⦄, y ∈ s → (f y).radical = (f i).radical) :
    (s.inf f).radical = (f i).radical := by
  rw [← radicalInfTopHom_apply, map_finset_inf, ← Finset.inf'_eq_inf ⟨_, hi⟩]
  exact Finset.inf'_eq_of_forall _ _ hs
Radical of Finite Infimum of Ideals with Common Radical
Informal description
Let $R$ be a semiring, $\iota$ a finite index set, $s \subseteq \iota$ a finite subset, and $f : \iota \to \text{Ideal}(R)$ a family of ideals. Suppose there exists an index $i \in s$ such that for all $y \in s$, the radicals of $f(y)$ and $f(i)$ are equal. Then the radical of the infimum of the ideals $\{f(y)\}_{y \in s}$ equals the radical of $f(i)$, i.e., \[ \sqrt{\bigsqcap_{y \in s} f(y)} = \sqrt{f(i)}. \]
Ideal.radical_iInf_le theorem
{ι} (I : ι → Ideal R) : radical (⨅ i, I i) ≤ ⨅ i, radical (I i)
Full source
/-- The reverse inclusion does not hold for e.g. `I := fun n : ℕ ↦ Ideal.span {(2 ^ n : ℤ)}`. -/
theorem radical_iInf_le {ι} (I : ι → Ideal R) : radical (⨅ i, I i) ≤ ⨅ i, radical (I i) :=
  le_iInf fun _ ↦ radical_mono (iInf_le _ _)
Radical of Infimum of Ideals is Contained in Infimum of Radicals
Informal description
For any family of ideals $(I_i)_{i \in \iota}$ in a semiring $R$, the radical of their infimum is contained in the infimum of their radicals, i.e., \[ \sqrt{\bigsqcap_i I_i} \leq \bigsqcap_i \sqrt{I_i}. \]
Ideal.isRadical_iInf theorem
{ι} (I : ι → Ideal R) (hI : ∀ i, IsRadical (I i)) : IsRadical (⨅ i, I i)
Full source
theorem isRadical_iInf {ι} (I : ι → Ideal R) (hI : ∀ i, IsRadical (I i)) : IsRadical (⨅ i, I i) :=
  (radical_iInf_le I).trans (iInf_mono hI)
Infimum of Radical Ideals is Radical
Informal description
For any family of ideals $(I_i)_{i \in \iota}$ in a semiring $R$, if each $I_i$ is a radical ideal, then their infimum $\bigsqcap_i I_i$ is also a radical ideal.
Ideal.radical_mul theorem
: radical (I * J) = radical I ⊓ radical J
Full source
theorem radical_mul : radical (I * J) = radicalradical I ⊓ radical J := by
  refine le_antisymm ?_ fun r ⟨⟨m, hrm⟩, ⟨n, hrn⟩⟩ =>
    ⟨m + n, (pow_add r m n).symm ▸ mul_mem_mul hrm hrn⟩
  have := radical_mono <| @mul_le_inf _ _ I J
  simp_rw [radical_inf I J] at this
  assumption
Radical of Product Ideal Equals Intersection of Radicals: $\sqrt{I \cdot J} = \sqrt{I} \cap \sqrt{J}$
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, the radical of their product equals the intersection of their radicals, i.e., \[ \sqrt{I \cdot J} = \sqrt{I} \cap \sqrt{J}. \]
Ideal.IsPrime.radical_le_iff theorem
(hJ : IsPrime J) : I.radical ≤ J ↔ I ≤ J
Full source
theorem IsPrime.radical_le_iff (hJ : IsPrime J) : I.radical ≤ J ↔ I ≤ J :=
  IsRadical.radical_le_iff hJ.isRadical
Prime Ideal Containment Criterion for Radicals: $\sqrt{I} \subseteq J \leftrightarrow I \subseteq J$ for prime $J$
Informal description
For a prime ideal $J$ in a semiring $R$, the radical of an ideal $I$ is contained in $J$ if and only if $I$ itself is contained in $J$. That is, \[ \sqrt{I} \subseteq J \leftrightarrow I \subseteq J. \]
Ideal.radical_eq_sInf theorem
(I : Ideal R) : radical I = sInf {J : Ideal R | I ≤ J ∧ IsPrime J}
Full source
theorem radical_eq_sInf (I : Ideal R) : radical I = sInf { J : Ideal R | I ≤ J ∧ IsPrime J } :=
  le_antisymm (le_sInf fun _ hJ ↦ hJ.2.radical_le_iff.2 hJ.1) fun r hr ↦
    by_contradiction fun hri ↦
      let ⟨m, hIm, hm⟩ :=
        zorn_le_nonempty₀ { K : Ideal R | r ∉ radical K }
          (fun c hc hcc y hyc =>
            ⟨sSup c, fun ⟨n, hrnc⟩ =>
              let ⟨_, hyc, hrny⟩ := (Submodule.mem_sSup_of_directed ⟨y, hyc⟩ hcc.directedOn).1 hrnc
              hc hyc ⟨n, hrny⟩,
              fun _ => le_sSup⟩)
          I hri
      have hrm : r ∉ radical m := hm.prop
      have : ∀ x ∉ m, r ∈ radical (m ⊔ span {x}) := fun x hxm =>
        by_contradiction fun hrmx => hxm <| by
          rw [hm.eq_of_le hrmx le_sup_left]
          exact Submodule.mem_sup_right <| mem_span_singleton_self x
      have : IsPrime m :=
        ⟨by rintro rfl; rw [radical_top] at hrm; exact hrm trivial, fun {x y} hxym =>
          or_iff_not_imp_left.2 fun hxm =>
            by_contradiction fun hym =>
              let ⟨n, hrn⟩ := this _ hxm
              let ⟨p, hpm, q, hq, hpqrn⟩ := Submodule.mem_sup.1 hrn
              let ⟨c, hcxq⟩ := mem_span_singleton'.1 hq
              let ⟨k, hrk⟩ := this _ hym
              let ⟨f, hfm, g, hg, hfgrk⟩ := Submodule.mem_sup.1 hrk
              let ⟨d, hdyg⟩ := mem_span_singleton'.1 hg
              hrm
                ⟨n + k, by
                  rw [pow_add, ← hpqrn, ← hcxq, ← hfgrk, ← hdyg, add_mul, mul_add (c * x),
                      mul_assoc c x (d * y), mul_left_comm x, ← mul_assoc]
                  refine
                    m.add_mem (m.mul_mem_right _ hpm)
                    (m.add_mem (m.mul_mem_left _ hfm) (m.mul_mem_left _ hxym))⟩⟩
    hrm <|
      this.radical.symm ▸ (sInf_le ⟨hIm, this⟩ : sInf { J : Ideal R | I ≤ J ∧ IsPrime J } ≤ m) hr
Radical as Infimum of Containing Prime Ideals: $\sqrt{I} = \bigcap \{J \text{ prime} \mid I \subseteq J\}$
Informal description
For any ideal $I$ in a semiring $R$, the radical of $I$ is equal to the infimum of all prime ideals $J$ containing $I$, i.e., \[ \sqrt{I} = \bigcap \{J \text{ prime ideal} \mid I \subseteq J\}. \]
Ideal.isRadical_bot_of_noZeroDivisors theorem
{R} [CommSemiring R] [NoZeroDivisors R] : (⊥ : Ideal R).IsRadical
Full source
theorem isRadical_bot_of_noZeroDivisors {R} [CommSemiring R] [NoZeroDivisors R] :
    ( : Ideal R).IsRadical := fun _ hx => hx.recOn fun _ hn => pow_eq_zero hn
Zero Ideal is Radical in a Commutative Semiring without Zero Divisors
Informal description
In a commutative semiring $R$ with no zero divisors, the zero ideal $\{0\}$ is a radical ideal.
Ideal.radical_bot_of_noZeroDivisors theorem
{R : Type u} [CommSemiring R] [NoZeroDivisors R] : radical (⊥ : Ideal R) = ⊥
Full source
@[simp]
theorem radical_bot_of_noZeroDivisors {R : Type u} [CommSemiring R] [NoZeroDivisors R] :
    radical ( : Ideal R) =  :=
  eq_bot_iff.2 isRadical_bot_of_noZeroDivisors
Radical of Zero Ideal in a Commutative Semiring without Zero Divisors
Informal description
In a commutative semiring $R$ with no zero divisors, the radical of the zero ideal $\{0\}$ is equal to the zero ideal itself, i.e., $\sqrt{(0)} = (0)$.
Ideal.instIdemCommSemiring instance
: IdemCommSemiring (Ideal R)
Full source
instance : IdemCommSemiring (Ideal R) :=
  inferInstance
Idempotent Commutative Semiring Structure on Ideals
Informal description
The set of ideals in a semiring $R$ forms an idempotent commutative semiring, where the addition is given by the sum of ideals and the multiplication is given by the product of ideals.
Ideal.top_pow theorem
(n : ℕ) : (⊤ ^ n : Ideal R) = ⊤
Full source
theorem top_pow (n : ) : ( ^ n : Ideal R) =  :=
  Nat.recOn n one_eq_top fun n ih => by rw [pow_succ, ih, top_mul]
Top Ideal is Idempotent under Power Operation: $\top^n = \top$
Informal description
For any natural number $n$, the $n$-th power of the top ideal $\top$ in a semiring $R$ is equal to $\top$, i.e., $\top^n = \top$.
Ideal.natCast_eq_top theorem
{n : ℕ} (hn : n ≠ 0) : (n : Ideal R) = ⊤
Full source
theorem natCast_eq_top {n : } (hn : n ≠ 0) : (n : Ideal R) =  :=
  natCast_eq_one hn |>.trans one_eq_top
Ideal Generated by Nonzero Natural Number is Whole Ring
Informal description
For any nonzero natural number $n$, the ideal generated by $n$ in a semiring $R$ is equal to the entire ring, i.e., $(n) = \top$.
Ideal.ofNat_eq_top theorem
{n : ℕ} [n.AtLeastTwo] : (ofNat(n) : Ideal R) = ⊤
Full source
/-- `3 : Ideal R` is *not* the ideal generated by 3 (which would be spelt
    `Ideal.span {3}`), it is simply `1 + 1 + 1 = ⊤`. -/
theorem ofNat_eq_top {n : } [n.AtLeastTwo] : (ofNat(n) : Ideal R) =  :=
  ofNat_eq_one.trans one_eq_top
Ideal Generated by Numeral ≥ 2 is Whole Ring
Informal description
For any natural number $n \geq 2$, the ideal generated by the numeral $n$ in a semiring $R$ is equal to the entire ring, i.e., $(n) = \top$.
Ideal.radical_pow theorem
: ∀ {n}, n ≠ 0 → radical (I ^ n) = radical I
Full source
lemma radical_pow : ∀ {n}, n ≠ 0radical (I ^ n) = radical I
  | 1, _ => by simp
  | n + 2, _ => by rw [pow_succ, radical_mul, radical_pow n.succ_ne_zero, inf_idem]
Radical of Ideal Power: $\sqrt{I^n} = \sqrt{I}$ for $n \neq 0$
Informal description
For any nonzero natural number $n$, the radical of the $n$-th power of an ideal $I$ in a semiring $R$ is equal to the radical of $I$, i.e., $\sqrt{I^n} = \sqrt{I}$.
Ideal.IsPrime.mul_le theorem
{I J P : Ideal R} (hp : IsPrime P) : I * J ≤ P ↔ I ≤ P ∨ J ≤ P
Full source
theorem IsPrime.mul_le {I J P : Ideal R} (hp : IsPrime P) : I * J ≤ P ↔ I ≤ P ∨ J ≤ P := by
  rw [or_comm, Ideal.mul_le]
  simp_rw [hp.mul_mem_iff_mem_or_mem, SetLike.le_def, ← forall_or_left, or_comm, forall_or_left]
Prime Ideal Product Containment Criterion: $I \cdot J \leq P \leftrightarrow I \leq P \lor J \leq P$
Informal description
Let $I$, $J$, and $P$ be ideals in a ring $R$, with $P$ being a prime ideal. Then the product ideal $I \cdot J$ is contained in $P$ if and only if either $I$ is contained in $P$ or $J$ is contained in $P$.
Ideal.IsPrime.inf_le theorem
{I J P : Ideal R} (hp : IsPrime P) : I ⊓ J ≤ P ↔ I ≤ P ∨ J ≤ P
Full source
theorem IsPrime.inf_le {I J P : Ideal R} (hp : IsPrime P) : I ⊓ JI ⊓ J ≤ P ↔ I ≤ P ∨ J ≤ P :=
  ⟨fun h ↦ hp.mul_le.1 <| mul_le_inf.trans h, fun h ↦ h.elim inf_le_left.trans inf_le_right.trans⟩
Prime Ideal Intersection Containment Criterion: $I \cap J \leq P \leftrightarrow I \leq P \lor J \leq P$
Informal description
Let $I$, $J$, and $P$ be ideals in a ring $R$, with $P$ being a prime ideal. Then the intersection $I \cap J$ is contained in $P$ if and only if either $I$ is contained in $P$ or $J$ is contained in $P$.
Ideal.IsPrime.multiset_prod_le theorem
{s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) : s.prod ≤ P ↔ ∃ I ∈ s, I ≤ P
Full source
theorem IsPrime.multiset_prod_le {s : Multiset (Ideal R)} {P : Ideal R} (hp : IsPrime P) :
    s.prod ≤ P ↔ ∃ I ∈ s, I ≤ P :=
  s.induction_on (by simp [hp.ne_top]) fun I s ih ↦ by simp [hp.mul_le, ih]
Prime Ideal Criterion for Multiset Product Containment: $\prod s \leq P \leftrightarrow \exists I \in s, I \leq P$
Informal description
Let $s$ be a multiset of ideals in a ring $R$, and let $P$ be a prime ideal in $R$. Then the product of all ideals in $s$ is contained in $P$ if and only if there exists an ideal $I \in s$ such that $I$ is contained in $P$.
Ideal.IsPrime.multiset_prod_map_le theorem
{s : Multiset ι} (f : ι → Ideal R) {P : Ideal R} (hp : IsPrime P) : (s.map f).prod ≤ P ↔ ∃ i ∈ s, f i ≤ P
Full source
theorem IsPrime.multiset_prod_map_le {s : Multiset ι} (f : ι → Ideal R) {P : Ideal R}
    (hp : IsPrime P) : (s.map f).prod ≤ P ↔ ∃ i ∈ s, f i ≤ P := by
  simp_rw [hp.multiset_prod_le, Multiset.mem_map, exists_exists_and_eq_and]
Prime Ideal Criterion for Mapped Multiset Product Containment: $\prod (f \circ s) \leq P \leftrightarrow \exists i \in s, f(i) \leq P$
Informal description
Let $s$ be a multiset of elements of type $\iota$, $f : \iota \to \text{Ideal}(R)$ a function mapping elements to ideals, and $P$ a prime ideal in $R$. Then the product of the ideals in the multiset $s.map(f)$ is contained in $P$ if and only if there exists an element $i \in s$ such that the ideal $f(i)$ is contained in $P$.
Ideal.IsPrime.multiset_prod_mem_iff_exists_mem theorem
{I : Ideal R} (hI : I.IsPrime) (s : Multiset R) : s.prod ∈ I ↔ ∃ p ∈ s, p ∈ I
Full source
theorem IsPrime.multiset_prod_mem_iff_exists_mem {I : Ideal R} (hI : I.IsPrime) (s : Multiset R) :
    s.prod ∈ Is.prod ∈ I ↔ ∃ p ∈ s, p ∈ I := by
  simpa [span_singleton_le_iff_mem] using (hI.multiset_prod_map_le (span {·}))
Prime Ideal Criterion for Multiset Product Membership: $\prod s \in I \leftrightarrow \exists p \in s, p \in I$
Informal description
Let $I$ be a prime ideal in a ring $R$ and let $s$ be a multiset of elements in $R$. The product of all elements in $s$ belongs to $I$ if and only if there exists an element $p \in s$ such that $p \in I$.
Ideal.IsPrime.pow_le_iff theorem
{I P : Ideal R} [hP : P.IsPrime] {n : ℕ} (hn : n ≠ 0) : I ^ n ≤ P ↔ I ≤ P
Full source
theorem IsPrime.pow_le_iff {I P : Ideal R} [hP : P.IsPrime] {n : } (hn : n ≠ 0) :
    I ^ n ≤ P ↔ I ≤ P := by
  have h : (Multiset.replicate n I).prod ≤ P ↔ _ := hP.multiset_prod_le
  simp_rw [Multiset.prod_replicate, Multiset.mem_replicate, ne_eq, hn, not_false_eq_true,
    true_and, exists_eq_left] at h
  exact h
Prime Ideal Containment Criterion for Powers: $I^n \subseteq P \leftrightarrow I \subseteq P$
Informal description
Let $I$ and $P$ be ideals in a ring $R$ with $P$ prime, and let $n$ be a nonzero natural number. Then $I^n \subseteq P$ if and only if $I \subseteq P$.
Ideal.IsPrime.le_of_pow_le theorem
{I P : Ideal R} [hP : P.IsPrime] {n : ℕ} (h : I ^ n ≤ P) : I ≤ P
Full source
theorem IsPrime.le_of_pow_le {I P : Ideal R} [hP : P.IsPrime] {n : } (h : I ^ n ≤ P) :
    I ≤ P := by
  by_cases hn : n = 0
  · rw [hn, pow_zero, one_eq_top] at h
    exact fun ⦃_⦄ _ ↦ h Submodule.mem_top
  · exact (pow_le_iff hn).mp h
Prime Ideal Containment Implication: $I^n \subseteq P \Rightarrow I \subseteq P$
Informal description
Let $I$ and $P$ be ideals in a ring $R$ with $P$ prime, and let $n$ be a natural number. If $I^n \subseteq P$, then $I \subseteq P$.
Ideal.IsPrime.prod_le theorem
{s : Finset ι} {f : ι → Ideal R} {P : Ideal R} (hp : IsPrime P) : s.prod f ≤ P ↔ ∃ i ∈ s, f i ≤ P
Full source
theorem IsPrime.prod_le {s : Finset ι} {f : ι → Ideal R} {P : Ideal R} (hp : IsPrime P) :
    s.prod f ≤ P ↔ ∃ i ∈ s, f i ≤ P :=
  hp.multiset_prod_map_le f
Prime Ideal Criterion for Finite Product Containment: $\prod_{i \in s} f(i) \subseteq P \leftrightarrow \exists i \in s, f(i) \subseteq P$
Informal description
Let $R$ be a semiring, $s$ a finite set, $f : \iota \to \text{Ideal}(R)$ a function mapping elements to ideals, and $P$ a prime ideal in $R$. Then the product of the ideals $\prod_{i \in s} f(i)$ is contained in $P$ if and only if there exists an element $i \in s$ such that the ideal $f(i)$ is contained in $P$.
Ideal.IsPrime.prod_mem_iff theorem
{s : Finset ι} {x : ι → R} {p : Ideal R} [hp : p.IsPrime] : ∏ i ∈ s, x i ∈ p ↔ ∃ i ∈ s, x i ∈ p
Full source
/-- The product of a finite number of elements in the commutative semiring `R` lies in the
  prime ideal `p` if and only if at least one of those elements is in `p`. -/
theorem IsPrime.prod_mem_iff {s : Finset ι} {x : ι → R} {p : Ideal R} [hp : p.IsPrime] :
    ∏ i ∈ s, x i∏ i ∈ s, x i ∈ p∏ i ∈ s, x i ∈ p ↔ ∃ i ∈ s, x i ∈ p := by
  simp_rw [← span_singleton_le_iff_mem, ← prod_span_singleton]
  exact hp.prod_le
Prime Ideal Criterion for Finite Product Membership: $\prod_{i \in s} x_i \in p \leftrightarrow \exists i \in s, x_i \in p$
Informal description
Let $R$ be a commutative semiring, $p$ a prime ideal in $R$, and $s$ a finite set. For any family of elements $(x_i)_{i \in s}$ in $R$, the product $\prod_{i \in s} x_i$ belongs to $p$ if and only if there exists some $i \in s$ such that $x_i \in p$.
Ideal.IsPrime.prod_mem_iff_exists_mem theorem
{I : Ideal R} (hI : I.IsPrime) (s : Finset R) : s.prod (fun x ↦ x) ∈ I ↔ ∃ p ∈ s, p ∈ I
Full source
theorem IsPrime.prod_mem_iff_exists_mem {I : Ideal R} (hI : I.IsPrime) (s : Finset R) :
    s.prod (fun x ↦ x) ∈ Is.prod (fun x ↦ x) ∈ I ↔ ∃ p ∈ s, p ∈ I := by
  rw [Finset.prod_eq_multiset_prod, Multiset.map_id']
  exact hI.multiset_prod_mem_iff_exists_mem s.val
Prime Ideal Criterion for Finite Product Membership: $\prod_{p \in s} p \in I \leftrightarrow \exists p \in s, p \in I$
Informal description
Let $I$ be a prime ideal in a ring $R$ and let $s$ be a finite set of elements in $R$. The product of all elements in $s$ belongs to $I$ if and only if there exists an element $p \in s$ such that $p \in I$.
Ideal.IsPrime.inf_le' theorem
{s : Finset ι} {f : ι → Ideal R} {P : Ideal R} (hp : IsPrime P) : s.inf f ≤ P ↔ ∃ i ∈ s, f i ≤ P
Full source
theorem IsPrime.inf_le' {s : Finset ι} {f : ι → Ideal R} {P : Ideal R} (hp : IsPrime P) :
    s.inf f ≤ P ↔ ∃ i ∈ s, f i ≤ P :=
  ⟨fun h ↦ hp.prod_le.1 <| prod_le_inf.trans h, fun ⟨_, his, hip⟩ ↦ (Finset.inf_le his).trans hip⟩
Prime Ideal Criterion for Finite Infimum Containment: $\inf_{i \in s} f(i) \subseteq P \leftrightarrow \exists i \in s, f(i) \subseteq P$
Informal description
Let $R$ be a semiring, $s$ a finite set, $f : \iota \to \text{Ideal}(R)$ a function mapping elements to ideals, and $P$ a prime ideal in $R$. Then the infimum of the ideals $\inf_{i \in s} f(i)$ is contained in $P$ if and only if there exists an element $i \in s$ such that the ideal $f(i)$ is contained in $P$.
Ideal.subset_union theorem
{R : Type u} [Ring R] {I J K : Ideal R} : (I : Set R) ⊆ J ∪ K ↔ I ≤ J ∨ I ≤ K
Full source
theorem subset_union {R : Type u} [Ring R] {I J K : Ideal R} :
    (I : Set R) ⊆ J ∪ K(I : Set R) ⊆ J ∪ K ↔ I ≤ J ∨ I ≤ K :=
  AddSubgroupClass.subset_union
Union of Ideals Criterion: $I \subseteq J \cup K \iff I \subseteq J \lor I \subseteq K$
Informal description
For any ideals $I$, $J$, and $K$ in a ring $R$, the set inclusion $I \subseteq J \cup K$ holds if and only if either $I \subseteq J$ or $I \subseteq K$.
Ideal.subset_union_prime' theorem
{R : Type u} [CommRing R] {s : Finset ι} {f : ι → Ideal R} {a b : ι} (hp : ∀ i ∈ s, IsPrime (f i)) {I : Ideal R} : ((I : Set R) ⊆ f a ∪ f b ∪ ⋃ i ∈ (↑s : Set ι), f i) ↔ I ≤ f a ∨ I ≤ f b ∨ ∃ i ∈ s, I ≤ f i
Full source
theorem subset_union_prime' {R : Type u} [CommRing R] {s : Finset ι} {f : ι → Ideal R} {a b : ι}
    (hp : ∀ i ∈ s, IsPrime (f i)) {I : Ideal R} :
    ((I : Set R) ⊆ f a ∪ f b ∪ ⋃ i ∈ (↑s : Set ι), f i) ↔ I ≤ f a ∨ I ≤ f b ∨ ∃ i ∈ s, I ≤ f i := by
  suffices
    ((I : Set R) ⊆ f a ∪ f b ∪ ⋃ i ∈ (↑s : Set ι), f i) → I ≤ f a ∨ I ≤ f b ∨ ∃ i ∈ s, I ≤ f i from
    ⟨this, fun h =>
      Or.casesOn h
        (fun h =>
          Set.Subset.trans h <|
            Set.Subset.trans Set.subset_union_left Set.subset_union_left)
        fun h =>
        Or.casesOn h
          (fun h =>
            Set.Subset.trans h <|
              Set.Subset.trans Set.subset_union_right Set.subset_union_left)
          fun ⟨i, his, hi⟩ => by
          refine Set.Subset.trans hi <| Set.Subset.trans ?_ Set.subset_union_right
          exact Set.subset_biUnion_of_mem (u := fun x ↦ (f x : Set R)) (Finset.mem_coe.2 his)⟩
  generalize hn : s.card = n; intro h
  induction' n with n ih generalizing a b s
  · clear hp
    rw [Finset.card_eq_zero] at hn
    subst hn
    rw [Finset.coe_empty, Set.biUnion_empty, Set.union_empty, subset_union] at h
    simpa only [exists_prop, Finset.not_mem_empty, false_and, exists_false, or_false]
  classical
    replace hn : ∃ (i : ι) (t : Finset ι), i ∉ t ∧ insert i t = s ∧ t.card = n :=
      Finset.card_eq_succ.1 hn
    rcases hn with ⟨i, t, hit, rfl, hn⟩
    replace hp : IsPrimeIsPrime (f i) ∧ ∀ x ∈ t, IsPrime (f x) := (t.forall_mem_insert _ _).1 hp
    by_cases Ht : ∃ j ∈ t, f j ≤ f i
    · obtain ⟨j, hjt, hfji⟩ : ∃ j ∈ t, f j ≤ f i := Ht
      obtain ⟨u, hju, rfl⟩ : ∃ u, j ∉ u ∧ insert j u = t :=
        ⟨t.erase j, t.not_mem_erase j, Finset.insert_erase hjt⟩
      have hp' : ∀ k ∈ insert i u, IsPrime (f k) := by
        rw [Finset.forall_mem_insert] at hp ⊢
        exact ⟨hp.1, hp.2.2⟩
      have hiu : i ∉ u := mt Finset.mem_insert_of_mem hit
      have hn' : (insert i u).card = n := by
        rwa [Finset.card_insert_of_not_mem] at hn ⊢
        exacts [hiu, hju]
      have h' : (I : Set R) ⊆ f a ∪ f b ∪ ⋃ k ∈ (↑(insert i u) : Set ι), f k := by
        rw [Finset.coe_insert] at h ⊢
        rw [Finset.coe_insert] at h
        simp only [Set.biUnion_insert] at h ⊢
        rw [← Set.union_assoc (f i : Set R),
            Set.union_eq_self_of_subset_right hfji] at h
        exact h
      specialize ih hp' hn' h'
      refine ih.imp id (Or.imp id (Exists.imp fun k => ?_))
      exact And.imp (fun hk => Finset.insert_subset_insert i (Finset.subset_insert j u) hk) id
    by_cases Ha : f a ≤ f i
    · have h' : (I : Set R) ⊆ f i ∪ f b ∪ ⋃ j ∈ (↑t : Set ι), f j := by
        rw [Finset.coe_insert, Set.biUnion_insert, ← Set.union_assoc,
          Set.union_right_comm (f a : Set R),
          Set.union_eq_self_of_subset_left Ha] at h
        exact h
      specialize ih hp.2 hn h'
      right
      rcases ih with (ih | ih | ⟨k, hkt, ih⟩)
      · exact Or.inr ⟨i, Finset.mem_insert_self i t, ih⟩
      · exact Or.inl ih
      · exact Or.inr ⟨k, Finset.mem_insert_of_mem hkt, ih⟩
    by_cases Hb : f b ≤ f i
    · have h' : (I : Set R) ⊆ f a ∪ f i ∪ ⋃ j ∈ (↑t : Set ι), f j := by
        rw [Finset.coe_insert, Set.biUnion_insert, ← Set.union_assoc,
          Set.union_assoc (f a : Set R),
          Set.union_eq_self_of_subset_left Hb] at h
        exact h
      specialize ih hp.2 hn h'
      rcases ih with (ih | ih | ⟨k, hkt, ih⟩)
      · exact Or.inl ih
      · exact Or.inr (Or.inr ⟨i, Finset.mem_insert_self i t, ih⟩)
      · exact Or.inr (Or.inr ⟨k, Finset.mem_insert_of_mem hkt, ih⟩)
    by_cases Hi : I ≤ f i
    · exact Or.inr (Or.inr ⟨i, Finset.mem_insert_self i t, Hi⟩)
    have : ¬I ⊓ f a ⊓ f b ⊓ t.inf f ≤ f i := by
      simp only [hp.1.inf_le, hp.1.inf_le', not_or]
      exact ⟨⟨⟨Hi, Ha⟩, Hb⟩, Ht⟩
    rcases Set.not_subset.1 this with ⟨r, ⟨⟨⟨hrI, hra⟩, hrb⟩, hr⟩, hri⟩
    by_cases HI : (I : Set R) ⊆ f a ∪ f b ∪ ⋃ j ∈ (↑t : Set ι), f j
    · specialize ih hp.2 hn HI
      rcases ih with (ih | ih | ⟨k, hkt, ih⟩)
      · left
        exact ih
      · right
        left
        exact ih
      · right
        right
        exact ⟨k, Finset.mem_insert_of_mem hkt, ih⟩
    exfalso
    rcases Set.not_subset.1 HI with ⟨s, hsI, hs⟩
    rw [Finset.coe_insert, Set.biUnion_insert] at h
    have hsi : s ∈ f i := ((h hsI).resolve_left (mt Or.inl hs)).resolve_right (mt Or.inr hs)
    rcases h (I.add_mem hrI hsI) with (⟨ha | hb⟩ | hi | ht)
    · exact hs (Or.inl <| Or.inl <| add_sub_cancel_left r s ▸ (f a).sub_mem ha hra)
    · exact hs (Or.inl <| Or.inr <| add_sub_cancel_left r s ▸ (f b).sub_mem hb hrb)
    · exact hri (add_sub_cancel_right r s ▸ (f i).sub_mem hi hsi)
    · rw [Set.mem_iUnion₂] at ht
      rcases ht with ⟨j, hjt, hj⟩
      simp only [Finset.inf_eq_iInf, SetLike.mem_coe, Submodule.mem_iInf] at hr
      exact hs <| Or.inr <| Set.mem_biUnion hjt <|
        add_sub_cancel_left r s ▸ (f j).sub_mem hj <| hr j hjt
Prime Ideal Union Criterion: $I \subseteq P_a \cup P_b \cup \bigcup_{i \in s} P_i \iff I \subseteq P_a \lor I \subseteq P_b \lor \exists i \in s, I \subseteq P_i$
Informal description
Let $R$ be a commutative ring, $s$ a finite set, and $f : \iota \to \text{Ideal}(R)$ a function assigning to each index an ideal of $R$. Let $a, b \in \iota$ and assume that for every $i \in s$, the ideal $f(i)$ is prime. Then for any ideal $I$ of $R$, the following are equivalent: 1. The set inclusion $I \subseteq f(a) \cup f(b) \cup \left( \bigcup_{i \in s} f(i) \right)$ holds. 2. Either $I \subseteq f(a)$, or $I \subseteq f(b)$, or there exists $i \in s$ such that $I \subseteq f(i)$.
Ideal.subset_union_prime theorem
{R : Type u} [CommRing R] {s : Finset ι} {f : ι → Ideal R} (a b : ι) (hp : ∀ i ∈ s, i ≠ a → i ≠ b → IsPrime (f i)) {I : Ideal R} : ((I : Set R) ⊆ ⋃ i ∈ (↑s : Set ι), f i) ↔ ∃ i ∈ s, I ≤ f i
Full source
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Matsumura Ex.1.6. -/
@[stacks 00DS]
theorem subset_union_prime {R : Type u} [CommRing R] {s : Finset ι} {f : ι → Ideal R} (a b : ι)
    (hp : ∀ i ∈ s, i ≠ a → i ≠ b → IsPrime (f i)) {I : Ideal R} :
    ((I : Set R) ⊆ ⋃ i ∈ (↑s : Set ι), f i) ↔ ∃ i ∈ s, I ≤ f i :=
  suffices ((I : Set R) ⊆ ⋃ i ∈ (↑s : Set ι), f i) → ∃ i, i ∈ s ∧ I ≤ f i by
    have aux := fun h => (bex_def.2 <| this h)
    simp_rw [exists_prop] at aux
    refine ⟨aux, fun ⟨i, his, hi⟩ ↦ Set.Subset.trans hi ?_⟩
    apply Set.subset_biUnion_of_mem (show i ∈ (↑s : Set ι) from his)
  fun h : (I : Set R) ⊆ ⋃ i ∈ (↑s : Set ι), f i => by
  classical
    by_cases has : a ∈ s
    · obtain ⟨t, hat, rfl⟩ : ∃ t, a ∉ t ∧ insert a t = s :=
        ⟨s.erase a, Finset.not_mem_erase a s, Finset.insert_erase has⟩
      by_cases hbt : b ∈ t
      · obtain ⟨u, hbu, rfl⟩ : ∃ u, b ∉ u ∧ insert b u = t :=
          ⟨t.erase b, Finset.not_mem_erase b t, Finset.insert_erase hbt⟩
        have hp' : ∀ i ∈ u, IsPrime (f i) := by
          intro i hiu
          refine hp i (Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hiu)) ?_ ?_ <;>
              rintro rfl <;>
            solve_by_elim only [Finset.mem_insert_of_mem, *]
        rw [Finset.coe_insert, Finset.coe_insert, Set.biUnion_insert, Set.biUnion_insert, ←
          Set.union_assoc, subset_union_prime' hp'] at h
        rwa [Finset.exists_mem_insert, Finset.exists_mem_insert]
      · have hp' : ∀ j ∈ t, IsPrime (f j) := by
          intro j hj
          refine hp j (Finset.mem_insert_of_mem hj) ?_ ?_ <;> rintro rfl <;>
            solve_by_elim only [Finset.mem_insert_of_mem, *]
        rw [Finset.coe_insert, Set.biUnion_insert, ← Set.union_self (f a : Set R),
          subset_union_prime' hp', ← or_assoc, or_self_iff] at h
        rwa [Finset.exists_mem_insert]
    · by_cases hbs : b ∈ s
      · obtain ⟨t, hbt, rfl⟩ : ∃ t, b ∉ t ∧ insert b t = s :=
          ⟨s.erase b, Finset.not_mem_erase b s, Finset.insert_erase hbs⟩
        have hp' : ∀ j ∈ t, IsPrime (f j) := by
          intro j hj
          refine hp j (Finset.mem_insert_of_mem hj) ?_ ?_ <;> rintro rfl <;>
            solve_by_elim only [Finset.mem_insert_of_mem, *]
        rw [Finset.coe_insert, Set.biUnion_insert, ← Set.union_self (f b : Set R),
          subset_union_prime' hp', ← or_assoc, or_self_iff] at h
        rwa [Finset.exists_mem_insert]
      rcases s.eq_empty_or_nonempty with hse | hsne
      · subst hse
        rw [Finset.coe_empty, Set.biUnion_empty, Set.subset_empty_iff] at h
        have : (I : Set R) ≠ ∅ := Set.Nonempty.ne_empty (Set.nonempty_of_mem I.zero_mem)
        exact absurd h this
      · obtain ⟨i, his⟩ := hsne
        obtain ⟨t, _, rfl⟩ : ∃ t, i ∉ t ∧ insert i t = s :=
          ⟨s.erase i, Finset.not_mem_erase i s, Finset.insert_erase his⟩
        have hp' : ∀ j ∈ t, IsPrime (f j) := by
          intro j hj
          refine hp j (Finset.mem_insert_of_mem hj) ?_ ?_ <;> rintro rfl <;>
            solve_by_elim only [Finset.mem_insert_of_mem, *]
        rw [Finset.coe_insert, Set.biUnion_insert, ← Set.union_self (f i : Set R),
          subset_union_prime' hp', ← or_assoc, or_self_iff] at h
        rwa [Finset.exists_mem_insert]
Prime Avoidance Lemma for Ideals: $I \subseteq \bigcup_{i \in s} P_i \iff \exists i \in s, I \subseteq P_i$
Informal description
Let $R$ be a commutative ring, $s$ a finite set, and $f : \iota \to \text{Ideal}(R)$ a function assigning to each index an ideal of $R$. Let $a, b \in \iota$ and assume that for every $i \in s$ with $i \neq a$ and $i \neq b$, the ideal $f(i)$ is prime. Then for any ideal $I$ of $R$, the following are equivalent: 1. The set inclusion $I \subseteq \bigcup_{i \in s} f(i)$ holds. 2. There exists $i \in s$ such that $I \subseteq f(i)$.
Ideal.le_of_dvd theorem
{I J : Ideal R} : I ∣ J → J ≤ I
Full source
/-- If `I` divides `J`, then `I` contains `J`.

In a Dedekind domain, to divide and contain are equivalent, see `Ideal.dvd_iff_le`.
-/
theorem le_of_dvd {I J : Ideal R} : I ∣ J → J ≤ I
  | ⟨_, h⟩ => h.symm ▸ le_trans mul_le_inf inf_le_left
Inclusion of Ideal from Divisibility: $I \mid J \implies J \subseteq I$
Informal description
For any two ideals $I$ and $J$ in a semiring $R$, if $I$ divides $J$ (i.e., there exists an ideal $K$ such that $J = I \cdot K$), then $J$ is contained in $I$ (i.e., $J \subseteq I$).
Ideal.isUnit_iff theorem
{I : Ideal R} : IsUnit I ↔ I = ⊤
Full source
/-- See also `isUnit_iff_eq_one`. -/
@[simp high]
theorem isUnit_iff {I : Ideal R} : IsUnitIsUnit I ↔ I = ⊤ :=
  isUnit_iff_dvd_one.trans
    ((@one_eq_top R _).symm⟨fun h => eq_top_iff.mpr (Ideal.le_of_dvd h), fun h => ⟨⊤, by rw [mul_top, h]⟩⟩)
Characterization of Unit Ideals: $I$ is a unit if and only if $I = \top$
Informal description
An ideal $I$ in a semiring $R$ is a unit (i.e., invertible) if and only if $I$ is equal to the entire ring $R$ (i.e., $I = \top$).
Ideal.uniqueUnits instance
: Unique (Ideal R)ˣ
Full source
instance uniqueUnits : Unique (Ideal R)ˣ where
  default := 1
  uniq u := Units.ext (show (u : Ideal R) = 1 by rw [isUnit_iff.mp u.isUnit, one_eq_top])
Uniqueness of Units in the Ideal Monoid
Informal description
For any semiring $R$, the group of units of the monoid of ideals of $R$ is trivial (i.e., has exactly one element).
Ideal.finsuppTotal definition
: (ι →₀ I) →ₗ[R] M
Full source
/-- A variant of `Finsupp.linearCombination` that takes in vectors valued in `I`. -/
noncomputable def finsuppTotal : (ι →₀ I) →ₗ[R] M :=
  (Finsupp.linearCombination R v).comp (Finsupp.mapRange.linearMap I.subtype)
Linear combination with coefficients in an ideal
Informal description
Given a semiring $R$, an $R$-module $M$, an ideal $I$ of $R$, and a family of vectors $v : \iota \to M$, the function `Ideal.finsuppTotal` maps a finitely supported function $f : \iota \to I$ to the linear combination $\sum_{i \in \iota} (f(i) : R) \cdot v(i)$ in $M$. This is a variant of `Finsupp.linearCombination` where the coefficients are restricted to lie in the ideal $I$.
Ideal.finsuppTotal_apply theorem
(f : ι →₀ I) : finsuppTotal ι M I v f = f.sum fun i x => (x : R) • v i
Full source
theorem finsuppTotal_apply (f : ι →₀ I) :
    finsuppTotal ι M I v f = f.sum fun i x => (x : R) • v i := by
  dsimp [finsuppTotal]
  rw [Finsupp.linearCombination_apply, Finsupp.sum_mapRange_index]
  exact fun _ => zero_smul _ _
Evaluation of Linear Combination with Ideal Coefficients: $\text{finsuppTotal}(f) = \sum_i f(i) \cdot v_i$
Informal description
For any finitely supported function $f \colon \iota \to I$ with coefficients in an ideal $I$ of a semiring $R$, the linear combination $\text{finsuppTotal}_{\iota,M,I,v}(f)$ is equal to the sum $\sum_{i \in \iota} (f(i) : R) \cdot v(i)$, where $v \colon \iota \to M$ is a family of vectors in an $R$-module $M$.
Ideal.finsuppTotal_apply_eq_of_fintype theorem
[Fintype ι] (f : ι →₀ I) : finsuppTotal ι M I v f = ∑ i, (f i : R) • v i
Full source
theorem finsuppTotal_apply_eq_of_fintype [Fintype ι] (f : ι →₀ I) :
    finsuppTotal ι M I v f = ∑ i, (f i : R) • v i := by
  rw [finsuppTotal_apply, Finsupp.sum_fintype]
  exact fun _ => zero_smul _ _
Finite Linear Combination Formula for Ideal Coefficients: $\text{finsuppTotal}(f) = \sum_i f(i) \cdot v_i$
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $I$ an ideal of $R$, and $\iota$ a finite type. For any finitely supported function $f \colon \iota \to I$, the linear combination $\text{finsuppTotal}_{\iota,M,I,v}(f)$ equals the finite sum $\sum_{i \in \iota} (f(i) : R) \cdot v(i)$, where $v \colon \iota \to M$ is a family of vectors in $M$.
Ideal.range_finsuppTotal theorem
: LinearMap.range (finsuppTotal ι M I v) = I • Submodule.span R (Set.range v)
Full source
theorem range_finsuppTotal :
    LinearMap.range (finsuppTotal ι M I v) = I • Submodule.span R (Set.range v) := by
  ext
  rw [Submodule.mem_ideal_smul_span_iff_exists_sum]
  refine ⟨fun ⟨f, h⟩ => ⟨Finsupp.mapRange.linearMap I.subtype f, fun i => (f i).2, h⟩, ?_⟩
  rintro ⟨a, ha, rfl⟩
  classical
    refine ⟨a.mapRange (fun r => if h : r ∈ I then ⟨r, h⟩ else 0)
      (by simp only [Submodule.zero_mem, ↓reduceDIte]; rfl), ?_⟩
    rw [finsuppTotal_apply, Finsupp.sum_mapRange_index]
    · apply Finsupp.sum_congr
      intro i _
      rw [dif_pos (ha i)]
    · exact fun _ => zero_smul _ _
Range of Linear Combination Map with Ideal Coefficients Equals Ideal-Scalar Multiple of Span
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $I$ an ideal of $R$, and $v \colon \iota \to M$ a family of vectors in $M$. The range of the linear map $\text{finsuppTotal}_{\iota,M,I,v}$ is equal to the submodule $I \cdot \operatorname{span}_R(\mathrm{range}(v))$, where $\text{finsuppTotal}_{\iota,M,I,v}$ maps a finitely supported function $f \colon \iota \to I$ to the linear combination $\sum_{i \in \iota} (f(i) : R) \cdot v(i)$. In mathematical notation: \[ \mathrm{range}(\text{finsuppTotal}_{\iota,M,I,v}) = I \cdot \operatorname{span}_R(\mathrm{range}(v)) \]
Finsupp.mem_ideal_span_range_iff_exists_finsupp theorem
{x : R} {v : α → R} : x ∈ Ideal.span (Set.range v) ↔ ∃ c : α →₀ R, (c.sum fun i a => a * v i) = x
Full source
theorem Finsupp.mem_ideal_span_range_iff_exists_finsupp {x : R} {v : α → R} :
    x ∈ Ideal.span (Set.range v)x ∈ Ideal.span (Set.range v) ↔ ∃ c : α →₀ R, (c.sum fun i a => a * v i) = x :=
  Finsupp.mem_span_range_iff_exists_finsupp
Characterization of Ideal Membership via Finitely Supported Functions
Informal description
An element $x$ of a ring $R$ belongs to the ideal generated by the range of a function $v : \alpha \to R$ if and only if there exists a finitely supported function $c : \alpha \to R$ such that the sum $\sum_{i \in \alpha} c(i) \cdot v(i)$ equals $x$.
Ideal.mem_span_range_iff_exists_fun theorem
[Fintype α] {x : R} {v : α → R} : x ∈ Ideal.span (Set.range v) ↔ ∃ c : α → R, ∑ i, c i * v i = x
Full source
/-- An element `x` lies in the span of `v` iff it can be written as sum `∑ cᵢ • vᵢ = x`.
-/
theorem Ideal.mem_span_range_iff_exists_fun [Fintype α] {x : R} {v : α → R} :
    x ∈ Ideal.span (Set.range v)x ∈ Ideal.span (Set.range v) ↔ ∃ c : α → R, ∑ i, c i * v i = x :=
  Submodule.mem_span_range_iff_exists_fun _
Characterization of Ideal Membership via Finite Linear Combinations
Informal description
Let $R$ be a semiring, $\alpha$ a finite type, $v \colon \alpha \to R$ a function, and $x \in R$. Then $x$ belongs to the ideal generated by the range of $v$ if and only if there exists a function $c \colon \alpha \to R$ such that $x = \sum_{i \in \alpha} c_i \cdot v_i$.
Associates.mk_ne_zero' theorem
{R : Type*} [CommSemiring R] {r : R} : Associates.mk (Ideal.span { r } : Ideal R) ≠ 0 ↔ r ≠ 0
Full source
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
    Associates.mkAssociates.mk (Ideal.span {r} : Ideal R) ≠ 0Associates.mk (Ideal.span {r} : Ideal R) ≠ 0 ↔ r ≠ 0 := by
  rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne, Ideal.span_singleton_eq_bot]
Nonzero Ideal Generated by Singleton in Associates if and only if Element is Nonzero
Informal description
For any element $r$ in a commutative semiring $R$, the ideal generated by $\{r\}$ is nonzero in the associates of $R$ if and only if $r$ is nonzero, i.e., $\mathrm{Associates.mk}(\mathrm{span}(\{r\})) \neq 0 \leftrightarrow r \neq 0$.
Ideal.span_singleton_nonZeroDivisors theorem
{R : Type*} [CommSemiring R] [NoZeroDivisors R] {r : R} : span { r } ∈ (Ideal R)⁰ ↔ r ∈ R⁰
Full source
theorem Ideal.span_singleton_nonZeroDivisors {R : Type*} [CommSemiring R] [NoZeroDivisors R]
    {r : R} : spanspan {r} ∈ (Ideal R)⁰span {r} ∈ (Ideal R)⁰ ↔ r ∈ R⁰ := by
  cases subsingleton_or_nontrivial R
  · exact ⟨fun _ _ _ ↦ Subsingleton.eq_zero _, fun _ _ _ ↦ Subsingleton.eq_zero _⟩
  · rw [mem_nonZeroDivisors_iff_ne_zero, mem_nonZeroDivisors_iff_ne_zero, ne_eq, zero_eq_bot,
      span_singleton_eq_bot]
Non-zero-divisor property of principal ideals: $\mathrm{span}(\{r\}) \in (Ideal R)^\times \leftrightarrow r \in R^\times$
Informal description
Let $R$ be a commutative semiring with no zero divisors. For any element $r \in R$, the ideal generated by $\{r\}$ is a non-zero-divisor in the semiring of ideals of $R$ if and only if $r$ is a non-zero-divisor in $R$. In other words, $\mathrm{span}(\{r\})$ is a non-zero-divisor ideal if and only if $r$ is a non-zero-divisor element.
Ideal.primeCompl_le_nonZeroDivisors theorem
{R : Type*} [CommSemiring R] [NoZeroDivisors R] (P : Ideal R) [P.IsPrime] : P.primeCompl ≤ nonZeroDivisors R
Full source
theorem Ideal.primeCompl_le_nonZeroDivisors {R : Type*} [CommSemiring R] [NoZeroDivisors R]
    (P : Ideal R) [P.IsPrime] : P.primeComplnonZeroDivisors R :=
  le_nonZeroDivisors_of_noZeroDivisors <| not_not_intro P.zero_mem
Complement of Prime Ideal Consists of Non-Zero Divisors
Informal description
Let $R$ be a commutative semiring with no zero divisors, and let $P$ be a prime ideal of $R$. Then the complement $P^c$ of $P$ is contained in the set of non-zero divisors of $R$.
Submodule.moduleSubmodule instance
: Module (Ideal R) (Submodule R M)
Full source
instance moduleSubmodule : Module (Ideal R) (Submodule R M) where
  smul_add := smul_sup
  add_smul := sup_smul
  mul_smul := Submodule.mul_smul
  one_smul := by simp
  zero_smul := bot_smul
  smul_zero := smul_bot
Module Structure of Submodules over Ideals
Informal description
For a semiring $R$ and an $R$-module $M$, the collection of submodules of $M$ forms a module over the semiring of ideals of $R$. This means that for any ideal $I$ of $R$ and any submodule $N$ of $M$, the scalar multiplication $I \cdot N$ is well-defined and satisfies the module axioms.
Submodule.span_smul_eq theorem
(s : Set R) (N : Submodule R M) : Ideal.span s • N = s • N
Full source
lemma span_smul_eq
    (s : Set R) (N : Submodule R M) :
    Ideal.span s • N = s • N := by
  rw [← coe_set_smul, coe_span_smul]
Equality of Ideal-Submodule Product and Set-Submodule Product
Informal description
Let $R$ be a semiring, $M$ an $R$-module, $s$ a subset of $R$, and $N$ a submodule of $M$. Then the product of the ideal generated by $s$ with $N$ is equal to the product of $s$ with $N$, i.e., $(\operatorname{span}_R s) \cdot N = s \cdot N$.
Submodule.set_smul_top_eq_span theorem
(s : Set R) : s • ⊤ = Ideal.span s
Full source
@[simp]
theorem set_smul_top_eq_span (s : Set R) :
    s •  = Ideal.span s :=
  (span_smul_eq s ).symm.trans (Ideal.span s).mul_top
Product of Set with Top Submodule Equals Ideal Span
Informal description
For any subset $s$ of a semiring $R$, the product of $s$ with the top submodule $\top$ is equal to the ideal generated by $s$, i.e., $s \cdot \top = \operatorname{span}_R s$.
Submodule.algebraIdeal instance
: Algebra (Ideal R) (Submodule R A)
Full source
instance algebraIdeal : Algebra (Ideal R) (Submodule R A) where
  __ := moduleSubmodule
  algebraMap :=
  { toFun := map (Algebra.linearMap R A)
    map_one' := by
      rw [one_eq_span, map_span, Set.image_singleton, Algebra.linearMap_apply, map_one, one_eq_span]
    map_mul' := (Submodule.map_mul · · <| Algebra.ofId R A)
    map_zero' := map_bot _
    map_add' := (map_sup · · _) }
  commutes' I M := mul_comm_of_commute <| by rintro _ ⟨r, _, rfl⟩ a _; apply Algebra.commutes
  smul_def' I M := le_antisymm (smul_le.mpr fun r hr a ha ↦ by
    rw [Algebra.smul_def]; exact Submodule.mul_mem_mul ⟨r, hr, rfl⟩ ha) (Submodule.mul_le.mpr <| by
    rintro _ ⟨r, hr, rfl⟩ a ha; rw [Algebra.linearMap_apply, ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hr ha)
Algebra Structure of Submodules over Ideals
Informal description
For a semiring $R$ and an $R$-algebra $A$, the collection of submodules of $A$ forms an algebra over the semiring of ideals of $R$. This means that there is a canonical algebra structure where the ideals of $R$ act on the submodules of $A$ via scalar multiplication.
Submodule.mapAlgHom definition
(f : A →ₐ[R] B) : Submodule R A →ₐ[Ideal R] Submodule R B
Full source
/-- `Submonoid.map` as an `AlgHom`, when applied to an `AlgHom`. -/
@[simps!] def mapAlgHom (f : A →ₐ[R] B) : SubmoduleSubmodule R A →ₐ[Ideal R] Submodule R B where
  __ := mapHom f
  commutes' I := (map_comp _ _ I).symm.trans (congr_arg (map · I) <| LinearMap.ext f.commutes)
Algebra homomorphism between submodules induced by an algebra homomorphism
Informal description
Given an algebra homomorphism $f \colon A \to B$ over a semiring $R$, the function `Submodule.mapAlgHom f` maps a submodule $M$ of $A$ to its image under $f$ in $B$, and this mapping is itself an algebra homomorphism over the semiring of ideals of $R$. More precisely, for any ideal $I$ of $R$, the image of the scalar multiplication $I \cdot M$ under $f$ coincides with the scalar multiplication $I \cdot f(M)$ in $B$.
Submodule.mapAlgEquiv definition
(f : A ≃ₐ[R] B) : Submodule R A ≃ₐ[Ideal R] Submodule R B
Full source
/-- `Submonoid.map` as an `AlgEquiv`, when applied to an `AlgEquiv`. -/
-- TODO: when A, B noncommutative, still has `MulEquiv`.
@[simps!] def mapAlgEquiv (f : A ≃ₐ[R] B) : SubmoduleSubmodule R A ≃ₐ[Ideal R] Submodule R B where
  __ := mapAlgHom f
  invFun := mapAlgHom f.symm
  left_inv I := (map_comp _ _ I).symm.trans <|
    (congr_arg (map · I) <| LinearMap.ext (f.left_inv ·)).trans (map_id I)
  right_inv I := (map_comp _ _ I).symm.trans <|
    (congr_arg (map · I) <| LinearMap.ext (f.right_inv ·)).trans (map_id I)
Algebra equivalence between submodules induced by an algebra equivalence
Informal description
Given an algebra equivalence $f \colon A \simeq B$ over a semiring $R$, the function `Submodule.mapAlgEquiv f` maps a submodule $M$ of $A$ to its image under $f$ in $B$, and this mapping is itself an algebra equivalence over the semiring of ideals of $R$. More precisely, for any ideal $I$ of $R$, the image of the scalar multiplication $I \cdot M$ under $f$ coincides with the scalar multiplication $I \cdot f(M)$ in $B$, and this correspondence is bijective with inverse given by applying $f^{-1}$.
instNonUnitalSubsemiringClassIdeal instance
{R} [Semiring R] : NonUnitalSubsemiringClass (Ideal R) R
Full source
instance {R} [Semiring R] : NonUnitalSubsemiringClass (Ideal R) R where
  mul_mem _ hb := Ideal.mul_mem_left _ _ hb
Ideals as Non-Unital Subsemirings
Informal description
For any semiring $R$, the ideals of $R$ form a class of non-unital subsemirings of $R$.
instNonUnitalSubringClassIdeal instance
{R} [Ring R] : NonUnitalSubringClass (Ideal R) R
Full source
instance {R} [Ring R] : NonUnitalSubringClass (Ideal R) R where
Ideals as Non-Unital Subrings
Informal description
For any ring $R$, the ideals of $R$ form a class of non-unital subrings of $R$.