/-
Copyright (c) 2021 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
public import Mathlib.Algebra.Category.ModuleCat.Kernels
public import Mathlib.CategoryTheory.Subobject.Limits
/-!
# Subobjects in the category of `R`-modules
We construct an explicit order isomorphism between the categorical subobjects of an `R`-module `M`
and its submodules. This immediately implies that the category of `R`-modules is well-powered.
-/
@[
expose]
public section
open CategoryTheory Subobject Limits
universe v u
namespace ModuleCat
variable {R : Type u} [Ring R] (M : ModuleCat.{v} R)
/-- The categorical subobjects of a module `M` are in one-to-one correspondence with its
submodules. -/
noncomputable
def subobjectModule : Subobject M ≃o Submodule R M :=
OrderIso.symm
{ invFun :=
fun S => LinearMap.range S.arrow.hom
toFun :=
fun N => Subobject.mk (ofHom N.subtype)
right_inv :=
fun S => Eq.symm (
by
fapply eq_mk_of_comm
·
apply LinearEquiv.toModuleIso
apply LinearEquiv.ofBijective (LinearMap.codRestrict
(LinearMap.range S.arrow.hom) S.arrow.hom (LinearMap.mem_range_self _))
constructor
·
simp [← LinearMap.ker_eq_bot, ker_eq_bot_of_mono]
·
rw [← LinearMap.range_eq_top, LinearMap.range_codRestrict,
Submodule.comap_subtype_self]
· ext x
rfl)
left_inv :=
fun N =>
by
convert
congr_arg LinearMap.range
(ModuleCat.hom_ext_iff.mp (underlyingIso_arrow (ofHom N.subtype))) using
1
·
have :
(underlyingIso (ofHom N.subtype)).inv =
ofHom (underlyingIso (ofHom N.subtype)).symm.toLinearEquiv.toLinearMap :=
by
ext x
rfl
rw [this, hom_comp, hom_ofHom, LinearEquiv.range_comp]
·
exact (Submodule.range_subtype _).symm
map_rel_iff' :=
fun {S T} =>
by
refine ⟨
fun h => ?_,
fun h => mk_le_mk_of_comm (↟(Submodule.inclusion h)) rfl⟩
convert LinearMap.range_comp_le_range (ofMkLEMk _ _ h).hom (ofHom T.subtype).hom
·
rw [← hom_comp, ofMkLEMk_comp]
exact (Submodule.range_subtype _).symm
·
exact (Submodule.range_subtype _).symm }
instance wellPowered_moduleCat : WellPowered.{v} (ModuleCat.{v} R) :=
⟨
fun M => ⟨⟨_, ⟨(subobjectModule M).toEquiv⟩⟩⟩⟩
attribute [
local instance] hasKernels_moduleCat
/-- Bundle an element `m : M` such that `f m = 0` as a term of `kernelSubobject f`. -/
noncomputable
def toKernelSubobject {M N : ModuleCat.{v} R} {f : M ⟶ N} :
LinearMap.ker f.hom →ₗ[R] kernelSubobject f :=
(kernelSubobjectIso f ≪≫ ModuleCat.kernelIsoKer f).inv.hom
@[
simp]
theorem toKernelSubobject_arrow {M N : ModuleCat R} {f : M ⟶ N} (x : LinearMap.ker f.hom) :
(kernelSubobject f).arrow (toKernelSubobject x) = x.
1 :=
by
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/10959): the whole proof was just `simp [toKernelSubobject]`.
simp [toKernelSubobject, -hom_comp, ← CategoryTheory.comp_apply]
/-- An extensionality lemma showing that two elements of a cokernel by an image
are equal if they differ by an element of the image.
The application is for homology:
two elements in homology are equal if they differ by a boundary.
-/
theorem cokernel_π_imageSubobject_ext {L M N : ModuleCat.{v} R} (f : L ⟶ M) [HasImage f]
(g : (imageSubobject f : ModuleCat.{v} R) ⟶ N) [HasCokernel g] {x y : N} (l : L)
(w : x = y + g (factorThruImageSubobject f l)) : cokernel.π g x = cokernel.π g y :=
by
subst w
simp
end ModuleCat