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] - refactor(Algebra/Category/Grp/Colimits): change the construction of colimits in AddCommGrp #20474

Closed
wants to merge 21 commits into from

Conversation

smorel394
Copy link
Collaborator

The old version of this file has a remark saying "TODO: In fact, in AddCommGrp there is a much nicer model of colimits as quotients of finitely supported functions, and we really should implement this as well (or instead)."

This PR does precisely this (choosing the "instead" option). In fact, given a functor F : J ⥤ AddCommGrp.{w}, it constructs a candidate for the colimit of F as a quotient of DFinsupp (fun j ↦ F.obj j), without any smallness assumptions on J. It then proves that this quotient is a colimit of F if it is w-small, then deduces that AddCommGrp.{w} has all small colimits.


Open in Gitpod

@smorel394 smorel394 added the t-category-theory Category theory label Jan 4, 2025
@github-actions github-actions bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Jan 4, 2025
Copy link

github-actions bot commented Jan 4, 2025

PR summary 551492e1a7

Import changes exceeding 2%

% File
+18.09% Mathlib.Algebra.Category.Grp.Colimits

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Algebra.Category.Grp.Colimits 691 816 +125 (+18.09%)
Import changes for all files
Files Import difference
76 files Mathlib.Algebra.Homology.ShortComplex.Ab Mathlib.AlgebraicGeometry.Modules.Sheaf Mathlib.RepresentationTheory.GroupCohomology.Hilbert90 Mathlib.Algebra.Category.Grp.AB Mathlib.Condensed.Limits Mathlib.Algebra.Category.ModuleCat.AB Mathlib.Algebra.Category.ModuleCat.Differentials.Basic Mathlib.AlgebraicGeometry.Modules.Presheaf Mathlib.Algebra.Category.ModuleCat.ChangeOfRings Mathlib.CategoryTheory.Sites.SheafCohomology.Basic Mathlib.Algebra.Category.ModuleCat.Presheaf.Limits Mathlib.Topology.Category.Profinite.Nobeling Mathlib.Condensed.Light.Explicit Mathlib.Analysis.Fourier.FiniteAbelian.PontryaginDuality Mathlib.Topology.Sheaves.MayerVietoris Mathlib.Algebra.Category.Grp.Abelian Mathlib.Condensed.AB Mathlib.Condensed.Explicit Mathlib.Algebra.Category.ModuleCat.Sheaf.Colimits Mathlib.Condensed.Module Mathlib.Condensed.Discrete.Characterization Mathlib.RepresentationTheory.GroupCohomology.Resolution Mathlib.Algebra.Category.ModuleCat.Sheaf Mathlib.RepresentationTheory.Rep Mathlib.Algebra.Category.ModuleCat.Sheaf.Free Mathlib.NumberTheory.DirichletCharacter.Orthogonality Mathlib.Algebra.Homology.ShortComplex.ModuleCat Mathlib.Algebra.Category.ModuleCat.Differentials.Presheaf Mathlib.Algebra.Category.ModuleCat.Pseudofunctor Mathlib.Algebra.Category.ModuleCat.Sheaf.ChangeOfRings Mathlib.Algebra.Category.ModuleCat.Biproducts Mathlib.RepresentationTheory.Invariants Mathlib.RingTheory.Flat.CategoryTheory Mathlib.Condensed.Solid Mathlib.Algebra.Category.ModuleCat.EnoughInjectives Mathlib.Condensed.Discrete.Module Mathlib.Algebra.Category.ModuleCat.Sheaf.Limits Mathlib.AlgebraicGeometry.Modules.Tilde Mathlib.NumberTheory.MulChar.Duality Mathlib.Condensed.Light.Epi Mathlib.RepresentationTheory.Character Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences Mathlib.Algebra.Category.ModuleCat.Sheaf.Generators Mathlib.Algebra.Category.ModuleCat.Sheaf.Abelian Mathlib.Algebra.Module.PID Mathlib.RingTheory.AdicCompletion.AsTensorProduct Mathlib.Algebra.Category.ModuleCat.Presheaf.Generator Mathlib.Algebra.Category.Grp.Images Mathlib.Condensed.Light.AB Mathlib.Algebra.Category.ModuleCat.Presheaf.Colimits Mathlib.Condensed.Light.Limits Mathlib.RepresentationTheory.GroupCohomology.Basic Mathlib.RepresentationTheory.FDRep Mathlib.Algebra.Homology.LocalCohomology Mathlib.Algebra.Category.ModuleCat.Presheaf Mathlib.RepresentationTheory.GroupCohomology.LowDegree Mathlib.CategoryTheory.Sites.MayerVietorisSquare Mathlib.Condensed.Light.Module Mathlib.Algebra.Category.ModuleCat.Presheaf.Sheafification Mathlib.GroupTheory.FiniteAbelian.Duality Mathlib.Algebra.Category.ModuleCat.Presheaf.EpiMono Mathlib.Condensed.Epi Mathlib.Algebra.Homology.ShortComplex.ConcreteCategory Mathlib.Algebra.Category.ModuleCat.Free Mathlib.GroupTheory.FiniteAbelian.Basic Mathlib.NumberTheory.LSeries.PrimesInAP Mathlib.Algebra.Category.ModuleCat.Presheaf.Monoidal Mathlib.Algebra.Category.ModuleCat.Presheaf.Abelian Mathlib.Algebra.Category.ModuleCat.Presheaf.Pushforward Mathlib.Algebra.Category.ModuleCat.Sheaf.PushforwardContinuous Mathlib.Algebra.Category.ModuleCat.Presheaf.Sheafify Mathlib.Algebra.Category.ModuleCat.Sheaf.Quasicoherent Mathlib.CategoryTheory.Triangulated.Yoneda Mathlib.Algebra.Category.ModuleCat.Presheaf.ChangeOfRings Mathlib.Algebra.Homology.ConcreteCategory Mathlib.Algebra.Category.ModuleCat.Presheaf.Free
1
Mathlib.Algebra.Category.ModuleCat.FilteredColimits 35
Mathlib.Algebra.Category.ModuleCat.Colimits 98
Mathlib.Algebra.Category.Grp.Colimits 125
Mathlib.Data.DFinsupp.Small (new file) 458

Declarations diff

+ DFinsupp.small
+ Quot
+ Quot.addMonoidHom_ext
+ Quot.desc
+ Quot.desc_colimitCocone
+ Quot.desc_toCocone_desc
+ Quot.desc_toCocone_desc_app
+ Quot.map_ι
+ Quot.ι
+ Quot.ι_desc
+ Relations
+ hasColimit_of_small_quot
+ instance (priority := 1300) hasColimitsOfSize [UnivLE.{u, w}] :
+ instance [DecidableEq J] : AddCommGroup (Quot F)
+ instance [DecidableEq J] [Small.{w} J] : Small.{w} (Quot F)
+ isColimit_of_bijective_desc
+ on
+ toCocone
- ColimitType
- ColimitTypeInhabited
- Prequotient
- Relation
- coconeFun
- coconeMorphism
- cocone_naturality
- cocone_naturality_components
- colimit
- colimitSetoid
- descFun
- descFunLift
- descMorphism
- hasColimits
- hasColimitsOfSize
- instance : Add (ColimitType.{w} F)
- instance : AddCommGroup (ColimitType.{w} F)
- instance : HasColimitsOfSize.{0, 0} (AddCommGrp.{u}) := hasColimitsOfSize.{u, 0, 0}
- instance : HasColimitsOfSize.{u, u} (AddCommGrpMax.{u, v}) := hasColimitsOfSize.{v}
- instance : HasColimitsOfSize.{u, v} (AddCommGrpMax.{u, v}) := hasColimitsOfSize.{u}
- instance : HasColimitsOfSize.{v, u} (AddCommGrpMax.{u, v}) := hasColimitsOfSize.{u}
- instance : HasColimitsOfSize.{v, v} (AddCommGrpMax.{u, v}) := hasColimitsOfSize.{u}
- instance : Inhabited (Prequotient.{w} F)
- instance : Neg (ColimitType.{w} F)
- instance : Zero (ColimitType.{w} F)
- quot_add
- quot_neg
- quot_zero

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


Increase in tech debt: (relative, absolute) = (2.56, 0.00)
Current number Change Type
4824 -2 porting notes
1518 4 erw

Current commit 551492e1a7
Reference commit 0f18102487

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@joelriou
Copy link
Collaborator

joelriou commented Jan 4, 2025

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 75fa8cf.
There were significant changes against commit e6514e0:

  Benchmark                                              Metric         Change
  ============================================================================
- ~Mathlib.Algebra.Category.Grp.Colimits                 instructions   126.9%
+ ~Mathlib.Algebra.Category.ModuleCat.Presheaf.Abelian   instructions   -80.1%
+ ~Mathlib.Condensed.Discrete.Module                     instructions   -16.7%

@joelriou joelriou added the awaiting-author A reviewer has asked the author a question or requested changes label Jan 4, 2025
@smorel394 smorel394 removed the awaiting-author A reviewer has asked the author a question or requested changes label Jan 5, 2025
@joelriou joelriou added the awaiting-author A reviewer has asked the author a question or requested changes label Jan 5, 2025
@smorel394 smorel394 removed the awaiting-author A reviewer has asked the author a question or requested changes label Jan 5, 2025
@joelriou
Copy link
Collaborator

joelriou commented Jan 6, 2025

Thanks!

bors merge

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the ready-to-merge This PR has been sent to bors. label Jan 6, 2025
mathlib-bors bot pushed a commit that referenced this pull request Jan 6, 2025
…olimits in `AddCommGrp` (#20474)

The old version of this file has a remark saying "TODO: In fact, in `AddCommGrp` there is a much nicer model of colimits as quotients of finitely supported functions, and we really should implement this as well (or instead)."

This PR does precisely this (choosing the "instead" option). In fact, given a functor `F : J ⥤ AddCommGrp.{w}`, it constructs a candidate for the colimit of `F` as a quotient of `DFinsupp (fun j ↦ F.obj j)`, without any smallness assumptions on `J`. It then proves that this quotient is a colimit of `F` if it is `w`-small, then deduces that `AddCommGrp.{w}` has all small colimits.




Co-authored-by: smorel394 <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jan 6, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title refactor(Algebra/Category/Grp/Colimits): change the construction of colimits in AddCommGrp [Merged by Bors] - refactor(Algebra/Category/Grp/Colimits): change the construction of colimits in AddCommGrp Jan 6, 2025
@mathlib-bors mathlib-bors bot closed this Jan 6, 2025
@mathlib-bors mathlib-bors bot deleted the SM.colimitGrp branch January 6, 2025 12:25
Julian added a commit that referenced this pull request Jan 6, 2025
* origin/master: (189 commits)
  chore(Algebra): make more names consistent (#20449)
  feat: Polynomial FLT (#18882)
  feat: A disjoint union is finite iff all sets are finite, and all but finitely many are empty (#20457)
  fix: linkfix in 100.yaml (#20517)
  feat(1000): fill in more entries (#20470)
  feat(Combinatorics/SimpleGraph/Walk): add `penultimate` and `snd` (#16769)
  feat(ContinuousMultilinearMap): add lemmas about `.prod` (#20462)
  feat(RingTheory): classification of etale algebras over fields (#20324)
  fix: Allow multiple builds on staging branch (#20515)
  feat(CategoryTheory/Shift/Adjunction): properties of `Adjunction.CommShift` (#20337)
  chore(Data/Multiset/Basic): move the `sub`, `union`, `inter` sections lower (#19863)
  chore(Topology/UniformSpace/Completion): make coe' argument implicit (#20514)
  refactor(Algebra/Category/Grp/Colimits): change the construction of colimits in `AddCommGrp` (#20474)
  feat(Topology/Algebra/InfiniteSum/NatInt): Add pnat lems (#16544)
  chore(RingTheory/Finiteness): rename Module.Finite.out (#20506)
  refactor(CategoryTheory/Limits/Preserves/Ulift): simplify the proof that the universe lifting functor for types preserves all colimits (#20508)
  feat(CategoryTheory): products in the category of Ind-objects (#20507)
  chore: remove >9 month old deprecations (#20505)
  chore(FieldTheory/Galois): small cleanup (#20217)
  chore(LinearIndependent): generalize to semirings (#20480)
  chore(NumberTheory/NumberField/AdeleRing): refactor adele rings (#20500)
  chore: replace `aesop` with `simp` where possible (#20483)
  chore(1000): remove nonexistent fields (#20493)
  chore(CategoryTheory/Adjunction.Basic, CategoryTheory/Equivalence): change definition of `Adjunction.comp` and `Equivalence.trans` (#20490)
  feat(Asymptotics): add `Asymptotics.*.*Prod` lemmas (#20458)
  feat: a conditional kernel is almost everywhere a probability measure (#20430)
  feat: if `f` is a measurable group hom, then every point has a neighborhood `s` such that `f '' s` is bounded (#20304)
  feat: `Ico`, `Ioc`, and `Ioo` are not closed or compact (#20479)
  chore: drop redundant hypothesis in `Module.Dual.eq_of_preReflection_mapsTo` (#20492)
  feat(FaaDiBruno): derive `DecidableEq` (#20482)
  chore(SetTheory/Ordinal/Basic): `{x // x < y}` → `Iio y` (#20413)
  chore: generalize `FormalMultilinearSeries.ofScalars_norm` to `Seminormed` (#20351)
  chore(MvPolynomial/Localization): golf using TensorProduct (#20309)
  chore(Combinatorics/Enumerative/Partition): auto-derive DecidableEq (#20277)
  chore(CategoryTheory): make relevant parameters explicit in `Arrow.homMk`. (#20259)
  feat: add `IsStarNormal (↑x⁻¹ : R)` instance for `x : Rˣ` (#20091)
  fix: Stop cancelling builds of master (#20435)
  chore: update Mathlib dependencies 2025-01-05 (#20485)
  feat(SetTheory/Cardinal/Arithmetic): miscellaneous cardinality lemmas (#18933)
  chore: bump toolchain to v4.16.0-rc1, and merge bump/v4.16.0 (#20464)
  chore: bot validates lean-toolchain on bump/v4.X.0 branches (#20478)
  feat: shorthand lemmas for the L1 norm (#20383)
  chore: remove unnecessary adaptation notes (#20467)
  chore(Algebra/Category/MonCat/Colimits): remove smallness condition (#20473)
  chore(SetTheory/Ordinal/Arithmetic): `IsLeftCancelAdd Ordinal` (#19888)
  feat(Algebra): more on `OrthogonalIdempotents` (#18195)
  feat(Radical): `(radical a).natDegree ≤ a.natDegree` (#20468)
  feat(Polynomial): `(a^n)' = 0` iff `a' = 0` when `n` doesn't divide the characteristic (#20190)
  feat(Algebra/Lie): add Lie's theorem (#13480)
  chore(RingTheory/Generators): make algebra instance a def (#14265)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
large-import Automatically added label for PRs with a significant increase in transitive imports ready-to-merge This PR has been sent to bors. t-category-theory Category theory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants