doc-next-gen

Mathlib.Algebra.Algebra.NonUnitalSubalgebra

Module docstring

{"# Non-unital Subalgebras over Commutative Semirings

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

TODO

  • once we have scalar actions by semigroups (as opposed to monoids), implement the action of a non-unital subalgebra on the larger algebra. ","NonUnitalSubalgebras inherit structure from their NonUnitalSubsemiring / Semiring coercions. ","### NonUnitalSubalgebras inherit structure from their Submodule coercions. "}
NonUnitalSubalgebraClass.subtype definition
(s : S) : s →ₙₐ[R] A
Full source
/-- Embedding of a non-unital subalgebra into the non-unital algebra. -/
def subtype (s : S) : s →ₙₐ[R] A :=
  { NonUnitalSubsemiringClass.subtype s, SMulMemClass.subtype s with toFun := (↑) }
Inclusion homomorphism of a non-unital subalgebra
Informal description
The canonical embedding of a non-unital subalgebra $s$ of a non-unital algebra $A$ over a commutative semiring $R$ into $A$. This is a non-unital algebra homomorphism that maps each element of $s$ to itself in $A$, preserving both the ring operations and the scalar multiplication by elements of $R$.
NonUnitalSubalgebraClass.subtype_apply theorem
(x : s) : subtype s x = x
Full source
@[simp]
lemma subtype_apply (x : s) : subtype s x = x := rfl
Inclusion Homomorphism Acts as Identity on Elements of Non-Unital Subalgebra
Informal description
For any element $x$ in a non-unital subalgebra $s$ of a non-unital algebra $A$ over a commutative semiring $R$, the inclusion homomorphism $\text{subtype}(s)$ maps $x$ to itself, i.e., $\text{subtype}(s)(x) = x$.
NonUnitalSubalgebraClass.subtype_injective theorem
: Function.Injective (subtype s)
Full source
lemma subtype_injective :
    Function.Injective (subtype s) :=
  Subtype.coe_injective
Injectivity of Non-unital Subalgebra Inclusion
Informal description
The inclusion homomorphism from a non-unital subalgebra $s$ to its ambient algebra $A$ is injective. That is, if two elements of $s$ are equal in $A$, then they are equal in $s$.
NonUnitalSubalgebraClass.coe_subtype theorem
: (subtype s : s → A) = ((↑) : s → A)
Full source
@[simp]
theorem coe_subtype : (subtype s : s → A) = ((↑) : s → A) :=
  rfl
Commutativity of Subalgebra Inclusion and Coercion
Informal description
For a non-unital subalgebra $s$ of a non-unital algebra $A$ over a commutative semiring $R$, the inclusion homomorphism $\text{subtype}(s)$ from $s$ to $A$ coincides with the canonical coercion map from $s$ to $A$. In other words, the diagram \[ \begin{tikzcd} s \arrow[r, "\text{subtype}(s)"] \arrow[dr, "\text{coerce}"'] & A \\ & A \end{tikzcd} \] commutes, where both paths represent the same map that sends an element of $s$ to itself as an element of $A$.
NonUnitalSubalgebra structure
(R : Type u) (A : Type v) [CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A] : Type v extends NonUnitalSubsemiring A, Submodule R A
Full source
/-- A non-unital subalgebra is a sub(semi)ring that is also a submodule. -/
structure NonUnitalSubalgebra (R : Type u) (A : Type v) [CommSemiring R]
    [NonUnitalNonAssocSemiring A] [Module R A] : Type v
    extends NonUnitalSubsemiring A, Submodule R A
Non-unital subalgebra
Informal description
A non-unital subalgebra over a commutative semiring $R$ is a subset of a non-unital non-associative semiring $A$ that is simultaneously a non-unital subsemiring (closed under addition and multiplication) and a submodule (closed under scalar multiplication by elements of $R$).
NonUnitalSubalgebra.instSetLike instance
: SetLike (NonUnitalSubalgebra R A) A
Full source
instance : SetLike (NonUnitalSubalgebra 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 for Non-unital Subalgebras
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, the type of non-unital subalgebras of $A$ forms a set-like structure where elements can be treated as subsets of $A$.
NonUnitalSubalgebra.ofClass definition
{S R A : Type*} [CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A] [SetLike S A] [NonUnitalSubsemiringClass S A] [SMulMemClass S R A] (s : S) : NonUnitalSubalgebra R A
Full source
/-- The actual `NonUnitalSubalgebra` obtained from an element of a type satisfying
`NonUnitalSubsemiringClass` and `SMulMemClass`. -/
@[simps]
def ofClass {S R A : Type*} [CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A]
    [SetLike S A] [NonUnitalSubsemiringClass S A] [SMulMemClass S R A]
    (s : S) : NonUnitalSubalgebra R A where
  carrier := s
  add_mem' := add_mem
  zero_mem' := zero_mem _
  mul_mem' := mul_mem
  smul_mem' := SMulMemClass.smul_mem
Construction of non-unital subalgebra from a closed subset
Informal description
Given a commutative semiring $R$, a non-unital non-associative semiring $A$ equipped with a module structure over $R$, and a type $S$ representing subsets of $A$ that form a `NonUnitalSubsemiringClass` and are closed under scalar multiplication (`SMulMemClass`), the function `NonUnitalSubalgebra.ofClass` constructs a non-unital subalgebra from an element $s$ of $S$. The resulting subalgebra has: - Carrier set equal to $s$ - Closure under addition (inherited from `NonUnitalSubsemiringClass`) - Contains the zero element (inherited from `NonUnitalSubsemiringClass`) - Closure under multiplication (inherited from `NonUnitalSubsemiringClass`) - Closure under scalar multiplication by elements of $R$ (from `SMulMemClass`)
NonUnitalSubalgebra.instCanLiftSetCoeAndMemOfNatForallForallForallForallHAddForallForallForallForallHMulForallForallForallHSMul instance
: CanLift (Set A) (NonUnitalSubalgebra R A) (↑) (fun s ↦ 0 ∈ s ∧ (∀ {x y}, x ∈ s → y ∈ s → x + y ∈ s) ∧ (∀ {x y}, x ∈ s → y ∈ s → x * y ∈ s) ∧ ∀ (r : R) {x}, x ∈ s → r • x ∈ s)
Full source
instance (priority := 100) : CanLift (Set A) (NonUnitalSubalgebra R A) (↑)
    (fun s ↦ 0 ∈ s0 ∈ s ∧ (∀ {x y}, x ∈ s → y ∈ s → x + y ∈ s) ∧ (∀ {x y}, x ∈ s → y ∈ s → x * y ∈ s) ∧
      ∀ (r : R) {x}, x ∈ s → r • x ∈ s) where
  prf s h :=
    ⟨ { carrier := s
        zero_mem' := h.1
        add_mem' := h.2.1
        mul_mem' := h.2.2.1
        smul_mem' := h.2.2.2 },
      rfl ⟩
Lifting Condition for Non-unital Subalgebras
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, a subset $s$ of $A$ can be lifted to a non-unital subalgebra if and only if $s$ contains $0$, is closed under addition and multiplication, and is closed under scalar multiplication by elements of $R$.
NonUnitalSubalgebra.instNonUnitalSubsemiringClass instance
: NonUnitalSubsemiringClass (NonUnitalSubalgebra R A) A
Full source
instance instNonUnitalSubsemiringClass :
    NonUnitalSubsemiringClass (NonUnitalSubalgebra R A) A where
  add_mem {s} := s.add_mem'
  mul_mem {s} := s.mul_mem'
  zero_mem {s} := s.zero_mem'
Non-unital Subalgebras as Non-unital Subsemirings
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, the collection of non-unital subalgebras of $A$ forms a class of non-unital subsemirings. This means every non-unital subalgebra is closed under addition and multiplication, contains the additive identity, and is closed under scalar multiplication by elements of $R$.
NonUnitalSubalgebra.instSMulMemClass instance
: SMulMemClass (NonUnitalSubalgebra R A) R A
Full source
instance instSMulMemClass : SMulMemClass (NonUnitalSubalgebra R A) R A where
  smul_mem := @fun s => s.smul_mem'
Non-unital Subalgebras are Closed under Scalar Multiplication
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, the collection of non-unital subalgebras of $A$ forms a class of subsets closed under scalar multiplication by elements of $R$.
NonUnitalSubalgebra.mem_carrier theorem
{s : NonUnitalSubalgebra R A} {x : A} : x ∈ s.carrier ↔ x ∈ s
Full source
theorem mem_carrier {s : NonUnitalSubalgebra R A} {x : A} : x ∈ s.carrierx ∈ s.carrier ↔ x ∈ s :=
  Iff.rfl
Equivalence of Membership in Non-unital Subalgebra and its Carrier Set
Informal description
For any non-unital subalgebra $s$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, and for any element $x \in A$, we have $x \in s.\mathrm{carrier}$ if and only if $x \in s$.
NonUnitalSubalgebra.ext theorem
{S T : NonUnitalSubalgebra R A} (h : ∀ x : A, x ∈ S ↔ x ∈ T) : S = T
Full source
@[ext]
theorem ext {S T : NonUnitalSubalgebra R A} (h : ∀ x : A, x ∈ Sx ∈ S ↔ x ∈ T) : S = T :=
  SetLike.ext h
Extensionality of Non-unital Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ be a non-unital non-associative semiring equipped with a module structure over $R$. For any two non-unital 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$.
NonUnitalSubalgebra.mem_toNonUnitalSubsemiring theorem
{S : NonUnitalSubalgebra R A} {x} : x ∈ S.toNonUnitalSubsemiring ↔ x ∈ S
Full source
@[simp]
theorem mem_toNonUnitalSubsemiring {S : NonUnitalSubalgebra R A} {x} :
    x ∈ S.toNonUnitalSubsemiringx ∈ S.toNonUnitalSubsemiring ↔ x ∈ S :=
  Iff.rfl
Membership in Non-unital Subalgebra and its Subsemiring Coincide
Informal description
For any non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, and for any element $x \in A$, the element $x$ belongs to the underlying non-unital subsemiring of $S$ if and only if $x$ belongs to $S$ itself.
NonUnitalSubalgebra.coe_toNonUnitalSubsemiring theorem
(S : NonUnitalSubalgebra R A) : (↑S.toNonUnitalSubsemiring : Set A) = S
Full source
@[simp]
theorem coe_toNonUnitalSubsemiring (S : NonUnitalSubalgebra R A) :
    (↑S.toNonUnitalSubsemiring : Set A) = S :=
  rfl
Equality of Non-unital Subalgebra and its Subsemiring Carrier Set
Informal description
For any non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure over $R$, the underlying set of the associated non-unital subsemiring of $S$ is equal to $S$ itself as a set.
NonUnitalSubalgebra.toNonUnitalSubsemiring_injective theorem
: Function.Injective (toNonUnitalSubsemiring : NonUnitalSubalgebra R A → NonUnitalSubsemiring A)
Full source
theorem toNonUnitalSubsemiring_injective :
    Function.Injective
      (toNonUnitalSubsemiring : NonUnitalSubalgebra R A → NonUnitalSubsemiring A) :=
  fun S T h =>
  ext fun x => by rw [← mem_toNonUnitalSubsemiring, ← mem_toNonUnitalSubsemiring, h]
Injectivity of the Non-unital Subalgebra to Subsemiring Map
Informal description
The function that maps a non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ to its underlying non-unital subsemiring is injective. That is, if two non-unital subalgebras $S$ and $T$ have the same underlying non-unital subsemiring, then $S = T$.
NonUnitalSubalgebra.toNonUnitalSubsemiring_inj theorem
{S U : NonUnitalSubalgebra R A} : S.toNonUnitalSubsemiring = U.toNonUnitalSubsemiring ↔ S = U
Full source
theorem toNonUnitalSubsemiring_inj {S U : NonUnitalSubalgebra R A} :
    S.toNonUnitalSubsemiring = U.toNonUnitalSubsemiring ↔ S = U :=
  toNonUnitalSubsemiring_injective.eq_iff
Equality of Non-unital Subalgebras via Subsemiring Structure
Informal description
For any two non-unital subalgebras $S$ and $U$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure over $R$, the underlying non-unital subsemirings of $S$ and $U$ are equal if and only if $S = U$ as subalgebras.
NonUnitalSubalgebra.mem_toSubmodule theorem
(S : NonUnitalSubalgebra R A) {x} : x ∈ S.toSubmodule ↔ x ∈ S
Full source
theorem mem_toSubmodule (S : NonUnitalSubalgebra R A) {x} : x ∈ S.toSubmodulex ∈ S.toSubmodule ↔ x ∈ S :=
  Iff.rfl
Equivalence of Membership in Non-unital Subalgebra and its Submodule
Informal description
For any non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure over $R$, and for any element $x \in A$, we have $x \in S.\text{toSubmodule}$ if and only if $x \in S$.
NonUnitalSubalgebra.coe_toSubmodule theorem
(S : NonUnitalSubalgebra R A) : (↑S.toSubmodule : Set A) = S
Full source
@[simp]
theorem coe_toSubmodule (S : NonUnitalSubalgebra R A) : (↑S.toSubmodule : Set A) = S :=
  rfl
Submodule and Subalgebra Set Equality: $\uparrow\!S.\text{toSubmodule} = S$
Informal description
For any non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure over $R$, the underlying set of the submodule associated to $S$ is equal to $S$ itself when viewed as a subset of $A$.
NonUnitalSubalgebra.toSubmodule_injective theorem
: Function.Injective (toSubmodule : NonUnitalSubalgebra R A → Submodule R A)
Full source
theorem toSubmodule_injective :
    Function.Injective (toSubmodule : NonUnitalSubalgebra R A → Submodule R A) := fun S T h =>
  ext fun x => by rw [← mem_toSubmodule, ← mem_toSubmodule, h]
Injectivity of the Submodule Map for Non-unital Subalgebras
Informal description
The map from a non-unital subalgebra $S$ over a commutative semiring $R$ to its underlying submodule is injective. That is, for any two non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ equipped with a module structure over $R$, if their associated submodules are equal, then $S = T$.
NonUnitalSubalgebra.toSubmodule_inj theorem
{S U : NonUnitalSubalgebra R A} : S.toSubmodule = U.toSubmodule ↔ S = U
Full source
theorem toSubmodule_inj {S U : NonUnitalSubalgebra R A} : S.toSubmodule = U.toSubmodule ↔ S = U :=
  toSubmodule_injective.eq_iff
Submodule Equality Characterizes Non-unital Subalgebra Equality
Informal description
For any two non-unital subalgebras $S$ and $U$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure over $R$, the associated submodules of $S$ and $U$ are equal if and only if $S = U$.
NonUnitalSubalgebra.copy definition
(S : NonUnitalSubalgebra R A) (s : Set A) (hs : s = ↑S) : NonUnitalSubalgebra R A
Full source
/-- Copy of a non-unital subalgebra with a new `carrier` equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (S : NonUnitalSubalgebra R A) (s : Set A) (hs : s = ↑S) :
    NonUnitalSubalgebra R A :=
  { S.toNonUnitalSubsemiring.copy s hs with
    smul_mem' := fun r a (ha : a ∈ s) => by
      show r • a ∈ s
      rw [hs] at ha ⊢
      exact S.smul_mem' r ha }
Copy of a non-unital subalgebra with specified carrier set
Informal description
Given a non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure, and a subset $s$ of $A$ that is equal to the underlying set of $S$, the function `NonUnitalSubalgebra.copy` constructs a new non-unital subalgebra with carrier set $s$. This preserves the algebraic structure of $S$ while allowing the carrier set to be replaced by a definitionally equal set.
NonUnitalSubalgebra.coe_copy theorem
(S : NonUnitalSubalgebra R A) (s : Set A) (hs : s = ↑S) : (S.copy s hs : Set A) = s
Full source
@[simp]
theorem coe_copy (S : NonUnitalSubalgebra R A) (s : Set A) (hs : s = ↑S) :
    (S.copy s hs : Set A) = s :=
  rfl
Equality of Carrier Set in Non-unital Subalgebra Copy Construction
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. For any non-unital subalgebra $S$ of $A$ and any subset $s$ of $A$ such that $s$ is equal to the underlying set of $S$, the underlying set of the copy of $S$ with carrier set $s$ is equal to $s$ itself.
NonUnitalSubalgebra.copy_eq theorem
(S : NonUnitalSubalgebra R A) (s : Set A) (hs : s = ↑S) : S.copy s hs = S
Full source
theorem copy_eq (S : NonUnitalSubalgebra R A) (s : Set A) (hs : s = ↑S) : S.copy s hs = S :=
  SetLike.coe_injective hs
Equality of Non-unital Subalgebra Copy with Original
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. For any non-unital subalgebra $S$ of $A$ and any subset $s$ of $A$ such that $s$ equals the underlying set of $S$, the copy of $S$ with carrier set $s$ is equal to $S$ itself.
NonUnitalSubalgebra.instInhabitedSubtypeMem instance
(S : NonUnitalSubalgebra R A) : Inhabited S
Full source
instance (S : NonUnitalSubalgebra R A) : Inhabited S :=
  ⟨(0 : S.toNonUnitalSubsemiring)⟩
Non-unital Subalgebras are Inhabited
Informal description
For any non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure, the subtype $S$ is inhabited (i.e., contains at least one element).
NonUnitalSubalgebra.instNonUnitalSubringClass instance
: NonUnitalSubringClass (NonUnitalSubalgebra R A) A
Full source
instance instNonUnitalSubringClass : NonUnitalSubringClass (NonUnitalSubalgebra R A) A :=
  { NonUnitalSubalgebra.instNonUnitalSubsemiringClass with
    neg_mem := @fun _ x hx => neg_one_smul R x ▸ SMulMemClass.smul_mem _ hx }
Non-unital Subalgebras as Non-unital Subrings
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, the collection of non-unital subalgebras of $A$ forms a class of non-unital subrings. This means every non-unital subalgebra is closed under addition, multiplication, and negation, and contains the additive identity.
NonUnitalSubalgebra.toNonUnitalSubring definition
(S : NonUnitalSubalgebra R A) : NonUnitalSubring A
Full source
/-- A non-unital subalgebra over a ring is also a `Subring`. -/
def toNonUnitalSubring (S : NonUnitalSubalgebra R A) : NonUnitalSubring A where
  toNonUnitalSubsemiring := S.toNonUnitalSubsemiring
  neg_mem' := neg_mem (s := S)
Non-unital subalgebra viewed as non-unital subring
Informal description
Given a non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure, the function returns $S$ viewed as a non-unital subring of $A$. This means $S$ inherits the additive group structure and multiplicative structure from $A$, while maintaining closure under addition, negation, and multiplication.
NonUnitalSubalgebra.mem_toNonUnitalSubring theorem
{S : NonUnitalSubalgebra R A} {x} : x ∈ S.toNonUnitalSubring ↔ x ∈ S
Full source
@[simp]
theorem mem_toNonUnitalSubring {S : NonUnitalSubalgebra R A} {x} :
    x ∈ S.toNonUnitalSubringx ∈ S.toNonUnitalSubring ↔ x ∈ S :=
  Iff.rfl
Membership Equivalence between Non-unital Subalgebra and its Subring View
Informal description
For any non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure, and for any element $x \in A$, we have $x \in S.\text{toNonUnitalSubring}$ if and only if $x \in S$.
NonUnitalSubalgebra.coe_toNonUnitalSubring theorem
(S : NonUnitalSubalgebra R A) : (↑S.toNonUnitalSubring : Set A) = S
Full source
@[simp]
theorem coe_toNonUnitalSubring (S : NonUnitalSubalgebra R A) :
    (↑S.toNonUnitalSubring : Set A) = S :=
  rfl
Equality of Underlying Sets for Non-unital Subalgebra and its Subring View
Informal description
For any non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure, the underlying set of $S$ viewed as a non-unital subring is equal to $S$ itself as a subset of $A$. In other words, $\overline{S.\text{toNonUnitalSubring}} = S$ where $\overline{\cdot}$ denotes the underlying set.
NonUnitalSubalgebra.toNonUnitalSubring_injective theorem
: Function.Injective (toNonUnitalSubring : NonUnitalSubalgebra R A → NonUnitalSubring A)
Full source
theorem toNonUnitalSubring_injective :
    Function.Injective (toNonUnitalSubring : NonUnitalSubalgebra R A → NonUnitalSubring A) :=
  fun S T h => ext fun x => by rw [← mem_toNonUnitalSubring, ← mem_toNonUnitalSubring, h]
Injectivity of the Non-unital Subalgebra to Non-unital Subring Map
Informal description
The function that maps a non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ to its underlying non-unital subring is injective. That is, if two non-unital subalgebras $S$ and $T$ have the same underlying non-unital subring, then $S = T$.
NonUnitalSubalgebra.toNonUnitalSubring_inj theorem
{S U : NonUnitalSubalgebra R A} : S.toNonUnitalSubring = U.toNonUnitalSubring ↔ S = U
Full source
theorem toNonUnitalSubring_inj {S U : NonUnitalSubalgebra R A} :
    S.toNonUnitalSubring = U.toNonUnitalSubring ↔ S = U :=
  toNonUnitalSubring_injective.eq_iff
Equality of Non-unital Subalgebras via Underlying Subrings
Informal description
For any two non-unital subalgebras $S$ and $U$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with a module structure, the underlying non-unital subrings of $S$ and $U$ are equal if and only if $S = U$.
NonUnitalSubalgebra.toNonUnitalNonAssocSemiring instance
[CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A] (S : NonUnitalSubalgebra R A) : NonUnitalNonAssocSemiring S
Full source
instance toNonUnitalNonAssocSemiring [CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A]
    (S : NonUnitalSubalgebra R A) : NonUnitalNonAssocSemiring S :=
  inferInstance
Non-unital Subalgebras as Non-unital Non-associative Semirings
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, every non-unital subalgebra $S$ of $A$ inherits a non-unital non-associative semiring structure from $A$.
NonUnitalSubalgebra.toNonUnitalSemiring instance
[CommSemiring R] [NonUnitalSemiring A] [Module R A] (S : NonUnitalSubalgebra R A) : NonUnitalSemiring S
Full source
instance toNonUnitalSemiring [CommSemiring R] [NonUnitalSemiring A] [Module R A]
    (S : NonUnitalSubalgebra R A) : NonUnitalSemiring S :=
  inferInstance
Non-unital Subalgebras as Non-unital Semirings
Informal description
For any commutative semiring $R$ and non-unital semiring $A$ equipped with a module structure over $R$, every non-unital subalgebra $S$ of $A$ inherits a non-unital semiring structure from $A$.
NonUnitalSubalgebra.toNonUnitalCommSemiring instance
[CommSemiring R] [NonUnitalCommSemiring A] [Module R A] (S : NonUnitalSubalgebra R A) : NonUnitalCommSemiring S
Full source
instance toNonUnitalCommSemiring [CommSemiring R] [NonUnitalCommSemiring A] [Module R A]
    (S : NonUnitalSubalgebra R A) : NonUnitalCommSemiring S :=
  inferInstance
Non-unital Subalgebras Inherit Non-unital Commutative Semiring Structure
Informal description
For any commutative semiring $R$ and non-unital commutative semiring $A$ equipped with a module structure over $R$, every non-unital subalgebra $S$ of $A$ inherits a non-unital commutative semiring structure from $A$.
NonUnitalSubalgebra.toNonUnitalNonAssocRing instance
[CommRing R] [NonUnitalNonAssocRing A] [Module R A] (S : NonUnitalSubalgebra R A) : NonUnitalNonAssocRing S
Full source
instance toNonUnitalNonAssocRing [CommRing R] [NonUnitalNonAssocRing A] [Module R A]
    (S : NonUnitalSubalgebra R A) : NonUnitalNonAssocRing S :=
  inferInstance
Non-unital Subalgebras Inherit Non-unital Non-associative Ring Structure
Informal description
For any commutative ring $R$, non-unital non-associative ring $A$ equipped with a module structure over $R$, and non-unital subalgebra $S$ of $A$, the subset $S$ inherits a non-unital non-associative ring structure from $A$.
NonUnitalSubalgebra.toNonUnitalRing instance
[CommRing R] [NonUnitalRing A] [Module R A] (S : NonUnitalSubalgebra R A) : NonUnitalRing S
Full source
instance toNonUnitalRing [CommRing R] [NonUnitalRing A] [Module R A]
    (S : NonUnitalSubalgebra R A) : NonUnitalRing S :=
  inferInstance
Non-unital Subalgebras Inherit Non-unital Ring Structure
Informal description
For any commutative ring $R$, non-unital ring $A$ equipped with a module structure over $R$, and non-unital subalgebra $S$ of $A$, the subset $S$ inherits a non-unital ring structure from $A$.
NonUnitalSubalgebra.toNonUnitalCommRing instance
[CommRing R] [NonUnitalCommRing A] [Module R A] (S : NonUnitalSubalgebra R A) : NonUnitalCommRing S
Full source
instance toNonUnitalCommRing [CommRing R] [NonUnitalCommRing A] [Module R A]
    (S : NonUnitalSubalgebra R A) : NonUnitalCommRing S :=
  inferInstance
Non-unital Subalgebras Inherit Non-unital Commutative Ring Structure
Informal description
For any commutative ring $R$ and non-unital commutative ring $A$ equipped with a module structure over $R$, every non-unital subalgebra $S$ of $A$ inherits a non-unital commutative ring structure from $A$.
NonUnitalSubalgebra.toSubmodule' definition
[CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A] : NonUnitalSubalgebra R A ↪o Submodule R A
Full source
/-- The forgetful map from `NonUnitalSubalgebra` to `Submodule` as an `OrderEmbedding` -/
def toSubmodule' [CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A] :
    NonUnitalSubalgebraNonUnitalSubalgebra R A ↪o Submodule R A where
  toEmbedding :=
    { toFun := fun S => S.toSubmodule
      inj' := fun S T h => ext <| by apply SetLike.ext_iff.1 h }
  map_rel_iff' := SetLike.coe_subset_coe.symm.trans SetLike.coe_subset_coe
Order embedding from non-unital subalgebras to submodules
Informal description
The order embedding that maps a non-unital subalgebra $S$ over a commutative semiring $R$ to its underlying submodule, preserving the order structure. Specifically, for any two non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ equipped with a module structure over $R$, we have $S \leq T$ if and only if the underlying submodule of $S$ is contained in the underlying submodule of $T$.
NonUnitalSubalgebra.toNonUnitalSubsemiring' definition
[CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A] : NonUnitalSubalgebra R A ↪o NonUnitalSubsemiring A
Full source
/-- The forgetful map from `NonUnitalSubalgebra` to `NonUnitalSubsemiring` as an
`OrderEmbedding` -/
def toNonUnitalSubsemiring' [CommSemiring R] [NonUnitalNonAssocSemiring A] [Module R A] :
    NonUnitalSubalgebraNonUnitalSubalgebra R A ↪o NonUnitalSubsemiring A where
  toEmbedding :=
    { toFun := fun S => S.toNonUnitalSubsemiring
      inj' := fun S T h => ext <| by apply SetLike.ext_iff.1 h }
  map_rel_iff' := SetLike.coe_subset_coe.symm.trans SetLike.coe_subset_coe
Order embedding from non-unital subalgebras to non-unital subsemirings
Informal description
The order embedding that maps a non-unital subalgebra $S$ over a commutative semiring $R$ to its underlying non-unital subsemiring, preserving the order structure. Specifically, for any two non-unital subalgebras $S$ and $T$, $S \leq T$ if and only if the underlying non-unital subsemiring of $S$ is contained in the underlying non-unital subsemiring of $T$.
NonUnitalSubalgebra.toNonUnitalSubring' definition
[CommRing R] [NonUnitalNonAssocRing A] [Module R A] : NonUnitalSubalgebra R A ↪o NonUnitalSubring A
Full source
/-- The forgetful map from `NonUnitalSubalgebra` to `NonUnitalSubsemiring` as an
`OrderEmbedding` -/
def toNonUnitalSubring' [CommRing R] [NonUnitalNonAssocRing A] [Module R A] :
    NonUnitalSubalgebraNonUnitalSubalgebra R A ↪o NonUnitalSubring A where
  toEmbedding :=
    { toFun := fun S => S.toNonUnitalSubring
      inj' := fun S T h => ext <| by apply SetLike.ext_iff.1 h }
  map_rel_iff' := SetLike.coe_subset_coe.symm.trans SetLike.coe_subset_coe
Order embedding from non-unital subalgebras to non-unital subrings
Informal description
Given a commutative ring $R$ and a non-unital non-associative ring $A$ equipped with a module structure over $R$, the function maps a non-unital subalgebra $S$ of $A$ to its underlying non-unital subring, preserving the order structure. Specifically, for any two non-unital subalgebras $S$ and $T$, $S \leq T$ if and only if the underlying non-unital subring of $S$ is contained in the underlying non-unital subring of $T$.
NonUnitalSubalgebra.instModule' instance
[Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] : Module R' S
Full source
instance instModule' [Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] : Module R' S :=
  SMulMemClass.toModule' _ R' R A S
Module Structure Inheritance on Non-unital Subalgebras under Scalar Tower Condition
Informal description
For any semiring $R'$ with a scalar multiplication action on a commutative semiring $R$, and a non-unital non-associative semiring $A$ equipped with compatible module structures over $R'$ and $R$ (satisfying the scalar tower property), every non-unital subalgebra $S$ of $A$ inherits a module structure over $R'$.
NonUnitalSubalgebra.instModule instance
: Module R S
Full source
instance instModule : Module R S :=
  S.instModule'
Module Structure on Non-unital Subalgebras
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, every non-unital subalgebra $S$ of $A$ inherits a module structure over $R$.
NonUnitalSubalgebra.instIsScalarTower' instance
[Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] : IsScalarTower R' R S
Full source
instance instIsScalarTower' [Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] :
    IsScalarTower R' R S :=
  S.toSubmodule.isScalarTower
Scalar Tower Property for Non-unital Subalgebras
Informal description
For any semiring $R'$ with a scalar multiplication action on a commutative semiring $R$, and a non-unital non-associative semiring $A$ equipped with compatible module structures over $R'$ and $R$ (satisfying the scalar tower property), every non-unital subalgebra $S$ of $A$ inherits the scalar tower property for the actions of $R'$ and $R$ on $S$. That is, for any $s \in S$, $r \in R$, and $x \in R'$, we have $(x \cdot r) \bullet s = x \bullet (r \bullet s)$.
NonUnitalSubalgebra.instIsScalarTowerSubtypeMem instance
[IsScalarTower R A A] : IsScalarTower R S S
Full source
instance [IsScalarTower R A A] : IsScalarTower R S S where
  smul_assoc r x y := Subtype.ext <| smul_assoc r (x : A) (y : A)
Scalar Tower Property for Non-unital Subalgebras
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, if $A$ forms a scalar tower with itself (i.e., the scalar multiplication satisfies $(r \cdot a) \cdot b = r \cdot (a \cdot b)$ for all $r \in R$ and $a, b \in A$), then any non-unital subalgebra $S$ of $A$ also forms a scalar tower with itself.
NonUnitalSubalgebra.instSMulCommClass' instance
[Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] [SMulCommClass R' R A] : SMulCommClass R' R S
Full source
instance instSMulCommClass' [Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A]
    [SMulCommClass R' R A] : SMulCommClass R' R S where
  smul_comm r' r s := Subtype.ext <| smul_comm r' r (s : A)
Commutativity of Scalar Multiplications on Non-unital Subalgebras under Scalar Tower Condition
Informal description
For any semiring $R'$ with a scalar multiplication action on a commutative semiring $R$, and a non-unital non-associative semiring $A$ equipped with compatible module structures over $R'$ and $R$ (satisfying the scalar tower property), if the scalar multiplications by $R'$ and $R$ on $A$ commute, then they also commute on any non-unital subalgebra $S$ of $A$.
NonUnitalSubalgebra.instSMulCommClass instance
[SMulCommClass R A A] : SMulCommClass R S S
Full source
instance instSMulCommClass [SMulCommClass R A A] : SMulCommClass R S S where
  smul_comm r x y := Subtype.ext <| smul_comm r (x : A) (y : A)
Commutativity of Scalar Multiplication in Non-unital Subalgebras
Informal description
For any non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, if the scalar multiplications by $R$ on $A$ commute with each other, then the scalar multiplications by $R$ on $S$ also commute with each other.
NonUnitalSubalgebra.noZeroSMulDivisors_bot instance
[NoZeroSMulDivisors R A] : NoZeroSMulDivisors R S
Full source
instance noZeroSMulDivisors_bot [NoZeroSMulDivisors R A] : NoZeroSMulDivisors R S :=
  ⟨fun {c x} h =>
    have : c = 0 ∨ (x : A) = 0 := eq_zero_or_eq_zero_of_smul_eq_zero (congr_arg ((↑) : S → A) h)
    this.imp_right (@Subtype.ext_iff _ _ x 0).mpr⟩
No Zero Scalar Divisors in Non-unital Subalgebras
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, if $A$ has no zero scalar divisors (i.e., $r \bullet x = 0$ implies $r = 0$ or $x = 0$ for $r \in R$ and $x \in A$), then any non-unital subalgebra $S$ of $A$ also has no zero scalar divisors.
NonUnitalSubalgebra.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
Additivity of Non-unital Subalgebra Inclusion
Informal description
For any elements $x, y$ in a non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, 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$.
NonUnitalSubalgebra.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 Preservation in Non-unital Subalgebra Inclusion
Informal description
For any elements $x$ and $y$ in a non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the image of their product under the canonical inclusion map into $A$ equals the product of their images, i.e., $(x \cdot y)_A = x_A \cdot y_A$.
NonUnitalSubalgebra.coe_zero theorem
: ((0 : S) : A) = 0
Full source
protected theorem coe_zero : ((0 : S) : A) = 0 :=
  rfl
Preservation of Zero in Non-unital Subalgebra Inclusion
Informal description
For any non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, 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$.
NonUnitalSubalgebra.coe_neg theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] {S : NonUnitalSubalgebra 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 : NonUnitalSubalgebra R A} (x : S) : (↑(-x) : A) = -↑x :=
  rfl
Negation Preservation in Non-unital Subalgebra Inclusion
Informal description
Let $R$ be a commutative ring and $A$ a ring equipped with an $R$-algebra structure. For any non-unital subalgebra $S$ of $A$ and any element $x \in S$, the image of $-x$ under the inclusion map $S \hookrightarrow A$ equals $-x_A$, where $x_A$ is the image of $x$ in $A$.
NonUnitalSubalgebra.coe_sub theorem
{R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] {S : NonUnitalSubalgebra 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 : NonUnitalSubalgebra R A} (x y : S) : (↑(x - y) : A) = ↑x - ↑y :=
  rfl
Subalgebra Inclusion Preserves Subtraction: $\uparrow(x - y) = \uparrow x - \uparrow y$
Informal description
Let $R$ be a commutative ring and $A$ a ring equipped with an $R$-algebra structure. For any non-unital subalgebra $S$ of $A$ and any elements $x, y \in S$, the image of the difference $x - y$ under the inclusion map $S \hookrightarrow A$ equals the difference of the images $\uparrow x - \uparrow y$ in $A$.
NonUnitalSubalgebra.coe_smul theorem
[SMul R' R] [SMul R' A] [IsScalarTower R' R A] (r : R') (x : S) : ↑(r • x) = 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) = r • (x : A) :=
  rfl
Scalar Multiplication Commutes with Subalgebra Inclusion in Tower Structure
Informal description
Let $R'$ and $R$ be semirings with scalar multiplication actions on $R$ and $A$, where $A$ is a non-unital non-associative semiring over $R$. Suppose the scalar multiplications satisfy the tower property $R' \to R \to A$. Then for any scalar $r \in R'$ and any element $x$ in a non-unital subalgebra $S$ of $A$, the image of the scalar multiple $r \bullet x$ in $A$ equals the scalar multiple $r \bullet (x \in A)$.
NonUnitalSubalgebra.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 Criterion in Non-unital Subalgebras: $x = 0 \leftrightarrow x \in S$ and $x = 0 \in A$
Informal description
For any element $x$ in a non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the image of $x$ in $A$ is zero if and only if $x$ is the zero element of $S$.
NonUnitalSubalgebra.toNonUnitalSubsemiring_subtype theorem
: NonUnitalSubsemiringClass.subtype S = NonUnitalSubalgebraClass.subtype (R := R) S
Full source
@[simp]
theorem toNonUnitalSubsemiring_subtype :
    NonUnitalSubsemiringClass.subtype S = NonUnitalSubalgebraClass.subtype (R := R) S :=
  rfl
Equality of Inclusion Homomorphisms for Non-unital Subalgebras and Subsemirings
Informal description
For a non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the inclusion homomorphism from $S$ to $A$ as a non-unital subsemiring coincides with the inclusion homomorphism as a non-unital subalgebra.
NonUnitalSubalgebra.toSubring_subtype theorem
{R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : NonUnitalSubalgebra R A) : NonUnitalSubringClass.subtype S = NonUnitalSubalgebraClass.subtype (R := R) S
Full source
@[simp]
theorem toSubring_subtype {R A : Type*} [CommRing R] [Ring A] [Algebra R A]
    (S : NonUnitalSubalgebra R A) :
    NonUnitalSubringClass.subtype S = NonUnitalSubalgebraClass.subtype (R := R) S :=
  rfl
Equality of Inclusion Homomorphisms for Non-unital Subalgebras as Subrings
Informal description
Let $R$ be a commutative ring and $A$ a ring with an $R$-algebra structure. For any non-unital subalgebra $S$ of $A$ over $R$, the canonical inclusion homomorphism of $S$ as a non-unital subring of $A$ coincides with the canonical inclusion homomorphism of $S$ as a non-unital subalgebra over $R$.
NonUnitalSubalgebra.toSubmoduleEquiv definition
(S : NonUnitalSubalgebra R A) : S.toSubmodule ≃ₗ[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 : NonUnitalSubalgebra R A) : S.toSubmodule ≃ₗ[R] S :=
  LinearEquiv.ofEq _ _ rfl
Canonical linear equivalence between a non-unital subalgebra and its underlying submodule
Informal description
Given a commutative semiring $R$ and a non-unital non-associative semiring $A$ equipped with an $R$-module structure, for any non-unital subalgebra $S$ of $A$, there is a canonical linear equivalence between the underlying submodule $S.\text{toSubmodule}$ and $S$ itself. This equivalence is the identity map, presented as a linear equivalence to avoid type equality issues. It preserves both the additive and scalar multiplicative structures of the submodule.
NonUnitalSubalgebra.map definition
(f : F) (S : NonUnitalSubalgebra R A) : NonUnitalSubalgebra R B
Full source
/-- Transport a non-unital subalgebra via an algebra homomorphism. -/
def map (f : F) (S : NonUnitalSubalgebra R A) : NonUnitalSubalgebra R B :=
  { S.toNonUnitalSubsemiring.map (f : A →ₙ+* B) with
    smul_mem' := fun r b hb => by
      rcases hb with ⟨a, ha, rfl⟩
      exact map_smulₛₗ f r a ▸ Set.mem_image_of_mem f (S.smul_mem' r ha) }
Image of a non-unital subalgebra under an algebra homomorphism
Informal description
Given a non-unital subalgebra $S$ of a non-unital algebra $A$ over a commutative semiring $R$, and a non-unital algebra homomorphism $f \colon A \to B$, the image of $S$ under $f$ forms a non-unital subalgebra of $B$. More precisely, the image consists of all elements of the form $f(a)$ where $a \in S$, and this set is closed under addition, multiplication, scalar multiplication by elements of $R$, and contains the additive identity of $B$.
NonUnitalSubalgebra.map_mono theorem
{S₁ S₂ : NonUnitalSubalgebra R A} {f : F} : S₁ ≤ S₂ → (map f S₁ : NonUnitalSubalgebra R B) ≤ map f S₂
Full source
theorem map_mono {S₁ S₂ : NonUnitalSubalgebra R A} {f : F} :
    S₁ ≤ S₂ → (map f S₁ : NonUnitalSubalgebra R B) ≤ map f S₂ :=
  Set.image_subset f
Monotonicity of Non-unital Subalgebra Image under Homomorphism
Informal description
Let $R$ be a commutative semiring and $A$, $B$ be non-unital non-associative semirings equipped with $R$-module structures. For any non-unital algebra homomorphism $f \colon A \to B$ and any two non-unital subalgebras $S_1, S_2$ of $A$ such that $S_1 \subseteq S_2$, 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)$.
NonUnitalSubalgebra.map_injective theorem
{f : F} (hf : Function.Injective f) : Function.Injective (map f : NonUnitalSubalgebra R A → NonUnitalSubalgebra R B)
Full source
theorem map_injective {f : F} (hf : Function.Injective f) :
    Function.Injective (map f : NonUnitalSubalgebra R A → NonUnitalSubalgebra R B) :=
  fun _S₁ _S₂ ih =>
  ext <| Set.ext_iff.1 <| Set.image_injective.2 hf <| Set.ext <| SetLike.ext_iff.mp ih
Injectivity of Non-unital Subalgebra Image under Injective Homomorphism
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with module structures over $R$. For any injective non-unital algebra homomorphism $f \colon A \to B$, the induced map on non-unital subalgebras, which sends a subalgebra $S \subseteq A$ to its image $f(S) \subseteq B$, is also injective.
NonUnitalSubalgebra.map_id theorem
(S : NonUnitalSubalgebra R A) : map (NonUnitalAlgHom.id R A) S = S
Full source
@[simp]
theorem map_id (S : NonUnitalSubalgebra R A) : map (NonUnitalAlgHom.id R A) S = S :=
  SetLike.coe_injective <| Set.image_id _
Identity Mapping Preserves Non-unital Subalgebra
Informal description
For any non-unital subalgebra $S$ of a non-unital algebra $A$ over a commutative semiring $R$, the image of $S$ under the identity non-unital algebra homomorphism $\mathrm{id} \colon A \to A$ is equal to $S$ itself.
NonUnitalSubalgebra.map_map theorem
(S : NonUnitalSubalgebra 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 : NonUnitalSubalgebra 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 _ _ _
Image of Non-unital Subalgebra under Composition of Homomorphisms Equals Composition of Images
Informal description
Let $R$ be a commutative semiring, and let $A$, $B$, and $C$ be non-unital non-associative semirings equipped with module structures over $R$. Given a non-unital subalgebra $S$ of $A$, and non-unital algebra homomorphisms $f \colon A \to B$ and $g \colon B \to C$, the image of $S$ under $g \circ f$ is equal to the image under $g$ of the image of $S$ under $f$. In symbols: $$g(f(S)) = (g \circ f)(S).$$
NonUnitalSubalgebra.mem_map theorem
{S : NonUnitalSubalgebra R A} {f : F} {y : B} : y ∈ map f S ↔ ∃ x ∈ S, f x = y
Full source
@[simp]
theorem mem_map {S : NonUnitalSubalgebra R A} {f : F} {y : B} : y ∈ map f Sy ∈ map f S ↔ ∃ x ∈ S, f x = y :=
  NonUnitalSubsemiring.mem_map
Characterization of Elements in the Image of a Non-unital Subalgebra under a Ring Homomorphism
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings with $A$ being a module over $R$. For any non-unital subalgebra $S$ of $A$ and any non-unital ring homomorphism $f \colon A \to B$, an element $y \in B$ belongs to the image of $S$ under $f$ if and only if there exists an element $x \in S$ such that $f(x) = y$. In other words, $y \in f(S) \leftrightarrow \exists x \in S, f(x) = y$.
NonUnitalSubalgebra.map_toSubmodule theorem
{S : NonUnitalSubalgebra R A} {f : F} : -- TODO: introduce a better coercion from `NonUnitalAlgHomClass` to `LinearMap`(map f S).toSubmodule = Submodule.map (LinearMapClass.linearMap f) S.toSubmodule
Full source
theorem map_toSubmodule {S : NonUnitalSubalgebra R A} {f : F} :
    -- TODO: introduce a better coercion from `NonUnitalAlgHomClass` to `LinearMap`
    (map f S).toSubmodule = Submodule.map (LinearMapClass.linearMap f) S.toSubmodule :=
  SetLike.coe_injective rfl
Compatibility of Non-unital Subalgebra Map with Underlying Submodule Map
Informal description
For any non-unital subalgebra $S$ of a non-unital algebra $A$ over a commutative semiring $R$, and any non-unital algebra homomorphism $f \colon A \to B$, the underlying submodule of the image of $S$ under $f$ is equal to the image of the underlying submodule of $S$ under the linear map associated to $f$. In symbols, if we denote: - $\text{map}(f, S)$ as the image of $S$ under $f$, - $S_{\text{submodule}}$ as the underlying submodule of $S$, - $\text{LinearMap}(f)$ as the linear map associated to $f$, - $\text{map}(\text{LinearMap}(f), S_{\text{submodule}})$ as the image of $S_{\text{submodule}}$ under $\text{LinearMap}(f)$, then the statement asserts that: $$(\text{map}(f, S))_{\text{submodule}} = \text{map}(\text{LinearMap}(f), S_{\text{submodule}}).$$
NonUnitalSubalgebra.map_toNonUnitalSubsemiring theorem
{S : NonUnitalSubalgebra R A} {f : F} : (map f S).toNonUnitalSubsemiring = S.toNonUnitalSubsemiring.map (f : A →ₙ+* B)
Full source
theorem map_toNonUnitalSubsemiring {S : NonUnitalSubalgebra R A} {f : F} :
    (map f S).toNonUnitalSubsemiring = S.toNonUnitalSubsemiring.map (f : A →ₙ+* B) :=
  SetLike.coe_injective rfl
Compatibility of Non-unital Subalgebra Map with Underlying Subsemiring Map
Informal description
For any non-unital subalgebra $S$ of a non-unital algebra $A$ over a commutative semiring $R$, and any non-unital ring homomorphism $f \colon A \to B$, the underlying non-unital subsemiring of the image of $S$ under $f$ is equal to the image of the underlying non-unital subsemiring of $S$ under $f$. In symbols, if we denote: - $\text{map}(f, S)$ as the image of $S$ under $f$, - $S_{\text{subsemiring}}$ as the underlying non-unital subsemiring of $S$, - $\text{map}(f, S_{\text{subsemiring}})$ as the image of $S_{\text{subsemiring}}$ under $f$, then the statement asserts that: $$(\text{map}(f, S))_{\text{subsemiring}} = \text{map}(f, S_{\text{subsemiring}}).$$
NonUnitalSubalgebra.coe_map theorem
(S : NonUnitalSubalgebra R A) (f : F) : (map f S : Set B) = f '' S
Full source
@[simp]
theorem coe_map (S : NonUnitalSubalgebra R A) (f : F) : (map f S : Set B) = f '' S :=
  rfl
Image of Subalgebra Under Homomorphism Equals Function Image
Informal description
For any non-unital subalgebra $S$ of a non-unital algebra $A$ over a commutative semiring $R$, and any non-unital algebra homomorphism $f \colon A \to B$, the underlying set of the image subalgebra $\mathrm{map}(f, S)$ is equal to the image of $S$ under $f$, i.e., $\mathrm{map}(f, S) = f(S)$ as subsets of $B$.
NonUnitalSubalgebra.comap definition
(f : F) (S : NonUnitalSubalgebra R B) : NonUnitalSubalgebra R A
Full source
/-- Preimage of a non-unital subalgebra under an algebra homomorphism. -/
def comap (f : F) (S : NonUnitalSubalgebra R B) : NonUnitalSubalgebra R A :=
  { S.toNonUnitalSubsemiring.comap (f : A →ₙ+* B) with
    smul_mem' := fun r a (ha : f a ∈ S) =>
      show f (r • a) ∈ S from (map_smulₛₗ f r a).symmSMulMemClass.smul_mem r ha }
Preimage of a non-unital subalgebra under an algebra homomorphism
Informal description
Given a non-unital algebra homomorphism \( f : A \to B \) between non-unital algebras over a commutative semiring \( R \), and a non-unital subalgebra \( S \) of \( B \), the preimage \( f^{-1}(S) \) forms a non-unital subalgebra of \( A \). This subalgebra consists of all elements \( a \in A \) such that \( f(a) \in S \), and it inherits the structure of both a non-unital subsemiring and a submodule under scalar multiplication by elements of \( R \).
NonUnitalSubalgebra.map_le theorem
{S : NonUnitalSubalgebra R A} {f : F} {U : NonUnitalSubalgebra R B} : map f S ≤ U ↔ S ≤ comap f U
Full source
theorem map_le {S : NonUnitalSubalgebra R A} {f : F} {U : NonUnitalSubalgebra R B} :
    mapmap f S ≤ U ↔ S ≤ comap f U :=
  Set.image_subset_iff
Image-Preimage Order Correspondence for Non-unital Subalgebras
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with $R$-module structures. Given a non-unital algebra homomorphism $f \colon A \to B$, a non-unital subalgebra $S$ of $A$, and a non-unital 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). \]
NonUnitalSubalgebra.gc_map_comap theorem
(f : F) : GaloisConnection (map f : NonUnitalSubalgebra R A → NonUnitalSubalgebra R B) (comap f)
Full source
theorem gc_map_comap (f : F) :
    GaloisConnection (map f : NonUnitalSubalgebra R A → NonUnitalSubalgebra R B) (comap f) :=
  fun _ _ => map_le
Galois Connection Between Image and Preimage of Non-unital Subalgebras Under Homomorphism
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with $R$-module structures. Given a non-unital algebra homomorphism $f \colon A \to B$, the pair of functions $(\text{map}_f, \text{comap}_f)$ forms a Galois connection between the partially ordered sets of non-unital subalgebras of $A$ and $B$. More precisely, for any non-unital subalgebra $S$ of $A$ and $U$ of $B$, we have: \[ \text{map}_f(S) \subseteq U \leftrightarrow S \subseteq \text{comap}_f(U). \]
NonUnitalSubalgebra.mem_comap theorem
(S : NonUnitalSubalgebra R B) (f : F) (x : A) : x ∈ comap f S ↔ f x ∈ S
Full source
@[simp]
theorem mem_comap (S : NonUnitalSubalgebra R B) (f : F) (x : A) : x ∈ comap f Sx ∈ comap f S ↔ f x ∈ S :=
  Iff.rfl
Membership Criterion for Preimage of Non-unital Subalgebra under Homomorphism
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with module structures over $R$. Given a non-unital algebra homomorphism $f : A \to B$ and a non-unital subalgebra $S$ of $B$, an element $x \in A$ belongs to the preimage subalgebra $\text{comap}_f(S)$ if and only if its image $f(x)$ belongs to $S$.
NonUnitalSubalgebra.coe_comap theorem
(S : NonUnitalSubalgebra R B) (f : F) : (comap f S : Set A) = f ⁻¹' (S : Set B)
Full source
@[simp, norm_cast]
theorem coe_comap (S : NonUnitalSubalgebra R B) (f : F) : (comap f S : Set A) = f ⁻¹' (S : Set B) :=
  rfl
Preimage of Non-unital Subalgebra Under Homomorphism Equals Set Preimage
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with module structures over $R$. Given a non-unital algebra homomorphism $f : A \to B$ and a non-unital subalgebra $S$ of $B$, the underlying set of the preimage subalgebra $\text{comap}_f(S)$ is equal to the preimage of the underlying set of $S$ under $f$, i.e., $$ \text{comap}_f(S) = f^{-1}(S). $$
NonUnitalSubalgebra.noZeroDivisors instance
{R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [NoZeroDivisors A] [Module R A] (S : NonUnitalSubalgebra R A) : NoZeroDivisors S
Full source
instance noZeroDivisors {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [NoZeroDivisors A]
    [Module R A] (S : NonUnitalSubalgebra R A) : NoZeroDivisors S :=
  NonUnitalSubsemiringClass.noZeroDivisors S
No Zero Divisors in Non-unital Subalgebras
Informal description
For any commutative semiring $R$ and non-unital semiring $A$ with no zero divisors that is equipped with a module structure over $R$, every non-unital subalgebra $S$ of $A$ also has no zero divisors.
Submodule.toNonUnitalSubalgebra definition
(p : Submodule R A) (h_mul : ∀ x y, x ∈ p → y ∈ p → x * y ∈ p) : NonUnitalSubalgebra R A
Full source
/-- A submodule closed under multiplication is a non-unital subalgebra. -/
def toNonUnitalSubalgebra (p : Submodule R A) (h_mul : ∀ x y, x ∈ py ∈ px * y ∈ p) :
    NonUnitalSubalgebra R A :=
  { p with
    mul_mem' := h_mul _ _ }
Submodule to non-unital subalgebra conversion
Informal description
Given a submodule $p$ of a module $A$ over a commutative semiring $R$, if $p$ is closed under multiplication (i.e., for any $x, y \in p$, $x * y \in p$), then $p$ can be viewed as a non-unital subalgebra of $A$.
Submodule.mem_toNonUnitalSubalgebra theorem
{p : Submodule R A} {h_mul} {x} : x ∈ p.toNonUnitalSubalgebra h_mul ↔ x ∈ p
Full source
@[simp]
theorem mem_toNonUnitalSubalgebra {p : Submodule R A} {h_mul} {x} :
    x ∈ p.toNonUnitalSubalgebra h_mulx ∈ p.toNonUnitalSubalgebra h_mul ↔ x ∈ p :=
  Iff.rfl
Membership Equivalence in Submodule to Non-unital Subalgebra Conversion
Informal description
For any submodule $p$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, if $p$ is closed under multiplication (i.e., for all $x, y \in p$, $x * y \in p$), then an element $x \in A$ belongs to the non-unital subalgebra generated from $p$ if and only if $x \in p$.
Submodule.coe_toNonUnitalSubalgebra theorem
(p : Submodule R A) (h_mul) : (p.toNonUnitalSubalgebra h_mul : Set A) = p
Full source
@[simp]
theorem coe_toNonUnitalSubalgebra (p : Submodule R A) (h_mul) :
    (p.toNonUnitalSubalgebra h_mul : Set A) = p :=
  rfl
Equality of Underlying Sets in Submodule to Non-unital Subalgebra Conversion
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. For any submodule $p$ of $A$ that is closed under multiplication (i.e., for all $x, y \in p$, $x * y \in p$), the underlying set of the corresponding non-unital subalgebra obtained from $p$ via `toNonUnitalSubalgebra` is equal to $p$ itself as a set.
Submodule.toNonUnitalSubalgebra_mk theorem
(p : Submodule R A) hmul : p.toNonUnitalSubalgebra hmul = NonUnitalSubalgebra.mk ⟨⟨⟨p, p.add_mem⟩, p.zero_mem⟩, hmul _ _⟩ p.smul_mem'
Full source
theorem toNonUnitalSubalgebra_mk (p : Submodule R A) hmul :
    p.toNonUnitalSubalgebra hmul =
      NonUnitalSubalgebra.mk ⟨⟨⟨p, p.add_mem⟩, p.zero_mem⟩, hmul _ _⟩ p.smul_mem' :=
  rfl
Construction of Non-Unital Subalgebra from Multiplication-Closed Submodule
Informal description
Let $R$ be a commutative semiring and $A$ be a non-unital non-associative semiring equipped with an $R$-module structure. Given a submodule $p$ of $A$ that is closed under multiplication (i.e., for any $x, y \in p$, $x * y \in p$), the construction of the corresponding non-unital subalgebra from $p$ is equal to the non-unital subalgebra generated by the additive subgroup $\langle p, p.\text{add\_mem}\rangle$ with zero element $p.\text{zero\_mem}$, multiplication closure condition $\text{hmul}$, and scalar multiplication closure condition $p.\text{smul\_mem}'$.
Submodule.toNonUnitalSubalgebra_toSubmodule theorem
(p : Submodule R A) (h_mul) : (p.toNonUnitalSubalgebra h_mul).toSubmodule = p
Full source
@[simp]
theorem toNonUnitalSubalgebra_toSubmodule (p : Submodule R A) (h_mul) :
    (p.toNonUnitalSubalgebra h_mul).toSubmodule = p :=
  SetLike.coe_injective rfl
Submodule-NonUnitalSubalgebra Correspondence: Roundtrip via `toSubmodule`
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 submodule $p$ of $A$ that is closed under multiplication (i.e., for all $x, y \in p$, $x * y \in p$), the submodule obtained from the corresponding non-unital subalgebra via `toSubmodule` is equal to $p$ itself.
NonUnitalSubalgebra.toSubmodule_toNonUnitalSubalgebra theorem
(S : NonUnitalSubalgebra R A) : (S.toSubmodule.toNonUnitalSubalgebra fun _ _ => mul_mem (s := S)) = S
Full source
@[simp]
theorem _root_.NonUnitalSubalgebra.toSubmodule_toNonUnitalSubalgebra (S : NonUnitalSubalgebra R A) :
    (S.toSubmodule.toNonUnitalSubalgebra fun _ _ => mul_mem (s := S)) = S :=
  SetLike.coe_injective rfl
Submodule-NonUnitalSubalgebra Roundtrip Equality
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$, the submodule obtained from $S$ and then converted back to a non-unital subalgebra (using the multiplication closure property of $S$) is equal to $S$ itself.
NonUnitalAlgHom.range definition
(φ : F) : NonUnitalSubalgebra R B
Full source
/-- Range of an `NonUnitalAlgHom` as a non-unital subalgebra. -/
protected def range (φ : F) : NonUnitalSubalgebra R B where
  toNonUnitalSubsemiring := NonUnitalRingHom.srange (φ : A →ₙ+* B)
  smul_mem' := fun r a => by rintro ⟨a, rfl⟩; exact ⟨r • a, map_smul φ r a⟩
Range of a non-unital algebra homomorphism as a non-unital subalgebra
Informal description
The range of a non-unital algebra homomorphism $\phi \colon A \to B$ as a non-unital subalgebra of $B$. More precisely, for a commutative semiring $R$ and non-unital non-associative semirings $A$ and $B$ with $R$-module structures, the range of $\phi$ is the subset of $B$ consisting of all elements of the form $\phi(x)$ for some $x \in A$. This subset inherits the structure of a non-unital subalgebra of $B$, meaning it is closed under addition, multiplication, and scalar multiplication by elements of $R$.
NonUnitalAlgHom.mem_range theorem
(φ : F) {y : B} : y ∈ (NonUnitalAlgHom.range φ : NonUnitalSubalgebra R B) ↔ ∃ x : A, φ x = y
Full source
@[simp]
theorem mem_range (φ : F) {y : B} :
    y ∈ (NonUnitalAlgHom.range φ : NonUnitalSubalgebra R B)y ∈ (NonUnitalAlgHom.range φ : NonUnitalSubalgebra R B) ↔ ∃ x : A, φ x = y :=
  NonUnitalRingHom.mem_srange
Characterization of Range Elements for Non-Unital Algebra Homomorphisms
Informal description
For a non-unital algebra homomorphism $\phi \colon A \to B$ over a commutative semiring $R$, an element $y \in B$ belongs to the range of $\phi$ (considered as a non-unital subalgebra of $B$) if and only if there exists an element $x \in A$ such that $\phi(x) = y$.
NonUnitalAlgHom.mem_range_self theorem
(φ : F) (x : A) : φ x ∈ (NonUnitalAlgHom.range φ : NonUnitalSubalgebra R B)
Full source
theorem mem_range_self (φ : F) (x : A) :
    φ x ∈ (NonUnitalAlgHom.range φ : NonUnitalSubalgebra R B) :=
  (NonUnitalAlgHom.mem_range φ).2 ⟨x, rfl⟩
Self-Image Belongs to Range of Non-Unital Algebra Homomorphism
Informal description
For any non-unital algebra homomorphism $\phi \colon A \to B$ over a commutative semiring $R$ and any element $x \in A$, the image $\phi(x)$ belongs to the range of $\phi$ (considered as a non-unital subalgebra of $B$).
NonUnitalAlgHom.coe_range theorem
(φ : F) : ((NonUnitalAlgHom.range φ : NonUnitalSubalgebra R B) : Set B) = Set.range (φ : A → B)
Full source
@[simp]
theorem coe_range (φ : F) :
    ((NonUnitalAlgHom.range φ : NonUnitalSubalgebra R B) : Set B) = Set.range (φ : A → B) := by
  ext
  rw [SetLike.mem_coe, mem_range]
  rfl
Range of Non-unital Algebra Homomorphism as Set Equals Function Range
Informal description
For a non-unital algebra homomorphism $\phi \colon A \to B$ over a commutative semiring $R$, the underlying set of the range of $\phi$ (as a non-unital subalgebra of $B$) is equal to the range of $\phi$ as a function from $A$ to $B$. In other words, the set $\{y \in B \mid \exists x \in A, \phi(x) = y\}$ coincides with the range subalgebra of $\phi$.
NonUnitalAlgHom.range_comp theorem
(f : A →ₙₐ[R] B) (g : B →ₙₐ[R] C) : NonUnitalAlgHom.range (g.comp f) = (NonUnitalAlgHom.range f).map g
Full source
theorem range_comp (f : A →ₙₐ[R] B) (g : B →ₙₐ[R] C) :
    NonUnitalAlgHom.range (g.comp f) = (NonUnitalAlgHom.range f).map g :=
  SetLike.coe_injective (Set.range_comp g f)
Range of Composition of Non-unital Algebra Homomorphisms Equals Image of Range
Informal description
Let $R$ be a commutative semiring, and let $A$, $B$, and $C$ be non-unital non-associative semirings equipped with $R$-module structures. For any non-unital 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., $\mathrm{range}(g \circ f) = g(\mathrm{range}(f))$.
NonUnitalAlgHom.range_comp_le_range theorem
(f : A →ₙₐ[R] B) (g : B →ₙₐ[R] C) : NonUnitalAlgHom.range (g.comp f) ≤ NonUnitalAlgHom.range g
Full source
theorem range_comp_le_range (f : A →ₙₐ[R] B) (g : B →ₙₐ[R] C) :
    NonUnitalAlgHom.range (g.comp f) ≤ NonUnitalAlgHom.range g :=
  SetLike.coe_mono (Set.range_comp_subset_range f g)
Range of Composition of Non-unital Algebra Homomorphisms is Subset of Range of Second Homomorphism
Informal description
For any non-unital 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$ as non-unital subalgebras of $C$. In other words, $\text{range}(g \circ f) \subseteq \text{range}(g)$.
NonUnitalAlgHom.codRestrict definition
(f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x, f x ∈ S) : A →ₙₐ[R] S
Full source
/-- Restrict the codomain of a non-unital algebra homomorphism. -/
def codRestrict (f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x, f x ∈ S) : A →ₙₐ[R] S :=
  { NonUnitalRingHom.codRestrict (f : A →ₙ+* B) S.toNonUnitalSubsemiring hf with
    map_smul' := fun r a => Subtype.ext <| map_smul f r a }
Codomain restriction of a non-unital algebra homomorphism to a subalgebra
Informal description
Given a non-unital algebra homomorphism \( f \colon A \to B \) over a commutative semiring \( R \), and a non-unital subalgebra \( S \) of \( B \) such that \( f(x) \in S \) for all \( x \in A \), the function `codRestrict` returns the restricted homomorphism \( f \colon A \to S \) that maps each \( x \in A \) to \( \langle f(x), hf(x) \rangle \in S \), where \( hf(x) \) is the proof that \( f(x) \in S \). This restricted homomorphism preserves the scalar multiplication, addition, and multiplication structures.
NonUnitalAlgHom.subtype_comp_codRestrict theorem
(f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x : A, f x ∈ S) : (NonUnitalSubalgebraClass.subtype S).comp (NonUnitalAlgHom.codRestrict f S hf) = f
Full source
@[simp]
theorem subtype_comp_codRestrict (f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x : A, f x ∈ S) :
    (NonUnitalSubalgebraClass.subtype S).comp (NonUnitalAlgHom.codRestrict f S hf) = f :=
  rfl
Composition of inclusion with codomain restriction equals original homomorphism
Informal description
Let $R$ be a commutative semiring, $A$ and $B$ be non-unital non-associative semirings with $A$ having a module structure over $R$, and $S$ be a non-unital subalgebra of $B$. Given a non-unital algebra homomorphism $f \colon A \to B$ such that $f(x) \in S$ for all $x \in A$, the composition of the inclusion homomorphism $\iota \colon S \hookrightarrow B$ with the codomain-restricted homomorphism $f|_S \colon A \to S$ equals $f$. That is, $\iota \circ f|_S = f$.
NonUnitalAlgHom.coe_codRestrict theorem
(f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x, f x ∈ S) (x : A) : ↑(NonUnitalAlgHom.codRestrict f S hf x) = f x
Full source
@[simp]
theorem coe_codRestrict (f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x, f x ∈ S) (x : A) :
    ↑(NonUnitalAlgHom.codRestrict f S hf x) = f x :=
  rfl
Codomain-Restricted Homomorphism Preserves Elements
Informal description
Let $R$ be a commutative semiring, $A$ and $B$ be non-unital non-associative semirings with $B$ having a module structure over $R$. Given a non-unital algebra homomorphism $f \colon A \to B$ over $R$, a non-unital subalgebra $S$ of $B$, and a proof $hf$ that $f(x) \in S$ for all $x \in A$, then for any $x \in A$, the underlying element of the codomain-restricted homomorphism $\text{codRestrict}(f, S, hf)(x)$ equals $f(x)$.
NonUnitalAlgHom.injective_codRestrict theorem
(f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x : A, f x ∈ S) : Function.Injective (NonUnitalAlgHom.codRestrict f S hf) ↔ Function.Injective f
Full source
theorem injective_codRestrict (f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x : A, f x ∈ S) :
    Function.InjectiveFunction.Injective (NonUnitalAlgHom.codRestrict f 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 Non-unital Algebra Homomorphism
Informal description
Let $R$ be a commutative semiring, $A$ and $B$ be non-unital non-associative semirings equipped with $R$-module structures. Given a non-unital $R$-algebra homomorphism $f : A \to B$ and a non-unital subalgebra $S$ of $B$ such that $f(x) \in S$ for all $x \in A$, the codomain-restricted homomorphism $f : A \to S$ is injective if and only if the original homomorphism $f : A \to B$ is injective.
NonUnitalAlgHom.rangeRestrict abbrev
(f : F) : A →ₙₐ[R] (NonUnitalAlgHom.range f : NonUnitalSubalgebra R B)
Full source
/-- Restrict the codomain of an `NonUnitalAlgHom` `f` to `f.range`.

This is the bundled version of `Set.rangeFactorization`. -/
abbrev rangeRestrict (f : F) : A →ₙₐ[R] (NonUnitalAlgHom.range f : NonUnitalSubalgebra R B) :=
  NonUnitalAlgHom.codRestrict f (NonUnitalAlgHom.range f) (NonUnitalAlgHom.mem_range_self f)
Range Restriction of a Non-Unital Algebra Homomorphism
Informal description
Given a non-unital algebra homomorphism $f \colon A \to B$ over a commutative semiring $R$, the function $\text{rangeRestrict}(f)$ is the restriction of $f$ to its range, viewed as a non-unital subalgebra of $B$. Specifically, it maps each $x \in A$ to $\langle f(x), \text{mem\_range\_self}(f, x) \rangle \in \text{range}(f)$, where $\text{mem\_range\_self}(f, x)$ is the proof that $f(x)$ belongs to the range of $f$.
NonUnitalAlgHom.equalizer definition
(ϕ ψ : F) : NonUnitalSubalgebra R A
Full source
/-- The equalizer of two non-unital `R`-algebra homomorphisms -/
def equalizer (ϕ ψ : F) : NonUnitalSubalgebra R A where
  carrier := {a | (ϕ a : B) = ψ a}
  zero_mem' := by rw [Set.mem_setOf_eq, map_zero, map_zero]
  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]
  smul_mem' r x (hx : ϕ x = ψ x) := by rw [Set.mem_setOf_eq, map_smul, map_smul, hx]
Equalizer of non-unital algebra homomorphisms
Informal description
Given two non-unital $R$-algebra homomorphisms $\phi, \psi : A \to B$, the equalizer is the non-unital subalgebra of $A$ consisting of all elements $a \in A$ such that $\phi(a) = \psi(a)$. This subalgebra is closed under addition, multiplication, and scalar multiplication by elements of $R$.
NonUnitalAlgHom.mem_equalizer theorem
(φ ψ : F) (x : A) : x ∈ NonUnitalAlgHom.equalizer φ ψ ↔ φ x = ψ x
Full source
@[simp]
theorem mem_equalizer (φ ψ : F) (x : A) :
    x ∈ NonUnitalAlgHom.equalizer φ ψx ∈ NonUnitalAlgHom.equalizer φ ψ ↔ φ x = ψ x :=
  Iff.rfl
Characterization of Equalizer Subalgebra Membership
Informal description
Let $R$ be a commutative semiring and $A$ be a non-unital non-associative semiring equipped with a module structure over $R$. For any two non-unital $R$-algebra homomorphisms $\phi, \psi : A \to B$ and any element $x \in A$, we have $x$ belongs to the equalizer subalgebra of $\phi$ and $\psi$ if and only if $\phi(x) = \psi(x)$. In other words, $x \in \text{equalizer}(\phi, \psi) \leftrightarrow \phi(x) = \psi(x)$.
NonUnitalAlgHom.fintypeRange instance
[Fintype A] [DecidableEq B] (φ : F) : Fintype (NonUnitalAlgHom.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] (φ : F) :
    Fintype (NonUnitalAlgHom.range φ) :=
  Set.fintypeRange φ
Finiteness of the Range of a Non-unital Algebra Homomorphism
Informal description
For any finite type $A$ and decidable equality on $B$, the range of a non-unital algebra homomorphism $\phi \colon A \to B$ is finite.
NonUnitalAlgebra.span_eq_toSubmodule theorem
(s : NonUnitalSubalgebra R A) : Submodule.span R (s : Set A) = s.toSubmodule
Full source
@[simp]
lemma span_eq_toSubmodule (s : NonUnitalSubalgebra R A) :
    Submodule.span R (s : Set A) = s.toSubmodule := by
  simp [SetLike.ext'_iff, Submodule.coe_span_eq_self]
Equality of Span and Submodule Structure in Non-Unital Subalgebras
Informal description
For any non-unital subalgebra $s$ of a non-unital algebra $A$ over a commutative semiring $R$, the $R$-linear span of $s$ (viewed as a subset of $A$) is equal to the underlying submodule structure of $s$. In other words: $$\operatorname{span}_R s = s.\text{toSubmodule}$$ where: - $\operatorname{span}_R s$ is the smallest $R$-submodule containing $s$ - $s.\text{toSubmodule}$ is the submodule structure inherited from $s$ being a non-unital subalgebra
NonUnitalAlgebra.adjoin definition
(s : Set A) : NonUnitalSubalgebra R A
Full source
/-- The minimal non-unital subalgebra that includes `s`. -/
def adjoin (s : Set A) : NonUnitalSubalgebra R A :=
  { Submodule.span R (NonUnitalSubsemiring.closure s : Set A) with
    mul_mem' :=
      @fun a b (ha : a ∈ Submodule.span R (NonUnitalSubsemiring.closure s : Set A))
        (hb : b ∈ Submodule.span R (NonUnitalSubsemiring.closure s : Set A)) =>
      show a * b ∈ Submodule.span R (NonUnitalSubsemiring.closure s : Set A) by
        refine Submodule.span_induction ?_ ?_ ?_ ?_ ha
        · refine Submodule.span_induction ?_ ?_ ?_ ?_ hb
          · exact fun x (hx : x ∈ NonUnitalSubsemiring.closure s) y
              (hy : y ∈ NonUnitalSubsemiring.closure s) => Submodule.subset_span (mul_mem hy hx)
          · exact fun x _hx => (mul_zero x).symmSubmodule.zero_mem _
          · exact fun x y _ _ hx hy z hz => (mul_add z x y).symmadd_mem (hx z hz) (hy z hz)
          · exact fun r x _ hx y hy =>
              (mul_smul_comm r y x).symmSMulMemClass.smul_mem r (hx y hy)
        · exact (zero_mul b).symmSubmodule.zero_mem _
        · exact fun x y _ _ => (add_mul x y b).symmadd_mem
        · exact fun r x _ hx => (smul_mul_assoc r x b).symmSMulMemClass.smul_mem r hx }
Non-unital subalgebra generated by a set
Informal description
Given a subset $s$ of a non-unital non-associative semiring $A$ that is also an $R$-module, the non-unital subalgebra generated by $s$ is the smallest non-unital subalgebra of $A$ containing $s$. It is constructed as the $R$-submodule spanned by the non-unital subsemiring generated by $s$, ensuring closure under addition, multiplication, and scalar multiplication by elements of $R$.
NonUnitalAlgebra.adjoin_toSubmodule theorem
(s : Set A) : (adjoin R s).toSubmodule = Submodule.span R (NonUnitalSubsemiring.closure s : Set A)
Full source
theorem adjoin_toSubmodule (s : Set A) :
    (adjoin R s).toSubmodule = Submodule.span R (NonUnitalSubsemiring.closure s : Set A) :=
  rfl
Equality between Submodule of Adjoined Non-Unital Subalgebra and Span of Subsemiring Closure
Informal description
For any subset $s$ of a non-unital algebra $A$ over a commutative semiring $R$, the submodule associated with the non-unital subalgebra generated by $s$ is equal to the $R$-linear span of the non-unital subsemiring generated by $s$. In other words, we have: $$(\text{adjoin}_R\, s).\text{toSubmodule} = \text{span}_R (\text{closure}\, s)$$ where: - $\text{adjoin}_R\, s$ is the smallest non-unital subalgebra containing $s$ - $\text{closure}\, s$ is the smallest non-unital subsemiring containing $s$ - $\text{span}_R$ denotes the $R$-linear span
NonUnitalAlgebra.subset_adjoin theorem
{s : Set A} : s ⊆ adjoin R s
Full source
@[aesop safe 20 apply (rule_sets := [SetLike])]
theorem subset_adjoin {s : Set A} : s ⊆ adjoin R s :=
  NonUnitalSubsemiring.subset_closure.trans Submodule.subset_span
Subset Property of Non-unital Subalgebra Generation
Informal description
For any subset $s$ of a non-unital non-associative semiring $A$ that is also an $R$-module, the set $s$ is contained in the non-unital subalgebra generated by $s$, i.e., $s \subseteq \text{adjoin}_R\, s$.
NonUnitalAlgebra.self_mem_adjoin_singleton theorem
(x : A) : x ∈ adjoin R ({ x } : Set A)
Full source
theorem self_mem_adjoin_singleton (x : A) : x ∈ adjoin R ({x} : Set A) :=
  NonUnitalAlgebra.subset_adjoin R (Set.mem_singleton x)
Element Belongs to Its Own Generated Non-unital Subalgebra
Informal description
For any element $x$ in a non-unital non-associative semiring $A$ that is also an $R$-module, $x$ belongs to the non-unital subalgebra generated by the singleton set $\{x\}$ over $R$, i.e., $x \in \text{adjoin}_R \{x\}$.
NonUnitalAlgebra.gc theorem
: GaloisConnection (adjoin R : Set A → NonUnitalSubalgebra R A) (↑)
Full source
protected theorem gc : GaloisConnection (adjoin R : Set A → NonUnitalSubalgebra R A) (↑) :=
  fun s S =>
  ⟨fun H => (NonUnitalSubsemiring.subset_closure.trans Submodule.subset_span).trans H,
    fun H => show Submodule.span R _ ≤ S.toSubmodule from Submodule.span_le.mpr <|
      show NonUnitalSubsemiring.closure s ≤ S.toNonUnitalSubsemiring from
        NonUnitalSubsemiring.closure_le.2 H⟩
Galois Connection Between Non-unital Subalgebra Generation and Underlying Set Coercion
Informal description
For a commutative semiring $R$ and a non-unital non-associative semiring $A$ equipped with an $R$-module structure, the pair of functions $(adjoin_R, \cdot\uparrow)$ forms a Galois connection between: - The function $adjoin_R$ that maps a subset $s \subseteq A$ to the smallest non-unital subalgebra containing $s$ - The coercion function $\cdot\uparrow$ that maps a non-unital subalgebra to its underlying set This means that for any subset $s \subseteq A$ and any non-unital subalgebra $T$ of $A$, we have: $$adjoin_R(s) \leq T \iff s \subseteq T\uparrow$$ where $\leq$ denotes subalgebra inclusion and $\uparrow$ denotes the underlying set of $T$.
NonUnitalAlgebra.gi definition
: GaloisInsertion (adjoin R : Set A → NonUnitalSubalgebra R A) (↑)
Full source
/-- Galois insertion between `adjoin` and `Subtype.val`. -/
protected def gi : GaloisInsertion (adjoin R : Set A → NonUnitalSubalgebra R A) (↑) where
  choice s hs := (adjoin R s).copy s <| le_antisymm (NonUnitalAlgebra.gc.le_u_l s) hs
  gc := NonUnitalAlgebra.gc
  le_l_u S := (NonUnitalAlgebra.gc (S : Set A) (adjoin R S)).1 <| le_rfl
  choice_eq _ _ := NonUnitalSubalgebra.copy_eq _ _ _
Galois insertion between non-unital subalgebra generation and underlying set coercion
Informal description
The pair of functions $(adjoin_R, \cdot\uparrow)$ forms a Galois insertion between: - The function $adjoin_R$ that maps a subset $s \subseteq A$ to the smallest non-unital subalgebra containing $s$ - The coercion function $\cdot\uparrow$ that maps a non-unital subalgebra to its underlying set This means that for any subset $s \subseteq A$, the non-unital subalgebra generated by $s$ is the smallest subalgebra whose underlying set contains $s$, and the coercion of this subalgebra recovers the original set up to definitional equality.
NonUnitalAlgebra.instCompleteLatticeNonUnitalSubalgebra instance
: CompleteLattice (NonUnitalSubalgebra R A)
Full source
instance : CompleteLattice (NonUnitalSubalgebra R A) :=
  GaloisInsertion.liftCompleteLattice NonUnitalAlgebra.gi
Complete Lattice Structure on Non-unital Subalgebras
Informal description
The collection of all non-unital subalgebras of a non-unital non-associative semiring $A$ over a commutative semiring $R$ forms a complete lattice, where the partial order is given by inclusion and the supremum (resp. infimum) of a family of subalgebras is the smallest (resp. largest) subalgebra containing (resp. contained in) all members of the family.
NonUnitalAlgebra.adjoin_le theorem
{S : NonUnitalSubalgebra R A} {s : Set A} (hs : s ⊆ S) : adjoin R s ≤ S
Full source
theorem adjoin_le {S : NonUnitalSubalgebra R A} {s : Set A} (hs : s ⊆ S) : adjoin R s ≤ S :=
  NonUnitalAlgebra.gc.l_le hs
Inclusion of Generated Non-unital Subalgebra: $s \subseteq S \Rightarrow \text{adjoin}_R(s) \leq S$
Informal description
For any subset $s$ of a non-unital non-associative semiring $A$ and any non-unital subalgebra $S$ of $A$ over a commutative semiring $R$, if $s$ is contained in $S$, then the non-unital subalgebra generated by $s$ is contained in $S$.
NonUnitalAlgebra.adjoin_le_iff theorem
{S : NonUnitalSubalgebra R A} {s : Set A} : adjoin R s ≤ S ↔ s ⊆ S
Full source
theorem adjoin_le_iff {S : NonUnitalSubalgebra R A} {s : Set A} : adjoinadjoin R s ≤ S ↔ s ⊆ S :=
  NonUnitalAlgebra.gc _ _
Subalgebra Generation Inclusion Criterion: $\text{adjoin}_R(s) \leq S \leftrightarrow s \subseteq S$
Informal description
For a non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, and a subset $s \subseteq A$, the non-unital subalgebra generated by $s$ is contained in $S$ if and only if $s$ is a subset of $S$.
NonUnitalAlgebra.adjoin_union theorem
(s t : Set A) : adjoin R (s ∪ t) = adjoin R s ⊔ adjoin R t
Full source
theorem adjoin_union (s t : Set A) : adjoin R (s ∪ t) = adjoinadjoin R s ⊔ adjoin R t :=
  (NonUnitalAlgebra.gc : GaloisConnection _ ((↑) : NonUnitalSubalgebra R A → Set A)).l_sup
Union of Subalgebras Equals Supremum of Individual Subalgebras
Informal description
For any two subsets $s$ and $t$ of a non-unital non-associative semiring $A$ that is also an $R$-module, the non-unital subalgebra generated by the union $s \cup t$ is equal to the supremum (join) of the non-unital subalgebras generated by $s$ and $t$ individually, i.e., $\text{adjoin}_R(s \cup t) = \text{adjoin}_R(s) \sqcup \text{adjoin}_R(t)$.
NonUnitalAlgebra.adjoin_eq theorem
(s : NonUnitalSubalgebra R A) : adjoin R (s : Set A) = s
Full source
lemma adjoin_eq (s : NonUnitalSubalgebra R A) : adjoin R (s : Set A) = s :=
  le_antisymm (adjoin_le le_rfl) (subset_adjoin R)
Fixed Point Property of Non-unital Subalgebra Generation: $\text{adjoin}_R(S) = S$
Informal description
For any non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the non-unital subalgebra generated by the underlying set of $S$ is equal to $S$ itself, i.e., $\text{adjoin}_R(S) = S$.
NonUnitalAlgebra.adjoin_induction theorem
{s : Set A} {p : (x : A) → x ∈ adjoin R s → Prop} (mem : ∀ (x) (hx : x ∈ s), p x (subset_adjoin R hx)) (add : ∀ x y hx hy, p x hx → p y hy → p (x + y) (add_mem hx hy)) (zero : p 0 (zero_mem _)) (mul : ∀ x y hx hy, p x hx → p y hy → p (x * y) (mul_mem hx hy)) (smul : ∀ r x hx, p x hx → p (r • x) (SMulMemClass.smul_mem r hx)) {x} (hx : x ∈ adjoin R s) : p x hx
Full source
/-- If some predicate holds for all `x ∈ (s : Set A)` and this predicate is closed under the
`algebraMap`, addition, multiplication and star operations, then it holds for `a ∈ adjoin R s`. -/
@[elab_as_elim]
theorem adjoin_induction {s : Set A} {p : (x : A) → x ∈ adjoin R s → Prop}
    (mem : ∀ (x) (hx : x ∈ s), p x (subset_adjoin R hx))
    (add : ∀ x y hx hy, p x hx → p y hy → p (x + y) (add_mem hx hy)) (zero : p 0 (zero_mem _))
    (mul : ∀ x y hx hy, p x hx → p y hy → p (x * y) (mul_mem hx hy))
    (smul : ∀ r x hx, p x hx → p (r • x) (SMulMemClass.smul_mem r hx))
    {x} (hx : x ∈ adjoin R s) : p x hx :=
  let S : NonUnitalSubalgebra R A :=
    { carrier := { x | ∃ hx, p x hx }
      mul_mem' := (Exists.elim · fun _ ha ↦ (Exists.elim · fun _ hb ↦ ⟨_, mul _ _ _ _ ha hb⟩))
      add_mem' := (Exists.elim · fun _ ha ↦ (Exists.elim · fun _ hb ↦ ⟨_, add _ _ _ _ ha hb⟩))
      smul_mem' := fun r ↦ (Exists.elim · fun _ hb ↦ ⟨_, smul r _ _ hb⟩)
      zero_mem' := ⟨_, zero⟩ }
  adjoin_le (S := S) (fun y hy ↦ ⟨subset_adjoin R hy, mem y hy⟩) hx |>.elim fun _ ↦ id
Induction Principle for Non-unital Subalgebra Generation
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with an $R$-module structure. Given a subset $s \subseteq A$ and a predicate $p : A \to \text{Prop}$ such that: 1. $p(x)$ holds for all $x \in s$, 2. $p$ is closed under addition (i.e., $p(x)$ and $p(y)$ imply $p(x + y)$), 3. $p(0)$ holds, 4. $p$ is closed under multiplication (i.e., $p(x)$ and $p(y)$ imply $p(x \cdot y)$), 5. $p$ is closed under scalar multiplication by $R$ (i.e., $p(x)$ implies $p(r \cdot x)$ for all $r \in R$), then $p(x)$ holds for all $x$ in the non-unital subalgebra generated by $s$.
NonUnitalAlgebra.adjoin_induction₂ theorem
{s : Set A} {p : ∀ x y, x ∈ adjoin R s → y ∈ adjoin R s → Prop} (mem_mem : ∀ (x) (y) (hx : x ∈ s) (hy : y ∈ s), p x y (subset_adjoin R hx) (subset_adjoin R hy)) (zero_left : ∀ x hx, p 0 x (zero_mem _) hx) (zero_right : ∀ x hx, p x 0 hx (zero_mem _)) (add_left : ∀ x y z hx hy hz, p x z hx hz → p y z hy hz → p (x + y) z (add_mem hx hy) hz) (add_right : ∀ x y z hx hy hz, p x y hx hy → p x z hx hz → p x (y + z) hx (add_mem hy hz)) (mul_left : ∀ x y z hx hy hz, p x z hx hz → p y z hy hz → p (x * y) z (mul_mem hx hy) hz) (mul_right : ∀ x y z hx hy hz, p x y hx hy → p x z hx hz → p x (y * z) hx (mul_mem hy hz)) (smul_left : ∀ r x y hx hy, p x y hx hy → p (r • x) y (SMulMemClass.smul_mem r hx) hy) (smul_right : ∀ r x y hx hy, p x y hx hy → p x (r • y) hx (SMulMemClass.smul_mem r hy)) {x y : A} (hx : x ∈ adjoin R s) (hy : y ∈ adjoin R s) : p x y hx hy
Full source
@[elab_as_elim]
theorem adjoin_induction₂ {s : Set A} {p : ∀ x y, x ∈ adjoin R sy ∈ adjoin R s → Prop}
    (mem_mem : ∀ (x) (y) (hx : x ∈ s) (hy : y ∈ s), p x y (subset_adjoin R hx) (subset_adjoin R hy))
    (zero_left : ∀ x hx, p 0 x (zero_mem _) hx) (zero_right : ∀ x hx, p x 0 hx (zero_mem _))
    (add_left : ∀ x y z hx hy hz, p x z hx hz → p y z hy hz → p (x + y) z (add_mem hx hy) hz)
    (add_right : ∀ x y z hx hy hz, p x y hx hy → p x z hx hz → p x (y + z) hx (add_mem hy hz))
    (mul_left : ∀ x y z hx hy hz, p x z hx hz → p y z hy hz → p (x * y) z (mul_mem hx hy) hz)
    (mul_right : ∀ x y z hx hy hz, p x y hx hy → p x z hx hz → p x (y * z) hx (mul_mem hy hz))
    (smul_left : ∀ r x y hx hy, p x y hx hy → p (r • x) y (SMulMemClass.smul_mem r hx) hy)
    (smul_right : ∀ r x y hx hy, p x y hx hy → p x (r • y) hx (SMulMemClass.smul_mem r hy))
    {x y : A} (hx : x ∈ adjoin R s) (hy : y ∈ adjoin R s) :
    p x y hx hy := by
  induction hy using adjoin_induction with
  | mem z hz =>
    induction hx using adjoin_induction with
    | mem _ h => exact mem_mem _ _ h hz
    | zero => exact zero_left _ _
    | mul _ _ _ _ h₁ h₂ => exact mul_left _ _ _ _ _ _ h₁ h₂
    | add _ _ _ _ h₁ h₂ => exact add_left _ _ _ _ _ _ h₁ h₂
    | smul _ _ _ h => exact smul_left _ _ _ _ _ h
  | zero => exact zero_right x hx
  | mul _ _ _ _ h₁ h₂ => exact mul_right _ _ _ _ _ _ h₁ h₂
  | add _ _ _ _ h₁ h₂ => exact add_right _ _ _ _ _ _ h₁ h₂
  | smul _ _ _ h => exact smul_right _ _ _ _ _ h
Double Induction Principle for Non-unital Subalgebra Generation
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with an $R$-module structure. Given a subset $s \subseteq A$ and a binary predicate $p : A \times A \to \text{Prop}$ such that: 1. $p(x, y)$ holds for all $x, y \in s$, 2. $p(0, x)$ and $p(x, 0)$ hold for all $x$ in the subalgebra generated by $s$, 3. $p$ is closed under addition in the first argument (i.e., $p(x, z)$ and $p(y, z)$ imply $p(x + y, z)$), 4. $p$ is closed under addition in the second argument (i.e., $p(x, y)$ and $p(x, z)$ imply $p(x, y + z)$), 5. $p$ is closed under multiplication in the first argument (i.e., $p(x, z)$ and $p(y, z)$ imply $p(x \cdot y, z)$), 6. $p$ is closed under multiplication in the second argument (i.e., $p(x, y)$ and $p(x, z)$ imply $p(x, y \cdot z)$), 7. $p$ is closed under scalar multiplication in the first argument (i.e., $p(x, y)$ implies $p(r \cdot x, y)$ for all $r \in R$), 8. $p$ is closed under scalar multiplication in the second argument (i.e., $p(x, y)$ implies $p(x, r \cdot y)$ for all $r \in R$), then $p(x, y)$ holds for all $x, y$ in the non-unital subalgebra generated by $s$.
NonUnitalAlgebra.adjoin_eq_span theorem
(s : Set A) : (adjoin R s).toSubmodule = span R (Subsemigroup.closure s)
Full source
lemma adjoin_eq_span (s : Set A) : (adjoin R s).toSubmodule = span R (Subsemigroup.closure s) := by
  apply le_antisymm
  · intro x hx
    induction hx using adjoin_induction with
    | mem x hx => exact subset_span <| Subsemigroup.subset_closure hx
    | add x y _ _ hpx hpy => exact add_mem hpx hpy
    | zero => exact zero_mem _
    | mul x y _ _ hpx hpy =>
      apply span_induction₂ ?Hs (by simp) (by simp) ?Hadd_l ?Hadd_r ?Hsmul_l ?Hsmul_r hpx hpy
      case Hs => exact fun x y hx hy ↦ subset_span <| mul_mem hx hy
      case Hadd_l => exact fun x y z _ _ _ hxz hyz ↦ by simpa [add_mul] using add_mem hxz hyz
      case Hadd_r => exact fun x y z _ _ _ hxz hyz ↦ by simpa [mul_add] using add_mem hxz hyz
      case Hsmul_l => exact fun r x y _ _ hxy ↦ by simpa [smul_mul_assoc] using smul_mem _ _ hxy
      case Hsmul_r => exact fun r x y _ _ hxy ↦ by simpa [mul_smul_comm] using smul_mem _ _ hxy
    | smul r x _ hpx => exact smul_mem _ _ hpx
  · apply span_le.2 _
    show Subsemigroup.closure s ≤ (adjoin R s).toSubsemigroup
    exact Subsemigroup.closure_le.2 (subset_adjoin R)
Equality of Non-unital Subalgebra Generation and Linear Span of Multiplicative Closure
Informal description
For any subset $s$ of a non-unital non-associative semiring $A$ that is also an $R$-module over a commutative semiring $R$, the underlying submodule of the non-unital subalgebra generated by $s$ is equal to the $R$-linear span of the subsemigroup generated by $s$. In other words: $$ \text{adjoin}_R\, s = \text{span}_R (\text{closure}\, s) $$ where $\text{closure}\, s$ denotes the multiplicative subsemigroup generated by $s$.
NonUnitalAlgebra.adjoin_empty theorem
: adjoin R (∅ : Set A) = ⊥
Full source
@[simp]
theorem adjoin_empty : adjoin R ( : Set A) =  :=
  show adjoin R  =  by apply GaloisConnection.l_bot; exact NonUnitalAlgebra.gc
Empty Set Generates Trivial Non-unital Subalgebra
Informal description
The non-unital subalgebra generated by the empty set in a non-unital non-associative semiring $A$ over a commutative semiring $R$ is equal to the bottom element of the lattice of non-unital subalgebras of $A$.
NonUnitalAlgebra.adjoin_univ theorem
: adjoin R (Set.univ : Set A) = ⊤
Full source
@[simp]
theorem adjoin_univ : adjoin R (Set.univ : Set A) =  :=
  eq_top_iff.2 fun _x hx => subset_adjoin R hx
Universal Set Generates Entire Non-unital Subalgebra
Informal description
The non-unital subalgebra generated by the universal set of a non-unital non-associative semiring $A$ over a commutative semiring $R$ is equal to the top element of the complete lattice of non-unital subalgebras, i.e., $\text{adjoin}_R\, A = \top$.
NonUnitalAlgHom.map_adjoin theorem
[IsScalarTower R B B] [SMulCommClass R B B] (f : F) (s : Set A) : map f (adjoin R s) = adjoin R (f '' s)
Full source
lemma _root_.NonUnitalAlgHom.map_adjoin [IsScalarTower R B B] [SMulCommClass R B B]
    (f : F) (s : Set A) : map f (adjoin R s) = adjoin R (f '' s) :=
  Set.image_preimage.l_comm_of_u_comm (gc_map_comap f) NonUnitalAlgebra.gi.gc
    NonUnitalAlgebra.gi.gc fun _t => rfl
Image of Generated Non-unital Subalgebra Under Homomorphism Equals Generated Subalgebra of Image
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with $R$-module structures. Suppose that $B$ satisfies the scalar tower property (i.e., the scalar multiplication by $R$ on $B$ factors through $B$'s own multiplication) and that the scalar multiplications by $R$ and $B$ on $B$ commute. Given a non-unital algebra homomorphism $f \colon A \to B$ and a subset $s \subseteq A$, the image under $f$ of the non-unital subalgebra generated by $s$ in $A$ is equal to the non-unital subalgebra generated by the image $f(s)$ in $B$. In symbols: \[ f(\text{adjoin}_R(s)) = \text{adjoin}_R(f(s)). \]
NonUnitalAlgHom.map_adjoin_singleton theorem
[IsScalarTower R B B] [SMulCommClass R B B] (f : F) (x : A) : map f (adjoin R { x }) = adjoin R {f x}
Full source
@[simp]
lemma _root_.NonUnitalAlgHom.map_adjoin_singleton [IsScalarTower R B B] [SMulCommClass R B B]
    (f : F) (x : A) : map f (adjoin R {x}) = adjoin R {f x} := by
  simp [NonUnitalAlgHom.map_adjoin]
Image of Generated Non-unital Subalgebra Under Homomorphism for Singleton Set
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with $R$-module structures. Suppose that $B$ satisfies the scalar tower property (i.e., the scalar multiplication by $R$ on $B$ factors through $B$'s own multiplication) and that the scalar multiplications by $R$ and $B$ on $B$ commute. Given a non-unital algebra homomorphism $f \colon A \to B$ and an element $x \in A$, the image under $f$ of the non-unital subalgebra generated by $\{x\}$ in $A$ is equal to the non-unital subalgebra generated by $\{f(x)\}$ in $B$. In symbols: \[ f(\text{adjoin}_R(\{x\})) = \text{adjoin}_R(\{f(x)\}). \]
NonUnitalAlgebra.coe_top theorem
: (↑(⊤ : NonUnitalSubalgebra R A) : Set A) = Set.univ
Full source
@[simp]
theorem coe_top : (↑( : NonUnitalSubalgebra R A) : Set A) = Set.univ :=
  rfl
Top Non-Unital Subalgebra Equals Universal Set
Informal description
The underlying set of the top non-unital subalgebra of a non-unital non-associative semiring $A$ over a commutative semiring $R$ is equal to the universal set of $A$, i.e., $\overline{(\top : \text{NonUnitalSubalgebra } R A)} = \text{Set.univ}$.
NonUnitalAlgebra.mem_top theorem
{x : A} : x ∈ (⊤ : NonUnitalSubalgebra R A)
Full source
@[simp]
theorem mem_top {x : A} : x ∈ (⊤ : NonUnitalSubalgebra R A) :=
  Set.mem_univ x
Universal Membership in Top Non-unital Subalgebra
Informal description
For any element $x$ in a non-unital non-associative semiring $A$ that is a module over a commutative semiring $R$, $x$ belongs to the top non-unital subalgebra of $A$ (which is the entire algebra $A$ itself).
NonUnitalAlgebra.top_toSubmodule theorem
: (⊤ : NonUnitalSubalgebra R A).toSubmodule = ⊤
Full source
@[simp]
theorem top_toSubmodule : ( : NonUnitalSubalgebra R A).toSubmodule =  :=
  rfl
Top Non-unital Subalgebra's Submodule is the Universal Submodule
Informal description
For a non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ equipped with an $R$-module structure, the underlying submodule of the top element in the lattice of non-unital subalgebras is equal to the top element in the lattice of submodules of $A$. In other words, $(⊤ : \text{NonUnitalSubalgebra } R A).\text{toSubmodule} = ⊤$.
NonUnitalAlgebra.top_toNonUnitalSubsemiring theorem
: (⊤ : NonUnitalSubalgebra R A).toNonUnitalSubsemiring = ⊤
Full source
@[simp]
theorem top_toNonUnitalSubsemiring : ( : NonUnitalSubalgebra R A).toNonUnitalSubsemiring =  :=
  rfl
Top Non-unital Subalgebra's Underlying Non-unital Subsemiring is Top
Informal description
For a non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying non-unital subsemiring of the top element in the lattice of non-unital subalgebras is equal to the top element in the lattice of non-unital subsemirings of $A$.
NonUnitalAlgebra.top_toSubring theorem
{R A : Type*} [CommRing R] [NonUnitalNonAssocRing A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] : (⊤ : NonUnitalSubalgebra R A).toNonUnitalSubring = ⊤
Full source
@[simp]
theorem top_toSubring {R A : Type*} [CommRing R] [NonUnitalNonAssocRing A] [Module R A]
    [IsScalarTower R A A] [SMulCommClass R A A] :
    ( : NonUnitalSubalgebra R A).toNonUnitalSubring =  :=
  rfl
Equality of Top Non-Unital Subalgebra and Top Non-Unital Subring under Scalar Commutativity Conditions
Informal description
Let $R$ be a commutative ring and $A$ be a non-unital non-associative ring equipped with a module structure over $R$. Assume that: 1. The scalar multiplication satisfies the tower property: $R$ acts on $A$ and $A$ acts on itself in a compatible way ($\text{IsScalarTower}\,R\,A\,A$) 2. The scalar multiplications by $R$ and $A$ commute ($\text{SMulCommClass}\,R\,A\,A$) Then the top element in the lattice of non-unital subalgebras of $A$ over $R$, when viewed as a non-unital subring of $A$, equals the top non-unital subring of $A$. In other words, under these conditions, the largest non-unital subalgebra coincides with the largest non-unital subring.
NonUnitalAlgebra.toSubmodule_eq_top theorem
{S : NonUnitalSubalgebra R A} : S.toSubmodule = ⊤ ↔ S = ⊤
Full source
@[simp]
theorem toSubmodule_eq_top {S : NonUnitalSubalgebra R A} : S.toSubmodule = ⊤ ↔ S = ⊤ :=
  NonUnitalSubalgebra.toSubmodule'.injective.eq_iff' top_toSubmodule
Characterization of Top Non-Unital Subalgebra via Submodule Equality
Informal description
For any non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying submodule of $S$ is equal to the entire module $A$ if and only if $S$ is the top element in the lattice of non-unital subalgebras of $A$.
NonUnitalAlgebra.toNonUnitalSubsemiring_eq_top theorem
{S : NonUnitalSubalgebra R A} : S.toNonUnitalSubsemiring = ⊤ ↔ S = ⊤
Full source
@[simp]
theorem toNonUnitalSubsemiring_eq_top {S : NonUnitalSubalgebra R A} :
    S.toNonUnitalSubsemiring = ⊤ ↔ S = ⊤ :=
  NonUnitalSubalgebra.toNonUnitalSubsemiring_injective.eq_iff' top_toNonUnitalSubsemiring
Characterization of Top Non-Unital Subalgebra via Underlying Subsemiring
Informal description
For any non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying non-unital subsemiring of $S$ equals the entire semiring $A$ if and only if $S$ itself equals the top element in the lattice of non-unital subalgebras of $A$.
NonUnitalAlgebra.to_subring_eq_top theorem
{R A : Type*} [CommRing R] [Ring A] [Algebra R A] {S : NonUnitalSubalgebra R A} : S.toNonUnitalSubring = ⊤ ↔ S = ⊤
Full source
@[simp]
theorem to_subring_eq_top {R A : Type*} [CommRing R] [Ring A] [Algebra R A]
    {S : NonUnitalSubalgebra R A} : S.toNonUnitalSubring = ⊤ ↔ S = ⊤ :=
  NonUnitalSubalgebra.toNonUnitalSubring_injective.eq_iff' top_toSubring
Equivalence of Top Non-Unital Subalgebra and Top Non-Unital Subring in Algebras over Commutative Rings
Informal description
Let $R$ be a commutative ring and $A$ be a ring equipped with an algebra structure over $R$. For any non-unital subalgebra $S$ of $A$ over $R$, the underlying non-unital subring of $S$ equals the top non-unital subring of $A$ if and only if $S$ is the top non-unital subalgebra of $A$.
NonUnitalAlgebra.mem_sup_left theorem
{S T : NonUnitalSubalgebra R A} : ∀ {x : A}, x ∈ S → x ∈ S ⊔ T
Full source
theorem mem_sup_left {S T : NonUnitalSubalgebra R A} : ∀ {x : A}, x ∈ Sx ∈ S ⊔ T := by
  rw [← SetLike.le_def]
  exact le_sup_left
Left Inclusion in Supremum of Non-unital Subalgebras
Informal description
For any non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, and for any element $x \in A$, if $x$ belongs to $S$, then $x$ also belongs to the supremum $S \sqcup T$ of $S$ and $T$ in the lattice of non-unital subalgebras.
NonUnitalAlgebra.mem_sup_right theorem
{S T : NonUnitalSubalgebra R A} : ∀ {x : A}, x ∈ T → x ∈ S ⊔ T
Full source
theorem mem_sup_right {S T : NonUnitalSubalgebra R A} : ∀ {x : A}, x ∈ Tx ∈ S ⊔ T := by
  rw [← SetLike.le_def]
  exact le_sup_right
Right Inclusion in Supremum of Non-unital Subalgebras
Informal description
For any non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, and for any element $x \in A$, if $x$ belongs to $T$, then $x$ also belongs to the supremum $S \sqcup T$ of $S$ and $T$ in the lattice of non-unital subalgebras.
NonUnitalAlgebra.mul_mem_sup theorem
{S T : NonUnitalSubalgebra R A} {x y : A} (hx : x ∈ S) (hy : y ∈ T) : x * y ∈ S ⊔ T
Full source
theorem mul_mem_sup {S T : NonUnitalSubalgebra R A} {x y : A} (hx : x ∈ S) (hy : y ∈ T) :
    x * y ∈ S ⊔ T :=
  mul_mem (mem_sup_left hx) (mem_sup_right hy)
Product of Elements from Two Non-unital Subalgebras Belongs to Their Supremum
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with an $R$-module structure. For any two non-unital subalgebras $S$ and $T$ of $A$, and any elements $x \in S$ and $y \in T$, the product $x \cdot y$ belongs to the supremum $S \sqcup T$ in the lattice of non-unital subalgebras.
NonUnitalAlgebra.map_sup theorem
[IsScalarTower R B B] [SMulCommClass R B B] (f : F) (S T : NonUnitalSubalgebra R A) : ((S ⊔ T).map f : NonUnitalSubalgebra R B) = S.map f ⊔ T.map f
Full source
theorem map_sup [IsScalarTower R B B] [SMulCommClass R B B]
    (f : F) (S T : NonUnitalSubalgebra R A) :
    ((S ⊔ T).map f : NonUnitalSubalgebra R B) = S.map f ⊔ T.map f :=
  (NonUnitalSubalgebra.gc_map_comap f).l_sup
Image of Supremum of Non-unital Subalgebras Under Homomorphism Equals Supremum of Images
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with $R$-module structures. Assume that $B$ satisfies the scalar tower property (i.e., the scalar multiplication by $R$ on $B$ is compatible with the multiplication in $B$) and that the scalar multiplications by $R$ and $B$ on $B$ commute. Given a non-unital algebra homomorphism $f \colon A \to B$ and two non-unital subalgebras $S$ and $T$ of $A$, the image of the supremum $S \sqcup T$ under $f$ is equal to the supremum of the images of $S$ and $T$ under $f$, i.e., \[ f(S \sqcup T) = f(S) \sqcup f(T). \]
NonUnitalAlgebra.map_inf theorem
[IsScalarTower R B B] [SMulCommClass R B B] (f : F) (hf : Function.Injective f) (S T : NonUnitalSubalgebra R A) : ((S ⊓ T).map f : NonUnitalSubalgebra R B) = S.map f ⊓ T.map f
Full source
theorem map_inf [IsScalarTower R B B] [SMulCommClass R B B]
    (f : F) (hf : Function.Injective f) (S T : NonUnitalSubalgebra R A) :
    ((S ⊓ T).map f : NonUnitalSubalgebra R B) = S.map f ⊓ T.map f :=
  SetLike.coe_injective (Set.image_inter hf)
Image of Intersection of Non-unital Subalgebras under Injective Homomorphism Equals Intersection of Images
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with a module structure over $R$. Suppose that $B$ satisfies the scalar tower property and scalar multiplication commutativity with respect to $R$. Given an injective non-unital algebra homomorphism $f \colon A \to B$ and two non-unital subalgebras $S$ and $T$ of $A$, the image of the intersection $S \cap T$ under $f$ is equal to the intersection of the images of $S$ and $T$ under $f$, i.e., $f(S \cap T) = f(S) \cap f(T)$ as non-unital subalgebras of $B$.
NonUnitalAlgebra.coe_inf theorem
(S T : NonUnitalSubalgebra R A) : (↑(S ⊓ T) : Set A) = (S : Set A) ∩ T
Full source
@[simp, norm_cast]
theorem coe_inf (S T : NonUnitalSubalgebra R A) : (↑(S ⊓ T) : Set A) = (S : Set A) ∩ T :=
  rfl
Infimum of Non-unital Subalgebras as Set Intersection
Informal description
For any two non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying set of their infimum $S \sqcap T$ is equal to the intersection of the underlying sets of $S$ and $T$, i.e., $(S \sqcap T) = S \cap T$ as subsets of $A$.
NonUnitalAlgebra.mem_inf theorem
{S T : NonUnitalSubalgebra R A} {x : A} : x ∈ S ⊓ T ↔ x ∈ S ∧ x ∈ T
Full source
@[simp]
theorem mem_inf {S T : NonUnitalSubalgebra R A} {x : A} : x ∈ S ⊓ Tx ∈ S ⊓ T ↔ x ∈ S ∧ x ∈ T :=
  Iff.rfl
Characterization of Membership in the Infimum of Non-unital Subalgebras
Informal description
For any non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, and for any element $x \in A$, we have $x \in S \sqcap T$ if and only if $x \in S$ and $x \in T$.
NonUnitalAlgebra.inf_toSubmodule theorem
(S T : NonUnitalSubalgebra R A) : (S ⊓ T).toSubmodule = S.toSubmodule ⊓ T.toSubmodule
Full source
@[simp]
theorem inf_toSubmodule (S T : NonUnitalSubalgebra R A) :
    (S ⊓ T).toSubmodule = S.toSubmodule ⊓ T.toSubmodule :=
  rfl
Submodule Structure Preserved Under Infimum of Non-unital Subalgebras
Informal description
For any two non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying submodule of their infimum $S \sqcap T$ is equal to the infimum of their underlying submodules $S.\text{toSubmodule} \sqcap T.\text{toSubmodule}$.
NonUnitalAlgebra.inf_toNonUnitalSubsemiring theorem
(S T : NonUnitalSubalgebra R A) : (S ⊓ T).toNonUnitalSubsemiring = S.toNonUnitalSubsemiring ⊓ T.toNonUnitalSubsemiring
Full source
@[simp]
theorem inf_toNonUnitalSubsemiring (S T : NonUnitalSubalgebra R A) :
    (S ⊓ T).toNonUnitalSubsemiring = S.toNonUnitalSubsemiring ⊓ T.toNonUnitalSubsemiring :=
  rfl
Infimum of Non-unital Subalgebras Preserves Underlying Non-unital Subsemiring Structure
Informal description
For any two non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying non-unital subsemiring of their infimum $S \sqcap T$ is equal to the infimum of their underlying non-unital subsemirings. That is, $(S \sqcap T).\text{toNonUnitalSubsemiring} = S.\text{toNonUnitalSubsemiring} \sqcap T.\text{toNonUnitalSubsemiring}$.
NonUnitalAlgebra.coe_sInf theorem
(S : Set (NonUnitalSubalgebra R A)) : (↑(sInf S) : Set A) = ⋂ s ∈ S, ↑s
Full source
@[simp, norm_cast]
theorem coe_sInf (S : Set (NonUnitalSubalgebra R A)) : (↑(sInf S) : Set A) = ⋂ s ∈ S, ↑s :=
  sInf_image
Infimum of Non-unital Subalgebras as Intersection of Underlying Sets
Informal description
For any set $S$ of non-unital subalgebras of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying set of the infimum of $S$ is equal to the intersection of the underlying sets of all subalgebras in $S$. That is, $$ \left(\bigsqcap S\right) = \bigcap_{s \in S} s. $$
NonUnitalAlgebra.mem_sInf theorem
{S : Set (NonUnitalSubalgebra R A)} {x : A} : x ∈ sInf S ↔ ∀ p ∈ S, x ∈ p
Full source
theorem mem_sInf {S : Set (NonUnitalSubalgebra R A)} {x : A} : x ∈ sInf Sx ∈ sInf S ↔ ∀ p ∈ S, x ∈ p := by
  simp only [← SetLike.mem_coe, coe_sInf, Set.mem_iInter₂]
Characterization of Membership in Infimum of Non-unital Subalgebras
Informal description
For any set $S$ of non-unital subalgebras of a non-unital non-associative semiring $A$ over a commutative semiring $R$, and for any element $x \in A$, we have $x \in \bigsqcap S$ if and only if $x$ belongs to every subalgebra $p \in S$.
NonUnitalAlgebra.sInf_toSubmodule theorem
(S : Set (NonUnitalSubalgebra R A)) : (sInf S).toSubmodule = sInf (NonUnitalSubalgebra.toSubmodule '' S)
Full source
@[simp]
theorem sInf_toSubmodule (S : Set (NonUnitalSubalgebra R A)) :
    (sInf S).toSubmodule = sInf (NonUnitalSubalgebra.toSubmoduleNonUnitalSubalgebra.toSubmodule '' S) :=
  SetLike.coe_injective <| by simp
Infimum of Non-unital Subalgebras as Infimum of Submodules
Informal description
For any set $S$ of non-unital subalgebras of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying submodule of the infimum of $S$ is equal to the infimum of the image of $S$ under the map that takes each non-unital subalgebra to its underlying submodule. That is, $$ (\bigsqcap S).\text{toSubmodule} = \bigsqcap (\text{NonUnitalSubalgebra.toSubmodule} '' S). $$
NonUnitalAlgebra.sInf_toNonUnitalSubsemiring theorem
(S : Set (NonUnitalSubalgebra R A)) : (sInf S).toNonUnitalSubsemiring = sInf (NonUnitalSubalgebra.toNonUnitalSubsemiring '' S)
Full source
@[simp]
theorem sInf_toNonUnitalSubsemiring (S : Set (NonUnitalSubalgebra R A)) :
    (sInf S).toNonUnitalSubsemiring = sInf (NonUnitalSubalgebra.toNonUnitalSubsemiringNonUnitalSubalgebra.toNonUnitalSubsemiring '' S) :=
  SetLike.coe_injective <| by simp
Infimum of Non-unital Subalgebras as Non-unital Subsemirings
Informal description
For any set $S$ of non-unital subalgebras of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the underlying non-unital subsemiring of the infimum of $S$ is equal to the infimum of the images of the underlying non-unital subsemirings of all subalgebras in $S$. That is, $$ \left(\bigsqcap S\right)_{\text{subsemiring}} = \bigsqcap \{s_{\text{subsemiring}} \mid s \in S\}. $$
NonUnitalAlgebra.coe_iInf theorem
{ι : Sort*} {S : ι → NonUnitalSubalgebra R A} : (↑(⨅ i, S i) : Set A) = ⋂ i, S i
Full source
@[simp, norm_cast]
theorem coe_iInf {ι : Sort*} {S : ι → NonUnitalSubalgebra R A} :
    (↑(⨅ i, S i) : Set A) = ⋂ i, S i := by simp [iInf]
Infimum of Non-unital Subalgebras as Intersection of Underlying Sets
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. For any family $\{S_i\}_{i \in \iota}$ of non-unital subalgebras of $A$, the underlying set of the infimum $\bigsqcap_i S_i$ is equal to the intersection $\bigcap_i S_i$ of the underlying sets of the subalgebras. That is, $$ \left(\bigsqcap_i S_i\right) = \bigcap_i S_i. $$
NonUnitalAlgebra.mem_iInf theorem
{ι : Sort*} {S : ι → NonUnitalSubalgebra R A} {x : A} : (x ∈ ⨅ i, S i) ↔ ∀ i, x ∈ S i
Full source
theorem mem_iInf {ι : Sort*} {S : ι → NonUnitalSubalgebra R A} {x : A} :
    (x ∈ ⨅ i, S i) ↔ ∀ i, x ∈ S i := by simp only [iInf, mem_sInf, Set.forall_mem_range]
Characterization of Membership in Infimum of Non-unital Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. For any family $\{S_i\}_{i \in \iota}$ of non-unital subalgebras of $A$ and any element $x \in A$, we have: $$x \in \bigsqcap_i S_i \leftrightarrow \forall i \in \iota, x \in S_i$$ where $\bigsqcap_i S_i$ denotes the infimum (intersection) of the family of subalgebras $\{S_i\}_{i \in \iota}$.
NonUnitalAlgebra.map_iInf theorem
{ι : Sort*} [Nonempty ι] [IsScalarTower R B B] [SMulCommClass R B B] (f : F) (hf : Function.Injective f) (S : ι → NonUnitalSubalgebra R A) : ((⨅ i, S i).map f : NonUnitalSubalgebra R B) = ⨅ i, (S i).map f
Full source
theorem map_iInf {ι : Sort*} [Nonempty ι]
    [IsScalarTower R B B] [SMulCommClass R B B] (f : F)
    (hf : Function.Injective f) (S : ι → NonUnitalSubalgebra R A) :
    ((⨅ i, S i).map f : NonUnitalSubalgebra R B) = ⨅ i, (S i).map f := by
  apply SetLike.coe_injective
  simpa using (Set.injOn_of_injective hf).image_iInter_eq (s := SetLike.coeSetLike.coe ∘ S)
Image of Infimum of Non-Unital Subalgebras under Injective Homomorphism Equals Infimum of Images
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with module structures over $R$. Suppose that: 1. The index set $\iota$ is nonempty. 2. The scalar multiplication operations satisfy the tower property $[IsScalarTower\, R\, B\, B]$ and the commutativity condition $[SMulCommClass\, R\, B\, B]$. 3. $f : A \to B$ is an injective non-unital algebra homomorphism. Then for any family $\{S_i\}_{i \in \iota}$ of non-unital subalgebras of $A$, the image of their infimum under $f$ equals the infimum of their images: $$ f\left(\bigsqcap_{i \in \iota} S_i\right) = \bigsqcap_{i \in \iota} f(S_i). $$
NonUnitalAlgebra.iInf_toSubmodule theorem
{ι : Sort*} (S : ι → NonUnitalSubalgebra R A) : (⨅ i, S i).toSubmodule = ⨅ i, (S i).toSubmodule
Full source
@[simp]
theorem iInf_toSubmodule {ι : Sort*} (S : ι → NonUnitalSubalgebra R A) :
    (⨅ i, S i).toSubmodule = ⨅ i, (S i).toSubmodule :=
  SetLike.coe_injective <| by simp
Infimum of Non-unital Subalgebras Commutes with Submodule Construction
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. For any family $\{S_i\}_{i \in \iota}$ of non-unital subalgebras of $A$, the submodule associated with the infimum $\bigsqcap_i S_i$ is equal to the infimum of the submodules associated with each $S_i$. That is, $$ \left(\bigsqcap_i S_i\right).\text{toSubmodule} = \bigsqcap_i (S_i.\text{toSubmodule}). $$
NonUnitalAlgebra.instInhabitedNonUnitalSubalgebra instance
: Inhabited (NonUnitalSubalgebra R A)
Full source
instance : Inhabited (NonUnitalSubalgebra R A) :=
  ⟨⊥⟩
Existence of Trivial Non-unital Subalgebra
Informal description
For any commutative semiring $R$ and non-unital non-associative semiring $A$ equipped with a module structure over $R$, the collection of non-unital subalgebras of $A$ is nonempty. In particular, the trivial subalgebra $\{0\}$ always exists.
NonUnitalAlgebra.mem_bot theorem
{x : A} : x ∈ (⊥ : NonUnitalSubalgebra R A) ↔ x = 0
Full source
theorem mem_bot {x : A} : x ∈ (⊥ : NonUnitalSubalgebra R A)x ∈ (⊥ : NonUnitalSubalgebra R A) ↔ x = 0 :=
  show x ∈ Submodule.span R (NonUnitalSubsemiring.closure (∅ : Set A) : Set A)x ∈ Submodule.span R (NonUnitalSubsemiring.closure (∅ : Set A) : Set A) ↔ x = 0 by
    rw [NonUnitalSubsemiring.closure_empty, NonUnitalSubsemiring.coe_bot,
      Submodule.span_zero_singleton, Submodule.mem_bot]
Membership in Zero Non-unital Subalgebra is Equivalent to Being Zero
Informal description
For any element $x$ in a non-unital algebra $A$ over a commutative semiring $R$, $x$ belongs to the bottom non-unital subalgebra (the zero subalgebra) if and only if $x$ is equal to the zero element of $A$.
NonUnitalAlgebra.toSubmodule_bot theorem
: (⊥ : NonUnitalSubalgebra R A).toSubmodule = ⊥
Full source
theorem toSubmodule_bot : ( : NonUnitalSubalgebra R A).toSubmodule =  := by
  ext
  simp only [mem_bot, NonUnitalSubalgebra.mem_toSubmodule, Submodule.mem_bot]
Bottom Non-unital Subalgebra Corresponds to Bottom Submodule
Informal description
For any non-unital subalgebra $S$ over a commutative semiring $R$ in a non-unital non-associative semiring $A$ with a module structure, the underlying submodule of the bottom element $\bot$ in the lattice of non-unital subalgebras is equal to the bottom element $\bot$ in the lattice of submodules. In other words, $(⊥ : \text{NonUnitalSubalgebra } R A).\text{toSubmodule} = ⊥$.
NonUnitalAlgebra.coe_bot theorem
: ((⊥ : NonUnitalSubalgebra R A) : Set A) = {0}
Full source
@[simp]
theorem coe_bot : (( : NonUnitalSubalgebra R A) : Set A) = {0} := by
  simp [Set.ext_iff, NonUnitalAlgebra.mem_bot]
Bottom Non-unital Subalgebra is Zero Set
Informal description
The underlying set of the bottom (smallest) non-unital subalgebra of a non-unital non-associative semiring $A$ over a commutative semiring $R$ is equal to the singleton set containing the zero element of $A$, i.e., $\{0\}$.
NonUnitalAlgebra.range_id theorem
: NonUnitalAlgHom.range (NonUnitalAlgHom.id R A) = ⊤
Full source
@[simp]
theorem range_id : NonUnitalAlgHom.range (NonUnitalAlgHom.id R A) =  :=
  SetLike.coe_injective Set.range_id
Range of Identity Non-Unital Algebra Homomorphism is Top Subalgebra
Informal description
For a non-unital algebra $A$ over a commutative semiring $R$, the range of the identity non-unital algebra homomorphism $\mathrm{id} \colon A \to A$ is equal to the top element $\top$ in the lattice of non-unital subalgebras of $A$.
NonUnitalAlgebra.map_top theorem
(f : A →ₙₐ[R] B) : (⊤ : NonUnitalSubalgebra R A).map f = NonUnitalAlgHom.range f
Full source
@[simp]
theorem map_top (f : A →ₙₐ[R] B) : ( : NonUnitalSubalgebra R A).map f = NonUnitalAlgHom.range f :=
  SetLike.coe_injective Set.image_univ
Image of Top Subalgebra Equals Range of Homomorphism
Informal description
For any non-unital algebra homomorphism $f \colon A \to B$ over a commutative semiring $R$, the image of the top non-unital subalgebra of $A$ under $f$ equals the range of $f$ as a non-unital subalgebra of $B$.
NonUnitalAlgebra.map_bot theorem
[IsScalarTower R B B] [SMulCommClass R B B] (f : A →ₙₐ[R] B) : (⊥ : NonUnitalSubalgebra R A).map f = ⊥
Full source
@[simp]
theorem map_bot [IsScalarTower R B B] [SMulCommClass R B B]
    (f : A →ₙₐ[R] B) : ( : NonUnitalSubalgebra R A).map f =  :=
  SetLike.coe_injective <| by simp [NonUnitalAlgebra.coe_bot, NonUnitalSubalgebra.coe_map]
Image of Bottom Non-Unital Subalgebra Under Homomorphism is Bottom Subalgebra
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with module structures over $R$. Assume that $B$ satisfies the scalar tower property (i.e., the scalar multiplication by $R$ on $B$ factors through $B$'s own multiplication) and that the scalar multiplications by $R$ and $B$ on $B$ commute. For any non-unital algebra homomorphism $f \colon A \to B$ over $R$, the image of the bottom (smallest) non-unital subalgebra of $A$ under $f$ is equal to the bottom non-unital subalgebra of $B$.
NonUnitalAlgebra.comap_top theorem
[IsScalarTower R B B] [SMulCommClass R B B] (f : A →ₙₐ[R] B) : (⊤ : NonUnitalSubalgebra R B).comap f = ⊤
Full source
@[simp]
theorem comap_top [IsScalarTower R B B] [SMulCommClass R B B]
    (f : A →ₙₐ[R] B) : ( : NonUnitalSubalgebra R B).comap f =  :=
  eq_top_iff.2 fun _ => mem_top
Preimage of Top Subalgebra is Top Subalgebra
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with $R$-module structures. Suppose that $B$ satisfies the scalar tower property (i.e., the scalar multiplication by $R$ on $B$ factors through $B$) and that the scalar multiplications by $R$ and $B$ on $B$ commute. For any non-unital algebra homomorphism $f \colon A \to B$, the preimage of the top non-unital subalgebra of $B$ under $f$ is equal to the top non-unital subalgebra of $A$.
NonUnitalAlgebra.toTop definition
: A →ₙₐ[R] (⊤ : NonUnitalSubalgebra R A)
Full source
/-- `NonUnitalAlgHom` to `⊤ : NonUnitalSubalgebra R A`. -/
def toTop : A →ₙₐ[R] (⊤ : NonUnitalSubalgebra R A) :=
  NonUnitalAlgHom.codRestrict (NonUnitalAlgHom.id R A)  fun _ => mem_top
Canonical homomorphism to the top non-unital subalgebra
Informal description
The canonical non-unital algebra homomorphism from a non-unital algebra $A$ over a commutative semiring $R$ to the top element (the entire algebra $A$ itself) in the lattice of non-unital subalgebras of $A$.
NonUnitalAlgebra.range_eq_top theorem
[IsScalarTower R B B] [SMulCommClass R B B] (f : A →ₙₐ[R] B) : NonUnitalAlgHom.range f = (⊤ : NonUnitalSubalgebra R B) ↔ Function.Surjective f
Full source
theorem range_eq_top [IsScalarTower R B B] [SMulCommClass R B B] (f : A →ₙₐ[R] B) :
    NonUnitalAlgHom.rangeNonUnitalAlgHom.range f = (⊤ : NonUnitalSubalgebra R B) ↔ Function.Surjective f :=
  NonUnitalAlgebra.eq_top_iff
Range of Non-Unital Algebra Homomorphism Equals Entire Subalgebra if and only if Surjective
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with $R$-module structures. Suppose that $B$ satisfies the scalar tower property (i.e., the scalar multiplication by $R$ on $B$ factors through $B$) and that the scalar multiplications by $R$ and $B$ on $B$ commute. For a non-unital algebra homomorphism $f \colon A \to B$, the range of $f$ is equal to the entire non-unital subalgebra $B$ if and only if $f$ is surjective.
NonUnitalSubalgebra.range_val theorem
: NonUnitalAlgHom.range (NonUnitalSubalgebraClass.subtype S) = S
Full source
theorem range_val : NonUnitalAlgHom.range (NonUnitalSubalgebraClass.subtype S) = S :=
  ext <| Set.ext_iff.1 <|
    (NonUnitalAlgHom.coe_range <| NonUnitalSubalgebraClass.subtype S).trans Subtype.range_val
Range of Inclusion Homomorphism Equals Subalgebra
Informal description
For any non-unital subalgebra $S$ of a non-unital algebra $A$ over a commutative semiring $R$, the range of the inclusion homomorphism $\text{subtype} \colon S \to A$ (which maps each element to itself) is equal to $S$ itself when viewed as a non-unital subalgebra.
NonUnitalSubalgebra.subsingleton_of_subsingleton instance
[Subsingleton A] : Subsingleton (NonUnitalSubalgebra R A)
Full source
instance subsingleton_of_subsingleton [Subsingleton A] : Subsingleton (NonUnitalSubalgebra R A) :=
  ⟨fun B C => ext fun x => by simp only [Subsingleton.elim x 0, zero_mem B, zero_mem C]⟩
Subsingleton of Non-unital Subalgebras for Subsingleton Algebras
Informal description
For any non-unital non-associative semiring $A$ that is a subsingleton (i.e., has at most one element), the collection of non-unital subalgebras of $A$ over a commutative semiring $R$ is also a subsingleton.
NonUnitalSubalgebra.prod definition
: NonUnitalSubalgebra R (A × B)
Full source
/-- The product of two non-unital subalgebras is a non-unital subalgebra. -/
def prod : NonUnitalSubalgebra R (A × B) :=
  { S.toNonUnitalSubsemiring.prod S₁.toNonUnitalSubsemiring with
    carrier := S ×ˢ S₁
    smul_mem' := fun r _x hx => ⟨SMulMemClass.smul_mem r hx.1, SMulMemClass.smul_mem r hx.2⟩ }
Product of non-unital subalgebras
Informal description
Given two non-unital subalgebras $S$ and $S_1$ over a commutative semiring $R$, where $S$ is a subalgebra of $A$ and $S_1$ is a subalgebra of $B$, their product $S \times S_1$ is a non-unital subalgebra of the direct product algebra $A \times B$. The underlying set is the Cartesian product of the underlying sets of $S$ and $S_1$, and it is closed under scalar multiplication by elements of $R$ (acting componentwise).
NonUnitalSubalgebra.coe_prod theorem
: (prod S S₁ : Set (A × B)) = (S : Set A) ×ˢ S₁
Full source
@[simp]
theorem coe_prod : (prod S S₁ : Set (A × B)) = (S : Set A) ×ˢ S₁ :=
  rfl
Underlying Set of Product Subalgebra Equals Cartesian Product of Underlying Sets
Informal description
For any non-unital subalgebras $S$ of $A$ and $S_1$ of $B$ over a commutative semiring $R$, the underlying set of their product subalgebra $S \times S_1$ is equal to the Cartesian product of the underlying sets of $S$ and $S_1$ as subsets of $A \times B$.
NonUnitalSubalgebra.prod_toSubmodule theorem
: (S.prod S₁).toSubmodule = S.toSubmodule.prod S₁.toSubmodule
Full source
theorem prod_toSubmodule : (S.prod S₁).toSubmodule = S.toSubmodule.prod S₁.toSubmodule :=
  rfl
Submodule Structure of Product Non-Unital Subalgebras
Informal description
For any two non-unital subalgebras $S$ and $S_1$ over a commutative semiring $R$, the underlying submodule of their product $S \times S_1$ is equal to the product of their underlying submodules $S_{\text{module}} \times S_{1,\text{module}}$.
NonUnitalSubalgebra.mem_prod theorem
{S : NonUnitalSubalgebra R A} {S₁ : NonUnitalSubalgebra R B} {x : A × B} : x ∈ prod S S₁ ↔ x.1 ∈ S ∧ x.2 ∈ S₁
Full source
@[simp]
theorem mem_prod {S : NonUnitalSubalgebra R A} {S₁ : NonUnitalSubalgebra R B} {x : A × B} :
    x ∈ prod S S₁x ∈ prod S S₁ ↔ x.1 ∈ S ∧ x.2 ∈ S₁ :=
  Set.mem_prod
Membership Condition for Product of Non-unital Subalgebras: $x \in S \times S_1 \leftrightarrow x_1 \in S \land x_2 \in S_1$
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with module structures over $R$. For any non-unital subalgebras $S \subseteq A$ and $S_1 \subseteq B$, and any element $x = (x_1, x_2) \in A \times B$, we have $x \in S \times S_1$ if and only if $x_1 \in S$ and $x_2 \in S_1$.
NonUnitalSubalgebra.prod_top theorem
: (prod ⊤ ⊤ : NonUnitalSubalgebra R (A × B)) = ⊤
Full source
@[simp]
theorem prod_top : (prod   : NonUnitalSubalgebra R (A × B)) =  := by ext; simp
Product of Top Non-Unital Subalgebras is Top in Product Algebra
Informal description
The product of the top non-unital subalgebras of $A$ and $B$ over a commutative semiring $R$ is equal to the top non-unital subalgebra of the product algebra $A \times B$.
NonUnitalSubalgebra.prod_mono theorem
{S T : NonUnitalSubalgebra R A} {S₁ T₁ : NonUnitalSubalgebra R B} : S ≤ T → S₁ ≤ T₁ → prod S S₁ ≤ prod T T₁
Full source
theorem prod_mono {S T : NonUnitalSubalgebra R A} {S₁ T₁ : NonUnitalSubalgebra R B} :
    S ≤ T → S₁ ≤ T₁ → prod S S₁ ≤ prod T T₁ :=
  Set.prod_mono
Monotonicity of Product Non-unital Subalgebras with Respect to Inclusion
Informal description
Let $R$ be a commutative semiring, and let $A$ and $B$ be non-unital non-associative semirings equipped with module structures over $R$. For any non-unital subalgebras $S, T \subseteq A$ and $S_1, T_1 \subseteq B$, if $S \subseteq T$ and $S_1 \subseteq T_1$, then the product subalgebra $S \times S_1$ is contained in the product subalgebra $T \times T_1$.
NonUnitalSubalgebra.prod_inf_prod theorem
{S T : NonUnitalSubalgebra R A} {S₁ T₁ : NonUnitalSubalgebra R B} : S.prod S₁ ⊓ T.prod T₁ = (S ⊓ T).prod (S₁ ⊓ T₁)
Full source
@[simp]
theorem prod_inf_prod {S T : NonUnitalSubalgebra R A} {S₁ T₁ : NonUnitalSubalgebra R B} :
    S.prod S₁ ⊓ T.prod T₁ = (S ⊓ T).prod (S₁ ⊓ T₁) :=
  SetLike.coe_injective Set.prod_inter_prod
Infimum of Product Subalgebras Equals Product of Infima
Informal description
For any non-unital subalgebras $S, T$ of a non-unital non-associative semiring $A$ and $S_1, T_1$ of a non-unital non-associative semiring $B$ over a commutative semiring $R$, the infimum of the product subalgebras $S \times S_1$ and $T \times T_1$ is equal to the product of the infima $(S \sqcap T) \times (S_1 \sqcap T_1)$. In symbols: $$ (S \times S_1) \sqcap (T \times T_1) = (S \sqcap T) \times (S_1 \sqcap T_1). $$
NonUnitalAlgHom.subsingleton instance
[Subsingleton (NonUnitalSubalgebra R A)] : Subsingleton (A →ₙₐ[R] B)
Full source
instance _root_.NonUnitalAlgHom.subsingleton [Subsingleton (NonUnitalSubalgebra R A)] :
    Subsingleton (A →ₙₐ[R] B) :=
  ⟨fun f g =>
    NonUnitalAlgHom.ext fun a =>
      have : a ∈ (⊥ : NonUnitalSubalgebra R A) :=
        Subsingleton.elim (⊤ : NonUnitalSubalgebra R A) ⊥ ▸ mem_top
      (mem_bot.mp this).symm ▸ (map_zero f).trans (map_zero g).symm⟩
Uniqueness of Non-unital Algebra Homomorphisms from a Subsingleton Subalgebra
Informal description
If there is at most one non-unital subalgebra of a non-unital non-associative semiring $A$ over a commutative semiring $R$, then there is at most one non-unital algebra homomorphism from $A$ to any other non-unital non-associative semiring $B$ over $R$.
NonUnitalSubalgebra.inclusion definition
{S T : NonUnitalSubalgebra R A} (h : S ≤ T) : S →ₙₐ[R] T
Full source
/-- The map `S → T` when `S` is a non-unital subalgebra contained in the non-unital subalgebra `T`.

This is the non-unital subalgebra version of `Submodule.inclusion`, or `Subring.inclusion` -/
def inclusion {S T : NonUnitalSubalgebra R A} (h : S ≤ T) : S →ₙₐ[R] T where
  toFun := Set.inclusion h
  map_add' _ _ := rfl
  map_mul' _ _ := rfl
  map_zero' := rfl
  map_smul' _ _ := rfl
Inclusion homomorphism between non-unital subalgebras
Informal description
Given two non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, with $S$ contained in $T$ (i.e., $S \leq T$), the inclusion map $\text{inclusion}(h) : S \to T$ is a non-unital algebra homomorphism that: 1. Maps each element of $S$ to itself in $T$ 2. Preserves addition ($f(x + y) = f(x) + f(y)$) 3. Preserves multiplication ($f(x \cdot y) = f(x) \cdot f(y)$) 4. Maps zero to zero ($f(0) = 0$) 5. Preserves scalar multiplication ($f(r \cdot x) = r \cdot f(x)$ for $r \in R$) This is the non-unital subalgebra version of the inclusion map between submodules or subrings.
NonUnitalSubalgebra.inclusion_injective theorem
{S T : NonUnitalSubalgebra R A} (h : S ≤ T) : Function.Injective (inclusion h)
Full source
theorem inclusion_injective {S T : NonUnitalSubalgebra R A} (h : S ≤ T) :
    Function.Injective (inclusion h) := fun _ _ => Subtype.extSubtype.ext ∘ Subtype.mk.inj
Injectivity of the Inclusion Homomorphism Between Non-unital Subalgebras
Informal description
For any two non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, if $S$ is contained in $T$ (i.e., $S \leq T$), then the inclusion homomorphism $\text{inclusion}(h) : S \to T$ is injective.
NonUnitalSubalgebra.inclusion_self theorem
{S : NonUnitalSubalgebra R A} : inclusion (le_refl S) = NonUnitalAlgHom.id R S
Full source
@[simp]
theorem inclusion_self {S : NonUnitalSubalgebra R A} :
    inclusion (le_refl S) = NonUnitalAlgHom.id R S :=
  rfl
Inclusion Homomorphism of a Non-unital Subalgebra into Itself is the Identity
Informal description
For any non-unital subalgebra $S$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, the inclusion homomorphism of $S$ into itself (induced by the reflexivity of the inclusion order) is equal to the identity non-unital algebra homomorphism on $S$.
NonUnitalSubalgebra.inclusion_mk theorem
{S T : NonUnitalSubalgebra R A} (h : S ≤ T) (x : A) (hx : x ∈ S) : inclusion h ⟨x, hx⟩ = ⟨x, h hx⟩
Full source
@[simp]
theorem inclusion_mk {S T : NonUnitalSubalgebra R A} (h : S ≤ T) (x : A) (hx : x ∈ S) :
    inclusion h ⟨x, hx⟩ = ⟨x, h hx⟩ :=
  rfl
Inclusion Homomorphism Maps Elements Preserving Membership Proofs in Non-unital Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. For any two non-unital subalgebras $S$ and $T$ of $A$ with $S \subseteq T$, and any element $x \in A$ that belongs to $S$, the inclusion homomorphism maps the element $\langle x, hx \rangle$ of $S$ to the element $\langle x, h hx \rangle$ of $T$, where $hx$ is the proof that $x \in S$ and $h hx$ is the proof that $x \in T$ obtained via the inclusion $h$.
NonUnitalSubalgebra.inclusion_right theorem
{S T : NonUnitalSubalgebra R A} (h : S ≤ T) (x : T) (m : (x : A) ∈ S) : inclusion h ⟨x, m⟩ = x
Full source
theorem inclusion_right {S T : NonUnitalSubalgebra R A} (h : S ≤ T) (x : T) (m : (x : A) ∈ S) :
    inclusion h ⟨x, m⟩ = x :=
  Subtype.ext rfl
Right Inclusion Property for Non-unital Subalgebras
Informal description
Let $S$ and $T$ be non-unital subalgebras of a non-unital non-associative semiring $A$ over a commutative semiring $R$, with $S \subseteq T$. For any element $x \in T$ that also belongs to $S$ (i.e., $x \in S$), the inclusion homomorphism $\text{inclusion}(h)$ maps the element $\langle x, m \rangle$ of $S$ (where $m$ is the proof that $x \in S$) back to $x$ itself in $T$.
NonUnitalSubalgebra.inclusion_inclusion theorem
{S T U : NonUnitalSubalgebra R A} (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 {S T U : NonUnitalSubalgebra R A} (hst : S ≤ T) (htu : T ≤ U) (x : S) :
    inclusion htu (inclusion hst x) = inclusion (le_trans hst htu) x :=
  Subtype.ext rfl
Composition of Inclusion Maps for Non-Unital Subalgebras
Informal description
For any non-unital subalgebras $S$, $T$, and $U$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, if $S \leq T$ and $T \leq U$, then for any $x \in S$, the composition of inclusion maps satisfies: \[ \text{inclusion}(T \leq U) \circ \text{inclusion}(S \leq T)(x) = \text{inclusion}(S \leq U)(x) \]
NonUnitalSubalgebra.coe_inclusion theorem
{S T : NonUnitalSubalgebra R A} (h : S ≤ T) (s : S) : (inclusion h s : A) = s
Full source
@[simp]
theorem coe_inclusion {S T : NonUnitalSubalgebra R A} (h : S ≤ T) (s : S) :
    (inclusion h s : A) = s :=
  rfl
Inclusion Map Preserves Elements in Non-Unital Subalgebras
Informal description
For any non-unital subalgebras $S$ and $T$ of a non-unital non-associative semiring $A$ over a commutative semiring $R$, if $S$ is contained in $T$ (i.e., $S \leq T$), then for any element $s \in S$, the image of $s$ under the inclusion homomorphism $\text{inclusion}(h) : S \to T$ is equal to $s$ when viewed as an element of $A$. In other words, the inclusion map preserves the underlying elements of $A$.
NonUnitalSubalgebra.coe_iSup_of_directed theorem
[Nonempty ι] {S : ι → NonUnitalSubalgebra R A} (dir : Directed (· ≤ ·) S) : ↑(iSup S) = ⋃ i, (S i : Set A)
Full source
theorem coe_iSup_of_directed [Nonempty ι] {S : ι → NonUnitalSubalgebra R A}
    (dir : Directed (· ≤ ·) S) : ↑(iSup S) = ⋃ i, (S i : Set A) :=
  let K : NonUnitalSubalgebra R A :=
    { __ := NonUnitalSubsemiring.copy _ _ (NonUnitalSubsemiring.coe_iSup_of_directed dir).symm
      smul_mem' := fun r _x hx ↦
        let ⟨i, hi⟩ := Set.mem_iUnion.1 hx
        Set.mem_iUnion.2 ⟨i, (S i).smul_mem' r hi⟩ }
  have : iSup S = K := le_antisymm
    (iSup_le fun i ↦ le_iSup (fun i ↦ (S i : Set A)) i) (Set.iUnion_subset fun _ ↦ le_iSup S _)
  this.symmrfl
Underlying Set of Directed Supremum of Non-Unital Subalgebras Equals Union of Underlying Sets
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. Given a nonempty index set $\iota$ and a directed family $(S_i)_{i \in \iota}$ of non-unital subalgebras of $A$ with respect to inclusion, the underlying set of the supremum $\bigsqcup_{i \in \iota} S_i$ is equal to the union $\bigcup_{i \in \iota} S_i$ of the underlying sets of the subalgebras $S_i$.
NonUnitalSubalgebra.iSupLift definition
[Nonempty ι] (K : ι → NonUnitalSubalgebra R A) (dir : Directed (· ≤ ·) K) (f : ∀ i, K i →ₙₐ[R] B) (hf : ∀ (i j : ι) (h : K i ≤ K j), f i = (f j).comp (inclusion h)) (T : NonUnitalSubalgebra R A) (hT : T = iSup K) : ↥T →ₙₐ[R] B
Full source
/-- Define an algebra homomorphism on a directed supremum of non-unital subalgebras by defining
it on each non-unital subalgebra, and proving that it agrees on the intersection of
non-unital subalgebras. -/
noncomputable def iSupLift [Nonempty ι] (K : ι → NonUnitalSubalgebra R A) (dir : Directed (· ≤ ·) K)
    (f : ∀ i, K i →ₙₐ[R] B) (hf : ∀ (i j : ι) (h : K i ≤ K j), f i = (f j).comp (inclusion h))
    (T : NonUnitalSubalgebra R A) (hT : T = iSup K) : ↥T →ₙₐ[R] B := by
  subst hT
  exact
      { toFun :=
          Set.iUnionLift (fun i => ↑(K i)) (fun i x => f i x)
            (fun i j x hxi hxj => by
              let ⟨k, hik, hjk⟩ := dir i j
              simp only
              rw [hf i k hik, hf j k hjk]
              rfl)
            _ (by rw [coe_iSup_of_directed dir])
        map_zero' := by
          dsimp
          exact Set.iUnionLift_const _ (fun i : ι => (0 : K i)) (fun _ => rfl) _ (by simp)
        map_mul' := by
          dsimp
          apply Set.iUnionLift_binary (coe_iSup_of_directed dir) dir _ (fun _ => (· * ·))
          all_goals simp
        map_add' := by
          dsimp
          apply Set.iUnionLift_binary (coe_iSup_of_directed dir) dir _ (fun _ => (· + ·))
          all_goals simp
        map_smul' := fun r => by
          dsimp
          apply Set.iUnionLift_unary (coe_iSup_of_directed dir) _ (fun _ x => r • x)
            (fun _ _ => rfl)
          all_goals simp }
Lifting of compatible non-unital algebra homomorphisms to directed supremum
Informal description
Given a nonempty index set $\iota$, a directed family $(K_i)_{i \in \iota}$ of non-unital subalgebras of a non-unital non-associative semiring $A$ over a commutative semiring $R$, and a family of non-unital algebra homomorphisms $(f_i \colon K_i \to B)_{i \in \iota}$ that are compatible on intersections (i.e., for any $i, j \in \iota$ with $K_i \leq K_j$, the homomorphism $f_i$ equals the composition of $f_j$ with the inclusion map $K_i \hookrightarrow K_j$), the function `NonUnitalSubalgebra.iSupLift` constructs a non-unital algebra homomorphism from the supremum $\bigsqcup_{i \in \iota} K_i$ to $B$ by lifting the homomorphisms $f_i$ to the union. Specifically, for any $T = \bigsqcup_{i \in \iota} K_i$, the homomorphism $\text{iSupLift}(K, \text{dir}, f, \text{hf}, T, \text{hT}) \colon T \to B$ satisfies: 1. For any $i \in \iota$ and $x \in K_i$, the value of the lifted homomorphism on the inclusion of $x$ in $T$ equals $f_i(x)$. 2. The composition of the lifted homomorphism with the inclusion $K_i \hookrightarrow T$ equals $f_i$.
NonUnitalSubalgebra.iSupLift_inclusion theorem
{i : ι} (x : K i) (h : K i ≤ T) : iSupLift K dir f hf T hT (inclusion h x) = f i x
Full source
@[simp]
theorem iSupLift_inclusion {i : ι} (x : K i) (h : K i ≤ T) :
    iSupLift K dir f hf T hT (inclusion h x) = f i x := by
  subst T
  dsimp [iSupLift]
  apply Set.iUnionLift_inclusion
  exact h
Compatibility of Lifted Homomorphism with Inclusion in Directed Supremum of Non-Unital Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. Given a nonempty index set $\iota$, a directed family $(K_i)_{i \in \iota}$ of non-unital subalgebras of $A$, and a family of compatible non-unital algebra homomorphisms $(f_i \colon K_i \to B)_{i \in \iota}$, for any $i \in \iota$ and $x \in K_i$ with $K_i \leq T$, the lifted homomorphism satisfies $\text{iSupLift}(K, \text{dir}, f, \text{hf}, T, \text{hT})(\text{inclusion}(h)(x)) = f_i(x)$.
NonUnitalSubalgebra.iSupLift_comp_inclusion theorem
{i : ι} (h : K i ≤ T) : (iSupLift K dir f hf T hT).comp (inclusion h) = f i
Full source
@[simp]
theorem iSupLift_comp_inclusion {i : ι} (h : K i ≤ T) :
    (iSupLift K dir f hf T hT).comp (inclusion h) = f i := by
  ext
  simp only [NonUnitalAlgHom.comp_apply, iSupLift_inclusion]
Compatibility of Lifted Homomorphism Composition with Inclusion in Directed Supremum of Non-Unital Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. Given a nonempty index set $\iota$, a directed family $(K_i)_{i \in \iota}$ of non-unital subalgebras of $A$, and a family of compatible non-unital algebra homomorphisms $(f_i \colon K_i \to B)_{i \in \iota}$, for any $i \in \iota$ with $K_i \leq T$, the composition of the lifted homomorphism $\text{iSupLift}(K, \text{dir}, f, \text{hf}, T, \text{hT})$ with the inclusion map $\text{inclusion}(h) \colon K_i \hookrightarrow T$ equals $f_i$.
NonUnitalSubalgebra.iSupLift_mk theorem
{i : ι} (x : K i) (hx : (x : A) ∈ T) : iSupLift K dir f hf T hT ⟨x, hx⟩ = f i x
Full source
@[simp]
theorem iSupLift_mk {i : ι} (x : K i) (hx : (x : A) ∈ T) :
    iSupLift K dir f hf T hT ⟨x, hx⟩ = f i x := by
  subst hT
  dsimp [iSupLift]
  apply Set.iUnionLift_mk
Lifted Homomorphism Evaluation on Directed Union Elements
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. Given a nonempty index set $\iota$, a directed family $(K_i)_{i \in \iota}$ of non-unital subalgebras of $A$, and a family of compatible non-unital algebra homomorphisms $(f_i \colon K_i \to B)_{i \in \iota}$, for any $x \in K_i$ such that $x \in T = \bigsqcup_{i \in \iota} K_i$, the lifted homomorphism $\text{iSupLift}(K, \text{dir}, f, \text{hf}, T, \text{hT})$ satisfies $\text{iSupLift}(K, \text{dir}, f, \text{hf}, T, \text{hT}) \langle x, \text{hx} \rangle = f_i(x)$.
NonUnitalSubalgebra.iSupLift_of_mem theorem
{i : ι} (x : T) (hx : (x : A) ∈ K i) : iSupLift K dir f hf T hT x = f i ⟨x, hx⟩
Full source
theorem iSupLift_of_mem {i : ι} (x : T) (hx : (x : A) ∈ K i) :
    iSupLift K dir f hf T hT x = f i ⟨x, hx⟩ := by
  subst hT
  dsimp [iSupLift]
  apply Set.iUnionLift_of_mem
Evaluation of Lifted Homomorphism on Directed Union Elements
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring equipped with a module structure over $R$. Given a nonempty index set $\iota$, a directed family $(K_i)_{i \in \iota}$ of non-unital subalgebras of $A$, and a family of compatible non-unital algebra homomorphisms $(f_i \colon K_i \to B)_{i \in \iota}$, for any $x \in T = \bigsqcup_{i \in \iota} K_i$ and any $i \in \iota$ such that $x \in K_i$, the lifted homomorphism $\text{iSupLift}(K, \text{dir}, f, \text{hf}, T, \text{hT})$ satisfies $\text{iSupLift}(K, \text{dir}, f, \text{hf}, T, \text{hT})(x) = f_i(\langle x, hx \rangle)$.
Set.smul_mem_center theorem
(r : R) {a : A} (ha : a ∈ Set.center A) : r • a ∈ Set.center A
Full source
theorem _root_.Set.smul_mem_center (r : R) {a : A} (ha : a ∈ Set.center A) :
    r • a ∈ Set.center A where
  comm b := by rw [mul_smul_comm, smul_mul_assoc, ha.comm]
  left_assoc b c := by rw [smul_mul_assoc, smul_mul_assoc, smul_mul_assoc, ha.left_assoc]
  mid_assoc b c := by
    rw [mul_smul_comm, smul_mul_assoc, smul_mul_assoc, mul_smul_comm, ha.mid_assoc]
  right_assoc b c := by
    rw [mul_smul_comm, mul_smul_comm, mul_smul_comm, ha.right_assoc]
Scalar multiplication preserves centrality: $r \cdot a \in Z(A)$ for $a \in Z(A)$
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital non-associative semiring. For any scalar $r \in R$ and any element $a$ in the center of $A$, the scalar multiple $r \cdot a$ is also in the center of $A$.
NonUnitalSubalgebra.center definition
: NonUnitalSubalgebra R A
Full source
/-- The center of a non-unital algebra is the set of elements which commute with every element.
They form a non-unital subalgebra. -/
def center : NonUnitalSubalgebra R A :=
  { NonUnitalSubsemiring.center A with smul_mem' := Set.smul_mem_center }
Center of a non-unital algebra
Informal description
The center of a non-unital algebra $A$ over a commutative semiring $R$ is the subset of elements that commute with every element of $A$. This center forms a non-unital subalgebra of $A$, meaning it is closed under addition, multiplication, and scalar multiplication by elements of $R$.
NonUnitalSubalgebra.coe_center theorem
: (center R A : Set A) = Set.center A
Full source
theorem coe_center : (center R A : Set A) = Set.center A :=
  rfl
Equality of Non-unital Subalgebra Center and Set Center: $\text{center}(R, A) = Z(A)$
Informal description
The underlying set of the center of a non-unital subalgebra $A$ over a commutative semiring $R$ is equal to the center of $A$ as a set, i.e., $\text{center}(R, A) = Z(A)$ where $Z(A)$ denotes the set of elements in $A$ that commute with every element of $A$.
NonUnitalSubalgebra.center.instNonUnitalCommSemiring instance
: NonUnitalCommSemiring (center R A)
Full source
/-- The center of a non-unital algebra is commutative and associative -/
instance center.instNonUnitalCommSemiring : NonUnitalCommSemiring (center R A) :=
  NonUnitalSubsemiring.center.instNonUnitalCommSemiring _
Non-unital Commutative Semiring Structure on the Center of a Non-unital Algebra
Informal description
The center of a non-unital algebra $A$ over a commutative semiring $R$ forms a non-unital commutative semiring. That is, the subset of elements in $A$ that commute with all other elements under multiplication inherits a non-unital commutative semiring structure from $A$.
NonUnitalSubalgebra.center.instNonUnitalCommRing instance
{A : Type*} [NonUnitalNonAssocRing A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] : NonUnitalCommRing (center R A)
Full source
instance center.instNonUnitalCommRing {A : Type*} [NonUnitalNonAssocRing A] [Module R A]
    [IsScalarTower R A A] [SMulCommClass R A A] : NonUnitalCommRing (center R A) :=
  NonUnitalSubring.center.instNonUnitalCommRing _
Center of a Non-Unital Algebra is a Non-Unital Commutative Ring
Informal description
For any non-unital non-associative ring $A$ equipped with a module structure over a commutative semiring $R$, where the scalar multiplication satisfies the tower property and commutes with the multiplication in $A$, the center of $A$ forms a non-unital commutative ring.
NonUnitalSubalgebra.center_toNonUnitalSubsemiring theorem
: (center R A).toNonUnitalSubsemiring = NonUnitalSubsemiring.center A
Full source
@[simp]
theorem center_toNonUnitalSubsemiring :
    (center R A).toNonUnitalSubsemiring = NonUnitalSubsemiring.center A :=
  rfl
Equality of Non-Unital Subsemiring Centers in Non-Unital Algebras
Informal description
For a non-unital algebra $A$ over a commutative semiring $R$, the underlying non-unital subsemiring of the center of $A$ (as a non-unital subalgebra) is equal to the center of $A$ as a non-unital subsemiring.
NonUnitalSubalgebra.center_toNonUnitalSubring theorem
(R A : Type*) [CommRing R] [NonUnitalNonAssocRing A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] : (center R A).toNonUnitalSubring = NonUnitalSubring.center A
Full source
@[simp] lemma center_toNonUnitalSubring (R A : Type*) [CommRing R] [NonUnitalNonAssocRing A]
    [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] :
    (center R A).toNonUnitalSubring = NonUnitalSubring.center A :=
  rfl
Equality of Non-Unital Subalgebra and Subring Centers under Commuting Scalar Actions
Informal description
Let $R$ be a commutative ring and $A$ a non-unital non-associative ring equipped with a module structure over $R$ such that the scalar multiplication satisfies the tower property $R \to A \to A$ and the scalar multiplications by $R$ and $A$ on $A$ commute. Then the center of $A$ as a non-unital subalgebra over $R$ coincides with the center of $A$ as a non-unital subring, i.e., $$(\text{center}_R A).\text{toNonUnitalSubring} = \text{center}(A).$$
NonUnitalSubalgebra.center_eq_top theorem
(A : Type*) [NonUnitalCommSemiring A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] : center R A = ⊤
Full source
@[simp]
theorem center_eq_top (A : Type*) [NonUnitalCommSemiring A] [Module R A] [IsScalarTower R A A]
    [SMulCommClass R A A] : center R A =  :=
  SetLike.coe_injective (Set.center_eq_univ A)
Center of a Commutative Non-Unital Algebra is the Whole Algebra
Informal description
Let $A$ be a non-unital commutative semiring equipped with a module structure over a commutative semiring $R$, such that the scalar multiplication satisfies the tower property $R \to A \to A$ and the scalar multiplications by $R$ and $A$ on $A$ commute. Then the center of $A$ as a non-unital subalgebra over $R$ is equal to the entire algebra, i.e., $\text{center}_R A = A$.
NonUnitalSubalgebra.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 Non-Unital Algebras: $a \in Z(A) \leftrightarrow \forall b \in A, b * a = a * b$
Informal description
An element $a$ of a non-unital algebra $A$ over a commutative semiring $R$ belongs to the center of $A$ if and only if $a$ commutes with every element $b \in A$, i.e., $b * a = a * b$ for all $b \in A$.
Set.smul_mem_centralizer theorem
{s : Set A} (r : R) {a : A} (ha : a ∈ s.centralizer) : r • a ∈ s.centralizer
Full source
@[simp]
theorem _root_.Set.smul_mem_centralizer {s : Set A} (r : R) {a : A} (ha : a ∈ s.centralizer) :
    r • a ∈ s.centralizer :=
  fun x hx => by rw [mul_smul_comm, smul_mul_assoc, ha x hx]
Scalar Multiplication Preserves Centralizer Membership in Non-Unital Algebras
Informal description
Let $R$ be a commutative semiring and $A$ a non-unital algebra over $R$. For any subset $s \subseteq A$ and any element $a \in A$ that belongs to the centralizer of $s$ (i.e., $a$ commutes with every element of $s$), the scalar multiple $r \cdot a$ also belongs to the centralizer of $s$ for any $r \in R$.
NonUnitalSubalgebra.centralizer definition
(s : Set A) : NonUnitalSubalgebra R A
Full source
/-- The centralizer of a set as a non-unital subalgebra. -/
def centralizer (s : Set A) : NonUnitalSubalgebra R A where
  toNonUnitalSubsemiring := NonUnitalSubsemiring.centralizer s
  smul_mem' := Set.smul_mem_centralizer
Centralizer as a non-unital subalgebra
Informal description
Given a commutative semiring $R$, a non-unital non-associative semiring $A$ equipped with a module structure over $R$, and a subset $s \subseteq A$, the centralizer of $s$ is the non-unital 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$. This subalgebra is closed under addition, multiplication, and scalar multiplication by elements of $R$.
NonUnitalSubalgebra.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 Centralizer Set in Non-Unital Algebras
Informal description
For any subset $s$ of a non-unital algebra $A$ over a commutative semiring $R$, the underlying set of the centralizer subalgebra $\text{centralizer}_R(s)$ is equal to the centralizer set $s.\text{centralizer}$, which consists of all elements $z \in A$ that commute with every element of $s$.
NonUnitalSubalgebra.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 Elements in Non-unital Subalgebras
Informal description
Let $R$ be a commutative semiring and $A$ be a non-unital non-associative semiring equipped with a module structure over $R$. For any subset $s \subseteq A$ and any element $z \in A$, $z$ belongs to the centralizer of $s$ if and only if $z$ commutes with every element of $s$, i.e., $g * z = z * g$ for all $g \in s$.
NonUnitalSubalgebra.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 Antimonotonicity: $s \subseteq t$ implies $\text{centralizer}_R(t) \leq \text{centralizer}_R(s)$
Informal description
For any subsets $s$ and $t$ of a non-unital algebra $A$ over a commutative semiring $R$, if $s \subseteq t$, then the centralizer of $t$ is contained in the centralizer of $s$, i.e., $\text{centralizer}_R(t) \leq \text{centralizer}_R(s)$.
NonUnitalSubalgebra.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 a non-unital algebra $A$ over a commutative semiring $R$, the centralizer of the entire set $A$ is equal to the center of $A$, i.e., $\text{centralizer}_R(A) = \text{center}_R(A)$.
NonUnitalAlgebra.adjoin_le_centralizer_centralizer theorem
(s : Set A) : adjoin R s ≤ centralizer R (centralizer R s)
Full source
lemma adjoin_le_centralizer_centralizer (s : Set A) :
    adjoin R s ≤ centralizer R (centralizer R s) :=
  adjoin_le Set.subset_centralizer_centralizer
Generated Subalgebra is Contained in Double Centralizer
Informal description
For any subset $s$ of a non-unital non-associative semiring $A$ that is also an $R$-module over a commutative semiring $R$, the non-unital subalgebra generated by $s$ is contained in the centralizer of its centralizer, i.e., $\text{adjoin}_R(s) \leq \text{centralizer}_R(\text{centralizer}_R(s))$.
NonUnitalAlgebra.commute_of_mem_adjoin_of_forall_mem_commute theorem
{a b : A} {s : Set A} (hb : b ∈ adjoin R s) (h : ∀ b ∈ s, Commute a b) : Commute a b
Full source
lemma commute_of_mem_adjoin_of_forall_mem_commute {a b : A} {s : Set A}
    (hb : b ∈ adjoin R s) (h : ∀ b ∈ s, Commute a b) :
    Commute a b := by
  have : a ∈ centralizer R s := by simpa only [Commute.symm_iff (a := a)] using h
  exact adjoin_le_centralizer_centralizer R s hb a this
Commutation Property for Elements in Generated Non-unital Subalgebra
Informal description
Let $A$ be a non-unital non-associative semiring equipped with a module structure over a commutative semiring $R$. For any elements $a, b \in A$ and a subset $s \subseteq A$, if $b$ belongs to the non-unital subalgebra generated by $s$ and $a$ commutes with every element of $s$, then $a$ commutes with $b$, i.e., $a * b = b * a$.
NonUnitalAlgebra.commute_of_mem_adjoin_singleton_of_commute theorem
{a b c : A} (hc : c ∈ adjoin R { b }) (h : Commute a b) : Commute a c
Full source
lemma commute_of_mem_adjoin_singleton_of_commute {a b c : A}
    (hc : c ∈ adjoin R {b}) (h : Commute a b) :
    Commute a c :=
  commute_of_mem_adjoin_of_forall_mem_commute hc <| by simpa
Commutation Property for Elements in Singleton-Generated Non-unital Subalgebra
Informal description
Let $A$ be a non-unital non-associative semiring equipped with a module structure over a commutative semiring $R$. For any elements $a, b, c \in A$, if $c$ belongs to the non-unital subalgebra generated by the singleton set $\{b\}$ and $a$ commutes with $b$, then $a$ commutes with $c$.
NonUnitalAlgebra.commute_of_mem_adjoin_self theorem
{a b : A} (hb : b ∈ adjoin R { a }) : Commute a b
Full source
lemma commute_of_mem_adjoin_self {a b : A} (hb : b ∈ adjoin R {a}) :
    Commute a b :=
  commute_of_mem_adjoin_singleton_of_commute hb rfl
Commutation Property for Elements in Self-Generated Non-unital Subalgebra
Informal description
Let $A$ be a non-unital non-associative semiring equipped with a module structure over a commutative semiring $R$. For any elements $a, b \in A$, if $b$ belongs to the non-unital subalgebra generated by the singleton set $\{a\}$, then $a$ commutes with $b$, i.e., $a \cdot b = b \cdot a$.
NonUnitalAlgebra.adjoinNonUnitalCommSemiringOfComm abbrev
{s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) : NonUnitalCommSemiring (adjoin R s)
Full source
/-- If all elements of `s : Set A` commute pairwise, then `adjoin R s` is a non-unital commutative
semiring.

See note [reducible non-instances]. -/
abbrev adjoinNonUnitalCommSemiringOfComm {s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) :
    NonUnitalCommSemiring (adjoin R s) :=
  { (adjoin R s).toNonUnitalSemiring with
    mul_comm := fun ⟨_, h₁⟩ ⟨_, h₂⟩ ↦
      have := adjoin_le_centralizer_centralizer R s
      Subtype.ext <| Set.centralizer_centralizer_comm_of_comm hcomm _ (this h₁) _ (this h₂) }
Non-unital Commutative Semiring Structure on Adjoined Subalgebra of Pairwise Commuting Elements
Informal description
Let $A$ be a non-unital non-associative semiring equipped with a module structure over a commutative semiring $R$, and let $s$ be a subset of $A$ such that all pairs of elements in $s$ commute under multiplication (i.e., $a \cdot b = b \cdot a$ for all $a, b \in s$). Then the non-unital subalgebra $\text{adjoin}_R(s)$ generated by $s$ inherits the structure of a non-unital commutative semiring.
NonUnitalAlgebra.adjoinNonUnitalCommRingOfComm abbrev
(R : Type*) {A : Type*} [CommRing R] [NonUnitalRing A] [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] {s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) : NonUnitalCommRing (adjoin R s)
Full source
/-- If all elements of `s : Set A` commute pairwise, then `adjoin R s` is a non-unital commutative
ring.

See note [reducible non-instances]. -/
abbrev adjoinNonUnitalCommRingOfComm (R : Type*) {A : Type*} [CommRing R] [NonUnitalRing A]
    [Module R A] [IsScalarTower R A A] [SMulCommClass R A A] {s : Set A}
    (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) : NonUnitalCommRing (adjoin R s) :=
  { (adjoin R s).toNonUnitalRing, adjoinNonUnitalCommSemiringOfComm R hcomm with }
Non-unital Commutative Ring Structure on Adjoined Subalgebra of Pairwise Commuting Elements
Informal description
Let $R$ be a commutative ring and $A$ a non-unital ring equipped with a module structure over $R$ such that: 1. The scalar multiplication satisfies the tower property: for all $r \in R$ and $a, b \in A$, we have $(r \cdot a) \cdot b = r \cdot (a \cdot b)$. 2. The scalar multiplications by $R$ and $A$ on $A$ commute: for all $r \in R$, $a \in A$, and $b \in A$, we have $r \cdot (a \cdot b) = a \cdot (r \cdot b)$. Given a subset $s \subseteq A$ where all pairs of elements commute (i.e., $a \cdot b = b \cdot a$ for all $a, b \in s$), the non-unital subalgebra $\text{adjoin}_R(s)$ generated by $s$ inherits the structure of a non-unital commutative ring.
nonUnitalSubalgebraOfNonUnitalSubsemiring definition
(S : NonUnitalSubsemiring R) : NonUnitalSubalgebra ℕ R
Full source
/-- A non-unital subsemiring is a non-unital `ℕ`-subalgebra. -/
def nonUnitalSubalgebraOfNonUnitalSubsemiring (S : NonUnitalSubsemiring R) :
    NonUnitalSubalgebra  R where
  toNonUnitalSubsemiring := S
  smul_mem' n _x hx := nsmul_mem (S := S) hx n
Non-unital $\mathbb{N}$-subalgebra from non-unital subsemiring
Informal description
Given a non-unital subsemiring $S$ of a non-unital non-associative semiring $R$, the function constructs a non-unital $\mathbb{N}$-subalgebra of $R$ with the same underlying set as $S$. The construction preserves the additive and multiplicative structures of $S$ and ensures closure under natural number scalar multiplication.
mem_nonUnitalSubalgebraOfNonUnitalSubsemiring theorem
{x : R} {S : NonUnitalSubsemiring R} : x ∈ nonUnitalSubalgebraOfNonUnitalSubsemiring S ↔ x ∈ S
Full source
@[simp]
theorem mem_nonUnitalSubalgebraOfNonUnitalSubsemiring {x : R} {S : NonUnitalSubsemiring R} :
    x ∈ nonUnitalSubalgebraOfNonUnitalSubsemiring Sx ∈ nonUnitalSubalgebraOfNonUnitalSubsemiring S ↔ x ∈ S :=
  Iff.rfl
Membership in $\mathbb{N}$-subalgebra from non-unital subsemiring
Informal description
For any element $x$ in a non-unital non-associative semiring $R$ and any non-unital subsemiring $S$ of $R$, the element $x$ belongs to the $\mathbb{N}$-subalgebra generated from $S$ if and only if $x$ belongs to $S$.
nonUnitalSubalgebraOfNonUnitalSubring definition
(S : NonUnitalSubring R) : NonUnitalSubalgebra ℤ R
Full source
/-- A non-unital subring is a non-unital `ℤ`-subalgebra. -/
def nonUnitalSubalgebraOfNonUnitalSubring (S : NonUnitalSubring R) : NonUnitalSubalgebra  R where
  toNonUnitalSubsemiring := S.toNonUnitalSubsemiring
  smul_mem' n _x hx := zsmul_mem (K := S) hx n
Non-unital $\mathbb{Z}$-subalgebra from non-unital subring
Informal description
Given a non-unital subring $S$ of a non-unital non-associative ring $R$, the function constructs a non-unital $\mathbb{Z}$-subalgebra of $R$ with the same underlying set as $S$. The construction preserves the additive and multiplicative structures of $S$ and ensures closure under integer scalar multiplication.
mem_nonUnitalSubalgebraOfNonUnitalSubring theorem
{x : R} {S : NonUnitalSubring R} : x ∈ nonUnitalSubalgebraOfNonUnitalSubring S ↔ x ∈ S
Full source
@[simp]
theorem mem_nonUnitalSubalgebraOfNonUnitalSubring {x : R} {S : NonUnitalSubring R} :
    x ∈ nonUnitalSubalgebraOfNonUnitalSubring Sx ∈ nonUnitalSubalgebraOfNonUnitalSubring S ↔ x ∈ S :=
  Iff.rfl
Membership in $\mathbb{Z}$-subalgebra from non-unital subring
Informal description
For any element $x$ in a non-unital non-associative ring $R$ and any non-unital subring $S$ of $R$, the element $x$ belongs to the $\mathbb{Z}$-subalgebra generated from $S$ if and only if $x$ belongs to $S$.