Algebras over commutative semirings #
In this file we define associative unital Algebra
s over commutative (semi)rings.
algebra homomorphisms
AlgHom
are defined inMathlib.Algebra.Algebra.Hom
;algebra equivalences
AlgEquiv
are defined inMathlib.Algebra.Algebra.Equiv
;Subalgebra
s are defined inMathlib.Algebra.Algebra.Subalgebra
;The category
AlgebraCat R
ofR
-algebras is defined in the fileMathlib.Algebra.Category.Algebra.Basic
.
See the implementation notes for remarks about non-associative and non-unital algebras.
Main definitions: #
Algebra R A
: the algebra typeclass.algebraMap R A : R →+* A
: the canonical map fromR
toA
, as aRingHom
. This is the preferred spelling of this map, it is also available as:Algebra.linearMap R A : R →ₗ[R] A
, aLinearMap
.Algebra.ofId R A : R →ₐ[R] A
, anAlgHom
(defined in a later file).
Implementation notes #
Given a commutative (semi)ring R
, there are two ways to define an R
-algebra structure on a
(possibly noncommutative) (semi)ring A
:
- By endowing
A
with a morphism of ringsR →+* A
denotedalgebraMap R A
which lands in the center ofA
. - By requiring
A
be anR
-module such that the action associates and commutes with multiplication asr • (a₁ * a₂) = (r • a₁) * a₂ = a₁ * (r • a₂)
.
We define Algebra R A
in a way that subsumes both definitions, by extending SMul R A
and
requiring that this scalar action r • x
must agree with left multiplication by the image of the
structure morphism algebraMap R A r * x
.
As a result, there are two ways to talk about an R
-algebra A
when A
is a semiring:
variable [CommSemiring R] [Semiring A] variable [Algebra R A]
variable [CommSemiring R] [Semiring A] variable [Module R A] [SMulCommClass R A A] [IsScalarTower R A A]
The first approach implies the second via typeclass search; so any lemma stated with the second set of arguments will automatically apply to the first set. Typeclass search does not know that the second approach implies the first, but this can be shown with:
example {R A : Type*} [CommSemiring R] [Semiring A]
[Module R A] [SMulCommClass R A A] [IsScalarTower R A A] : Algebra R A :=
Algebra.ofModule smul_mul_assoc mul_smul_comm
The advantage of the first approach is that algebraMap R A
is available, and AlgHom R A B
and
Subalgebra R A
can be used. For concrete R
and A
, algebraMap R A
is often definitionally
convenient.
The advantage of the second approach is that CommSemiring R
, Semiring A
, and Module R A
can
all be relaxed independently; for instance, this allows us to:
- Replace
Semiring A
withNonUnitalNonAssocSemiring A
in order to describe non-unital and/or non-associative algebras. - Replace
CommSemiring R
andModule R A
withCommGroup R'
andDistribMulAction R' A
, which whenR' = Rˣ
lets us talk about the "algebra-like" action ofRˣ
on anR
-algebraA
.
While AlgHom R A B
cannot be used in the second approach, NonUnitalAlgHom R A B
still can.
You should always use the first approach when working with associative unital algebras, and mimic
the second approach only when you need to weaken a condition on either R
or A
.
An associative unital R
-algebra is a semiring A
equipped with a map into its center R → A
.
See the implementation notes in this file for discussion of the details of this definition.
- smul : R → A → A
- toFun : R → A
- map_one' : (↑↑Algebra.toRingHom).toFun 1 = 1
- map_zero' : (↑↑Algebra.toRingHom).toFun 0 = 0
Instances
Embedding R →+* A
given by Algebra
structure.
Equations
- algebraMap R A = Algebra.toRingHom
Instances For
Coercion from a commutative semiring to an algebra over this semiring.
Equations
- Algebra.cast = ⇑(algebraMap R A)
Instances For
Equations
- algebraMap.coeHTCT R A = { coe := Algebra.cast }
Instances For
Creating an algebra from a morphism to the center of a semiring.
Equations
- i.toAlgebra' h = Algebra.mk i h ⋯
Instances For
Creating an algebra from a morphism to a commutative semiring.
Equations
- i.toAlgebra = i.toAlgebra' ⋯
Instances For
Let R
be a commutative semiring, let A
be a semiring with a Module R
structure.
If (r • 1) * x = x * (r • 1) = r • x
for all r : R
and x : A
, then A
is an Algebra
over R
.
See note [reducible non-instances].
Equations
- Algebra.ofModule' h₁ h₂ = Algebra.mk { toFun := fun (r : R) => r • 1, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ } ⋯ ⋯
Instances For
Let R
be a commutative semiring, let A
be a semiring with a Module R
structure.
If (r • x) * y = x * (r • y) = r • (x * y)
for all r : R
and x y : A
, then A
is an Algebra
over R
.
See note [reducible non-instances].
Equations
- Algebra.ofModule h₁ h₂ = Algebra.ofModule' ⋯ ⋯
Instances For
To prove two algebra structures on a fixed [CommSemiring R] [Semiring A]
agree,
it suffices to check the algebraMap
s agree.
mul_comm
for Algebra
s when one element is from the base ring.
mul_left_comm
for Algebra
s when one element is from the base ring.
mul_right_comm
for Algebra
s when one element is from the base ring.
Equations
- ⋯ = ⋯
This is just a special case of the global mul_smul_comm
lemma that requires less typeclass
search (and was here first).
This is just a special case of the global smul_mul_assoc
lemma that requires less typeclass
search (and was here first).
The canonical ring homomorphism algebraMap R A : R →+* A
for any R
-algebra A
,
packaged as an R
-linear map.
Equations
- Algebra.linearMap R A = { toFun := (↑↑(algebraMap R A)).toFun, map_add' := ⋯, map_smul' := ⋯ }
Instances For
The identity map inducing an Algebra
structure.
Equations
- Algebra.id R = Algebra.mk { toFun := fun (x : R) => x, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ } ⋯ ⋯