doc-next-gen

Mathlib.Algebra.Ring.Subring.Basic

Module docstring

{"# Subrings

We prove that subrings are a complete lattice, and that you can map (pushforward) and comap (pull back) them along ring homomorphisms.

We define the closure construction from Set R to Subring R, sending a subset of R to the subring it generates, and prove that it is a Galois insertion.

Main definitions

Notation used here:

(R : Type u) [Ring R] (S : Type u) [Ring S] (f g : R →+* S) (A : Subring R) (B : Subring S) (s : Set R)

  • instance : CompleteLattice (Subring R) : the complete lattice structure on the subrings.

  • Subring.center : the center of a ring R.

  • Subring.closure : subring closure of a set, i.e., the smallest subring that includes the set.

  • Subring.gi : closure : Set M → Subring M and coercion (↑) : Subring M → et M form a GaloisInsertion.

  • comap f B : Subring A : the preimage of a subring B along the ring homomorphism f

  • map f A : Subring B : the image of a subring A along the ring homomorphism f.

  • prod A B : Subring (R × S) : the product of subrings

  • f.range : Subring B : the range of the ring homomorphism f.

  • eqLocus f g : Subring R : given ring homomorphisms f g : R →+* S, the subring of R where f x = g x

Implementation notes

A subring is implemented as a subsemiring which is also an additive subgroup. The initial PR was as a submonoid which is also an additive subgroup.

Lattice inclusion (e.g. and ) is used rather than set notation ( and ), although is defined as membership of a subring's underlying set.

Tags

subring, subrings ","## top ","## comap ","## map ","## range ","## bot ","## inf ","## Center of a ring ","## subring closure of a subset ","## Actions by Subrings

These are just copies of the definitions about Subsemiring starting from Subsemiring.MulAction.

When R is commutative, Algebra.ofSubring provides a stronger result than those found in this file, which uses the same scalar action. "}

Subring.toSubsemiring_strictMono theorem
: StrictMono (toSubsemiring : Subring R → Subsemiring R)
Full source
@[mono]
theorem toSubsemiring_strictMono : StrictMono (toSubsemiring : Subring R → Subsemiring R) :=
  fun _ _ => id
Strict Monotonicity of Subring to Subsemiring Conversion
Informal description
The function that maps a subring $S$ of a ring $R$ to its underlying subsemiring is strictly monotone. That is, for any two subrings $S$ and $T$ of $R$, if $S < T$ (as subrings), then the subsemiring corresponding to $S$ is strictly contained in the subsemiring corresponding to $T$.
Subring.toSubsemiring_mono theorem
: Monotone (toSubsemiring : Subring R → Subsemiring R)
Full source
@[mono]
theorem toSubsemiring_mono : Monotone (toSubsemiring : Subring R → Subsemiring R) :=
  toSubsemiring_strictMono.monotone
Monotonicity of Subring to Subsemiring Conversion
Informal description
The function that maps a subring $S$ of a ring $R$ to its underlying subsemiring is monotone. That is, for any two subrings $S$ and $T$ of $R$, if $S \leq T$ (as subrings), then the subsemiring corresponding to $S$ is contained in the subsemiring corresponding to $T$.
Subring.toSubsemiring_lt_toSubsemiring theorem
(hst : s < t) : s.toSubsemiring < t.toSubsemiring
Full source
@[gcongr]
lemma toSubsemiring_lt_toSubsemiring (hst : s < t) : s.toSubsemiring < t.toSubsemiring := hst
Strict Inclusion of Subrings Implies Strict Inclusion of Subsemirings
Informal description
For any two subrings $s$ and $t$ of a ring $R$, if $s$ is strictly contained in $t$ (i.e., $s < t$), then the underlying subsemiring of $s$ is strictly contained in the underlying subsemiring of $t$.
Subring.toSubsemiring_le_toSubsemiring theorem
(hst : s ≤ t) : s.toSubsemiring ≤ t.toSubsemiring
Full source
@[gcongr]
lemma toSubsemiring_le_toSubsemiring (hst : s ≤ t) : s.toSubsemiring ≤ t.toSubsemiring := hst
Subring Inclusion Implies Subsemiring Inclusion
Informal description
For any two subrings $s$ and $t$ of a ring $R$, if $s$ is contained in $t$ (i.e., $s \leq t$), then the underlying subsemiring of $s$ is contained in the underlying subsemiring of $t$ (i.e., $s.\text{toSubsemiring} \leq t.\text{toSubsemiring}$).
Subring.toAddSubgroup_strictMono theorem
: StrictMono (toAddSubgroup : Subring R → AddSubgroup R)
Full source
@[mono]
theorem toAddSubgroup_strictMono : StrictMono (toAddSubgroup : Subring R → AddSubgroup R) :=
  fun _ _ => id
Strict Monotonicity of Subring to Additive Subgroup Map
Informal description
The function that maps a subring $S$ of a ring $R$ to its underlying additive subgroup is strictly monotone. That is, for any two subrings $S$ and $T$ of $R$, if $S < T$ (strict inclusion), then the additive subgroup corresponding to $S$ is strictly contained in the additive subgroup corresponding to $T$.
Subring.toAddSubgroup_mono theorem
: Monotone (toAddSubgroup : Subring R → AddSubgroup R)
Full source
@[mono]
theorem toAddSubgroup_mono : Monotone (toAddSubgroup : Subring R → AddSubgroup R) :=
  toAddSubgroup_strictMono.monotone
Monotonicity of Subring to Additive Subgroup Map
Informal description
The function that maps a subring $S$ of a ring $R$ to its underlying additive subgroup is monotone. That is, for any two subrings $S$ and $T$ of $R$, if $S \leq T$ (inclusion), then the additive subgroup corresponding to $S$ is contained in the additive subgroup corresponding to $T$.
Subring.toAddSubgroup_lt_toAddSubgroup theorem
(hst : s < t) : s.toAddSubgroup < t.toAddSubgroup
Full source
@[gcongr]
lemma toAddSubgroup_lt_toAddSubgroup (hst : s < t) : s.toAddSubgroup < t.toAddSubgroup := hst
Strict Containment of Additive Subgroups Corresponds to Strict Containment of Subrings
Informal description
For any two subrings $s$ and $t$ of a ring $R$, if $s$ is strictly contained in $t$ (i.e., $s < t$), then the underlying additive subgroup of $s$ is strictly contained in the underlying additive subgroup of $t$ (i.e., $s.\text{toAddSubgroup} < t.\text{toAddSubgroup}$).
Subring.toAddSubgroup_le_toAddSubgroup theorem
(hst : s ≤ t) : s.toAddSubgroup ≤ t.toAddSubgroup
Full source
@[gcongr]
lemma toAddSubgroup_le_toAddSubgroup (hst : s ≤ t) : s.toAddSubgroup ≤ t.toAddSubgroup := hst
Monotonicity of Subring-to-Additive-Subgroup Mapping
Informal description
For any two subrings $s$ and $t$ of a ring $R$, if $s$ is contained in $t$ (i.e., $s \leq t$), then the underlying additive subgroup of $s$ is contained in the underlying additive subgroup of $t$.
Subring.toSubmonoid_strictMono theorem
: StrictMono (fun s : Subring R => s.toSubmonoid)
Full source
@[mono]
theorem toSubmonoid_strictMono : StrictMono (fun s : Subring R => s.toSubmonoid) := fun _ _ => id
Strict Monotonicity of Subring-to-Submonoid Mapping
Informal description
The function that maps a subring $s$ of a ring $R$ to its underlying submonoid is strictly monotone. That is, for any two subrings $s$ and $t$ of $R$, if $s < t$ (strictly contained), then the submonoid of $s$ is strictly contained in the submonoid of $t$.
Subring.toSubmonoid_mono theorem
: Monotone (fun s : Subring R => s.toSubmonoid)
Full source
@[mono]
theorem toSubmonoid_mono : Monotone (fun s : Subring R => s.toSubmonoid) :=
  toSubmonoid_strictMono.monotone
Monotonicity of Subring-to-Submonoid Mapping
Informal description
The function that maps a subring $s$ of a ring $R$ to its underlying submonoid is monotone. That is, for any two subrings $s$ and $t$ of $R$, if $s \leq t$ (in the lattice of subrings), then the submonoid of $s$ is contained in the submonoid of $t$.
Subring.list_prod_mem theorem
{l : List R} : (∀ x ∈ l, x ∈ s) → l.prod ∈ s
Full source
/-- Product of a list of elements in a subring is in the subring. -/
protected theorem list_prod_mem {l : List R} : (∀ x ∈ l, x ∈ s) → l.prod ∈ s :=
  list_prod_mem
Subring Closure Under List Product
Informal description
Let $R$ be a ring and $s$ a subring of $R$. For any list $l$ of elements in $R$, if every element $x \in l$ belongs to $s$, then the product of all elements in $l$ (computed in $R$) also belongs to $s$.
Subring.list_sum_mem theorem
{l : List R} : (∀ x ∈ l, x ∈ s) → l.sum ∈ s
Full source
/-- Sum of a list of elements in a subring is in the subring. -/
protected theorem list_sum_mem {l : List R} : (∀ x ∈ l, x ∈ s) → l.sum ∈ s :=
  list_sum_mem
Subring Closure under List Summation
Informal description
Let $R$ be a ring and $s$ a subring of $R$. For any list $l$ of elements of $R$, if every element $x \in l$ belongs to $s$, then the sum of all elements in $l$ also belongs to $s$.
Subring.multiset_prod_mem theorem
{R} [CommRing R] (s : Subring R) (m : Multiset R) : (∀ a ∈ m, a ∈ s) → m.prod ∈ s
Full source
/-- Product of a multiset of elements in a subring of a `CommRing` is in the subring. -/
protected theorem multiset_prod_mem {R} [CommRing R] (s : Subring R) (m : Multiset R) :
    (∀ a ∈ m, a ∈ s) → m.prod ∈ s :=
  multiset_prod_mem _
Subring closure under multiset product in a commutative ring
Informal description
Let $R$ be a commutative ring and $s$ a subring of $R$. For any multiset $m$ of elements in $R$, if every element $a \in m$ belongs to $s$, then the product of all elements in $m$ (computed in $R$) also belongs to $s$.
Subring.multiset_sum_mem theorem
{R} [Ring R] (s : Subring R) (m : Multiset R) : (∀ a ∈ m, a ∈ s) → m.sum ∈ s
Full source
/-- Sum of a multiset of elements in a `Subring` of a `Ring` is
in the `Subring`. -/
protected theorem multiset_sum_mem {R} [Ring R] (s : Subring R) (m : Multiset R) :
    (∀ a ∈ m, a ∈ s) → m.sum ∈ s :=
  multiset_sum_mem _
Sum of Multiset Elements in Subring
Informal description
Let $R$ be a ring and $s$ be a subring of $R$. For any multiset $m$ of elements of $R$, if every element of $m$ belongs to $s$, then the sum of all elements in $m$ also belongs to $s$.
Subring.prod_mem theorem
{R : Type*} [CommRing R] (s : Subring R) {ι : Type*} {t : Finset ι} {f : ι → R} (h : ∀ c ∈ t, f c ∈ s) : (∏ i ∈ t, f i) ∈ s
Full source
/-- Product of elements of a subring of a `CommRing` indexed by a `Finset` is in the
    subring. -/
protected theorem prod_mem {R : Type*} [CommRing R] (s : Subring R) {ι : Type*} {t : Finset ι}
    {f : ι → R} (h : ∀ c ∈ t, f c ∈ s) : (∏ i ∈ t, f i) ∈ s :=
  prod_mem h
Product of Subring Elements over a Finite Set Belongs to Subring
Informal description
Let $R$ be a commutative ring and $s$ a subring of $R$. For any finite index set $t$ and function $f : \iota \to R$, if $f(c) \in s$ for every $c \in t$, then the product $\prod_{i \in t} f(i)$ belongs to $s$.
Subring.sum_mem theorem
{R : Type*} [Ring R] (s : Subring R) {ι : Type*} {t : Finset ι} {f : ι → R} (h : ∀ c ∈ t, f c ∈ s) : (∑ i ∈ t, f i) ∈ s
Full source
/-- Sum of elements in a `Subring` of a `Ring` indexed by a `Finset`
is in the `Subring`. -/
protected theorem sum_mem {R : Type*} [Ring R] (s : Subring R) {ι : Type*} {t : Finset ι}
    {f : ι → R} (h : ∀ c ∈ t, f c ∈ s) : (∑ i ∈ t, f i) ∈ s :=
  sum_mem h
Sum of Subring Elements over a Finite Set Belongs to Subring
Informal description
Let $R$ be a ring and $s$ a subring of $R$. For any finite index set $\iota$ and finite subset $t \subseteq \iota$, given a function $f : \iota \to R$ such that $f(c) \in s$ for every $c \in t$, the sum $\sum_{i \in t} f(i)$ belongs to $s$.
Subring.mem_top theorem
(x : R) : x ∈ (⊤ : Subring R)
Full source
@[simp]
theorem mem_top (x : R) : x ∈ (⊤ : Subring R) :=
  Set.mem_univ x
Membership in the Full Subring of a Ring
Informal description
For any element $x$ in a ring $R$, $x$ belongs to the top subring of $R$ (which is $R$ itself).
Subring.coe_top theorem
: ((⊤ : Subring R) : Set R) = Set.univ
Full source
@[simp]
theorem coe_top : (( : Subring R) : Set R) = Set.univ :=
  rfl
Top Subring as Universal Set
Informal description
The underlying set of the top subring (the entire ring $R$) is equal to the universal set of $R$, i.e., $(\top : \text{Subring } R) = \text{univ}$.
Subring.topEquiv definition
: (⊤ : Subring R) ≃+* R
Full source
/-- The ring equiv between the top element of `Subring R` and `R`. -/
@[simps!]
def topEquiv : (⊤ : Subring R) ≃+* R :=
  Subsemiring.topEquiv
Ring isomorphism between the top subring and the ring
Informal description
The ring isomorphism between the top element of the lattice of subrings of a ring \( R \) (which is \( R \) itself) and \( R \). This equivalence preserves both the additive and multiplicative structures of the ring.
Subring.instFintypeSubtypeMemTop instance
{R : Type*} [Ring R] [Fintype R] : Fintype (⊤ : Subring R)
Full source
instance {R : Type*} [Ring R] [Fintype R] : Fintype ( : Subring R) :=
  inferInstanceAs (Fintype ( : Set R))
Finiteness of the Full Subring in Finite Rings
Informal description
For any finite ring $R$, the top subring (which is $R$ itself) is finite.
Subring.card_top theorem
(R) [Ring R] [Fintype R] : Fintype.card (⊤ : Subring R) = Fintype.card R
Full source
theorem card_top (R) [Ring R] [Fintype R] : Fintype.card ( : Subring R) = Fintype.card R :=
  Fintype.card_congr topEquiv.toEquiv
Cardinality of the Full Subring Equals Cardinality of the Ring
Informal description
For any finite ring $R$, the cardinality of the top subring (which is $R$ itself) is equal to the cardinality of $R$.
Subring.comap definition
{R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) (s : Subring S) : Subring R
Full source
/-- The preimage of a subring along a ring homomorphism is a subring. -/
def comap {R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) (s : Subring S) : Subring R :=
  { s.toSubmonoid.comap (f : R →* S), s.toAddSubgroup.comap (f : R →+ S) with
    carrier := f ⁻¹' s.carrier }
Preimage of a subring under a ring homomorphism
Informal description
Given a ring homomorphism \( f \colon R \to S \) and a subring \( s \) of \( S \), the preimage \( f^{-1}(s) \) forms a subring of \( R \). This subring consists of all elements \( x \in R \) such that \( f(x) \in s \), and it inherits the ring structure from \( R \).
Subring.coe_comap theorem
(s : Subring S) (f : R →+* S) : (s.comap f : Set R) = f ⁻¹' s
Full source
@[simp]
theorem coe_comap (s : Subring S) (f : R →+* S) : (s.comap f : Set R) = f ⁻¹' s :=
  rfl
Preimage of Subring Under Homomorphism Equals Set Preimage
Informal description
For any subring $s$ of a ring $S$ and any ring homomorphism $f \colon R \to S$, the underlying set of the preimage subring $s.\text{comap}\, f$ is equal to the preimage of $s$ under $f$, i.e., $(s.\text{comap}\, f) = f^{-1}(s)$.
Subring.mem_comap theorem
{s : Subring S} {f : R →+* S} {x : R} : x ∈ s.comap f ↔ f x ∈ s
Full source
@[simp]
theorem mem_comap {s : Subring S} {f : R →+* S} {x : R} : x ∈ s.comap fx ∈ s.comap f ↔ f x ∈ s :=
  Iff.rfl
Characterization of Elements in Preimage Subring via Ring Homomorphism
Informal description
Let $R$ and $S$ be rings, $f : R \to S$ a ring homomorphism, and $s$ a subring of $S$. For any element $x \in R$, we have $x$ belongs to the preimage subring $f^{-1}(s)$ if and only if $f(x)$ belongs to $s$.
Subring.comap_comap theorem
(s : Subring T) (g : S →+* T) (f : R →+* S) : (s.comap g).comap f = s.comap (g.comp f)
Full source
theorem comap_comap (s : Subring T) (g : S →+* T) (f : R →+* S) :
    (s.comap g).comap f = s.comap (g.comp f) :=
  rfl
Preimage of Subring under Composition of Ring Homomorphisms
Informal description
Let $R$, $S$, and $T$ be rings, with ring homomorphisms $f \colon R \to S$ and $g \colon S \to T$. For any subring $s$ of $T$, the preimage of the preimage of $s$ under $g$ and $f$ is equal to the preimage of $s$ under the composition $g \circ f$. In other words, $(g^{-1}(s))^{-1}(f) = (g \circ f)^{-1}(s)$.
Subring.map definition
{R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) (s : Subring R) : Subring S
Full source
/-- The image of a subring along a ring homomorphism is a subring. -/
def map {R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) (s : Subring R) : Subring S :=
  { s.toSubmonoid.map (f : R →* S), s.toAddSubgroup.map (f : R →+ S) with
    carrier := f '' s.carrier }
Image of a subring under a ring homomorphism
Informal description
Given a ring homomorphism \( f \colon R \to S \) and a subring \( s \) of \( R \), the image of \( s \) under \( f \) is the subring of \( S \) consisting of all elements of the form \( f(x) \) for \( x \in s \). This subring is constructed by taking the image of the underlying multiplicative submonoid and additive subgroup of \( s \) under \( f \), and its carrier set is precisely the image of the carrier set of \( s \) under \( f \).
Subring.coe_map theorem
(f : R →+* S) (s : Subring R) : (s.map f : Set S) = f '' s
Full source
@[simp]
theorem coe_map (f : R →+* S) (s : Subring R) : (s.map f : Set S) = f '' s :=
  rfl
Image of Subring Under Ring Homomorphism Equals Function Image
Informal description
For any ring homomorphism $f \colon R \to S$ and any subring $s$ of $R$, the underlying set of the image subring $s.map f$ is equal to the image of the underlying set of $s$ under $f$, i.e., $(s.map f : \text{Set } S) = f '' s$.
Subring.mem_map theorem
{f : R →+* S} {s : Subring R} {y : S} : y ∈ s.map f ↔ ∃ x ∈ s, f x = y
Full source
@[simp]
theorem mem_map {f : R →+* S} {s : Subring R} {y : S} : y ∈ s.map fy ∈ s.map f ↔ ∃ x ∈ s, f x = y := Iff.rfl
Characterization of Elements in the Image of a Subring under a Ring Homomorphism
Informal description
For any ring homomorphism $f \colon R \to S$, a subring $s$ of $R$, and an element $y \in S$, we have $y \in s.map(f)$ if and only if there exists $x \in s$ such that $f(x) = y$.
Subring.map_id theorem
: s.map (RingHom.id R) = s
Full source
@[simp]
theorem map_id : s.map (RingHom.id R) = s :=
  SetLike.coe_injective <| Set.image_id _
Identity Mapping Preserves Subring
Informal description
For any subring $s$ of a ring $R$, the image of $s$ under the identity ring homomorphism $\mathrm{id}_R$ is equal to $s$ itself, i.e., $\mathrm{id}_R(s) = s$.
Subring.map_map theorem
(g : S →+* T) (f : R →+* S) : (s.map f).map g = s.map (g.comp f)
Full source
theorem map_map (g : S →+* T) (f : R →+* S) : (s.map f).map g = s.map (g.comp f) :=
  SetLike.coe_injective <| Set.image_image _ _ _
Image of Subring under Composition of Ring Homomorphisms
Informal description
Let $R$, $S$, and $T$ be rings, and let $f \colon R \to S$ and $g \colon S \to T$ be ring homomorphisms. For any subring $s$ of $R$, the image of the image of $s$ under $f$ under $g$ is equal to the image of $s$ under the composition $g \circ f$. In symbols: $$g(f(s)) = (g \circ f)(s).$$
Subring.map_le_iff_le_comap theorem
{f : R →+* S} {s : Subring R} {t : Subring S} : s.map f ≤ t ↔ s ≤ t.comap f
Full source
theorem map_le_iff_le_comap {f : R →+* S} {s : Subring R} {t : Subring S} :
    s.map f ≤ t ↔ s ≤ t.comap f :=
  Set.image_subset_iff
Image-Preimage Order Correspondence for Subrings
Informal description
Let $R$ and $S$ be rings, $f : R \to S$ a ring homomorphism, $s$ a subring of $R$, and $t$ a subring of $S$. Then the image of $s$ under $f$ is contained in $t$ if and only if $s$ is contained in the preimage of $t$ under $f$. In symbols: \[ f(s) \leq t \leftrightarrow s \leq f^{-1}(t). \]
Subring.gc_map_comap theorem
(f : R →+* S) : GaloisConnection (map f) (comap f)
Full source
theorem gc_map_comap (f : R →+* S) : GaloisConnection (map f) (comap f) := fun _ _ =>
  map_le_iff_le_comap
Galois Connection Between Subring Image and Preimage
Informal description
For any ring homomorphism $f \colon R \to S$, the pair of functions `map f` (which sends a subring of $R$ to its image under $f$) and `comap f` (which sends a subring of $S$ to its preimage under $f$) forms a Galois connection. In other words, for any subring $A$ of $R$ and any subring $B$ of $S$, we have: \[ \text{map } f(A) \leq B \quad \text{if and only if} \quad A \leq \text{comap } f(B). \]
Subring.equivMapOfInjective definition
(f : R →+* S) (hf : Function.Injective f) : s ≃+* s.map f
Full source
/-- A subring is isomorphic to its image under an injective function -/
noncomputable def equivMapOfInjective (f : R →+* S) (hf : Function.Injective f) : s ≃+* s.map f :=
  { Equiv.Set.image f s hf with
    map_mul' := fun _ _ => Subtype.ext (f.map_mul _ _)
    map_add' := fun _ _ => Subtype.ext (f.map_add _ _) }
Subring isomorphism via injective ring homomorphism
Informal description
Given an injective ring homomorphism \( f : R \to S \) and a subring \( s \) of \( R \), there exists a ring isomorphism \( s \simeq+* s.map f \) between \( s \) and the image of \( s \) under \( f \). This isomorphism is constructed by restricting \( f \) to \( s \) and using the injectivity of \( f \) to ensure bijectivity.
Subring.coe_equivMapOfInjective_apply theorem
(f : R →+* S) (hf : Function.Injective f) (x : s) : (equivMapOfInjective s f hf x : S) = f x
Full source
@[simp]
theorem coe_equivMapOfInjective_apply (f : R →+* S) (hf : Function.Injective f) (x : s) :
    (equivMapOfInjective s f hf x : S) = f x :=
  rfl
Image of Subring Element under Induced Isomorphism Equals Direct Image
Informal description
Let $R$ and $S$ be rings, $f : R \to S$ an injective ring homomorphism, and $s$ a subring of $R$. For any element $x \in s$, the image of $x$ under the induced isomorphism $s \simeq+* s.map f$ equals $f(x)$ when viewed as an element of $S$.
RingHom.range definition
{R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) : Subring S
Full source
/-- The range of a ring homomorphism, as a subring of the target. See Note [range copy pattern]. -/
def range {R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) : Subring S :=
  (( : Subring R).map f).copy (Set.range f) Set.image_univ.symm
Range of a ring homomorphism
Informal description
Given a ring homomorphism \( f \colon R \to S \), the range of \( f \) is the subring of \( S \) consisting of all elements of the form \( f(x) \) for some \( x \in R \). This is constructed as the image of the entire ring \( R \) (considered as a subring of itself) under \( f \), and its underlying set is precisely the set-theoretic range of \( f \).
RingHom.coe_range theorem
: (f.range : Set S) = Set.range f
Full source
@[simp]
theorem coe_range : (f.range : Set S) = Set.range f :=
  rfl
Range of a Ring Homomorphism as a Set
Informal description
For any ring homomorphism $f \colon R \to S$, the underlying set of the range subring $f.range$ is equal to the set-theoretic range of $f$, i.e., $\{f(x) \mid x \in R\}$.
RingHom.mem_range theorem
{f : R →+* S} {y : S} : y ∈ f.range ↔ ∃ x, f x = y
Full source
@[simp]
theorem mem_range {f : R →+* S} {y : S} : y ∈ f.rangey ∈ f.range ↔ ∃ x, f x = y :=
  Iff.rfl
Characterization of Elements in the Range of a Ring Homomorphism
Informal description
For any ring homomorphism $f \colon R \to S$ and any element $y \in S$, the element $y$ belongs to the range of $f$ if and only if there exists an element $x \in R$ such that $f(x) = y$.
RingHom.range_eq_map theorem
(f : R →+* S) : f.range = Subring.map f ⊤
Full source
theorem range_eq_map (f : R →+* S) : f.range = Subring.map f  := by
  ext
  simp
Range of a Ring Homomorphism as Image of the Full Ring
Informal description
For any ring homomorphism $f \colon R \to S$, the range of $f$ is equal to the image of the entire ring $R$ (considered as a subring of itself) under $f$. In other words, $f.\text{range} = f(R)$.
RingHom.mem_range_self theorem
(f : R →+* S) (x : R) : f x ∈ f.range
Full source
theorem mem_range_self (f : R →+* S) (x : R) : f x ∈ f.range :=
  mem_range.mpr ⟨x, rfl⟩
Image of Element Belongs to Range of Ring Homomorphism
Informal description
For any ring homomorphism $f \colon R \to S$ and any element $x \in R$, the image $f(x)$ belongs to the range of $f$.
RingHom.map_range theorem
: f.range.map g = (g.comp f).range
Full source
theorem map_range : f.range.map g = (g.comp f).range := by
  simpa only [range_eq_map] using ( : Subring R).map_map g f
Image of Range under Composition of Ring Homomorphisms
Informal description
For ring homomorphisms $f \colon R \to S$ and $g \colon S \to T$, the image of the range of $f$ under $g$ equals the range of the composition $g \circ f \colon R \to T$. In symbols: $$ g(f.\text{range}) = (g \circ f).\text{range} $$
RingHom.fintypeRange instance
[Fintype R] [DecidableEq S] (f : R →+* S) : Fintype (range f)
Full source
/-- The range of a ring homomorphism is a fintype, if the domain is a fintype.
Note: this instance can form a diamond with `Subtype.fintype` in the
  presence of `Fintype S`. -/
instance fintypeRange [Fintype R] [DecidableEq S] (f : R →+* S) : Fintype (range f) :=
  Set.fintypeRange f
Finiteness of the Range of a Ring Homomorphism with Finite Domain
Informal description
For any ring homomorphism $f \colon R \to S$ where $R$ is a finite type and $S$ has decidable equality, the range of $f$ is finite.
Subring.instBot instance
: Bot (Subring R)
Full source
instance : Bot (Subring R) :=
  ⟨(Int.castRingHom R).range⟩
Bottom Element in the Subring Lattice
Informal description
For any ring $R$, the subring lattice has a bottom element, which is the subring generated by the image of the canonical ring homomorphism from the integers $\mathbb{Z}$ to $R$.
Subring.instInhabited instance
: Inhabited (Subring R)
Full source
instance : Inhabited (Subring R) :=
  ⟨⊥⟩
Inhabitedness of Subrings
Informal description
For any ring $R$, the lattice of subrings of $R$ is inhabited, meaning there exists at least one subring of $R$.
Subring.coe_bot theorem
: ((⊥ : Subring R) : Set R) = Set.range ((↑) : ℤ → R)
Full source
theorem coe_bot : (( : Subring R) : Set R) = Set.range ((↑) :  → R) :=
  RingHom.coe_range (Int.castRingHom R)
Bottom Subring as Integer Multiples of One
Informal description
The underlying set of the bottom subring of a ring $R$ is equal to the range of the canonical embedding of the integers $\mathbb{Z}$ into $R$, i.e., $(\bot : \text{Subring } R) = \{n \cdot 1_R \mid n \in \mathbb{Z}\}$.
Subring.mem_bot theorem
{x : R} : x ∈ (⊥ : Subring R) ↔ ∃ n : ℤ, ↑n = x
Full source
theorem mem_bot {x : R} : x ∈ (⊥ : Subring R)x ∈ (⊥ : Subring R) ↔ ∃ n : ℤ, ↑n = x :=
  RingHom.mem_range
Characterization of Elements in the Bottom Subring via Integer Images
Informal description
For any element $x$ in a ring $R$, $x$ belongs to the bottom subring $\bot$ of $R$ if and only if there exists an integer $n \in \mathbb{Z}$ such that the canonical image of $n$ in $R$ equals $x$.
Subring.coe_inf theorem
(p p' : Subring R) : ((p ⊓ p' : Subring R) : Set R) = (p : Set R) ∩ p'
Full source
@[simp]
theorem coe_inf (p p' : Subring R) : ((p ⊓ p' : Subring R) : Set R) = (p : Set R) ∩ p' :=
  rfl
Subring Infimum Equals Set Intersection
Informal description
For any two subrings $p$ and $p'$ of a ring $R$, the underlying set of their infimum $p \sqcap p'$ (as subrings) is equal to the intersection of their underlying sets, i.e., $(p \sqcap p') = p \cap p'$ as sets.
Subring.mem_inf theorem
{p p' : Subring R} {x : R} : x ∈ p ⊓ p' ↔ x ∈ p ∧ x ∈ p'
Full source
@[simp]
theorem mem_inf {p p' : Subring R} {x : R} : x ∈ p ⊓ p'x ∈ p ⊓ p' ↔ x ∈ p ∧ x ∈ p' :=
  Iff.rfl
Membership in Intersection of Subrings
Informal description
For any subrings $p$ and $p'$ of a ring $R$, and any element $x \in R$, we have $x \in p \sqcap p'$ if and only if $x \in p$ and $x \in p'$.
Subring.coe_sInf theorem
(S : Set (Subring R)) : ((sInf S : Subring R) : Set R) = ⋂ s ∈ S, ↑s
Full source
@[simp, norm_cast]
theorem coe_sInf (S : Set (Subring R)) : ((sInf S : Subring R) : Set R) = ⋂ s ∈ S, ↑s :=
  rfl
Infimum of Subrings as Intersection of Underlying Sets
Informal description
For any collection $S$ of subrings of a ring $R$, the underlying set of the infimum (greatest lower bound) of $S$ in the lattice of subrings is equal to the intersection of all the underlying sets of the subrings in $S$. In symbols: \[ \bigcap_{s \in S} s = \bigcap \{ s \mid s \in S \} \] where on the left side, $s$ denotes the underlying set of the subring $s$.
Subring.mem_sInf theorem
{S : Set (Subring R)} {x : R} : x ∈ sInf S ↔ ∀ p ∈ S, x ∈ p
Full source
theorem mem_sInf {S : Set (Subring R)} {x : R} : x ∈ sInf Sx ∈ sInf S ↔ ∀ p ∈ S, x ∈ p :=
  Set.mem_iInter₂
Characterization of Membership in Intersection of Subrings
Informal description
For any collection $S$ of subrings of a ring $R$ and any element $x \in R$, $x$ belongs to the infimum (intersection) of $S$ if and only if $x$ is a member of every subring in $S$. In symbols: $$x \in \bigcap S \leftrightarrow \forall p \in S, x \in p$$
Subring.coe_iInf theorem
{ι : Sort*} {S : ι → Subring R} : (↑(⨅ i, S i) : Set R) = ⋂ i, S i
Full source
@[simp, norm_cast]
theorem coe_iInf {ι : Sort*} {S : ι → Subring R} : (↑(⨅ i, S i) : Set R) = ⋂ i, S i := by
  simp only [iInf, coe_sInf, Set.biInter_range]
Infimum of Subrings as Intersection of Underlying Sets
Informal description
For any indexed family of subrings $(S_i)_{i \in \iota}$ of a ring $R$, the underlying set of the infimum of the subrings is equal to the intersection of their underlying sets. That is, \[ \left( \bigsqcap_{i \in \iota} S_i \right) = \bigcap_{i \in \iota} S_i. \]
Subring.mem_iInf theorem
{ι : Sort*} {S : ι → Subring R} {x : R} : (x ∈ ⨅ i, S i) ↔ ∀ i, x ∈ S i
Full source
theorem mem_iInf {ι : Sort*} {S : ι → Subring R} {x : R} : (x ∈ ⨅ i, S i) ↔ ∀ i, x ∈ S i := by
  simp only [iInf, mem_sInf, Set.forall_mem_range]
Characterization of Membership in Infimum of Subrings
Informal description
For any indexed family of subrings $(S_i)_{i \in \iota}$ of a ring $R$ and any element $x \in R$, we have $x \in \bigsqcap_i S_i$ if and only if $x \in S_i$ for every $i \in \iota$.
Subring.sInf_toSubmonoid theorem
(s : Set (Subring R)) : (sInf s).toSubmonoid = ⨅ t ∈ s, t.toSubmonoid
Full source
@[simp]
theorem sInf_toSubmonoid (s : Set (Subring R)) :
    (sInf s).toSubmonoid = ⨅ t ∈ s, t.toSubmonoid :=
  mk'_toSubmonoid _ _
Infimum of Subrings Preserves Underlying Submonoid Structure
Informal description
For any set $s$ of subrings of a ring $R$, the underlying submonoid of the infimum of $s$ is equal to the infimum of the underlying submonoids of all subrings in $s$. That is, $(\bigsqcap s).\text{toSubmonoid} = \bigsqcap_{t \in s} t.\text{toSubmonoid}$.
Subring.sInf_toAddSubgroup theorem
(s : Set (Subring R)) : (sInf s).toAddSubgroup = ⨅ t ∈ s, Subring.toAddSubgroup t
Full source
@[simp]
theorem sInf_toAddSubgroup (s : Set (Subring R)) :
    (sInf s).toAddSubgroup = ⨅ t ∈ s, Subring.toAddSubgroup t :=
  mk'_toAddSubgroup _ _
Infimum of Subrings Preserves Underlying Additive Subgroup Structure
Informal description
For any set $s$ of subrings of a ring $R$, the underlying additive subgroup of the infimum of $s$ is equal to the infimum of the underlying additive subgroups of all subrings in $s$. That is, $(\bigsqcap s).\text{toAddSubgroup} = \bigsqcap_{t \in s} t.\text{toAddSubgroup}$.
Subring.instCompleteLattice instance
: CompleteLattice (Subring R)
Full source
/-- Subrings of a ring form a complete lattice. -/
instance : CompleteLattice (Subring R) :=
  { completeLatticeOfInf (Subring R) fun _ =>
      IsGLB.of_image SetLike.coe_subset_coe isGLB_biInf with
    bot := 
    bot_le := fun s _x hx =>
      let ⟨n, hn⟩ := mem_bot.1 hx
      hn ▸ intCast_mem s n
    top := 
    le_top := fun _s _x _hx => trivial
    inf := (· ⊓ ·)
    inf_le_left := fun _s _t _x => And.left
    inf_le_right := fun _s _t _x => And.right
    le_inf := fun _s _t₁ _t₂ h₁ h₂ _x hx => ⟨h₁ hx, h₂ hx⟩ }
Complete Lattice Structure on Subrings of a Ring
Informal description
The collection of all subrings of a ring $R$ forms a complete lattice, where the partial order is given by inclusion, the infimum of a collection of subrings is their intersection, and the supremum is the smallest subring containing all of them.
Subring.center definition
: Subring R
Full source
/-- The center of a ring `R` is the set of elements that commute with everything in `R` -/
def center : Subring R :=
  { Subsemiring.center R with
    carrier := Set.center R
    neg_mem' := Set.neg_mem_center }
Center of a ring
Informal description
The center of a ring \( R \) is the subring consisting of all elements \( z \in R \) that commute with every element of \( R \), i.e., \( z \cdot x = x \cdot z \) for all \( x \in R \).
Subring.coe_center theorem
: ↑(center R) = Set.center R
Full source
theorem coe_center : ↑(center R) = Set.center R :=
  rfl
Coercion of Ring Center to Set Equals Set Center
Informal description
The underlying set of the center of a ring $R$ is equal to the center of $R$ as a set, i.e., $\overline{\text{center}(R)} = \text{Set.center}(R)$, where $\overline{\text{center}(R)}$ denotes the coercion of the subring $\text{center}(R)$ to a set.
Subring.center_toSubsemiring theorem
: (center R).toSubsemiring = Subsemiring.center R
Full source
@[simp]
theorem center_toSubsemiring : (center R).toSubsemiring = Subsemiring.center R :=
  rfl
Subring Center as Subsemiring Equality: $\text{center}(R).\text{toSubsemiring} = \text{Subsemiring.center}(R)$
Informal description
The subsemiring associated with the center of a ring $R$ is equal to the center of $R$ when viewed as a subsemiring. That is, if $\text{center}(R)$ denotes the center of $R$ as a subring, then the underlying subsemiring of $\text{center}(R)$ is exactly the center of $R$ as a subsemiring.
Subring.mem_center_iff theorem
{z : R} : z ∈ center R ↔ ∀ g, g * z = z * g
Full source
theorem mem_center_iff {z : R} : z ∈ center Rz ∈ center R ↔ ∀ g, g * z = z * g :=
  Subsemigroup.mem_center_iff
Characterization of Central Elements in a Ring: $z \in \text{center}(R) \leftrightarrow \forall g \in R, gz = zg$
Informal description
An element $z$ in a ring $R$ belongs to the center of $R$ if and only if $z$ commutes with every element $g \in R$, i.e., $g \cdot z = z \cdot g$ for all $g \in R$.
Subring.decidableMemCenter instance
[DecidableEq R] [Fintype R] : DecidablePred (· ∈ center R)
Full source
instance decidableMemCenter [DecidableEq R] [Fintype R] : DecidablePred (· ∈ center R) := fun _ =>
  decidable_of_iff' _ mem_center_iff
Decidability of Membership in the Center of a Finite Ring
Informal description
For any ring $R$ with decidable equality and finite type, the membership predicate for the center of $R$ is decidable. That is, given an element $z \in R$, we can algorithmically determine whether $z$ commutes with every element of $R$.
Subring.center_eq_top theorem
(R) [CommRing R] : center R = ⊤
Full source
@[simp]
theorem center_eq_top (R) [CommRing R] : center R =  :=
  SetLike.coe_injective (Set.center_eq_univ R)
Center of a Commutative Ring is the Whole Ring
Informal description
For a commutative ring $R$, the center of $R$ is equal to the entire ring, i.e., $\text{center}(R) = R$.
Subring.instCommRingSubtypeMemCenter instance
: CommRing (center R)
Full source
/-- The center is commutative. -/
instance : CommRing (center R) :=
  { inferInstanceAs (CommSemiring (Subsemiring.center R)), (center R).toRing with }
The Center of a Ring is a Commutative Ring
Informal description
The center of a ring $R$ forms a commutative ring. That is, the subring consisting of all elements $z \in R$ that commute with every element of $R$ (i.e., $z \cdot x = x \cdot z$ for all $x \in R$) inherits a commutative ring structure from $R$.
Subring.centerCongr definition
(e : R ≃+* S) : center R ≃+* center S
Full source
/-- The center of isomorphic (not necessarily associative) rings are isomorphic. -/
@[simps!] def centerCongr (e : R ≃+* S) : centercenter R ≃+* center S :=
  NonUnitalSubsemiring.centerCongr e
Isomorphism of centers under ring isomorphism
Informal description
Given a ring isomorphism \( e : R \simeq^* S \) between two rings \( R \) and \( S \), the centers of \( R \) and \( S \) are isomorphic as rings. Specifically, the isomorphism \( e \) restricts to an isomorphism between \( \text{center}(R) \) and \( \text{center}(S) \), where \( \text{center}(R) \) denotes the subring of \( R \) consisting of elements that commute with every element of \( R \).
Subring.centerToMulOpposite definition
: center R ≃+* center Rᵐᵒᵖ
Full source
/-- The center of a (not necessarily associative) ring
is isomorphic to the center of its opposite. -/
@[simps!] def centerToMulOpposite : centercenter R ≃+* center Rᵐᵒᵖ :=
  NonUnitalSubsemiring.centerToMulOpposite
Isomorphism between the center of a ring and its opposite
Informal description
The center of a ring \( R \) is isomorphic as a ring to the center of its multiplicative opposite \( R^{\text{op}} \). This isomorphism preserves both the additive and multiplicative structures.
Subring.instField instance
: Field (center K)
Full source
instance instField : Field (center K) where
  inv a := ⟨a⁻¹, Set.inv_mem_center a.prop⟩
  mul_inv_cancel _ ha := Subtype.ext <| mul_inv_cancel₀ <| Subtype.coe_injective.ne ha
  div a b := ⟨a / b, Set.div_mem_center a.prop b.prop⟩
  div_eq_mul_inv _ _ := Subtype.ext <| div_eq_mul_inv _ _
  inv_zero := Subtype.ext inv_zero
  -- TODO: use a nicer defeq
  nnqsmul := _
  nnqsmul_def := fun _ _ => rfl
  qsmul := _
  qsmul_def := fun _ _ => rfl
The Center of a Division Ring is a Field
Informal description
The center of a division ring $K$ forms a field. That is, the subring consisting of all elements $z \in K$ that commute with every element of $K$ (i.e., $z \cdot x = x \cdot z$ for all $x \in K$) inherits a field structure from $K$.
Subring.center.coe_inv theorem
(a : center K) : ((a⁻¹ : center K) : K) = (a : K)⁻¹
Full source
@[simp]
theorem center.coe_inv (a : center K) : ((a⁻¹ : center K) : K) = (a : K)⁻¹ :=
  rfl
Inversion Commutes with Center Inclusion in Division Rings
Informal description
For any element $a$ in the center of a division ring $K$, the canonical inclusion map from the center to $K$ preserves inverses, i.e., $(a^{-1}) = (a)^{-1}$ in $K$.
Subring.center.coe_div theorem
(a b : center K) : ((a / b : center K) : K) = (a : K) / (b : K)
Full source
@[simp]
theorem center.coe_div (a b : center K) : ((a / b : center K) : K) = (a : K) / (b : K) :=
  rfl
Division Preservation in the Center of a Division Ring
Informal description
For any elements $a$ and $b$ in the center of a division ring $K$, the canonical inclusion map from the center to $K$ preserves division, i.e., $(a / b) = a / b$ in $K$.
Subring.centralizer definition
(s : Set R) : Subring R
Full source
/-- The centralizer of a set inside a ring as a `Subring`. -/
def centralizer (s : Set R) : Subring R :=
  { Subsemiring.centralizer s with neg_mem' := Set.neg_mem_centralizer }
Centralizer subring of a subset
Informal description
For a given subset $s$ of a ring $R$, the centralizer of $s$ is the subring consisting of all elements $x \in R$ that commute with every element of $s$, i.e., $x \cdot y = y \cdot x$ for all $y \in s$. The centralizer is constructed by extending the subsemiring centralizer with the additional property that it is closed under additive inverses.
Subring.coe_centralizer theorem
(s : Set R) : (centralizer s : Set R) = s.centralizer
Full source
@[simp, norm_cast]
theorem coe_centralizer (s : Set R) : (centralizer s : Set R) = s.centralizer :=
  rfl
Equality of Centralizer Subring and Set Centralizer
Informal description
For any subset $s$ of a ring $R$, the underlying set of the centralizer subring of $s$ is equal to the centralizer of $s$ in $R$ as a set. That is, $(\text{centralizer}\, s : \text{Set}\, R) = s.\text{centralizer}$.
Subring.centralizer_toSubmonoid theorem
(s : Set R) : (centralizer s).toSubmonoid = Submonoid.centralizer s
Full source
theorem centralizer_toSubmonoid (s : Set R) :
    (centralizer s).toSubmonoid = Submonoid.centralizer s :=
  rfl
Equality of Submonoid Structures in Centralizer Construction
Informal description
For any subset $s$ of a ring $R$, the underlying submonoid of the centralizer subring of $s$ is equal to the centralizer submonoid of $s$ in $R$. In other words, the submonoid obtained by forgetting the additive structure of the centralizer subring $\text{centralizer}(s)$ coincides with the centralizer submonoid $\text{Submonoid.centralizer}(s)$.
Subring.centralizer_toSubsemiring theorem
(s : Set R) : (centralizer s).toSubsemiring = Subsemiring.centralizer s
Full source
theorem centralizer_toSubsemiring (s : Set R) :
    (centralizer s).toSubsemiring = Subsemiring.centralizer s :=
  rfl
Equality of Centralizer Subring and Subsemiring Structures
Informal description
For any subset $s$ of a ring $R$, the underlying subsemiring of the centralizer subring of $s$ is equal to the centralizer subsemiring of $s$.
Subring.mem_centralizer_iff theorem
{s : Set R} {z : R} : z ∈ centralizer s ↔ ∀ g ∈ s, g * z = z * g
Full source
theorem mem_centralizer_iff {s : Set R} {z : R} : z ∈ centralizer sz ∈ centralizer s ↔ ∀ g ∈ s, g * z = z * g :=
  Iff.rfl
Characterization of Centralizer Subring Membership: $z \in \text{centralizer}(s) \leftrightarrow \forall g \in s, gz = zg$
Informal description
Let $R$ be a ring and $s$ a subset of $R$. An element $z \in R$ belongs to the centralizer subring of $s$ if and only if $z$ commutes with every element $g \in s$, i.e., $g \cdot z = z \cdot g$ for all $g \in s$.
Subring.center_le_centralizer theorem
(s) : center R ≤ centralizer s
Full source
theorem center_le_centralizer (s) : center R ≤ centralizer s :=
  s.center_subset_centralizer
Inclusion of Center in Centralizer Subring
Informal description
For any subset $s$ of a ring $R$, the center of $R$ is contained in the centralizer subring of $s$, i.e., $\text{center}(R) \leq \text{centralizer}(s)$.
Subring.centralizer_le theorem
(s t : Set R) (h : s ⊆ t) : centralizer t ≤ centralizer s
Full source
theorem centralizer_le (s t : Set R) (h : s ⊆ t) : centralizer t ≤ centralizer s :=
  Set.centralizer_subset h
Antimonotonicity of Centralizer Subrings: $s \subseteq t$ implies $\text{centralizer}(t) \leq \text{centralizer}(s)$
Informal description
For any subsets $s$ and $t$ of a ring $R$, if $s \subseteq t$, then the centralizer subring of $t$ is contained in the centralizer subring of $s$, i.e., $\text{centralizer}(t) \leq \text{centralizer}(s)$.
Subring.centralizer_eq_top_iff_subset theorem
{s : Set R} : centralizer s = ⊤ ↔ s ⊆ center R
Full source
@[simp]
theorem centralizer_eq_top_iff_subset {s : Set R} : centralizercentralizer s = ⊤ ↔ s ⊆ center R :=
  SetLike.ext'_iff.trans Set.centralizer_eq_top_iff_subset
Centralizer Equals Full Ring iff Subset is Central
Informal description
For any subset $s$ of a ring $R$, the centralizer subring of $s$ is equal to the entire ring $R$ if and only if $s$ is contained in the center of $R$. In other words, $\text{centralizer}(s) = R \leftrightarrow s \subseteq \text{center}(R)$.
Subring.centralizer_univ theorem
: centralizer Set.univ = center R
Full source
@[simp]
theorem centralizer_univ : centralizer Set.univ = center R :=
  SetLike.ext' (Set.centralizer_univ R)
Centralizer of Universal Set Equals Ring Center
Informal description
The centralizer of the universal set in a ring $R$ is equal to the center of $R$, i.e., $\text{centralizer}(\text{univ}) = \text{center}(R)$.
Subring.closure definition
(s : Set R) : Subring R
Full source
/-- The `Subring` generated by a set. -/
def closure (s : Set R) : Subring R :=
  sInf { S | s ⊆ S }
Subring generated by a set
Informal description
The subring closure of a subset $s$ of a ring $R$ is the smallest subring of $R$ containing $s$, defined as the infimum of all subrings of $R$ that contain $s$.
Subring.mem_closure theorem
{x : R} {s : Set R} : x ∈ closure s ↔ ∀ S : Subring R, s ⊆ S → x ∈ S
Full source
theorem mem_closure {x : R} {s : Set R} : x ∈ closure sx ∈ closure s ↔ ∀ S : Subring R, s ⊆ S → x ∈ S :=
  mem_sInf
Characterization of Membership in Subring Closure
Informal description
For any element $x$ in a ring $R$ and any subset $s \subseteq R$, $x$ belongs to the subring closure of $s$ if and only if $x$ is contained in every subring $S$ of $R$ that contains $s$. In symbols: $$x \in \text{closure}(s) \leftrightarrow \forall S \leq R, s \subseteq S \to x \in S$$
Subring.subset_closure theorem
{s : Set R} : s ⊆ closure s
Full source
/-- The subring generated by a set includes the set. -/
@[simp, aesop safe 20 apply (rule_sets := [SetLike])]
theorem subset_closure {s : Set R} : s ⊆ closure s := fun _ hx => mem_closure.2 fun _ hS => hS hx
Subset is Contained in its Subring Closure
Informal description
For any subset $s$ of a ring $R$, the subring closure of $s$ contains $s$ itself, i.e., $s \subseteq \text{closure}(s)$.
Subring.not_mem_of_not_mem_closure theorem
{s : Set R} {P : R} (hP : P ∉ closure s) : P ∉ s
Full source
theorem not_mem_of_not_mem_closure {s : Set R} {P : R} (hP : P ∉ closure s) : P ∉ s := fun h =>
  hP (subset_closure h)
Non-membership in Subring Closure Implies Non-membership in Original Set
Informal description
For any subset $s$ of a ring $R$ and any element $P \in R$, if $P$ does not belong to the subring closure of $s$, then $P$ does not belong to $s$. In other words, $\text{closure}(s) \not\ni P \implies s \not\ni P$.
Subring.closure_le theorem
{s : Set R} {t : Subring R} : closure s ≤ t ↔ s ⊆ t
Full source
/-- A subring `t` includes `closure s` if and only if it includes `s`. -/
@[simp]
theorem closure_le {s : Set R} {t : Subring R} : closureclosure s ≤ t ↔ s ⊆ t :=
  ⟨Set.Subset.trans subset_closure, fun h => sInf_le h⟩
Subring Closure Containment Criterion: $\text{closure}(s) \leq t \leftrightarrow s \subseteq t$
Informal description
For any subset $s$ of a ring $R$ and any subring $t$ of $R$, the subring closure of $s$ is contained in $t$ if and only if $s$ is a subset of $t$. In other words, $\text{closure}(s) \leq t \leftrightarrow s \subseteq t$.
Subring.closure_mono theorem
⦃s t : Set R⦄ (h : s ⊆ t) : closure s ≤ closure t
Full source
/-- Subring closure of a set is monotone in its argument: if `s ⊆ t`,
then `closure s ≤ closure t`. -/
@[gcongr]
theorem closure_mono ⦃s t : Set R⦄ (h : s ⊆ t) : closure s ≤ closure t :=
  closure_le.2 <| Set.Subset.trans h subset_closure
Monotonicity of Subring Closure: $s \subseteq t \implies \text{closure}(s) \leq \text{closure}(t)$
Informal description
For any subsets $s$ and $t$ of a ring $R$, if $s \subseteq t$, then the subring generated by $s$ is contained in the subring generated by $t$, i.e., $\text{closure}(s) \leq \text{closure}(t)$.
Subring.closure_eq_of_le theorem
{s : Set R} {t : Subring R} (h₁ : s ⊆ t) (h₂ : t ≤ closure s) : closure s = t
Full source
theorem closure_eq_of_le {s : Set R} {t : Subring R} (h₁ : s ⊆ t) (h₂ : t ≤ closure s) :
    closure s = t :=
  le_antisymm (closure_le.2 h₁) h₂
Subring Closure Equality Criterion: $\text{closure}(s) = t$ under $s \subseteq t \leq \text{closure}(s)$
Informal description
For any subset $s$ of a ring $R$ and any subring $t$ of $R$, if $s$ is contained in $t$ and $t$ is contained in the subring closure of $s$, then the closure of $s$ equals $t$. In other words, if $s \subseteq t \leq \text{closure}(s)$, then $\text{closure}(s) = t$.
Subring.closure_induction theorem
{s : Set R} {p : (x : R) → x ∈ closure s → Prop} (mem : ∀ (x) (hx : x ∈ s), p x (subset_closure hx)) (zero : p 0 (zero_mem _)) (one : p 1 (one_mem _)) (add : ∀ x y hx hy, p x hx → p y hy → p (x + y) (add_mem hx hy)) (neg : ∀ x hx, p x hx → p (-x) (neg_mem hx)) (mul : ∀ x y hx hy, p x hx → p y hy → p (x * y) (mul_mem hx hy)) {x} (hx : x ∈ closure s) : p x hx
Full source
/-- An induction principle for closure membership. If `p` holds for `0`, `1`, and all elements
of `s`, and is preserved under addition, negation, and multiplication, then `p` holds for all
elements of the closure of `s`. -/
@[elab_as_elim]
theorem closure_induction {s : Set R} {p : (x : R) → x ∈ closure s → Prop}
    (mem : ∀ (x) (hx : x ∈ s), p x (subset_closure hx))
    (zero : p 0 (zero_mem _)) (one : p 1 (one_mem _))
    (add : ∀ x y hx hy, p x hx → p y hy → p (x + y) (add_mem hx hy))
    (neg : ∀ x hx, p x hx → p (-x) (neg_mem hx))
    (mul : ∀ x y hx hy, p x hx → p y hy → p (x * y) (mul_mem hx hy))
    {x} (hx : x ∈ closure s) : p x hx :=
  let K : Subring R :=
    { carrier := { x | ∃ hx, p x hx }
      mul_mem' := fun ⟨_, hpx⟩ ⟨_, hpy⟩ ↦ ⟨_, mul _ _ _ _ hpx hpy⟩
      add_mem' := fun ⟨_, hpx⟩ ⟨_, hpy⟩ ↦ ⟨_, add _ _ _ _ hpx hpy⟩
      neg_mem' := fun ⟨_, hpx⟩ ↦ ⟨_, neg _ _ hpx⟩
      zero_mem' := ⟨_, zero⟩
      one_mem' := ⟨_, one⟩ }
  closure_le (t := K) |>.mpr (fun y hy ↦ ⟨subset_closure hy, mem y hy⟩) hx |>.elim fun _ ↦ id
Induction Principle for Subring Closure Membership
Informal description
Let $R$ be a ring and $s$ a subset of $R$. For any predicate $p : R \to \mathrm{Prop}$ defined on the subring closure of $s$, if: 1. $p(x)$ holds for all $x \in s$, 2. $p(0)$ holds, 3. $p(1)$ holds, 4. $p$ is preserved under addition (i.e., $p(x)$ and $p(y)$ imply $p(x + y)$), 5. $p$ is preserved under negation (i.e., $p(x)$ implies $p(-x)$), 6. $p$ is preserved under multiplication (i.e., $p(x)$ and $p(y)$ imply $p(x \cdot y)$), then $p(x)$ holds for all $x$ in the subring closure of $s$.
Subring.closure_induction₂ theorem
{s : Set R} {p : (x y : R) → x ∈ closure s → y ∈ closure s → Prop} (mem_mem : ∀ (x) (y) (hx : x ∈ s) (hy : y ∈ s), p x y (subset_closure hx) (subset_closure hy)) (zero_left : ∀ x hx, p 0 x (zero_mem _) hx) (zero_right : ∀ x hx, p x 0 hx (zero_mem _)) (one_left : ∀ x hx, p 1 x (one_mem _) hx) (one_right : ∀ x hx, p x 1 hx (one_mem _)) (neg_left : ∀ x y hx hy, p x y hx hy → p (-x) y (neg_mem hx) hy) (neg_right : ∀ x y hx hy, p x y hx hy → p x (-y) hx (neg_mem hy)) (add_left : ∀ x y z hx hy hz, p x z hx hz → p y z hy hz → p (x + y) z (add_mem hx hy) hz) (add_right : ∀ x y z hx hy hz, p x y hx hy → p x z hx hz → p x (y + z) hx (add_mem hy hz)) (mul_left : ∀ x y z hx hy hz, p x z hx hz → p y z hy hz → p (x * y) z (mul_mem hx hy) hz) (mul_right : ∀ x y z hx hy hz, p x y hx hy → p x z hx hz → p x (y * z) hx (mul_mem hy hz)) {x y : R} (hx : x ∈ closure s) (hy : y ∈ closure s) : p x y hx hy
Full source
/-- An induction principle for closure membership, for predicates with two arguments. -/
@[elab_as_elim]
theorem closure_induction₂ {s : Set R} {p : (x y : R) → x ∈ closure sy ∈ closure s → Prop}
    (mem_mem : ∀ (x) (y) (hx : x ∈ s) (hy : y ∈ s), p x y (subset_closure hx) (subset_closure hy))
    (zero_left : ∀ x hx, p 0 x (zero_mem _) hx) (zero_right : ∀ x hx, p x 0 hx (zero_mem _))
    (one_left : ∀ x hx, p 1 x (one_mem _) hx) (one_right : ∀ x hx, p x 1 hx (one_mem _))
    (neg_left : ∀ x y hx hy, p x y hx hy → p (-x) y (neg_mem hx) hy)
    (neg_right : ∀ x y hx hy, p x y hx hy → p x (-y) hx (neg_mem hy))
    (add_left : ∀ x y z hx hy hz, p x z hx hz → p y z hy hz → p (x + y) z (add_mem hx hy) hz)
    (add_right : ∀ x y z hx hy hz, p x y hx hy → p x z hx hz → p x (y + z) hx (add_mem hy hz))
    (mul_left : ∀ x y z hx hy hz, p x z hx hz → p y z hy hz → p (x * y) z (mul_mem hx hy) hz)
    (mul_right : ∀ x y z hx hy hz, p x y hx hy → p x z hx hz → p x (y * z) hx (mul_mem hy hz))
    {x y : R} (hx : x ∈ closure s) (hy : y ∈ closure s) :
    p x y hx hy := by
  induction hy using closure_induction with
  | mem z hz => induction hx using closure_induction with
    | mem _ h => exact mem_mem _ _ h hz
    | zero => exact zero_left _ _
    | one => exact one_left _ _
    | mul _ _ _ _ h₁ h₂ => exact mul_left _ _ _ _ _ _ h₁ h₂
    | add _ _ _ _ h₁ h₂ => exact add_left _ _ _ _ _ _ h₁ h₂
    | neg _ _ h => exact neg_left _ _ _ _ h
  | zero => exact zero_right x hx
  | one => exact one_right x hx
  | mul _ _ _ _ h₁ h₂ => exact mul_right _ _ _ _ _ _ h₁ h₂
  | add _ _ _ _ h₁ h₂ => exact add_right _ _ _ _ _ _ h₁ h₂
  | neg _ _ h => exact neg_right _ _ _ _ h
Two-Variable Induction Principle for Subring Closure Membership
Informal description
Let $R$ be a ring and $s$ a subset of $R$. For any predicate $p : R \times R \to \mathrm{Prop}$ defined on pairs of elements from the subring closure of $s$, if: 1. $p(x,y)$ holds for all $x, y \in s$, 2. $p(0,x)$ holds for all $x$ in the closure, 3. $p(x,0)$ holds for all $x$ in the closure, 4. $p(1,x)$ holds for all $x$ in the closure, 5. $p(x,1)$ holds for all $x$ in the closure, 6. $p$ is preserved under left negation (i.e., $p(x,y)$ implies $p(-x,y)$), 7. $p$ is preserved under right negation (i.e., $p(x,y)$ implies $p(x,-y)$), 8. $p$ is preserved under left addition (i.e., $p(x,z)$ and $p(y,z)$ imply $p(x+y,z)$), 9. $p$ is preserved under right addition (i.e., $p(x,y)$ and $p(x,z)$ imply $p(x,y+z)$), 10. $p$ is preserved under left multiplication (i.e., $p(x,z)$ and $p(y,z)$ imply $p(x \cdot y,z)$), 11. $p$ is preserved under right multiplication (i.e., $p(x,y)$ and $p(x,z)$ imply $p(x,y \cdot z)$), then $p(x,y)$ holds for all $x, y$ in the subring closure of $s$.
Subring.mem_closure_iff theorem
{s : Set R} {x} : x ∈ closure s ↔ x ∈ AddSubgroup.closure (Submonoid.closure s : Set R)
Full source
theorem mem_closure_iff {s : Set R} {x} :
    x ∈ closure sx ∈ closure s ↔ x ∈ AddSubgroup.closure (Submonoid.closure s : Set R) :=
  ⟨fun h => by
    induction h using closure_induction with
    | mem _ hx => exact AddSubgroup.subset_closure (Submonoid.subset_closure hx)
    | zero => exact zero_mem _
    | one => exact AddSubgroup.subset_closure (one_mem _)
    | add _ _ _ _ hx hy => exact add_mem hx hy
    | neg _ _ hx => exact neg_mem hx
    | mul _ _ _hx _hy hx hy =>
      clear _hx _hy
      induction hx, hy using AddSubgroup.closure_induction₂ with
      | mem _ _ hx hy => exact AddSubgroup.subset_closure (mul_mem hx hy)
      | one_left => simpa using zero_mem _
      | one_right => simpa using zero_mem _
      | mul_left _ _ _ _ _ _ h₁ h₂ => simpa [add_mul] using add_mem h₁ h₂
      | mul_right _ _ _ _ _ _ h₁ h₂ => simpa [mul_add] using add_mem h₁ h₂
      | inv_left _ _ _ _ h => simpa [neg_mul] using neg_mem h
      | inv_right _ _ _ _ h => simpa [mul_neg] using neg_mem h,
    fun h => by
      induction h using AddSubgroup.closure_induction with
      | mem x hx =>
        induction hx using Submonoid.closure_induction with
        | mem _ h => exact subset_closure h
        | one => exact one_mem _
        | mul _ _ _ _ h₁ h₂ => exact mul_mem h₁ h₂
      | one => exact zero_mem _
      | mul _ _ _ _ h₁ h₂ => exact add_mem h₁ h₂
      | inv _ _ h => exact neg_mem h⟩
Characterization of Subring Closure via Additive Subgroup and Submonoid
Informal description
For any subset $s$ of a ring $R$ and any element $x \in R$, $x$ belongs to the subring generated by $s$ if and only if $x$ belongs to the additive subgroup generated by the submonoid generated by $s$.
Subring.closure_le_centralizer_centralizer theorem
(s : Set R) : closure s ≤ centralizer (centralizer s)
Full source
lemma closure_le_centralizer_centralizer (s : Set R) :
    closure s ≤ centralizer (centralizer s) :=
  closure_le.mpr Set.subset_centralizer_centralizer
Subring Closure is Contained in Double Centralizer
Informal description
For any subset $s$ of a ring $R$, the subring generated by $s$ is contained in the centralizer of the centralizer of $s$. In other words, $\text{closure}(s) \leq \text{centralizer}(\text{centralizer}(s))$.
Subring.closureCommRingOfComm abbrev
{s : Set R} (hcomm : ∀ x ∈ s, ∀ y ∈ s, x * y = y * x) : CommRing (closure s)
Full source
/-- If all elements of `s : Set A` commute pairwise, then `closure s` is a commutative ring. -/
abbrev closureCommRingOfComm {s : Set R} (hcomm : ∀ x ∈ s, ∀ y ∈ s, x * y = y * x) :
    CommRing (closure s) :=
  { (closure s).toRing with
    mul_comm := fun ⟨_, h₁⟩ ⟨_, h₂⟩ ↦
      have := closure_le_centralizer_centralizer s
      Subtype.ext <| Set.centralizer_centralizer_comm_of_comm hcomm _ (this h₁) _ (this h₂) }
Commutativity of Subring Closure for Pairwise Commuting Elements
Informal description
For any subset $s$ of a ring $R$, if every pair of elements in $s$ commutes (i.e., $x \cdot y = y \cdot x$ for all $x, y \in s$), then the subring generated by $s$ is a commutative ring.
Subring.exists_list_of_mem_closure theorem
{s : Set R} {x : R} (hx : x ∈ closure s) : ∃ L : List (List R), (∀ t ∈ L, ∀ y ∈ t, y ∈ s ∨ y = (-1 : R)) ∧ (L.map List.prod).sum = x
Full source
theorem exists_list_of_mem_closure {s : Set R} {x : R} (hx : x ∈ closure s) :
    ∃ L : List (List R), (∀ t ∈ L, ∀ y ∈ t, y ∈ s ∨ y = (-1 : R)) ∧ (L.map List.prod).sum = x := by
  rw [mem_closure_iff] at hx
  induction hx using AddSubgroup.closure_induction with
  | mem _ hx =>
    obtain ⟨l, hl, h⟩ := Submonoid.exists_list_of_mem_closure hx
    exact ⟨[l], by simp [h]; clear_aux_decl; tauto⟩
  | one => exact ⟨[], List.forall_mem_nil _, rfl⟩
  | mul _ _ _ _ hL hM =>
    obtain ⟨⟨L, HL1, HL2⟩, ⟨M, HM1, HM2⟩⟩ := And.intro hL hM
    exact ⟨L ++ M, List.forall_mem_append.2 ⟨HL1, HM1⟩, by
      rw [List.map_append, List.sum_append, HL2, HM2]⟩
  | inv _ _ hL =>
    obtain ⟨L, hL⟩ := hL
    exact ⟨L.map (List.cons (-1)),
      List.forall_mem_map.2 fun j hj => List.forall_mem_cons.2 ⟨Or.inr rfl, hL.1 j hj⟩,
      hL.2 ▸
        List.recOn L (by simp)
          (by simp +contextual [List.map_cons, add_comm])⟩
Factorization of Subring Elements into Sums of Products of Generators and Negatives of Identity
Informal description
Let $R$ be a ring and $s$ a subset of $R$. For any element $x$ in the subring generated by $s$, there exists a finite list $L$ of lists of elements of $R$ such that: 1. For every list $t$ in $L$ and every element $y$ in $t$, either $y \in s$ or $y = -1$ (where $1$ is the multiplicative identity of $R$) 2. The sum of the products of the elements in each list of $L$ equals $x$ In other words, every element in the subring closure of $s$ can be expressed as a finite sum of products of elements from $s$ or $-1$.
Subring.gi definition
: GaloisInsertion (@closure R _) (↑)
Full source
/-- `closure` forms a Galois insertion with the coercion to set. -/
protected def gi : GaloisInsertion (@closure R _) (↑) where
  choice s _ := closure s
  gc _s _t := closure_le
  le_l_u _s := subset_closure
  choice_eq _s _h := rfl
Galois insertion between subring closure and coercion to set
Informal description
The pair of functions `closure : Set R → Subring R` (subring closure) and the coercion `(↑) : Subring R → Set R` (viewing a subring as a set) form a Galois insertion. This means: 1. For any subset $s$ of $R$ and any subring $t$ of $R$, we have $\text{closure}(s) \leq t$ if and only if $s \subseteq t$ (as sets) 2. For any subring $s$, we have $s \subseteq \text{closure}(s)$ (as sets) 3. The composition $\text{closure} \circ (↑)$ is the identity on subrings
Subring.closure_eq theorem
(s : Subring R) : closure (s : Set R) = s
Full source
/-- Closure of a subring `S` equals `S`. -/
@[simp]
theorem closure_eq (s : Subring R) : closure (s : Set R) = s :=
  (Subring.gi R).l_u_eq s
Subring Closure of a Subring is Itself
Informal description
For any subring $S$ of a ring $R$, the closure of $S$ (viewed as a subset of $R$) is equal to $S$ itself, i.e., $\text{closure}(S) = S$.
Subring.closure_empty theorem
: closure (∅ : Set R) = ⊥
Full source
@[simp]
theorem closure_empty : closure ( : Set R) =  :=
  (Subring.gi R).gc.l_bot
Subring Generated by Empty Set is Bottom Subring
Informal description
The subring generated by the empty set in a ring $R$ is equal to the bottom element of the subring lattice, i.e., the smallest subring of $R$.
Subring.closure_univ theorem
: closure (Set.univ : Set R) = ⊤
Full source
@[simp]
theorem closure_univ : closure (Set.univ : Set R) =  :=
  @coe_top R _ ▸ closure_eq 
Closure of Universal Set is Top Subring
Informal description
The subring generated by the universal set of a ring $R$ is equal to the top subring (the entire ring $R$ itself), i.e., $\text{closure}(\text{univ}) = \top$.
Subring.closure_union theorem
(s t : Set R) : closure (s ∪ t) = closure s ⊔ closure t
Full source
theorem closure_union (s t : Set R) : closure (s ∪ t) = closureclosure s ⊔ closure t :=
  (Subring.gi R).gc.l_sup
Subring Closure of Union Equals Join of Closures
Informal description
For any two subsets $s$ and $t$ of a ring $R$, the subring generated by their union $s \cup t$ is equal to the supremum (join) of the subrings generated by $s$ and $t$ individually, i.e., $\text{closure}(s \cup t) = \text{closure}(s) \sqcup \text{closure}(t)$.
Subring.closure_iUnion theorem
{ι} (s : ι → Set R) : closure (⋃ i, s i) = ⨆ i, closure (s i)
Full source
theorem closure_iUnion {ι} (s : ι → Set R) : closure (⋃ i, s i) = ⨆ i, closure (s i) :=
  (Subring.gi R).gc.l_iSup
Subring Closure of Union Equals Supremum of Closures
Informal description
For any indexed family of subsets $(s_i)_{i \in \iota}$ of a ring $R$, the subring generated by their union $\bigcup_i s_i$ is equal to the supremum of the subrings generated by each $s_i$, i.e., \[ \text{closure}\left(\bigcup_{i} s_i\right) = \bigsqcup_{i} \text{closure}(s_i). \]
Subring.closure_sUnion theorem
(s : Set (Set R)) : closure (⋃₀ s) = ⨆ t ∈ s, closure t
Full source
theorem closure_sUnion (s : Set (Set R)) : closure (⋃₀ s) = ⨆ t ∈ s, closure t :=
  (Subring.gi R).gc.l_sSup
Subring Closure of Union of Sets Equals Supremum of Closures
Informal description
For any collection $s$ of subsets of a ring $R$, the subring generated by the union of all sets in $s$ is equal to the supremum of the subrings generated by each individual set in $s$, i.e., \[ \text{closure}\left(\bigcup_{t \in s} t\right) = \bigsqcup_{t \in s} \text{closure}(t). \]
Subring.closure_singleton_intCast theorem
(n : ℤ) : closure {(n : R)} = ⊥
Full source
@[simp]
theorem closure_singleton_intCast (n : ) : closure {(n : R)} =  :=
  bot_unique <| closure_le.2 <| Set.singleton_subset_iff.mpr <| intCast_mem _ _
Subring Generated by Integer Singleton is Bottom Element
Informal description
For any integer $n \in \mathbb{Z}$, the subring generated by the singleton set $\{n\}$ (viewed as an element of $R$ via the canonical ring homomorphism $\mathbb{Z} \to R$) is equal to the bottom element $\bot$ of the subring lattice of $R$.
Subring.closure_singleton_natCast theorem
(n : ℕ) : closure {(n : R)} = ⊥
Full source
@[simp]
theorem closure_singleton_natCast (n : ) : closure {(n : R)} =  :=
  mod_cast closure_singleton_intCast n
Subring Generated by Natural Number Singleton is Bottom Element
Informal description
For any natural number $n \in \mathbb{N}$, the subring generated by the singleton set $\{n\}$ (viewed as an element of $R$ via the canonical ring homomorphism $\mathbb{N} \to \mathbb{Z} \to R$) is equal to the bottom element $\bot$ of the subring lattice of $R$.
Subring.closure_singleton_zero theorem
: closure {(0 : R)} = ⊥
Full source
@[simp]
theorem closure_singleton_zero : closure {(0 : R)} =  := mod_cast closure_singleton_natCast 0
Subring Generated by Zero Singleton is Bottom Element
Informal description
For any ring $R$, the subring generated by the singleton set $\{0\}$ is equal to the bottom element $\bot$ of the subring lattice of $R$.
Subring.closure_singleton_one theorem
: closure {(1 : R)} = ⊥
Full source
@[simp]
theorem closure_singleton_one : closure {(1 : R)} =  := mod_cast closure_singleton_natCast 1
Subring Generated by One is Bottom Element
Informal description
The subring generated by the singleton set $\{1\}$ in a ring $R$ is equal to the bottom element $\bot$ of the subring lattice of $R$.
Subring.closure_insert_intCast theorem
(n : ℤ) (s : Set R) : closure (insert (n : R) s) = closure s
Full source
@[simp]
theorem closure_insert_intCast (n : ) (s : Set R) : closure (insert (n : R) s) = closure s := by
  rw [Set.insert_eq, closure_union]
  simp
Subring Closure Unaffected by Insertion of Integer Element
Informal description
For any integer $n \in \mathbb{Z}$ and any subset $s$ of a ring $R$, the subring generated by the insertion of $n$ (viewed as an element of $R$ via the canonical ring homomorphism $\mathbb{Z} \to R$) into $s$ is equal to the subring generated by $s$ alone, i.e., $\text{closure}(\text{insert}(n, s)) = \text{closure}(s)$.
Subring.closure_insert_natCast theorem
(n : ℕ) (s : Set R) : closure (insert (n : R) s) = closure s
Full source
@[simp]
theorem closure_insert_natCast (n : ) (s : Set R) : closure (insert (n : R) s) = closure s :=
  mod_cast closure_insert_intCast n s
Subring Closure Unaffected by Insertion of Natural Number Element
Informal description
For any natural number $n \in \mathbb{N}$ and any subset $s$ of a ring $R$, the subring generated by the insertion of $n$ (viewed as an element of $R$ via the canonical ring homomorphism $\mathbb{N} \to R$) into $s$ is equal to the subring generated by $s$ alone, i.e., $\text{closure}(\text{insert}(n, s)) = \text{closure}(s)$.
Subring.closure_insert_zero theorem
(s : Set R) : closure (insert 0 s) = closure s
Full source
@[simp]
theorem closure_insert_zero (s : Set R) : closure (insert 0 s) = closure s :=
  mod_cast closure_insert_natCast 0 s
Subring Closure Unaffected by Insertion of Zero
Informal description
For any subset $s$ of a ring $R$, the subring generated by inserting the zero element into $s$ is equal to the subring generated by $s$ alone, i.e., $\text{closure}(\{0\} \cup s) = \text{closure}(s)$.
Subring.closure_insert_one theorem
(s : Set R) : closure (insert 1 s) = closure s
Full source
@[simp]
theorem closure_insert_one (s : Set R) : closure (insert 1 s) = closure s :=
  mod_cast closure_insert_natCast 1 s
Subring Closure Unchanged by Adding Identity Element
Informal description
For any subset $s$ of a ring $R$, the subring generated by the insertion of the multiplicative identity $1$ into $s$ is equal to the subring generated by $s$ alone, i.e., $\text{closure}(\{1\} \cup s) = \text{closure}(s)$.
Subring.map_sup theorem
(s t : Subring R) (f : R →+* S) : (s ⊔ t).map f = s.map f ⊔ t.map f
Full source
theorem map_sup (s t : Subring R) (f : R →+* S) : (s ⊔ t).map f = s.map f ⊔ t.map f :=
  (gc_map_comap f).l_sup
Image of Subring Supremum under Ring Homomorphism Equals Supremum of Images
Informal description
Let $R$ and $S$ be rings, and let $f : R \to S$ be a ring homomorphism. For any two subrings $s$ and $t$ of $R$, the image of their supremum under $f$ equals the supremum of their images under $f$, i.e., \[ f(s \sqcup t) = f(s) \sqcup f(t). \]
Subring.map_iSup theorem
{ι : Sort*} (f : R →+* S) (s : ι → Subring R) : (iSup s).map f = ⨆ i, (s i).map f
Full source
theorem map_iSup {ι : Sort*} (f : R →+* S) (s : ι → Subring R) :
    (iSup s).map f = ⨆ i, (s i).map f :=
  (gc_map_comap f).l_iSup
Image of Supremum of Subrings under Ring Homomorphism Equals Supremum of Images
Informal description
Let $R$ and $S$ be rings, and let $f : R \to S$ be a ring homomorphism. For any family of subrings $(s_i)_{i \in \iota}$ of $R$, the image under $f$ of the supremum of the subrings $s_i$ equals the supremum of their images under $f$. That is, \[ f\left(\bigsqcup_{i \in \iota} s_i\right) = \bigsqcup_{i \in \iota} f(s_i). \]
Subring.map_inf theorem
(s t : Subring R) (f : R →+* S) (hf : Function.Injective f) : (s ⊓ t).map f = s.map f ⊓ t.map f
Full source
theorem map_inf (s t : Subring R) (f : R →+* S) (hf : Function.Injective f) :
    (s ⊓ t).map f = s.map f ⊓ t.map f := SetLike.coe_injective (Set.image_inter hf)
Image of Subring Intersection under Injective Ring Homomorphism Equals Intersection of Images
Informal description
Let $R$ and $S$ be rings, and let $f : R \to S$ be an injective ring homomorphism. For any two subrings $s$ and $t$ of $R$, the image of their intersection under $f$ equals the intersection of their images under $f$, i.e., \[ f(s \cap t) = f(s) \cap f(t). \]
Subring.map_iInf theorem
{ι : Sort*} [Nonempty ι] (f : R →+* S) (hf : Function.Injective f) (s : ι → Subring R) : (iInf s).map f = ⨅ i, (s i).map f
Full source
theorem map_iInf {ι : Sort*} [Nonempty ι] (f : R →+* S) (hf : Function.Injective f)
    (s : ι → Subring R) : (iInf s).map f = ⨅ i, (s i).map f := by
  apply SetLike.coe_injective
  simpa using (Set.injOn_of_injective hf).image_iInter_eq (s := SetLike.coeSetLike.coe ∘ s)
Image of Infimum of Subrings under Injective Ring Homomorphism Equals Infimum of Images
Informal description
Let $R$ and $S$ be rings, and let $f : R \to S$ be an injective ring homomorphism. For any nonempty index set $\iota$ and any family of subrings $(s_i)_{i \in \iota}$ of $R$, the image under $f$ of the infimum of the subrings $s_i$ equals the infimum of their images under $f$. That is, \[ f\left(\bigsqcap_{i \in \iota} s_i\right) = \bigsqcap_{i \in \iota} f(s_i). \]
Subring.comap_inf theorem
(s t : Subring S) (f : R →+* S) : (s ⊓ t).comap f = s.comap f ⊓ t.comap f
Full source
theorem comap_inf (s t : Subring S) (f : R →+* S) : (s ⊓ t).comap f = s.comap f ⊓ t.comap f :=
  (gc_map_comap f).u_inf
Preimage of Subring Intersection Equals Intersection of Preimages
Informal description
Let $R$ and $S$ be rings, and let $f : R \to S$ be a ring homomorphism. For any two subrings $s$ and $t$ of $S$, the preimage of their intersection under $f$ equals the intersection of their preimages under $f$, i.e., \[ f^{-1}(s \cap t) = f^{-1}(s) \cap f^{-1}(t). \]
Subring.comap_iInf theorem
{ι : Sort*} (f : R →+* S) (s : ι → Subring S) : (iInf s).comap f = ⨅ i, (s i).comap f
Full source
theorem comap_iInf {ι : Sort*} (f : R →+* S) (s : ι → Subring S) :
    (iInf s).comap f = ⨅ i, (s i).comap f :=
  (gc_map_comap f).u_iInf
Preimage of Infimum of Subrings Equals Infimum of Preimages
Informal description
Let $R$ and $S$ be rings, and let $f : R \to S$ be a ring homomorphism. For any family of subrings $(s_i)_{i \in \iota}$ of $S$, the preimage under $f$ of their infimum equals the infimum of their preimages under $f$. That is, \[ f^{-1}\left(\bigsqcap_{i \in \iota} s_i\right) = \bigsqcap_{i \in \iota} f^{-1}(s_i). \]
Subring.map_bot theorem
(f : R →+* S) : (⊥ : Subring R).map f = ⊥
Full source
@[simp]
theorem map_bot (f : R →+* S) : ( : Subring R).map f =  :=
  (gc_map_comap f).l_bot
Image of Bottom Subring is Bottom Subring
Informal description
For any ring homomorphism $f \colon R \to S$, the image of the bottom subring of $R$ under $f$ is the bottom subring of $S$. In other words, $f(\{0_R\}) = \{0_S\}$.
Subring.comap_top theorem
(f : R →+* S) : (⊤ : Subring S).comap f = ⊤
Full source
@[simp]
theorem comap_top (f : R →+* S) : ( : Subring S).comap f =  :=
  (gc_map_comap f).u_top
Preimage of Top Subring is Top Subring
Informal description
For any ring homomorphism $f \colon R \to S$, the preimage of the top subring of $S$ (which is $S$ itself) under $f$ is equal to the top subring of $R$ (which is $R$ itself). In other words, $f^{-1}(S) = R$.
Subring.prod definition
(s : Subring R) (t : Subring S) : Subring (R × S)
Full source
/-- Given `Subring`s `s`, `t` of rings `R`, `S` respectively, `s.prod t` is `s ×̂ t`
as a subring of `R × S`. -/
def prod (s : Subring R) (t : Subring S) : Subring (R × S) :=
  { s.toSubmonoid.prod t.toSubmonoid, s.toAddSubgroup.prod t.toAddSubgroup with carrier := s ×ˢ t }
Product of subrings
Informal description
Given subrings $s$ of a ring $R$ and $t$ of a ring $S$, the product subring $s \times t$ is defined as the subring of $R \times S$ consisting of all pairs $(r, s)$ where $r \in s$ and $s \in t$. This subring is constructed by taking the product of the underlying submonoids and additive subgroups of $s$ and $t$.
Subring.coe_prod theorem
(s : Subring R) (t : Subring S) : (s.prod t : Set (R × S)) = (s : Set R) ×ˢ (t : Set S)
Full source
@[norm_cast]
theorem coe_prod (s : Subring R) (t : Subring S) :
    (s.prod t : Set (R × S)) = (s : Set R) ×ˢ (t : Set S) :=
  rfl
Underlying Set of Product Subring Equals Cartesian Product of Underlying Sets
Informal description
For any subrings $s$ of a ring $R$ and $t$ of a ring $S$, the underlying set of the product subring $s \times t$ is equal to the Cartesian product of the underlying sets of $s$ and $t$, i.e., $(s \times t) = s \timesˢ t$.
Subring.mem_prod theorem
{s : Subring R} {t : Subring S} {p : R × S} : p ∈ s.prod t ↔ p.1 ∈ s ∧ p.2 ∈ t
Full source
theorem mem_prod {s : Subring R} {t : Subring S} {p : R × S} : p ∈ s.prod tp ∈ s.prod t ↔ p.1 ∈ s ∧ p.2 ∈ t :=
  Iff.rfl
Membership Criterion for Product of Subrings
Informal description
For any subrings $s$ of a ring $R$ and $t$ of a ring $S$, and any element $p = (r, s) \in R \times S$, we have $p \in s \times t$ if and only if $r \in s$ and $s \in t$.
Subring.prod_mono theorem
⦃s₁ s₂ : Subring R⦄ (hs : s₁ ≤ s₂) ⦃t₁ t₂ : Subring S⦄ (ht : t₁ ≤ t₂) : s₁.prod t₁ ≤ s₂.prod t₂
Full source
@[gcongr, mono]
theorem prod_mono ⦃s₁ s₂ : Subring R⦄ (hs : s₁ ≤ s₂) ⦃t₁ t₂ : Subring S⦄ (ht : t₁ ≤ t₂) :
    s₁.prod t₁ ≤ s₂.prod t₂ :=
  Set.prod_mono hs ht
Monotonicity of Subring Product with Respect to Inclusion
Informal description
For any subrings $s_1, s_2$ of a ring $R$ and $t_1, t_2$ of a ring $S$, if $s_1 \subseteq s_2$ and $t_1 \subseteq t_2$, then the product subring $s_1 \times t_1$ is contained in $s_2 \times t_2$.
Subring.prod_mono_right theorem
(s : Subring R) : Monotone fun t : Subring S => s.prod t
Full source
theorem prod_mono_right (s : Subring R) : Monotone fun t : Subring S => s.prod t :=
  prod_mono (le_refl s)
Monotonicity of Product Subring Construction in Second Factor
Informal description
For any subring $s$ of a ring $R$, the function that maps a subring $t$ of a ring $S$ to the product subring $s \times t$ is monotone with respect to inclusion. That is, if $t_1 \subseteq t_2$ are subrings of $S$, then $s \times t_1 \subseteq s \times t_2$.
Subring.prod_mono_left theorem
(t : Subring S) : Monotone fun s : Subring R => s.prod t
Full source
theorem prod_mono_left (t : Subring S) : Monotone fun s : Subring R => s.prod t := fun _ _ hs =>
  prod_mono hs (le_refl t)
Monotonicity of Left Factor in Subring Product
Informal description
For any subring $t$ of a ring $S$, the function that maps a subring $s$ of $R$ to the product subring $s \times t$ is monotone with respect to the inclusion order on subrings. That is, if $s_1 \subseteq s_2$ are subrings of $R$, then $s_1 \times t \subseteq s_2 \times t$.
Subring.prod_top theorem
(s : Subring R) : s.prod (⊤ : Subring S) = s.comap (RingHom.fst R S)
Full source
theorem prod_top (s : Subring R) : s.prod ( : Subring S) = s.comap (RingHom.fst R S) :=
  ext fun x => by simp [mem_prod, MonoidHom.coe_fst]
Product Subring with Full Ring Equals Preimage under First Projection
Informal description
For any subring $s$ of a ring $R$, the product subring $s \times S$ (where $S$ is the full ring) is equal to the preimage of $s$ under the first projection ring homomorphism $\mathrm{fst} \colon R \times S \to R$.
Subring.top_prod theorem
(s : Subring S) : (⊤ : Subring R).prod s = s.comap (RingHom.snd R S)
Full source
theorem top_prod (s : Subring S) : ( : Subring R).prod s = s.comap (RingHom.snd R S) :=
  ext fun x => by simp [mem_prod, MonoidHom.coe_snd]
Product of Full Subring with Subring Equals Preimage Under Projection
Informal description
For any subring $s$ of a ring $S$, the product of the full subring of $R$ (denoted $\top$) with $s$ is equal to the preimage of $s$ under the second projection ring homomorphism $\text{snd} : R \times S \to S$.
Subring.top_prod_top theorem
: (⊤ : Subring R).prod (⊤ : Subring S) = ⊤
Full source
@[simp]
theorem top_prod_top : ( : Subring R).prod ( : Subring S) =  :=
  (top_prod _).trans <| comap_top _
Product of Full Subrings is Full Subring of Product Ring
Informal description
The product of the full subring of $R$ and the full subring of $S$ is equal to the full subring of $R \times S$. That is, $R \times S$ is the largest subring of the product ring $R \times S$.
Subring.prodEquiv definition
(s : Subring R) (t : Subring S) : s.prod t ≃+* s × t
Full source
/-- Product of subrings is isomorphic to their product as rings. -/
def prodEquiv (s : Subring R) (t : Subring S) : s.prod t ≃+* s × t :=
  { Equiv.Set.prod (s : Set R) (t : Set S) with
    map_mul' := fun _x _y => rfl
    map_add' := fun _x _y => rfl }
Ring isomorphism between product subring and product of subrings
Informal description
Given subrings $s$ of a ring $R$ and $t$ of a ring $S$, the product subring $s \times t$ is isomorphic as a ring to the direct product of the subrings $s$ and $t$. The isomorphism is given by the canonical bijection between the product set $(s \times t)$ and the product type $s \times t$, which preserves both the multiplicative and additive structures.
Subring.mem_iSup_of_directed theorem
{ι} [hι : Nonempty ι] {S : ι → Subring R} (hS : Directed (· ≤ ·) S) {x : R} : (x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i
Full source
/-- The underlying set of a non-empty directed sSup of subrings is just a union of the subrings.
  Note that this fails without the directedness assumption (the union of two subrings is
  typically not a subring) -/
theorem mem_iSup_of_directed {ι} [hι : Nonempty ι] {S : ι → Subring R} (hS : Directed (· ≤ ·) S)
    {x : R} : (x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i := by
  refine ⟨?_, fun ⟨i, hi⟩ ↦ le_iSup S i hi⟩
  let U : Subring R :=
    Subring.mk' (⋃ i, (S i : Set R)) (⨆ i, (S i).toSubmonoid) (⨆ i, (S i).toAddSubgroup)
      (Submonoid.coe_iSup_of_directed hS) (AddSubgroup.coe_iSup_of_directed hS)
  suffices ⨆ i, S i ≤ U by simpa [U] using @this x
  exact iSup_le fun i x hx ↦ Set.mem_iUnion.2 ⟨i, hx⟩
Characterization of Membership in Directed Supremum of Subrings
Informal description
Let $R$ be a ring, $\iota$ a nonempty index set, and $(S_i)_{i \in \iota}$ a directed family of subrings of $R$ with respect to inclusion. For any element $x \in R$, we have $x \in \bigsqcup_i S_i$ if and only if there exists an index $i \in \iota$ such that $x \in S_i$.
Subring.coe_iSup_of_directed theorem
{ι} [hι : Nonempty ι] {S : ι → Subring R} (hS : Directed (· ≤ ·) S) : ((⨆ i, S i : Subring R) : Set R) = ⋃ i, S i
Full source
theorem coe_iSup_of_directed {ι} [hι : Nonempty ι] {S : ι → Subring R} (hS : Directed (· ≤ ·) S) :
    ((⨆ i, S i : Subring R) : Set R) = ⋃ i, S i :=
  Set.ext fun x ↦ by simp [mem_iSup_of_directed hS]
Underlying Set of Directed Supremum of Subrings Equals Union of Their Sets
Informal description
Let $R$ be a ring, $\iota$ a nonempty index set, and $(S_i)_{i \in \iota}$ a directed family of subrings of $R$ with respect to inclusion. Then the underlying set of the supremum $\bigsqcup_i S_i$ of these subrings is equal to the union $\bigcup_i S_i$ of their underlying sets.
Subring.mem_sSup_of_directedOn theorem
{S : Set (Subring R)} (Sne : S.Nonempty) (hS : DirectedOn (· ≤ ·) S) {x : R} : x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s
Full source
theorem mem_sSup_of_directedOn {S : Set (Subring R)} (Sne : S.Nonempty) (hS : DirectedOn (· ≤ ·) S)
    {x : R} : x ∈ sSup Sx ∈ sSup S ↔ ∃ s ∈ S, x ∈ s := by
  haveI : Nonempty S := Sne.to_subtype
  simp only [sSup_eq_iSup', mem_iSup_of_directed hS.directed_val, SetCoe.exists, Subtype.coe_mk,
    exists_prop]
Characterization of Membership in Directed Supremum of Subrings via Directed Set
Informal description
Let $R$ be a ring and $S$ a nonempty set of subrings of $R$ that is directed with respect to inclusion. For any element $x \in R$, we have $x \in \mathrm{sSup}(S)$ if and only if there exists a subring $s \in S$ such that $x \in s$.
Subring.coe_sSup_of_directedOn theorem
{S : Set (Subring R)} (Sne : S.Nonempty) (hS : DirectedOn (· ≤ ·) S) : (↑(sSup S) : Set R) = ⋃ s ∈ S, ↑s
Full source
theorem coe_sSup_of_directedOn {S : Set (Subring R)} (Sne : S.Nonempty)
    (hS : DirectedOn (· ≤ ·) S) : (↑(sSup S) : Set R) = ⋃ s ∈ S, ↑s :=
  Set.ext fun x => by simp [mem_sSup_of_directedOn Sne hS]
Underlying Set of Directed Supremum of Subrings Equals Union of Their Sets
Informal description
Let $R$ be a ring and $S$ a nonempty set of subrings of $R$ that is directed with respect to inclusion. Then the underlying set of the supremum $\bigsqcup S$ of these subrings is equal to the union $\bigcup_{s \in S} s$ of their underlying sets.
Subring.mem_map_equiv theorem
{f : R ≃+* S} {K : Subring R} {x : S} : x ∈ K.map (f : R →+* S) ↔ f.symm x ∈ K
Full source
theorem mem_map_equiv {f : R ≃+* S} {K : Subring R} {x : S} :
    x ∈ K.map (f : R →+* S)x ∈ K.map (f : R →+* S) ↔ f.symm x ∈ K :=
  @Set.mem_image_equiv _ _ (K : Set R) f.toEquiv x
Characterization of Image Membership via Ring Isomorphism Inverse
Informal description
Let $R$ and $S$ be rings, and let $f \colon R \simeq+* S$ be a ring isomorphism. For any subring $K$ of $R$ and any element $x \in S$, the element $x$ belongs to the image of $K$ under the ring homomorphism $f$ if and only if the inverse isomorphism $f^{-1}$ maps $x$ back into $K$, i.e., \[ x \in f(K) \leftrightarrow f^{-1}(x) \in K. \]
Subring.map_equiv_eq_comap_symm theorem
(f : R ≃+* S) (K : Subring R) : K.map (f : R →+* S) = K.comap f.symm
Full source
theorem map_equiv_eq_comap_symm (f : R ≃+* S) (K : Subring R) :
    K.map (f : R →+* S) = K.comap f.symm :=
  SetLike.coe_injective (f.toEquiv.image_eq_preimage K)
Image-Preimage Duality for Subrings under Ring Isomorphisms
Informal description
Let $R$ and $S$ be rings, and let $f : R \simeq+* S$ be a ring isomorphism. For any subring $K$ of $R$, the image of $K$ under $f$ is equal to the preimage of $K$ under the inverse isomorphism $f^{-1} : S \simeq+* R$. In other words, \[ f(K) = f^{-1}^{-1}(K). \]
Subring.comap_equiv_eq_map_symm theorem
(f : R ≃+* S) (K : Subring S) : K.comap (f : R →+* S) = K.map f.symm
Full source
theorem comap_equiv_eq_map_symm (f : R ≃+* S) (K : Subring S) :
    K.comap (f : R →+* S) = K.map f.symm :=
  (map_equiv_eq_comap_symm f.symm K).symm
Preimage-Image Duality for Subrings under Ring Isomorphisms
Informal description
Let $R$ and $S$ be rings, and let $f : R \simeq+* S$ be a ring isomorphism. For any subring $K$ of $S$, the preimage of $K$ under $f$ is equal to the image of $K$ under the inverse isomorphism $f^{-1} : S \simeq+* R$. In other words, \[ f^{-1}(K) = f^{-1}(K). \]
RingHom.rangeRestrict definition
(f : R →+* S) : R →+* f.range
Full source
/-- Restriction of a ring homomorphism to its range interpreted as a subsemiring.

This is the bundled version of `Set.rangeFactorization`. -/
def rangeRestrict (f : R →+* S) : R →+* f.range :=
  f.codRestrict f.range fun x => ⟨x, rfl⟩
Range restriction of a ring homomorphism
Informal description
Given a ring homomorphism \( f \colon R \to S \), the range restriction of \( f \) is the ring homomorphism from \( R \) to the range of \( f \) (as a subring of \( S \)), defined by mapping each \( x \in R \) to \( f(x) \) viewed as an element of the range subring. This is the bundled version of the factorization of \( f \) through its range.
RingHom.coe_rangeRestrict theorem
(f : R →+* S) (x : R) : (f.rangeRestrict x : S) = f x
Full source
@[simp]
theorem coe_rangeRestrict (f : R →+* S) (x : R) : (f.rangeRestrict x : S) = f x :=
  rfl
Range-Restricted Homomorphism Preserves Images
Informal description
For any ring homomorphism $f \colon R \to S$ and any element $x \in R$, the image of $x$ under the range-restricted homomorphism $f.rangeRestrict$ (viewed as an element of $S$) equals $f(x)$. In other words, the following diagram commutes: \[ (f.rangeRestrict(x) : S) = f(x). \]
RingHom.rangeRestrict_surjective theorem
(f : R →+* S) : Function.Surjective f.rangeRestrict
Full source
theorem rangeRestrict_surjective (f : R →+* S) : Function.Surjective f.rangeRestrict :=
  fun ⟨_y, hy⟩ =>
  let ⟨x, hx⟩ := mem_range.mp hy
  ⟨x, Subtype.ext hx⟩
Surjectivity of Range-Restricted Ring Homomorphism
Informal description
For any ring homomorphism $f \colon R \to S$, the range restriction $f_{\text{range}} \colon R \to f.\text{range}$ is surjective. That is, for every $y \in f.\text{range}$, there exists an $x \in R$ such that $f_{\text{range}}(x) = y$.
RingHom.range_eq_top theorem
{f : R →+* S} : f.range = (⊤ : Subring S) ↔ Function.Surjective f
Full source
theorem range_eq_top {f : R →+* S} :
    f.range = (⊤ : Subring S) ↔ Function.Surjective f :=
  SetLike.ext'_iff.trans <| Iff.trans (by rw [coe_range, coe_top]) Set.range_eq_univ
Range Equals Top Subring iff Ring Homomorphism is Surjective
Informal description
For a ring homomorphism $f \colon R \to S$, the range of $f$ is equal to the entire ring $S$ (as a subring) if and only if $f$ is surjective. In other words, $f.\text{range} = \top \leftrightarrow \text{Surjective}(f)$.
RingHom.range_eq_top_of_surjective theorem
(f : R →+* S) (hf : Function.Surjective f) : f.range = (⊤ : Subring S)
Full source
/-- The range of a surjective ring homomorphism is the whole of the codomain. -/
@[simp]
theorem range_eq_top_of_surjective (f : R →+* S) (hf : Function.Surjective f) :
    f.range = ( : Subring S) :=
  range_eq_top.2 hf
Range of Surjective Ring Homomorphism is Entire Codomain
Informal description
For a surjective ring homomorphism $f \colon R \to S$, the range of $f$ is equal to the entire ring $S$ (as a subring). That is, $f(R) = S$.
RingHom.eqLocus definition
(f g : R →+* S) : Subring R
Full source
/-- The subring of elements `x : R` such that `f x = g x`, i.e.,
  the equalizer of f and g as a subring of R -/
def eqLocus (f g : R →+* S) : Subring R :=
  { (f : R →* S).eqLocusM g, (f : R →+ S).eqLocus g with carrier := { x | f x = g x } }
Equalizer subring of ring homomorphisms
Informal description
Given two ring homomorphisms \( f, g \colon R \to S \), the subring \(\text{eqLocus}(f, g)\) consists of all elements \( x \in R \) such that \( f(x) = g(x) \). This is the equalizer of \( f \) and \( g \) as a subring of \( R \).
RingHom.eqLocus_same theorem
(f : R →+* S) : f.eqLocus f = ⊤
Full source
@[simp]
theorem eqLocus_same (f : R →+* S) : f.eqLocus f =  :=
  SetLike.ext fun _ => eq_self_iff_true _
Equalizer Subring of a Ring Homomorphism with Itself is the Full Ring
Informal description
For any ring homomorphism $f \colon R \to S$, the equalizer subring $\text{eqLocus}(f, f)$ is equal to the entire ring $R$ (denoted by $\top$ in the lattice of subrings).
RingHom.eqOn_set_closure theorem
{f g : R →+* S} {s : Set R} (h : Set.EqOn f g s) : Set.EqOn f g (closure s)
Full source
/-- If two ring homomorphisms are equal on a set, then they are equal on its subring closure. -/
theorem eqOn_set_closure {f g : R →+* S} {s : Set R} (h : Set.EqOn f g s) :
    Set.EqOn f g (closure s) :=
  show closure s ≤ f.eqLocus g from closure_le.2 h
Agreement of Ring Homomorphisms on Subring Closure
Informal description
Let $R$ and $S$ be rings, and let $f, g \colon R \to S$ be ring homomorphisms. If $f$ and $g$ agree on a subset $s \subseteq R$, then they also agree on the subring closure of $s$.
RingHom.closure_preimage_le theorem
(f : R →+* S) (s : Set S) : closure (f ⁻¹' s) ≤ (closure s).comap f
Full source
theorem closure_preimage_le (f : R →+* S) (s : Set S) : closure (f ⁻¹' s) ≤ (closure s).comap f :=
  closure_le.2 fun _ hx => SetLike.mem_coe.2 <| mem_comap.2 <| subset_closure hx
Subring Closure of Preimage is Contained in Preimage of Closure
Informal description
Let $R$ and $S$ be rings, and $f : R \to S$ a ring homomorphism. For any subset $s \subseteq S$, the subring closure of the preimage $f^{-1}(s)$ is contained in the preimage of the subring closure of $s$ under $f$. In other words, $$\text{closure}(f^{-1}(s)) \leq f^{-1}(\text{closure}(s)).$$
RingHom.map_closure theorem
(f : R →+* S) (s : Set R) : (closure s).map f = closure (f '' s)
Full source
/-- The image under a ring homomorphism of the subring generated by a set equals
the subring generated by the image of the set. -/
theorem map_closure (f : R →+* S) (s : Set R) : (closure s).map f = closure (f '' s) :=
  Set.image_preimage.l_comm_of_u_comm (gc_map_comap f) (Subring.gi S).gc (Subring.gi R).gc
    fun _ ↦ rfl
Image of Subring Closure Equals Closure of Image
Informal description
Let $R$ and $S$ be rings and $f \colon R \to S$ a ring homomorphism. For any subset $s \subseteq R$, the image of the subring generated by $s$ under $f$ equals the subring generated by the image $f(s)$ in $S$. In other words: $$ f(\text{closure}(s)) = \text{closure}(f(s)). $$
Subring.inclusion definition
{S T : Subring R} (h : S ≤ T) : S →+* T
Full source
/-- The ring homomorphism associated to an inclusion of subrings. -/
def inclusion {S T : Subring R} (h : S ≤ T) : S →+* T :=
  S.subtype.codRestrict _ fun x => h x.2
Inclusion homomorphism of subrings
Informal description
Given two subrings \( S \) and \( T \) of a ring \( R \) such that \( S \) is contained in \( T \) (i.e., \( S \leq T \)), the inclusion map \( \text{Subring.inclusion} \) is the ring homomorphism from \( S \) to \( T \) that maps each element of \( S \) to itself as an element of \( T \).
Subring.range_fst theorem
: (fst R S).rangeS = ⊤
Full source
theorem range_fst : (fst R S).rangeS =  :=
  (fst R S).rangeS_top_of_surjective <| Prod.fst_surjective
Range of First Projection Ring Homomorphism is Top Subring
Informal description
The range of the first projection ring homomorphism $\operatorname{fst} : R \times S \to R$ is equal to the top subring of $R$, i.e., $\operatorname{range}(\operatorname{fst}) = \top$.
Subring.range_snd theorem
: (snd R S).rangeS = ⊤
Full source
theorem range_snd : (snd R S).rangeS =  :=
  (snd R S).rangeS_top_of_surjective <| Prod.snd_surjective
Range of Second Projection Ring Homomorphism is Entire Codomain
Informal description
The range of the second projection ring homomorphism $\operatorname{snd} : R \times S \to S$ is the entire ring $S$, i.e., $\operatorname{range}(\operatorname{snd}) = \top$.
Subring.prod_bot_sup_bot_prod theorem
(s : Subring R) (t : Subring S) : s.prod ⊥ ⊔ prod ⊥ t = s.prod t
Full source
@[simp]
theorem prod_bot_sup_bot_prod (s : Subring R) (t : Subring S) : s.prod ⊥ ⊔ prod ⊥ t = s.prod t :=
  le_antisymm (sup_le (prod_mono_right s bot_le) (prod_mono_left t bot_le)) fun p hp =>
    Prod.fst_mul_snd p ▸
      mul_mem
        ((le_sup_left : s.prod s.prod ⊥ ⊔ prod ⊥ t) ⟨hp.1, SetLike.mem_coe.2 <| one_mem ⊥⟩)
        ((le_sup_right : prod  t ≤ s.prod ⊥ ⊔ prod ⊥ t) ⟨SetLike.mem_coe.2 <| one_mem ⊥, hp.2⟩)
Supremum of Product Subrings with Bottom Elements Equals Full Product Subring
Informal description
For any subrings $s$ of a ring $R$ and $t$ of a ring $S$, the supremum of the product subrings $s \times \{\bot_S\}$ and $\{\bot_R\} \times t$ equals the product subring $s \times t$, where $\bot_R$ and $\bot_S$ denote the bottom elements of the subring lattices of $R$ and $S$ respectively.
RingEquiv.subringCongr definition
(h : s = t) : s ≃+* t
Full source
/-- Makes the identity isomorphism from a proof two subrings of a multiplicative
    monoid are equal. -/
def subringCongr (h : s = t) : s ≃+* t :=
  { Equiv.setCongr <| congr_arg _ h with
    map_mul' := fun _ _ => rfl
    map_add' := fun _ _ => rfl }
Ring equivalence of equal subrings
Informal description
Given two subrings \( s \) and \( t \) of a ring \( R \) that are equal (\( s = t \)), the ring equivalence \( s \simeq+* t \) is the identity isomorphism between them, preserving both the multiplicative and additive structures.
RingEquiv.ofLeftInverse definition
{g : S → R} {f : R →+* S} (h : Function.LeftInverse g f) : R ≃+* f.range
Full source
/-- Restrict a ring homomorphism with a left inverse to a ring isomorphism to its
`RingHom.range`. -/
def ofLeftInverse {g : S → R} {f : R →+* S} (h : Function.LeftInverse g f) : R ≃+* f.range :=
  { f.rangeRestrict with
    toFun := fun x => f.rangeRestrict x
    invFun := fun x => (g ∘ f.range.subtype) x
    left_inv := h
    right_inv := fun x =>
      Subtype.ext <|
        let ⟨x', hx'⟩ := RingHom.mem_range.mp x.prop
        show f (g x) = x by rw [← hx', h x'] }
Ring isomorphism from left inverse of a ring homomorphism to its range
Informal description
Given a ring homomorphism $f \colon R \to S$ with a left inverse $g \colon S \to R$ (i.e., $g \circ f = \text{id}_R$), the function constructs a ring isomorphism between $R$ and the range of $f$ (as a subring of $S$). Specifically, the isomorphism maps each $x \in R$ to $f(x)$ in the range, and its inverse maps each $y$ in the range to $g(y)$. This shows that $R$ is isomorphic to its image under $f$ when $f$ has a left inverse.
RingEquiv.ofLeftInverse_apply theorem
{g : S → R} {f : R →+* S} (h : Function.LeftInverse g f) (x : R) : ↑(ofLeftInverse h x) = f x
Full source
@[simp]
theorem ofLeftInverse_apply {g : S → R} {f : R →+* S} (h : Function.LeftInverse g f) (x : R) :
    ↑(ofLeftInverse h x) = f x :=
  rfl
Image of element under ring isomorphism induced by left inverse equals its image under original homomorphism
Informal description
Let $R$ and $S$ be rings, $f \colon R \to S$ a ring homomorphism, and $g \colon S \to R$ a left inverse of $f$ (i.e., $g \circ f = \text{id}_R$). Then for any $x \in R$, the image of $x$ under the ring isomorphism $\text{ofLeftInverse}\ h \colon R \simeq^{+*} f.\text{range}$ equals $f(x)$.
RingEquiv.ofLeftInverse_symm_apply theorem
{g : S → R} {f : R →+* S} (h : Function.LeftInverse g f) (x : f.range) : (ofLeftInverse h).symm x = g x
Full source
@[simp]
theorem ofLeftInverse_symm_apply {g : S → R} {f : R →+* S} (h : Function.LeftInverse g f)
    (x : f.range) : (ofLeftInverse h).symm x = g x :=
  rfl
Inverse of ring isomorphism from left inverse equals original left inverse on range
Informal description
Given a ring homomorphism $f \colon R \to S$ with a left inverse $g \colon S \to R$ (i.e., $g \circ f = \text{id}_R$), the inverse of the ring isomorphism $\text{ofLeftInverse}\ h \colon R \simeq^{+*} f.\text{range}$ satisfies $(\text{ofLeftInverse}\ h)^{-1}(x) = g(x)$ for any $x$ in the range of $f$.
RingEquiv.subringMap definition
(e : R ≃+* S) : s ≃+* s.map e.toRingHom
Full source
/-- Given an equivalence `e : R ≃+* S` of rings and a subring `s` of `R`,
`subringMap e s` is the induced equivalence between `s` and `s.map e` -/
def subringMap (e : R ≃+* S) : s ≃+* s.map e.toRingHom :=
  e.subsemiringMap s.toSubsemiring
Induced subring isomorphism via ring isomorphism
Informal description
Given a ring isomorphism \( e \colon R \simeq^{+*} S \) and a subring \( s \) of \( R \), the function `RingEquiv.subringMap` constructs a ring isomorphism between \( s \) and the image of \( s \) under \( e \), denoted \( s.\text{map} \, e \). This isomorphism preserves both the additive and multiplicative structures of the subrings.
Subring.InClosure.recOn theorem
{C : R → Prop} {x : R} (hx : x ∈ closure s) (h1 : C 1) (hneg1 : C (-1)) (hs : ∀ z ∈ s, ∀ n, C n → C (z * n)) (ha : ∀ {x y}, C x → C y → C (x + y)) : C x
Full source
@[elab_as_elim]
protected theorem InClosure.recOn {C : R → Prop} {x : R} (hx : x ∈ closure s) (h1 : C 1)
    (hneg1 : C (-1)) (hs : ∀ z ∈ s, ∀ n, C n → C (z * n)) (ha : ∀ {x y}, C x → C y → C (x + y)) :
    C x := by
  have h0 : C 0 := add_neg_cancel (1 : R) ▸ ha h1 hneg1
  rcases exists_list_of_mem_closure hx with ⟨L, HL, rfl⟩
  clear hx
  induction' L with hd tl ih
  · exact h0
  rw [List.forall_mem_cons] at HL
  suffices C (List.prod hd) by
    rw [List.map_cons, List.sum_cons]
    exact ha this (ih HL.2)
  replace HL := HL.1
  clear ih tl
  rsuffices ⟨L, HL', HP | HP⟩ :
    ∃ L : List R, (∀ x ∈ L, x ∈ s) ∧ (List.prod hd = List.prod L ∨ List.prod hd = -List.prod L)
  · rw [HP]
    clear HP HL hd
    induction' L with hd tl ih
    · exact h1
    rw [List.forall_mem_cons] at HL'
    rw [List.prod_cons]
    exact hs _ HL'.1 _ (ih HL'.2)
  · rw [HP]
    clear HP HL hd
    induction' L with hd tl ih
    · exact hneg1
    rw [List.prod_cons, neg_mul_eq_mul_neg]
    rw [List.forall_mem_cons] at HL'
    exact hs _ HL'.1 _ (ih HL'.2)
  induction' hd with hd tl ih
  · exact ⟨[], List.forall_mem_nil _, Or.inl rfl⟩
  rw [List.forall_mem_cons] at HL
  rcases ih HL.2 with ⟨L, HL', HP | HP⟩ <;> rcases HL.1 with hhd | hhd
  · exact
      ⟨hd::L, List.forall_mem_cons.2 ⟨hhd, HL'⟩,
        Or.inl <| by rw [List.prod_cons, List.prod_cons, HP]⟩
  · exact ⟨L, HL', Or.inr <| by rw [List.prod_cons, hhd, neg_one_mul, HP]⟩
  · exact
      ⟨hd::L, List.forall_mem_cons.2 ⟨hhd, HL'⟩,
        Or.inr <| by rw [List.prod_cons, List.prod_cons, HP, neg_mul_eq_mul_neg]⟩
  · exact ⟨L, HL', Or.inl <| by rw [List.prod_cons, hhd, HP, neg_one_mul, neg_neg]⟩
Recursion Principle for Subring Membership
Informal description
Let $R$ be a ring and $s$ a subset of $R$. For any property $C$ of elements of $R$ and any $x$ in the subring generated by $s$, if: 1. $C(1)$ holds, 2. $C(-1)$ holds, 3. For all $z \in s$ and $n \in R$, $C(n)$ implies $C(z \cdot n)$, and 4. For all $x, y \in R$, $C(x)$ and $C(y)$ imply $C(x + y)$, then $C(x)$ holds.
Subring.closure_preimage_le theorem
(f : R →+* S) (s : Set S) : closure (f ⁻¹' s) ≤ (closure s).comap f
Full source
theorem closure_preimage_le (f : R →+* S) (s : Set S) : closure (f ⁻¹' s) ≤ (closure s).comap f :=
  closure_le.2 fun _ hx => SetLike.mem_coe.2 <| mem_comap.2 <| subset_closure hx
Subring Closure of Preimage is Contained in Preimage of Closure
Informal description
Let $R$ and $S$ be rings, and $f : R \to S$ a ring homomorphism. For any subset $s \subseteq S$, the subring closure of the preimage $f^{-1}(s)$ is contained in the preimage of the subring closure of $s$ under $f$. In other words, $\text{closure}(f^{-1}(s)) \leq f^{-1}(\text{closure}(s))$.
Subring.instSMulSubtypeMem instance
[SMul R α] (S : Subring R) : SMul S α
Full source
/-- The action by a subring is the action by the underlying ring. -/
instance [SMul R α] (S : Subring R) : SMul S α :=
  inferInstanceAs (SMul S.toSubsemiring α)
Scalar Multiplication Induced by Subring Inclusion
Informal description
For any ring $R$ and type $\alpha$ equipped with a scalar multiplication operation by elements of $R$, every subring $S$ of $R$ inherits a scalar multiplication operation on $\alpha$ via the inclusion map $S \hookrightarrow R$.
Subring.smul_def theorem
[SMul R α] {S : Subring R} (g : S) (m : α) : g • m = (g : R) • m
Full source
theorem smul_def [SMul R α] {S : Subring R} (g : S) (m : α) : g • m = (g : R) • m :=
  rfl
Subring Scalar Multiplication Definition: $g \bullet m = (g : R) \bullet m$
Informal description
Let $R$ be a ring and $\alpha$ be a type equipped with a scalar multiplication operation by elements of $R$. For any subring $S$ of $R$, the scalar multiplication of an element $g \in S$ on an element $m \in \alpha$ is equal to the scalar multiplication of $g$ (viewed as an element of $R$) on $m$, i.e., $g \bullet m = (g : R) \bullet m$.
Subring.smulCommClass_left instance
[SMul R β] [SMul α β] [SMulCommClass R α β] (S : Subring R) : SMulCommClass S α β
Full source
instance smulCommClass_left [SMul R β] [SMul α β] [SMulCommClass R α β] (S : Subring R) :
    SMulCommClass S α β :=
  inferInstanceAs (SMulCommClass S.toSubsemiring α β)
Commutativity of Subring and Scalar Multiplication
Informal description
For any ring $R$, type $\beta$ with scalar multiplications by $R$ and $\alpha$, if the scalar multiplications by $R$ and $\alpha$ on $\beta$ commute, then for any subring $S$ of $R$, the scalar multiplications by $S$ and $\alpha$ on $\beta$ also commute. That is, for any $s \in S$, $a \in \alpha$, and $b \in \beta$, we have $s \cdot (a \cdot b) = a \cdot (s \cdot b)$.
Subring.smulCommClass_right instance
[SMul α β] [SMul R β] [SMulCommClass α R β] (S : Subring R) : SMulCommClass α S β
Full source
instance smulCommClass_right [SMul α β] [SMul R β] [SMulCommClass α R β] (S : Subring R) :
    SMulCommClass α S β :=
  inferInstanceAs (SMulCommClass α S.toSubsemiring β)
Commutativity of Scalar Multiplication with Subring Elements
Informal description
For any type $\alpha$ and $\beta$ equipped with scalar multiplication operations by $\alpha$ and $R$ respectively, if the scalar multiplications by $\alpha$ and $R$ on $\beta$ commute, then for any subring $S$ of $R$, the scalar multiplications by $\alpha$ and $S$ on $\beta$ also commute. In other words, for any $a \in \alpha$, $s \in S$, and $b \in \beta$, we have $a \cdot (s \cdot b) = s \cdot (a \cdot b)$.
Subring.instIsScalarTowerSubtypeMem instance
[SMul α β] [SMul R α] [SMul R β] [IsScalarTower R α β] (S : Subring R) : IsScalarTower S α β
Full source
/-- Note that this provides `IsScalarTower S R R` which is needed by `smul_mul_assoc`. -/
instance [SMul α β] [SMul R α] [SMul R β] [IsScalarTower R α β] (S : Subring R) :
    IsScalarTower S α β :=
  inferInstanceAs (IsScalarTower S.toSubsemiring α β)
Subrings Inherit Scalar Multiplication Tower Property
Informal description
For any ring $R$ and types $\alpha, \beta$ equipped with scalar multiplication operations, if $R$ acts on $\alpha$ and $\beta$ such that the scalar multiplication tower property holds (i.e., $(r \cdot s) \cdot t = r \cdot (s \cdot t)$ for $r \in R$, $s \in \alpha$, $t \in \beta$), then any subring $S$ of $R$ also satisfies the scalar multiplication tower property on $\alpha$ and $\beta$.
Subring.instFaithfulSMulSubtypeMem instance
[SMul R α] [FaithfulSMul R α] (S : Subring R) : FaithfulSMul S α
Full source
instance [SMul R α] [FaithfulSMul R α] (S : Subring R) : FaithfulSMul S α :=
  inferInstanceAs (FaithfulSMul S.toSubsemiring α)
Faithful Scalar Multiplication Inherited by Subrings
Informal description
For any ring $R$ and type $\alpha$ with a faithful scalar multiplication action by $R$, every subring $S$ of $R$ also acts faithfully on $\alpha$ via the inherited scalar multiplication. This means that if two elements $s_1, s_2 \in S$ satisfy $s_1 \cdot a = s_2 \cdot a$ for all $a \in \alpha$, then $s_1 = s_2$.
Subring.instMulActionSubtypeMem instance
[MulAction R α] (S : Subring R) : MulAction S α
Full source
/-- The action by a subring is the action by the underlying ring. -/
instance [MulAction R α] (S : Subring R) : MulAction S α :=
  inferInstanceAs (MulAction S.toSubsemiring α)
Multiplicative Action by Subrings
Informal description
For any ring $R$ and type $\alpha$ with a multiplicative action of $R$ on $\alpha$, every subring $S$ of $R$ inherits a multiplicative action on $\alpha$ by restricting the action of $R$.
Subring.instDistribMulActionSubtypeMem instance
[AddMonoid α] [DistribMulAction R α] (S : Subring R) : DistribMulAction S α
Full source
/-- The action by a subring is the action by the underlying ring. -/
instance [AddMonoid α] [DistribMulAction R α] (S : Subring R) : DistribMulAction S α :=
  inferInstanceAs (DistribMulAction S.toSubsemiring α)
Distributive Multiplicative Action Inherited by Subrings
Informal description
For any additive monoid $\alpha$ with a distributive multiplicative action by a ring $R$, every subring $S$ of $R$ inherits a distributive multiplicative action on $\alpha$. This means that for any $s \in S$ and $a, b \in \alpha$, the action satisfies $s \cdot (a + b) = s \cdot a + s \cdot b$ and $s \cdot 0 = 0$.
Subring.instMulDistribMulActionSubtypeMem instance
[Monoid α] [MulDistribMulAction R α] (S : Subring R) : MulDistribMulAction S α
Full source
/-- The action by a subring is the action by the underlying ring. -/
instance [Monoid α] [MulDistribMulAction R α] (S : Subring R) : MulDistribMulAction S α :=
  inferInstanceAs (MulDistribMulAction S.toSubsemiring α)
Subrings Inherit Multiplicative Distributive Actions
Informal description
For any monoid $\alpha$ and any ring $R$ with a multiplicative distributive action on $\alpha$, every subring $S$ of $R$ inherits a multiplicative distributive action on $\alpha$. This means that for any $s \in S$ and $a, b \in \alpha$, the action satisfies $s \cdot (a * b) = (s \cdot a) * (s \cdot b)$.
Subring.instSMulWithZeroSubtypeMem instance
[Zero α] [SMulWithZero R α] (S : Subring R) : SMulWithZero S α
Full source
/-- The action by a subring is the action by the underlying ring. -/
instance [Zero α] [SMulWithZero R α] (S : Subring R) : SMulWithZero S α :=
  inferInstanceAs (SMulWithZero S.toSubsemiring α)
Subrings Inherit Zero-Preserving Scalar Multiplication
Informal description
For any ring $R$ with a subring $S$, and any type $\alpha$ with a zero element equipped with a scalar multiplication operation by $R$ that preserves zero (i.e., $r \cdot 0 = 0$ and $0 \cdot a = 0$ for all $r \in R$ and $a \in \alpha$), the subring $S$ inherits a scalar multiplication operation on $\alpha$ that also preserves zero.
Subring.instMulActionWithZeroSubtypeMem instance
[Zero α] [MulActionWithZero R α] (S : Subring R) : MulActionWithZero S α
Full source
/-- The action by a subring is the action by the underlying ring. -/
instance [Zero α] [MulActionWithZero R α] (S : Subring R) : MulActionWithZero S α :=
  -- inferInstanceAs (MulActionWithZero S.toSubsemiring α) -- Porting note: does not work
  Subsemiring.mulActionWithZero S.toSubsemiring
Subring Inherits Multiplicative Action with Zero
Informal description
For any ring $R$, any type $\alpha$ with a zero element, and any multiplicative action with zero of $R$ on $\alpha$, a subring $S$ of $R$ inherits a multiplicative action with zero on $\alpha$ by restricting the action of $R$ to $S$.
Subring.instModuleSubtypeMem instance
[AddCommMonoid α] [Module R α] (S : Subring R) : Module S α
Full source
/-- The action by a subring is the action by the underlying ring. -/
instance [AddCommMonoid α] [Module R α] (S : Subring R) : Module S α :=
  -- inferInstanceAs (Module S.toSubsemiring α) -- Porting note: does not work
  Subsemiring.module S.toSubsemiring
Module Structure on Subrings
Informal description
For any subring $S$ of a ring $R$ and any additive commutative monoid $\alpha$ equipped with a module structure over $R$, $\alpha$ inherits a module structure over $S$ where the scalar multiplication is defined by restricting the $R$-action to $S$.
Subring.instMulSemiringActionSubtypeMem instance
[Semiring α] [MulSemiringAction R α] (S : Subring R) : MulSemiringAction S α
Full source
/-- The action by a subsemiring is the action by the underlying ring. -/
instance [Semiring α] [MulSemiringAction R α] (S : Subring R) : MulSemiringAction S α :=
  inferInstanceAs (MulSemiringAction S.toSubmonoid α)
Subrings Inherit Multiplicative Semiring Actions
Informal description
For any semiring $\alpha$ and any ring $R$ with a multiplicative semiring action on $\alpha$, a subring $S$ of $R$ inherits a multiplicative semiring action on $\alpha$ by restricting the action of $R$ to $S$.
Subring.center.smulCommClass_left instance
: SMulCommClass (center R) R R
Full source
/-- The center of a semiring acts commutatively on that semiring. -/
instance center.smulCommClass_left : SMulCommClass (center R) R R :=
  Subsemiring.center.smulCommClass_left
Commutativity of Center Scalar Multiplication in a Ring
Informal description
For any ring $R$, the scalar multiplication by elements of the center of $R$ commutes with the scalar multiplication by elements of $R$ itself. That is, for any $z$ in the center of $R$, $r \in R$, and $x \in R$, we have $z \cdot (r \cdot x) = r \cdot (z \cdot x)$.
Subring.center.smulCommClass_right instance
: SMulCommClass R (center R) R
Full source
/-- The center of a semiring acts commutatively on that semiring. -/
instance center.smulCommClass_right : SMulCommClass R (center R) R :=
  Subsemiring.center.smulCommClass_right
Commutativity of Scalar Multiplication with Center Elements
Informal description
For any ring $R$, the scalar multiplication by elements of $R$ commutes with the scalar multiplication by elements of the center of $R$. That is, for any $r \in R$, $z$ in the center of $R$, and $x \in R$, we have $r \cdot (z \cdot x) = z \cdot (r \cdot x)$.
Subring.map_comap_eq theorem
(f : R →+* S) (t : Subring S) : (t.comap f).map f = t ⊓ f.range
Full source
theorem map_comap_eq (f : R →+* S) (t : Subring S) : (t.comap f).map f = t ⊓ f.range :=
  SetLike.coe_injective Set.image_preimage_eq_inter_range
Image-Preimage Equality for Ring Homomorphisms: $f(f^{-1}(t)) = t \cap \mathrm{range}(f)$
Informal description
Let $R$ and $S$ be rings, $f : R \to S$ a ring homomorphism, and $t$ a subring of $S$. Then the image of the preimage of $t$ under $f$ equals the intersection of $t$ with the range of $f$, i.e., $$ f(f^{-1}(t)) = t \cap \mathrm{range}(f). $$
Subring.map_comap_eq_self theorem
{f : R →+* S} {t : Subring S} (h : t ≤ f.range) : (t.comap f).map f = t
Full source
theorem map_comap_eq_self
    {f : R →+* S} {t : Subring S} (h : t ≤ f.range) : (t.comap f).map f = t := by
  simpa only [inf_of_le_left h] using Subring.map_comap_eq f t
Image-Preimage Identity for Subrings: $f(f^{-1}(t)) = t$ when $t \subseteq \mathrm{range}(f)$
Informal description
Let $R$ and $S$ be rings, $f : R \to S$ a ring homomorphism, and $t$ a subring of $S$ that is contained in the range of $f$. Then the image of the preimage of $t$ under $f$ equals $t$ itself, i.e., $$ f(f^{-1}(t)) = t. $$
Subring.map_comap_eq_self_of_surjective theorem
{f : R →+* S} (hf : Function.Surjective f) (t : Subring S) : (t.comap f).map f = t
Full source
theorem map_comap_eq_self_of_surjective
    {f : R →+* S} (hf : Function.Surjective f) (t : Subring S) : (t.comap f).map f = t :=
  map_comap_eq_self <| by simp [hf]
Image-Preimage Identity for Subrings under Surjective Homomorphism: $f(f^{-1}(t)) = t$
Informal description
Let $R$ and $S$ be rings and $f : R \to S$ a surjective ring homomorphism. For any subring $t$ of $S$, the image of the preimage of $t$ under $f$ equals $t$ itself, i.e., $$ f(f^{-1}(t)) = t. $$
Subring.comap_map_eq theorem
(f : R →+* S) (s : Subring R) : (s.map f).comap f = s ⊔ closure (f ⁻¹' {0})
Full source
theorem comap_map_eq (f : R →+* S) (s : Subring R) :
    (s.map f).comap f = s ⊔ closure (f ⁻¹' {0}) := by
  apply le_antisymm
  · intro x hx
    rw [mem_comap, mem_map] at hx
    obtain ⟨y, hy, hxy⟩ := hx
    replace hxy : x - y ∈ f ⁻¹' {0} := by simp [hxy]
    rw [← closure_eq s, ← closure_union, ← add_sub_cancel y x]
    exact Subring.add_mem _ (subset_closure <| Or.inl hy) (subset_closure <| Or.inr hxy)
  · rw [← map_le_iff_le_comap, map_sup, f.map_closure]
    apply le_of_eq
    rw [sup_eq_left, closure_le]
    exact (Set.image_preimage_subset f {0}).trans (Set.singleton_subset_iff.2 (s.map f).zero_mem)
Preimage-Image Identity for Subrings: $f^{-1}(f(s)) = s \sqcup \text{closure}(\ker f)$
Informal description
Let $R$ and $S$ be rings and $f \colon R \to S$ a ring homomorphism. For any subring $s$ of $R$, the preimage of the image of $s$ under $f$ equals the join of $s$ and the subring generated by the kernel of $f$, i.e., $$ f^{-1}(f(s)) = s \sqcup \text{closure}(f^{-1}(\{0\})). $$
Subring.comap_map_eq_self theorem
{f : R →+* S} {s : Subring R} (h : f ⁻¹' {0} ⊆ s) : (s.map f).comap f = s
Full source
theorem comap_map_eq_self {f : R →+* S} {s : Subring R}
    (h : f ⁻¹' {0}f ⁻¹' {0} ⊆ s) : (s.map f).comap f = s := by
  convert comap_map_eq f s
  rwa [left_eq_sup, closure_le]
Preimage-Image Identity for Subrings with Kernel Condition: $f^{-1}(f(s)) = s$ when $\ker f \subseteq s$
Informal description
Let $f \colon R \to S$ be a ring homomorphism and let $s$ be a subring of $R$. If the kernel of $f$ (i.e., the preimage $f^{-1}(\{0\})$) is contained in $s$, then the preimage of the image of $s$ under $f$ equals $s$ itself, i.e., $$ f^{-1}(f(s)) = s. $$
Subring.comap_map_eq_self_of_injective theorem
{f : R →+* S} (hf : Function.Injective f) (s : Subring R) : (s.map f).comap f = s
Full source
theorem comap_map_eq_self_of_injective
    {f : R →+* S} (hf : Function.Injective f) (s : Subring R) : (s.map f).comap f = s :=
  SetLike.coe_injective (Set.preimage_image_eq _ hf)
Preimage of Image Equals Original Subring for Injective Ring Homomorphisms
Informal description
Let $f \colon R \to S$ be an injective ring homomorphism and let $s$ be a subring of $R$. Then the preimage of the image of $s$ under $f$ is equal to $s$ itself, i.e., $f^{-1}(f(s)) = s$.
AddSubgroup.int_mul_mem theorem
{G : AddSubgroup R} (k : ℤ) {g : R} (h : g ∈ G) : (k : R) * g ∈ G
Full source
theorem AddSubgroup.int_mul_mem {G : AddSubgroup R} (k : ) {g : R} (h : g ∈ G) :
    (k : R) * g ∈ G := by
  convert AddSubgroup.zsmul_mem G h k using 1
  rw [zsmul_eq_mul]
Integer Scalar Multiplication Preserves Additive Subgroup Membership
Informal description
Let $G$ be an additive subgroup of a ring $R$. For any integer $k$ and any element $g \in G$, the product $(k : R) \cdot g$ is also in $G$.