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
- smul : R → M → M
Scalar multiplication distributes over addition from the right.
Scalar multiplication by zero gives zero.
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
A module over a semiring automatically inherits a MulActionWithZero
structure.
Pullback a Module
structure along an injective additive monoid homomorphism.
See note [reducible non-instances].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pushforward a Module
structure along a surjective additive monoid homomorphism.
Equations
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
- One or more equations did not get rendered due to their size.
Instances For
Compose a Module
with a RingHom
, with action f s • m
.
See note [reducible non-instances].
Equations
- One or more equations did not get rendered due to their size.
Instances For
(•)
as an AddMonoidHom
.
This is a stronger version of DistribMulAction.toAddMonoidEnd
Equations
- One or more equations did not get rendered due to their size.
Instances For
A convenience alias for Module.toAddMonoidEnd
as an AddMonoidHom
, usually to allow the
use of AddMonoidHom.flip
.
Equations
Instances For
- smul : R → M → M
Scalar multiplication distributes over addition from the left.
Scalar multiplication distributes over addition from the right.
Scalar multiplication distributes over multiplication from the right.
Scalar multiplication by one is the identity.
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 AddCommGroup
,
this provides a way to construct a module structure by checking less properties, in
Module.ofCore
.
Instances For
Define Module
without proving zero_smul
and smul_zero
by using an auxiliary
structure Module.Core
, when the underlying space is an AddCommGroup
.
Equations
Instances For
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 (_ : ∀ (a b : M), a + b = b + a)
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
- One or more equations did not get rendered due to their size.
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
The tautological action by R →+* R
on R
.
This generalizes Function.End.applyMulAction
.
RingHom.applyDistribMulAction
is faithful.
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
Instances For
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
Instances For
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 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
.
NoZeroSMulDivisors
#
This section defines the NoZeroSMulDivisors
class, and includes some tests
for the vanishing of elements (especially in modules over division rings).
If scalar multiplication yields zero, either the scalar or the vector was zero.
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.
Instances
Pullback a NoZeroSMulDivisors
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 DivisionSemiring
s, in particular NNReal
and NNRat
.