-
Notifications
You must be signed in to change notification settings - Fork 373
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
Changes from all commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
3c87dcb
Bad start
TwoFX f4a3c79
WIP
TwoFX 2d7126d
nothing
TwoFX b2d6f6b
feat: group objects
TwoFX 6ad4df4
Revert "nothing"
TwoFX a790055
Mathlib.lean
TwoFX f36a814
Switch to PreservesFiniteProducts
TwoFX d121ea8
Additional group stuff
TwoFX 4ddcb9d
CommGrp
TwoFX ef5a5d6
Additional group stuff
TwoFX f8fe688
Cleanup
TwoFX eab57ef
WIP
TwoFX 5682836
Okay
TwoFX c1b92de
WIP
TwoFX 97bdbca
Done
TwoFX 1cf5d22
Fix
TwoFX 8959ad6
Merge remote-tracking branch 'origin/master' into fme-197-more
TwoFX 2172134
Merge remote-tracking branch 'origin/master' into fme-197
TwoFX 93b6633
Add forgetful functor
TwoFX 10f6445
Import
TwoFX 0d20720
Compatibility
TwoFX b1c3eee
Fix namespace
TwoFX 2fe34b5
Move to separate file
TwoFX ef38b43
Merge branch 'fme-197' into fme-197-more
TwoFX 6da6e17
Fix
TwoFX 527b8c9
Add forgetful functor
TwoFX 4e118dd
Fix
TwoFX 9c42bc2
Merge branch 'fme-197-more' into fme-199
TwoFX 22b12d2
Cleanup
TwoFX d575b25
Fix implicitness
TwoFX 5757161
Merge branch 'fme-197' into fme-197-more
TwoFX e53b99f
Fix implicitness
TwoFX 9837c67
Oops
TwoFX a8d8b86
Lint?!
TwoFX a657cfa
Merge branch 'fme-197-more' into fme-199
TwoFX b16a438
Merge branch 'fme-200-pre' into fme-200
TwoFX 015fded
Add code
TwoFX d23aea4
Merge branch 'fme-200' into fme-190
TwoFX 3846c27
Merge branch 'fme-199' into fme-190
TwoFX ec1677c
Tricky sorry
TwoFX 384a483
WIP
TwoFX 284fdf7
sorry-free?!
TwoFX 75256b2
Going to try the multiplicative version now
TwoFX 4799598
Cleanup
TwoFX 09788fa
Done?!?!
TwoFX c35edb4
Merge remote-tracking branch 'origin/master' into fme-199
TwoFX 38cc456
Merge remote-tracking branch 'origin/master' into tothefinish
TwoFX 1c6cd70
Import
TwoFX 2f8710e
Merge branch 'fme-199' into fme-190
TwoFX 101fe19
feat(CategoryTheory): forgetting the group structure on the codomain …
TwoFX 9d52382
module doc
TwoFX a51ee0d
Merge branch 'fme-190' into tothefinish
TwoFX 0882ad5
Fix
TwoFX 769874f
It was not a good simp lemma anyway
TwoFX 9eb36fa
Merge remote-tracking branch 'origin/master' into fme-190
TwoFX e91ac71
Code
TwoFX 5c92697
feat(CategoryTheory): explicit argument versions of `epi_comp` and `m…
TwoFX 49c35a7
fix
TwoFX 19a2463
Merge branch 'epi-comp-prime' into fme-14-final
TwoFX 1882fbe
adapt
TwoFX 663ef4c
Merge branch 'fme-190' into tothefinish
TwoFX a4c63d1
Merge remote-tracking branch 'origin/master' into tothefinish
TwoFX 44f9f75
Merge branch 'tothefinish' into fme-204
TwoFX a284b0f
?!?!
TwoFX f9b1f49
Mathlib.lean
TwoFX c881fc1
Merge remote-tracking branch 'origin/master' into tothefinish
TwoFX 7388228
WIP
TwoFX 686d42f
Merge remote-tracking branch 'origin/master' into tothefinish
TwoFX faff768
Cleanup
TwoFX 0abcc2d
Docs
TwoFX 443f60c
Merge branch 'tothefinish' into fme-204
TwoFX 6330cd3
Update 1000.yaml
TwoFX ff3622f
Update comment in Pseudoelements.lean
TwoFX 5021923
Comment
TwoFX 0500131
Fix
TwoFX 96146bc
Busywork
TwoFX 6063df1
Typo
TwoFX ed5ef10
Merge remote-tracking branch 'origin/master' into fme-204
TwoFX 55e2d9d
add overview
TwoFX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?