doc-next-gen

Mathlib.Algebra.Algebra.Subalgebra.Basic

Module docstring

{"# Subalgebras over Commutative Semiring

In this file we define Subalgebras and the usual operations on them (map, comap).

The Algebra.adjoin operation and complete lattice structure can be found in Mathlib.Algebra.Algebra.Subalgebra.Lattice. ","Subalgebras inherit structure from their Subsemiring / Semiring coercions. ","Subalgebras inherit structure from their Submodule coercions. ","## Actions by Subalgebras

These are just copies of the definitions about Subsemiring starting from Subring.mulAction. "}

Subalgebra structure
(R : Type u) (A : Type v) [CommSemiring R] [Semiring A] [Algebra R A] : Type v extends Subsemiring A
Full source
/-- A subalgebra is a sub(semi)ring that includes the range of `algebraMap`. -/
structure Subalgebra (R : Type u) (A : Type v) [CommSemiring R] [Semiring A] [Algebra R A] : Type v
    extends Subsemiring A where
  /-- The image of `algebraMap` is contained in the underlying set of the subalgebra -/
  algebraMap_mem' : ∀ r, algebraMapalgebraMap R A r ∈ carrier
  zero_mem' := (algebraMap R A).map_zero ▸ algebraMap_mem' 0
  one_mem' := (algebraMap R A).map_one ▸ algebraMap_mem' 1
Subalgebra of an $R$-algebra
Informal description
A subalgebra over a commutative semiring $R$ is a subsemiring of an $R$-algebra $A$ that is closed under the action of $R$ (i.e., it contains the image of the algebra map $R \to A$). More precisely, given a commutative semiring $R$ and a semiring $A$ equipped with an $R$-algebra structure, a subalgebra is a subset $S \subseteq A$ that: 1. Forms a subsemiring of $A$ (i.e., is closed under addition, multiplication, and contains $0$ and $1$). 2. Contains the image of the algebra map $R \to A$ (i.e., is closed under scalar multiplication by elements of $R$).
Subalgebra.instSetLike instance
: SetLike (Subalgebra R A) A
Full source
instance : SetLike (Subalgebra R A) A where
  coe s := s.carrier
  coe_injective' p q h := by cases p; cases q; congr; exact SetLike.coe_injective' h
Set-like Structure on Subalgebras
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the type of subalgebras of $A$ has a set-like structure, where each subalgebra can be viewed as a subset of $A$.
Subalgebra.ofClass definition
{S R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] [SetLike S A] [SubsemiringClass S A] [SMulMemClass S R A] (s : S) : Subalgebra R A
Full source
/-- The actual `Subalgebra` obtained from an element of a type satisfying `SubsemiringClass` and
`SMulMemClass`. -/
@[simps]
def ofClass {S R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A]
    [SetLike S A] [SubsemiringClass S A] [SMulMemClass S R A] (s : S) :
    Subalgebra R A where
  carrier := s
  add_mem' := add_mem
  zero_mem' := zero_mem _
  mul_mem' := mul_mem
  one_mem' := one_mem _
  algebraMap_mem' r :=
    Algebra.algebraMap_eq_smul_one (A := A) r ▸ SMulMemClass.smul_mem r (one_mem s)
Subalgebra construction from a set-like class
Informal description
Given a commutative semiring $R$, a semiring $A$ with an $R$-algebra structure, and a type $S$ that is a set-like structure on $A$ satisfying both `SubsemiringClass` (closed under addition, multiplication, and contains 0 and 1) and `SMulMemClass` (closed under scalar multiplication by $R$), the function `Subalgebra.ofClass` constructs a subalgebra of $A$ over $R$ from an element $s$ of $S$. Specifically, the subalgebra has: - Carrier set $s$ - Closure under addition (`add_mem'`) - Contains zero (`zero_mem'`) - Closure under multiplication (`mul_mem'`) - Contains one (`one_mem'`) - Contains the image of the algebra map $R \to A$ (`algebraMap_mem'`), which follows from the scalar multiplication closure property.
Subalgebra.instCanLiftSetCoeAndForallForallForallMemForallHAddForallForallForallForallHMulForallCoeRingHomAlgebraMap instance
: CanLift (Set A) (Subalgebra R A) (↑) (fun s ↦ (∀ {x y}, x ∈ s → y ∈ s → x + y ∈ s) ∧ (∀ {x y}, x ∈ s → y ∈ s → x * y ∈ s) ∧ ∀ (r : R), algebraMap R A r ∈ s)
Full source
instance (priority := 100) : CanLift (Set A) (Subalgebra R A) (↑)
    (fun s ↦ (∀ {x y}, x ∈ s → y ∈ s → x + y ∈ s) ∧
      (∀ {x y}, x ∈ s → y ∈ s → x * y ∈ s) ∧ ∀ (r : R), algebraMap R A r ∈ s) where
  prf s h :=
    ⟨ { carrier := s
        zero_mem' := by simpa using h.2.2 0
        add_mem' := h.1
        one_mem' := by simpa using h.2.2 1
        mul_mem' := h.2.1
        algebraMap_mem' := h.2.2 },
      rfl ⟩
Lifting Condition for Subalgebras of an $R$-Algebra
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, a subset $s \subseteq A$ can be lifted to a subalgebra of $A$ if and only if $s$ is closed under addition, multiplication, and contains the image of the algebra map $R \to A$.
Subalgebra.instSubsemiringClass instance
: SubsemiringClass (Subalgebra R A) A
Full source
instance : SubsemiringClass (Subalgebra R A) A where
  add_mem {s} := add_mem (s := s.toSubsemiring)
  mul_mem {s} := mul_mem (s := s.toSubsemiring)
  one_mem {s} := one_mem s.toSubsemiring
  zero_mem {s} := zero_mem s.toSubsemiring
Subalgebras as Subsemiring Classes
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the type of subalgebras of $A$ forms a `SubsemiringClass`. This means that every subalgebra $S$ of $A$ is both a multiplicative submonoid and an additive submonoid, containing the multiplicative identity (1) and the additive identity (0), and is closed under both addition and multiplication.
Subalgebra.mem_toSubsemiring theorem
{S : Subalgebra R A} {x} : x ∈ S.toSubsemiring ↔ x ∈ S
Full source
@[simp]
theorem mem_toSubsemiring {S : Subalgebra R A} {x} : x ∈ S.toSubsemiringx ∈ S.toSubsemiring ↔ x ∈ S :=
  Iff.rfl
Membership in Subalgebra and its Underlying Subsemiring Coincide
Informal description
For any subalgebra $S$ of an $R$-algebra $A$ and any element $x \in A$, $x$ belongs to the underlying subsemiring of $S$ if and only if $x$ belongs to $S$.
Subalgebra.mem_carrier theorem
{s : Subalgebra R A} {x : A} : x ∈ s.carrier ↔ x ∈ s
Full source
theorem mem_carrier {s : Subalgebra R A} {x : A} : x ∈ s.carrierx ∈ s.carrier ↔ x ∈ s :=
  Iff.rfl
Characterization of Membership in Subalgebra via Carrier Set
Informal description
For any subalgebra $s$ of an $R$-algebra $A$ and any element $x \in A$, the element $x$ belongs to the underlying set of $s$ (denoted $s.\mathrm{carrier}$) if and only if $x$ belongs to $s$.
Subalgebra.ext theorem
{S T : Subalgebra R A} (h : ∀ x : A, x ∈ S ↔ x ∈ T) : S = T
Full source
@[ext]
theorem ext {S T : Subalgebra R A} (h : ∀ x : A, x ∈ Sx ∈ S ↔ x ∈ T) : S = T :=
  SetLike.ext h
Extensionality of Subalgebras: $S = T \iff \forall x \in A, x \in S \leftrightarrow x \in T$
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any two subalgebras $S$ and $T$ of $A$, if for every element $x \in A$ we have $x \in S$ if and only if $x \in T$, then $S = T$.
Subalgebra.coe_toSubsemiring theorem
(S : Subalgebra R A) : (↑S.toSubsemiring : Set A) = S
Full source
@[simp]
theorem coe_toSubsemiring (S : Subalgebra R A) : (↑S.toSubsemiring : Set A) = S :=
  rfl
Subalgebra and Subsemiring Carrier Set Equality
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the underlying set of $S$ as a subsemiring is equal to $S$ itself when viewed as a subset of $A$.
Subalgebra.toSubsemiring_injective theorem
: Function.Injective (toSubsemiring : Subalgebra R A → Subsemiring A)
Full source
theorem toSubsemiring_injective :
    Function.Injective (toSubsemiring : Subalgebra R A → Subsemiring A) := fun S T h =>
  ext fun x => by rw [← mem_toSubsemiring, ← mem_toSubsemiring, h]
Injectivity of Subalgebra to Subsemiring Map
Informal description
The function that maps a subalgebra $S$ of an $R$-algebra $A$ to its underlying subsemiring is injective. That is, for any two subalgebras $S$ and $T$ of $A$, if their underlying subsemirings are equal, then $S = T$.
Subalgebra.copy definition
(S : Subalgebra R A) (s : Set A) (hs : s = ↑S) : Subalgebra R A
Full source
/-- Copy of a subalgebra with a new `carrier` equal to the old one. Useful to fix definitional
equalities. -/
@[simps coe toSubsemiring]
protected def copy (S : Subalgebra R A) (s : Set A) (hs : s = ↑S) : Subalgebra R A :=
  { S.toSubsemiring.copy s hs with
    carrier := s
    algebraMap_mem' := hs.symm ▸ S.algebraMap_mem' }
Copy of a subalgebra with specified carrier set
Informal description
Given a subalgebra $S$ of an $R$-algebra $A$ and a subset $s$ of $A$ equal to the underlying set of $S$, the function `Subalgebra.copy` constructs a new subalgebra with $s$ as its underlying set. This new subalgebra has the same algebraic structure as $S$, including the same scalar multiplication by elements of $R$.
Subalgebra.copy_eq theorem
(S : Subalgebra R A) (s : Set A) (hs : s = ↑S) : S.copy s hs = S
Full source
theorem copy_eq (S : Subalgebra R A) (s : Set A) (hs : s = ↑S) : S.copy s hs = S :=
  SetLike.coe_injective hs
Equality of Subalgebra Copy with Original
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebra $S$ of $A$ and any subset $s$ of $A$ equal to the underlying set of $S$, the copy of $S$ with carrier set $s$ is equal to $S$ itself.
Subalgebra.instSMulMemClass instance
: SMulMemClass (Subalgebra R A) R A
Full source
instance instSMulMemClass : SMulMemClass (Subalgebra R A) R A where
  smul_mem {S} r x hx := (Algebra.smul_def r x).symmmul_mem (S.algebraMap_mem' r) hx
Subalgebras are Closed under Scalar Multiplication
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the subalgebras of $A$ are closed under scalar multiplication by elements of $R$. That is, if $S$ is a subalgebra of $A$ and $r \in R$, then for any $a \in S$, the scalar multiple $r \cdot a$ is also in $S$.
algebraMap_mem theorem
{S R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] [SetLike S A] [OneMemClass S A] [SMulMemClass S R A] (s : S) (r : R) : algebraMap R A r ∈ s
Full source
@[aesop safe apply (rule_sets := [SetLike])]
theorem _root_.algebraMap_mem {S R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A]
    [SetLike S A] [OneMemClass S A] [SMulMemClass S R A] (s : S) (r : R) :
    algebraMapalgebraMap R A r ∈ s :=
  Algebra.algebraMap_eq_smul_one (A := A) r ▸ SMulMemClass.smul_mem r (one_mem s)
Algebra Map Preserves Membership in Subalgebra
Informal description
Let $R$ be a commutative semiring, $A$ a semiring equipped with an $R$-algebra structure, and $S$ a subset of $A$ that is closed under the algebra operations (i.e., contains $1$ and is closed under scalar multiplication by $R$). Then for any element $r \in R$, the image of $r$ under the algebra map $\text{algebraMap}_R^A : R \to A$ lies in $S$.
Subalgebra.algebraMap_mem theorem
(r : R) : algebraMap R A r ∈ S
Full source
protected theorem algebraMap_mem (r : R) : algebraMapalgebraMap R A r ∈ S :=
  algebraMap_mem S r
Subalgebra Contains Image of Algebra Map
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, if $S$ is a subalgebra of $A$, then the image of any element $r \in R$ under the algebra map $\text{algebraMap}_R^A : R \to A$ belongs to $S$.
Subalgebra.rangeS_le theorem
: (algebraMap R A).rangeS ≤ S.toSubsemiring
Full source
theorem rangeS_le : (algebraMap R A).rangeS ≤ S.toSubsemiring := fun _x ⟨r, hr⟩ =>
  hr ▸ S.algebraMap_mem r
Range of Algebra Map is Contained in Subalgebra's Subsemiring
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the range of the algebra map $\text{algebraMap}_R^A : R \to A$ is contained in the underlying subsemiring of $S$. In other words, the image of $R$ under the algebra map is a subsemiring of $S$.
Subalgebra.range_subset theorem
: Set.range (algebraMap R A) ⊆ S
Full source
theorem range_subset : Set.rangeSet.range (algebraMap R A) ⊆ S := fun _x ⟨r, hr⟩ => hr ▸ S.algebraMap_mem r
Range of Algebra Map is Subset of Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the range of the algebra map $\text{algebraMap}_R^A : R \to A$ is contained in $S$.
Subalgebra.range_le theorem
: Set.range (algebraMap R A) ≤ S
Full source
theorem range_le : Set.range (algebraMap R A) ≤ S :=
  S.range_subset
Inclusion of Algebra Map Range in Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the range of the algebra map $\text{algebraMap}_R^A : R \to A$ is contained in $S$. In other words, for every $r \in R$, the image $\text{algebraMap}_R^A(r)$ belongs to $S$.
Subalgebra.smul_mem theorem
{x : A} (hx : x ∈ S) (r : R) : r • x ∈ S
Full source
theorem smul_mem {x : A} (hx : x ∈ S) (r : R) : r • x ∈ S :=
  SMulMemClass.smul_mem r hx
Closure of Subalgebra under Scalar Multiplication
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebra $S$ of $A$, if $x \in S$ and $r \in R$, then the scalar multiple $r \cdot x$ belongs to $S$.
Subalgebra.one_mem theorem
: (1 : A) ∈ S
Full source
protected theorem one_mem : (1 : A) ∈ S :=
  one_mem S
Subalgebra Contains One
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the multiplicative identity element $1$ of $A$ is contained in $S$.
Subalgebra.mul_mem theorem
{x y : A} (hx : x ∈ S) (hy : y ∈ S) : x * y ∈ S
Full source
protected theorem mul_mem {x y : A} (hx : x ∈ S) (hy : y ∈ S) : x * y ∈ S :=
  mul_mem hx hy
Closure of Subalgebra under Multiplication
Informal description
Let $A$ be an $R$-algebra where $R$ is a commutative semiring, and let $S$ be a subalgebra of $A$. For any elements $x, y \in S$, their product $x * y$ also belongs to $S$.
Subalgebra.pow_mem theorem
{x : A} (hx : x ∈ S) (n : ℕ) : x ^ n ∈ S
Full source
protected theorem pow_mem {x : A} (hx : x ∈ S) (n : ) : x ^ n ∈ S :=
  pow_mem hx n
Closure under Powers in Subalgebras
Informal description
Let $A$ be an $R$-algebra over a commutative semiring $R$, and let $S$ be a subalgebra of $A$. For any element $x \in S$ and any natural number $n$, the power $x^n$ belongs to $S$.
Subalgebra.zero_mem theorem
: (0 : A) ∈ S
Full source
protected theorem zero_mem : (0 : A) ∈ S :=
  zero_mem S
Zero Element Belongs to Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the zero element $0 \in A$ is contained in $S$.
Subalgebra.add_mem theorem
{x y : A} (hx : x ∈ S) (hy : y ∈ S) : x + y ∈ S
Full source
protected theorem add_mem {x y : A} (hx : x ∈ S) (hy : y ∈ S) : x + y ∈ S :=
  add_mem hx hy
Closure of Subalgebra under Addition
Informal description
For any elements $x$ and $y$ in an $R$-algebra $A$, if $x$ and $y$ belong to a subalgebra $S$ of $A$, then their sum $x + y$ also belongs to $S$.
Subalgebra.nsmul_mem theorem
{x : A} (hx : x ∈ S) (n : ℕ) : n • x ∈ S
Full source
protected theorem nsmul_mem {x : A} (hx : x ∈ S) (n : ) : n • x ∈ S :=
  nsmul_mem hx n
Closure of Subalgebra under Natural Number Scalar Multiplication
Informal description
Let $S$ be a subalgebra of an $R$-algebra $A$. For any element $x \in S$ and any natural number $n$, the scalar multiple $n \cdot x$ is also in $S$.
Subalgebra.natCast_mem theorem
(n : ℕ) : (n : A) ∈ S
Full source
protected theorem natCast_mem (n : ) : (n : A) ∈ S :=
  natCast_mem S n
Natural numbers are contained in any subalgebra via canonical homomorphism
Informal description
For any natural number $n$, the image of $n$ under the canonical homomorphism $\mathbb{N} \to A$ is contained in the subalgebra $S$ of the $R$-algebra $A$.
Subalgebra.list_prod_mem theorem
{L : List A} (h : ∀ x ∈ L, x ∈ S) : L.prod ∈ S
Full source
protected theorem list_prod_mem {L : List A} (h : ∀ x ∈ L, x ∈ S) : L.prod ∈ S :=
  list_prod_mem h
Product of Subalgebra Elements in a List Belongs to Subalgebra
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebra $S$ of $A$ and any list $L$ of elements in $A$, if every element $x \in L$ belongs to $S$, then the product of all elements in $L$ (computed in $A$) also belongs to $S$.
Subalgebra.list_sum_mem theorem
{L : List A} (h : ∀ x ∈ L, x ∈ S) : L.sum ∈ S
Full source
protected theorem list_sum_mem {L : List A} (h : ∀ x ∈ L, x ∈ S) : L.sum ∈ S :=
  list_sum_mem h
Sum of List Elements in Subalgebra
Informal description
Let $S$ be a subalgebra of an $R$-algebra $A$. For any list $L$ of elements in $A$, if every element of $L$ belongs to $S$, then the sum of all elements in $L$ also belongs to $S$.
Subalgebra.multiset_sum_mem theorem
{m : Multiset A} (h : ∀ x ∈ m, x ∈ S) : m.sum ∈ S
Full source
protected theorem multiset_sum_mem {m : Multiset A} (h : ∀ x ∈ m, x ∈ S) : m.sum ∈ S :=
  multiset_sum_mem m h
Sum of Multiset Elements in Subalgebra Belongs to Subalgebra
Informal description
Let $A$ be an $R$-algebra over a commutative semiring $R$, and let $S$ be a subalgebra of $A$. For any multiset $m$ of elements of $A$, if every element $x \in m$ belongs to $S$, then the sum of all elements in $m$ also belongs to $S$.
Subalgebra.sum_mem theorem
{ι : Type w} {t : Finset ι} {f : ι → A} (h : ∀ x ∈ t, f x ∈ S) : (∑ x ∈ t, f x) ∈ S
Full source
protected theorem sum_mem {ι : Type w} {t : Finset ι} {f : ι → A} (h : ∀ x ∈ t, f x ∈ S) :
    (∑ x ∈ t, f x) ∈ S :=
  sum_mem h
Sum of Elements in a Subalgebra Belongs to the Subalgebra
Informal description
Let $R$ be a commutative semiring and $A$ be an $R$-algebra. For any subalgebra $S$ of $A$, finite set $t$ indexed by type $\iota$, and function $f : \iota \to A$, if $f(x) \in S$ for all $x \in t$, then the sum $\sum_{x \in t} f(x)$ belongs to $S$.
Subalgebra.multiset_prod_mem theorem
{R : Type u} {A : Type v} [CommSemiring R] [CommSemiring A] [Algebra R A] (S : Subalgebra R A) {m : Multiset A} (h : ∀ x ∈ m, x ∈ S) : m.prod ∈ S
Full source
protected theorem multiset_prod_mem {R : Type u} {A : Type v} [CommSemiring R] [CommSemiring A]
    [Algebra R A] (S : Subalgebra R A) {m : Multiset A} (h : ∀ x ∈ m, x ∈ S) : m.prod ∈ S :=
  multiset_prod_mem m h
Product of Multiset in Subalgebra is in Subalgebra
Informal description
Let $R$ be a commutative semiring and $A$ a commutative $R$-algebra. For any subalgebra $S$ of $A$ and any multiset $m$ of elements in $A$, if every element $x \in m$ belongs to $S$, then the product of all elements in $m$ (computed in $A$) also belongs to $S$.
Subalgebra.prod_mem theorem
{R : Type u} {A : Type v} [CommSemiring R] [CommSemiring A] [Algebra R A] (S : Subalgebra R A) {ι : Type w} {t : Finset ι} {f : ι → A} (h : ∀ x ∈ t, f x ∈ S) : (∏ x ∈ t, f x) ∈ S
Full source
protected theorem prod_mem {R : Type u} {A : Type v} [CommSemiring R] [CommSemiring A] [Algebra R A]
    (S : Subalgebra R A) {ι : Type w} {t : Finset ι} {f : ι → A} (h : ∀ x ∈ t, f x ∈ S) :
    (∏ x ∈ t, f x) ∈ S :=
  prod_mem h
Product of Elements in Subalgebra Belongs to Subalgebra
Informal description
Let $R$ be a commutative semiring and $A$ a commutative $R$-algebra. For any subalgebra $S$ of $A$, finite set $t$ indexed by type $\iota$, and function $f : \iota \to A$, if $f(x) \in S$ for all $x \in t$, then the product $\prod_{x \in t} f(x)$ belongs to $S$.
Subalgebra.toNonUnitalSubalgebra definition
(S : Subalgebra R A) : NonUnitalSubalgebra R A
Full source
/-- Turn a `Subalgebra` into a `NonUnitalSubalgebra` by forgetting that it contains `1`. -/
def toNonUnitalSubalgebra (S : Subalgebra R A) : NonUnitalSubalgebra R A where
  __ := S
  smul_mem' r _x hx := S.smul_mem hx r
Forgetting the unit in a subalgebra to obtain a non-unital subalgebra
Informal description
Given a subalgebra $S$ of an $R$-algebra $A$ (where $R$ is a commutative semiring), the function returns the underlying non-unital subalgebra obtained by forgetting that $S$ contains the multiplicative identity $1$. The resulting non-unital subalgebra maintains all the original structure except for the requirement of containing $1$: 1. It remains closed under addition and multiplication (inherited from being a subsemiring) 2. It remains closed under scalar multiplication by elements of $R$ (inherited from being a submodule)
Subalgebra.one_mem_toNonUnitalSubalgebra theorem
(S : Subalgebra R A) : (1 : A) ∈ S.toNonUnitalSubalgebra
Full source
lemma one_mem_toNonUnitalSubalgebra (S : Subalgebra R A) : (1 : A) ∈ S.toNonUnitalSubalgebra :=
  S.one_mem
Inclusion of One in Non-unital Subalgebra Derived from Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the multiplicative identity element $1$ of $A$ is contained in the underlying non-unital subalgebra obtained from $S$.
Subalgebra.instSubringClass instance
{R A : Type*} [CommRing R] [Ring A] [Algebra R A] : SubringClass (Subalgebra R A) A
Full source
instance {R A : Type*} [CommRing R] [Ring A] [Algebra R A] : SubringClass (Subalgebra R A) A :=
  { Subalgebra.instSubsemiringClass with
    neg_mem := fun {S x} hx => neg_one_smul R x ▸ S.smul_mem hx _ }
Subalgebras as Subring Classes
Informal description
For any commutative ring $R$ and ring $A$ equipped with an $R$-algebra structure, the type of subalgebras of $A$ forms a `SubringClass`. This means that every subalgebra $S$ of $A$ is closed under addition, multiplication, additive inverses, and contains the additive and multiplicative identities.
Subalgebra.neg_mem theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) {x : A} (hx : x ∈ S) : -x ∈ S
Full source
protected theorem neg_mem {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    (S : Subalgebra R A) {x : A} (hx : x ∈ S) : -x ∈ S :=
  neg_mem hx
Closure of Subalgebras under Additive Inverses
Informal description
Let $R$ be a commutative ring and $A$ be a ring equipped with an $R$-algebra structure. For any subalgebra $S$ of $A$ and any element $x \in S$, the additive inverse $-x$ is also in $S$.
Subalgebra.sub_mem theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) {x y : A} (hx : x ∈ S) (hy : y ∈ S) : x - y ∈ S
Full source
protected theorem sub_mem {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    (S : Subalgebra R A) {x y : A} (hx : x ∈ S) (hy : y ∈ S) : x - y ∈ S :=
  sub_mem hx hy
Subalgebra is Closed under Subtraction
Informal description
Let $R$ be a commutative ring and $A$ be a ring equipped with an $R$-algebra structure. For any subalgebra $S$ of $A$ and any elements $x, y \in A$ such that $x \in S$ and $y \in S$, the difference $x - y$ is also in $S$.
Subalgebra.zsmul_mem theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) {x : A} (hx : x ∈ S) (n : ℤ) : n • x ∈ S
Full source
protected theorem zsmul_mem {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    (S : Subalgebra R A) {x : A} (hx : x ∈ S) (n : ) : n • x ∈ S :=
  zsmul_mem hx n
Closure of Subalgebras under Integer Scalar Multiplication
Informal description
Let $R$ be a commutative ring and $A$ be a ring equipped with an $R$-algebra structure. For any subalgebra $S$ of $A$, if an element $x \in A$ belongs to $S$, then for any integer $n \in \mathbb{Z}$, the scalar multiple $n \cdot x$ also belongs to $S$.
Subalgebra.intCast_mem theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) (n : ℤ) : (n : A) ∈ S
Full source
protected theorem intCast_mem {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    (S : Subalgebra R A) (n : ) : (n : A) ∈ S :=
  intCast_mem S n
Integer elements belong to subalgebras
Informal description
Let $R$ be a commutative ring and $A$ be a ring equipped with an $R$-algebra structure. For any subalgebra $S$ of $A$ and any integer $n$, the image of $n$ under the canonical ring homomorphism from $\mathbb{Z}$ to $A$ is an element of $S$.
Subalgebra.toAddSubmonoid definition
{R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A] (S : Subalgebra R A) : AddSubmonoid A
Full source
/-- The projection from a subalgebra of `A` to an additive submonoid of `A`. -/
@[simps coe]
def toAddSubmonoid {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]
    (S : Subalgebra R A) : AddSubmonoid A :=
  S.toSubsemiring.toAddSubmonoid
Underlying additive submonoid of a subalgebra
Informal description
Given a commutative semiring $R$ and a semiring $A$ equipped with an $R$-algebra structure, the function maps a subalgebra $S$ of $A$ to its underlying additive submonoid, consisting of all elements of $S$ viewed as an additive submonoid of $A$.
Subalgebra.toSubring definition
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) : Subring A
Full source
/-- A subalgebra over a ring is also a `Subring`. -/
@[simps toSubsemiring]
def toSubring {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) :
    Subring A :=
  { S.toSubsemiring with neg_mem' := S.neg_mem }
Subalgebra viewed as a subring
Informal description
Given a commutative ring $R$ and a ring $A$ equipped with an $R$-algebra structure, the function maps a subalgebra $S$ of $A$ to its underlying subring, which is the subset of $A$ consisting of all elements of $S$ viewed as a subring of $A$. This subring inherits the additive inverse property from the subalgebra structure.
Subalgebra.mem_toSubring theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] {S : Subalgebra R A} {x} : x ∈ S.toSubring ↔ x ∈ S
Full source
@[simp]
theorem mem_toSubring {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    {S : Subalgebra R A} {x} : x ∈ S.toSubringx ∈ S.toSubring ↔ x ∈ S :=
  Iff.rfl
Membership in Subalgebra and its Underlying Subring Coincide
Informal description
Let $R$ be a commutative ring and $A$ be a ring equipped with an $R$-algebra structure. For any subalgebra $S$ of $A$ and any element $x \in A$, we have $x \in S$ if and only if $x$ belongs to the underlying subring of $S$.
Subalgebra.coe_toSubring theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) : (↑S.toSubring : Set A) = S
Full source
@[simp]
theorem coe_toSubring {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    (S : Subalgebra R A) : (↑S.toSubring : Set A) = S :=
  rfl
Subalgebra and Subring Coincidence for Underlying Sets
Informal description
For any commutative ring $R$ and ring $A$ equipped with an $R$-algebra structure, if $S$ is a subalgebra of $A$, then the underlying set of the subring associated to $S$ is equal to $S$ itself as a subset of $A$.
Subalgebra.toSubring_injective theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] : Function.Injective (toSubring : Subalgebra R A → Subring A)
Full source
theorem toSubring_injective {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] :
    Function.Injective (toSubring : Subalgebra R A → Subring A) := fun S T h =>
  ext fun x => by rw [← mem_toSubring, ← mem_toSubring, h]
Injectivity of Subalgebra-to-Subring Map
Informal description
Let $R$ be a commutative ring and $A$ a ring equipped with an $R$-algebra structure. The map that sends a subalgebra $S$ of $A$ to its underlying subring is injective. In other words, if two subalgebras $S$ and $T$ of $A$ have the same underlying subring, then $S = T$.
Subalgebra.toSubring_inj theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] {S U : Subalgebra R A} : S.toSubring = U.toSubring ↔ S = U
Full source
theorem toSubring_inj {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    {S U : Subalgebra R A} : S.toSubring = U.toSubring ↔ S = U :=
  toSubring_injective.eq_iff
Subalgebra-to-Subring Equality Criterion
Informal description
Let $R$ be a commutative ring and $A$ a ring equipped with an $R$-algebra structure. For any two subalgebras $S$ and $U$ of $A$, the associated subrings $S.toSubring$ and $U.toSubring$ are equal if and only if $S = U$.
Subalgebra.instInhabitedSubtypeMem instance
: Inhabited S
Full source
instance : Inhabited S :=
  ⟨(0 : S.toSubsemiring)⟩
Subalgebras are Inhabited
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the subalgebra $S$ is inhabited (i.e., it contains at least one element).
Subalgebra.toSemiring instance
{R A} [CommSemiring R] [Semiring A] [Algebra R A] (S : Subalgebra R A) : Semiring S
Full source
instance toSemiring {R A} [CommSemiring R] [Semiring A] [Algebra R A] (S : Subalgebra R A) :
    Semiring S :=
  S.toSubsemiring.toSemiring
Subalgebra Inherits Semiring Structure
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, every subalgebra $S$ of $A$ inherits a semiring structure from $A$.
Subalgebra.toCommSemiring instance
{R A} [CommSemiring R] [CommSemiring A] [Algebra R A] (S : Subalgebra R A) : CommSemiring S
Full source
instance toCommSemiring {R A} [CommSemiring R] [CommSemiring A] [Algebra R A] (S : Subalgebra R A) :
    CommSemiring S :=
  S.toSubsemiring.toCommSemiring
Subalgebra Inherits Commutative Semiring Structure
Informal description
For any commutative semiring $R$ and commutative semiring $A$ equipped with an $R$-algebra structure, every subalgebra $S$ of $A$ inherits a commutative semiring structure from $A$.
Subalgebra.toRing instance
{R A} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) : Ring S
Full source
instance toRing {R A} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) : Ring S :=
  S.toSubring.toRing
Subalgebras Inherit Ring Structure
Informal description
For any commutative ring $R$ and ring $A$ equipped with an $R$-algebra structure, every subalgebra $S$ of $A$ inherits a ring structure from $A$.
Subalgebra.toCommRing instance
{R A} [CommRing R] [CommRing A] [Algebra R A] (S : Subalgebra R A) : CommRing S
Full source
instance toCommRing {R A} [CommRing R] [CommRing A] [Algebra R A] (S : Subalgebra R A) :
    CommRing S :=
  S.toSubring.toCommRing
Subalgebra Inherits Commutative Ring Structure
Informal description
For any commutative ring $R$ and commutative ring $A$ equipped with an $R$-algebra structure, every subalgebra $S$ of $A$ inherits a commutative ring structure from $A$.
Subalgebra.toSubmodule definition
: Subalgebra R A ↪o Submodule R A
Full source
/-- The forgetful map from `Subalgebra` to `Submodule` as an `OrderEmbedding` -/
def toSubmodule : SubalgebraSubalgebra R A ↪o Submodule R A where
  toEmbedding :=
    { toFun := fun S =>
        { S with
          carrier := S
          smul_mem' := fun c {x} hx ↦
            (Algebra.smul_def c x).symmmul_mem (S.range_le ⟨c, rfl⟩) hx }
      inj' := fun _ _ h ↦ ext fun x ↦ SetLike.ext_iff.mp h x }
  map_rel_iff' := SetLike.coe_subset_coe.symm.trans SetLike.coe_subset_coe
Subalgebra to Submodule Order Embedding
Informal description
The order embedding that maps a subalgebra $S$ of an $R$-algebra $A$ to its underlying submodule, where the submodule structure is inherited from the subalgebra structure. Specifically, for any $S \in \text{Subalgebra}\,R\,A$, the embedding sends $S$ to the submodule with the same carrier set as $S$, and the scalar multiplication is defined via the algebra structure $R \to A$.
Subalgebra.mem_toSubmodule theorem
{x} : x ∈ (toSubmodule S) ↔ x ∈ S
Full source
@[simp]
theorem mem_toSubmodule {x} : x ∈ (toSubmodule S)x ∈ (toSubmodule S) ↔ x ∈ S := Iff.rfl
Membership in Subalgebra and its Underlying Submodule Coincide
Informal description
For any element $x$ of an $R$-algebra $A$, $x$ belongs to the underlying submodule of a subalgebra $S$ if and only if $x$ belongs to $S$ itself.
Subalgebra.coe_toSubmodule theorem
(S : Subalgebra R A) : (toSubmodule S : Set A) = S
Full source
@[simp]
theorem coe_toSubmodule (S : Subalgebra R A) : (toSubmodule S : Set A) = S := rfl
Subalgebra to Submodule Coercion Preserves Carrier Set
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the underlying set of the corresponding submodule (via the order embedding `toSubmodule`) is equal to $S$ itself as a set. In other words, the coercion to a submodule preserves the carrier set of the subalgebra.
Subalgebra.toSubmodule_injective theorem
: Function.Injective (toSubmodule : Subalgebra R A → Submodule R A)
Full source
theorem toSubmodule_injective : Function.Injective (toSubmodule : Subalgebra R A → Submodule R A) :=
  fun _S₁ _S₂ h => SetLike.ext (SetLike.ext_iff.mp h :)
Injectivity of Subalgebra-to-Submodule Map
Informal description
The map from subalgebras of an $R$-algebra $A$ to their underlying submodules is injective. In other words, if two subalgebras $S_1$ and $S_2$ of $A$ have the same underlying submodule structure, then $S_1 = S_2$.
Subalgebra.module' instance
[Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] : Module R' S
Full source
instance (priority := low) module' [Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] :
    Module R' S :=
  S.toSubmodule.module'
Subalgebra as Module over Scalar Semiring with Tower Property
Informal description
For any commutative semiring $R$, $R$-algebra $A$, and subalgebra $S$ of $A$, if there exists a semiring $R'$ with a scalar multiplication action on $R$ such that $A$ is a module over $R'$ and the scalar multiplications satisfy the tower property $(s \cdot r) \cdot a = s \cdot (r \cdot a)$ for all $s \in R'$, $r \in R$, $a \in A$, then $S$ inherits a module structure over $R'$.
Subalgebra.instModuleSubtypeMem instance
: Module R S
Full source
instance : Module R S :=
  S.module'
Subalgebra as Module over Base Semiring
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, every subalgebra $S$ of $A$ inherits a module structure over $R$.
Subalgebra.instIsScalarTowerSubtypeMem instance
[Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] : IsScalarTower R' R S
Full source
instance [Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] : IsScalarTower R' R S :=
  inferInstanceAs (IsScalarTower R' R (toSubmodule S))
Scalar Tower Property for Subalgebras
Informal description
For any commutative semiring $R$, $R$-algebra $A$, and subalgebra $S$ of $A$, if there exists a semiring $R'$ with a scalar multiplication action on $R$ such that $A$ is a module over $R'$ and the scalar multiplications satisfy the tower property $(s \cdot r) \cdot a = s \cdot (r \cdot a)$ for all $s \in R'$, $r \in R$, $a \in A$, then the scalar multiplications also satisfy the tower property on $S$.
Subalgebra.algebra' instance
[CommSemiring R'] [SMul R' R] [Algebra R' A] [IsScalarTower R' R A] : Algebra R' S
Full source
instance (priority := 500) algebra' [CommSemiring R'] [SMul R' R] [Algebra R' A]
    [IsScalarTower R' R A] :
    Algebra R' S where
  algebraMap := (algebraMap R' A).codRestrict S fun x => by
    rw [Algebra.algebraMap_eq_smul_one, ← smul_one_smul R x (1 : A), ←
      Algebra.algebraMap_eq_smul_one]
    exact algebraMap_mem S _
  commutes' := fun _ _ => Subtype.eq <| Algebra.commutes _ _
  smul_def' := fun _ _ => Subtype.eq <| Algebra.smul_def _ _
Subalgebra Inherits Algebra Structure with Scalar Tower Property
Informal description
For any commutative semiring $R'$ with a scalar multiplication action on $R$, and any $R$-algebra $A$ where the scalar multiplications satisfy the tower property $(s \cdot r) \cdot a = s \cdot (r \cdot a)$ for all $s \in R'$, $r \in R$, $a \in A$, every subalgebra $S$ of $A$ inherits an $R'$-algebra structure from $A$.
Subalgebra.algebra instance
: Algebra R S
Full source
instance algebra : Algebra R S := S.algebra'
Subalgebra Inherits Algebra Structure
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, every subalgebra $S$ of $A$ inherits an $R$-algebra structure from $A$.
Subalgebra.noZeroSMulDivisors_bot instance
[NoZeroSMulDivisors R A] : NoZeroSMulDivisors R S
Full source
instance noZeroSMulDivisors_bot [NoZeroSMulDivisors R A] : NoZeroSMulDivisors R S :=
  ⟨fun {c} {x : S} h =>
    have : c = 0 ∨ (x : A) = 0 := eq_zero_or_eq_zero_of_smul_eq_zero (congr_arg Subtype.val h)
    this.imp_right (@Subtype.ext_iff _ _ x 0).mpr⟩
No Zero Scalar Divisors in Bottom Subalgebra
Informal description
For any commutative semiring $R$ and $R$-algebra $A$ with no zero scalar divisors, the bottom subalgebra (i.e., the smallest subalgebra) of $A$ also has no zero scalar divisors.
Subalgebra.coe_add theorem
(x y : S) : (↑(x + y) : A) = ↑x + ↑y
Full source
protected theorem coe_add (x y : S) : (↑(x + y) : A) = ↑x + ↑y := rfl
Inclusion Preserves Addition in Subalgebra
Informal description
For any elements $x$ and $y$ in a subalgebra $S$ of an $R$-algebra $A$, the image of their sum under the canonical inclusion map into $A$ equals the sum of their images, i.e., $(x + y)_A = x_A + y_A$.
Subalgebra.coe_mul theorem
(x y : S) : (↑(x * y) : A) = ↑x * ↑y
Full source
protected theorem coe_mul (x y : S) : (↑(x * y) : A) = ↑x * ↑y := rfl
Multiplication in Subalgebra Commutes with Inclusion
Informal description
For any elements $x, y$ in a subalgebra $S$ of an $R$-algebra $A$, the image of their product under the inclusion map $S \hookrightarrow A$ equals the product of their images in $A$, i.e., $(x \cdot y)_A = x_A \cdot y_A$.
Subalgebra.coe_zero theorem
: ((0 : S) : A) = 0
Full source
protected theorem coe_zero : ((0 : S) : A) = 0 := rfl
Inclusion of Zero in Subalgebra Preserves Zero
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the image of the zero element of $S$ under the canonical inclusion map into $A$ is equal to the zero element of $A$, i.e., $0_S = 0_A$.
Subalgebra.coe_one theorem
: ((1 : S) : A) = 1
Full source
protected theorem coe_one : ((1 : S) : A) = 1 := rfl
Inclusion of Subalgebra's Identity Preserves One
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the image of the multiplicative identity $1 \in S$ under the inclusion map $S \hookrightarrow A$ is equal to the multiplicative identity $1 \in A$.
Subalgebra.coe_neg theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] {S : Subalgebra R A} (x : S) : (↑(-x) : A) = -↑x
Full source
protected theorem coe_neg {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    {S : Subalgebra R A} (x : S) : (↑(-x) : A) = -↑x := rfl
Inclusion of Additive Inverse in Subalgebra Equals Additive Inverse of Inclusion
Informal description
Let $R$ be a commutative ring and $A$ a ring equipped with an $R$-algebra structure. For any subalgebra $S$ of $A$ and any element $x \in S$, the image of the additive inverse $-x$ under the inclusion map $S \hookrightarrow A$ is equal to the additive inverse of the image of $x$, i.e., $(-x)_A = -x_A$.
Subalgebra.coe_sub theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] {S : Subalgebra R A} (x y : S) : (↑(x - y) : A) = ↑x - ↑y
Full source
protected theorem coe_sub {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
    {S : Subalgebra R A} (x y : S) : (↑(x - y) : A) = ↑x - ↑y := rfl
Subalgebra Inclusion Preserves Subtraction: $\iota(x - y) = \iota(x) - \iota(y)$
Informal description
For any commutative ring $R$, ring $A$ equipped with an $R$-algebra structure, and subalgebra $S$ of $A$, the inclusion map from $S$ to $A$ preserves subtraction. That is, for any elements $x, y \in S$, the image of $x - y$ under the inclusion equals the difference of the images of $x$ and $y$ in $A$.
Subalgebra.coe_smul theorem
[SMul R' R] [SMul R' A] [IsScalarTower R' R A] (r : R') (x : S) : (↑(r • x) : A) = r • (x : A)
Full source
@[simp, norm_cast]
theorem coe_smul [SMul R' R] [SMul R' A] [IsScalarTower R' R A] (r : R') (x : S) :
    (↑(r • x) : A) = r • (x : A) := rfl
Subalgebra Scalar Multiplication Coercion: $(r \cdot x)_S = r \cdot x_A$
Informal description
Let $R'$, $R$, and $A$ be types equipped with scalar multiplication operations such that $R'$ acts on $R$ and $A$, and $R$ acts on $A$, forming a scalar tower (i.e., $(r' \cdot r) \cdot a = r' \cdot (r \cdot a)$ for all $r' \in R'$, $r \in R$, $a \in A$). For any subalgebra $S$ of an $R$-algebra $A$, scalar $r \in R'$, and element $x \in S$, the coercion of the scalar multiple $r \cdot x$ in $S$ equals the scalar multiple $r \cdot x$ in $A$. In other words, $(r \cdot x)_S = r \cdot x_A$ where $(\cdot)_S$ denotes the scalar multiplication in $S$ and $(\cdot)_A$ denotes the scalar multiplication in $A$.
Subalgebra.coe_algebraMap theorem
[CommSemiring R'] [SMul R' R] [Algebra R' A] [IsScalarTower R' R A] (r : R') : ↑(algebraMap R' S r) = algebraMap R' A r
Full source
@[simp, norm_cast]
theorem coe_algebraMap [CommSemiring R'] [SMul R' R] [Algebra R' A] [IsScalarTower R' R A]
    (r : R') : ↑(algebraMap R' S r) = algebraMap R' A r := rfl
Compatibility of Subalgebra Inclusion with Algebra Maps: $\iota(\varphi_S(r)) = \varphi_A(r)$
Informal description
Let $R'$ be a commutative semiring with a scalar multiplication action on $R$, and let $A$ be an $R$-algebra such that the scalar multiplications satisfy the tower property $(s \cdot r) \cdot a = s \cdot (r \cdot a)$ for all $s \in R'$, $r \in R$, $a \in A$. For any subalgebra $S$ of $A$ and any element $r \in R'$, the image of the algebra map $R' \to S$ evaluated at $r$ (when viewed in $A$) equals the algebra map $R' \to A$ evaluated at $r$. In other words, the inclusion map from $S$ to $A$ commutes with the algebra maps from $R'$.
Subalgebra.coe_pow theorem
(x : S) (n : ℕ) : (↑(x ^ n) : A) = (x : A) ^ n
Full source
protected theorem coe_pow (x : S) (n : ) : (↑(x ^ n) : A) = (x : A) ^ n :=
  SubmonoidClass.coe_pow x n
Subalgebra Power Coercion: $(x^n)_S = x^n_A$
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebra $S$ of $A$, element $x \in S$, and natural number $n$, the $n$-th power of $x$ in $S$ (when viewed as an element of $A$) equals the $n$-th power of $x$ in $A$. In other words, $(x^n)_S = x^n_A$ where $(\cdot)_S$ denotes the power operation in $S$ and $(\cdot)_A$ denotes the power operation in $A$.
Subalgebra.coe_eq_zero theorem
{x : S} : (x : A) = 0 ↔ x = 0
Full source
protected theorem coe_eq_zero {x : S} : (x : A) = 0 ↔ x = 0 :=
  ZeroMemClass.coe_eq_zero
Zero Preservation in Subalgebra Inclusion
Informal description
For any element $x$ in a subalgebra $S$ of an $R$-algebra $A$, the image of $x$ in $A$ is zero if and only if $x$ is zero in $S$. In other words, the canonical inclusion map from $S$ to $A$ preserves the zero element in both directions.
Subalgebra.coe_eq_one theorem
{x : S} : (x : A) = 1 ↔ x = 1
Full source
protected theorem coe_eq_one {x : S} : (x : A) = 1 ↔ x = 1 :=
  OneMemClass.coe_eq_one
Subalgebra Inclusion Preserves Identity
Informal description
For any element $x$ in a subalgebra $S$ of an $R$-algebra $A$, the image of $x$ under the inclusion map $S \hookrightarrow A$ equals the multiplicative identity $1$ of $A$ if and only if $x$ is the multiplicative identity of $S$.
Subalgebra.val definition
: S →ₐ[R] A
Full source
/-- Embedding of a subalgebra into the algebra. -/
def val : S →ₐ[R] A :=
  { toFun := ((↑) : S → A)
    map_zero' := rfl
    map_one' := rfl
    map_add' := fun _ _ ↦ rfl
    map_mul' := fun _ _ ↦ rfl
    commutes' := fun _ ↦ rfl }
Subalgebra inclusion homomorphism
Informal description
The canonical algebra homomorphism that embeds a subalgebra \( S \) of an \( R \)-algebra \( A \) into \( A \). This map sends each element \( x \in S \) to its corresponding element in \( A \) and preserves the algebraic structure, including addition, multiplication, and scalar multiplication by elements of \( R \).
Subalgebra.coe_val theorem
: (S.val : S → A) = ((↑) : S → A)
Full source
@[simp]
theorem coe_val : (S.val : S → A) = ((↑) : S → A) := rfl
Inclusion Homomorphism Coincides with Coercion in Subalgebras
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the underlying function of the inclusion algebra homomorphism $S \hookrightarrow A$ coincides with the coercion map from $S$ to $A$.
Subalgebra.val_apply theorem
(x : S) : S.val x = (x : A)
Full source
theorem val_apply (x : S) : S.val x = (x : A) := rfl
Subalgebra inclusion preserves elements
Informal description
For any element $x$ in a subalgebra $S$ of an $R$-algebra $A$, the image of $x$ under the canonical inclusion homomorphism $S \to A$ equals the underlying element $x$ viewed as an element of $A$.
Subalgebra.toSubsemiring_subtype theorem
: S.toSubsemiring.subtype = (S.val : S →+* A)
Full source
@[simp]
theorem toSubsemiring_subtype : S.toSubsemiring.subtype = (S.val : S →+* A) := rfl
Equality of Subsemiring Inclusion and Subalgebra Embedding
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the inclusion homomorphism from the underlying subsemiring of $S$ to $A$ is equal to the algebra homomorphism embedding $S$ into $A$.
Subalgebra.toSubring_subtype theorem
{R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) : S.toSubring.subtype = (S.val : S →+* A)
Full source
@[simp]
theorem toSubring_subtype {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) :
    S.toSubring.subtype = (S.val : S →+* A) := rfl
Agreement of Subalgebra and Subring Inclusion Homomorphisms
Informal description
Let $R$ be a commutative ring and $A$ be a ring equipped with an $R$-algebra structure. For any subalgebra $S$ of $A$, the inclusion homomorphism of the underlying subring of $S$ coincides with the canonical algebra homomorphism embedding $S$ into $A$.
Subalgebra.toSubmoduleEquiv definition
(S : Subalgebra R A) : toSubmodule S ≃ₗ[R] S
Full source
/-- Linear equivalence between `S : Submodule R A` and `S`. Though these types are equal,
we define it as a `LinearEquiv` to avoid type equalities. -/
def toSubmoduleEquiv (S : Subalgebra R A) : toSubmoduletoSubmodule S ≃ₗ[R] S :=
  LinearEquiv.ofEq _ _ rfl
Linear equivalence between subalgebra and its underlying submodule
Informal description
For a subalgebra $S$ of an $R$-algebra $A$, the linear equivalence $\text{toSubmoduleEquiv}\,S$ is the canonical isomorphism between the underlying submodule of $S$ (obtained via $\text{toSubmodule}$) and $S$ itself. This equivalence maps each element $x$ in the submodule to the same element $x$ in the subalgebra, preserving both the additive and scalar multiplicative structures.
Subalgebra.map definition
(f : A →ₐ[R] B) (S : Subalgebra R A) : Subalgebra R B
Full source
/-- Transport a subalgebra via an algebra homomorphism. -/
@[simps! coe toSubsemiring]
def map (f : A →ₐ[R] B) (S : Subalgebra R A) : Subalgebra R B :=
  { S.toSubsemiring.map (f : A →+* B) with
    algebraMap_mem' := fun r => f.commutes r ▸ Set.mem_image_of_mem _ (S.algebraMap_mem r) }
Image of a subalgebra under an algebra homomorphism
Informal description
Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $A$, the image of $S$ under $f$ is the subalgebra of $B$ consisting of all elements of the form $f(x)$ for $x \in S$. More precisely, $\text{map}(f, S)$ is the subalgebra of $B$ whose underlying set is $f(S) = \{f(x) \mid x \in S\}$, and it inherits the subalgebra structure from $B$.
Subalgebra.map_mono theorem
{S₁ S₂ : Subalgebra R A} {f : A →ₐ[R] B} : S₁ ≤ S₂ → S₁.map f ≤ S₂.map f
Full source
theorem map_mono {S₁ S₂ : Subalgebra R A} {f : A →ₐ[R] B} : S₁ ≤ S₂ → S₁.map f ≤ S₂.map f :=
  Set.image_subset f
Monotonicity of Subalgebra Image under Algebra Homomorphism
Informal description
Let $R$ be a commutative semiring and $A, B$ be $R$-algebras. For any two subalgebras $S_1, S_2$ of $A$ and any $R$-algebra homomorphism $f : A \to B$, if $S_1 \subseteq S_2$, then the image of $S_1$ under $f$ is contained in the image of $S_2$ under $f$, i.e., $f(S_1) \subseteq f(S_2)$.
Subalgebra.map_injective theorem
{f : A →ₐ[R] B} (hf : Function.Injective f) : Function.Injective (map f)
Full source
theorem map_injective {f : A →ₐ[R] B} (hf : Function.Injective f) : Function.Injective (map f) :=
  fun _S₁ _S₂ ih =>
  ext <| Set.ext_iff.1 <| Set.image_injective.2 hf <| Set.ext <| SetLike.ext_iff.mp ih
Injectivity of Subalgebra Image Map for Injective Algebra Homomorphisms
Informal description
Let $R$ be a commutative semiring and let $A$ and $B$ be $R$-algebras. If $f \colon A \to B$ is an injective $R$-algebra homomorphism, then the induced map $\mathrm{map}(f) \colon \mathrm{Subalgebra}_R(A) \to \mathrm{Subalgebra}_R(B)$ on subalgebras is also injective. In other words, for any two subalgebras $S_1, S_2$ of $A$, if $f(S_1) = f(S_2)$, then $S_1 = S_2$.
Subalgebra.map_id theorem
(S : Subalgebra R A) : S.map (AlgHom.id R A) = S
Full source
@[simp]
theorem map_id (S : Subalgebra R A) : S.map (AlgHom.id R A) = S :=
  SetLike.coe_injective <| Set.image_id _
Identity Algebra Homomorphism Preserves Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the image of $S$ under the identity algebra homomorphism $\mathrm{id}_A \colon A \to A$ is equal to $S$ itself, i.e., $\mathrm{id}_A(S) = S$.
Subalgebra.map_map theorem
(S : Subalgebra R A) (g : B →ₐ[R] C) (f : A →ₐ[R] B) : (S.map f).map g = S.map (g.comp f)
Full source
theorem map_map (S : Subalgebra R A) (g : B →ₐ[R] C) (f : A →ₐ[R] B) :
    (S.map f).map g = S.map (g.comp f) :=
  SetLike.coe_injective <| Set.image_image _ _ _
Composition of Algebra Homomorphisms Preserves Subalgebra Image
Informal description
Let $R$ be a commutative semiring, and let $A$, $B$, and $C$ be $R$-algebras. Given a subalgebra $S$ of $A$, an $R$-algebra homomorphism $f \colon A \to B$, and an $R$-algebra homomorphism $g \colon B \to C$, the image of $S$ under $f$ followed by $g$ is equal to the image of $S$ under the composition $g \circ f$. In symbols: $$g(f(S)) = (g \circ f)(S).$$
Subalgebra.mem_map theorem
{S : Subalgebra R A} {f : A →ₐ[R] B} {y : B} : y ∈ map f S ↔ ∃ x ∈ S, f x = y
Full source
@[simp]
theorem mem_map {S : Subalgebra R A} {f : A →ₐ[R] B} {y : B} : y ∈ map f Sy ∈ map f S ↔ ∃ x ∈ S, f x = y :=
  Subsemiring.mem_map
Characterization of Elements in the Image of a Subalgebra under an Algebra Homomorphism
Informal description
Let $R$ be a commutative semiring and $A$, $B$ be $R$-algebras. Given a subalgebra $S$ of $A$ and an $R$-algebra homomorphism $f \colon A \to B$, an element $y \in B$ belongs to the image subalgebra $f(S)$ if and only if there exists $x \in S$ such that $f(x) = y$.
Subalgebra.map_toSubmodule theorem
{S : Subalgebra R A} {f : A →ₐ[R] B} : (toSubmodule <| S.map f) = S.toSubmodule.map f.toLinearMap
Full source
theorem map_toSubmodule {S : Subalgebra R A} {f : A →ₐ[R] B} :
    (toSubmodule <| S.map f) = S.toSubmodule.map f.toLinearMap :=
  SetLike.coe_injective rfl
Compatibility of Subalgebra and Submodule Images under Algebra Homomorphisms
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. For any subalgebra $S$ of $A$ and any $R$-algebra homomorphism $f \colon A \to B$, the underlying submodule of the image subalgebra $f(S)$ is equal to the image of the underlying submodule of $S$ under the linear map associated to $f$. In symbols, if $\text{toSubmodule}$ denotes the operation that takes a subalgebra to its underlying submodule, and $f_{\text{lin}}$ denotes the linear map associated to $f$, then: $$\text{toSubmodule}(f(S)) = f_{\text{lin}}(\text{toSubmodule}(S)).$$
Subalgebra.comap definition
(f : A →ₐ[R] B) (S : Subalgebra R B) : Subalgebra R A
Full source
/-- Preimage of a subalgebra under an algebra homomorphism. -/
@[simps! coe toSubsemiring]
def comap (f : A →ₐ[R] B) (S : Subalgebra R B) : Subalgebra R A :=
  { S.toSubsemiring.comap (f : A →+* B) with
    algebraMap_mem' := fun r =>
      show f (algebraMap R A r) ∈ S from (f.commutes r).symm ▸ S.algebraMap_mem r }
Preimage of a subalgebra under an algebra homomorphism
Informal description
Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $B$, the preimage $f^{-1}(S)$ forms a subalgebra of $A$. This subalgebra consists of all elements $x \in A$ such that $f(x) \in S$. More precisely, the preimage subalgebra satisfies: 1. It is a subsemiring of $A$ (closed under addition, multiplication, and contains $0$ and $1$). 2. It contains the image of the algebra map $R \to A$ (i.e., it is closed under scalar multiplication by elements of $R$).
Subalgebra.map_le theorem
{S : Subalgebra R A} {f : A →ₐ[R] B} {U : Subalgebra R B} : map f S ≤ U ↔ S ≤ comap f U
Full source
theorem map_le {S : Subalgebra R A} {f : A →ₐ[R] B} {U : Subalgebra R B} :
    mapmap f S ≤ U ↔ S ≤ comap f U :=
  Set.image_subset_iff
Image-Preimage Order Relation for Subalgebras
Informal description
Let $R$ be a commutative semiring, $A$ and $B$ be $R$-algebras, and $f \colon A \to B$ be an $R$-algebra homomorphism. For any subalgebra $S$ of $A$ and subalgebra $U$ of $B$, the image of $S$ under $f$ is contained in $U$ if and only if $S$ is contained in the preimage of $U$ under $f$. In symbols: \[ f(S) \subseteq U \leftrightarrow S \subseteq f^{-1}(U). \]
Subalgebra.gc_map_comap theorem
(f : A →ₐ[R] B) : GaloisConnection (map f) (comap f)
Full source
theorem gc_map_comap (f : A →ₐ[R] B) : GaloisConnection (map f) (comap f) := fun _S _U => map_le
Galois Connection Between Subalgebra Image and Preimage under Algebra Homomorphism
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$, the pair of functions $(\text{map}(f), \text{comap}(f))$ forms a Galois connection between the subalgebras of $A$ and the subalgebras of $B$. More precisely, for any subalgebra $S$ of $A$ and subalgebra $T$ of $B$, we have: \[ \text{map}(f)(S) \leq T \quad \text{if and only if} \quad S \leq \text{comap}(f)(T), \] where $\leq$ denotes the inclusion relation on subalgebras.
Subalgebra.mem_comap theorem
(S : Subalgebra R B) (f : A →ₐ[R] B) (x : A) : x ∈ S.comap f ↔ f x ∈ S
Full source
@[simp]
theorem mem_comap (S : Subalgebra R B) (f : A →ₐ[R] B) (x : A) : x ∈ S.comap fx ∈ S.comap f ↔ f x ∈ S :=
  Iff.rfl
Characterization of Preimage Subalgebra Membership via Algebra Homomorphism
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$, an element $x \in A$ belongs to the preimage subalgebra $f^{-1}(S)$ if and only if its image $f(x)$ belongs to $S$. In other words, $x \in \text{comap}_f(S) \leftrightarrow f(x) \in S$.
Subalgebra.noZeroDivisors instance
{R A : Type*} [CommSemiring R] [Semiring A] [NoZeroDivisors A] [Algebra R A] (S : Subalgebra R A) : NoZeroDivisors S
Full source
instance noZeroDivisors {R A : Type*} [CommSemiring R] [Semiring A] [NoZeroDivisors A]
    [Algebra R A] (S : Subalgebra R A) : NoZeroDivisors S :=
  inferInstanceAs (NoZeroDivisors S.toSubsemiring)
Subalgebras Inherit No Zero Divisors Property
Informal description
For any commutative semiring $R$ and $R$-algebra $A$ with no zero divisors, every subalgebra $S$ of $A$ also has no zero divisors.
Subalgebra.isDomain instance
{R A : Type*} [CommRing R] [Ring A] [IsDomain A] [Algebra R A] (S : Subalgebra R A) : IsDomain S
Full source
instance isDomain {R A : Type*} [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    (S : Subalgebra R A) : IsDomain S :=
  inferInstanceAs (IsDomain S.toSubring)
Subalgebras of Domains are Domains
Informal description
For any commutative ring $R$ and $R$-algebra $A$ that is a domain, every subalgebra $S$ of $A$ is also a domain.
SubalgebraClass.toAlgebra instance
: Algebra R s
Full source
instance (priority := 75) toAlgebra : Algebra R s where
  algebraMap := {
    toFun r := ⟨algebraMap R A r, algebraMap_mem s r⟩
    map_one' := Subtype.ext <| by simp
    map_mul' _ _ := Subtype.ext <| by simp
    map_zero' := Subtype.ext <| by simp
    map_add' _ _ := Subtype.ext <| by simp}
  commutes' r x := Subtype.ext <| Algebra.commutes r (x : A)
  smul_def' r x := Subtype.ext <| (algebraMap_smul A r (x : A)).symm
Algebra Structure on Subalgebras
Informal description
For any commutative semiring $R$ and a subalgebra $s$ of an $R$-algebra $A$, the subset $s$ inherits an $R$-algebra structure from $A$. This means $s$ is equipped with addition, multiplication, and scalar multiplication operations that are closed within $s$, and satisfy the axioms of an algebra over $R$.
SubalgebraClass.coe_algebraMap theorem
(r : R) : (algebraMap R s r : A) = algebraMap R A r
Full source
@[simp, norm_cast]
lemma coe_algebraMap (r : R) : (algebraMap R s r : A) = algebraMap R A r := rfl
Coincidence of Algebra Maps on Subalgebras
Informal description
For any commutative semiring $R$ and an $R$-algebra $A$, if $s$ is a subalgebra of $A$, then the algebra map $\text{algebraMap}_R^s$ from $R$ to $s$ coincides with the algebra map $\text{algebraMap}_R^A$ from $R$ to $A$ when composed with the inclusion map $s \hookrightarrow A$. That is, for any $r \in R$, we have $\text{algebraMap}_R^s(r) = \text{algebraMap}_R^A(r)$ as elements of $A$.
SubalgebraClass.val definition
(s : S) : s →ₐ[R] A
Full source
/-- Embedding of a subalgebra into the algebra, as an algebra homomorphism. -/
def val (s : S) : s →ₐ[R] A :=
  { SubsemiringClass.subtype s, SMulMemClass.subtype s with
    toFun := (↑)
    commutes' := fun _ ↦ rfl }
Canonical embedding of a subalgebra
Informal description
The function maps a subalgebra $s$ of an $R$-algebra $A$ to the canonical algebra homomorphism embedding $s$ into $A$. This homomorphism preserves the algebraic structure, including addition, multiplication, scalar multiplication, and the action of $R$. More precisely, for any $x, y \in s$ and $r \in R$: - $\text{val}(x + y) = \text{val}(x) + \text{val}(y)$ - $\text{val}(x * y) = \text{val}(x) * \text{val}(y)$ - $\text{val}(r \bullet x) = r \bullet \text{val}(x)$ - $\text{val}(r) = r$ (where $r$ is viewed in $A$ via the algebra map)
SubalgebraClass.coe_val theorem
: (val s : s → A) = ((↑) : s → A)
Full source
@[simp]
theorem coe_val : (val s : s → A) = ((↑) : s → A) :=
  rfl
Coincidence of Subalgebra Embedding and Coercion
Informal description
For any subalgebra $s$ of an $R$-algebra $A$, the canonical algebra homomorphism $\text{val}_s : s \to A$ coincides with the coercion map $(↑) : s \to A$ that embeds $s$ into $A$.
Submodule.toSubalgebra definition
(p : Submodule R A) (h_one : (1 : A) ∈ p) (h_mul : ∀ x y, x ∈ p → y ∈ p → x * y ∈ p) : Subalgebra R A
Full source
/-- A submodule containing `1` and closed under multiplication is a subalgebra. -/
@[simps coe toSubsemiring]
def toSubalgebra (p : Submodule R A) (h_one : (1 : A) ∈ p)
    (h_mul : ∀ x y, x ∈ py ∈ px * y ∈ p) : Subalgebra R A :=
  { p with
    mul_mem' := fun hx hy ↦ h_mul _ _ hx hy
    one_mem' := h_one
    algebraMap_mem' := fun r => by
      rw [Algebra.algebraMap_eq_smul_one]
      exact p.smul_mem _ h_one }
Submodule to subalgebra conversion
Informal description
Given a submodule $p$ of an $R$-algebra $A$ that contains the multiplicative identity $1$ and is closed under multiplication, the function constructs a subalgebra of $A$ over $R$ with the same underlying set as $p$. More precisely, for a submodule $p$ of $A$ satisfying: 1. $1 \in p$ 2. For any $x, y \in p$, $x * y \in p$ the function returns a subalgebra structure on $p$ that inherits the additive and scalar multiplication properties from $p$ and additionally satisfies the multiplicative properties of a subalgebra.
Submodule.mem_toSubalgebra theorem
{p : Submodule R A} {h_one h_mul} {x} : x ∈ p.toSubalgebra h_one h_mul ↔ x ∈ p
Full source
@[simp]
theorem mem_toSubalgebra {p : Submodule R A} {h_one h_mul} {x} :
    x ∈ p.toSubalgebra h_one h_mulx ∈ p.toSubalgebra h_one h_mul ↔ x ∈ p := Iff.rfl
Membership Equivalence in Submodule-to-Subalgebra Conversion
Informal description
For any submodule $p$ of an $R$-algebra $A$ that contains the multiplicative identity $1$ and is closed under multiplication (i.e., satisfies $h_{\text{one}}$ and $h_{\text{mul}}$), an element $x$ belongs to the subalgebra constructed from $p$ if and only if $x$ belongs to $p$.
Submodule.toSubalgebra_mk theorem
(s : Submodule R A) (h1 hmul) : s.toSubalgebra h1 hmul = Subalgebra.mk ⟨⟨⟨s, @hmul⟩, h1⟩, s.add_mem, s.zero_mem⟩ (by intro r; rw [Algebra.algebraMap_eq_smul_one]; apply s.smul_mem _ h1)
Full source
theorem toSubalgebra_mk (s : Submodule R A) (h1 hmul) :
    s.toSubalgebra h1 hmul =
      Subalgebra.mk ⟨⟨⟨s, @hmul⟩, h1⟩, s.add_mem, s.zero_mem⟩
        (by intro r; rw [Algebra.algebraMap_eq_smul_one]; apply s.smul_mem _ h1) :=
  rfl
Submodule to Subalgebra Construction via Explicit Definition
Informal description
Given a submodule $s$ of an $R$-algebra $A$ that contains the multiplicative identity $1$ (i.e., $1 \in s$) and is closed under multiplication (i.e., for all $x, y \in s$, $x * y \in s$), the construction of the corresponding subalgebra via `toSubalgebra` is equal to the subalgebra obtained by explicitly constructing it from the underlying set of $s$ with the inherited addition, zero, and scalar multiplication properties. Specifically, the scalar multiplication condition is verified using the algebra map property $r \mapsto r \bullet 1$.
Submodule.toSubalgebra_toSubmodule theorem
(p : Submodule R A) (h_one h_mul) : Subalgebra.toSubmodule (p.toSubalgebra h_one h_mul) = p
Full source
@[simp]
theorem toSubalgebra_toSubmodule (p : Submodule R A) (h_one h_mul) :
    Subalgebra.toSubmodule (p.toSubalgebra h_one h_mul) = p :=
  SetLike.coe_injective rfl
Submodule-Subalgebra Roundtrip Identity
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any submodule $p$ of $A$ that contains the multiplicative identity $1$ and is closed under multiplication, the submodule obtained from the corresponding subalgebra (via `toSubalgebra`) is equal to the original submodule $p$. In other words, the composition of `toSubalgebra` and `toSubmodule` acts as the identity on such submodules.
Subalgebra.toSubmodule_toSubalgebra theorem
(S : Subalgebra R A) : (S.toSubmodule.toSubalgebra S.one_mem fun _ _ => S.mul_mem) = S
Full source
@[simp]
theorem _root_.Subalgebra.toSubmodule_toSubalgebra (S : Subalgebra R A) :
    (S.toSubmodule.toSubalgebra S.one_mem fun _ _ => S.mul_mem) = S :=
  SetLike.coe_injective rfl
Subalgebra-Submodule Roundtrip Identity
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the submodule obtained by converting $S$ to a submodule and then back to a subalgebra (with the same multiplicative closure properties) is equal to $S$ itself.
AlgHom.range definition
(φ : A →ₐ[R] B) : Subalgebra R B
Full source
/-- Range of an `AlgHom` as a subalgebra. -/
@[simps! coe toSubsemiring]
protected def range (φ : A →ₐ[R] B) : Subalgebra R B :=
  { φ.toRingHom.rangeS with algebraMap_mem' := fun r => ⟨algebraMap R A r, φ.commutes r⟩ }
Range of an algebra homomorphism as a subalgebra
Informal description
Given an algebra homomorphism $\varphi \colon A \to B$ over a commutative semiring $R$, the range of $\varphi$ is the subalgebra of $B$ consisting of all elements of the form $\varphi(x)$ for some $x \in A$. More precisely, $\text{range}(\varphi)$ is the subalgebra of $B$ whose underlying set is $\{\varphi(x) \mid x \in A\}$, and it inherits the $R$-algebra structure from $B$.
AlgHom.mem_range theorem
(φ : A →ₐ[R] B) {y : B} : y ∈ φ.range ↔ ∃ x, φ x = y
Full source
@[simp]
theorem mem_range (φ : A →ₐ[R] B) {y : B} : y ∈ φ.rangey ∈ φ.range ↔ ∃ x, φ x = y :=
  RingHom.mem_rangeS
Characterization of Elements in the Range of an Algebra Homomorphism
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. For any $R$-algebra homomorphism $\varphi \colon A \to B$ and any element $y \in B$, we have $y \in \text{range}(\varphi)$ if and only if there exists $x \in A$ such that $\varphi(x) = y$.
AlgHom.mem_range_self theorem
(φ : A →ₐ[R] B) (x : A) : φ x ∈ φ.range
Full source
theorem mem_range_self (φ : A →ₐ[R] B) (x : A) : φ x ∈ φ.range :=
  φ.mem_range.2 ⟨x, rfl⟩
Image of Element under Algebra Homomorphism Belongs to its Range
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be $R$-algebras. For any $R$-algebra homomorphism $\varphi \colon A \to B$ and any element $x \in A$, the image $\varphi(x)$ belongs to the range of $\varphi$.
AlgHom.range_comp theorem
(f : A →ₐ[R] B) (g : B →ₐ[R] C) : (g.comp f).range = f.range.map g
Full source
theorem range_comp (f : A →ₐ[R] B) (g : B →ₐ[R] C) : (g.comp f).range = f.range.map g :=
  SetLike.coe_injective (Set.range_comp g f)
Range of Composition of Algebra Homomorphisms Equals Image of Range
Informal description
Let $R$ be a commutative semiring, and let $A$, $B$, and $C$ be $R$-algebras. Given $R$-algebra homomorphisms $f \colon A \to B$ and $g \colon B \to C$, the range of the composition $g \circ f$ is equal to the image of the range of $f$ under $g$, i.e., \[ \text{range}(g \circ f) = g(\text{range}(f)). \]
AlgHom.range_comp_le_range theorem
(f : A →ₐ[R] B) (g : B →ₐ[R] C) : (g.comp f).range ≤ g.range
Full source
theorem range_comp_le_range (f : A →ₐ[R] B) (g : B →ₐ[R] C) : (g.comp f).range ≤ g.range :=
  SetLike.coe_mono (Set.range_comp_subset_range f g)
Range of Composition of Algebra Homomorphisms is Subset of Range of Second Homomorphism
Informal description
For any algebra homomorphisms $f \colon A \to B$ and $g \colon B \to C$ over a commutative semiring $R$, the range of the composition $g \circ f$ is contained in the range of $g$, i.e., $\mathrm{range}(g \circ f) \subseteq \mathrm{range}(g)$.
AlgHom.codRestrict definition
(f : A →ₐ[R] B) (S : Subalgebra R B) (hf : ∀ x, f x ∈ S) : A →ₐ[R] S
Full source
/-- Restrict the codomain of an algebra homomorphism. -/
def codRestrict (f : A →ₐ[R] B) (S : Subalgebra R B) (hf : ∀ x, f x ∈ S) : A →ₐ[R] S :=
  { RingHom.codRestrict (f : A →+* B) S hf with commutes' := fun r => Subtype.eq <| f.commutes r }
Restriction of an algebra homomorphism to a subalgebra of the codomain
Informal description
Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $B$ such that $f(x) \in S$ for all $x \in A$, the function `AlgHom.codRestrict` restricts the codomain of $f$ to $S$, yielding an $R$-algebra homomorphism $A \to S$. This is defined by mapping each $x \in A$ to $\langle f(x), hf(x) \rangle$, where $hf$ is the proof that $f(x) \in S$, and preserving both the additive and multiplicative structures (including zero and one) as well as the $R$-algebra structure.
AlgHom.val_comp_codRestrict theorem
(f : A →ₐ[R] B) (S : Subalgebra R B) (hf : ∀ x, f x ∈ S) : S.val.comp (f.codRestrict S hf) = f
Full source
@[simp]
theorem val_comp_codRestrict (f : A →ₐ[R] B) (S : Subalgebra R B) (hf : ∀ x, f x ∈ S) :
    S.val.comp (f.codRestrict S hf) = f :=
  AlgHom.ext fun _ => rfl
Commutativity of Inclusion with Codomain-Restricted Algebra Homomorphism
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 $f(x) \in S$ for all $x \in A$, the composition of the inclusion homomorphism $S \hookrightarrow B$ with the codomain-restricted homomorphism $A \to S$ equals $f$. In other words, the following diagram commutes: \[ \begin{tikzcd} A \arrow[r, "f"] \arrow[dr, "f_{\text{codRestrict}}"'] & B \\ & S \arrow[u, hook] \end{tikzcd} \] where $f_{\text{codRestrict}}$ denotes the codomain-restricted homomorphism $A \to S$ obtained from $f$.
AlgHom.coe_codRestrict theorem
(f : A →ₐ[R] B) (S : Subalgebra R B) (hf : ∀ x, f x ∈ S) (x : A) : ↑(f.codRestrict S hf x) = f x
Full source
@[simp]
theorem coe_codRestrict (f : A →ₐ[R] B) (S : Subalgebra R B) (hf : ∀ x, f x ∈ S) (x : A) :
    ↑(f.codRestrict S hf x) = f x :=
  rfl
Coercion of Codomain-Restricted Algebra Homomorphism Preserves Values
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$, a subalgebra $S$ of $B$, and a proof $hf$ that $f(x) \in S$ for all $x \in A$, the underlying function of the restricted homomorphism $f.codRestrict\, S\, hf \colon A \to S$ satisfies $\uparrow(f.codRestrict\, S\, hf\, x) = f(x)$ for any $x \in A$, where $\uparrow$ denotes the coercion from $S$ to $B$.
AlgHom.injective_codRestrict theorem
(f : A →ₐ[R] B) (S : Subalgebra R B) (hf : ∀ x, f x ∈ S) : Function.Injective (f.codRestrict S hf) ↔ Function.Injective f
Full source
theorem injective_codRestrict (f : A →ₐ[R] B) (S : Subalgebra R B) (hf : ∀ x, f x ∈ S) :
    Function.InjectiveFunction.Injective (f.codRestrict S hf) ↔ Function.Injective f :=
  ⟨fun H _x _y hxy => H <| Subtype.eq hxy, fun H _x _y hxy => H (congr_arg Subtype.val hxy :)⟩
Injectivity of Codomain-Restricted Algebra Homomorphism
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 $f(x) \in S$ for all $x \in A$, the restricted homomorphism $f \colon A \to S$ is injective if and only if the original homomorphism $f \colon A \to B$ is injective.
AlgHom.rangeRestrict abbrev
(f : A →ₐ[R] B) : A →ₐ[R] f.range
Full source
/-- Restrict the codomain of an `AlgHom` `f` to `f.range`.

This is the bundled version of `Set.rangeFactorization`. -/
abbrev rangeRestrict (f : A →ₐ[R] B) : A →ₐ[R] f.range :=
  f.codRestrict f.range f.mem_range_self
Range-Restricted Algebra Homomorphism
Informal description
Given an $R$-algebra homomorphism $f \colon A \to B$, the function `AlgHom.rangeRestrict` restricts the codomain of $f$ to its range, yielding an $R$-algebra homomorphism $A \to \text{range}(f)$.
AlgHom.rangeRestrict_surjective theorem
(f : A →ₐ[R] B) : Function.Surjective (f.rangeRestrict)
Full source
theorem rangeRestrict_surjective (f : A →ₐ[R] B) : Function.Surjective (f.rangeRestrict) :=
  fun ⟨_y, hy⟩ =>
    let ⟨x, hx⟩ := hy
    ⟨x, SetCoe.ext hx⟩
Surjectivity of Range-Restricted Algebra Homomorphism
Informal description
For any $R$-algebra homomorphism $f \colon A \to B$, the range-restricted homomorphism $f \colon A \to \text{range}(f)$ is surjective.
AlgHom.fintypeRange instance
[Fintype A] [DecidableEq B] (φ : A →ₐ[R] B) : Fintype φ.range
Full source
/-- The range of a morphism of algebras is a fintype, if the domain is a fintype.

Note that this instance can cause a diamond with `Subtype.fintype` if `B` is also a fintype. -/
instance fintypeRange [Fintype A] [DecidableEq B] (φ : A →ₐ[R] B) : Fintype φ.range :=
  Set.fintypeRange φ
Finiteness of the Range of an Algebra Homomorphism from a Finite Domain
Informal description
For any algebra homomorphism $\varphi \colon A \to B$ over a commutative semiring $R$, if $A$ is a finite type and $B$ has decidable equality, then the range of $\varphi$ is also a finite type.
AlgEquiv.ofLeftInverse definition
{g : B → A} {f : A →ₐ[R] B} (h : Function.LeftInverse g f) : A ≃ₐ[R] f.range
Full source
/-- Restrict an algebra homomorphism with a left inverse to an algebra isomorphism to its range.

This is a computable alternative to `AlgEquiv.ofInjective`. -/
def ofLeftInverse {g : B → A} {f : A →ₐ[R] B} (h : Function.LeftInverse g f) : A ≃ₐ[R] f.range :=
  { f.rangeRestrict with
    toFun := f.rangeRestrict
    invFun := g ∘ f.range.val
    left_inv := h
    right_inv := fun x =>
      Subtype.ext <|
        let ⟨x', hx'⟩ := f.mem_range.mp x.prop
        show f (g x) = x by rw [← hx', h x'] }
Algebra isomorphism from a homomorphism with left inverse
Informal description
Given an $R$-algebra homomorphism $f \colon A \to B$ and a left inverse $g \colon B \to A$ of $f$ (i.e., $g \circ f = \text{id}_A$), the function `AlgEquiv.ofLeftInverse` constructs an $R$-algebra isomorphism between $A$ and the range of $f$ (denoted $f.\text{range}$). The isomorphism is defined by: - The forward map is the range-restricted version of $f$, sending $x \in A$ to $f(x) \in f.\text{range}$. - The inverse map is the composition of $g$ with the inclusion $f.\text{range} \hookrightarrow B$. This provides a computable alternative to constructing an isomorphism from an injective homomorphism.
AlgEquiv.ofLeftInverse_apply theorem
{g : B → A} {f : A →ₐ[R] B} (h : Function.LeftInverse g f) (x : A) : ↑(ofLeftInverse h x) = f x
Full source
@[simp]
theorem ofLeftInverse_apply {g : B → A} {f : A →ₐ[R] B} (h : Function.LeftInverse g f) (x : A) :
    ↑(ofLeftInverse h x) = f x :=
  rfl
Image under algebra isomorphism from left inverse equals original homomorphism
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be semirings equipped with $R$-algebra structures. Given an $R$-algebra homomorphism $f \colon A \to B$ and a left inverse $g \colon B \to A$ of $f$ (i.e., $g \circ f = \text{id}_A$), then for any $x \in A$, the image of $x$ under the $R$-algebra isomorphism $\text{ofLeftInverse}\ h \colon A \simeq_{alg[R]} f.\text{range}$ is equal to $f(x)$.
AlgEquiv.ofLeftInverse_symm_apply theorem
{g : B → A} {f : A →ₐ[R] B} (h : Function.LeftInverse g f) (x : f.range) : (ofLeftInverse h).symm x = g x
Full source
@[simp]
theorem ofLeftInverse_symm_apply {g : B → A} {f : A →ₐ[R] B} (h : Function.LeftInverse g f)
    (x : f.range) : (ofLeftInverse h).symm x = g x :=
  rfl
Inverse of Algebra Isomorphism from Left Inverse Evaluates to Left Inverse
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be semirings equipped with $R$-algebra structures. Given an $R$-algebra homomorphism $f \colon A \to B$ and a left inverse $g \colon B \to A$ of $f$ (i.e., $g \circ f = \text{id}_A$), the inverse of the $R$-algebra isomorphism $\text{ofLeftInverse}\ h \colon A \simeq_{R} f.\text{range}$ satisfies $(\text{ofLeftInverse}\ h)^{-1}(x) = g(x)$ for all $x \in f.\text{range}$.
AlgEquiv.ofInjective definition
(f : A →ₐ[R] B) (hf : Function.Injective f) : A ≃ₐ[R] f.range
Full source
/-- Restrict an injective algebra homomorphism to an algebra isomorphism -/
noncomputable def ofInjective (f : A →ₐ[R] B) (hf : Function.Injective f) : A ≃ₐ[R] f.range :=
  ofLeftInverse (Classical.choose_spec hf.hasLeftInverse)
Algebra isomorphism from an injective homomorphism
Informal description
Given an injective $R$-algebra homomorphism $f \colon A \to B$, the function `AlgEquiv.ofInjective` constructs an $R$-algebra isomorphism between $A$ and the range of $f$ (denoted $f.\text{range}$). The isomorphism is defined by: - The forward map sends $x \in A$ to $f(x) \in f.\text{range}$. - The inverse map is constructed using a left inverse of $f$ (which exists due to the injectivity of $f$). This provides a way to view the domain $A$ as isomorphic to the image of $f$ in $B$ when $f$ is injective.
AlgEquiv.ofInjective_apply theorem
(f : A →ₐ[R] B) (hf : Function.Injective f) (x : A) : ↑(ofInjective f hf x) = f x
Full source
@[simp]
theorem ofInjective_apply (f : A →ₐ[R] B) (hf : Function.Injective f) (x : A) :
    ↑(ofInjective f hf x) = f x :=
  rfl
Image under injective algebra homomorphism equals range element
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 an element $x \in A$, the image of $x$ under the $R$-algebra isomorphism $\text{ofInjective}\ f\ hf \colon A \simeq_{alg[R]} f.\text{range}$ is equal to $f(x)$.
AlgEquiv.ofInjectiveField definition
{E F : Type*} [DivisionRing E] [Semiring F] [Nontrivial F] [Algebra R E] [Algebra R F] (f : E →ₐ[R] F) : E ≃ₐ[R] f.range
Full source
/-- Restrict an algebra homomorphism between fields to an algebra isomorphism -/
noncomputable def ofInjectiveField {E F : Type*} [DivisionRing E] [Semiring F] [Nontrivial F]
    [Algebra R E] [Algebra R F] (f : E →ₐ[R] F) : E ≃ₐ[R] f.range :=
  ofInjective f f.toRingHom.injective
Isomorphism from division ring to range of algebra homomorphism
Informal description
Given a division ring $E$ and a nontrivial semiring $F$, both equipped with an $R$-algebra structure, and an $R$-algebra homomorphism $f \colon E \to F$, the function `AlgEquiv.ofInjectiveField` constructs an $R$-algebra isomorphism between $E$ and the range of $f$. This isomorphism is obtained by restricting the codomain of $f$ to its image, which is valid because any algebra homomorphism between a division ring and a nontrivial semiring is automatically injective.
AlgEquiv.subalgebraMap definition
(e : A ≃ₐ[R] B) (S : Subalgebra R A) : S ≃ₐ[R] S.map (e : A →ₐ[R] B)
Full source
/-- Given an equivalence `e : A ≃ₐ[R] B` of `R`-algebras and a subalgebra `S` of `A`,
`subalgebraMap` is the induced equivalence between `S` and `S.map e` -/
@[simps!]
def subalgebraMap (e : A ≃ₐ[R] B) (S : Subalgebra R A) : S ≃ₐ[R] S.map (e : A →ₐ[R] B) :=
  { e.toRingEquiv.subsemiringMap S.toSubsemiring with
    commutes' := fun r => by ext; exact e.commutes r }
Subalgebra equivalence induced by an $R$-algebra isomorphism
Informal description
Given an $R$-algebra isomorphism $e \colon A \simeq_{alg[R]} B$ and a subalgebra $S$ of $A$, the function `subalgebraMap e S` constructs an $R$-algebra isomorphism between $S$ and its image under $e$ in $B$. More precisely, this establishes an isomorphism $S \simeq_{alg[R]} e(S)$ where $e(S)$ is the subalgebra of $B$ consisting of all elements of the form $e(x)$ for $x \in S$.
Subalgebra.subsingleton_of_subsingleton instance
[Subsingleton A] : Subsingleton (Subalgebra R A)
Full source
instance subsingleton_of_subsingleton [Subsingleton A] : Subsingleton (Subalgebra R A) :=
  ⟨fun B C => ext fun x => by simp only [Subsingleton.elim x 0, zero_mem B, zero_mem C]⟩
Subsingleton Algebra Implies Subsingleton Subalgebras
Informal description
If an $R$-algebra $A$ is a subsingleton (i.e., has at most one element), then the collection of all subalgebras of $A$ is also a subsingleton.
Subalgebra.range_val theorem
: S.val.range = S
Full source
theorem range_val : S.val.range = S :=
  ext <| Set.ext_iff.1 <| S.val.coe_range.trans Subtype.range_val
Range of Subalgebra Inclusion Equals Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the range of the inclusion homomorphism $S \hookrightarrow A$ is equal to $S$ itself.
Subalgebra.inclusion definition
{S T : Subalgebra R A} (h : S ≤ T) : S →ₐ[R] T
Full source
/-- The map `S → T` when `S` is a subalgebra contained in the subalgebra `T`.

This is the subalgebra version of `Submodule.inclusion`, or `Subring.inclusion` -/
def inclusion {S T : Subalgebra R A} (h : S ≤ T) : S →ₐ[R] T where
  toFun := Set.inclusion h
  map_one' := rfl
  map_add' _ _ := rfl
  map_mul' _ _ := rfl
  map_zero' := rfl
  commutes' _ := rfl
Inclusion homomorphism of subalgebras
Informal description
Given two subalgebras \( S \) and \( T \) of an \( R \)-algebra \( A \) such that \( S \subseteq T \), the function \(\text{inclusion}(h) : S \to T\) is the canonical \( R \)-algebra homomorphism that maps each element of \( S \) to itself, viewed as an element of \( T \). This homomorphism preserves the additive and multiplicative structures, as well as the action of \( R \).
Subalgebra.inclusion_self theorem
: inclusion (le_refl S) = AlgHom.id R S
Full source
@[simp]
theorem inclusion_self : inclusion (le_refl S) = AlgHom.id R S :=
  AlgHom.ext fun _x => Subtype.ext rfl
Inclusion Homomorphism of a Subalgebra into Itself is the Identity
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the inclusion homomorphism of $S$ into itself (induced by the reflexivity of the partial order $\leq$) is equal to the identity $R$-algebra homomorphism on $S$.
Subalgebra.inclusion_mk theorem
(x : A) (hx : x ∈ S) : inclusion h ⟨x, hx⟩ = ⟨x, h hx⟩
Full source
@[simp]
theorem inclusion_mk (x : A) (hx : x ∈ S) : inclusion h ⟨x, hx⟩ = ⟨x, h hx⟩ :=
  rfl
Inclusion Homomorphism Preserves Element Construction in Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebras $S \subseteq T$ of $A$, the inclusion homomorphism $\text{inclusion}(h) : S \to T$ satisfies the following property: for any element $x \in A$ that belongs to $S$ (i.e., $x \in S$), we have $\text{inclusion}(h)(\langle x, hx\rangle) = \langle x, h(hx)\rangle$, where $\langle x, hx\rangle$ denotes the element $x$ viewed as an element of $S$ via the membership proof $hx$, and similarly $\langle x, h(hx)\rangle$ denotes $x$ viewed as an element of $T$ via the proof $h(hx)$ that $x \in T$ (since $S \subseteq T$).
Subalgebra.inclusion_right theorem
(x : T) (m : (x : A) ∈ S) : inclusion h ⟨x, m⟩ = x
Full source
theorem inclusion_right (x : T) (m : (x : A) ∈ S) : inclusion h ⟨x, m⟩ = x :=
  Subtype.ext rfl
Inclusion Homomorphism Acts as Identity on Elements of Subalgebra
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebras $S \subseteq T$ of $A$ (with inclusion $h : S \leq T$), and any element $x \in T$ such that $x \in S$ (as an element of $A$), the inclusion homomorphism maps the element $\langle x, m \rangle$ of $S$ (where $m$ witnesses that $x \in S$) back to $x$ in $T$.
Subalgebra.inclusion_inclusion theorem
(hst : S ≤ T) (htu : T ≤ U) (x : S) : inclusion htu (inclusion hst x) = inclusion (le_trans hst htu) x
Full source
@[simp]
theorem inclusion_inclusion (hst : S ≤ T) (htu : T ≤ U) (x : S) :
    inclusion htu (inclusion hst x) = inclusion (le_trans hst htu) x :=
  Subtype.ext rfl
Composition of Subalgebra Inclusions is Transitive Inclusion
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For subalgebras $S$, $T$, $U$ of $A$ with $S \subseteq T \subseteq U$, and any element $x \in S$, the composition of inclusion homomorphisms $T \hookrightarrow U$ and $S \hookrightarrow T$ applied to $x$ equals the inclusion homomorphism $S \hookrightarrow U$ applied to $x$. In other words, the following diagram commutes: \[ \begin{CD} S @>{hst}>> T \\ @V{le\_trans\ hst\ htu}VV @VV{htu}V \\ U @= U \end{CD} \] where $hst$ and $htu$ are the inclusion maps, and $le\_trans\ hst\ htu$ is the inclusion map obtained by transitivity of $\subseteq$.
Subalgebra.coe_inclusion theorem
(s : S) : (inclusion h s : A) = s
Full source
@[simp]
theorem coe_inclusion (s : S) : (inclusion h s : A) = s :=
  rfl
Inclusion Map Acts as Identity on Subalgebra Elements
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any two subalgebras $S$ and $T$ of $A$ with $S \subseteq T$, the inclusion map $\text{inclusion}(h) : S \to T$ satisfies that for any element $s \in S$, the image of $s$ under the inclusion map, when viewed as an element of $A$, equals $s$ itself. In other words, the inclusion map acts as the identity when composed with the coercion from $T$ to $A$. Symbolically: For any $s \in S$, we have $\text{inclusion}(h)(s) = s$ in $A$.
Subalgebra.inclusion.isScalarTower_left instance
(X) [SMul X R] [SMul X A] [IsScalarTower X R A] : letI := (inclusion h).toModule; IsScalarTower X S T
Full source
scoped instance isScalarTower_left (X) [SMul X R] [SMul X A] [IsScalarTower X R A] :
    letI := (inclusion h).toModule; IsScalarTower X S T :=
  letI := (inclusion h).toModule
  ⟨fun x s t ↦ Subtype.ext <| by
    rw [← one_smul R s, ← smul_assoc, one_smul, ← one_smul R (s • t), ← smul_assoc,
      Algebra.smul_def, Algebra.smul_def]
    apply mul_assoc⟩
Scalar Tower Property for Subalgebra Inclusion
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. Given subalgebras $S \subseteq T$ of $A$ and a type $X$ with scalar multiplication actions on both $R$ and $A$ such that $X$ forms a scalar tower with $R$ and $A$ (i.e., $(x \cdot r) \cdot a = x \cdot (r \cdot a)$ for all $x \in X$, $r \in R$, $a \in A$), then $X$ also forms a scalar tower with $S$ and $T$ via the inclusion homomorphism $S \hookrightarrow T$.
Subalgebra.inclusion.isScalarTower_right instance
(X) [MulAction A X] : letI := (inclusion h).toModule; IsScalarTower S T X
Full source
scoped instance isScalarTower_right (X) [MulAction A X] :
    letI := (inclusion h).toModule; IsScalarTower S T X :=
  letI := (inclusion h).toModule; ⟨fun _ ↦ mul_smul _⟩
Scalar Tower Property for Subalgebra Inclusion on Right Actions
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. Given two subalgebras $S \subseteq T$ of $A$ and a type $X$ with a multiplicative action of $A$, then $T$ forms a scalar tower over $S$ acting on $X$. That is, for all $s \in S$, $t \in T$, and $x \in X$, we have $(s \cdot t) \cdot x = s \cdot (t \cdot x)$.
Subalgebra.inclusion.faithfulSMul instance
: letI := (inclusion h).toModule; FaithfulSMul S T
Full source
scoped instance faithfulSMul :
    letI := (inclusion h).toModule; FaithfulSMul S T :=
  letI := (inclusion h).toModule
  ⟨fun {x y} h ↦ Subtype.ext <| by
    convert Subtype.ext_iff.mp (h 1) using 1 <;> exact (mul_one _).symm⟩
Faithful Scalar Multiplication Induced by Subalgebra Inclusion
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, given two subalgebras $S \subseteq T$ of $A$, the inclusion map $S \hookrightarrow T$ induces a faithful scalar multiplication action of $S$ on $T$. This means that distinct elements of $S$ act differently on $T$ via scalar multiplication.
Subalgebra.equivOfEq definition
(S T : Subalgebra R A) (h : S = T) : S ≃ₐ[R] T
Full source
/-- Two subalgebras that are equal are also equivalent as algebras.

This is the `Subalgebra` version of `LinearEquiv.ofEq` and `Equiv.setCongr`. -/
@[simps apply]
def equivOfEq (S T : Subalgebra R A) (h : S = T) : S ≃ₐ[R] T where
  __ := LinearEquiv.ofEq _ _ (congr_arg toSubmodule h)
  toFun x := ⟨x, h ▸ x.2⟩
  invFun x := ⟨x, h.symm ▸ x.2⟩
  map_mul' _ _ := rfl
  commutes' _ := rfl
$R$-algebra isomorphism between equal subalgebras
Informal description
Given two subalgebras $S$ and $T$ of an $R$-algebra $A$ that are equal (i.e., $S = T$), the function $\text{equivOfEq}$ constructs an $R$-algebra isomorphism between $S$ and $T$. This isomorphism maps each element of $S$ to the corresponding element in $T$ (which is the same element since $S = T$), preserving both the ring structure and the scalar multiplication by elements of $R$.
Subalgebra.equivOfEq_symm theorem
(S T : Subalgebra R A) (h : S = T) : (equivOfEq S T h).symm = equivOfEq T S h.symm
Full source
@[simp]
theorem equivOfEq_symm (S T : Subalgebra R A) (h : S = T) :
    (equivOfEq S T h).symm = equivOfEq T S h.symm := rfl
Inverse of Subalgebra Equality Isomorphism
Informal description
For any two subalgebras $S$ and $T$ of an $R$-algebra $A$ such that $S = T$, the inverse of the $R$-algebra isomorphism $\text{equivOfEq}(S, T, h)$ is equal to the $R$-algebra isomorphism $\text{equivOfEq}(T, S, h^{-1})$, where $h^{-1}$ is the equality proof of $T = S$.
Subalgebra.equivOfEq_rfl theorem
(S : Subalgebra R A) : equivOfEq S S rfl = AlgEquiv.refl
Full source
@[simp]
theorem equivOfEq_rfl (S : Subalgebra R A) : equivOfEq S S rfl = AlgEquiv.refl := by ext; rfl
Identity $R$-algebra isomorphism for reflexive equality of subalgebras
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the $R$-algebra isomorphism $\text{equivOfEq}$ from $S$ to itself (induced by reflexivity) is equal to the identity $R$-algebra isomorphism on $S$.
Subalgebra.equivOfEq_trans theorem
(S T U : Subalgebra R A) (hST : S = T) (hTU : T = U) : (equivOfEq S T hST).trans (equivOfEq T U hTU) = equivOfEq S U (hST.trans hTU)
Full source
@[simp]
theorem equivOfEq_trans (S T U : Subalgebra R A) (hST : S = T) (hTU : T = U) :
    (equivOfEq S T hST).trans (equivOfEq T U hTU) = equivOfEq S U (hST.trans hTU) := rfl
Transitivity of Subalgebra Isomorphism Composition for Equal Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ an $R$-algebra. For any subalgebras $S$, $T$, $U$ of $A$ with equalities $S = T$ and $T = U$, the composition of the $R$-algebra isomorphisms $\text{equivOfEq}(S, T, h_{ST})$ and $\text{equivOfEq}(T, U, h_{TU})$ equals the $R$-algebra isomorphism $\text{equivOfEq}(S, U, h_{ST} \circ h_{TU})$.
Subalgebra.range_comp_val theorem
: (f.comp S.val).range = S.map f
Full source
theorem range_comp_val : (f.comp S.val).range = S.map f := by
  rw [AlgHom.range_comp, range_val]
Range of Composition with Subalgebra Inclusion Equals Image of Subalgebra
Informal description
For an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $A$, the range of the composition $f \circ \text{val}_S$ (where $\text{val}_S \colon S \hookrightarrow A$ is the inclusion homomorphism) is equal to the image of $S$ under $f$, i.e., \[ \text{range}(f \circ \text{val}_S) = f(S). \]
AlgHom.subalgebraMap definition
: S →ₐ[R] S.map f
Full source
/-- An `AlgHom` between two rings restricts to an `AlgHom` from any subalgebra of the
domain onto the image of that subalgebra. -/
def _root_.AlgHom.subalgebraMap : S →ₐ[R] S.map f :=
  (f.comp S.val).codRestrict _ fun x ↦ ⟨_, x.2, rfl⟩
Restriction of an algebra homomorphism to a subalgebra and its image
Informal description
Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $A$, the function `AlgHom.subalgebraMap` restricts $f$ to $S$ and maps it into the image subalgebra $S.map f$ of $B$. More precisely, for each $x \in S$, the map sends $x$ to $f(x)$ viewed as an element of the subalgebra $S.map f = \{f(y) \mid y \in S\}$ of $B$. This yields an $R$-algebra homomorphism $S \to S.map f$ that preserves the algebraic structure.
AlgHom.subalgebraMap_coe_apply theorem
(x : S) : f.subalgebraMap S x = f x
Full source
@[simp]
theorem _root_.AlgHom.subalgebraMap_coe_apply (x : S) : f.subalgebraMap S x = f x := rfl
Restriction of Algebra Homomorphism to Subalgebra Preserves Evaluation
Informal description
For any $R$-algebra homomorphism $f \colon A \to B$ and any subalgebra $S$ of $A$, the restriction of $f$ to $S$ (denoted $f.\text{subalgebraMap} S$) satisfies $(f.\text{subalgebraMap} S)(x) = f(x)$ for all $x \in S$.
AlgHom.subalgebraMap_surjective theorem
: Function.Surjective (f.subalgebraMap S)
Full source
theorem _root_.AlgHom.subalgebraMap_surjective : Function.Surjective (f.subalgebraMap S) :=
  f.toAddMonoidHom.addSubmonoidMap_surjective S.toAddSubmonoid
Surjectivity of Restricted Algebra Homomorphism on Image Subalgebra
Informal description
Given an $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $A$, the restricted homomorphism $f \colon S \to S.\text{map}(f)$ is surjective. That is, for every element $y$ in the image subalgebra $S.\text{map}(f)$, there exists an element $x \in S$ such that $f(x) = y$.
Subalgebra.equivMapOfInjective definition
: S ≃ₐ[R] S.map f
Full source
/-- A subalgebra is isomorphic to its image under an injective `AlgHom` -/
noncomputable def equivMapOfInjective : S ≃ₐ[R] S.map f :=
  (AlgEquiv.ofInjective (f.comp S.val) (hf.comp Subtype.val_injective)).trans
    (equivOfEq _ _ (range_comp_val S f))
Isomorphism between a subalgebra and its image under an injective algebra homomorphism
Informal description
Given an injective $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $A$, the function `Subalgebra.equivMapOfInjective` constructs an $R$-algebra isomorphism between $S$ and the image of $S$ under $f$ (denoted $S.\text{map}(f)$). More precisely, this isomorphism is constructed by: 1. First composing $f$ with the inclusion homomorphism $S \hookrightarrow A$ to obtain an injective homomorphism $f \circ \text{val}_S \colon S \to B$. 2. Using the injectivity to create an isomorphism between $S$ and the range of $f \circ \text{val}_S$. 3. Observing that this range is equal to $S.\text{map}(f)$. The isomorphism preserves both the ring structure and the scalar multiplication by elements of $R$.
Subalgebra.coe_equivMapOfInjective_apply theorem
(x : S) : ↑(equivMapOfInjective S f hf x) = f x
Full source
@[simp]
theorem coe_equivMapOfInjective_apply (x : S) : ↑(equivMapOfInjective S f hf x) = f x := rfl
Image of Subalgebra Element under Isomorphism Equals Image under Homomorphism
Informal description
For any element $x$ in a subalgebra $S$ of an $R$-algebra $A$, and given an injective $R$-algebra homomorphism $f \colon A \to B$, the image of $x$ under the isomorphism $\text{equivMapOfInjective}(S, f, hf)$ (where $hf$ is the proof of injectivity of $f$) is equal to $f(x)$ when viewed as an element of $B$. In other words, if $\varphi \colon S \to S.\text{map}(f)$ is the isomorphism constructed by $\text{equivMapOfInjective}(S, f, hf)$, then for any $x \in S$, we have $\varphi(x) = f(x)$ in $B$.
Subalgebra.instSMulSubtypeMem instance
[SMul A α] (S : Subalgebra R A) : SMul S α
Full source
/-- The action by a subalgebra is the action by the underlying algebra. -/
instance [SMul A α] (S : Subalgebra R A) : SMul S α :=
  inferInstanceAs (SMul S.toSubsemiring α)
Scalar Multiplication Action Inherited by Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$ with a scalar multiplication action on a type $\alpha$, the subalgebra $S$ inherits a scalar multiplication action on $\alpha$ defined by $s \bullet a = (s : A) \bullet a$ for $s \in S$ and $a \in \alpha$.
Subalgebra.smul_def theorem
[SMul A α] {S : Subalgebra R A} (g : S) (m : α) : g • m = (g : A) • m
Full source
theorem smul_def [SMul A α] {S : Subalgebra R A} (g : S) (m : α) : g • m = (g : A) • m := rfl
Subalgebra Scalar Multiplication Definition: $g \bullet m = (g : A) \bullet m$
Informal description
For any subalgebra $S$ of an $R$-algebra $A$ with a scalar multiplication action on a type $\alpha$, the scalar multiplication of an element $g \in S$ on an element $m \in \alpha$ is equal to the scalar multiplication of $g$ (viewed as an element of $A$) on $m$, i.e., $g \bullet m = (g : A) \bullet m$.
Subalgebra.smulCommClass_left instance
[SMul A β] [SMul α β] [SMulCommClass A α β] (S : Subalgebra R A) : SMulCommClass S α β
Full source
instance smulCommClass_left [SMul A β] [SMul α β] [SMulCommClass A α β] (S : Subalgebra R A) :
    SMulCommClass S α β :=
  S.toSubsemiring.smulCommClass_left
Commutativity of Scalar Multiplication between Subalgebra and Another Action
Informal description
For any subalgebra $S$ of an $R$-algebra $A$ with scalar multiplication actions on a type $\beta$, if the scalar multiplications by $A$ and $\alpha$ on $\beta$ commute (i.e., $a \bullet (x \bullet b) = x \bullet (a \bullet b)$ for all $a \in A$, $x \in \alpha$, $b \in \beta$), then the scalar multiplications by $S$ and $\alpha$ on $\beta$ also commute. In other words, for any $s \in S$, $x \in \alpha$, and $b \in \beta$, we have $s \bullet (x \bullet b) = x \bullet (s \bullet b)$.
Subalgebra.smulCommClass_right instance
[SMul α β] [SMul A β] [SMulCommClass α A β] (S : Subalgebra R A) : SMulCommClass α S β
Full source
instance smulCommClass_right [SMul α β] [SMul A β] [SMulCommClass α A β] (S : Subalgebra R A) :
    SMulCommClass α S β :=
  S.toSubsemiring.smulCommClass_right
Commutativity of Scalar Multiplication between $\alpha$ and a Subalgebra of $A$ on $\beta$
Informal description
For any types $\alpha$ and $\beta$ with scalar multiplication actions by $A$ and $\alpha$ on $\beta$, if these actions commute (i.e., $a \bullet (x \bullet b) = x \bullet (a \bullet b)$ for all $a \in \alpha$, $x \in A$, $b \in \beta$), then for any subalgebra $S$ of $A$, the actions of $\alpha$ and $S$ on $\beta$ also commute. That is, $a \bullet (s \bullet b) = s \bullet (a \bullet b)$ for all $a \in \alpha$, $s \in S$, $b \in \beta$.
Subalgebra.isScalarTower_left instance
[SMul α β] [SMul A α] [SMul A β] [IsScalarTower A α β] (S : Subalgebra R A) : IsScalarTower S α β
Full source
/-- Note that this provides `IsScalarTower S R R` which is needed by `smul_mul_assoc`. -/
instance isScalarTower_left [SMul α β] [SMul A α] [SMul A β] [IsScalarTower A α β]
    (S : Subalgebra R A) : IsScalarTower S α β :=
  inferInstanceAs (IsScalarTower S.toSubsemiring α β)
Scalar Tower Property for Subalgebra Actions on Left
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, and types $\alpha$ and $\beta$ with scalar multiplication actions by $A$, if the actions of $A$ on $\alpha$ and $\beta$ form a scalar tower (i.e., $(a \cdot x) \cdot y = a \cdot (x \cdot y)$ for all $a \in A$, $x \in \alpha$, $y \in \beta$), then the actions of $S$ on $\alpha$ and $\beta$ also form a scalar tower. That is, for any $s \in S$, $x \in \alpha$, and $y \in \beta$, we have $(s \cdot x) \cdot y = s \cdot (x \cdot y)$.
Subalgebra.isScalarTower_mid instance
{R S T : Type*} [CommSemiring R] [Semiring S] [AddCommMonoid T] [Algebra R S] [Module R T] [Module S T] [IsScalarTower R S T] (S' : Subalgebra R S) : IsScalarTower R S' T
Full source
instance isScalarTower_mid {R S T : Type*} [CommSemiring R] [Semiring S] [AddCommMonoid T]
    [Algebra R S] [Module R T] [Module S T] [IsScalarTower R S T] (S' : Subalgebra R S) :
    IsScalarTower R S' T :=
  ⟨fun _x y _z => smul_assoc _ (y : S) _⟩
Scalar Tower Property for Subalgebras in the Middle Position
Informal description
For any commutative semiring $R$, semiring $S$, and additive commutative monoid $T$ with compatible $R$-algebra and module structures, if the scalar multiplications form a tower $R \to S \to T$, then for any subalgebra $S'$ of $S$, the scalar multiplications also form a tower $R \to S' \to T$.
Subalgebra.instFaithfulSMulSubtypeMem instance
[SMul A α] [FaithfulSMul A α] (S : Subalgebra R A) : FaithfulSMul S α
Full source
instance [SMul A α] [FaithfulSMul A α] (S : Subalgebra R A) : FaithfulSMul S α :=
  inferInstanceAs (FaithfulSMul S.toSubsemiring α)
Faithfulness of Scalar Multiplication Inherited by Subalgebras
Informal description
For any subalgebra $S$ of an $R$-algebra $A$ with a faithful scalar multiplication action on a type $\alpha$, the induced scalar multiplication action of $S$ on $\alpha$ is also faithful. That is, if distinct elements of $A$ act differently on $\alpha$, then distinct elements of $S$ also act differently on $\alpha$.
Subalgebra.instMulActionSubtypeMem instance
[MulAction A α] (S : Subalgebra R A) : MulAction S α
Full source
/-- The action by a subalgebra is the action by the underlying algebra. -/
instance [MulAction A α] (S : Subalgebra R A) : MulAction S α :=
  inferInstanceAs (MulAction S.toSubsemiring α)
Subalgebras Inherit Multiplicative Actions from Their Algebra
Informal description
For any commutative semiring $R$, $R$-algebra $A$, and type $\alpha$ with a multiplicative action by $A$, every subalgebra $S$ of $A$ inherits a multiplicative action on $\alpha$. This means that the action of $A$ on $\alpha$ restricts to an action of $S$ on $\alpha$ that preserves the multiplicative structure.
Subalgebra.instDistribMulActionSubtypeMem instance
[AddMonoid α] [DistribMulAction A α] (S : Subalgebra R A) : DistribMulAction S α
Full source
/-- The action by a subalgebra is the action by the underlying algebra. -/
instance [AddMonoid α] [DistribMulAction A α] (S : Subalgebra R A) : DistribMulAction S α :=
  inferInstanceAs (DistribMulAction S.toSubsemiring α)
Subalgebras Inherit Distributive Multiplicative Actions
Informal description
For any commutative semiring $R$, $R$-algebra $A$, additive monoid $\alpha$, and distributive multiplicative action of $A$ on $\alpha$, every subalgebra $S$ of $A$ inherits a distributive multiplicative action on $\alpha$. That is, for all $s \in S$ and $a, b \in \alpha$, we have $s \cdot (a + b) = s \cdot a + s \cdot b$ and $s \cdot 0 = 0$.
Subalgebra.instSMulWithZeroSubtypeMem instance
[Zero α] [SMulWithZero A α] (S : Subalgebra R A) : SMulWithZero S α
Full source
/-- The action by a subalgebra is the action by the underlying algebra. -/
instance [Zero α] [SMulWithZero A α] (S : Subalgebra R A) : SMulWithZero S α :=
  inferInstanceAs (SMulWithZero S.toSubsemiring α)
Subalgebras Inherit Scalar Multiplication with Zero from Their Algebra
Informal description
For any commutative semiring $R$, $R$-algebra $A$, and type $\alpha$ with a zero element and a scalar multiplication action by $A$ that respects zero, every subalgebra $S$ of $A$ inherits a scalar multiplication action on $\alpha$ that also respects zero. Specifically, if $r \cdot a = 0$ holds in $A$ whenever either $r = 0$ or $a = 0$, then the same property holds for the action of $S$ on $\alpha$.
Subalgebra.instMulActionWithZeroSubtypeMem instance
[Zero α] [MulActionWithZero A α] (S : Subalgebra R A) : MulActionWithZero S α
Full source
/-- The action by a subalgebra is the action by the underlying algebra. -/
instance [Zero α] [MulActionWithZero A α] (S : Subalgebra R A) : MulActionWithZero S α :=
  inferInstanceAs (MulActionWithZero S.toSubsemiring α)
Subalgebras Inherit Multiplicative Actions with Zero from Their Algebra
Informal description
For any commutative semiring $R$, $R$-algebra $A$, and type $\alpha$ with a zero element and a multiplicative action with zero by $A$, every subalgebra $S$ of $A$ inherits a multiplicative action with zero on $\alpha$. This means that the action of $S$ on $\alpha$ preserves the zero element and satisfies the properties of a multiplicative action with zero.
Subalgebra.moduleLeft instance
[AddCommMonoid α] [Module A α] (S : Subalgebra R A) : Module S α
Full source
/-- The action by a subalgebra is the action by the underlying algebra. -/
instance moduleLeft [AddCommMonoid α] [Module A α] (S : Subalgebra R A) : Module S α :=
  inferInstanceAs (Module S.toSubsemiring α)
Module Structure Induced by a Subalgebra
Informal description
For any commutative semiring $R$, $R$-algebra $A$, and additive commutative monoid $\alpha$ equipped with a module structure over $A$, every subalgebra $S$ of $A$ induces a module structure on $\alpha$ where the scalar multiplication is given by the restriction of the original scalar multiplication to $S$.
Subalgebra.toAlgebra instance
{R A : Type*} [CommSemiring R] [CommSemiring A] [Semiring α] [Algebra R A] [Algebra A α] (S : Subalgebra R A) : Algebra S α
Full source
/-- The action by a subalgebra is the action by the underlying algebra. -/
instance toAlgebra {R A : Type*} [CommSemiring R] [CommSemiring A] [Semiring α] [Algebra R A]
    [Algebra A α] (S : Subalgebra R A) : Algebra S α :=
  Algebra.ofSubsemiring S.toSubsemiring
Subalgebra Induces Algebra Structure
Informal description
For any commutative semiring $R$, commutative semiring $A$ equipped with an $R$-algebra structure, and semiring $\alpha$ equipped with an $A$-algebra structure, every subalgebra $S$ of $A$ induces an $S$-algebra structure on $\alpha$. This means that $\alpha$ can be viewed as an algebra over $S$ via the restriction of the $A$-algebra structure.
Subalgebra.algebraMap_eq theorem
{R A : Type*} [CommSemiring R] [CommSemiring A] [Semiring α] [Algebra R A] [Algebra A α] (S : Subalgebra R A) : algebraMap S α = (algebraMap A α).comp S.val
Full source
theorem algebraMap_eq {R A : Type*} [CommSemiring R] [CommSemiring A] [Semiring α] [Algebra R A]
    [Algebra A α] (S : Subalgebra R A) : algebraMap S α = (algebraMap A α).comp S.val :=
  rfl
Equality of Subalgebra Algebra Map and Composition
Informal description
Let $R$ be a commutative semiring, $A$ a commutative semiring with an $R$-algebra structure, and $\alpha$ a semiring with an $A$-algebra structure. For any subalgebra $S$ of $A$, the algebra map from $S$ to $\alpha$ is equal to the composition of the algebra map from $A$ to $\alpha$ with the inclusion homomorphism from $S$ to $A$. In other words, the following diagram commutes: $$\text{algebraMap}_{S\alpha} = \text{algebraMap}_{A\alpha} \circ \text{val}_S$$ where $\text{val}_S : S \hookrightarrow A$ is the inclusion map.
Subalgebra.rangeS_algebraMap theorem
{R A : Type*} [CommSemiring R] [CommSemiring A] [Algebra R A] (S : Subalgebra R A) : (algebraMap S A).rangeS = S.toSubsemiring
Full source
@[simp]
theorem rangeS_algebraMap {R A : Type*} [CommSemiring R] [CommSemiring A] [Algebra R A]
    (S : Subalgebra R A) : (algebraMap S A).rangeS = S.toSubsemiring := by
  rw [algebraMap_eq, Algebra.id.map_eq_id, RingHom.id_comp, ← toSubsemiring_subtype,
    Subsemiring.rangeS_subtype]
Range of Subalgebra Algebra Map Equals Underlying Subsemiring
Informal description
For any commutative semirings $R$ and $A$ with an $R$-algebra structure on $A$, and for any subalgebra $S$ of $A$, the range of the algebra map from $S$ to $A$ is equal to the underlying subsemiring of $S$. That is, $\text{rangeS}(\text{algebraMap}_{S A}) = S.\text{toSubsemiring}$.
Subalgebra.range_algebraMap theorem
{R A : Type*} [CommRing R] [CommRing A] [Algebra R A] (S : Subalgebra R A) : (algebraMap S A).range = S.toSubring
Full source
@[simp]
theorem range_algebraMap {R A : Type*} [CommRing R] [CommRing A] [Algebra R A]
    (S : Subalgebra R A) : (algebraMap S A).range = S.toSubring := by
  rw [algebraMap_eq, Algebra.id.map_eq_id, RingHom.id_comp, ← toSubring_subtype,
    Subring.range_subtype]
Range of Subalgebra Inclusion Equals Underlying Subring
Informal description
For any commutative rings $R$ and $A$ with an $R$-algebra structure, and any subalgebra $S$ of $A$, the range of the algebra homomorphism from $S$ to $A$ is equal to $S$ viewed as a subring of $A$.
Subalgebra.noZeroSMulDivisors_top instance
[NoZeroDivisors A] (S : Subalgebra R A) : NoZeroSMulDivisors S A
Full source
instance noZeroSMulDivisors_top [NoZeroDivisors A] (S : Subalgebra R A) : NoZeroSMulDivisors S A :=
  ⟨fun {c} x h =>
    have : (c : A) = 0 ∨ x = 0 := eq_zero_or_eq_zero_of_mul_eq_zero h
    this.imp_left (@Subtype.ext_iff _ _ c 0).mpr⟩
No Zero Divisors in Scalar Multiplication by Subalgebras
Informal description
For any subalgebra $S$ of an $R$-algebra $A$ where $A$ has no zero divisors, the scalar multiplication action of $S$ on $A$ has no zero divisors. That is, for any $s \in S$ and $a \in A$, if $s \cdot a = 0$, then either $s = 0$ or $a = 0$.
Set.algebraMap_mem_center theorem
(r : R) : algebraMap R A r ∈ Set.center A
Full source
theorem _root_.Set.algebraMap_mem_center (r : R) : algebraMapalgebraMap R A r ∈ Set.center A := by
  simp only [Semigroup.mem_center_iff, commutes, forall_const]
Algebra Maps Send Elements to the Center
Informal description
For any commutative semiring $R$ and semiring $A$ with an algebra structure over $R$, the image of any element $r \in R$ under the algebra map $\text{algebraMap} : R \to A$ lies in the center of $A$, i.e., $\text{algebraMap}(r) \in Z(A)$ where $Z(A)$ denotes the center of $A$.
Subalgebra.center definition
: Subalgebra R A
Full source
/-- The center of an algebra is the set of elements which commute with every element. They form a
subalgebra. -/
@[simps! coe toSubsemiring]
def center : Subalgebra R A :=
  { Subsemiring.center A with algebraMap_mem' := Set.algebraMap_mem_center }
Center of an algebra
Informal description
The center of an $R$-algebra $A$ is the subalgebra consisting of all elements of $A$ that commute with every element of $A$. More precisely, given a commutative semiring $R$ and a semiring $A$ equipped with an $R$-algebra structure, the center is the subset $Z(A) \subseteq A$ where: 1. $Z(A)$ is a subsemiring of $A$ (closed under addition, multiplication, and contains $0$ and $1$). 2. $Z(A)$ contains the image of the algebra map $R \to A$. 3. Every element $z \in Z(A)$ satisfies $z \cdot a = a \cdot z$ for all $a \in A$.
Subalgebra.center_toSubring theorem
(R A : Type*) [CommRing R] [Ring A] [Algebra R A] : (center R A).toSubring = Subring.center A
Full source
@[simp]
theorem center_toSubring (R A : Type*) [CommRing R] [Ring A] [Algebra R A] :
    (center R A).toSubring = Subring.center A :=
  rfl
Equality of Center Subalgebra and Center Subring in an Algebra
Informal description
For a commutative ring $R$ and a ring $A$ equipped with an $R$-algebra structure, the subring obtained from the center subalgebra of $A$ is equal to the center subring of $A$. That is, if $Z(A)$ denotes the center of $A$ as a subalgebra, then $Z(A)$ viewed as a subring is exactly the center of $A$ as a subring.
Subalgebra.instCommSemiringSubtypeMemCenter instance
: CommSemiring (center R A)
Full source
instance : CommSemiring (center R A) :=
  inferInstanceAs (CommSemiring (Subsemiring.center A))
Commutative Semiring Structure on the Center of an Algebra
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the center of $A$ (the subalgebra consisting of all elements that commute with every element of $A$) forms a commutative semiring under the operations inherited from $A$.
Subalgebra.instCommRingSubtypeMemCenter instance
{A : Type*} [Ring A] [Algebra R A] : CommRing (center R A)
Full source
instance {A : Type*} [Ring A] [Algebra R A] : CommRing (center R A) :=
  inferInstanceAs (CommRing (Subring.center A))
The Center of an Algebra is a Commutative Ring
Informal description
For any ring $A$ with an algebra structure over a commutative semiring $R$, the center of $A$ (the subalgebra consisting of all elements that commute with every element of $A$) forms a commutative ring under the operations inherited from $A$.
Subalgebra.mem_center_iff theorem
{a : A} : a ∈ center R A ↔ ∀ b : A, b * a = a * b
Full source
theorem mem_center_iff {a : A} : a ∈ center R Aa ∈ center R A ↔ ∀ b : A, b * a = a * b :=
  Subsemigroup.mem_center_iff
Characterization of Central Elements in an Algebra: $a \in Z(A) \leftrightarrow \forall b \in A, b * a = a * b$
Informal description
An element $a$ of an $R$-algebra $A$ belongs to the center of $A$ if and only if it commutes with every element $b \in A$, i.e., $b * a = a * b$ for all $b \in A$.
Set.algebraMap_mem_centralizer theorem
{s : Set A} (r : R) : algebraMap R A r ∈ s.centralizer
Full source
@[simp]
theorem _root_.Set.algebraMap_mem_centralizer {s : Set A} (r : R) :
    algebraMapalgebraMap R A r ∈ s.centralizer :=
  fun _a _h => (Algebra.commutes _ _).symm
Algebra Map Elements Centralize Subsets
Informal description
For any subset $s$ of a ring $A$ with an algebra structure over a commutative semiring $R$, and for any element $r \in R$, the image of $r$ under the algebra map $\text{algebraMap}_R A$ belongs to the centralizer of $s$ in $A$.
Subalgebra.centralizer definition
(s : Set A) : Subalgebra R A
Full source
/-- The centralizer of a set as a subalgebra. -/
def centralizer (s : Set A) : Subalgebra R A :=
  { Subsemiring.centralizer s with algebraMap_mem' := Set.algebraMap_mem_centralizer }
Centralizer subalgebra of a set in an $R$-algebra
Informal description
The centralizer of a subset $s$ in an $R$-algebra $A$ is the subalgebra consisting of all elements $z \in A$ that commute with every element of $s$, i.e., $g * z = z * g$ for all $g \in s$. It inherits the structure of a subalgebra from the underlying subsemiring centralizer and contains the image of the algebra map from $R$ to $A$.
Subalgebra.coe_centralizer theorem
(s : Set A) : (centralizer R s : Set A) = s.centralizer
Full source
@[simp, norm_cast]
theorem coe_centralizer (s : Set A) : (centralizer R s : Set A) = s.centralizer :=
  rfl
Equality of Centralizer Subalgebra and Set Centralizer
Informal description
For any subset $s$ of an $R$-algebra $A$, the underlying set of the centralizer subalgebra $\text{centralizer}_R(s)$ is equal to the centralizer of $s$ in $A$ as a set, i.e., $\text{centralizer}_R(s) = \{z \in A \mid \forall g \in s, g * z = z * g\}$.
Subalgebra.mem_centralizer_iff theorem
{s : Set A} {z : A} : z ∈ centralizer R s ↔ ∀ g ∈ s, g * z = z * g
Full source
theorem mem_centralizer_iff {s : Set A} {z : A} : z ∈ centralizer R sz ∈ centralizer R s ↔ ∀ g ∈ s, g * z = z * g :=
  Iff.rfl
Characterization of Centralizer Subalgebra Elements: $z \in \text{centralizer}(s) \leftrightarrow \forall g \in s, gz = zg$
Informal description
Let $R$ be a commutative semiring and $A$ be an $R$-algebra. For any subset $s \subseteq A$ and any element $z \in A$, we have $z$ belongs to the centralizer subalgebra of $s$ if and only if $z$ commutes with every element of $s$, i.e., $g \cdot z = z \cdot g$ for all $g \in s$.
Subalgebra.center_le_centralizer theorem
(s) : center R A ≤ centralizer R s
Full source
theorem center_le_centralizer (s) : center R A ≤ centralizer R s :=
  s.center_subset_centralizer
Center is Contained in Centralizer for Subalgebras
Informal description
For any subset $s$ of an $R$-algebra $A$, the center of $A$ is contained in the centralizer of $s$, i.e., $Z(A) \subseteq C_A(s)$ where: - $Z(A)$ denotes the center of $A$ (elements commuting with all of $A$) - $C_A(s)$ denotes the centralizer of $s$ (elements commuting with every element of $s$)
Subalgebra.centralizer_le theorem
(s t : Set A) (h : s ⊆ t) : centralizer R t ≤ centralizer R s
Full source
theorem centralizer_le (s t : Set A) (h : s ⊆ t) : centralizer R t ≤ centralizer R s :=
  Set.centralizer_subset h
Centralizer Subalgebra Antimonotonicity: $s \subseteq t$ implies $C_A(t) \subseteq C_A(s)$
Informal description
For any subsets $s$ and $t$ of an $R$-algebra $A$, if $s \subseteq t$, then the centralizer subalgebra of $t$ is contained in the centralizer subalgebra of $s$, i.e., $C_A(t) \subseteq C_A(s)$.
Subalgebra.centralizer_univ theorem
: centralizer R Set.univ = center R A
Full source
@[simp]
theorem centralizer_univ : centralizer R Set.univ = center R A :=
  SetLike.ext' (Set.centralizer_univ A)
Centralizer of Entire Algebra Equals Its Center
Informal description
For any commutative semiring $R$ and $R$-algebra $A$, the centralizer of the entire algebra $A$ (i.e., the set of all elements commuting with every element of $A$) equals the center of $A$, i.e., $C_A(A) = Z(A)$.
Subalgebra.le_centralizer_centralizer theorem
{s : Subalgebra R A} : s ≤ centralizer R (centralizer R (s : Set A))
Full source
lemma le_centralizer_centralizer {s : Subalgebra R A} :
    s ≤ centralizer R (centralizer R (s : Set A)) :=
  Set.subset_centralizer_centralizer
Subalgebra Inclusion in Double Centralizer
Informal description
For any subalgebra $s$ of an $R$-algebra $A$, the subalgebra $s$ is contained in the centralizer of its own centralizer, i.e., $s \subseteq \text{centralizer}(\text{centralizer}(s))$.
Subalgebra.centralizer_centralizer_centralizer theorem
{s : Set A} : centralizer R s.centralizer.centralizer = centralizer R s
Full source
@[simp]
lemma centralizer_centralizer_centralizer {s : Set A} :
    centralizer R s.centralizer.centralizer = centralizer R s := by
  apply SetLike.coe_injective
  simp only [coe_centralizer, Set.centralizer_centralizer_centralizer]
Triple Centralizer Identity for Subalgebras: $\text{centralizer}^3(s) = \text{centralizer}(s)$
Informal description
For any subset $s$ of an $R$-algebra $A$, the centralizer of the centralizer of the centralizer of $s$ is equal to the centralizer of $s$, i.e., $\text{centralizer}_R(\text{centralizer}_R(\text{centralizer}_R(s))) = \text{centralizer}_R(s)$.
subalgebraOfSubsemiring definition
(S : Subsemiring R) : Subalgebra ℕ R
Full source
/-- A subsemiring is an `ℕ`-subalgebra. -/
@[simps toSubsemiring]
def subalgebraOfSubsemiring (S : Subsemiring R) : Subalgebra  R :=
  { S with algebraMap_mem' := fun i => natCast_mem S i }
Subsemiring as $\mathbb{N}$-subalgebra
Informal description
Given a subsemiring $S$ of a semiring $R$, the function `subalgebraOfSubsemiring` constructs an $\mathbb{N}$-subalgebra of $R$ whose underlying set is $S$. This construction ensures that the subalgebra contains the image of the canonical algebra map $\mathbb{N} \to R$ (i.e., all natural number multiples of $1_R$). More precisely, for any subsemiring $S$ of $R$, the $\mathbb{N}$-subalgebra `subalgebraOfSubsemiring S` consists of all elements of $S$, and it satisfies: 1. $0 \in S$ (from subsemiring property) 2. $1 \in S$ (from subsemiring property) 3. Closed under addition (from subsemiring property) 4. Closed under multiplication (from subsemiring property) 5. Contains all natural number scalars (via the algebra map $\mathbb{N} \to R$)
mem_subalgebraOfSubsemiring theorem
{x : R} {S : Subsemiring R} : x ∈ subalgebraOfSubsemiring S ↔ x ∈ S
Full source
@[simp]
theorem mem_subalgebraOfSubsemiring {x : R} {S : Subsemiring R} :
    x ∈ subalgebraOfSubsemiring Sx ∈ subalgebraOfSubsemiring S ↔ x ∈ S :=
  Iff.rfl
Membership in $\mathbb{N}$-subalgebra generated from a subsemiring
Informal description
For any element $x$ in a semiring $R$ and any subsemiring $S$ of $R$, the element $x$ belongs to the $\mathbb{N}$-subalgebra generated from $S$ if and only if $x$ belongs to $S$.
subalgebraOfSubring definition
(S : Subring R) : Subalgebra ℤ R
Full source
/-- A subring is a `ℤ`-subalgebra. -/
@[simps toSubsemiring]
def subalgebraOfSubring (S : Subring R) : Subalgebra  R :=
  { S with
    algebraMap_mem' := fun i =>
      Int.induction_on i (by simpa using S.zero_mem)
        (fun i ih => by simpa using S.add_mem ih S.one_mem) fun i ih =>
        show ((-i - 1 : ℤ) : R) ∈ S by
          rw [Int.cast_sub, Int.cast_one]
          exact S.sub_mem ih S.one_mem }
Subring as $\mathbb{Z}$-subalgebra
Informal description
Given a subring $S$ of a ring $R$, the function `subalgebraOfSubring` constructs a $\mathbb{Z}$-subalgebra of $R$ whose underlying set is $S$. This construction ensures that the subalgebra contains the image of the canonical algebra map $\mathbb{Z} \to R$ (i.e., all integer multiples of $1_R$). More precisely, for any subring $S$ of $R$, the $\mathbb{Z}$-subalgebra `subalgebraOfSubring S` consists of all elements of $S$, and it satisfies: 1. $0 \in S$ (from subring property) 2. $1 \in S$ (from subring property) 3. Closed under addition (from subring property) 4. Closed under additive inverses (from subring property) 5. Contains all integer scalars (via the algebra map $\mathbb{Z} \to R$)
mem_subalgebraOfSubring theorem
{x : R} {S : Subring R} : x ∈ subalgebraOfSubring S ↔ x ∈ S
Full source
@[simp]
theorem mem_subalgebraOfSubring {x : R} {S : Subring R} : x ∈ subalgebraOfSubring Sx ∈ subalgebraOfSubring S ↔ x ∈ S :=
  Iff.rfl
Membership in $\mathbb{Z}$-subalgebra generated from a subring
Informal description
For any element $x$ in a ring $R$ and any subring $S$ of $R$, the element $x$ belongs to the $\mathbb{Z}$-subalgebra generated from $S$ if and only if $x$ belongs to $S$.
AlgHom.equalizer definition
(ϕ ψ : F) [FunLike F A B] [AlgHomClass F R A B] : Subalgebra R A
Full source
/-- The equalizer of two R-algebra homomorphisms -/
@[simps coe toSubsemiring]
def equalizer (ϕ ψ : F) [FunLike F A B] [AlgHomClass F R A B] : Subalgebra R A where
  carrier := { a | ϕ a = ψ a }
  zero_mem' := by simp only [Set.mem_setOf_eq, map_zero]
  one_mem' := by simp only [Set.mem_setOf_eq, map_one]
  add_mem' {x y} (hx : ϕ x = ψ x) (hy : ϕ y = ψ y) := by
    rw [Set.mem_setOf_eq, map_add, map_add, hx, hy]
  mul_mem' {x y} (hx : ϕ x = ψ x) (hy : ϕ y = ψ y) := by
    rw [Set.mem_setOf_eq, map_mul, map_mul, hx, hy]
  algebraMap_mem' x := by
    simp only [Set.mem_setOf_eq, AlgHomClass.commutes]
Equalizer of $R$-algebra homomorphisms
Informal description
Given two $R$-algebra homomorphisms $\phi, \psi : A \to B$, the equalizer $\text{equalizer}(\phi, \psi)$ is the subalgebra of $A$ consisting of all elements $a \in A$ such that $\phi(a) = \psi(a)$. More precisely, the equalizer is defined as the subset $\{a \in A \mid \phi(a) = \psi(a)\}$ equipped with the inherited algebraic structure from $A$, which forms a subalgebra. This means: 1. It contains $0$ and $1$ (since $\phi(0) = \psi(0)$ and $\phi(1) = \psi(1)$). 2. It is closed under addition and multiplication (if $\phi(x) = \psi(x)$ and $\phi(y) = \psi(y)$, then $\phi(x + y) = \psi(x + y)$ and $\phi(xy) = \psi(xy)$). 3. It is closed under the action of $R$ (for any $r \in R$, $\phi(r \cdot a) = r \cdot \phi(a) = r \cdot \psi(a) = \psi(r \cdot a)$).
AlgHom.mem_equalizer theorem
(φ ψ : F) (x : A) : x ∈ equalizer φ ψ ↔ φ x = ψ x
Full source
@[simp]
theorem mem_equalizer (φ ψ : F) (x : A) : x ∈ equalizer φ ψx ∈ equalizer φ ψ ↔ φ x = ψ x :=
  Iff.rfl
Characterization of Equalizer Subalgebra Membership: $x \in \text{equalizer}(\phi, \psi) \leftrightarrow \phi(x) = \psi(x)$
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 an element $x \in A$, we have $x$ belongs to the equalizer subalgebra of $\phi$ and $\psi$ if and only if $\phi(x) = \psi(x)$.
AlgHom.equalizer_toSubmodule theorem
{φ ψ : F} : Subalgebra.toSubmodule (equalizer φ ψ) = LinearMap.eqLocus φ ψ
Full source
theorem equalizer_toSubmodule {φ ψ : F} :
    Subalgebra.toSubmodule (equalizer φ ψ) = LinearMap.eqLocus φ ψ := rfl
Equality of Submodule Structures for Algebra Homomorphism Equalizers
Informal description
For any two $R$-algebra homomorphisms $\phi, \psi \colon A \to B$, the submodule obtained from the equalizer subalgebra $\text{equalizer}(\phi, \psi)$ via the canonical order embedding is equal to the equalizer submodule $\text{eqLocus}(\phi, \psi)$ of the underlying linear maps.
AlgHom.le_equalizer theorem
{φ ψ : F} {S : Subalgebra R A} : S ≤ equalizer φ ψ ↔ Set.EqOn φ ψ S
Full source
theorem le_equalizer {φ ψ : F} {S : Subalgebra R A} : S ≤ equalizer φ ψ ↔ Set.EqOn φ ψ S := Iff.rfl
Subalgebra Containment in Equalizer is Equivalent to Function Agreement on Subalgebra
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 a subalgebra $S$ of $A$, the subalgebra $S$ is contained in the equalizer of $\phi$ and $\psi$ if and only if $\phi$ and $\psi$ agree on all elements of $S$, i.e., $\phi(s) = \psi(s)$ for every $s \in S$.
Subalgebra.comap_map_eq_self_of_injective theorem
{f : A →ₐ[R] B} (hf : Function.Injective f) (S : Subalgebra R A) : (S.map f).comap f = S
Full source
theorem comap_map_eq_self_of_injective
    {f : A →ₐ[R] B} (hf : Function.Injective f) (S : Subalgebra R A) : (S.map f).comap f = S :=
  SetLike.coe_injective (Set.preimage_image_eq _ hf)
Preimage-Image Equality for Subalgebras under Injective Algebra Homomorphisms
Informal description
Let $R$ be a commutative semiring and $A$, $B$ be $R$-algebras. Given an injective $R$-algebra homomorphism $f \colon A \to B$ and a subalgebra $S$ of $A$, the preimage of the image of $S$ under $f$ equals $S$ itself, i.e., $f^{-1}(f(S)) = S$.
NonUnitalSubalgebra.toSubalgebra definition
(S : NonUnitalSubalgebra R A) (h1 : (1 : A) ∈ S) : Subalgebra R A
Full source
/-- Turn a non-unital subalgebra containing `1` into a subalgebra. -/
def NonUnitalSubalgebra.toSubalgebra (S : NonUnitalSubalgebra R A) (h1 : (1 : A) ∈ S) :
    Subalgebra R A :=
  { S with
    one_mem' := h1
    algebraMap_mem' := fun r =>
      (Algebra.algebraMap_eq_smul_one (R := R) (A := A) r).symmSMulMemClass.smul_mem r h1 }
Subalgebra structure from a non-unital subalgebra containing 1
Informal description
Given a non-unital subalgebra $S$ of an $R$-algebra $A$ that contains the multiplicative identity $1$, the function `NonUnitalSubalgebra.toSubalgebra` constructs a subalgebra structure on $S$. This is done by extending the non-unital subalgebra structure with the condition that $1 \in S$ and ensuring that $S$ is closed under the algebra map $R \to A$ (i.e., for any $r \in R$, the element $r \cdot 1$ is in $S$).
Subalgebra.toNonUnitalSubalgebra_toSubalgebra theorem
(S : Subalgebra R A) : S.toNonUnitalSubalgebra.toSubalgebra S.one_mem = S
Full source
lemma Subalgebra.toNonUnitalSubalgebra_toSubalgebra (S : Subalgebra R A) :
    S.toNonUnitalSubalgebra.toSubalgebra S.one_mem = S := by cases S; rfl
Subalgebra Reconstruction via Non-Unital Subalgebra
Informal description
For any subalgebra $S$ of an $R$-algebra $A$, the subalgebra obtained by first converting $S$ to a non-unital subalgebra and then back to a subalgebra (using the fact that $1 \in S$) is equal to $S$ itself.
NonUnitalSubalgebra.toSubalgebra_toNonUnitalSubalgebra theorem
(S : NonUnitalSubalgebra R A) (h1 : (1 : A) ∈ S) : (NonUnitalSubalgebra.toSubalgebra S h1).toNonUnitalSubalgebra = S
Full source
lemma NonUnitalSubalgebra.toSubalgebra_toNonUnitalSubalgebra (S : NonUnitalSubalgebra R A)
    (h1 : (1 : A) ∈ S) : (NonUnitalSubalgebra.toSubalgebra S h1).toNonUnitalSubalgebra = S := by
  cases S; rfl
Subalgebra Reconstruction from Non-Unital Subalgebra via Unit Inclusion
Informal description
Let $R$ be a commutative semiring and $A$ be a non-unital non-associative semiring equipped with an $R$-module structure. For any non-unital subalgebra $S$ of $A$ that contains the multiplicative identity $1$, the non-unital subalgebra obtained by forgetting the unit in the subalgebra constructed from $S$ is equal to $S$ itself.