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).
- Instances of
Algebra
in this 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:
-
variables [CommSemiring R] [Semiring A] variables [Algebra R A]
-
variables [CommSemiring R] [Semiring A] variables [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
.
- smul : R → A → A
- toFun : R → A
- map_one' : OneHom.toFun (↑↑Algebra.toRingHom) 1 = 1
- map_mul' : ∀ (x y : R), OneHom.toFun (↑↑Algebra.toRingHom) (x * y) = OneHom.toFun (↑↑Algebra.toRingHom) x * OneHom.toFun (↑↑Algebra.toRingHom) y
- map_zero' : OneHom.toFun (↑↑Algebra.toRingHom) 0 = 0
- map_add' : ∀ (x y : R), OneHom.toFun (↑↑Algebra.toRingHom) (x + y) = OneHom.toFun (↑↑Algebra.toRingHom) x + OneHom.toFun (↑↑Algebra.toRingHom) y
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.
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
- RingHom.toAlgebra' i h = Algebra.mk i h (_ : ∀ (x : R) (x_1 : S), x • x_1 = x • x_1)
Instances For
Creating an algebra from a morphism to a commutative semiring.
Equations
- RingHom.toAlgebra i = RingHom.toAlgebra' i (_ : ∀ (x : R) (b : (fun x => S) x), ↑i x * b = b * ↑i x)
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
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.
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
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Algebra over a subsemiring. This builds upon Subsemiring.module
.
Equations
- One or more equations did not get rendered due to their size.
Explicit characterization of the submonoid map in the case of an algebra.
S
is made explicit to help with type inference
Equations
- Algebra.algebraMapSubmonoid S M = Submonoid.map (algebraMap R S) M
Instances For
A Semiring
that is an Algebra
over a commutative ring carries a natural Ring
structure.
See note [reducible non-instances].
Equations
- Algebra.semiringToRing R = let src := Module.addCommMonoidToAddCommGroup R; let src_1 := inferInstance; Ring.mk SubNegMonoid.zsmul (_ : ∀ (a : A), -a + a = 0)
Instances For
Equations
- Module.End.instAlgebra R S M = Algebra.ofModule (_ : ∀ (r : R) (x y : Module.End S M), r • x * y = r • (x * y)) (_ : ∀ (r : R) (f g : Module.End S M), f • r • g = r • f • g)
An alternate statement of LinearMap.map_smul
for when algebraMap
is more convenient to
work with than •
.
Semiring ⥤ ℕ-Alg
Equations
- algebraNat = Algebra.mk (Nat.castRingHom R) (_ : ∀ (n : ℕ) (x : R), Commute (↑n) x) (_ : ∀ (x : ℕ) (x_1 : R), x • x_1 = ↑x * x_1)
Equations
- algebraRat = Algebra.mk (Rat.castHom α) (_ : ∀ (r : ℚ) (a : α), Commute (↑r) a) (_ : ∀ (a : ℚ) (x : α), DivisionRing.qsmul a x = ↑a * x)
Ring ⥤ ℤ-Alg
Equations
- algebraInt R = Algebra.mk (Int.castRingHom R) (_ : ∀ (m : ℤ) (x : R), Commute (↑m) x) (_ : ∀ (x : ℤ) (x_1 : R), x • x_1 = ↑x * x_1)
A special case of eq_intCast'
that happens to be true definitionally
If algebraMap R A
is injective and A
has no zero divisors,
R
-multiples in A
are zero only if one of the factors is zero.
Cannot be an instance because there is no Injective (algebraMap R A)
typeclass.
A
-linearly coerce an R
-linear map from M
to A
to a function, given an algebra A
over
a commutative semiring R
and M
a module over R
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
TODO: The following lemmas no longer involve Algebra
at all, and could be moved closer
to Algebra/Module/Submodule.lean
. Currently this is tricky because ker
, range
, ⊤
, and ⊥
are all defined in LinearAlgebra/Basic.lean
.