Algebras over commutative semirings #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
In this file we define associative unital algebra
s over commutative (semi)rings, algebra
homomorphisms alg_hom
, and algebra equivalences alg_equiv
.
subalgebra
s are defined in algebra.algebra.subalgebra
.
For the category of R
-algebras, denoted Algebra R
, see the file
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.algebra_map R A : R →+* A
: the canonical map fromR
toA
, as aring_hom
. This is the preferred spelling of this map, it is also available as:algebra.linear_map R A : R →ₗ[R] A
, alinear_map
.algebra.of_id R A : R →ₐ[R] A
, analg_hom
(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
denotedalgebra_map 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 has_smul R A
and
requiring that this scalar action r • x
must agree with left multiplication by the image of the
structure morphism algebra_map R A r * x
.
As a result, there are two ways to talk about an R
-algebra A
when A
is a semiring:
-
variables [comm_semiring R] [semiring A] variables [algebra R A]
-
variables [comm_semiring R] [semiring A] variables [module R A] [smul_comm_class R A A] [is_scalar_tower 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*} [comm_semiring R] [semiring A]
[module R A] [smul_comm_class R A A] [is_scalar_tower R A A] : algebra R A :=
algebra.of_module smul_mul_assoc mul_smul_comm
The advantage of the first approach is that algebra_map R A
is available, and alg_hom R A B
and
subalgebra R A
can be used. For concrete R
and A
, algebra_map R A
is often definitionally
convenient.
The advantage of the second approach is that comm_semiring R
, semiring A
, and module R A
can
all be relaxed independently; for instance, this allows us to:
- Replace
semiring A
withnon_unital_non_assoc_semiring A
in order to describe non-unital and/or non-associative algebras. - Replace
comm_semiring R
andmodule R A
withcomm_group R'
anddistrib_mul_action R' A
, which whenR' = Rˣ
lets us talk about the "algebra-like" action ofRˣ
on anR
-algebraA
.
While alg_hom R A B
cannot be used in the second approach, non_unital_alg_hom 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
.
- to_has_smul : has_smul R A
- to_ring_hom : R →+* A
- commutes' : ∀ (r : R) (x : A), algebra.to_ring_hom.to_fun r * x = x * algebra.to_ring_hom.to_fun r
- smul_def' : ∀ (r : R) (x : A), r • x = algebra.to_ring_hom.to_fun r * x
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 of this typeclass
- algebra_nat
- algebra_int
- normed_algebra.to_algebra
- ideal.quotient_algebra
- power_series.algebra_polynomial'
- algebra.id
- punit.algebra
- ulift.algebra
- algebra.of_subsemiring
- algebra.of_subring
- mul_opposite.algebra
- module.End.algebra
- algebra_rat
- subfield.to_algebra
- nnreal.algebra
- ennreal.algebra
- prod.algebra
- subalgebra.algebra'
- subalgebra.algebra
- subalgebra.to_algebra
- continuous_linear_map.algebra
- restrict_scalars.algebra
- pi.algebra
- function.algebra
- matrix.algebra
- complex.algebra
- star_subalgebra.algebra
- uniform_space.completion.algebra
- uniform_space.completion.algebra'
- monoid_algebra.algebra
- add_monoid_algebra.algebra
- mv_polynomial.algebra
- polynomial.algebra_of_algebra
- localization.algebra
- fraction_ring.algebra
- ideal.quotient.algebra
- continuous_map.algebra
- bounded_continuous_function.algebra
- smooth_map.algebra
- smooth_functions_algebra
- pointed_smooth_map.algebra
- pointed_smooth_map.cont_mdiff_map.algebra
- pointed_smooth_map.eval_algebra
- free_algebra.algebra
- direct_sum.algebra
- local_ring.residue_field.algebra
- algebra.tensor_product.left_algebra
- algebra.tensor_product.tensor_product.algebra
- ring_con.quotient.algebra
- ring_quot.algebra
- triv_sq_zero_ext.algebra'
- triv_sq_zero_ext.algebra
- tensor_algebra.algebra
- clifford_algebra.algebra
- intermediate_field.algebra'
- intermediate_field.algebra
- intermediate_field.to_algebra
- adjoin_root.algebra
- intermediate_field.algebra_over_bot
- quaternion_algebra.algebra
- quaternion.algebra
- fixed_points.algebra
- mv_power_series.algebra
- mv_power_series.algebra_mv_polynomial
- mv_power_series.algebra_mv_power_series
- power_series.algebra
- power_series.algebra_polynomial
- power_series.algebra_power_series
- hahn_series.algebra
- hahn_series.power_series_algebra
- laurent_series.algebra
- ratfunc.algebra
- ratfunc.laurent_series.algebra
- polynomial.splitting_field_aux.algebra
- polynomial.splitting_field_aux.algebra'''
- polynomial.splitting_field_aux.algebra'
- polynomial.splitting_field_aux.algebra''
- polynomial.splitting_field.algebra'
- polynomial.splitting_field.algebra
- intermediate_field.fixed_field.algebra
- polynomial.gal.algebra
- zmod.algebra
- galois_field.algebra
- algebraic_closure.adjoin_monic.algebra
- algebraic_closure.step.algebra_succ
- algebraic_closure.step.algebra
- algebraic_closure.algebra_of_step
- algebraic_closure.algebra
- unitization.algebra
- universal_enveloping_algebra.algebra
- category_theory.linear.category_theory.End.algebra
- Algebra.is_algebra
- Algebra.algebra_obj
- Algebra.limit_algebra
- ideal.quotient.algebra_quotient_map_quotient
- is_localization.localization.at_prime.algebra
- is_localization.localization.algebra
- localized_module.algebra
- localized_module.algebra'
- locally_constant.algebra
- pi.algebra_of_normed_algebra
- pre_lp.algebra
- Top.presheaf.stalk.algebra
- cyclotomic_field.algebra
- cyclotomic_field.algebra_base
- cyclotomic_ring.algebra_base
- cyclotomic_ring.cyclotomic_field.algebra
- ideal.quotient.algebra_quotient_pow_ramification_idx
- padic_int.algebra
- function.algebra_ring
- pi.matrix_algebra
- double_centralizer.algebra
- algebraic_geometry.structure_sheaf.localizations.algebra
- algebraic_geometry.structure_sheaf.stalk_algebra
- algebraic_geometry.structure_sheaf.open_algebra
- algebraic_geometry.structure_sheaf.stalk.algebra
- algebraic_geometry.obj.algebra
- algebraic_geometry.Γ_restrict_algebra
- algebraic_geometry.Scheme.function_field.algebra
- algebraic_geometry.stalk_function_field_algebra
- algebraic_geometry.function_field.algebra
- homogeneous_localization.homogeneous_localization_algebra
- weierstrass_curve.coordinate_ring.algebra
- weierstrass_curve.coordinate_ring.algebra'
- nnrat.rat.algebra
- laurent_polynomial.algebra_polynomial
- valuation.algebra
- valuation_subring.algebra
- valuation_subring.of_prime_algebra
- is_dedekind_domain.height_one_spectrum.adic_completion.algebra'
- is_dedekind_domain.height_one_spectrum.adic_completion.algebra
- is_dedekind_domain.height_one_spectrum.adic_completion_integers.algebra
- dedekind_domain.prod_adic_completions.algebra
- dedekind_domain.prod_adic_completions.algebra'
- dedekind_domain.finite_integral_adeles.algebra
- dedekind_domain.prod_adic_completions.algebra_completions
- Module.Mon_Module_equivalence_Algebra.Mon_.X.algebra
Instances of other typeclasses for algebra
- algebra.has_sizeof_inst
- nat_algebra_subsingleton
- algebra_rat_subsingleton
- int_algebra_subsingleton
- zmod.algebra.subsingleton
Embedding R →+* A
given by algebra
structure.
Equations
Equations
- algebra_map.has_lift_t R A = {lift := λ (r : R), ⇑(algebra_map R A) r}
Creating an algebra from a morphism to the center of a semiring.
Equations
- i.to_algebra' h = {to_has_smul := {smul := λ (c : R) (x : S), ⇑i c * x}, to_ring_hom := i, commutes' := h, smul_def' := _}
Creating an algebra from a morphism to a commutative semiring.
Equations
- i.to_algebra = i.to_algebra' _
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.of_module' h₁ h₂ = {to_has_smul := smul_zero_class.to_has_smul smul_with_zero.to_smul_zero_class, to_ring_hom := {to_fun := λ (r : R), r • 1, map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}, commutes' := _, smul_def' := _}
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.of_module h₁ h₂ = algebra.of_module' _ _
To prove two algebra structures on a fixed [comm_semiring R] [semiring A]
agree,
it suffices to check the algebra_map
s agree.
Equations
- algebra.to_module = {to_distrib_mul_action := {to_mul_action := {to_has_smul := algebra.to_has_smul _inst_4, one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
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 algebra_map R A : R →* A
for any R
-algebra A
,
packaged as an R
-linear map.
Equations
- algebra.linear_map R A = {to_fun := (algebra_map R A).to_fun, map_add' := _, map_smul' := _}
Equations
- algebra.id R = (ring_hom.id R).to_algebra
Equations
- punit.algebra = {to_has_smul := punit.has_smul R, to_ring_hom := {to_fun := λ (x : R), punit.star, map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}, commutes' := _, smul_def' := _}
Equations
- ulift.algebra = {to_has_smul := mul_action.to_has_smul distrib_mul_action.to_mul_action, to_ring_hom := {to_fun := λ (r : R), {down := ⇑(algebra_map R A) r}, map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}, commutes' := _, smul_def' := _}
Algebra over a subsemiring. This builds upon subsemiring.module
.
Equations
- algebra.of_subsemiring S = {to_has_smul := {smul := has_smul.smul S.has_smul}, to_ring_hom := {to_fun := ((algebra_map R A).comp S.subtype).to_fun, map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}, commutes' := _, smul_def' := _}
Algebra over a subring. This builds upon subring.module
.
Equations
- algebra.of_subring S = {to_has_smul := {smul := has_smul.smul S.has_smul}, to_ring_hom := algebra.to_ring_hom (algebra.of_subsemiring S.to_subsemiring), commutes' := _, smul_def' := _}
Explicit characterization of the submonoid map in the case of an algebra.
S
is made explicit to help with type inference
Equations
- algebra.algebra_map_submonoid S M = submonoid.map (algebra_map R S) M
Instances for algebra.algebra_map_submonoid
A semiring
that is an algebra
over a commutative ring carries a natural ring
structure.
See note [reducible non-instances].
Equations
- algebra.semiring_to_ring R = {add := add_comm_group.add (module.add_comm_monoid_to_add_comm_group R), add_assoc := _, zero := add_comm_group.zero (module.add_comm_monoid_to_add_comm_group R), zero_add := _, add_zero := _, nsmul := add_comm_group.nsmul (module.add_comm_monoid_to_add_comm_group R), nsmul_zero' := _, nsmul_succ' := _, neg := add_comm_group.neg (module.add_comm_monoid_to_add_comm_group R), sub := add_comm_group.sub (module.add_comm_monoid_to_add_comm_group R), sub_eq_add_neg := _, zsmul := add_comm_group.zsmul (module.add_comm_monoid_to_add_comm_group R), zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _, int_cast := add_comm_group_with_one.int_cast._default semiring.nat_cast add_comm_group.add _ add_comm_group.zero _ _ add_comm_group.nsmul _ _ semiring.one algebra.semiring_to_ring._proof_17 algebra.semiring_to_ring._proof_18 add_comm_group.neg add_comm_group.sub _ add_comm_group.zsmul _ _ _ _, nat_cast := semiring.nat_cast infer_instance, one := semiring.one infer_instance, nat_cast_zero := _, nat_cast_succ := _, int_cast_of_nat := _, int_cast_neg_succ_of_nat := _, mul := semiring.mul infer_instance, mul_assoc := _, one_mul := _, mul_one := _, npow := semiring.npow infer_instance, npow_zero' := _, npow_succ' := _, left_distrib := _, right_distrib := _}
Equations
- mul_opposite.algebra = {to_has_smul := {smul := has_smul.smul (mul_opposite.has_smul A R)}, to_ring_hom := (algebra_map R A).to_opposite mul_opposite.algebra._proof_1, commutes' := _, smul_def' := _}
Equations
- module.End.algebra R M = algebra.of_module _ _
An alternate statement of linear_map.map_smul
for when algebra_map
is more convenient to
work with than •
.
Semiring ⥤ ℕ-Alg
Equations
- algebra_nat = {to_has_smul := add_monoid.has_smul_nat (add_monoid_with_one.to_add_monoid R), to_ring_hom := nat.cast_ring_hom R (semiring.to_non_assoc_semiring R), commutes' := _, smul_def' := _}
Equations
- algebra_rat = {to_has_smul := {smul := has_smul.smul rat.smul_division_ring}, to_ring_hom := rat.cast_hom α _inst_2, commutes' := _, smul_def' := _}
Ring ⥤ ℤ-Alg
Equations
- algebra_int R = {to_has_smul := sub_neg_monoid.has_smul_int (add_group.to_sub_neg_monoid R), to_ring_hom := int.cast_ring_hom R ring.to_non_assoc_ring, commutes' := _, smul_def' := _}
A special case of eq_int_cast'
that happens to be true definitionally
If algebra_map 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 (algebra_map R A)
typeclass.
A
-linearly coerce a 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
- linear_map.lto_fun R M A = {to_fun := linear_map.to_fun algebra.to_module, map_add' := _, map_smul' := _}
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 linear_algebra/basic.lean
.