Skip to content

[Merged by Bors] - feat(CategoryTheory): the internal hom with the monoidal unit is the identity - #17065

Closed
emilyriehl wants to merge 7 commits into
masterfrom
closedUnit
Closed

emilyriehl wants to merge 7 commits into
masterfrom
closedUnit

Conversation

@emilyriehl

@emilyriehl emilyriehl commented Sep 23, 2024 •

Copy link
Copy Markdown
Collaborator

In a closed monoidal category, the internal hom defined by mapping out of the monoidal unit is naturally isomorphic to the identity. This specializes to an analogous result about exponentiating with the terminal object in a cartesian closed category.

Co-authored-by: Dagur Asgeirsson


UPDATE: The questions raised here have been answered in the comments below. This is now ready for review.

There are two things I don't understand about this code.

(1) Why must MonoidalClosed.unitNatIso be marked uncomputable?
(2) Which of expTerminalNatIso or expTerminalNatIso' is better?

For (2), I'd assumed it would be more useful not to have to supply a proof that the terminal object is exponentiable. But when I gave an explicit proof in (1) I wasn't able to extract the component used to prove expTerminalIsoSelf, which existed already in the form that it's currently stated in.

-->

Open in Gitpod

@emilyriehl
emilyriehl marked this pull request as draft September 23, 2024 21:07
@github-actions

github-actions Bot commented Sep 23, 2024 •

Copy link
Copy Markdown

PR summary 343350d6bf

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ expTerminalNatIso
+ unitNatIso

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.

@emilyriehl

Copy link
Copy Markdown
Collaborator Author

@dagurtomas and @adamtopaz this is the issue we discussed. I left this as a draft because of the questions (1) and (2) above.

@emilyriehl emilyriehl changed the title the internal hom with the monoidal unit is the identity feat(CategoryTheory): the internal hom with the monoidal unit is the identity Sep 23, 2024
@dagurtomas

dagurtomas commented Sep 23, 2024 •

Copy link
Copy Markdown
Contributor

For (1), it's because it uses conjugateIsoEquiv, which is noncomputable because it uses asIso which produces an isomorphism (containing the data of an inverse) just by knowing that a morphism has an inverse.

For (2), I would supply MonoidalClosed.unitNatIso with an arbitrary instance variable [Closed (𝟙_ C)] instead (which will be automatically inferred whenever your in a monoidal closed category anyway) instead of using the explicit unitClosed. Then do the same with Exponentiable in the cartesian one. See this branch (you can just merge that branch into this one if you'd like)

@dagurtomas

Copy link
Copy Markdown
Contributor

Regarding computability, note that CategoryTheory.Adjunction.natIsoEquiv is computable, so conjuagateIsoEquiv shouldn't need to be noncomputable.

These two APIs should really be merged at some point, see the TODO in the file Adjunction.Unique. I wrote that part of the uniqueness file without knowing I was duplicating API, then when I discovered it it turned out to be nontrivial to deduplicate

@emilyriehl

Copy link
Copy Markdown
Collaborator Author

Thanks @dagurtomas. I would like to merge your branch with this one. How do I do this?

@emilyriehl

Copy link
Copy Markdown
Collaborator Author

Thanks also for pointing out the issue with the way I defined natIsoEquiv. When I get a moment (sometime this week) I'll go back into mates and do that part of the TODO from the Adjunction.Unique file.

@dagurtomas

dagurtomas commented Sep 24, 2024 •

Copy link
Copy Markdown
Contributor

I would like to merge your branch with this one. How do I do this?

git checkout closedUnit 
git merge dagur/closedUnit

@b-mehta

b-mehta commented Sep 24, 2024 •

Copy link
Copy Markdown
Contributor

The idea of having [Exponentiable (⊤_ C)] as an argument rather than having it be inferred is, approximately, to ensure that the proof works given any proof that 1 is exponentiable. If this argument weren't given directly, then the proof would be for a particular choice of the exponential of 1. Of course any choice is naturally isomorphic to any other, but it's convenient to not need to add this isomorphism where necessary. Admittedly my docstring "The typeclass argument is explicit: any instance can be used." isn't particularly clear about this, although hopefully "any instance can be used" makes a little more sense now.
Thus I agree with Dagur's comments about (2). And as he says, since the argument is given in [] brackets, it's automatically inferred in any application anyway.

@emilyriehl

emilyriehl commented Sep 24, 2024 •

Copy link
Copy Markdown
Collaborator Author

I would like to merge your branch with this one. How do I do this?

git checkout closedUnit 
git merge dagur/closedUnit

This returns the error merge: dagur/closedUnit - not something we can merge. I'm working from the command line on my computer in case this is relevant. I tried also running git fetch first but that didn't help.

But no need to reply. I just manually recreated your suggestions.

@emilyriehl
emilyriehl marked this pull request as ready for review September 24, 2024 18:27
@emilyriehl

Copy link
Copy Markdown
Collaborator Author

The idea of having [Exponentiable (⊤_ C)] as an argument rather than having it be inferred is, approximately, to ensure that the proof works given any proof that 1 is exponentiable. If this argument weren't given directly, then the proof would be for a particular choice of the exponential of 1. Of course any choice is naturally isomorphic to any other, but it's convenient to not need to add this isomorphism where necessary. Admittedly my docstring "The typeclass argument is explicit: any instance can be used." isn't particularly clear about this, although hopefully "any instance can be used" makes a little more sense now. Thus I agree with Dagur's comments about (2). And as he says, since the argument is given in [] brackets, it's automatically inferred in any application anyway.

Thanks for the explanation. I guess I hadn't quite figured out how to interpret typeclass arguments. I guess the idea is that even though we might specify a particular instance of [Exponentiable (⊤_ C)] some other term might be used somewhere else?

By the way, does Lean allow you to label two distinct terms of a given type as instances?

@dagurtomas

Copy link
Copy Markdown
Contributor

Thanks!

maintainer merge

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by dagurtomas.

@github-actions github-actions Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Sep 24, 2024
@dagurtomas

dagurtomas commented Sep 24, 2024 •

Copy link
Copy Markdown
Contributor

Regarding merging branches, I guess my suggestion requires you to have a local copy of my branch. So for future reference, I think it would have worked after running git fetch and git checkout dagur/closedUnit or something like that

@jcommelin jcommelin added awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Sep 25, 2024
@dagurtomas dagurtomas added t-category-theory Category theory and removed awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. labels Sep 25, 2024
@dagurtomas

Copy link
Copy Markdown
Contributor

maintainer merge

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by dagurtomas.

@github-actions github-actions Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Sep 25, 2024
@kim-em

kim-em commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

bors merge

@github-actions github-actions Bot added the ready-to-merge This PR has been sent to bors. label Sep 26, 2024
mathlib-bors Bot pushed a commit that referenced this pull request Sep 26, 2024
…identity (#17065)

In a closed monoidal category, the internal hom defined by mapping out of the monoidal unit is naturally isomorphic to the identity. This specializes to an analogous result about exponentiating with the terminal object in a cartesian closed category.

Co-authored-by: [Dagur Asgeirsson](https://github.com/dagurtomas)
@mathlib-bors

mathlib-bors Bot commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat(CategoryTheory): the internal hom with the monoidal unit is the identity [Merged by Bors] - feat(CategoryTheory): the internal hom with the monoidal unit is the identity Sep 26, 2024
@mathlib-bors mathlib-bors Bot closed this Sep 26, 2024
@mathlib-bors
mathlib-bors Bot deleted the closedUnit branch September 26, 2024 01:13
@b-mehta

b-mehta commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

Thanks for the explanation. I guess I hadn't quite figured out how to interpret typeclass arguments. I guess the idea is that even though we might specify a particular instance of [Exponentiable (⊤_ C)] some other term might be used somewhere else?

Yeah essentially - we can give an instance of Exponentiable (⊤_ C) directly, but it could also be the case that we have that the category is cartesian closed (eg because it's equivalent to another cartesian closed one), which gives a different Exponentiable (⊤_ C) instance. And the point of writing the proof like this is that it works regardless of which of the above are used as the construction.

By the way, does Lean allow you to label two distinct terms of a given type as instances?

Yes. In this example, we could have two different constructions of the right adjoint, which are not equal on the nose. It's usually not a good idea to do this, but it's possible.

fbarroero pushed a commit that referenced this pull request Oct 2, 2024
…identity (#17065)

In a closed monoidal category, the internal hom defined by mapping out of the monoidal unit is naturally isomorphic to the identity. This specializes to an analogous result about exponentiating with the terminal object in a cartesian closed category.

Co-authored-by: [Dagur Asgeirsson](https://github.com/dagurtomas)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. 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.

5 participants