module Algebra.Ring.Module where
Modulesπ
A module over a ring is an abelian group equipped with an action by . Modules generalise the idea of vector spaces, which may be familiar from linear algebra, by replacing the field of scalars by a ring of scalars. More pertinently, though, modules specialise functors: specifically, -enriched functors into the category .
For silly formalisation reasons, when defining modules, we do not take βan -functor into β as the definition: this correspondence is a theorem we prove later. Instead, we set up -modules as typical algebraic structures, as data (and property) attached to a type.
The structure of an -module on a type consists of an addition and a scalar multiplication . In prose, we generally omit the star, writing rather than the wordlier . These must satisfy the following properties:
makes into an abelian group. Since weβve already defined abelian groups, we can take this entire property as βindivisibleβ, saving some effort.
is a ring homomorphism of onto βs endomorphism ring. In other words, we have:
- ;
- ;
- ; and
- .
record is-module {β'} {T : Type β'} (_+_ : T β T β T) (_β_ : β R β β T β T) : Type (β β β') where
no-eta-equality
field
: is-abelian-group _+_
has-is-ab : β r x y β r β (x + y) β‘ (r β x) + (r β y)
β-distribl : β r s x β (r R.+ s) β x β‘ (r β x) + (s β x)
β-distribr : β r s x β r β (s β x) β‘ (r R.* s) β x
β-assoc : β x β R.1r β x β‘ x β-id
Correspondingly, a module structure on a type packages the addition, the scalar multiplication, and the proofs that these behave as we set above. A module is a type equipped with a module structure.
record Module-on {β'} (T : Type β') : Type (β β β') where
no-eta-equality
field
_+_ : T β T β T
_β_ : β R β β T β T
: is-module _+_ _β_
has-is-mod
infixl 25 _+_
infixr 27 _β_
open is-module has-is-mod public
: β βm β Type (lsuc βm β β)
Module = Ξ£ (Set βm) Ξ» X β Module-on β£ X β£
Module βm
record is-linear-map (f : S β T) (M : Module-on S) (N : Module-on T)
: Type (β β level-of S β level-of T) where
Linear mapsπ
The correct notion of morphism between -modules is the linear map; in case we need to make the base ring clear, we shall call them -linear maps. Since the structure of -modules are their additions and their scalar multiplications, it stands to reason that these are what homomorphisms should preserve. Rather than separately asking for preservation of addition and of multiplication, the following single assumption suffices:
field linear : β r s t β f (r β s + t) β‘ r β f s + f t
Any map which satisfies this equation must preserve addition, since we have
and standard lemmas about group homomorphisms ensure that will also preserve negation, and, more importantly, zero. We can then derive that preserves the scalar multiplication, by calculating
record Linear-map (M : Module βm) (N : Module βn) : Type (β β βm β βn) where
no-eta-equality
field
: β M β β β N β
map : is-linear-map map (M .snd) (N .snd)
lin open is-linear-map lin public
The collection of linear maps forms a set, whose identity type is given by pointwise identity of the underlying maps. Therefore, we may take these to be the morphisms of a category . is a very standard category, so very standard constructions can set up the category, the functor witnessing its concreteness, and a proof that it is univalent.
: β {β} β Thin-structure _ Module-on
R-Mod-structure {β} = rms where
R-Mod-structure : Thin-structure _ Module-on
rms .is-hom f M N β£ = is-linear-map {β} {_} {β} f M N
β£ rms .is-hom f M N .is-tr = is-linear-map-is-prop
rms
.id-is-hom .linear r s t = refl
rms .β-is-hom f g Ξ± Ξ² .linear r s t =
rms (Ξ² .linear r s t) β Ξ± .linear _ _ _
ap f
.id-hom-unique {s = s} {t = t} Ξ± _ = r where
rms module s = Module-on s
module t = Module-on t
: s β‘ t
r .Module-on._+_ x y = is-linear-map.pres-+ Ξ± x y i
r i .Module-on._β_ x y = is-linear-map.pres-β Ξ± x y i
r i .Module-on.has-is-mod =
r i (Ξ» i β hlevel {T = is-module
is-propβpathp (Ξ» x y β is-linear-map.pres-+ Ξ± x y i)
(Ξ» x y β is-linear-map.pres-β Ξ± x y i)} 1)
(Module-on.has-is-mod s) (Module-on.has-is-mod t) i
βRepresentableβ modulesπ
A prototypical example of -module is.. itself! A ring has an underlying abelian group, and the multiplication operation can certainly be considered a special kind of βscalar multiplicationβ. If we treat as an -category with a single object, this construction corresponds to the functor β the βYoneda embeddingβ of βs unique object. Stretching the analogy, we refer to -as-an--module as the βrepresentableβ -module.
: Module β
representable-module .fst = R .fst
representable-module .snd = to-module-on record
representable-module { has-is-set = R.has-is-set
; _+_ = R._+_
; inv = R.-_
; 0g = R.0r
; +-assoc = Ξ» x y z β R.+-associative
; +-invl = Ξ» x β R.+-invl
; +-idl = Ξ» x β R.+-idl
; +-comm = Ξ» x y β R.+-commutes
; _β_ = R._*_
; β-distribl = Ξ» x y z β R.*-distribl
; β-distribr = Ξ» x y z β R.*-distribr
; β-assoc = Ξ» x y z β R.*-associative
; β-id = Ξ» x β R.*-idl
}
Another perspective on this construction is that we are regarding as the space of β1-dimensional vectorsβ over itself. Following this line of reasoning one can define the module of -dimensional vectors over .