Skip to content

feat(CategoryTheory/Limits): commutation of limits and colimits - #43977

Open
joelriou wants to merge 11 commits into
leanprover-community:masterfrom
joelriou:preserves-colimits-comm
Open

joelriou wants to merge 11 commits into
leanprover-community:masterfrom
joelriou:preserves-colimits-comm

Conversation

@joelriou

@joelriou joelriou commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

This PR adds some API about the commutation of limits and colimits. For example, if C has colimits of shape K' and limits of shape K, we show that the limit functor lim : (K ⥤ C) ⥤ C commutes with colimits of shape K' iff the colimit functor colim : (K' ⥤ C) ⥤ C commutes with limits of shape K.
We use this in order to prove that if C has exact colimits of shape K' then the full subcategory of J ⥤ C consisting of functors which commutes with colimits of shape K' is closed under finite limits and finite colimits.


I do not think it would make sense to split the file Mathlib/CategoryTheory/ObjectProperty/FunctorCategory/PreservesLimits.lean to reduce imports.

Open in Gitpod

@joelriou joelriou added WIP Work in progress t-category-theory Category theory labels Sep 19, 2026
@github-actions github-actions Bot added large-import Automatically added label for PRs with a significant increase in transitive imports tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip labels Sep 19, 2026
@github-actions

github-actions Bot commented Sep 19, 2026

Copy link
Copy Markdown

PR summary 61a2abceca

Import changes exceeding 2%

% File
+16.04% Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits 1016 1179 +163 (+16.04%)
Import changes for all files
Files Import difference
Mathlib.CategoryTheory.Limits.Types.PreservesLimit Mathlib.CategoryTheory.ObjectProperty.FunctorCategory.PreservesLimits 163

Declarations diff (regex)

+ colim.coconeFlip
+ colim.isColimitCoconeFlip
+ colimitLimToLimitColim
+ colimitLimToLimitColim_eq_colimit_desc
+ colimitLimToLimitColim_eq_limit_lift
+ instance (F : K ⥤ J) [HasColimitsOfShape K' C] :
+ instance [HasColimitsOfShape K' C] :
+ instance [HasColimitsOfShape K' C] [HasExactColimitsOfShape K' C] [HasFiniteLimits C] :
+ instance [HasColimitsOfShape K' C] [HasLimitsOfShape K C]
+ instance [HasFiniteColimits C] :
+ instance {ι : Type*} (P : ι → ObjectProperty C) [∀ i, (P i).IsClosedUnderColimitsOfShape J] :
+ instance {ι : Type*} (P : ι → ObjectProperty C) [∀ i, (P i).IsClosedUnderLimitsOfShape J] :
+ isIso_colimitLimToLimitColim_iff_preservesColimit
+ isIso_colimitLimToLimitColim_iff_preservesLimit
+ lim.cone
+ lim.isLimitCone
+ preservesColimit_flip_lim_iff_preservesLimit_colim
+ preservesColimit_lim_iff_preservesLimit_colim
+ preservesColimitsOfShape_lim_iff_preservesLimitsOfShape_colim
+ ι_colimitToLimit_π

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 61a2abc).

  • +25 new declarations
  • −0 removed declarations
+CategoryTheory.Limits.colim.coconeFlip
+CategoryTheory.Limits.colim.coconeFlip_pt
+CategoryTheory.Limits.colim.coconeFlip_ι_app_app
+CategoryTheory.Limits.colim.isColimitCoconeFlip
+CategoryTheory.Limits.colimitLimToLimitColim
+CategoryTheory.Limits.colimitLimToLimitColim_eq_colimit_desc
+CategoryTheory.Limits.colimitLimToLimitColim_eq_limit_lift
+CategoryTheory.Limits.isIso_colimitLimToLimitColim_iff_preservesColimit
+CategoryTheory.Limits.isIso_colimitLimToLimitColim_iff_preservesLimit
+CategoryTheory.Limits.lim.cone
+CategoryTheory.Limits.lim.cone_pt
+CategoryTheory.Limits.lim.cone_π_app_app
+CategoryTheory.Limits.lim.isLimitCone
+CategoryTheory.Limits.preservesColimit_flip_lim_iff_preservesLimit_colim
+CategoryTheory.Limits.preservesColimit_lim_iff_preservesLimit_colim
+CategoryTheory.Limits.preservesColimitsOfShape_lim_iff_preservesLimitsOfShape_colim
+CategoryTheory.Limits.ι_colimitToLimit_π
+CategoryTheory.Limits.ι_colimitToLimit_π_assoc
+CategoryTheory.ObjectProperty.instIsClosedUnderColimitsOfShapeFunctorPreservesColimitOfHasColimitsOfShape
+CategoryTheory.ObjectProperty.instIsClosedUnderColimitsOfShapeFunctorPreservesColimitsOfShapeOfHasColimitsOfShape
+CategoryTheory.ObjectProperty.instIsClosedUnderColimitsOfShapeIInf
+CategoryTheory.ObjectProperty.instIsClosedUnderFiniteColimitsFunctorPreservesColimitsOfShapeOfHasFiniteColimits
+CategoryTheory.ObjectProperty.instIsClosedUnderFiniteLimitsFunctorPreservesColimitsOfShapeOfHasExactColimitsOfShapeOfHasFiniteLimits
+CategoryTheory.ObjectProperty.instIsClosedUnderLimitsOfShapeFunctorPreservesColimitsOfShapeOfHasLimitsOfShapeOfPreservesLimitsOfShapeColim
+CategoryTheory.ObjectProperty.instIsClosedUnderLimitsOfShapeIInf

Decrease in strong tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (strong)
backward.defeqAttrib.useBackward 4142 -1
No changes to weak technical debt.

Current commit 61a2abceca
Reference commit 2ed733ad3e

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py 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).

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 t-category-theory Category theory tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant