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

[Merged by Bors] - feat(CategoryTheory): the Freyd-Mitchell embedding theorem #22222

Closed
wants to merge 79 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
3c87dcb
Bad start
TwoFX Jan 26, 2025
f4a3c79
WIP
TwoFX Jan 26, 2025
2d7126d
nothing
TwoFX Feb 2, 2025
b2d6f6b
feat: group objects
TwoFX Feb 2, 2025
6ad4df4
Revert "nothing"
TwoFX Feb 2, 2025
a790055
Mathlib.lean
TwoFX Feb 2, 2025
f36a814
Switch to PreservesFiniteProducts
TwoFX Feb 3, 2025
d121ea8
Additional group stuff
TwoFX Feb 5, 2025
4ddcb9d
CommGrp
TwoFX Feb 5, 2025
ef5a5d6
Additional group stuff
TwoFX Feb 5, 2025
f8fe688
Cleanup
TwoFX Feb 5, 2025
eab57ef
WIP
TwoFX Feb 5, 2025
5682836
Okay
TwoFX Feb 6, 2025
c1b92de
WIP
TwoFX Feb 6, 2025
97bdbca
Done
TwoFX Feb 6, 2025
1cf5d22
Fix
TwoFX Feb 6, 2025
8959ad6
Merge remote-tracking branch 'origin/master' into fme-197-more
TwoFX Feb 7, 2025
2172134
Merge remote-tracking branch 'origin/master' into fme-197
TwoFX Feb 8, 2025
93b6633
Add forgetful functor
TwoFX Feb 8, 2025
10f6445
Import
TwoFX Feb 8, 2025
0d20720
Compatibility
TwoFX Feb 8, 2025
b1c3eee
Fix namespace
TwoFX Feb 8, 2025
2fe34b5
Move to separate file
TwoFX Feb 8, 2025
ef38b43
Merge branch 'fme-197' into fme-197-more
TwoFX Feb 8, 2025
6da6e17
Fix
TwoFX Feb 8, 2025
527b8c9
Add forgetful functor
TwoFX Feb 8, 2025
4e118dd
Fix
TwoFX Feb 8, 2025
9c42bc2
Merge branch 'fme-197-more' into fme-199
TwoFX Feb 8, 2025
22b12d2
Cleanup
TwoFX Feb 8, 2025
d575b25
Fix implicitness
TwoFX Feb 8, 2025
5757161
Merge branch 'fme-197' into fme-197-more
TwoFX Feb 8, 2025
e53b99f
Fix implicitness
TwoFX Feb 8, 2025
9837c67
Oops
TwoFX Feb 8, 2025
a8d8b86
Lint?!
TwoFX Feb 8, 2025
a657cfa
Merge branch 'fme-197-more' into fme-199
TwoFX Feb 8, 2025
b16a438
Merge branch 'fme-200-pre' into fme-200
TwoFX Feb 8, 2025
015fded
Add code
TwoFX Feb 8, 2025
d23aea4
Merge branch 'fme-200' into fme-190
TwoFX Feb 9, 2025
3846c27
Merge branch 'fme-199' into fme-190
TwoFX Feb 9, 2025
ec1677c
Tricky sorry
TwoFX Feb 9, 2025
384a483
WIP
TwoFX Feb 9, 2025
284fdf7
sorry-free?!
TwoFX Feb 9, 2025
75256b2
Going to try the multiplicative version now
TwoFX Feb 9, 2025
4799598
Cleanup
TwoFX Feb 9, 2025
09788fa
Done?!?!
TwoFX Feb 9, 2025
c35edb4
Merge remote-tracking branch 'origin/master' into fme-199
TwoFX Feb 15, 2025
38cc456
Merge remote-tracking branch 'origin/master' into tothefinish
TwoFX Feb 17, 2025
1c6cd70
Import
TwoFX Feb 17, 2025
2f8710e
Merge branch 'fme-199' into fme-190
TwoFX Feb 17, 2025
101fe19
feat(CategoryTheory): forgetting the group structure on the codomain …
TwoFX Feb 17, 2025
9d52382
module doc
TwoFX Feb 17, 2025
a51ee0d
Merge branch 'fme-190' into tothefinish
TwoFX Feb 17, 2025
0882ad5
Fix
TwoFX Feb 17, 2025
769874f
It was not a good simp lemma anyway
TwoFX Feb 17, 2025
9eb36fa
Merge remote-tracking branch 'origin/master' into fme-190
TwoFX Feb 20, 2025
e91ac71
Code
TwoFX Feb 22, 2025
5c92697
feat(CategoryTheory): explicit argument versions of `epi_comp` and `m…
TwoFX Feb 22, 2025
49c35a7
fix
TwoFX Feb 22, 2025
19a2463
Merge branch 'epi-comp-prime' into fme-14-final
TwoFX Feb 22, 2025
1882fbe
adapt
TwoFX Feb 22, 2025
663ef4c
Merge branch 'fme-190' into tothefinish
TwoFX Feb 22, 2025
a4c63d1
Merge remote-tracking branch 'origin/master' into tothefinish
TwoFX Feb 22, 2025
44f9f75
Merge branch 'tothefinish' into fme-204
TwoFX Feb 22, 2025
a284b0f
?!?!
TwoFX Feb 22, 2025
f9b1f49
Mathlib.lean
TwoFX Feb 22, 2025
c881fc1
Merge remote-tracking branch 'origin/master' into tothefinish
TwoFX Feb 22, 2025
7388228
WIP
TwoFX Feb 22, 2025
686d42f
Merge remote-tracking branch 'origin/master' into tothefinish
TwoFX Feb 22, 2025
faff768
Cleanup
TwoFX Feb 22, 2025
0abcc2d
Docs
TwoFX Feb 22, 2025
443f60c
Merge branch 'tothefinish' into fme-204
TwoFX Feb 22, 2025
6330cd3
Update 1000.yaml
TwoFX Feb 22, 2025
ff3622f
Update comment in Pseudoelements.lean
TwoFX Feb 22, 2025
5021923
Comment
TwoFX Feb 22, 2025
0500131
Fix
TwoFX Feb 22, 2025
96146bc
Busywork
TwoFX Feb 22, 2025
6063df1
Typo
TwoFX Feb 22, 2025
ed5ef10
Merge remote-tracking branch 'origin/master' into fme-204
TwoFX Feb 23, 2025
55e2d9d
add overview
TwoFX Feb 23, 2025
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
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,7 @@ import Mathlib.CategoryTheory.Abelian.DiagramLemmas.Four
import Mathlib.CategoryTheory.Abelian.EpiWithInjectiveKernel
import Mathlib.CategoryTheory.Abelian.Exact
import Mathlib.CategoryTheory.Abelian.Ext
import Mathlib.CategoryTheory.Abelian.FreydMitchell
import Mathlib.CategoryTheory.Abelian.FunctorCategory
import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Basic
import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Colim
Expand Down
162 changes: 162 additions & 0 deletions Mathlib/CategoryTheory/Abelian/FreydMitchell.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/-
Copyright (c) 2025 Markus Himmel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.ModuleEmbedding.Opposite
import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Indization

/-!
# The Freyd-Mitchell embedding theorem

Let `C` be an abelian category. We construct a ring `FreydMitchell.EmbeddingRing C` and a functor
`FreydMitchell.embedding : C ⥤ ModuleCat.{max u v} (EmbeddingRing C)` which is full, faithful and
exact.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Could you include an outline of the strategy of proof here, in particular the important work on Ind-objects?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added an overview of the proof stategy. Is that what you had in mind?

## Overview over the proof

The usual stategy to prove the Freyd-Mitchell embedding theorem is as follows:

1. Prove that if `D` is a Grothendieck abelian category and `F : C ⥤ Dᵒᵖ` is a functor from a
small category, then there is a functor `G : Dᵒᵖ ⥤ ModuleCat R` for a suitable `R` such that `G`
is faithful and exact and `F ⋙ G` is full.
2. Find a suitable Grothendieck abelian category `D` and a full, faithful and exact functor
`F : C ⥤ Dᵒᵖ`.

To prove (1), we proceed as follows:

1. Using the Special Adjoint Functor Theorem and the duality between subobjects and quotients in
abelian categories, we have that Grothendieck abelian categories have all limits (this is shown in
`Abelian.GrothendieckCategory.Basic`).
2. Using the small object argument, it is shown that Grothendieck abelian categories have enough
injectives (see `Abelian.GrothendieckCategory.EnoughInjectives`).
3. Putting these two together, it follows that Grothendieck abelian categories have an injective
cogenerator (see `Generator.Abelian`).
4. By taking a coproduct of copies of the injective cogenerator, we find a projective separator `G`
in `Dᵒᵖ` such that every object in the image of `F` is a quotient of `G`. Then the additive Hom
functor `Hom(G, ·) : Dᵒᵖ ⥤ Module (End G)ᵐᵒᵖ` is faithful (because `G` is a separator), left exact
(because it is a hom functor), right exact (because `G` is projective) and full (because of a
combination of the aforementioned properties, see `Abelian.Yoneda`). We put this all together in
the file `Abelian.GrothendieckCategory.ModuleEmbedding.Opposite`.

To prove (2), there are multiple options.

* Some sources (for example Freyd's "Abelian Categories") choose `D := LeftExactFunctor C Ab`. The
main difficulty with this approach is that it is not obvious that `D` is abelian. This approach has
a very algebraic flavor and requires a relatively large armount of ad-hoc reasoning.
* In the Stacks project, it is suggested to choose `D := Sheaf J Ab` for a suitable Grothendieck
topology on `Cᵒᵖ` and there are reasons to believe that this `D` is in fact equivalent to
`LeftExactFunctor C Ab`. This approach translates many of the interesting properties along the
sheafification adjunction from a category of `Ab`-valued presheaves, which in turn inherits many
interesting properties from the category of abelian groups.
* Kashiwara and Schapira choose `D := Ind Cᵒᵖ`, which can be shown to be equivalent to
`LeftExactFunctor C Ab` (see the file `CategoryTheory.Preadditive.Indization`). This approach
deduces most interesting properties from the category of types.

When work on this theorem commenced in early 2022, all three apporaches were quite out of reach.
By the time the theorem was proved in early 2025, both the `Sheaf` approach and the `Ind` approach
were available in mathlib. The code below uses `D := Ind Cᵒᵖ`.

## Implementation notes

In the literature you will generally only find this theorem stated for small categories `C`. In
Lean, we can work around this limitation by passing from `C` to `AsSmall.{max u v} C`, thereby
enlarging the category of modules that we land in (which should be inconsequential in most
applications) so that our embedding theorem applies to all abelian categories. If `C` was already a
small category, then this does not change anything.

## References

* https://stacks.math.columbia.edu/tag/05PL
* [M. Kashiwara, P. Schapira, *Categories and Sheaves*][Kashiwara2006], Section 9.6
-/

universe v u

open CategoryTheory Limits

namespace CategoryTheory.Abelian

variable {C : Type u} [Category.{v} C] [Abelian C]

namespace FreydMitchell

open ZeroObject in
instance : Nonempty (AsSmall.{max u v} C) := ⟨0⟩

variable (C) in
/-- Given an abelian category `C`, this is a ring such that there is a full, faithful and exact
embedding `C ⥤ ModuleCat (EmbeddingRing C)`.

It is probably not a good idea to unfold this. -/
def EmbeddingRing : Type (max u v) :=
IsGrothendieckAbelian.OppositeModuleEmbedding.EmbeddingRing
(Ind.yoneda (C := (AsSmall.{max u v} C)ᵒᵖ)).rightOp

noncomputable instance : Ring (EmbeddingRing C) :=
inferInstanceAs <| Ring <|
IsGrothendieckAbelian.OppositeModuleEmbedding.EmbeddingRing
(Ind.yoneda (C := (AsSmall.{max u v} C)ᵒᵖ)).rightOp

variable (C) in
private def F : C ⥤ AsSmall.{max u v} C :=
AsSmall.equiv.functor

variable (C) in
private noncomputable def G : AsSmall.{max u v} C ⥤ (Ind (AsSmall.{max u v} C)ᵒᵖ)ᵒᵖ :=
Ind.yoneda.rightOp

variable (C) in
private noncomputable def H :
(Ind (AsSmall.{max u v} C)ᵒᵖ)ᵒᵖ ⥤ ModuleCat.{max u v} (EmbeddingRing C) :=
IsGrothendieckAbelian.OppositeModuleEmbedding.embedding (G C)

variable (C) in
/-- This is the full, faithful and exact embedding `C ⥤ ModuleCat (EmbeddingRing C)`. The fact that
such a functor exists is called the Freyd-Mitchell embedding theorem.

It is probably not a good idea to unfold this. -/
noncomputable def functor : C ⥤ ModuleCat.{max u v} (EmbeddingRing C) :=
F C ⋙ G C ⋙ H C

instance : (functor C).Faithful := by
rw [functor]
have : (F C).Faithful := by rw [F]; infer_instance
have : (G C).Faithful := by rw [G]; infer_instance
have : (H C).Faithful := IsGrothendieckAbelian.OppositeModuleEmbedding.faithful_embedding _
infer_instance

instance : (functor C).Full := by
rw [functor]
have : (F C).Full := by rw [F]; infer_instance
have : (G C).Full := by rw [G]; infer_instance
have : (G C ⋙ H C).Full := IsGrothendieckAbelian.OppositeModuleEmbedding.full_embedding _
infer_instance

instance : PreservesFiniteLimits (functor C) := by
rw [functor]
have : PreservesFiniteLimits (F C) := by rw [F]; infer_instance
have : PreservesFiniteLimits (G C) := by rw [G]; apply preservesFiniteLimits_rightOp
have : PreservesFiniteLimits (H C) :=
IsGrothendieckAbelian.OppositeModuleEmbedding.preservesFiniteLimits_embedding _
infer_instance

instance : PreservesFiniteColimits (functor C) := by
rw [functor]
have : PreservesFiniteColimits (F C) := by rw [F]; infer_instance
have : PreservesFiniteColimits (G C) := by rw [G]; apply preservesFiniteColimits_rightOp
have : PreservesFiniteColimits (H C) :=
IsGrothendieckAbelian.OppositeModuleEmbedding.preservesFiniteColimits_embedding _
infer_instance

end FreydMitchell

/-- The Freyd-Mitchell embedding theorem. See also `FreydMitchell.functor` for a functor which
has the relevant instances. -/
@[stacks 05PP]
theorem freyd_mitchell (C : Type u) [Category.{v} C] [Abelian C] :
∃ (R : Type (max u v)) (_ : Ring R) (F : C ⥤ ModuleCat.{max u v} R),
F.Full ∧ F.Faithful ∧ PreservesFiniteLimits F ∧ PreservesFiniteColimits F :=
⟨_, _, FreydMitchell.functor C, inferInstance, inferInstance, inferInstance, inferInstance⟩

end CategoryTheory.Abelian
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ is faithful and preserves finite limits and colimits. Furthermore, `F ⋙ embedd
noncomputable def embedding : Cᵒᵖ ⥤ ModuleCat.{v} (EmbeddingRing F) :=
preadditiveCoyonedaObj (generator F)

instance [Nonempty D] : (embedding F).Faithful :=
instance faithful_embedding [Nonempty D] : (embedding F).Faithful :=
(isSeparator_iff_faithful_preadditiveCoyonedaObj _).1 (isSeparator F)

instance [Nonempty D] [F.Full] : (F ⋙ embedding F).Full :=
instance full_embedding [Nonempty D] [F.Full] : (F ⋙ embedding F).Full :=
full_comp_preadditiveCoyonedaObj _ (isSeparator F) (exists_epi F)

instance : PreservesFiniteLimits (embedding F) := by
instance preservesFiniteLimits_embedding : PreservesFiniteLimits (embedding F) := by
rw [embedding]
apply preservesFiniteLimits_of_preservesFiniteLimitsOfSize
infer_instance

instance : PreservesFiniteColimits (embedding F) := by
instance preservesFiniteColimits_embedding : PreservesFiniteColimits (embedding F) := by
apply preservesFiniteColimits_preadditiveCoyonedaObj_of_projective

end OppositeModuleEmbedding
Expand Down
7 changes: 4 additions & 3 deletions Mathlib/CategoryTheory/Abelian/Pseudoelements.lean
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ their action on pseudoelements. Thus, a usual style of proofs in abelian categor
First, we construct some morphism using universal properties, and then we use diagram chasing
of pseudoelements to verify that is has some desirable property such as exactness.

It should be noted that the Freyd-Mitchell embedding theorem gives a vastly stronger notion of
pseudoelement (in particular one that gives extensionality). However, this theorem is quite
difficult to prove and probably out of reach for a formal proof for the time being.
It should be noted that the Freyd-Mitchell embedding theorem
(see `CategoryTheory.Abelian.FreydMitchell`) gives a vastly stronger notion of
pseudoelement (in particular one that gives extensionality) and this file should be updated to
go use that instead!

## Main results

Expand Down
4 changes: 2 additions & 2 deletions docs/1000.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1324,8 +1324,8 @@ Q1146791:

Q1148215:
title: Mitchell's embedding theorem
# ongoing effort: going slowly; lots of work. see e.g.
# https://leanprover.zulipchat.com/#narrow/channel/217875-Is-there-code-for-X.3F/topic/Freyd-Mitchell.20embedding
decl: CategoryTheory.Abelian.freyd_mitchell
authors: Markus Himmel, Jakob von Raumer, Paul Reichert, Joël Riou

Q1149022:
title: Fubini's theorem
Expand Down