Skip to content

refactor(CategoryTheory): insert missing Functor.op compatibility isomorphisms - #43567

Open
kim-em wants to merge 1 commit into
leanprover-community:masterfrom
kim-em:functor-op
Open

refactor(CategoryTheory): insert missing Functor.op compatibility isomorphisms#43567
kim-em wants to merge 1 commit into
leanprover-community:masterfrom
kim-em:functor-op

Conversation

@kim-em

@kim-em kim-em commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This PR inserts Functor.opId, Functor.opComp and the new Functor.leftOpCompOp where Mathlib currently identifies (F ⋙ G).op with F.op ⋙ G.op, (𝟭 C).op with 𝟭 Cᵒᵖ, or (F ⋙ G.op).leftOp with F.leftOp ⋙ G by unfolding Functor.op, and states the units and counits of Adjunction.op, unop, leftOp and rightOp componentwise rather than as NatTrans.op/NatTrans.unop at a type that only matches after unfolding. The unit and counit of opOpEquivalence are likewise built from components. The affected declarations are opShiftFunctorEquivalence, SimplicialObject.opFunctorCompOpFunctorIso and Limits.exists_eq_isColimitMap_of_preservesColimit_coyoneda.

It is extracted from Paul Reichert's experiment making Functor.comp and Functor.id instance_reducible (master...leanprover-community:mathlib4-nightly-testing:datokrat/functorcomp, discussed at https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/backward.2EisDefEq.2ErespectTransparency), keeping only the Functor.op fixes; the associator and unitor fixes are in #43566.

🤖 Prepared with Claude Code

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

PR summary 312f6cf987

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ leftOpCompOp

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 312f6cf).

  • +11 new declarations
  • −8 removed declarations
-CategoryTheory.Adjunction.leftOp_counit
+CategoryTheory.Adjunction.leftOp_counit_app
-CategoryTheory.Adjunction.leftOp_unit
+CategoryTheory.Adjunction.leftOp_unit_app
-CategoryTheory.Adjunction.op_counit
+CategoryTheory.Adjunction.op_counit_app
-CategoryTheory.Adjunction.op_unit
+CategoryTheory.Adjunction.op_unit_app
-CategoryTheory.Adjunction.rightOp_counit
+CategoryTheory.Adjunction.rightOp_counit_app
-CategoryTheory.Adjunction.rightOp_unit
+CategoryTheory.Adjunction.rightOp_unit_app
-CategoryTheory.Adjunction.unop_counit
+CategoryTheory.Adjunction.unop_counit_app
-CategoryTheory.Adjunction.unop_unit
+CategoryTheory.Adjunction.unop_unit_app
+CategoryTheory.Functor.leftOpCompOp
+CategoryTheory.Functor.leftOpCompOp_hom_app
+CategoryTheory.Functor.leftOpCompOp_inv_app

Increase in strong tech debt: (relative, absolute) = (0.79, 0.00)
Current number Change Type (strong)
backward.defeqAttrib.useBackward 4245 -1
erw 497 1
No changes to weak technical debt.

Current commit 312f6cf987
Reference commit 572e4d091b

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).

…morphisms

Use Functor.opId, Functor.opComp and the new Functor.leftOpCompOp where the
opposite of a composition or identity was identified with the composition of
opposites by unfolding, and state the units and counits of Adjunction.op,
unop, leftOp and rightOp componentwise.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant