# Documentation

Mathlib.Algebra.Category.ModuleCat.Basic

# The category of R-modules #

Module.{v} R is the category of bundled R-modules with carrier in the universe v. We show that it is preadditive and show that being an isomorphism, monomorphism and epimorphism is equivalent to being a linear equivalence, an injective linear map and a surjective linear map, respectively.

## Implementation details #

To construct an object in the category of R-modules from a type M with an instance of the Module typeclass, write of R M. There is a coercion in the other direction.

Similarly, there is a coercion from morphisms in Module R to linear maps.

Porting note: the next two paragraphs should be revised.

Unfortunately, Lean is not smart enough to see that, given an object M : Module R, the expression of R M, where we coerce M to the carrier type, is definitionally equal to M itself. This means that to go the other direction, i.e., from linear maps/equivalences to (iso)morphisms in the category of R-modules, we have to take care not to inadvertently end up with an of R M where M is already an object. Hence, given f : M →ₗ[R] N,

• if M N : Module R, simply use f;
• if M : Module R and N is an unbundled R-module, use ↿f or asHomLeft f;
• if M is an unbundled R-module and N : Module R, use ↾f or asHomRight f;
• if M and N are unbundled R-modules, use ↟f or asHom f.

Similarly, given f : M ≃ₗ[R] N, use toModuleIso, toModuleIso'Left, toModuleIso'Right or toModuleIso', respectively.

The arrow notations are localized, so you may have to open ModuleCat (or open scoped ModuleCat) to use them. Note that the notation for asHomLeft clashes with the notation used to promote functions between types to morphisms in the category Type, so to avoid confusion, it is probably a good idea to avoid having the locales Module and CategoryTheory.Type open at the same time.

If you get an error when trying to apply a theorem and the convert tactic produces goals of the form M = of R M, then you probably used an incorrect variant of asHom or toModuleIso.

structure ModuleCat (R : Type u) [Ring R] :
Type (max u (v + 1))
• carrier : Type v

the underlying type of an object in ModuleCat R

• isModule : Module R s

The category of R-modules and their morphisms.

Note that in the case of R = ℤ, we can not impose here that the ℤ-multiplication field from the module structure is defeq to the one coming from the isAddCommGroup structure (contrary to what we do for all module structures in mathlib), which creates some difficulties down the road.

Instances For
@[inline, reducible]
abbrev ModuleCatMax (R : Type u₁) [Ring R] :
Type (max u₁ ((max v₁ v₂) + 1))

An alias for ModuleCat.{max u₁ u₂}, to deal around unification issues. Since the universe the ring lives in can be inferred, we put that last.

Instances For
theorem ModuleCat.ext (R : Type u) [Ring R] {M : } {N : } {f₁ : M N} {f₂ : M N} (h : ∀ (x : M), f₁ x = f₂ x) :
f₁ = f₂
def ModuleCat.of (R : Type u) [Ring R] (X : Type v) [] [Module R X] :

The object in the category of R-modules associated to an R-module

Instances For
@[simp]
theorem ModuleCat.forget₂_obj (R : Type u) [Ring R] (X : ) :
().obj X =
theorem ModuleCat.forget₂_obj_moduleCat_of (R : Type u) [Ring R] (X : Type v) [] [Module R X] :
().obj () =
@[simp]
theorem ModuleCat.forget₂_map (R : Type u) [Ring R] (X : ) (Y : ) (f : X Y) :
def ModuleCat.ofHom {R : Type u} [Ring R] {X : Type v} {Y : Type v} [] [Module R X] [] [Module R Y] (f : X →ₗ[R] Y) :

Typecheck a LinearMap as a morphism in Module R.

Instances For
@[simp]
theorem ModuleCat.ofHom_apply {R : Type u} [Ring R] {X : Type v} {Y : Type v} [] [Module R X] [] [Module R Y] (f : X →ₗ[R] Y) (x : X) :
↑() x = f x
instance ModuleCat.ofUnique (R : Type u) [Ring R] {X : Type v} [] [Module R X] [i : ] :
Unique ↑()
theorem ModuleCat.coe_of (R : Type u) [Ring R] (X : Type v) [] [Module R X] :
↑() = X
@[simp]
theorem ModuleCat.ofSelfIso_hom {R : Type u} [Ring R] (M : ) :
@[simp]
theorem ModuleCat.ofSelfIso_inv {R : Type u} [Ring R] (M : ) :
def ModuleCat.ofSelfIso {R : Type u} [Ring R] (M : ) :
ModuleCat.of R M M

Forgetting to the underlying type and then building the bundled object returns the original module.

Instances For
theorem ModuleCat.isZero_of_subsingleton {R : Type u} [Ring R] (M : ) [] :
@[simp]
theorem ModuleCat.id_apply {R : Type u} [Ring R] {M : } (m : M) :
@[simp]
theorem ModuleCat.coe_comp {R : Type u} [Ring R] {M : } {N : } {U : } (f : M N) (g : N U) :
= g f
theorem ModuleCat.comp_def {R : Type u} [Ring R] {M : } {N : } {U : } (f : M N) (g : N U) :
@[simp]
theorem ModuleCat.forget_map {R : Type u} [Ring R] {M : } {N : } (f : M N) :
().map f = f
def ModuleCat.asHom {R : Type u} [Ring R] {X₁ : Type v} {X₂ : Type v} [] [Module R X₁] [] [Module R X₂] :
(X₁ →ₗ[R] X₂) → (ModuleCat.of R X₁ ModuleCat.of R X₂)

Reinterpreting a linear map in the category of R-modules.

Instances For

Reinterpreting a linear map in the category of R-modules

Instances For
def ModuleCat.asHomRight {R : Type u} [Ring R] {X₁ : Type v} [] [Module R X₁] {X₂ : } :
(X₁ →ₗ[R] X₂) → (ModuleCat.of R X₁ X₂)

Reinterpreting a linear map in the category of R-modules.

Instances For

Reinterpreting a linear map in the category of R-modules.

Instances For
def ModuleCat.asHomLeft {R : Type u} [Ring R] {X₂ : Type v} {X₁ : } [] [Module R X₂] :
(X₁ →ₗ[R] X₂) → (X₁ ModuleCat.of R X₂)

Reinterpreting a linear map in the category of R-modules.

Instances For

Reinterpreting a linear map in the category of R-modules.

Instances For
@[simp]
theorem LinearEquiv.toModuleIso_inv {R : Type u} [Ring R] {X₁ : Type v} {X₂ : Type v} {g₁ : } {g₂ : } {m₁ : Module R X₁} {m₂ : Module R X₂} (e : X₁ ≃ₗ[R] X₂) :
().inv = ↑()
@[simp]
theorem LinearEquiv.toModuleIso_hom {R : Type u} [Ring R] {X₁ : Type v} {X₂ : Type v} {g₁ : } {g₂ : } {m₁ : Module R X₁} {m₂ : Module R X₂} (e : X₁ ≃ₗ[R] X₂) :
().hom = e
def LinearEquiv.toModuleIso {R : Type u} [Ring R] {X₁ : Type v} {X₂ : Type v} {g₁ : } {g₂ : } {m₁ : Module R X₁} {m₂ : Module R X₂} (e : X₁ ≃ₗ[R] X₂) :

Build an isomorphism in the category Module R from a LinearEquiv between Modules.

Instances For
@[inline, reducible]
abbrev LinearEquiv.toModuleIso' {R : Type u} [Ring R] {M : } {N : } (i : M ≃ₗ[R] N) :
M N

Build an isomorphism in the category Module R from a LinearEquiv between Modules.

Instances For
@[inline, reducible]
abbrev LinearEquiv.toModuleIso'Left {R : Type u} [Ring R] {X₂ : Type v} {X₁ : } [] [Module R X₂] (e : X₁ ≃ₗ[R] X₂) :
X₁ ModuleCat.of R X₂

Build an isomorphism in the category Module R from a linear_equiv between modules.

Instances For
@[inline, reducible]
abbrev LinearEquiv.toModuleIso'Right {R : Type u} [Ring R] {X₁ : Type v} [] [Module R X₁] {X₂ : } (e : X₁ ≃ₗ[R] X₂) :
ModuleCat.of R X₁ X₂

Build an isomorphism in the category Module R from a linear_equiv between modules.

Instances For
@[simp]
theorem CategoryTheory.Iso.toLinearEquiv_symm_apply {R : Type u} [Ring R] {X : } {Y : } (i : X Y) (a : Y) :
= i.inv a
@[simp]
theorem CategoryTheory.Iso.toLinearEquiv_apply {R : Type u} [Ring R] {X : } {Y : } (i : X Y) (a : X) :
= i.hom a
def CategoryTheory.Iso.toLinearEquiv {R : Type u} [Ring R] {X : } {Y : } (i : X Y) :
X ≃ₗ[R] Y

Build a linear_equiv from an isomorphism in the category Module R.

Instances For
@[simp]
theorem linearEquivIsoModuleIso_hom {R : Type u} [Ring R] {X : Type u} {Y : Type u} [] [] [Module R X] [Module R Y] (e : X ≃ₗ[R] Y) :
linearEquivIsoModuleIso.hom e =
@[simp]
theorem linearEquivIsoModuleIso_inv {R : Type u} [Ring R] {X : Type u} {Y : Type u} [] [] [Module R X] [Module R Y] (i : ) :
linearEquivIsoModuleIso.inv i =
def linearEquivIsoModuleIso {R : Type u} [Ring R] {X : Type u} {Y : Type u} [] [] [Module R X] [Module R Y] :
(X ≃ₗ[R] Y)

linear equivalences between modules are the same as (isomorphic to) isomorphisms in Module

Instances For
theorem ModuleCat.Iso.homCongr_eq_arrowCongr {S : Type u} [] {X : } {Y : } {X' : } {Y' : } (i : X X') (j : Y Y') (f : X Y) :
theorem ModuleCat.Iso.conj_eq_conj {S : Type u} [] {X : } {X' : } (i : X X') (f : ) :
def ModuleCat.smul {R : Type u} [Ring R] (M : ) :

The scalar multiplication on an object of ModuleCat R considered as a morphism of rings from R to the endomorphisms of the underlying abelian group.

Instances For
theorem ModuleCat.smul_naturality {R : Type u} [Ring R] {M : } {N : } (f : M N) (r : R) :
@[simp]
theorem ModuleCat.smulNatTrans_apply_app (R : Type u) [Ring R] (r : R) (M : ) :
(↑() r).app M = ↑() r
def ModuleCat.smulNatTrans (R : Type u) [Ring R] :

The scalar multiplication on ModuleCat R considered as a morphism of rings to the endomorphisms of the forgetful functor to AddCommGroupCat).

Instances For

Given A : AddCommGroupCat and a ring morphism R →+* End A, this is a type synonym for A, on which we shall define a structure of R-module.

Instances For
@[simp]
theorem ModuleCat.mkOfSMul'_smul {R : Type u} [Ring R] {A : AddCommGroupCat} (φ : ) (r : R) (x : ↑()) :
r x = ↑(let_fun this := φ r; this) x
@[inline, reducible]
abbrev ModuleCat.mkOfSMul {R : Type u} [Ring R] {A : AddCommGroupCat} (φ : ) :

Given A : AddCommGroupCat and a ring morphism R →+* End A, this is an object in ModuleCat R, whose underlying abelian group is A and whose scalar multiplication is given by R.

Instances For
@[simp]
theorem ModuleCat.mkOfSMul_smul {R : Type u} [Ring R] {A : AddCommGroupCat} (φ : ) (r : R) :
↑() r = φ r
@[simp]
theorem ModuleCat.homMk_apply {R : Type u} [Ring R] {M : } {N : } (φ : ().obj M ().obj N) (hφ : ∀ (r : R), ) (a : ↑(().obj M)) :
↑() a = φ a
def ModuleCat.homMk {R : Type u} [Ring R] {M : } {N : } (φ : ().obj M ().obj N) (hφ : ∀ (r : R), ) :
M N

Constructor for morphisms in ModuleCat R which takes as inputs a morphism between the underlying objects in AddCommGroupCat and the compatibility with the scalar multiplication.

Instances For
theorem ModuleCat.forget₂_map_homMk {R : Type u} [Ring R] {M : } {N : } (φ : ().obj M ().obj N) (hφ : ∀ (r : R), ) :
().map () = φ