Algebras over commutative semirings #
In this file we define associative unital Algebras over commutative (semi)rings.
algebra homomorphisms
AlgHomare defined inMathlib/Algebra/Algebra/Hom.lean;algebra equivalences
AlgEquivare defined inMathlib/Algebra/Algebra/Equiv.lean;Subalgebras are defined inMathlib/Algebra/Algebra/Subalgebra.lean;The category
AlgCat RofR-algebras is defined in the fileMathlib/Algebra/Category/Algebra/Basic.lean.
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 fromRtoA, 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
Awith a morphism of ringsR →+* AdenotedalgebraMap R Awhich lands in the center ofA. - By requiring
Abe 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 AwithNonUnitalNonAssocSemiring Ain order to describe non-unital and/or non-associative algebras. - Replace
CommSemiring RandModule R AwithCommGroup 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
Embedding
R →+* Agiven byAlgebrastructure. UsealgebraMapfrom the root namespace instead.
Instances
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. See note [reducible non-instances].
Warning: In general this should not be used if S already has a SMul R S
instance, since this creates another SMul R S instance from the supplied RingHom and
this will likely create a diamond.
Equations
- i.toAlgebra' h = { smul := fun (c : R) (x : S) => i c * x, algebraMap := i, commutes' := h, smul_def' := ⋯ }
Instances For
Creating an algebra from a morphism to a commutative semiring. See note [reducible non-instances].
Warning: In general this should not be used if S already has a SMul R S
instance, since this creates another SMul R S instance from the supplied RingHom and
this will likely create a diamond.
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
- One or more equations did not get rendered due to their size.
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 algebraMaps agree.
An auxiliary lemma used to prove theorems of the form
RingHom.X (algebraMap R S) ↔ Algebra.X R S.
Equations
- Algebra.toModule = { toSMul := inst✝.toSMul, one_smul := ⋯, mul_smul := ⋯, smul_zero := ⋯, smul_add := ⋯, add_smul := ⋯, zero_smul := ⋯ }
mul_comm for Algebras when one element is from the base ring.
mul_left_comm for Algebras when one element is from the base ring.
mul_right_comm for Algebras when one element is from the base ring.
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).
Compose an Algebra with a RingHom, with action f s • m.
This is the algebra version of Module.compHom.
Equations
- Algebra.compHom A f = { smul := fun (s : S) (a : A) => f s • a, algebraMap := (algebraMap R A).comp f, commutes' := ⋯, smul_def' := ⋯ }
Instances For
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 = { toSMul := Mul.toSMul R, algebraMap := Algebra.algebraMap, commutes' := ⋯, smul_def' := ⋯ }