Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Algebra/ModuleCat/Presheaf): composition of pushforwards and pullbacks and compatibilites #17589

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e3f0045
refactoring ModuleCat.Presheaf
joelriou Sep 10, 2024
00ead34
wip
joelriou Sep 10, 2024
39a0013
fixed Presheaf.Limits
joelriou Sep 11, 2024
458a34c
fix docstrings
joelriou Sep 11, 2024
4986072
fixed Presheaf.Colimits
joelriou Sep 11, 2024
2f85fa6
wip
joelriou Sep 11, 2024
47b3337
fixed ModuleCat.Sheaf
joelriou Sep 11, 2024
bcb4088
fixed Sheaf.ChangeOfRings
joelriou Sep 11, 2024
61d4ac8
fixed Presheaf.Sheafify
joelriou Sep 12, 2024
ae99ab9
wip
joelriou Sep 12, 2024
94eb640
fixed Presheaf.Sheafification
joelriou Sep 12, 2024
ade38cf
fixed Differentials.Presheaf
joelriou Sep 13, 2024
919b915
feat(Algebra/Category/ModuleCat): the free presheaf of modules functor
joelriou Sep 13, 2024
ab3f04b
AIM note
joelriou Sep 13, 2024
f7e9796
fixing AG.Modules.Tilde
joelriou Sep 13, 2024
e0eccec
cleaning up
joelriou Sep 13, 2024
aae13f3
Merge remote-tracking branch 'origin/refactor-presheaf-of-modules' in…
joelriou Sep 13, 2024
177dbdf
fixed GroupCohomology.Resolution
joelriou Sep 13, 2024
be238ef
cleaning up
joelriou Sep 13, 2024
e833541
cleaning up
joelriou Sep 13, 2024
3c589a0
Merge remote-tracking branch 'origin/refactor-presheaf-of-modules' in…
joelriou Sep 13, 2024
1e15c86
added docstrings
joelriou Sep 14, 2024
b0edaa3
Merge remote-tracking branch 'origin' into the-free-presheaf-of-modul…
joelriou Sep 27, 2024
6b0c727
fixing the build
joelriou Sep 27, 2024
68d109c
cleaning up
joelriou Sep 27, 2024
f9171f7
coding style
joelriou Sep 27, 2024
aab62c4
typo
joelriou Sep 27, 2024
f168dc3
Merge remote-tracking branch 'origin' into the-free-presheaf-of-modul…
joelriou Sep 27, 2024
4fb41e7
Merge remote-tracking branch 'origin' into the-free-presheaf-of-modul…
joelriou Sep 28, 2024
8adc243
Merge remote-tracking branch 'origin' into the-free-presheaf-of-modul…
joelriou Oct 2, 2024
ddca67f
feat(Algebra/ModuleCat/Presheaf): pullback of presheaves of modules
joelriou Oct 2, 2024
ac4c27d
some progress
joelriou Oct 3, 2024
a038f77
refactoring (co)Representable
joelriou Oct 3, 2024
2fdfb7c
feat(CategoryTheory/Adjunction): definition set of the left adjoint
joelriou Oct 3, 2024
5298580
refactor(CategoryTheory): generalize universes for representable func…
joelriou Oct 3, 2024
67e6706
fixing the build
joelriou Oct 3, 2024
fe09896
fixing the build
joelriou Oct 3, 2024
9f734a1
better name
joelriou Oct 3, 2024
1763ad2
Merge remote-tracking branch 'origin/refactor-representable-functors-…
joelriou Oct 3, 2024
c2eab62
cleaning up
joelriou Oct 3, 2024
c6f9b68
renaming the file
joelriou Oct 3, 2024
4d23efb
Merge remote-tracking branch 'origin/adjoint-definition-set' into pre…
joelriou Oct 3, 2024
6ea1bba
fix imports
joelriou Oct 3, 2024
668b6e9
cleaning up
joelriou Oct 3, 2024
cdbb1f4
finished the proof
joelriou Oct 4, 2024
6921482
Merge remote-tracking branch 'origin' into adjoint-definition-set
joelriou Oct 4, 2024
c652142
typo
joelriou Oct 4, 2024
6f7c8c4
Merge remote-tracking branch 'origin/adjoint-definition-set' into pre…
joelriou Oct 4, 2024
3646289
Merge remote-tracking branch 'origin' into presheaf-of-modules-pullback
joelriou Oct 4, 2024
b066528
added docstrings
joelriou Oct 4, 2024
0135678
cleaning up
joelriou Oct 4, 2024
929bba3
Merge remote-tracking branch 'origin/adjoint-definition-set' into pre…
joelriou Oct 4, 2024
8e34bf0
Merge remote-tracking branch 'origin' into presheaf-of-modules-pullback
joelriou Oct 4, 2024
23724a9
fixed imports
joelriou Oct 4, 2024
012042c
fix
joelriou Oct 4, 2024
ceb6806
Merge remote-tracking branch 'origin' into presheaf-of-modules-pullback
joelriou Oct 7, 2024
20db559
Merge remote-tracking branch 'origin' into presheaf-of-modules-pullback
joelriou Oct 9, 2024
853a093
compatibilities for pushforward
joelriou Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ import Mathlib.Algebra.Category.ModuleCat.Presheaf
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Abelian
import Mathlib.Algebra.Category.ModuleCat.Presheaf.ChangeOfRings
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Colimits
import Mathlib.Algebra.Category.ModuleCat.Presheaf.EpiMono
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Free
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Generator
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Limits
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Pullback
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Pushforward
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Sheafification
import Mathlib.Algebra.Category.ModuleCat.Presheaf.Sheafify
Expand Down Expand Up @@ -1423,6 +1427,7 @@ import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Adjunction.Mates
import Mathlib.CategoryTheory.Adjunction.Opposites
import Mathlib.CategoryTheory.Adjunction.Over
import Mathlib.CategoryTheory.Adjunction.PartialAdjoint
import Mathlib.CategoryTheory.Adjunction.Reflective
import Mathlib.CategoryTheory.Adjunction.Restrict
import Mathlib.CategoryTheory.Adjunction.Triple
Expand Down
53 changes: 47 additions & 6 deletions Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,63 @@ variable [Ring R]
/-- The free functor `Type u ⥤ ModuleCat R` sending a type `X` to the
free `R`-module with generators `x : X`, implemented as the type `X →₀ R`.
-/
@[simps]
def free : Type u ⥤ ModuleCat R where
obj X := ModuleCat.of R (X →₀ R)
map {X Y} f := Finsupp.lmapDomain _ _ f
map_id := by intros; exact Finsupp.lmapDomain_id _ _
map_comp := by intros; exact Finsupp.lmapDomain_comp _ _ _ _

variable {R}

/-- Constructor for elements in the module `(free R).obj X`. -/
noncomputable def freeMk {X : Type u} (x : X) : (free R).obj X := Finsupp.single x 1

@[ext 1200]
lemma free_hom_ext {X : Type u} {M : ModuleCat.{u} R} {f g : (free R).obj X ⟶ M}
(h : ∀ (x : X), f (freeMk x) = g (freeMk x)) :
f = g :=
(Finsupp.lhom_ext' (fun x ↦ LinearMap.ext_ring (h x)))

/-- The morphism of modules `(free R).obj X ⟶ M` corresponding
to a map `f : X ⟶ M`. -/
noncomputable def freeDesc {X : Type u} {M : ModuleCat.{u} R} (f : X ⟶ M) :
(free R).obj X ⟶ M :=
Finsupp.lift M R X f

@[simp]
lemma freeDesc_apply {X : Type u} {M : ModuleCat.{u} R} (f : X ⟶ M) (x : X) :
freeDesc f (freeMk x) = f x := by
dsimp [freeDesc]
erw [Finsupp.lift_apply, Finsupp.sum_single_index]
all_goals simp

@[simp]
lemma free_map_apply {X Y : Type u} (f : X → Y) (x : X) :
(free R).map f (freeMk x) = freeMk (f x) := by
apply Finsupp.mapDomain_single

/-- The bijection `((free R).obj X ⟶ M) ≃ (X → M)` when `X` is a type and `M` a module. -/
@[simps]
def freeHomEquiv {X : Type u} {M : ModuleCat.{u} R} :
((free R).obj X ⟶ M) ≃ (X ⟶ M) where
toFun φ x := φ (freeMk x)
invFun ψ := freeDesc ψ
left_inv _ := by ext; simp
right_inv _ := by ext; simp

variable (R)

/-- The free-forgetful adjunction for R-modules.
-/
def adj : free R ⊣ forget (ModuleCat.{u} R) :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun X M => (Finsupp.lift M R X).toEquiv.symm
homEquiv_naturality_left_symm := fun {_ _} M f g =>
Finsupp.lhom_ext' fun x =>
LinearMap.ext_ring
(Finsupp.sum_mapDomain_index_addMonoidHom fun y => (smulAddHom R M).flip (g y)).symm }
{ homEquiv := fun _ _ => freeHomEquiv
homEquiv_naturality_left_symm := fun {X Y M} f g ↦ by ext; simp [freeHomEquiv] }

@[simp]
lemma adj_homEquiv (X : Type u) (M : ModuleCat.{u} R) :
(adj R).homEquiv X M = freeHomEquiv := by
simp only [adj, Adjunction.mkOfHomEquiv_homEquiv]

instance : (forget (ModuleCat.{u} R)).IsRightAdjoint :=
(adj R).isRightAdjoint
Expand Down
34 changes: 34 additions & 0 deletions Mathlib/Algebra/Category/ModuleCat/Presheaf/EpiMono.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/-
Copyright (c) 2024 Joël Riou. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joël Riou
-/

import Mathlib.Algebra.Category.ModuleCat.Presheaf

/-!
# Epimorphisms and monomorphisms in the category of presheaves of modules

In this file, we shall give characterizations of epimorphisms and monomorphisms (TODO)
in the category of presheaves of modules.

So far, we have only obtained the lemma `epi_of_surjective`.

-/

universe v v₁ u₁ u

open CategoryTheory

namespace PresheafOfModules

variable {C : Type u₁} [Category.{v₁} C] {R : Cᵒᵖ ⥤ RingCat.{u}}
{M₁ M₂ : PresheafOfModules.{v} R} {f : M₁ ⟶ M₂}

lemma epi_of_surjective (hf : ∀ ⦃X : Cᵒᵖ⦄, Function.Surjective (f.app X)) : Epi f where
left_cancellation {M₃} g₁ g₂ hg := by
ext X m₂
obtain ⟨m₁, rfl⟩ := hf m₂
exact congr_fun ((evaluation R X ⋙ forget _).congr_map hg) m₁

end PresheafOfModules
116 changes: 116 additions & 0 deletions Mathlib/Algebra/Category/ModuleCat/Presheaf/Free.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/-
Copyright (c) 2024 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Joel Riou
-/
import Mathlib.Algebra.Category.ModuleCat.Presheaf
import Mathlib.Algebra.Category.ModuleCat.Adjunctions

/-! The free presheaf of modules on a presheaf of sets

In this file, given a presheaf of rings `R` on a category `C`,
we construct the functor
`PresheafOfModules.free (Cᵒᵖ ⥤ Type u) ⥤ PresheafOfModules.{u} R`
which sends a presheaf of types to the corresponding presheaf of free modules.
`PresheafOfModules.freeAdjunction` shows that this functor is the left
adjoint to the forget functor.

## Notes

This contribution was created as part of the AIM workshop
"Formalizing algebraic geometry" in June 2024.

-/

universe u v₁ u₁

open CategoryTheory

namespace PresheafOfModules

variable {C : Type u₁} [Category.{v₁} C] (R : Cᵒᵖ ⥤ RingCat.{u})

variable {R} in
/-- Given a presheaf of types `F : Cᵒᵖ ⥤ Type u`, this is the presheaf
of modules over `R` which sends `X : Cᵒᵖ` to the free `R.obj X`-module on `F.obj X`. -/
@[simps]
noncomputable def freeObj (F : Cᵒᵖ ⥤ Type u) : PresheafOfModules.{u} R where
obj := fun X ↦ (ModuleCat.free (R.obj X)).obj (F.obj X)
map := fun {X Y} f ↦ ModuleCat.freeDesc
(fun x ↦ ModuleCat.freeMk (F.map f x))
map_id := by aesop

/-- The free presheaf of modules functors `(Cᵒᵖ ⥤ Type u) ⥤ PresheafOfModules.{u} R`. -/
@[simps]
noncomputable def free : (Cᵒᵖ ⥤ Type u) ⥤ PresheafOfModules.{u} R where
obj := freeObj
map {F G} φ :=
{ app := fun X ↦ (ModuleCat.free (R.obj X)).map (φ.app X)
naturality := fun {X Y} f ↦ by
dsimp
ext x
simp only [ModuleCat.coe_comp, Function.comp_apply, ModuleCat.freeDesc_apply,
ModuleCat.restrictScalars.map_apply, ModuleCat.free_map_apply]
congr 1
exact NatTrans.naturality_apply φ f x }

section

variable {R}

variable {F : Cᵒᵖ ⥤ Type u} {G G' : PresheafOfModules.{u} R}

/-- The morphism of presheaves of modules `freeObj F ⟶ G` corresponding to
a morphism `F ⟶ G.presheaf ⋙ forget _` of presheaves of types. -/
@[simps]
noncomputable def freeObjDesc (φ : F ⟶ G.presheaf ⋙ forget _) : freeObj F ⟶ G where
app X := ModuleCat.freeDesc (φ.app X)
naturality {X Y} f := by
dsimp
ext x
simpa using NatTrans.naturality_apply φ f x

variable (F R) in
/-- The unit of `PresheafOfModules.freeAdjunction`. -/
@[simps]
noncomputable def freeAdjunctionUnit : F ⟶ (freeObj (R := R) F).presheaf ⋙ forget _ where
app X x := ModuleCat.freeMk x
naturality X Y f := by ext; simp [presheaf]

/-- The bijection `(freeObj F ⟶ G) ≃ (F ⟶ G.presheaf ⋙ forget _)` when
`F` is a presheaf of types and `G` a presheaf of modules. -/
noncomputable def freeHomEquiv : (freeObj F ⟶ G) ≃ (F ⟶ G.presheaf ⋙ forget _) where
toFun ψ := freeAdjunctionUnit R F ≫ whiskerRight ((toPresheaf _).map ψ) _
invFun φ := freeObjDesc φ
left_inv ψ := by ext1 X; dsimp; ext x; simp [toPresheaf]
right_inv φ := by ext; simp [toPresheaf]

lemma free_hom_ext {ψ ψ' : freeObj F ⟶ G}
(h : freeAdjunctionUnit R F ≫ whiskerRight ((toPresheaf _).map ψ) _ =
freeAdjunctionUnit R F ≫ whiskerRight ((toPresheaf _).map ψ') _ ) : ψ = ψ' :=
freeHomEquiv.injective h

variable (R) in
/-- The free presheaf of modules functor is left adjoint to the forget functor
`PresheafOfModules.{u} R ⥤ Cᵒᵖ ⥤ Type u`. -/
noncomputable def freeAdjunction :
free.{u} R ⊣ (toPresheaf R ⋙ (whiskeringRight _ _ _).obj (forget Ab)) :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun _ _ ↦ freeHomEquiv
homEquiv_naturality_left_symm := fun {F₁ F₂ G} f g ↦
free_hom_ext (by ext; simp [freeHomEquiv, toPresheaf])
homEquiv_naturality_right := fun {F G₁ G₂} f g ↦ rfl }

variable (F G) in
@[simp]
lemma freeAdjunction_homEquiv : (freeAdjunction R).homEquiv F G = freeHomEquiv := by
simp [freeAdjunction, Adjunction.mkOfHomEquiv_homEquiv]

variable (R F) in
@[simp]
lemma freeAdjunction_unit_app :
(freeAdjunction R).unit.app F = freeAdjunctionUnit R F := rfl

end

end PresheafOfModules
Loading
Loading