doc-next-gen

Mathlib.Algebra.Algebra.Subalgebra.Lattice

Module docstring

{"# Complete lattice structure of subalgebras

In this file we define Algebra.adjoin and the complete lattice structure on subalgebras.

More lemmas about adjoin can be found in Mathlib.RingTheory.Adjoin.Basic. "}

Algebra.adjoin definition
(s : Set A) : Subalgebra R A
Full source
/-- The minimal subalgebra that includes `s`. -/
@[simps toSubsemiring]
def adjoin (s : Set A) : Subalgebra R A :=
  { Subsemiring.closure (Set.rangeSet.range (algebraMap R A) ∪ s) with
    algebraMap_mem' := fun r => Subsemiring.subset_closure <| Or.inl ⟨r, rfl⟩ }
Subalgebra generated by a set
Informal description
Given a commutative semiring $R$ and a semiring $A$ with an $R$-algebra structure, the function $\text{adjoin}_R(s)$ constructs the smallest subalgebra of $A$ containing a subset $s \subseteq A$. More precisely, $\text{adjoin}_R(s)$ is defined as the subsemiring closure of the union of the range of the algebra map $R \to A$ and the set $s$. This ensures that the resulting subalgebra is closed under both the algebraic operations of $A$ and the action of $R$.
Algebra.gc theorem
: GaloisConnection (adjoin R : Set A → Subalgebra R A) (↑)
Full source
protected theorem gc : GaloisConnection (adjoin R : Set A → Subalgebra R A) (↑) := fun s S =>
  ⟨fun H => le_trans (le_trans Set.subset_union_right Subsemiring.subset_closure) H,
   fun H => show Subsemiring.closure (Set.range (algebraMap R A) ∪ s) ≤ S.toSubsemiring from
      Subsemiring.closure_le.2 <| Set.union_subset S.range_subset H⟩
Galois Connection Between Subalgebra Generation and Carrier Sets
Informal description
The pair of functions $(\text{adjoin}_R, \text{carrier})$ forms a Galois connection between the power set of $A$ and the lattice of subalgebras of $A$ over $R$. That is, for any subset $s \subseteq A$ and any subalgebra $S$ of $A$, we have: $$\text{adjoin}_R(s) \leq S \leftrightarrow s \subseteq \text{carrier}(S).$$
Algebra.gi definition
: GaloisInsertion (adjoin R : Set A → Subalgebra R A) (↑)
Full source
/-- Galois insertion between `adjoin` and `coe`. -/
protected def gi : GaloisInsertion (adjoin R : Set A → Subalgebra R A) (↑) where
  choice s hs := (adjoin R s).copy s <| le_antisymm (Algebra.gc.le_u_l s) hs
  gc := Algebra.gc
  le_l_u S := (Algebra.gc (S : Set A) (adjoin R S)).1 <| le_rfl
  choice_eq _ _ := Subalgebra.copy_eq _ _ _
Galois insertion between subalgebra generation and carrier sets
Informal description
The pair of functions $(\text{adjoin}_R, \text{carrier})$ forms a Galois insertion between the power set of $A$ and the lattice of subalgebras of $A$ over $R$. Specifically, for any subset $s \subseteq A$, $\text{adjoin}_R(s)$ is the smallest subalgebra containing $s$, and for any subalgebra $S$, $\text{carrier}(S)$ is its underlying set. The Galois insertion property ensures that: 1. $\text{adjoin}_R$ is a left adjoint to $\text{carrier}$ (i.e., $\text{adjoin}_R(s) \leq S \leftrightarrow s \subseteq \text{carrier}(S)$). 2. $\text{adjoin}_R \circ \text{carrier} = \text{id}$ on subalgebras.
Algebra.instCompleteLatticeSubalgebra instance
: CompleteLattice (Subalgebra R A)
Full source
instance : CompleteLattice (Subalgebra R A) where
  __ := GaloisInsertion.liftCompleteLattice Algebra.gi
  bot := (Algebra.ofId R A).range
  bot_le _S := fun _a ⟨_r, hr⟩ => hr ▸ algebraMap_mem _ _
Complete Lattice Structure on Subalgebras of an $R$-Algebra
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the collection of all subalgebras of $A$ forms a complete lattice under inclusion. In this lattice: - The meet (infimum) of a family of subalgebras is their intersection. - The join (supremum) of a family of subalgebras is the subalgebra generated by their union. - The top element is $A$ itself. - The bottom element is the image of the algebra map $R \to A$.
Algebra.sup_def theorem
(S T : Subalgebra R A) : S ⊔ T = adjoin R (S ∪ T : Set A)
Full source
theorem sup_def (S T : Subalgebra R A) : S ⊔ T = adjoin R (S ∪ T : Set A) := rfl
Supremum of Subalgebras as Generated by Union
Informal description
For any two subalgebras $S$ and $T$ of an $R$-algebra $A$, their supremum $S \sqcup T$ in the lattice of subalgebras is equal to the subalgebra generated by the union $S \cup T$ as a subset of $A$.
Algebra.sSup_def theorem
(S : Set (Subalgebra R A)) : sSup S = adjoin R (⋃₀ (SetLike.coe '' S))
Full source
theorem sSup_def (S : Set (Subalgebra R A)) : sSup S = adjoin R (⋃₀ (SetLike.coe '' S)) := rfl
Supremum of Subalgebras is Generated by Their Union
Informal description
For any set $S$ of subalgebras of an $R$-algebra $A$, the supremum of $S$ in the complete lattice of subalgebras is equal to the subalgebra generated by the union of all the underlying sets of the subalgebras in $S$. More precisely, if we denote by $\bigcup₀ (\text{SetLike.coe} '' S)$ the union of the carrier sets of all subalgebras in $S$, then $\bigsqcup S = \text{adjoin}_R(\bigcup₀ (\text{SetLike.coe} '' S))$.
Algebra.coe_top theorem
: (↑(⊤ : Subalgebra R A) : Set A) = Set.univ
Full source
@[simp]
theorem coe_top : (↑( : Subalgebra R A) : Set A) = Set.univ := rfl
Top Subalgebra Equals Universal Set
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the underlying set of the top element in the complete lattice of subalgebras of $A$ is equal to the universal set of $A$.
Algebra.mem_top theorem
{x : A} : x ∈ (⊤ : Subalgebra R A)
Full source
@[simp]
theorem mem_top {x : A} : x ∈ (⊤ : Subalgebra R A) := Set.mem_univ x
Membership in Top Subalgebra of an $R$-Algebra
Informal description
For any element $x$ in an $R$-algebra $A$, $x$ belongs to the top subalgebra (which is $A$ itself).
Algebra.top_toSubmodule theorem
: Subalgebra.toSubmodule (⊤ : Subalgebra R A) = ⊤
Full source
@[simp]
theorem top_toSubmodule : Subalgebra.toSubmodule ( : Subalgebra R A) =  := rfl
Top Subalgebra Maps to Top Submodule
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the order embedding that maps a subalgebra to its underlying submodule sends the top element of the subalgebra lattice (which is $A$ itself) to the top element of the submodule lattice (which is $A$ as a module over $R$). In other words, the image of the entire algebra $A$ under the subalgebra-to-submodule embedding is the entire module $A$.
Algebra.top_toSubsemiring theorem
: (⊤ : Subalgebra R A).toSubsemiring = ⊤
Full source
@[simp]
theorem top_toSubsemiring : ( : Subalgebra R A).toSubsemiring =  := rfl
Top Subalgebra as Subsemiring is Top
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the underlying subsemiring of the top element in the lattice of subalgebras of $A$ is equal to the top element in the lattice of subsemirings of $A$. In other words, $(⊤ : \text{Subalgebra } R A).\text{toSubsemiring} = ⊤$.
Algebra.top_toSubring theorem
{R A : Type*} [CommRing R] [Ring A] [Algebra R A] : (⊤ : Subalgebra R A).toSubring = ⊤
Full source
@[simp]
theorem top_toSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] :
    ( : Subalgebra R A).toSubring =  := rfl
Top Subalgebra as Subring is Top
Informal description
For any commutative ring $R$ and ring $A$ equipped with an $R$-algebra structure, the underlying subring of the top element in the lattice of subalgebras of $A$ is equal to the top element in the lattice of subrings of $A$. In other words, if we view the entire algebra $A$ as a subalgebra, its underlying subring is exactly $A$ itself.
Algebra.toSubmodule_eq_top theorem
{S : Subalgebra R A} : Subalgebra.toSubmodule S = ⊤ ↔ S = ⊤
Full source
@[simp]
theorem toSubmodule_eq_top {S : Subalgebra R A} : Subalgebra.toSubmoduleSubalgebra.toSubmodule S = ⊤ ↔ S = ⊤ :=
  Subalgebra.toSubmodule.injective.eq_iff' top_toSubmodule
Subalgebra's Underlying Submodule is Entire Module if and only if Subalgebra is Entire Algebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the underlying submodule of $S$ is equal to the entire module $A$ if and only if $S$ is equal to the entire algebra $A$.
Algebra.toSubsemiring_eq_top theorem
{S : Subalgebra R A} : S.toSubsemiring = ⊤ ↔ S = ⊤
Full source
@[simp]
theorem toSubsemiring_eq_top {S : Subalgebra R A} : S.toSubsemiring = ⊤ ↔ S = ⊤ :=
  Subalgebra.toSubsemiring_injective.eq_iff' top_toSubsemiring
Subalgebra's Underlying Subsemiring is Entire Semiring if and only if Subalgebra is Entire Algebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the underlying subsemiring of $S$ is equal to the entire semiring $A$ if and only if $S$ itself is equal to the entire algebra $A$.
Algebra.toSubring_eq_top theorem
{R A : Type*} [CommRing R] [Ring A] [Algebra R A] {S : Subalgebra R A} : S.toSubring = ⊤ ↔ S = ⊤
Full source
@[simp]
theorem toSubring_eq_top {R A : Type*} [CommRing R] [Ring A] [Algebra R A] {S : Subalgebra R A} :
    S.toSubring = ⊤ ↔ S = ⊤ :=
  Subalgebra.toSubring_injective.eq_iff' top_toSubring
Characterization of Top Subalgebra via Underlying Subring
Informal description
Let $R$ be a commutative ring and $A$ a ring equipped with an $R$-algebra structure. For any subalgebra $S$ of $A$, the underlying subring of $S$ is equal to the entire ring $A$ if and only if $S$ is equal to the top subalgebra (i.e., $A$ itself).
Algebra.mem_sup_left theorem
{S T : Subalgebra R A} : ∀ {x : A}, x ∈ S → x ∈ S ⊔ T
Full source
theorem mem_sup_left {S T : Subalgebra R A} : ∀ {x : A}, x ∈ Sx ∈ S ⊔ T :=
  have : S ≤ S ⊔ T := le_sup_left; (this ·)
Left Subalgebra Inclusion in Supremum
Informal description
For any subalgebras $S$ and $T$ of an $R$-algebra $A$, if an element $x \in A$ belongs to $S$, then $x$ also belongs to the supremum $S \sqcup T$ in the lattice of subalgebras.
Algebra.mem_sup_right theorem
{S T : Subalgebra R A} : ∀ {x : A}, x ∈ T → x ∈ S ⊔ T
Full source
theorem mem_sup_right {S T : Subalgebra R A} : ∀ {x : A}, x ∈ Tx ∈ S ⊔ T :=
  have : T ≤ S ⊔ T := le_sup_right; (this ·)
Right Inclusion in Supremum of Subalgebras
Informal description
For any subalgebras $S$ and $T$ of an $R$-algebra $A$, if an element $x \in A$ belongs to $T$, then $x$ also belongs to the supremum $S \sqcup T$ of the subalgebras $S$ and $T$.
Algebra.mul_mem_sup theorem
{S T : Subalgebra R A} {x y : A} (hx : x ∈ S) (hy : y ∈ T) : x * y ∈ S ⊔ T
Full source
theorem mul_mem_sup {S T : Subalgebra R A} {x y : A} (hx : x ∈ S) (hy : y ∈ T) : x * y ∈ S ⊔ T :=
  (S ⊔ T).mul_mem (mem_sup_left hx) (mem_sup_right hy)
Product of Elements from Subalgebras Belongs to Their Supremum
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebras $S$ and $T$ of $A$, if $x \in S$ and $y \in T$, then the product $x \cdot y$ belongs to the supremum $S \sqcup T$ in the lattice of subalgebras.
Algebra.map_sup theorem
(f : A →ₐ[R] B) (S T : Subalgebra R A) : (S ⊔ T).map f = S.map f ⊔ T.map f
Full source
theorem map_sup (f : A →ₐ[R] B) (S T : Subalgebra R A) : (S ⊔ T).map f = S.map f ⊔ T.map f :=
  (Subalgebra.gc_map_comap f).l_sup
Image of Subalgebra Supremum under Algebra Homomorphism Equals Supremum of Images
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. For any $R$-algebra homomorphism $f \colon A \to B$ and any two subalgebras $S$ and $T$ of $A$, the image of the supremum $S \sqcup T$ under $f$ equals the supremum of the images of $S$ and $T$ under $f$, i.e., \[ f(S \sqcup T) = f(S) \sqcup f(T). \]
Algebra.map_inf theorem
(f : A →ₐ[R] B) (hf : Function.Injective f) (S T : Subalgebra R A) : (S ⊓ T).map f = S.map f ⊓ T.map f
Full source
theorem map_inf (f : A →ₐ[R] B) (hf : Function.Injective f) (S T : Subalgebra R A) :
    (S ⊓ T).map f = S.map f ⊓ T.map f := SetLike.coe_injective (Set.image_inter hf)
Image of Subalgebra Infimum under Injective Algebra Homomorphism Equals Infimum of Images
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be semirings equipped with $R$-algebra structures. Given an injective $R$-algebra homomorphism $f \colon A \to B$ and two subalgebras $S$ and $T$ of $A$, the image of the infimum $S \sqcap T$ under $f$ is equal to the infimum of the images of $S$ and $T$ under $f$, i.e., \[ f(S \sqcap T) = f(S) \sqcap f(T). \]
Algebra.coe_inf theorem
(S T : Subalgebra R A) : (↑(S ⊓ T) : Set A) = (S ∩ T : Set A)
Full source
@[simp, norm_cast]
theorem coe_inf (S T : Subalgebra R A) : (↑(S ⊓ T) : Set A) = (S ∩ T : Set A) := rfl
Subalgebra Infimum as Set Intersection
Informal description
For any two subalgebras $S$ and $T$ of an $R$-algebra $A$, the underlying set of their infimum $S \sqcap T$ is equal to the intersection $S \cap T$ of their underlying sets.
Algebra.mem_inf theorem
{S T : Subalgebra R A} {x : A} : x ∈ S ⊓ T ↔ x ∈ S ∧ x ∈ T
Full source
@[simp]
theorem mem_inf {S T : Subalgebra R A} {x : A} : x ∈ S ⊓ Tx ∈ S ⊓ T ↔ x ∈ S ∧ x ∈ T := Iff.rfl
Membership in Infimum of Subalgebras is Equivalent to Membership in Both Subalgebras
Informal description
For any two subalgebras $S$ and $T$ of an $R$-algebra $A$, and any element $x \in A$, we have $x \in S \sqcap T$ if and only if $x \in S$ and $x \in T$.
Algebra.inf_toSubmodule theorem
(S T : Subalgebra R A) : toSubmodule (S ⊓ T) = toSubmodule S ⊓ toSubmodule T
Full source
@[simp]
theorem inf_toSubmodule (S T : Subalgebra R A) :
    toSubmodule (S ⊓ T) = toSubmoduletoSubmodule S ⊓ toSubmodule T := rfl
Subalgebra Infimum Preserves Underlying Submodule Structure
Informal description
For any two subalgebras $S$ and $T$ of an $R$-algebra $A$, the underlying submodule of their infimum $S \sqcap T$ is equal to the infimum of their underlying submodules $S$ and $T$.
Algebra.inf_toSubsemiring theorem
(S T : Subalgebra R A) : (S ⊓ T).toSubsemiring = S.toSubsemiring ⊓ T.toSubsemiring
Full source
@[simp]
theorem inf_toSubsemiring (S T : Subalgebra R A) :
    (S ⊓ T).toSubsemiring = S.toSubsemiring ⊓ T.toSubsemiring :=
  rfl
Infimum of Subalgebras Preserves Underlying Subsemiring Structure
Informal description
For any two subalgebras $S$ and $T$ of an $R$-algebra $A$, the underlying subsemiring of their infimum $S \sqcap T$ is equal to the infimum of their underlying subsemirings $S$ and $T$.
Algebra.sup_toSubsemiring theorem
(S T : Subalgebra R A) : (S ⊔ T).toSubsemiring = S.toSubsemiring ⊔ T.toSubsemiring
Full source
@[simp]
theorem sup_toSubsemiring (S T : Subalgebra R A) :
    (S ⊔ T).toSubsemiring = S.toSubsemiring ⊔ T.toSubsemiring := by
  rw [← S.toSubsemiring.closure_eq, ← T.toSubsemiring.closure_eq, ← Subsemiring.closure_union]
  simp_rw [sup_def, adjoin_toSubsemiring, Subalgebra.coe_toSubsemiring]
  congr 1
  rw [Set.union_eq_right]
  rintro _ ⟨x, rfl⟩
  exact Set.mem_union_left _ (algebraMap_mem S x)
Supremum of Subalgebras Preserves Underlying Subsemiring Structure
Informal description
For any two subalgebras $S$ and $T$ of an $R$-algebra $A$, the underlying subsemiring of their supremum $S \sqcup T$ is equal to the supremum of their underlying subsemirings $S$ and $T$.
Algebra.coe_sInf theorem
(S : Set (Subalgebra R A)) : (↑(sInf S) : Set A) = ⋂ s ∈ S, ↑s
Full source
@[simp, norm_cast]
theorem coe_sInf (S : Set (Subalgebra R A)) : (↑(sInf S) : Set A) = ⋂ s ∈ S, ↑s :=
  sInf_image
Infimum of Subalgebras as Intersection of Underlying Sets
Informal description
For any collection $S$ of subalgebras of an $R$-algebra $A$, the underlying set of the infimum of $S$ is equal to the intersection of the underlying sets of all subalgebras in $S$. That is, $$ \left( \bigsqcap S \right) = \bigcap_{s \in S} s. $$
Algebra.mem_sInf theorem
{S : Set (Subalgebra R A)} {x : A} : x ∈ sInf S ↔ ∀ p ∈ S, x ∈ p
Full source
theorem mem_sInf {S : Set (Subalgebra R A)} {x : A} : x ∈ sInf Sx ∈ sInf S ↔ ∀ p ∈ S, x ∈ p := by
  simp only [← SetLike.mem_coe, coe_sInf, Set.mem_iInter₂]
Characterization of Membership in Infimum of Subalgebras
Informal description
For any collection $S$ of subalgebras of an $R$-algebra $A$ and any element $x \in A$, $x$ belongs to the infimum of $S$ if and only if $x$ belongs to every subalgebra in $S$. That is, $$ x \in \bigsqcap S \leftrightarrow \forall p \in S, x \in p. $$
Algebra.sInf_toSubmodule theorem
(S : Set (Subalgebra R A)) : Subalgebra.toSubmodule (sInf S) = sInf (Subalgebra.toSubmodule '' S)
Full source
@[simp]
theorem sInf_toSubmodule (S : Set (Subalgebra R A)) :
    Subalgebra.toSubmodule (sInf S) = sInf (Subalgebra.toSubmoduleSubalgebra.toSubmodule '' S) :=
  SetLike.coe_injective <| by simp
Infimum of Subalgebras Preserved under Submodule Embedding
Informal description
For any collection $S$ of subalgebras of an $R$-algebra $A$, the image of the infimum of $S$ under the order embedding to submodules equals the infimum of the images of all subalgebras in $S$ under the same embedding. That is, $$ \text{toSubmodule}(\bigsqcap S) = \bigsqcap \{\text{toSubmodule}(s) \mid s \in S\}. $$
Algebra.sInf_toSubsemiring theorem
(S : Set (Subalgebra R A)) : (sInf S).toSubsemiring = sInf (Subalgebra.toSubsemiring '' S)
Full source
@[simp]
theorem sInf_toSubsemiring (S : Set (Subalgebra R A)) :
    (sInf S).toSubsemiring = sInf (Subalgebra.toSubsemiringSubalgebra.toSubsemiring '' S) :=
  SetLike.coe_injective <| by simp
Infimum of Subalgebras as Infimum of Associated Subsemirings
Informal description
For any collection $S$ of subalgebras of an $R$-algebra $A$, the underlying subsemiring of the infimum of $S$ is equal to the infimum of the images of the subsemirings associated with each subalgebra in $S$. That is, $$ \left( \bigsqcap S \right).\text{toSubsemiring} = \bigsqcap \left( \text{Subalgebra.toSubsemiring} \ '' \ S \right). $$
Algebra.sSup_toSubsemiring theorem
(S : Set (Subalgebra R A)) (hS : S.Nonempty) : (sSup S).toSubsemiring = sSup (toSubsemiring '' S)
Full source
@[simp]
theorem sSup_toSubsemiring (S : Set (Subalgebra R A)) (hS : S.Nonempty) :
    (sSup S).toSubsemiring = sSup (toSubsemiringtoSubsemiring '' S) := by
  have h : toSubsemiringtoSubsemiring '' S = Subsemiring.closureSubsemiring.closure '' (SetLike.coe '' S) := by
    rw [Set.image_image]
    congr! with x
    exact x.toSubsemiring.closure_eq.symm
  rw [h, sSup_image, ← Subsemiring.closure_sUnion, sSup_def, adjoin_toSubsemiring]
  congr 1
  rw [Set.union_eq_right]
  rintro _ ⟨x, rfl⟩
  obtain ⟨y, hy⟩ := hS
  simp only [Set.mem_sUnion, Set.mem_image, exists_exists_and_eq_and, SetLike.mem_coe]
  exact ⟨y, hy, algebraMap_mem y x⟩
Supremum of Subalgebras as Subsemirings
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any nonempty set $S$ of subalgebras of $A$, the underlying subsemiring of the supremum of $S$ in the lattice of subalgebras is equal to the supremum of the images of the subalgebras in $S$ under the forgetful functor to subsemirings. In other words, if $\bigsqcup S$ denotes the supremum of $S$ in the subalgebra lattice, then: $$(\bigsqcup S).\text{toSubsemiring} = \bigsqcup \{T.\text{toSubsemiring} \mid T \in S\}.$$
Algebra.coe_iInf theorem
{ι : Sort*} {S : ι → Subalgebra R A} : (↑(⨅ i, S i) : Set A) = ⋂ i, S i
Full source
@[simp, norm_cast]
theorem coe_iInf {ι : Sort*} {S : ι → Subalgebra R A} : (↑(⨅ i, S i) : Set A) = ⋂ i, S i := by
  simp [iInf]
Infimum of Subalgebras as Intersection of Underlying Sets
Informal description
For any family of subalgebras $\{S_i\}_{i \in \iota}$ of an $R$-algebra $A$, the underlying set of their infimum $\bigsqcap_i S_i$ is equal to the intersection $\bigcap_i S_i$ of their underlying sets.
Algebra.mem_iInf theorem
{ι : Sort*} {S : ι → Subalgebra R A} {x : A} : (x ∈ ⨅ i, S i) ↔ ∀ i, x ∈ S i
Full source
theorem mem_iInf {ι : Sort*} {S : ι → Subalgebra R A} {x : A} : (x ∈ ⨅ i, S i) ↔ ∀ i, x ∈ S i := by
  simp only [iInf, mem_sInf, Set.forall_mem_range]
Characterization of Elements in the Infimum of Subalgebras
Informal description
For any family of subalgebras $\{S_i\}_{i \in \iota}$ of an $R$-algebra $A$ and any element $x \in A$, we have $x \in \bigsqcap_i S_i$ if and only if $x \in S_i$ for every $i \in \iota$.
Algebra.map_iInf theorem
{ι : Sort*} [Nonempty ι] (f : A →ₐ[R] B) (hf : Function.Injective f) (s : ι → Subalgebra R A) : (iInf s).map f = ⨅ (i : ι), (s i).map f
Full source
theorem map_iInf {ι : Sort*} [Nonempty ι] (f : A →ₐ[R] B) (hf : Function.Injective f)
    (s : ι → Subalgebra R A) : (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)
Preservation of Infimum of Subalgebras under Injective Algebra Homomorphism
Informal description
Let $\{S_i\}_{i \in \iota}$ be a nonempty family of subalgebras of an $R$-algebra $A$, and let $f \colon A \to_{R} B$ be an injective $R$-algebra homomorphism. Then the image of the infimum $\bigsqcap_{i \in \iota} S_i$ under $f$ is equal to the infimum of the images $\bigsqcap_{i \in \iota} f(S_i)$. In other words, $f\left(\bigsqcap_{i \in \iota} S_i\right) = \bigsqcap_{i \in \iota} f(S_i)$.
Algebra.iInf_toSubmodule theorem
{ι : Sort*} (S : ι → Subalgebra R A) : toSubmodule (⨅ i, S i) = ⨅ i, toSubmodule (S i)
Full source
@[simp]
theorem iInf_toSubmodule {ι : Sort*} (S : ι → Subalgebra R A) :
    toSubmodule (⨅ i, S i) = ⨅ i, toSubmodule (S i) :=
  SetLike.coe_injective <| by simp
Infimum of Subalgebras Commutes with Submodule Structure
Informal description
For any family of subalgebras $\{S_i\}_{i \in \iota}$ of an $R$-algebra $A$, the underlying submodule of their infimum $\bigsqcap_i S_i$ is equal to the infimum $\bigsqcap_i (S_i \text{ as submodule})$ of their underlying submodules.
Algebra.iInf_toSubsemiring theorem
{ι : Sort*} (S : ι → Subalgebra R A) : (iInf S).toSubsemiring = ⨅ i, (S i).toSubsemiring
Full source
@[simp]
theorem iInf_toSubsemiring {ι : Sort*} (S : ι → Subalgebra R A) :
    (iInf S).toSubsemiring = ⨅ i, (S i).toSubsemiring := by
  simp only [iInf, sInf_toSubsemiring, ← Set.range_comp, Function.comp_def]
Infimum of Subalgebras as Infimum of Subsemirings
Informal description
For any indexed family of subalgebras $(S_i)_{i \in \iota}$ of an $R$-algebra $A$, the underlying subsemiring of the infimum $\bigsqcap_i S_i$ is equal to the infimum $\bigsqcap_i (S_i.\text{toSubsemiring})$ of the underlying subsemirings.
Algebra.iSup_toSubsemiring theorem
{ι : Sort*} [Nonempty ι] (S : ι → Subalgebra R A) : (iSup S).toSubsemiring = ⨆ i, (S i).toSubsemiring
Full source
@[simp]
theorem iSup_toSubsemiring {ι : Sort*} [Nonempty ι] (S : ι → Subalgebra R A) :
    (iSup S).toSubsemiring = ⨆ i, (S i).toSubsemiring := by
  simp only [iSup, Set.range_nonempty, sSup_toSubsemiring, ← Set.range_comp, Function.comp_def]
Supremum of Subalgebras as Supremum of Subsemirings
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any nonempty indexed family $(S_i)_{i \in \iota}$ of subalgebras of $A$, the underlying subsemiring of the supremum $\bigsqcup_i S_i$ in the lattice of subalgebras is equal to the supremum $\bigsqcup_i (S_i.\text{toSubsemiring})$ in the lattice of subsemirings. In other words: $$(\bigsqcup_{i \in \iota} S_i).\text{toSubsemiring} = \bigsqcup_{i \in \iota} (S_i.\text{toSubsemiring}).$$
Algebra.mem_iSup_of_mem theorem
{ι : Sort*} {S : ι → Subalgebra R A} (i : ι) {x : A} (hx : x ∈ S i) : x ∈ iSup S
Full source
lemma mem_iSup_of_mem {ι : Sort*} {S : ι → Subalgebra R A} (i : ι) {x : A} (hx : x ∈ S i) :
    x ∈ iSup S :=
  le_iSup S i hx
Element in Subalgebra Family Implies Element in Supremum
Informal description
For any indexed family of subalgebras $S_i$ of an $R$-algebra $A$ and any element $x \in A$, if $x$ belongs to $S_i$ for some index $i$, then $x$ also belongs to the supremum $\bigsqcup_i S_i$ of the family of subalgebras.
Algebra.iSup_induction theorem
{ι : Sort*} (S : ι → Subalgebra R A) {motive : A → Prop} {x : A} (mem : x ∈ ⨆ i, S i) (basic : ∀ i, ∀ a ∈ S i, motive a) (zero : motive 0) (one : motive 1) (add : ∀ a b, motive a → motive b → motive (a + b)) (mul : ∀ a b, motive a → motive b → motive (a * b)) (algebraMap : ∀ r, motive (algebraMap R A r)) : motive x
Full source
@[elab_as_elim]
lemma iSup_induction {ι : Sort*} (S : ι → Subalgebra R A) {motive : A → Prop}
    {x : A} (mem : x ∈ ⨆ i, S i)
    (basic : ∀ i, ∀ a ∈ S i, motive a)
    (zero : motive 0) (one : motive 1)
    (add : ∀ a b, motive a → motive b → motive (a + b))
    (mul : ∀ a b, motive a → motive b → motive (a * b))
    (algebraMap : ∀ r, motive (algebraMap R A r)) : motive x := by
  let T : Subalgebra R A :=
  { carrier := {x | motive x}
    mul_mem' {a b} := mul a b
    one_mem' := one
    add_mem' {a b} := add a b
    zero_mem' := zero
    algebraMap_mem' := algebraMap }
  suffices iSup S ≤ T from this mem
  rwa [iSup_le_iff]
Induction Principle for Elements in the Supremum of Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. Given an indexed family of subalgebras $(S_i)_{i \in \iota}$ of $A$, an element $x \in \bigsqcup_i S_i$, and a predicate $\text{motive} : A \to \text{Prop}$ satisfying: 1. $\text{motive}(a)$ holds for all $a \in S_i$ and all $i \in \iota$ (basic case), 2. $\text{motive}(0)$ (zero case), 3. $\text{motive}(1)$ (one case), 4. $\text{motive}(a + b)$ whenever $\text{motive}(a)$ and $\text{motive}(b)$ hold (additive closure), 5. $\text{motive}(a \cdot b)$ whenever $\text{motive}(a)$ and $\text{motive}(b)$ hold (multiplicative closure), 6. $\text{motive}(r \cdot 1_A)$ for all $r \in R$ (algebra map case), then $\text{motive}(x)$ holds.
Algebra.iSup_induction' theorem
{ι : Sort*} (S : ι → Subalgebra R A) {motive : ∀ x, (x ∈ ⨆ i, S i) → Prop} {x : A} (mem : x ∈ ⨆ i, S i) (basic : ∀ (i) (x) (hx : x ∈ S i), motive x (mem_iSup_of_mem i hx)) (zero : motive 0 (zero_mem _)) (one : motive 1 (one_mem _)) (add : ∀ x y hx hy, motive x hx → motive y hy → motive (x + y) (add_mem ‹_› ‹_›)) (mul : ∀ x y hx hy, motive x hx → motive y hy → motive (x * y) (mul_mem ‹_› ‹_›)) (algebraMap : ∀ r, motive (algebraMap R A r) (Subalgebra.algebraMap_mem _ ‹_›)) : motive x mem
Full source
/-- A dependent version of `Subalgebra.iSup_induction`. -/
@[elab_as_elim]
theorem iSup_induction' {ι : Sort*} (S : ι → Subalgebra R A) {motive : ∀ x, (x ∈ ⨆ i, S i) → Prop}
    {x : A} (mem : x ∈ ⨆ i, S i)
    (basic : ∀ (i) (x) (hx : x ∈ S i), motive x (mem_iSup_of_mem i hx))
    (zero : motive 0 (zero_mem _)) (one : motive 1 (one_mem _))
    (add : ∀ x y hx hy, motive x hx → motive y hy → motive (x + y) (add_mem ‹_› ‹_›))
    (mul : ∀ x y hx hy, motive x hx → motive y hy → motive (x * y) (mul_mem ‹_› ‹_›))
    (algebraMap : ∀ r, motive (algebraMap R A r) (Subalgebra.algebraMap_mem _ ‹_›)) :
    motive x mem := by
  refine Exists.elim ?_ fun (hx : x ∈ ⨆ i, S i) (hc : motive x hx) ↦ hc
  exact iSup_induction S (motive := fun x' ↦ ∃ h, motive x' h) mem
    (fun _ _ h ↦ ⟨_, basic _ _ h⟩) ⟨_, zero⟩ ⟨_, one⟩ (fun _ _ h h' ↦ ⟨_, add _ _ _ _ h.2 h'.2⟩)
    (fun _ _ h h' ↦ ⟨_, mul _ _ _ _ h.2 h'.2⟩) fun _ ↦ ⟨_, algebraMap _⟩
Dependent Induction Principle for Elements in the Supremum of Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. Given an indexed family of subalgebras $(S_i)_{i \in \iota}$ of $A$, an element $x \in \bigsqcup_i S_i$, and a predicate $\text{motive}(x, h_x)$ depending on $x$ and a proof $h_x$ that $x \in \bigsqcup_i S_i$, suppose the following conditions hold: 1. For any $i \in \iota$ and $a \in S_i$, $\text{motive}(a, h_a)$ holds where $h_a$ is the proof that $a \in \bigsqcup_i S_i$ via $\text{mem\_iSup\_of\_mem}$. 2. $\text{motive}(0, h_0)$ holds where $h_0$ is the proof that $0 \in \bigsqcup_i S_i$. 3. $\text{motive}(1, h_1)$ holds where $h_1$ is the proof that $1 \in \bigsqcup_i S_i$. 4. For any $x, y \in \bigsqcup_i S_i$ with proofs $h_x, h_y$, if $\text{motive}(x, h_x)$ and $\text{motive}(y, h_y)$ hold, then $\text{motive}(x + y, h_{x+y})$ holds. 5. For any $x, y \in \bigsqcup_i S_i$ with proofs $h_x, h_y$, if $\text{motive}(x, h_x)$ and $\text{motive}(y, h_y)$ hold, then $\text{motive}(x \cdot y, h_{x \cdot y})$ holds. 6. For any $r \in R$, $\text{motive}(\text{algebraMap}_R^A(r), h_r)$ holds where $h_r$ is the proof that $\text{algebraMap}_R^A(r) \in \bigsqcup_i S_i$. Then $\text{motive}(x, \text{mem})$ holds.
Algebra.instInhabitedSubalgebra instance
: Inhabited (Subalgebra R A)
Full source
instance : Inhabited (Subalgebra R A) := ⟨⊥⟩
Nonempty Collection of Subalgebras in an $R$-Algebra
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the collection of subalgebras of $A$ is nonempty.
Algebra.mem_bot theorem
{x : A} : x ∈ (⊥ : Subalgebra R A) ↔ x ∈ Set.range (algebraMap R A)
Full source
theorem mem_bot {x : A} : x ∈ (⊥ : Subalgebra R A)x ∈ (⊥ : Subalgebra R A) ↔ x ∈ Set.range (algebraMap R A) := Iff.rfl
Characterization of Elements in the Bottom Subalgebra via the Algebra Map
Informal description
For any element $x$ in an $R$-algebra $A$, $x$ belongs to the bottom subalgebra $\bot$ (the smallest subalgebra of $A$) if and only if $x$ is in the range of the algebra map $R \to A$.
Algebra.toSubmodule_bot theorem
: Subalgebra.toSubmodule (⊥ : Subalgebra R A) = 1
Full source
/-- TODO: change proof to `rfl` when fixing https://github.com/leanprover-community/mathlib4/issues/18110. -/
theorem toSubmodule_bot : Subalgebra.toSubmodule ( : Subalgebra R A) = 1 :=
  Submodule.one_eq_range.symm
Bottom Subalgebra Maps to Unit Submodule
Informal description
The image of the bottom element of the subalgebra lattice under the embedding into submodules is equal to the unit submodule. That is, the submodule corresponding to the smallest subalgebra (the image of the algebra map $R \to A$) is precisely the $R$-linear span of the multiplicative identity $1_A$ in $A$.
Algebra.coe_bot theorem
: ((⊥ : Subalgebra R A) : Set A) = Set.range (algebraMap R A)
Full source
@[simp]
theorem coe_bot : (( : Subalgebra R A) : Set A) = Set.range (algebraMap R A) := rfl
Bottom Subalgebra as Range of Algebra Map
Informal description
For a commutative semiring $R$ and an $R$-algebra $A$, the underlying set of the bottom element in the lattice of subalgebras of $A$ is equal to the range of the algebra map $R \to A$. In other words, $(\bot : \text{Subalgebra } R A) = \text{range}(\text{algebraMap } R A)$.
AlgHom.range_eq_top theorem
(f : A →ₐ[R] B) : f.range = (⊤ : Subalgebra R B) ↔ Function.Surjective f
Full source
theorem _root_.AlgHom.range_eq_top (f : A →ₐ[R] B) :
    f.range = (⊤ : Subalgebra R B) ↔ Function.Surjective f :=
  Algebra.eq_top_iff
Range of Algebra Homomorphism is Top Subalgebra if and only if Surjective
Informal description
For an $R$-algebra homomorphism $f \colon A \to B$, the range of $f$ is equal to the top subalgebra of $B$ (i.e., $B$ itself) if and only if $f$ is surjective. In symbols: \[ \text{range}(f) = \top \iff f \text{ is surjective}. \]
Algebra.range_ofId theorem
: (Algebra.ofId R A).range = ⊥
Full source
@[simp]
theorem range_ofId : (Algebra.ofId R A).range =  := rfl
Range of Canonical Homomorphism is Bottom Subalgebra
Informal description
The range of the canonical $R$-algebra homomorphism from $R$ to $A$ is equal to the bottom element of the complete lattice of subalgebras of $A$.
Algebra.range_id theorem
: (AlgHom.id R A).range = ⊤
Full source
@[simp]
theorem range_id : (AlgHom.id R A).range =  :=
  SetLike.coe_injective Set.range_id
Range of Identity Algebra Homomorphism is Top Subalgebra
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the range of the identity algebra homomorphism $\mathrm{id} \colon A \to A$ is equal to the top element of the complete lattice of subalgebras of $A$, i.e., $\mathrm{range}(\mathrm{id}) = \top$.
Algebra.map_top theorem
(f : A →ₐ[R] B) : (⊤ : Subalgebra R A).map f = f.range
Full source
@[simp]
theorem map_top (f : A →ₐ[R] B) : ( : Subalgebra R A).map f = f.range :=
  SetLike.coe_injective Set.image_univ
Image of Top Subalgebra Equals Range of Algebra Homomorphism
Informal description
For any $R$-algebra homomorphism $f \colon A \to B$, the image of the top subalgebra (i.e., $A$ itself) under $f$ is equal to the range of $f$.
Algebra.map_bot theorem
(f : A →ₐ[R] B) : (⊥ : Subalgebra R A).map f = ⊥
Full source
@[simp]
theorem map_bot (f : A →ₐ[R] B) : ( : Subalgebra R A).map f =  :=
  Subalgebra.toSubmodule_injective <| by
    simpa only [Subalgebra.map_toSubmodule, toSubmodule_bot] using Submodule.map_one _
Image of Bottom Subalgebra under Algebra Homomorphism is Bottom Subalgebra
Informal description
For any $R$-algebra homomorphism $f \colon A \to B$, the image of the bottom subalgebra (the smallest subalgebra of $A$) under $f$ is equal to the bottom subalgebra of $B$.
Algebra.comap_top theorem
(f : A →ₐ[R] B) : (⊤ : Subalgebra R B).comap f = ⊤
Full source
@[simp]
theorem comap_top (f : A →ₐ[R] B) : ( : Subalgebra R B).comap f =  :=
  eq_top_iff.2 fun _x => mem_top
Preimage of Top Subalgebra is Top Subalgebra
Informal description
For any $R$-algebra homomorphism $f \colon A \to B$, the preimage of the top subalgebra of $B$ under $f$ is the top subalgebra of $A$. In other words, $f^{-1}(B) = A$.
Algebra.toTop definition
: A →ₐ[R] (⊤ : Subalgebra R A)
Full source
/-- `AlgHom` to `⊤ : Subalgebra R A`. -/
def toTop : A →ₐ[R] (⊤ : Subalgebra R A) :=
  (AlgHom.id R A).codRestrict  fun _ => mem_top
Canonical homomorphism to the top subalgebra
Informal description
The canonical $R$-algebra homomorphism from an $R$-algebra $A$ to the top element of the lattice of subalgebras of $A$, which is $A$ itself. This homomorphism maps each element $x \in A$ to itself, viewed as an element of the top subalgebra.
Algebra.surjective_algebraMap_iff theorem
: Function.Surjective (algebraMap R A) ↔ (⊤ : Subalgebra R A) = ⊥
Full source
theorem surjective_algebraMap_iff :
    Function.SurjectiveFunction.Surjective (algebraMap R A) ↔ (⊤ : Subalgebra R A) = ⊥ :=
  ⟨fun h =>
    eq_bot_iff.2 fun y _ =>
      let ⟨_x, hx⟩ := h y
      hx ▸ Subalgebra.algebraMap_mem _ _,
    fun h y => Algebra.mem_bot.1 <| eq_bot_iff.1 h (Algebra.mem_top : y ∈ _)⟩
Surjectivity of Algebra Map Characterizes Trivial Subalgebra Lattice
Informal description
The algebra map $R \to A$ is surjective if and only if the top subalgebra of $A$ (which is $A$ itself) is equal to the bottom subalgebra (the image of the algebra map).
Algebra.bijective_algebraMap_iff theorem
{R A : Type*} [Field R] [Semiring A] [Nontrivial A] [Algebra R A] : Function.Bijective (algebraMap R A) ↔ (⊤ : Subalgebra R A) = ⊥
Full source
theorem bijective_algebraMap_iff {R A : Type*} [Field R] [Semiring A] [Nontrivial A]
    [Algebra R A] : Function.BijectiveFunction.Bijective (algebraMap R A) ↔ (⊤ : Subalgebra R A) = ⊥ :=
  ⟨fun h => surjective_algebraMap_iff.1 h.2, fun h =>
    ⟨(algebraMap R A).injective, surjective_algebraMap_iff.2 h⟩⟩
Bijectivity of Algebra Map Characterizes Minimal Subalgebra Lattice for Field Extensions
Informal description
Let $R$ be a field and $A$ be a nontrivial semiring equipped with an $R$-algebra structure. The algebra map $R \to A$ is bijective if and only if the top subalgebra of $A$ (which is $A$ itself) is equal to the bottom subalgebra (the image of the algebra map).
Algebra.botEquivOfInjective definition
(h : Function.Injective (algebraMap R A)) : (⊥ : Subalgebra R A) ≃ₐ[R] R
Full source
/-- The bottom subalgebra is isomorphic to the base ring. -/
noncomputable def botEquivOfInjective (h : Function.Injective (algebraMap R A)) :
    (⊥ : Subalgebra R A) ≃ₐ[R] R :=
  AlgEquiv.symm <|
    AlgEquiv.ofBijective (Algebra.ofId R _)
      ⟨fun _x _y hxy => h (congr_arg Subtype.val hxy :), fun ⟨_y, x, hx⟩ => ⟨x, Subtype.eq hx⟩⟩
Isomorphism between the bottom subalgebra and the base ring for injective algebra maps
Informal description
Given a commutative semiring $R$ and an $R$-algebra $A$ with an injective algebra map $R \to A$, the bottom subalgebra (the smallest subalgebra containing the image of $R$) is isomorphic to $R$ as an $R$-algebra. More precisely, if the canonical algebra homomorphism $\text{algebraMap} : R \to A$ is injective, then there exists an $R$-algebra isomorphism between the smallest subalgebra of $A$ (which is the image of $\text{algebraMap}$) and $R$ itself.
Algebra.botEquiv definition
(F R : Type*) [Field F] [Semiring R] [Nontrivial R] [Algebra F R] : (⊥ : Subalgebra F R) ≃ₐ[F] F
Full source
/-- The bottom subalgebra is isomorphic to the field. -/
@[simps! symm_apply]
noncomputable def botEquiv (F R : Type*) [Field F] [Semiring R] [Nontrivial R] [Algebra F R] :
    (⊥ : Subalgebra F R) ≃ₐ[F] F :=
  botEquivOfInjective (RingHom.injective _)
Isomorphism between the bottom subalgebra and the base field
Informal description
Given a field \( F \) and a nontrivial semiring \( R \) equipped with an \( F \)-algebra structure, the bottom subalgebra (the smallest subalgebra containing the image of \( F \)) is isomorphic to \( F \) as an \( F \)-algebra. More precisely, the canonical algebra homomorphism \( F \to R \) is injective, and thus the smallest subalgebra of \( R \) (which is the image of this homomorphism) is isomorphic to \( F \) itself as an \( F \)-algebra.
Subalgebra.topEquiv definition
: (⊤ : Subalgebra R A) ≃ₐ[R] A
Full source
/-- The top subalgebra is isomorphic to the algebra.

This is the algebra version of `Submodule.topEquiv`. -/
@[simps!]
def topEquiv : (⊤ : Subalgebra R A) ≃ₐ[R] A :=
  AlgEquiv.ofAlgHom (Subalgebra.val ) toTop rfl rfl
Isomorphism between top subalgebra and algebra
Informal description
The top subalgebra of an $R$-algebra $A$ (which is $A$ itself) is isomorphic to $A$ as an $R$-algebra. This isomorphism is constructed using the canonical inclusion homomorphism from the top subalgebra to $A$ and the canonical homomorphism from $A$ to the top subalgebra, which are mutual inverses.
AlgHom.subsingleton instance
[Subsingleton (Subalgebra R A)] : Subsingleton (A →ₐ[R] B)
Full source
instance _root_.AlgHom.subsingleton [Subsingleton (Subalgebra R A)] : Subsingleton (A →ₐ[R] B) :=
  ⟨fun f g =>
    AlgHom.ext fun a =>
      have : a ∈ (⊥ : Subalgebra R A) := Subsingleton.elim (⊤ : Subalgebra R A) ⊥ ▸ mem_top
      let ⟨_x, hx⟩ := Set.mem_range.mp (mem_bot.mp this)
      hx ▸ (f.commutes _).trans (g.commutes _).symm⟩
Uniqueness of Algebra Homomorphisms from a Subsingleton Subalgebra Structure
Informal description
For any commutative semiring $R$ and $R$-algebras $A$ and $B$, if the collection of subalgebras of $A$ is a subsingleton (i.e., there is at most one subalgebra of $A$), then the type of $R$-algebra homomorphisms from $A$ to $B$ is also a subsingleton (i.e., there is at most one such homomorphism).
AlgEquiv.subsingleton_left instance
[Subsingleton (Subalgebra R A)] : Subsingleton (A ≃ₐ[R] B)
Full source
instance _root_.AlgEquiv.subsingleton_left [Subsingleton (Subalgebra R A)] :
    Subsingleton (A ≃ₐ[R] B) :=
  ⟨fun f g => AlgEquiv.ext fun x => AlgHom.ext_iff.mp (Subsingleton.elim f.toAlgHom g.toAlgHom) x⟩
Uniqueness of Algebra Isomorphisms from a Subsingleton Subalgebra Structure
Informal description
For any commutative semiring $R$ and $R$-algebras $A$ and $B$, if the collection of subalgebras of $A$ is a subsingleton (i.e., there is at most one subalgebra of $A$), then the type of $R$-algebra isomorphisms from $A$ to $B$ is also a subsingleton (i.e., there is at most one such isomorphism).
AlgEquiv.subsingleton_right instance
[Subsingleton (Subalgebra R B)] : Subsingleton (A ≃ₐ[R] B)
Full source
instance _root_.AlgEquiv.subsingleton_right [Subsingleton (Subalgebra R B)] :
    Subsingleton (A ≃ₐ[R] B) :=
  ⟨fun f g => by rw [← f.symm_symm, Subsingleton.elim f.symm g.symm, g.symm_symm]⟩
Uniqueness of Algebra Isomorphisms to a Subsingleton Subalgebra Structure
Informal description
For any commutative semiring $R$ and $R$-algebras $A$ and $B$, if the collection of subalgebras of $B$ is a subsingleton (i.e., there is at most one subalgebra of $B$), then the type of $R$-algebra isomorphisms from $A$ to $B$ is also a subsingleton (i.e., there is at most one such isomorphism).
Subalgebra.instUnique instance
: Unique (Subalgebra R R)
Full source
instance : Unique (Subalgebra R R) :=
  { inferInstanceAs (Inhabited (Subalgebra R R)) with
    uniq := by
      intro S
      refine le_antisymm ?_ bot_le
      intro _ _
      simp only [Set.mem_range, mem_bot, id.map_eq_self, exists_apply_eq_apply, default] }
Uniqueness of Subalgebras in a Commutative Semiring as an Algebra over Itself
Informal description
For any commutative semiring $R$, the collection of subalgebras of $R$ as an $R$-algebra has exactly one element, namely $R$ itself.
Subalgebra.center_eq_top theorem
(A : Type*) [CommSemiring A] [Algebra R A] : center R A = ⊤
Full source
@[simp]
theorem center_eq_top (A : Type*) [CommSemiring A] [Algebra R A] : center R A =  :=
  SetLike.coe_injective (Set.center_eq_univ A)
Characterization of Commutative Algebras via Center: $Z(A) = A$
Informal description
For any commutative semiring $R$ and any commutative $R$-algebra $A$, the center of $A$ (the subalgebra consisting of all elements that commute with every element of $A$) is equal to the entire algebra $A$.
Subalgebra.centralizer_eq_top_iff_subset theorem
{s : Set A} : centralizer R s = ⊤ ↔ s ⊆ center R A
Full source
@[simp]
theorem centralizer_eq_top_iff_subset {s : Set A} : centralizercentralizer R s = ⊤ ↔ s ⊆ center R A :=
  SetLike.ext'_iff.trans Set.centralizer_eq_top_iff_subset
Centralizer Equals Entire Algebra iff Subset is Central
Informal description
For any subset $s$ of an $R$-algebra $A$, the centralizer subalgebra of $s$ is equal to the entire algebra $A$ if and only if $s$ is contained in the center of $A$.
AlgHom.equalizer_eq_top theorem
{φ ψ : F} : equalizer φ ψ = ⊤ ↔ φ = ψ
Full source
@[simp]
theorem equalizer_eq_top {φ ψ : F} : equalizerequalizer φ ψ = ⊤ ↔ φ = ψ := by
  simp [SetLike.ext_iff, DFunLike.ext_iff]
Equalizer Subalgebra is Whole Algebra if and only if Homomorphisms are Equal
Informal description
For any two $R$-algebra homomorphisms $\phi, \psi : A \to B$, the equalizer subalgebra $\text{equalizer}(\phi, \psi)$ is equal to the top subalgebra (i.e., $A$ itself) if and only if $\phi = \psi$.
AlgHom.equalizer_same theorem
(φ : F) : equalizer φ φ = ⊤
Full source
@[simp]
theorem equalizer_same (φ : F) : equalizer φ φ =  := equalizer_eq_top.2 rfl
Equalizer of an Algebra Homomorphism with Itself is the Whole Algebra
Informal description
For any $R$-algebra homomorphism $\phi \colon A \to B$, the equalizer subalgebra of $\phi$ with itself is equal to the entire algebra $A$.
AlgHom.eqOn_sup theorem
{φ ψ : F} {S T : Subalgebra R A} (hS : Set.EqOn φ ψ S) (hT : Set.EqOn φ ψ T) : Set.EqOn φ ψ ↑(S ⊔ T)
Full source
theorem eqOn_sup {φ ψ : F} {S T : Subalgebra R A} (hS : Set.EqOn φ ψ S) (hT : Set.EqOn φ ψ T) :
    Set.EqOn φ ψ ↑(S ⊔ T) := by
  rw [← le_equalizer] at hS hT ⊢
  exact sup_le hS hT
Agreement of Algebra Homomorphisms on Supremum of Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. Given two $R$-algebra homomorphisms $\phi, \psi \colon A \to B$ and two subalgebras $S, T$ of $A$, if $\phi$ and $\psi$ agree on $S$ and on $T$, then they also agree on the subalgebra generated by $S \cup T$.
AlgHom.ext_on_codisjoint theorem
{φ ψ : F} {S T : Subalgebra R A} (hST : Codisjoint S T) (hS : Set.EqOn φ ψ S) (hT : Set.EqOn φ ψ T) : φ = ψ
Full source
theorem ext_on_codisjoint {φ ψ : F} {S T : Subalgebra R A} (hST : Codisjoint S T)
    (hS : Set.EqOn φ ψ S) (hT : Set.EqOn φ ψ T) : φ = ψ :=
  DFunLike.ext _ _ fun _ ↦ eqOn_sup hS hT <| hST.eq_top.symmtrivial
Uniqueness of Algebra Homomorphisms on Codisjoint Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. Given two $R$-algebra homomorphisms $\phi, \psi \colon A \to B$ and two subalgebras $S, T$ of $A$ such that $S$ and $T$ are codisjoint (i.e., $S \sqcup T = \top$), if $\phi$ and $\psi$ agree on $S$ and on $T$, then $\phi = \psi$.
Subalgebra.map_comap_eq theorem
(f : A →ₐ[R] B) (S : Subalgebra R B) : (S.comap f).map f = S ⊓ f.range
Full source
theorem map_comap_eq (f : A →ₐ[R] B) (S : Subalgebra R B) : (S.comap f).map f = S ⊓ f.range :=
  SetLike.coe_injective Set.image_preimage_eq_inter_range
Image-Preimage Equality for Subalgebras: $f(f^{-1}(S)) = S \cap \mathrm{range}(f)$
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $B$, the image of the preimage of $S$ under $f$ is equal to the intersection of $S$ with the range of $f$. That is, \[ f(f^{-1}(S)) = S \cap \mathrm{range}(f). \]
Subalgebra.map_comap_eq_self theorem
{f : A →ₐ[R] B} {S : Subalgebra R B} (h : S ≤ f.range) : (S.comap f).map f = S
Full source
theorem map_comap_eq_self
    {f : A →ₐ[R] B} {S : Subalgebra R B} (h : S ≤ f.range) : (S.comap f).map f = S := by
  simpa only [inf_of_le_left h] using map_comap_eq f S
Image-Preimage Identity for Subalgebras Contained in Range
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $B$ such that $S$ is contained in the range of $f$, the image of the preimage of $S$ under $f$ equals $S$ itself. That is, \[ f(f^{-1}(S)) = S. \]
Subalgebra.map_comap_eq_self_of_surjective theorem
{f : A →ₐ[R] B} (hf : Function.Surjective f) (S : Subalgebra R B) : (S.comap f).map f = S
Full source
theorem map_comap_eq_self_of_surjective
    {f : A →ₐ[R] B} (hf : Function.Surjective f) (S : Subalgebra R B) : (S.comap f).map f = S :=
  map_comap_eq_self <| by simp [(AlgHom.range_eq_top f).2 hf]
Image-Preimage Identity for Subalgebras under Surjective Homomorphism
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. Given a surjective $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $B$, the image of the preimage of $S$ under $f$ equals $S$ itself. That is, \[ f(f^{-1}(S)) = S. \]
Algebra.subset_adjoin theorem
: s ⊆ adjoin R s
Full source
@[aesop safe 20 apply (rule_sets := [SetLike])]
theorem subset_adjoin : s ⊆ adjoin R s :=
  Algebra.gc.le_u_l s
Subset Contained in Generated Subalgebra
Informal description
For any subset $s$ of an $R$-algebra $A$, the set $s$ is contained in the subalgebra generated by $s$, i.e., $s \subseteq \text{adjoin}_R(s)$.
Algebra.adjoin_le theorem
{S : Subalgebra R A} (H : s ⊆ S) : adjoin R s ≤ S
Full source
theorem adjoin_le {S : Subalgebra R A} (H : s ⊆ S) : adjoin R s ≤ S :=
  Algebra.gc.l_le H
Generated Subalgebra is Smallest Containing Subset
Informal description
For any subset $s$ of an $R$-algebra $A$ and any subalgebra $S$ of $A$ containing $s$, the subalgebra generated by $s$ is contained in $S$, i.e., $\text{adjoin}_R(s) \leq S$.
Algebra.adjoin_singleton_le theorem
{S : Subalgebra R A} {a : A} (H : a ∈ S) : adjoin R { a } ≤ S
Full source
theorem adjoin_singleton_le {S : Subalgebra R A} {a : A} (H : a ∈ S) : adjoin R {a} ≤ S :=
  adjoin_le (Set.singleton_subset_iff.mpr H)
Subalgebra Generated by Singleton is Smallest Containing Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$ and any element $a \in S$, the subalgebra generated by the singleton set $\{a\}$ is contained in $S$, i.e., $\text{adjoin}_R(\{a\}) \leq S$.
Algebra.adjoin_eq_sInf theorem
: adjoin R s = sInf {p : Subalgebra R A | s ⊆ p}
Full source
theorem adjoin_eq_sInf : adjoin R s = sInf { p : Subalgebra R A | s ⊆ p } :=
  le_antisymm (le_sInf fun _ h => adjoin_le h) (sInf_le subset_adjoin)
Generated Subalgebra as Infimum of Containing Subalgebras
Informal description
For any subset $s$ of an $R$-algebra $A$, the subalgebra generated by $s$ is equal to the infimum of all subalgebras of $A$ containing $s$. In other words, $\text{adjoin}_R(s) = \bigwedge \{p \subseteq A \mid p \text{ is a subalgebra and } s \subseteq p\}$.
Algebra.adjoin_le_iff theorem
{S : Subalgebra R A} : adjoin R s ≤ S ↔ s ⊆ S
Full source
theorem adjoin_le_iff {S : Subalgebra R A} : adjoinadjoin R s ≤ S ↔ s ⊆ S :=
  Algebra.gc _ _
Subalgebra Generation and Containment Criterion
Informal description
For any subset $s$ of an $R$-algebra $A$ and any subalgebra $S$ of $A$, the subalgebra generated by $s$ is contained in $S$ if and only if $s$ is a subset of $S$.
Algebra.adjoin_mono theorem
(H : s ⊆ t) : adjoin R s ≤ adjoin R t
Full source
theorem adjoin_mono (H : s ⊆ t) : adjoin R s ≤ adjoin R t :=
  Algebra.gc.monotone_l H
Monotonicity of Subalgebra Generation with Respect to Inclusion
Informal description
For any subsets $s$ and $t$ of an $R$-algebra $A$, if $s \subseteq t$, then the subalgebra generated by $s$ is contained in the subalgebra generated by $t$, i.e., $\text{adjoin}_R(s) \leq \text{adjoin}_R(t)$.
Algebra.adjoin_eq_of_le theorem
(S : Subalgebra R A) (h₁ : s ⊆ S) (h₂ : S ≤ adjoin R s) : adjoin R s = S
Full source
theorem adjoin_eq_of_le (S : Subalgebra R A) (h₁ : s ⊆ S) (h₂ : S ≤ adjoin R s) : adjoin R s = S :=
  le_antisymm (adjoin_le h₁) h₂
Characterization of Subalgebra Generated by a Set: $\text{adjoin}_R(s) = S$ when $s \subseteq S \leq \text{adjoin}_R(s)$
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebra $S$ of $A$ and any subset $s \subseteq A$, if $s \subseteq S$ and $S$ is contained in the subalgebra generated by $s$, then $\text{adjoin}_R(s) = S$.
Algebra.adjoin_eq theorem
(S : Subalgebra R A) : adjoin R ↑S = S
Full source
theorem adjoin_eq (S : Subalgebra R A) : adjoin R ↑S = S :=
  adjoin_eq_of_le _ (Set.Subset.refl _) subset_adjoin
Subalgebra Generation of a Subalgebra is Itself
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the subalgebra generated by the underlying set of $S$ is equal to $S$ itself, i.e., $\text{adjoin}_R(S) = S$.
Algebra.adjoin_iUnion theorem
{α : Type*} (s : α → Set A) : adjoin R (Set.iUnion s) = ⨆ i : α, adjoin R (s i)
Full source
theorem adjoin_iUnion {α : Type*} (s : α → Set A) :
    adjoin R (Set.iUnion s) = ⨆ i : α, adjoin R (s i) :=
  (@Algebra.gc R A _ _ _).l_iSup
Subalgebra Generation Preserves Union of Sets
Informal description
For any family of subsets $\{s_i\}_{i \in \alpha}$ of an $R$-algebra $A$, the subalgebra generated by their union $\bigcup_i s_i$ is equal to the supremum of the subalgebras generated by each individual $s_i$. That is, $$\text{adjoin}_R\left(\bigcup_{i \in \alpha} s_i\right) = \bigsqcup_{i \in \alpha} \text{adjoin}_R(s_i).$$
Algebra.adjoin_attach_biUnion theorem
[DecidableEq A] {α : Type*} {s : Finset α} (f : s → Finset A) : adjoin R (s.attach.biUnion f : Set A) = ⨆ x, adjoin R (f x)
Full source
theorem adjoin_attach_biUnion [DecidableEq A] {α : Type*} {s : Finset α} (f : s → Finset A) :
    adjoin R (s.attach.biUnion f : Set A) = ⨆ x, adjoin R (f x) := by simp [adjoin_iUnion]
Subalgebra Generation Preserves Finite Union of Finite Sets
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any finite set $s$ of type $\alpha$ and any function $f : s \to \text{Finset } A$ assigning to each element of $s$ a finite subset of $A$, the subalgebra generated by the union of all $f(x)$ for $x \in s$ is equal to the supremum of the subalgebras generated by each individual $f(x)$. That is, $$\text{adjoin}_R\left(\bigcup_{x \in s} f(x)\right) = \bigsqcup_{x \in s} \text{adjoin}_R(f(x)).$$
Algebra.adjoin_induction theorem
{p : (x : A) → x ∈ adjoin R s → Prop} (mem : ∀ (x) (hx : x ∈ s), p x (subset_adjoin hx)) (algebraMap : ∀ r, p (algebraMap R A r) (algebraMap_mem _ r)) (add : ∀ x y hx hy, p x hx → p y hy → p (x + y) (add_mem hx hy)) (mul : ∀ x y hx hy, p x hx → p y hy → p (x * y) (mul_mem hx hy)) {x : A} (hx : x ∈ adjoin R s) : p x hx
Full source
@[elab_as_elim]
theorem adjoin_induction {p : (x : A) → x ∈ adjoin R s → Prop}
    (mem : ∀ (x) (hx : x ∈ s), p x (subset_adjoin hx))
    (algebraMap : ∀ r, p (algebraMap R A r) (algebraMap_mem _ r))
    (add : ∀ x y hx hy, p x hx → p y hy → p (x + y) (add_mem hx hy))
    (mul : ∀ x y hx hy, p x hx → p y hy → p (x * y) (mul_mem hx hy))
    {x : A} (hx : x ∈ adjoin R s) : p x hx :=
  let S : Subalgebra R A :=
    { carrier := { x | ∃ hx, p x hx }
      mul_mem' := by rintro _ _ ⟨_, hpx⟩ ⟨_, hpy⟩; exact ⟨_, mul _ _ _ _ hpx hpy⟩
      add_mem' := by rintro _ _ ⟨_, hpx⟩ ⟨_, hpy⟩; exact ⟨_, add _ _ _ _ hpx hpy⟩
      algebraMap_mem' := fun r ↦ ⟨_, algebraMap r⟩ }
  adjoin_le (S := S) (fun y hy ↦ ⟨subset_adjoin hy, mem y hy⟩) hx |>.elim fun _ ↦ _root_.id
Induction Principle for Subalgebra Generated by a Set
Informal description
Let $R$ be a commutative semiring and $A$ a semiring with an $R$-algebra structure. Given a subset $s \subseteq A$ and a predicate $p : A \to \text{Prop}$ defined on the subalgebra $\text{adjoin}_R(s)$ generated by $s$, if: 1. $p(x)$ holds for all $x \in s$, 2. $p(\text{algebraMap}_R^A(r))$ holds for all $r \in R$, 3. $p$ is preserved under addition (i.e., $p(x)$ and $p(y)$ imply $p(x + y)$), 4. $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 \text{adjoin}_R(s)$.
Algebra.adjoin_induction₂ theorem
{s : Set A} {p : (x y : A) → x ∈ adjoin R s → y ∈ adjoin R s → Prop} (mem_mem : ∀ (x) (y) (hx : x ∈ s) (hy : y ∈ s), p x y (subset_adjoin hx) (subset_adjoin hy)) (algebraMap_both : ∀ r₁ r₂, p (algebraMap R A r₁) (algebraMap R A r₂) (algebraMap_mem _ r₁) (algebraMap_mem _ r₂)) (algebraMap_left : ∀ (r) (x) (hx : x ∈ s), p (algebraMap R A r) x (algebraMap_mem _ r) (subset_adjoin hx)) (algebraMap_right : ∀ (r) (x) (hx : x ∈ s), p x (algebraMap R A r) (subset_adjoin hx) (algebraMap_mem _ r)) (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 : A} (hx : x ∈ adjoin R s) (hy : y ∈ adjoin R s) : p x y hx hy
Full source
/-- Induction principle for the algebra generated by a set `s`: show that `p x y` holds for any
`x y ∈ adjoin R s` given that it holds for `x y ∈ s` and that it satisfies a number of
natural properties. -/
@[elab_as_elim]
theorem adjoin_induction₂ {s : Set A} {p : (x y : A) → x ∈ adjoin R sy ∈ adjoin R s → Prop}
    (mem_mem : ∀ (x) (y) (hx : x ∈ s) (hy : y ∈ s), p x y (subset_adjoin hx) (subset_adjoin hy))
    (algebraMap_both : ∀ r₁ r₂, p (algebraMap R A r₁) (algebraMap R A r₂) (algebraMap_mem _ r₁)
      (algebraMap_mem _ r₂))
    (algebraMap_left : ∀ (r) (x) (hx : x ∈ s), p (algebraMap R A r) x (algebraMap_mem _ r)
      (subset_adjoin hx))
    (algebraMap_right : ∀ (r) (x) (hx : x ∈ s), p x (algebraMap R A r) (subset_adjoin hx)
      (algebraMap_mem _ r))
    (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 : A} (hx : x ∈ adjoin R s) (hy : y ∈ adjoin R s) :
    p x y hx hy := by
  induction hy using adjoin_induction with
  | mem z hz => induction hx using adjoin_induction with
    | mem _ h => exact mem_mem _ _ h hz
    | algebraMap _ => exact algebraMap_left _ _ hz
    | mul _ _ _ _ h₁ h₂ => exact mul_left _ _ _ _ _ _ h₁ h₂
    | add _ _ _ _ h₁ h₂ => exact add_left _ _ _ _ _ _ h₁ h₂
  | algebraMap r =>
    induction hx using adjoin_induction with
    | mem _ h => exact algebraMap_right _ _ h
    | algebraMap _ => exact algebraMap_both _ _
    | mul _ _ _ _ h₁ h₂ => exact mul_left _ _ _ _ _ _ h₁ h₂
    | add _ _ _ _ h₁ h₂ => exact add_left _ _ _ _ _ _ h₁ h₂
  | mul _ _ _ _ h₁ h₂ => exact mul_right _ _ _ _ _ _ h₁ h₂
  | add _ _ _ _ h₁ h₂ => exact add_right _ _ _ _ _ _ h₁ h₂
Two-Variable Induction Principle for Subalgebra Generated by a Set
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. Given a subset $s \subseteq A$ and a predicate $p : A \times A \to \text{Prop}$ defined on pairs $(x, y)$ where $x, y \in \text{adjoin}_R(s)$, if: 1. $p(x, y)$ holds for all $x, y \in s$, 2. $p(\text{algebraMap}_R^A(r_1), \text{algebraMap}_R^A(r_2))$ holds for all $r_1, r_2 \in R$, 3. $p(\text{algebraMap}_R^A(r), x)$ holds for all $r \in R$ and $x \in s$, 4. $p(x, \text{algebraMap}_R^A(r))$ holds for all $r \in R$ and $x \in s$, 5. $p$ is preserved under addition in the first argument (i.e., $p(x, z)$ and $p(y, z)$ imply $p(x + y, z)$), 6. $p$ is preserved under addition in the second argument (i.e., $p(x, y)$ and $p(x, z)$ imply $p(x, y + z)$), 7. $p$ is preserved under multiplication in the first argument (i.e., $p(x, z)$ and $p(y, z)$ imply $p(x \cdot y, z)$), 8. $p$ is preserved under multiplication in the second argument (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 \text{adjoin}_R(s)$.
Algebra.adjoin_adjoin_coe_preimage theorem
{s : Set A} : adjoin R (((↑) : adjoin R s → A) ⁻¹' s) = ⊤
Full source
@[simp]
theorem adjoin_adjoin_coe_preimage {s : Set A} : adjoin R (((↑) : adjoin R s → A) ⁻¹' s) =  := by
  refine eq_top_iff.2 fun ⟨x, hx⟩ ↦
      adjoin_induction (fun a ha ↦ ?_) (fun r ↦ ?_) (fun _ _ _ _ ↦ ?_) (fun _ _ _ _ ↦ ?_) hx
  · exact subset_adjoin ha
  · exact Subalgebra.algebraMap_mem _ r
  · exact Subalgebra.add_mem _
  · exact Subalgebra.mul_mem _
Subalgebra Generation of Preimage Under Inclusion Yields Top Subalgebra
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subset $s \subseteq A$, the subalgebra generated by the preimage of $s$ under the canonical inclusion map $\text{adjoin}_R(s) \hookrightarrow A$ is equal to the top element of the complete lattice of subalgebras (i.e., the entire algebra $A$ itself). In symbols: $$\text{adjoin}_R\left(\left(\iota : \text{adjoin}_R(s) \to A\right)^{-1}(s)\right) = \top$$ where $\iota$ is the inclusion map and $\top$ is the top subalgebra (equal to $A$).
Algebra.adjoin_union theorem
(s t : Set A) : adjoin R (s ∪ t) = adjoin R s ⊔ adjoin R t
Full source
theorem adjoin_union (s t : Set A) : adjoin R (s ∪ t) = adjoinadjoin R s ⊔ adjoin R t :=
  (Algebra.gc : GaloisConnection _ ((↑) : Subalgebra R A → Set A)).l_sup
Subalgebra Generation Preserves Union: $\text{adjoin}_R(s \cup t) = \text{adjoin}_R(s) \sqcup \text{adjoin}_R(t)$
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, and for any subsets $s, t \subseteq A$, the subalgebra generated by the union $s \cup t$ is equal to the supremum (join) of the subalgebras generated by $s$ and $t$ individually, i.e., $$\text{adjoin}_R(s \cup t) = \text{adjoin}_R(s) \sqcup \text{adjoin}_R(t).$$
Algebra.adjoin_empty theorem
: adjoin R (∅ : Set A) = ⊥
Full source
@[simp]
theorem adjoin_empty : adjoin R ( : Set A) =  := Algebra.gc.l_bot
Subalgebra Generated by Empty Set is Bottom Element
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the subalgebra generated by the empty set is equal to the bottom element of the complete lattice of subalgebras, i.e., the image of the algebra map $R \to A$.
Algebra.adjoin_univ theorem
: adjoin R (Set.univ : Set A) = ⊤
Full source
@[simp]
theorem adjoin_univ : adjoin R (Set.univ : Set A) =  := Algebra.gi.l_top
Subalgebra Generated by Universal Set is Top Element
Informal description
For a commutative semiring $R$ and an $R$-algebra $A$, the subalgebra generated by the universal set (i.e., all elements of $A$) is equal to the top element of the complete lattice of subalgebras, which is $A$ itself. In other words, $\text{adjoin}_R(A) = \top$.
Algebra.adjoin_singleton_algebraMap theorem
(x : R) : adjoin R {algebraMap R A x} = ⊥
Full source
@[simp]
theorem adjoin_singleton_algebraMap (x : R) : adjoin R {algebraMap R A x} =  :=
  bot_unique <| adjoin_singleton_le <| Subalgebra.algebraMap_mem _ _
Subalgebra Generated by Algebra Map Image is Bottom Element
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the subalgebra generated by the singleton set containing the image of an element $x \in R$ under the algebra map $R \to A$ is equal to the bottom element of the complete lattice of subalgebras, i.e., $\text{adjoin}_R(\{\text{algebraMap}_R^A(x)\}) = \bot$.
Algebra.adjoin_singleton_natCast theorem
(n : ℕ) : adjoin R {(n : A)} = ⊥
Full source
@[simp]
theorem adjoin_singleton_natCast (n : ) : adjoin R {(n : A)} =  := by
  simpa using adjoin_singleton_algebraMap A (n : R)
Subalgebra Generated by Natural Number is Bottom Element
Informal description
For any natural number $n$, the subalgebra of an $R$-algebra $A$ generated by the singleton set $\{n\}$ (where $n$ is viewed as an element of $A$ via the canonical map $\mathbb{N} \to A$) is equal to the bottom element of the complete lattice of subalgebras, i.e., $\text{adjoin}_R(\{n\}) = \bot$.
Algebra.adjoin_singleton_zero theorem
: adjoin R ({0} : Set A) = ⊥
Full source
@[simp]
theorem adjoin_singleton_zero : adjoin R ({0} : Set A) =  :=
  mod_cast adjoin_singleton_natCast R A 0
Subalgebra Generated by Zero is Bottom Element
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the subalgebra generated by the singleton set $\{0\}$ is equal to the bottom element of the complete lattice of subalgebras, i.e., $\text{adjoin}_R(\{0\}) = \bot$.
Algebra.adjoin_singleton_one theorem
: adjoin R ({ 1 } : Set A) = ⊥
Full source
@[simp]
theorem adjoin_singleton_one : adjoin R ({1} : Set A) =  :=
  mod_cast adjoin_singleton_natCast R A 1
Subalgebra Generated by One is Bottom Element
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the subalgebra generated by the singleton set $\{1\}$ is equal to the bottom element of the complete lattice of subalgebras, i.e., $\text{adjoin}_R(\{1\}) = \bot$.
Algebra.adjoin_insert_algebraMap theorem
(x : R) (s : Set A) : adjoin R (insert (algebraMap R A x) s) = adjoin R s
Full source
@[simp]
theorem adjoin_insert_algebraMap (x : R) (s : Set A) :
    adjoin R (insert (algebraMap R A x) s) = adjoin R s := by
  rw [Set.insert_eq, adjoin_union]
  simp
Subalgebra Generation Unaffected by Inserting Algebra Map Image: $\text{adjoin}_R(\{\text{algebraMap}_R^A(x)\} \cup s) = \text{adjoin}_R(s)$
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, given an element $x \in R$ and a subset $s \subseteq A$, the subalgebra generated by inserting the image of $x$ under the algebra map $R \to A$ into $s$ is equal to the subalgebra generated by $s$ alone. In other words, $$\text{adjoin}_R(\{\text{algebraMap}_R^A(x)\} \cup s) = \text{adjoin}_R(s).$$
Algebra.adjoin_insert_natCast theorem
(n : ℕ) (s : Set A) : adjoin R (insert (n : A) s) = adjoin R s
Full source
@[simp]
theorem adjoin_insert_natCast (n : ) (s : Set A) : adjoin R (insert (n : A) s) = adjoin R s :=
  mod_cast adjoin_insert_algebraMap (n : R) s
Subalgebra Generation Unaffected by Inserting Natural Number: $\text{adjoin}_R(\{n\} \cup s) = \text{adjoin}_R(s)$
Informal description
For any natural number $n$ and subset $s$ of an $R$-algebra $A$, the subalgebra generated by inserting the natural number $n$ (viewed as an element of $A$) into $s$ is equal to the subalgebra generated by $s$ alone. That is, $$\text{adjoin}_R(\{n\} \cup s) = \text{adjoin}_R(s).$$
Algebra.adjoin_insert_zero theorem
(s : Set A) : adjoin R (insert 0 s) = adjoin R s
Full source
@[simp]
theorem adjoin_insert_zero (s : Set A) : adjoin R (insert 0 s) = adjoin R s :=
  mod_cast adjoin_insert_natCast R 0 s
Subalgebra Generation Unaffected by Inserting Zero: $\text{adjoin}_R(\{0\} \cup s) = \text{adjoin}_R(s)$
Informal description
For any subset $s$ of an $R$-algebra $A$, the subalgebra generated by inserting the zero element into $s$ is equal to the subalgebra generated by $s$ alone. That is, $$\text{adjoin}_R(\{0\} \cup s) = \text{adjoin}_R(s).$$
Algebra.adjoin_insert_one theorem
(s : Set A) : adjoin R (insert 1 s) = adjoin R s
Full source
@[simp]
theorem adjoin_insert_one (s : Set A) : adjoin R (insert 1 s) = adjoin R s :=
  mod_cast adjoin_insert_natCast R 1 s
Subalgebra Generation Unaffected by Inserting One: $\text{adjoin}_R(\{1\} \cup s) = \text{adjoin}_R(s)$
Informal description
For any subset $s$ of an $R$-algebra $A$, the subalgebra generated by inserting the multiplicative identity $1$ into $s$ is equal to the subalgebra generated by $s$ alone. That is, $$\text{adjoin}_R(\{1\} \cup s) = \text{adjoin}_R(s).$$
Algebra.adjoin_eq_span theorem
: Subalgebra.toSubmodule (adjoin R s) = span R (Submonoid.closure s)
Full source
theorem adjoin_eq_span : Subalgebra.toSubmodule (adjoin R s) = span R (Submonoid.closure s) := by
  apply le_antisymm
  · intro r hr
    rcases Subsemiring.mem_closure_iff_exists_list.1 hr with ⟨L, HL, rfl⟩
    clear hr
    induction' L with hd tl ih
    · exact zero_mem _
    rw [List.forall_mem_cons] at HL
    rw [List.map_cons, List.sum_cons]
    refine Submodule.add_mem _ ?_ (ih HL.2)
    replace HL := HL.1
    clear ih tl
    suffices ∃ (z r : _) (_hr : r ∈ Submonoid.closure s), z • r = List.prod hd by
      rcases this with ⟨z, r, hr, hzr⟩
      rw [← hzr]
      exact smul_mem _ _ (subset_span hr)
    induction' hd with hd tl ih
    · exact ⟨1, 1, (Submonoid.closure s).one_mem', one_smul _ _⟩
    rw [List.forall_mem_cons] at HL
    rcases ih HL.2 with ⟨z, r, hr, hzr⟩
    rw [List.prod_cons, ← hzr]
    rcases HL.1 with (⟨hd, rfl⟩ | hs)
    · refine ⟨hd * z, r, hr, ?_⟩
      rw [Algebra.smul_def, Algebra.smul_def, (algebraMap _ _).map_mul, _root_.mul_assoc]
    · exact
        ⟨z, hd * r, Submonoid.mul_mem _ (Submonoid.subset_closure hs) hr,
          (mul_smul_comm _ _ _).symm⟩
  refine span_le.2 ?_
  change Submonoid.closure s ≤ (adjoin R s).toSubsemiring.toSubmonoid
  exact Submonoid.closure_le.2 subset_adjoin
Equality of Subalgebra Adjoin and Submodule Span via Submonoid Closure
Informal description
For any subset $s$ of an $R$-algebra $A$, the underlying submodule of the subalgebra generated by $s$ is equal to the $R$-linear span of the submonoid generated by $s$. In other words: $$(\text{adjoin}_R s).\text{toSubmodule} = \operatorname{span}_R (\text{Submonoid.closure}(s))$$
Algebra.span_le_adjoin theorem
(s : Set A) : span R s ≤ Subalgebra.toSubmodule (adjoin R s)
Full source
theorem span_le_adjoin (s : Set A) : span R s ≤ Subalgebra.toSubmodule (adjoin R s) :=
  span_le.mpr subset_adjoin
Submodule span is contained in subalgebra adjoin
Informal description
For any subset $s$ of an $R$-algebra $A$, the $R$-submodule generated by $s$ is contained in the underlying submodule of the subalgebra generated by $s$. In other words: $$\operatorname{span}_R s \leq (\text{adjoin}_R s).\text{toSubmodule}$$
Algebra.adjoin_eq_span_of_subset theorem
{s : Set A} (hs : ↑(Submonoid.closure s) ⊆ (span R s : Set A)) : Subalgebra.toSubmodule (adjoin R s) = span R s
Full source
theorem adjoin_eq_span_of_subset {s : Set A} (hs : ↑(Submonoid.closure s) ⊆ (span R s : Set A)) :
    Subalgebra.toSubmodule (adjoin R s) = span R s :=
  le_antisymm ((adjoin_toSubmodule_le R).mpr hs) (span_le_adjoin R s)
Equality of Subalgebra Module and Span When Monoid Closure is Contained in Span
Informal description
For any subset $s$ of an $R$-algebra $A$, if the submonoid generated by $s$ is contained in the $R$-submodule span of $s$, then the underlying submodule of the subalgebra generated by $s$ is equal to the $R$-submodule span of $s$. In other words: $$(\text{adjoin}_R s).\text{toSubmodule} = \operatorname{span}_R s$$
Algebra.adjoin_span theorem
{s : Set A} : adjoin R (Submodule.span R s : Set A) = adjoin R s
Full source
@[simp]
theorem adjoin_span {s : Set A} : adjoin R (Submodule.span R s : Set A) = adjoin R s :=
  le_antisymm (adjoin_le (span_le_adjoin _ _)) (adjoin_mono Submodule.subset_span)
Subalgebra Generation by Module Span Equals Generation by Original Set
Informal description
For any subset $s$ of an $R$-algebra $A$, the subalgebra generated by the $R$-submodule span of $s$ is equal to the subalgebra generated by $s$ itself, i.e., $$\text{adjoin}_R(\operatorname{span}_R s) = \text{adjoin}_R(s).$$
Algebra.adjoin_image theorem
(f : A →ₐ[R] B) (s : Set A) : adjoin R (f '' s) = (adjoin R s).map f
Full source
theorem adjoin_image (f : A →ₐ[R] B) (s : Set A) : adjoin R (f '' s) = (adjoin R s).map f :=
  le_antisymm (adjoin_le <| Set.image_subset _ subset_adjoin) <|
    Subalgebra.map_le.2 <| adjoin_le <| Set.image_subset_iff.1 <| by
      -- Porting note: I don't understand how this worked in Lean 3 with just `subset_adjoin`
      simp only [Set.image_id', coe_carrier_toSubmonoid, Subalgebra.coe_toSubsemiring,
        Subalgebra.coe_comap]
      exact fun x hx => subset_adjoin ⟨x, hx, rfl⟩
Image of Generated Subalgebra Equals Generated Subalgebra of Image
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. For any $R$-algebra homomorphism $f \colon A \to B$ and any subset $s \subseteq A$, the subalgebra generated by the image $f(s)$ is equal to the image of the subalgebra generated by $s$ under $f$. In symbols: \[ \text{adjoin}_R(f(s)) = f(\text{adjoin}_R(s)). \]
Algebra.adjoin_insert_adjoin theorem
(x : A) : adjoin R (insert x ↑(adjoin R s)) = adjoin R (insert x s)
Full source
@[simp]
theorem adjoin_insert_adjoin (x : A) : adjoin R (insert x ↑(adjoin R s)) = adjoin R (insert x s) :=
  le_antisymm
    (adjoin_le
      (Set.insert_subset_iff.mpr
        ⟨subset_adjoin (Set.mem_insert _ _), adjoin_mono (Set.subset_insert _ _)⟩))
    (Algebra.adjoin_mono (Set.insert_subset_insert Algebra.subset_adjoin))
Adjoin Insertion Equivalence: $\text{adjoin}_R(\{x\} \cup \text{adjoin}_R(s)) = \text{adjoin}_R(\{x\} \cup s)$
Informal description
For any element $x$ in an $R$-algebra $A$ and any subset $s \subseteq A$, the subalgebra generated by the insertion of $x$ into the carrier of the subalgebra generated by $s$ is equal to the subalgebra generated by the insertion of $x$ directly into $s$. In other words: \[ \text{adjoin}_R(\{x\} \cup \text{adjoin}_R(s)) = \text{adjoin}_R(\{x\} \cup s). \]
Algebra.mem_adjoin_of_map_mul theorem
{s} {x : A} {f : A →ₗ[R] B} (hf : ∀ a₁ a₂, f (a₁ * a₂) = f a₁ * f a₂) (h : x ∈ adjoin R s) : f x ∈ adjoin R (f '' (s ∪ { 1 }))
Full source
theorem mem_adjoin_of_map_mul {s} {x : A} {f : A →ₗ[R] B} (hf : ∀ a₁ a₂, f (a₁ * a₂) = f a₁ * f a₂)
    (h : x ∈ adjoin R s) : f x ∈ adjoin R (f '' (s ∪ {1})) := by
  induction h using adjoin_induction with
  | mem a ha => exact subset_adjoin ⟨a, ⟨Set.subset_union_left ha, rfl⟩⟩
  | algebraMap r =>
    have : f 1 ∈ adjoin R (f '' (s ∪ {1})) :=
      subset_adjoin ⟨1, ⟨Set.subset_union_right <| Set.mem_singleton 1, rfl⟩⟩
    convert Subalgebra.smul_mem (adjoin R (f '' (s ∪ {1}))) this r
    rw [algebraMap_eq_smul_one]
    exact f.map_smul _ _
  | add y z _ _ hy hz => simpa [hy, hz] using Subalgebra.add_mem _ hy hz
  | mul y z _ _ hy hz => simpa [hf, hy, hz] using Subalgebra.mul_mem _ hy hz
Image of Adjoined Element under Multiplicative Linear Map Belongs to Adjoined Image
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. Given a subset $s \subseteq A$, an element $x \in \text{adjoin}_R(s)$, and an $R$-linear map $f \colon A \to B$ that satisfies the multiplicative property $f(a_1 \cdot a_2) = f(a_1) \cdot f(a_2)$ for all $a_1, a_2 \in A$, then $f(x)$ belongs to the subalgebra generated by the image of $s \cup \{1\}$ under $f$, i.e., \[ f(x) \in \text{adjoin}_R(f(s \cup \{1\})). \]
Algebra.adjoin_le_centralizer_centralizer theorem
(s : Set A) : adjoin R s ≤ Subalgebra.centralizer R (Subalgebra.centralizer R s)
Full source
lemma adjoin_le_centralizer_centralizer (s : Set A) :
    adjoin R s ≤ Subalgebra.centralizer R (Subalgebra.centralizer R s) :=
  adjoin_le Set.subset_centralizer_centralizer
Generated Subalgebra is Contained in its Double Centralizer
Informal description
For any subset $s$ of an $R$-algebra $A$, the subalgebra generated by $s$ is contained in the centralizer of its centralizer, i.e., \[ \text{adjoin}_R(s) \leq \text{centralizer}_R(\text{centralizer}_R(s)). \] Here, $\text{centralizer}_R(s)$ denotes the subalgebra of elements in $A$ that commute with every element of $s$.
Algebra.adjoinCommSemiringOfComm abbrev
{s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) : CommSemiring (adjoin R s)
Full source
/-- If all elements of `s : Set A` commute pairwise, then `adjoin s` is a commutative semiring. -/
abbrev adjoinCommSemiringOfComm {s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) :
    CommSemiring (adjoin R s) :=
  { (adjoin R s).toSemiring with
    mul_comm := fun ⟨_, h₁⟩ ⟨_, h₂⟩ ↦
      have := adjoin_le_centralizer_centralizer R s
      Subtype.ext <| Set.centralizer_centralizer_comm_of_comm hcomm _ (this h₁) _ (this h₂) }
Commutativity of Adjoined Subalgebra for Pairwise Commuting Elements
Informal description
Let $R$ be a commutative semiring and $A$ be a semiring with an $R$-algebra structure. For any subset $s \subseteq A$ where all elements of $s$ commute pairwise (i.e., $a \cdot b = b \cdot a$ for all $a, b \in s$), the subalgebra $\text{adjoin}_R(s)$ generated by $s$ is a commutative semiring.
Algebra.commute_of_mem_adjoin_of_forall_mem_commute theorem
{a b : A} {s : Set A} (hb : b ∈ adjoin R s) (h : ∀ b ∈ s, Commute a b) : Commute a b
Full source
lemma commute_of_mem_adjoin_of_forall_mem_commute {a b : A} {s : Set A}
    (hb : b ∈ adjoin R s) (h : ∀ b ∈ s, Commute a b) :
    Commute a b := by
  induction hb using adjoin_induction with
  | mem x hx => exact h x hx
  | algebraMap r => exact commutes r a |>.symm
  | add y z _ _ hy hz => exact hy.add_right hz
  | mul y z _ _ hy hz => exact hy.mul_right hz
Commutation in Adjoined Subalgebra for Pairwise Commuting Elements
Informal description
Let $R$ be a commutative semiring and $A$ be a semiring with an $R$-algebra structure. Given elements $a, b \in A$ and a subset $s \subseteq A$, if $b$ belongs to the subalgebra generated by $s$ (i.e., $b \in \text{adjoin}_R(s)$) and $a$ commutes with every element of $s$ (i.e., $a \cdot c = c \cdot a$ for all $c \in s$), then $a$ commutes with $b$ (i.e., $a \cdot b = b \cdot a$).
Algebra.commute_of_mem_adjoin_singleton_of_commute theorem
{a b c : A} (hc : c ∈ adjoin R { b }) (h : Commute a b) : Commute a c
Full source
lemma commute_of_mem_adjoin_singleton_of_commute {a b c : A}
    (hc : c ∈ adjoin R {b}) (h : Commute a b) :
    Commute a c :=
  commute_of_mem_adjoin_of_forall_mem_commute hc <| by simpa
Commutation in Singleton-Adjoined Subalgebra for Commuting Elements
Informal description
Let $R$ be a commutative semiring and $A$ be a semiring with an $R$-algebra structure. For any elements $a, b, c \in A$, if $c$ belongs to the subalgebra generated by the singleton set $\{b\}$ (i.e., $c \in \text{adjoin}_R(\{b\})$) and $a$ commutes with $b$ (i.e., $a \cdot b = b \cdot a$), then $a$ commutes with $c$ (i.e., $a \cdot c = c \cdot a$).
Algebra.commute_of_mem_adjoin_self theorem
{a b : A} (hb : b ∈ adjoin R { a }) : Commute a b
Full source
lemma commute_of_mem_adjoin_self {a b : A} (hb : b ∈ adjoin R {a}) :
    Commute a b :=
  commute_of_mem_adjoin_singleton_of_commute hb rfl
Commutation in Self-Adjoined Subalgebra
Informal description
Let $R$ be a commutative semiring and $A$ be a semiring with an $R$-algebra structure. For any elements $a, b \in A$, if $b$ belongs to the subalgebra generated by the singleton set $\{a\}$ (i.e., $b \in \text{adjoin}_R(\{a\})$), then $a$ commutes with $b$ (i.e., $a \cdot b = b \cdot a$).
Algebra.adjoin_union_coe_submodule theorem
: Subalgebra.toSubmodule (adjoin R (s ∪ t)) = Subalgebra.toSubmodule (adjoin R s) * Subalgebra.toSubmodule (adjoin R t)
Full source
theorem adjoin_union_coe_submodule :
    Subalgebra.toSubmodule (adjoin R (s ∪ t)) =
      Subalgebra.toSubmodule (adjoin R s) * Subalgebra.toSubmodule (adjoin R t) := by
  rw [adjoin_eq_span, adjoin_eq_span, adjoin_eq_span, span_mul_span]
  congr 1 with z; simp [Submonoid.closure_union, Submonoid.mem_sup, Set.mem_mul]
Submodule Product Decomposition of Adjoined Union in $R$-Algebras
Informal description
For any subsets $s$ and $t$ of an $R$-algebra $A$, the underlying submodule of the subalgebra generated by $s \cup t$ is equal to the product of the underlying submodules of the subalgebras generated by $s$ and $t$ respectively. In other words: $$(\text{adjoin}_R (s \cup t)).\text{toSubmodule} = (\text{adjoin}_R s).\text{toSubmodule} \cdot (\text{adjoin}_R t).\text{toSubmodule}$$
Algebra.adjoin_singleton_intCast theorem
(n : ℤ) : adjoin R {(n : A)} = ⊥
Full source
@[simp]
theorem adjoin_singleton_intCast (n : ) : adjoin R {(n : A)} =  := by
  simpa using adjoin_singleton_algebraMap A (n : R)
Subalgebra Generated by Integer Singleton is Bottom Element
Informal description
For any integer $n \in \mathbb{Z}$ and any $R$-algebra $A$, the subalgebra generated by the singleton set $\{n\}$ (where $n$ is viewed as an element of $A$ via the canonical map $\mathbb{Z} \to A$) is equal to the bottom element of the complete lattice of subalgebras, i.e., $\text{adjoin}_R(\{n\}) = \bot$.
Algebra.adjoin_insert_intCast theorem
(n : ℤ) (s : Set A) : adjoin R (insert (n : A) s) = adjoin R s
Full source
@[simp]
theorem adjoin_insert_intCast (n : ) (s : Set A) : adjoin R (insert (n : A) s) = adjoin R s := by
  simpa using adjoin_insert_algebraMap (n : R) s
Subalgebra Generation Unaffected by Inserting Integer Image: $\text{adjoin}_R(\{n\} \cup s) = \text{adjoin}_R(s)$
Informal description
For any integer $n \in \mathbb{Z}$ and any subset $s$ of an $R$-algebra $A$, the subalgebra generated by inserting the image of $n$ (under the canonical map $\mathbb{Z} \to A$) into $s$ is equal to the subalgebra generated by $s$ alone. In other words: $$\text{adjoin}_R(\{n\} \cup s) = \text{adjoin}_R(s).$$
Algebra.mem_adjoin_iff theorem
{s : Set A} {x : A} : x ∈ adjoin R s ↔ x ∈ Subring.closure (Set.range (algebraMap R A) ∪ s)
Full source
theorem mem_adjoin_iff {s : Set A} {x : A} :
    x ∈ adjoin R sx ∈ adjoin R s ↔ x ∈ Subring.closure (Set.range (algebraMap R A) ∪ s) :=
  ⟨fun hx =>
    Subsemiring.closure_induction Subring.subset_closure (Subring.zero_mem _) (Subring.one_mem _)
      (fun _ _ _ _ => Subring.add_mem _) (fun _ _ _ _ => Subring.mul_mem _) hx,
    suffices Subring.closure (Set.range (algebraMap R A) ∪ s) ≤ (adjoin R s).toSubring
      from (show (_ : Set A) ⊆ _ from this) (a := x)
    -- Porting note: Lean doesn't seem to recognize the defeq between the order on subobjects and
    -- subsets of their coercions to sets as easily as in Lean 3
    Subring.closure_le.2 Subsemiring.subset_closure⟩
Characterization of Membership in the Subalgebra Generated by a Set
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subset $s \subseteq A$ and any element $x \in A$, we have $x \in \text{adjoin}_R(s)$ if and only if $x$ belongs to the subring closure of the union of the range of the algebra map $R \to A$ and the set $s$.
Algebra.adjoin_eq_ring_closure theorem
(s : Set A) : (adjoin R s).toSubring = Subring.closure (Set.range (algebraMap R A) ∪ s)
Full source
theorem adjoin_eq_ring_closure (s : Set A) :
    (adjoin R s).toSubring = Subring.closure (Set.rangeSet.range (algebraMap R A) ∪ s) :=
  Subring.ext fun _x => mem_adjoin_iff
Subalgebra Adjoin as Subring Closure
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subset $s \subseteq A$, the subring underlying the subalgebra $\text{adjoin}_R(s)$ is equal to the subring closure of the union of the range of the algebra map $R \to A$ and the set $s$. In other words, $(\text{adjoin}_R(s)).\text{toSubring} = \text{Subring.closure}(\text{range}(\text{algebraMap}_R A) \cup s)$.
Algebra.adjoinCommRingOfComm abbrev
{s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) : CommRing (adjoin R s)
Full source
/-- If all elements of `s : Set A` commute pairwise, then `adjoin R s` is a commutative
ring. -/
abbrev adjoinCommRingOfComm {s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) :
    CommRing (adjoin R s) :=
  { (adjoin R s).toRing, adjoinCommSemiringOfComm R hcomm with }
Commutativity of Adjoined Subalgebra for Pairwise Commuting Elements
Informal description
Let $R$ be a commutative semiring and $A$ be a ring with an $R$-algebra structure. For any subset $s \subseteq A$ where all elements of $s$ commute pairwise (i.e., $a \cdot b = b \cdot a$ for all $a, b \in s$), the subalgebra $\text{adjoin}_R(s)$ generated by $s$ is a commutative ring.
AlgHom.map_adjoin theorem
(φ : A →ₐ[R] B) (s : Set A) : (adjoin R s).map φ = adjoin R (φ '' s)
Full source
theorem map_adjoin (φ : A →ₐ[R] B) (s : Set A) : (adjoin R s).map φ = adjoin R (φ '' s) :=
  (adjoin_image _ _ _).symm
Image of Generated Subalgebra Equals Generated Subalgebra of Image
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be semirings equipped with $R$-algebra structures. For any $R$-algebra homomorphism $\phi \colon A \to B$ and any subset $s \subseteq A$, the image of the subalgebra $\text{adjoin}_R(s)$ under $\phi$ is equal to the subalgebra generated by the image $\phi(s)$ in $B$. In symbols: \[ \phi(\text{adjoin}_R(s)) = \text{adjoin}_R(\phi(s)). \]
AlgHom.map_adjoin_singleton theorem
(e : A →ₐ[R] B) (x : A) : (adjoin R { x }).map e = adjoin R {e x}
Full source
@[simp]
theorem map_adjoin_singleton (e : A →ₐ[R] B) (x : A) :
    (adjoin R {x}).map e = adjoin R {e x} := by
  rw [map_adjoin, Set.image_singleton]
Image of Generated Subalgebra for Singleton Equals Generated Subalgebra of Image
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be semirings equipped with $R$-algebra structures. For any $R$-algebra homomorphism $e \colon A \to B$ and any element $x \in A$, the image of the subalgebra $\text{adjoin}_R(\{x\})$ under $e$ is equal to the subalgebra generated by the singleton set $\{e(x)\}$ in $B$. In symbols: \[ e(\text{adjoin}_R(\{x\})) = \text{adjoin}_R(\{e(x)\}). \]
AlgHom.adjoin_le_equalizer theorem
(φ₁ φ₂ : A →ₐ[R] B) {s : Set A} (h : s.EqOn φ₁ φ₂) : adjoin R s ≤ equalizer φ₁ φ₂
Full source
theorem adjoin_le_equalizer (φ₁ φ₂ : A →ₐ[R] B) {s : Set A} (h : s.EqOn φ₁ φ₂) :
    adjoin R s ≤ equalizer φ₁ φ₂ :=
  adjoin_le h
Generated Subalgebra is Contained in Equalizer of Agreeing Homomorphisms
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be semirings equipped with $R$-algebra structures. Given two $R$-algebra homomorphisms $\phi_1, \phi_2: A \to B$ and a subset $s \subseteq A$ such that $\phi_1$ and $\phi_2$ agree on $s$ (i.e., $\phi_1(x) = \phi_2(x)$ for all $x \in s$), then the subalgebra $\text{adjoin}_R(s)$ generated by $s$ over $R$ is contained in the equalizer of $\phi_1$ and $\phi_2$.
AlgHom.ext_of_adjoin_eq_top theorem
{s : Set A} (h : adjoin R s = ⊤) ⦃φ₁ φ₂ : A →ₐ[R] B⦄ (hs : s.EqOn φ₁ φ₂) : φ₁ = φ₂
Full source
theorem ext_of_adjoin_eq_top {s : Set A} (h : adjoin R s = ) ⦃φ₁ φ₂ : A →ₐ[R] B⦄
    (hs : s.EqOn φ₁ φ₂) : φ₁ = φ₂ :=
  ext fun _x => adjoin_le_equalizer φ₁ φ₂ hs <| h.symmtrivial
Uniqueness of Algebra Homomorphisms on Top-Generating Subalgebra
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be semirings equipped with $R$-algebra structures. Given a subset $s \subseteq A$ such that the subalgebra $\text{adjoin}_R(s)$ generated by $s$ over $R$ is equal to the entire algebra $A$, and two $R$-algebra homomorphisms $\phi_1, \phi_2: A \to B$ that agree on $s$ (i.e., $\phi_1(x) = \phi_2(x)$ for all $x \in s$), then $\phi_1 = \phi_2$.
AlgHom.eqOn_adjoin_iff theorem
{φ ψ : A →ₐ[R] B} {s : Set A} : Set.EqOn φ ψ (adjoin R s) ↔ Set.EqOn φ ψ s
Full source
/-- Two algebra morphisms are equal on `Algebra.span s`iff they are equal on s -/
theorem eqOn_adjoin_iff {φ ψ : A →ₐ[R] B} {s : Set A} :
    Set.EqOnSet.EqOn φ ψ (adjoin R s) ↔ Set.EqOn φ ψ s := by
  have (S : Set A) : S ≤ equalizer φ ψ ↔ Set.EqOn φ ψ S := Iff.rfl
  simp only [← this, Set.le_eq_subset, SetLike.coe_subset_coe, adjoin_le_iff]
Equality of Algebra Homomorphisms on Generated Subalgebra vs. Generating Set
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be semirings equipped with $R$-algebra structures. For any two $R$-algebra homomorphisms $\phi, \psi: A \to B$ and any subset $s \subseteq A$, the following are equivalent: 1. $\phi$ and $\psi$ agree on the subalgebra $\text{adjoin}_R(s)$ generated by $s$ over $R$. 2. $\phi$ and $\psi$ agree on the set $s$ itself. In other words, $\phi(x) = \psi(x)$ for all $x \in \text{adjoin}_R(s)$ if and only if $\phi(x) = \psi(x)$ for all $x \in s$.
AlgHom.adjoin_ext theorem
{s : Set A} ⦃φ₁ φ₂ : adjoin R s →ₐ[R] B⦄ (h : ∀ x hx, φ₁ ⟨x, subset_adjoin hx⟩ = φ₂ ⟨x, subset_adjoin hx⟩) : φ₁ = φ₂
Full source
theorem adjoin_ext {s : Set A} ⦃φ₁ φ₂ : adjoinadjoin R s →ₐ[R] B⦄
    (h : ∀ x hx, φ₁ ⟨x, subset_adjoin hx⟩ = φ₂ ⟨x, subset_adjoin hx⟩) : φ₁ = φ₂ :=
  ext fun ⟨x, hx⟩ ↦ adjoin_induction h (fun _ ↦ φ₂.commutes _ ▸ φ₁.commutes _)
    (fun _ _ _ _ h₁ h₂ ↦ by convert congr_arg₂ (· + ·) h₁ h₂ <;> rw [← map_add] <;> rfl)
    (fun _ _ _ _ h₁ h₂ ↦ by convert congr_arg₂ (· * ·) h₁ h₂ <;> rw [← map_mul] <;> rfl) hx
Extension Property of Algebra Homomorphisms on Generated Subalgebra
Informal description
Let $R$ be a commutative semiring, $A$ and $B$ be semirings with $R$-algebra structures, and $s \subseteq A$ be a subset. For any two $R$-algebra homomorphisms $\phi_1, \phi_2 \colon \text{adjoin}_R(s) \to B$, if $\phi_1(x) = \phi_2(x)$ for all $x \in s$, then $\phi_1 = \phi_2$ on the entire subalgebra $\text{adjoin}_R(s)$.
AlgHom.ext_of_eq_adjoin theorem
{S : Subalgebra R A} {s : Set A} (hS : S = adjoin R s) ⦃φ₁ φ₂ : S →ₐ[R] B⦄ (h : ∀ x hx, φ₁ ⟨x, hS.ge (subset_adjoin hx)⟩ = φ₂ ⟨x, hS.ge (subset_adjoin hx)⟩) : φ₁ = φ₂
Full source
theorem ext_of_eq_adjoin {S : Subalgebra R A} {s : Set A} (hS : S = adjoin R s) ⦃φ₁ φ₂ : S →ₐ[R] B⦄
    (h : ∀ x hx, φ₁ ⟨x, hS.ge (subset_adjoin hx)⟩ = φ₂ ⟨x, hS.ge (subset_adjoin hx)⟩) :
    φ₁ = φ₂ := by
  subst hS; exact adjoin_ext h
Extension Property of Algebra Homomorphisms on Subalgebra Generated by a Set
Informal description
Let $R$ be a commutative semiring, $A$ and $B$ be semirings with $R$-algebra structures, and $S$ be a subalgebra of $A$ such that $S = \text{adjoin}_R(s)$ for some subset $s \subseteq A$. For any two $R$-algebra homomorphisms $\phi_1, \phi_2 \colon S \to B$, if $\phi_1(x) = \phi_2(x)$ for all $x \in s$, then $\phi_1 = \phi_2$ on the entire subalgebra $S$.
Algebra.adjoin_nat theorem
{R : Type*} [Semiring R] (s : Set R) : adjoin ℕ s = subalgebraOfSubsemiring (Subsemiring.closure s)
Full source
theorem Algebra.adjoin_nat {R : Type*} [Semiring R] (s : Set R) :
    adjoin  s = subalgebraOfSubsemiring (Subsemiring.closure s) :=
  le_antisymm (adjoin_le Subsemiring.subset_closure)
    (Subsemiring.closure_le.2 subset_adjoin : Subsemiring.closure s ≤ (adjoin  s).toSubsemiring)
Equality of $\mathbb{N}$-subalgebra generated by a set and its subsemiring closure
Informal description
For any semiring $R$ and subset $s \subseteq R$, the $\mathbb{N}$-subalgebra generated by $s$ is equal to the $\mathbb{N}$-subalgebra obtained from the subsemiring generated by $s$. In other words: $$\text{adjoin}_{\mathbb{N}}(s) = \text{subalgebraOfSubsemiring}(\text{Subsemiring.closure}(s)).$$
Algebra.adjoin_int theorem
{R : Type*} [Ring R] (s : Set R) : adjoin ℤ s = subalgebraOfSubring (Subring.closure s)
Full source
theorem Algebra.adjoin_int {R : Type*} [Ring R] (s : Set R) :
    adjoin  s = subalgebraOfSubring (Subring.closure s) :=
  le_antisymm (adjoin_le Subring.subset_closure)
    (Subring.closure_le.2 subset_adjoin : Subring.closure s ≤ (adjoin  s).toSubring)
Equality of $\mathbb{Z}$-subalgebra adjoin and subring closure
Informal description
For any ring $R$ and subset $s \subseteq R$, the $\mathbb{Z}$-subalgebra generated by $s$ is equal to the $\mathbb{Z}$-subalgebra obtained from the subring closure of $s$. In other words, $\text{adjoin}_{\mathbb{Z}}(s) = \text{subalgebraOfSubring}(\text{Subring.closure}(s))$.
Subsemiring.closureEquivAdjoinNat definition
{R : Type*} [Semiring R] (s : Set R) : Subsemiring.closure s ≃ₐ[ℕ] Algebra.adjoin ℕ s
Full source
/-- The `ℕ`-algebra equivalence between `Subsemiring.closure s` and `Algebra.adjoin ℕ s` given
by the identity map. -/
def Subsemiring.closureEquivAdjoinNat {R : Type*} [Semiring R] (s : Set R) :
    Subsemiring.closureSubsemiring.closure s ≃ₐ[ℕ] Algebra.adjoin ℕ s :=
  Subalgebra.equivOfEq (subalgebraOfSubsemiring <| Subsemiring.closure s) _ (adjoin_nat s).symm
$\mathbb{N}$-algebra isomorphism between subsemiring closure and $\mathbb{N}$-subalgebra adjoin
Informal description
Given a semiring $R$ and a subset $s \subseteq R$, there is a natural $\mathbb{N}$-algebra isomorphism between the subsemiring generated by $s$ and the $\mathbb{N}$-subalgebra generated by $s$. More precisely, the isomorphism $\text{closureEquivAdjoinNat}$ maps elements of the subsemiring closure $\text{Subsemiring.closure}(s)$ to their corresponding elements in the $\mathbb{N}$-subalgebra $\text{adjoin}_{\mathbb{N}}(s)$, preserving both the ring structure and the scalar multiplication by natural numbers.
Subring.closureEquivAdjoinInt definition
{R : Type*} [Ring R] (s : Set R) : Subring.closure s ≃ₐ[ℤ] Algebra.adjoin ℤ s
Full source
/-- The `ℤ`-algebra equivalence between `Subring.closure s` and `Algebra.adjoin ℤ s` given by
the identity map. -/
def Subring.closureEquivAdjoinInt {R : Type*} [Ring R] (s : Set R) :
    Subring.closureSubring.closure s ≃ₐ[ℤ] Algebra.adjoin ℤ s :=
  Subalgebra.equivOfEq (subalgebraOfSubring <| Subring.closure s) _ (adjoin_int s).symm
Subring closure and $\mathbb{Z}$-algebra adjoin equivalence
Informal description
For any ring $R$ and subset $s \subseteq R$, there is a $\mathbb{Z}$-algebra isomorphism between the subring generated by $s$ and the $\mathbb{Z}$-subalgebra generated by $s$. This isomorphism is given by the identity map, showing that these two constructions yield the same underlying set with the same algebraic structure.
Submonoid.adjoin_eq_span_of_eq_span theorem
[Semiring F] [Module F K] [IsScalarTower F E K] (L : Submonoid K) {S : Set K} (h : (L : Set K) = span F S) : toSubmodule (adjoin E (L : Set K)) = span E S
Full source
/-- If `K / E / F` is a ring extension tower, `L` is a submonoid of `K / F` which is generated by
`S` as an `F`-module, then `E[L]` is generated by `S` as an `E`-module. -/
theorem Submonoid.adjoin_eq_span_of_eq_span [Semiring F] [Module F K] [IsScalarTower F E K]
    (L : Submonoid K) {S : Set K} (h : (L : Set K) = span F S) :
    toSubmodule (adjoin E (L : Set K)) = span E S := by
  rw [adjoin_eq_span, L.closure_eq, h]
  exact (span_le.mpr <| span_subset_span _ _ _).antisymm (span_mono subset_span)
Equality of Adjoined Submodule and Span under Scalar Tower Condition
Informal description
Let $F$ be a semiring and $K$ an $F$-module such that $F \hookrightarrow E \hookrightarrow K$ forms a scalar multiplication tower. Let $L$ be a submonoid of $K$ as an $F$-module, and suppose $L$ is generated by a subset $S \subseteq K$ as an $F$-module (i.e., $L = \operatorname{span}_F S$). Then the $E$-submodule generated by $L$ (viewed as a subset of $K$) is equal to the $E$-linear span of $S$, i.e., $$\operatorname{toSubmodule}(\text{adjoin}_E L) = \operatorname{span}_E S.$$
Subalgebra.adjoin_eq_span_of_eq_span theorem
{S : Set K} (h : toSubmodule L = span F S) : toSubmodule (adjoin E (L : Set K)) = span E S
Full source
/-- If `K / E / F` is a ring extension tower, `L` is a subalgebra of `K / F` which is generated by
`S` as an `F`-module, then `E[L]` is generated by `S` as an `E`-module. -/
theorem Subalgebra.adjoin_eq_span_of_eq_span {S : Set K} (h : toSubmodule L = span F S) :
    toSubmodule (adjoin E (L : Set K)) = span E S :=
  L.toSubmonoid.adjoin_eq_span_of_eq_span F E (congr_arg ((↑) : _ → Set K) h)
Equality of subalgebra adjoin and module span in ring extension towers
Informal description
Let $F \subseteq E \subseteq K$ be a tower of ring extensions, and let $L$ be a subalgebra of $K$ over $F$ generated by a set $S \subseteq K$ as an $F$-module (i.e., $L = \operatorname{span}_F S$). Then the $E$-submodule generated by $L$ (viewed as a subset of $K$) equals the $E$-linear span of $S$, i.e., $$\operatorname{toSubmodule}(\operatorname{adjoin}_E L) = \operatorname{span}_E S.$$
NonUnitalAlgebra.adjoin_le_algebra_adjoin theorem
(s : Set A) : adjoin R s ≤ (Algebra.adjoin R s).toNonUnitalSubalgebra
Full source
lemma NonUnitalAlgebra.adjoin_le_algebra_adjoin (s : Set A) :
    adjoin R s ≤ (Algebra.adjoin R s).toNonUnitalSubalgebra := adjoin_le Algebra.subset_adjoin
Inclusion of Non-unital Subalgebra in Generated Subalgebra: $\text{adjoin}_R(s) \leq \text{Algebra.adjoin}_R(s).\text{toNonUnitalSubalgebra}$
Informal description
For any subset $s$ of an $R$-algebra $A$, the non-unital subalgebra generated by $s$ is contained in the non-unital subalgebra obtained by forgetting the unit in the subalgebra generated by $s$. In other words, $\text{adjoin}_R(s) \leq (\text{Algebra.adjoin}_R(s)).\text{toNonUnitalSubalgebra}$.
Algebra.adjoin_nonUnitalSubalgebra theorem
(s : Set A) : adjoin R (NonUnitalAlgebra.adjoin R s : Set A) = adjoin R s
Full source
lemma Algebra.adjoin_nonUnitalSubalgebra (s : Set A) :
    adjoin R (NonUnitalAlgebra.adjoin R s : Set A) = adjoin R s :=
  le_antisymm
    (adjoin_le <| NonUnitalAlgebra.adjoin_le_algebra_adjoin R s)
    (adjoin_le <| (NonUnitalAlgebra.subset_adjoin R).trans subset_adjoin)
Equality of Subalgebra Generation via Non-unital Subalgebra: $\text{adjoin}_R(\text{NonUnitalAlgebra.adjoin}_R(s)) = \text{adjoin}_R(s)$
Informal description
For any subset $s$ of an $R$-algebra $A$, the subalgebra generated by the non-unital subalgebra generated by $s$ is equal to the subalgebra generated by $s$ itself, i.e., \[ \text{adjoin}_R(\text{NonUnitalAlgebra.adjoin}_R(s)) = \text{adjoin}_R(s). \]
Subalgebra.comap_map_eq theorem
(f : A →ₐ[R] B) (S : Subalgebra R A) : (S.map f).comap f = S ⊔ Algebra.adjoin R (f ⁻¹' {0})
Full source
theorem comap_map_eq (f : A →ₐ[R] B) (S : Subalgebra R A) :
    (S.map f).comap f = S ⊔ Algebra.adjoin R (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 [← Algebra.adjoin_eq S, ← Algebra.adjoin_union, ← add_sub_cancel y x]
    exact Subalgebra.add_mem _
      (Algebra.subset_adjoin <| Or.inl hy) (Algebra.subset_adjoin <| Or.inr hxy)
  · rw [← map_le, Algebra.map_sup, f.map_adjoin]
    apply le_of_eq
    rw [sup_eq_left, Algebra.adjoin_le_iff]
    exact (Set.image_preimage_subset f {0}).trans (Set.singleton_subset_iff.2 (S.map f).zero_mem)
Preimage of Image Subalgebra Equals Join with Kernel Subalgebra
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $A$, the preimage of the image of $S$ under $f$ is equal to the join of $S$ and the subalgebra generated by the kernel of $f$, i.e., \[ f^{-1}(f(S)) = S \sqcup \text{adjoin}_R(f^{-1}(\{0\})). \]
Subalgebra.comap_map_eq_self theorem
{f : A →ₐ[R] B} {S : Subalgebra R A} (h : f ⁻¹' {0} ⊆ S) : (S.map f).comap f = S
Full source
theorem comap_map_eq_self {f : A →ₐ[R] B} {S : Subalgebra R A}
    (h : f ⁻¹' {0}f ⁻¹' {0} ⊆ S) : (S.map f).comap f = S := by
  convert comap_map_eq f S
  rwa [left_eq_sup, Algebra.adjoin_le_iff]
Preimage of Image Subalgebra Equals Original Subalgebra When Kernel is Contained
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $A$ such that the kernel of $f$ is contained in $S$, the preimage of the image of $S$ under $f$ is equal to $S$ itself, i.e., \[ f^{-1}(f(S)) = S. \]