Modules over a ring #
In this file we define
Module R M
: an additive commutative monoidM
is aModule
over aSemiring R
if forr : R
andx : M
their "scalar multiplication"r • 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 AddCommGroup
.
If R
is a Field
and M
an AddCommGroup
, 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 mathlib3, 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
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.
- smul : R → M → M
Scalar multiplication distributes over addition from the right.
Scalar multiplication by zero gives zero.
Instances
A module over a semiring automatically inherits a MulActionWithZero
structure.
Equations
- Module.toMulActionWithZero = let __src := inferInstance; MulActionWithZero.mk ⋯ ⋯
Pullback a Module
structure along an injective additive monoid homomorphism.
See note [reducible non-instances].
Equations
- Function.Injective.module R f hf smul = let __src := Function.Injective.distribMulAction f hf smul; Module.mk ⋯ ⋯
Instances For
Pushforward a Module
structure along a surjective additive monoid homomorphism.
See note [reducible non-instances].
Equations
- Function.Surjective.module R f hf smul = Module.mk ⋯ ⋯
Instances For
Push forward the action of R
on M
along a compatible surjective map f : R →+* S
.
See also Function.Surjective.mulActionLeft
and Function.Surjective.distribMulActionLeft
.
Equations
- Function.Surjective.moduleLeft f hf hsmul = let __src := Function.Surjective.distribMulActionLeft (↑f) hf hsmul; Module.mk ⋯ ⋯
Instances For
Compose a Module
with a RingHom
, with action f s • m
.
See note [reducible non-instances].
Equations
- Module.compHom M f = let __src := MulActionWithZero.compHom M (RingHom.toMonoidWithZeroHom f); let __src_1 := DistribMulAction.compHom M ↑f; Module.mk ⋯ ⋯
Instances For
(•)
as an AddMonoidHom
.
This is a stronger version of DistribMulAction.toAddMonoidEnd
Equations
- Module.toAddMonoidEnd R M = let __src := DistribMulAction.toAddMonoidEnd R M; { toMonoidHom := __src, map_zero' := ⋯, map_add' := ⋯ }
Instances For
A convenience alias for Module.toAddMonoidEnd
as an AddMonoidHom
, usually to allow the
use of AddMonoidHom.flip
.
Equations
Instances For
Equations
- AddCommGroup.intModule M = Module.mk ⋯ ⋯
A variant of Module.ext
that's convenient for term-mode.
An AddCommMonoid
that is a Module
over a Ring
carries a natural AddCommGroup
structure.
See note [reducible non-instances].
Equations
- Module.addCommMonoidToAddCommGroup R = let __src := inferInstance; AddCommGroup.mk ⋯
Instances For
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.
Like Semiring.toModule
, but multiplies on the right.
Equations
- Semiring.toOppositeModule = let __src := MonoidWithZero.toOppositeMulActionWithZero R; Module.mk ⋯ ⋯
A ring homomorphism f : R →+* M
defines a module structure by r • x = f r * x
.
Equations
- RingHom.toModule f = Module.compHom S f
Instances For
If the module action of R
on S
is compatible with multiplication on S
, then
fun x ↦ x • 1
is a ring homomorphism from R
to S
.
This is the RingHom
version of MonoidHom.smulOneHom
.
When R
is commutative, usually algebraMap
should be preferred.
Equations
- RingHom.smulOneHom = let __spread.0 := MonoidHom.smulOneHom; { toMonoidHom := __spread.0, map_zero' := ⋯, map_add' := ⋯ }
Instances For
A homomorphism between semirings R and S can be equivalently specified by a R-module structure on S such that S/S/R is a scalar tower.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert back any exotic ℕ
-smul to the canonical instance. This should not be needed since in
mathlib all AddCommMonoid
s should normally have exactly one ℕ
-module structure by design.
All ℕ
-module structures are equal. Not an instance since in mathlib all AddCommMonoid
should normally have exactly one ℕ
-module structure by design.
Equations
- AddCommMonoid.natModule.unique = { toInhabited := { default := inferInstance }, uniq := ⋯ }
Instances For
Equations
- ⋯ = ⋯
Convert back any exotic ℤ
-smul to the canonical instance. This should not be needed since in
mathlib all AddCommGroup
s should normally have exactly one ℤ
-module structure by design.
All ℤ
-module structures are equal. Not an instance since in mathlib all AddCommGroup
should normally have exactly one ℤ
-module structure by design.
Equations
- AddCommGroup.intModule.unique = { toInhabited := { default := inferInstance }, uniq := ⋯ }
Instances For
A Module
over ℚ
restricts to a Module
over ℚ≥0
.
Equations
- instModuleNNRatToSemiringToOrderedSemiringToOrderedCommSemiringInstNNRatCanonicallyOrderedCommSemiring = Module.compHom α NNRat.coeHom
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 semiring 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
.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
NoZeroSMulDivisors
#
This section defines the NoZeroSMulDivisors
class, and includes some tests
for the vanishing of elements (especially in modules over division rings).
NoZeroSMulDivisors R M
states that a scalar multiple is 0
only if either argument is 0
.
This is a version of saying that M
is torsion free, without assuming R
is zero-divisor free.
The main application of NoZeroSMulDivisors 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 NoZeroDivisors
class to heterogeneous multiplication.
If scalar multiplication yields zero, either the scalar or the vector was zero.
Instances
Pullback a NoZeroSMulDivisors
instance along an injective function.
Equations
- ⋯ = ⋯
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.
Only a ring of characteristic zero can can have a non-trivial module without additive or scalar torsion.
This instance applies to DivisionSemiring
s, in particular NNReal
and NNRat
.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯