Skip to content

feat(CategoryTheory/Bicategory): a retract of an equivalence is an equivalence - #42589

Open
joelriou wants to merge 7 commits into
leanprover-community:masterfrom
joelriou:bicategory-retract
Open

feat(CategoryTheory/Bicategory): a retract of an equivalence is an equivalence#42589
joelriou wants to merge 7 commits into
leanprover-community:masterfrom
joelriou:bicategory-retract

Conversation

@joelriou

@joelriou joelriou commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Open in Gitpod

@joelriou joelriou added the t-category-theory Category theory label Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

PR summary d15e7d5b79

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.CategoryTheory.Bicategory.RetractArrow (new file) 457

Declarations diff (regex)

+ RetractArrow.toLoc
+ RetractArrow₁
+ comm'
+ equivalence
+ map
+ toAdjunction

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

  • +50 new declarations
  • −0 removed declarations
+CategoryTheory.Bicategory.Equivalence.toAdjunction
+CategoryTheory.Bicategory.Equivalence.toAdjunction_counit
+CategoryTheory.Bicategory.Equivalence.toAdjunction_unit
+CategoryTheory.Bicategory.RetractArrow₁
+CategoryTheory.Bicategory.RetractArrow₁.casesOn
+CategoryTheory.Bicategory.RetractArrow₁.comm
+CategoryTheory.Bicategory.RetractArrow₁.comm'
+CategoryTheory.Bicategory.RetractArrow₁.comm'_assoc
+CategoryTheory.Bicategory.RetractArrow₁.comm_assoc
+CategoryTheory.Bicategory.RetractArrow₁.commi
+CategoryTheory.Bicategory.RetractArrow₁.commr
+CategoryTheory.Bicategory.RetractArrow₁.ctorIdx
+CategoryTheory.Bicategory.RetractArrow₁.equivalence
+CategoryTheory.Bicategory.RetractArrow₁.equivalence_counit
+CategoryTheory.Bicategory.RetractArrow₁.equivalence_hom
+CategoryTheory.Bicategory.RetractArrow₁.equivalence_inv
+CategoryTheory.Bicategory.RetractArrow₁.equivalence_unit
+CategoryTheory.Bicategory.RetractArrow₁.id₁
+CategoryTheory.Bicategory.RetractArrow₁.id₂
+CategoryTheory.Bicategory.RetractArrow₁.i₁
+CategoryTheory.Bicategory.RetractArrow₁.i₂
+CategoryTheory.Bicategory.RetractArrow₁.map
+CategoryTheory.Bicategory.RetractArrow₁.map_commi
+CategoryTheory.Bicategory.RetractArrow₁.map_commr
+CategoryTheory.Bicategory.RetractArrow₁.map_id₁
+CategoryTheory.Bicategory.RetractArrow₁.map_id₂
+CategoryTheory.Bicategory.RetractArrow₁.map_i₁
+CategoryTheory.Bicategory.RetractArrow₁.map_i₂
+CategoryTheory.Bicategory.RetractArrow₁.map_r₁
+CategoryTheory.Bicategory.RetractArrow₁.map_r₂
+CategoryTheory.Bicategory.RetractArrow₁.mk
+CategoryTheory.Bicategory.RetractArrow₁.mk.inj
+CategoryTheory.Bicategory.RetractArrow₁.mk.injEq
+CategoryTheory.Bicategory.RetractArrow₁.mk.noConfusion
+CategoryTheory.Bicategory.RetractArrow₁.mk.sizeOf_spec
+CategoryTheory.Bicategory.RetractArrow₁.noConfusion
+CategoryTheory.Bicategory.RetractArrow₁.noConfusionType
+CategoryTheory.Bicategory.RetractArrow₁.rec
+CategoryTheory.Bicategory.RetractArrow₁.recOn
+CategoryTheory.Bicategory.RetractArrow₁.r₁
+CategoryTheory.Bicategory.RetractArrow₁.r₂
+CategoryTheory.RetractArrow.toLoc
+CategoryTheory.RetractArrow.toLoc_commi
+CategoryTheory.RetractArrow.toLoc_commr
+CategoryTheory.RetractArrow.toLoc_id₁
+CategoryTheory.RetractArrow.toLoc_id₂
+CategoryTheory.RetractArrow.toLoc_i₁
+CategoryTheory.RetractArrow.toLoc_i₂
+CategoryTheory.RetractArrow.toLoc_r₁
+CategoryTheory.RetractArrow.toLoc_r₂

No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
5051 1 exposed public sections

Current commit d15e7d5b79
Reference commit 239cf0d8f3

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.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 joelriou added the WIP Work in progress label Aug 9, 2026
@joelriou joelriou removed the WIP Work in progress label Aug 9, 2026
Comment thread Mathlib/CategoryTheory/Bicategory/RetractArrow.lean
Comment on lines +94 to +129
def equivalence {f' : X' ⟶ Y'} {f : Equivalence X Y} (r : RetractArrow₁ f' f.hom) :
Equivalence X' Y' where
hom := f'
inv := r.i₂ ≫ f.inv ≫ r.r₁
unit :=
r.id₁.symm ≪≫ _ ◁ᵢ (λ_ _).symm ≪≫ r.i₁ ◁ᵢ f.unit ▷ᵢ r.r₁ ≪≫
_ ◁ᵢ (α_ _ _ _) ≪≫ (α_ _ _ _).symm ≪≫ (r.commi.symm ▷ᵢ (f.inv ≫ r.r₁)) ≪≫ α_ _ _ _
counit :=
α_ _ _ _ ≪≫ _ ◁ᵢ (α_ _ _ _ ≪≫ _ ◁ᵢ r.commr.symm ≪≫ (α_ _ _ _).symm) ≪≫
r.i₂ ◁ᵢ f.counit ▷ᵢ r.r₂ ≪≫ _ ◁ᵢ λ_ _ ≪≫ r.id₂
left_triangle := by
ext : 1
calc
_ = r.id₁.inv ▷ f' ⊗≫ ((r.i₁ ◁ f.unit.hom ⊗≫ r.commi.inv ▷ f.inv) ▷ (r.r₁ ≫ f') ≫
((f' ≫ r.i₂) ≫ f.inv) ◁ r.commr.inv) ⊗≫
f' ◁ r.i₂ ◁ f.counit.hom ▷ r.r₂ ⊗≫ f' ◁ r.id₂.hom := by
simp only [leftZigzagIso_hom, Iso.trans_hom, Iso.symm_hom, whiskerLeftIso_hom,
whiskerRightIso_hom]
bicategory
_ = r.id₁.inv ▷ f' ⊗≫ r.i₁ ◁ r.commr.inv ⊗≫
(r.i₁ ◁ f.unit.hom) ▷ (f.hom ≫ r.r₂) ⊗≫
((r.commi.inv ▷ (f.inv ≫ f.hom) ≫ ((f' ≫ r.i₂) ◁ f.counit.hom)) ▷ r.r₂) ⊗≫
f' ◁ r.id₂.hom := by
rw [← whisker_exchange]
bicategory
_ = r.id₁.inv ▷ f' ⊗≫ r.i₁ ◁ r.commr.inv ⊗≫
r.i₁ ◁ (leftZigzag f.unit.hom f.counit.hom) ▷ r.r₂ ⊗≫
(r.commi.inv ▷ r.r₂) ⊗≫ f' ◁ r.id₂.hom := by
rw [← whisker_exchange]
bicategory
_ = r.id₁.inv ▷ f' ⊗≫ r.i₁ ◁ r.commr.inv ⊗≫
(r.commi.inv ▷ r.r₂) ⊗≫ f' ◁ r.id₂.hom := by
rw [f.left_triangle_hom]
bicategory
_ = _ := by
simp [bicategoricalComp, r.comm'_assoc]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn’t test if it works, but from what I see of the proof you only need unit.hom and counit.hom and their left triangle identity from the equivalence, which says that you should probably first define the structure for an Adjunction first (i.e construct f' ⊣ r.i₂ ≫ g ≫ r.r₁ from f ⊣ g) and then specialize the proof here to the adjunction induced between f and f.inv.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reviews! It seems it should work, apart from the fact that I now need to prove also the right triangle identity...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have tried, but I failed to prove the right triangle compatibility, so that I reverted to doing only the case of equivalences.

Comment thread Mathlib/CategoryTheory/Bicategory/RetractArrow.lean Outdated
@joelriou joelriou added the awaiting-author A reviewer has asked the author a question or requested changes. label Aug 9, 2026
@joelriou joelriou removed the awaiting-author A reviewer has asked the author a question or requested changes. label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-category-theory Category theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants