Modules over a ring #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
In this file we define
module R M
: an additive commutative monoidM
is amodule
over asemiring R
if forr : R
andx : M
their "scalar multiplicationr • x : M
is defined, and the operation•
satisfies some natural associativity and distributivity axioms similar to those on a ring.
Implementation notes #
In typical mathematical usage, our definition of module
corresponds to "semimodule", and the
word "module" is reserved for module R M
where R
is a ring
and M
an add_comm_group
.
If R
is a field
and M
an add_comm_group
, M
would be called an R
-vector space.
Since those assumptions can be made by changing the typeclasses applied to R
and M
,
without changing the axioms in module
, mathlib calls everything a module
.
In older versions of mathlib, we had separate semimodule
and vector_space
abbreviations.
This caused inference issues in some cases, while not providing any real advantages, so we decided
to use a canonical module
typeclass throughout.
Tags #
semimodule, module, vector space
- to_distrib_mul_action : distrib_mul_action R M
- add_smul : ∀ (r s : R) (x : M), (r + s) • x = r • x + s • x
- zero_smul : ∀ (x : M), 0 • x = 0
A module is a generalization of vector spaces to a scalar semiring.
It consists of a scalar semiring R
and an additive monoid of "vectors" M
,
connected by a "scalar multiplication" operation r • x : M
(where r : R
and x : M
) with some natural associativity and
distributivity axioms similar to those on a ring.
Instances of this typeclass
- smul_mem_class.to_module
- normed_space.to_module'
- weak_bilin.module'
- algebra.to_module
- module.complex_to_real
- semiring.to_module
- semiring.to_opposite_module
- normed_space.to_module
- add_comm_monoid.nat_module
- add_comm_group.int_module
- pi.module
- function.module
- pi.module'
- linear_map.module
- linear_map.apply_module
- ulift.module
- ulift.module'
- punit.module
- add_monoid_hom.module
- prod.module
- submodule.module'
- submodule.module
- submodule.restrict_scalars.orig_module
- dfinsupp.module
- finsupp.module
- subsemiring.module
- subring.module
- tensor_product.left_module
- tensor_product.module
- mul_opposite.module
- submodule.module_set
- submodule.quotient.module'
- submodule.quotient.module
- submodule.module_submodule
- subalgebra.module'
- subalgebra.module
- subalgebra.module_left
- self_adjoint.module
- skew_adjoint.module
- restrict_scalars.module
- restrict_scalars.op_module
- dfinsupp.module_of_linear_map
- direct_sum.module
- matrix.module
- ideal.module_pi
- order_dual.module
- affine_map.module
- bilin_form.module
- nnreal.module
- ennreal.module
- complex.module
- normed_add_group_hom.module
- continuous_linear_map.apply_module
- continuous_linear_map.module
- real.module
- uniform_space.completion.module
- seminorm.module
- uniform_fun.module
- uniform_on_fun.module
- multilinear_map.module
- continuous_multilinear_map.module
- alternating_map.module
- monoid_algebra.module
- add_monoid_algebra.module
- mv_polynomial.module
- polynomial.module
- localization.module
- formal_multilinear_series.module
- weak_bilin.module
- weak_dual.module
- weak_dual.module'
- weak_space.module
- quadratic_form.module
- is_bimodule_map.module
- matrix.module_block_diagonal
Instances of other typeclasses for module
- module.has_sizeof_inst
- subsingleton_rat_module
A module over a semiring automatically inherits a mul_action_with_zero
structure.
Equations
- module.to_mul_action_with_zero = {to_mul_action := {to_has_smul := mul_action.to_has_smul infer_instance, one_smul := _, mul_smul := _}, smul_zero := _, zero_smul := _}
Equations
- add_comm_monoid.nat_module = {to_distrib_mul_action := {to_mul_action := {to_has_smul := add_monoid.has_smul_nat (add_comm_monoid.to_add_monoid M), one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
Pullback a module
structure along an injective additive monoid homomorphism.
See note [reducible non-instances].
Equations
- function.injective.module R f hf smul = {to_distrib_mul_action := {to_mul_action := {to_has_smul := {smul := has_smul.smul _inst_5}, one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
Pushforward a module
structure along a surjective additive monoid homomorphism.
Equations
- function.surjective.module R f hf smul = {to_distrib_mul_action := {to_mul_action := {to_has_smul := {smul := has_smul.smul _inst_5}, one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
Push forward the action of R
on M
along a compatible surjective map f : R →+* S
.
See also function.surjective.mul_action_left
and function.surjective.distrib_mul_action_left
.
Equations
- function.surjective.module_left f hf hsmul = {to_distrib_mul_action := {to_mul_action := {to_has_smul := {smul := has_smul.smul _inst_8}, one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
Compose a module
with a ring_hom
, with action f s • m
.
See note [reducible non-instances].
Equations
- module.comp_hom M f = {to_distrib_mul_action := {to_mul_action := {to_has_smul := {smul := has_smul.comp.smul ⇑f}, one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
(•)
as an add_monoid_hom
.
This is a stronger version of distrib_mul_action.to_add_monoid_End
Equations
- module.to_add_monoid_End R M = {to_fun := (distrib_mul_action.to_add_monoid_End R M).to_fun, map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}
A convenience alias for module.to_add_monoid_End
as an add_monoid_hom
, usually to allow the
use of add_monoid_hom.flip
.
Equations
An add_comm_monoid
that is a module
over a ring
carries a natural add_comm_group
structure.
See note [reducible non-instances].
Equations
- module.add_comm_monoid_to_add_comm_group R = {add := add_comm_monoid.add infer_instance, add_assoc := _, zero := add_comm_monoid.zero infer_instance, zero_add := _, add_zero := _, nsmul := add_comm_monoid.nsmul infer_instance, nsmul_zero' := _, nsmul_succ' := _, neg := λ (a : M), (-1) • a, sub := add_group.sub._default add_comm_monoid.add module.add_comm_monoid_to_add_comm_group._proof_6 add_comm_monoid.zero module.add_comm_monoid_to_add_comm_group._proof_7 module.add_comm_monoid_to_add_comm_group._proof_8 add_comm_monoid.nsmul module.add_comm_monoid_to_add_comm_group._proof_9 module.add_comm_monoid_to_add_comm_group._proof_10 (λ (a : M), (-1) • a), sub_eq_add_neg := _, zsmul := add_group.zsmul._default add_comm_monoid.add module.add_comm_monoid_to_add_comm_group._proof_12 add_comm_monoid.zero module.add_comm_monoid_to_add_comm_group._proof_13 module.add_comm_monoid_to_add_comm_group._proof_14 add_comm_monoid.nsmul module.add_comm_monoid_to_add_comm_group._proof_15 module.add_comm_monoid_to_add_comm_group._proof_16 (λ (a : M), (-1) • a), zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _}
Equations
- add_comm_group.int_module M = {to_distrib_mul_action := {to_mul_action := {to_has_smul := sub_neg_monoid.has_smul_int (add_group.to_sub_neg_monoid M), one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
- to_has_smul : has_smul R M
- smul_add : ∀ (r : R) (x y : M), r • (x + y) = r • x + r • y
- add_smul : ∀ (r s : R) (x : M), (r + s) • x = r • x + s • x
- mul_smul : ∀ (r s : R) (x : M), (r * s) • x = r • s • x
- one_smul : ∀ (x : M), 1 • x = x
A structure containing most informations as in a module, except the fields zero_smul
and smul_zero
. As these fields can be deduced from the other ones when M
is an add_comm_group
,
this provides a way to construct a module structure by checking less properties, in
module.of_core
.
Instances for module.core
- module.core.has_sizeof_inst
Define module
without proving zero_smul
and smul_zero
by using an auxiliary
structure module.core
, when the underlying space is an add_comm_group
.
Equations
- module.of_core H = let _inst : has_smul R M := H.to_has_smul in {to_distrib_mul_action := {to_mul_action := {to_has_smul := H.to_has_smul, one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
A variant of module.ext
that's convenient for term-mode.
A module over a subsingleton
semiring is a subsingleton
. We cannot register this
as an instance because Lean has no way to guess R
.
A semiring is nontrivial
provided that there exists a nontrivial module over this semiring.
Equations
- semiring.to_module = {to_distrib_mul_action := {to_mul_action := monoid.to_mul_action R (monoid_with_zero.to_monoid R), smul_zero := _, smul_add := _}, add_smul := _, zero_smul := _}
The tautological action by R →+* R
on R
.
This generalizes function.End.apply_mul_action
.
Equations
- ring_hom.apply_distrib_mul_action = {to_mul_action := {to_has_smul := {smul := λ (_x : R →+* R) (_y : R), ⇑_x _y}, one_smul := _, mul_smul := _}, smul_zero := _, smul_add := _}
ring_hom.apply_distrib_mul_action
is faithful.
Convert back any exotic ℕ
-smul to the canonical instance. This should not be needed since in
mathlib all add_comm_monoid
s should normally have exactly one ℕ
-module structure by design.
All ℕ
-module structures are equal. Not an instance since in mathlib all add_comm_monoid
should normally have exactly one ℕ
-module structure by design.
Equations
- add_comm_monoid.nat_module.unique = {to_inhabited := {default := add_comm_monoid.nat_module _inst_2}, uniq := _}
Convert back any exotic ℤ
-smul to the canonical instance. This should not be needed since in
mathlib all add_comm_group
s should normally have exactly one ℤ
-module structure by design.
All ℤ
-module structures are equal. Not an instance since in mathlib all add_comm_group
should normally have exactly one ℤ
-module structure by design.
Equations
- add_comm_group.int_module.unique = {to_inhabited := {default := add_comm_group.int_module M _inst_3}, uniq := _}
There can be at most one module ℚ E
structure on an additive commutative group.
If E
is a vector space over two division semirings R
and S
, then scalar multiplications
agree on inverses of natural numbers in R
and S
.
If E
is a vector space over two division rings R
and S
, then scalar multiplications
agree on inverses of integer numbers in R
and S
.
If E
is a vector space over a division ring R
and has a monoid action by α
, then that
action commutes by scalar multiplication of inverses of natural numbers in R
.
If E
is a vector space over a division ring R
and has a monoid action by α
, then that
action commutes by scalar multiplication of inverses of integers in R
If E
is a vector space over two division rings R
and S
, then scalar multiplications
agree on rational numbers in R
and S
.
no_zero_smul_divisors
#
This section defines the no_zero_smul_divisors
class, and includes some tests
for the vanishing of elements (especially in modules over division rings).
no_zero_smul_divisors R M
states that a scalar multiple is 0
only if either argument is 0
.
This a version of saying that M
is torsion free, without assuming R
is zero-divisor free.
The main application of no_zero_smul_divisors R M
, when M
is a module,
is the result smul_eq_zero
: a scalar multiple is 0
iff either argument is 0
.
It is a generalization of the no_zero_divisors
class to heterogeneous multiplication.
Instances of this typeclass
- no_zero_divisors.to_no_zero_smul_divisors
- group_with_zero.to_no_zero_smul_divisors
- rat_module.no_zero_smul_divisors
- no_zero_smul_divisors.char_zero.no_zero_smul_divisors_nat
- no_zero_smul_divisors.char_zero.no_zero_smul_divisors_int
- no_zero_smul_divisors.algebra.no_zero_smul_divisors
- module.free.no_zero_smul_divisors
- is_fraction_ring.no_zero_smul_divisors
- pi.no_zero_smul_divisors
- function.no_zero_smul_divisors
- set.no_zero_smul_divisors
- set.no_zero_smul_divisors_set
- linear_map.no_zero_smul_divisors
- prod.no_zero_smul_divisors
- submodule.no_zero_smul_divisors
- finsupp.no_zero_smul_divisors
- finset.no_zero_smul_divisors
- finset.no_zero_smul_divisors_finset
- subalgebra.no_zero_smul_divisors_bot
- subalgebra.no_zero_smul_divisors_top
- multilinear_map.no_zero_smul_divisors
- alternating_map.no_zero_smul_divisors
- fraction_ring.no_zero_smul_divisors
Pullback a no_zero_smul_divisors
instance along an injective function.
If M
is an R
-module with one and M
has characteristic zero, then R
has characteristic
zero as well. Usually M
is an R
-algebra.
This instance applies to division_semiring
s, in particular nnreal
and nnrat
.