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.
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
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
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
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
Instances For
Equations
- (_ : IsScalarTower ℕ R M) = (_ : IsScalarTower ℕ R M)
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
A Module
over ℚ
restricts to a Module
over ℚ≥0
.
Equations
- instModuleNNRatToSemiringToStrictOrderedSemiringToLinearOrderedSemiringToLinearOrderedCommSemiringToLinearOrderedSemifieldInstNNRatCanonicallyLinearOrderedSemifield = Module.compHom α NNRat.coeHom
There can be at most one Module ℚ E
structure on an additive commutative group.
Equations
- (_ : Subsingleton (Module ℚ E)) = (_ : Subsingleton (Module ℚ E))
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
- (_ : IsScalarTower ℤ R M) = (_ : IsScalarTower ℤ R M)
Equations
- (_ : IsScalarTower ℚ R M) = (_ : IsScalarTower ℚ R M)
Equations
- (_ : SMulCommClass ℚ R M) = (_ : SMulCommClass ℚ R M)
Equations
- (_ : SMulCommClass R ℚ M) = (_ : SMulCommClass R ℚ M)
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
- (_ : NoZeroSMulDivisors R R) = (_ : NoZeroSMulDivisors R R)
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.
Equations
- (_ : NoZeroSMulDivisors ℕ M) = (_ : NoZeroSMulDivisors ℕ M)
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
- (_ : NoZeroSMulDivisors R M) = (_ : NoZeroSMulDivisors R M)
Equations
- (_ : NoZeroSMulDivisors ℤ M) = (_ : NoZeroSMulDivisors ℤ M)