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] - feat(category_theory/monad/kleisli): add Kleisli category of a monad #4542

Closed
wants to merge 4 commits into from

Conversation

b-mehta
Copy link
Collaborator

@b-mehta b-mehta commented Oct 8, 2020

Adds the Kleisli category of a monad, and shows the Kleisli category for a lawful control monad is equivalent to the Kleisli category of its category-theoretic version.

Following discussion at https://leanprover.zulipchat.com/#narrow/stream/116395-maths/topic/kleisli.20vs.20kleisli.

I'd appreciate suggestions for names more sensible than the ones already there.


Coauthored by @Vtec234

@b-mehta b-mehta added awaiting-review The author would like community review of the PR needs-documentation This PR is missing required documentation labels Oct 8, 2020
@b-mehta b-mehta removed the needs-documentation This PR is missing required documentation label Oct 11, 2020
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

LGTM

@semorrison Would you please also take a look?

src/category_theory/monad/types.lean Show resolved Hide resolved
src/category_theory/monad/types.lean Outdated Show resolved Hide resolved
@jcommelin jcommelin added the awaiting-author A reviewer has asked the author a question or requested changes label Oct 13, 2020
@b-mehta b-mehta removed the awaiting-author A reviewer has asked the author a question or requested changes label Oct 13, 2020
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Sorry, I've been quite busy. I should have given these name suggestions earlier.
If you fix them, feel free to merge afterwards.

bors d+

namespace adjunction

/-- The left adjoint of the adjunction which induces the monad `T`. -/
@[simps] def F_T : C ⥤ kleisli T :=
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@[simps] def F_T : C ⥤ kleisli T :=
@[simps] def to_kleisli : C ⥤ kleisli T :=

Copy link
Member

Choose a reason for hiding this comment

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

alternatively maybe free?

Copy link
Member

Choose a reason for hiding this comment

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

alternatively, maybe free?

end }

/-- The right adjoint of the adjunction which induces the monad `T`. -/
@[simps] def U_T : kleisli T ⥤ C :=
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@[simps] def U_T : kleisli T ⥤ C :=
@[simps] def from_kleisli : kleisli T ⥤ C :=

Copy link
Member

Choose a reason for hiding this comment

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

and here underlying or forget?

@bors
Copy link

bors bot commented Oct 15, 2020

✌️ b-mehta can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

begin
unfold_projs,
ext,
dsimp,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this dsimp can be removed.

@adamtopaz
Copy link
Collaborator

I also think using the names free / forget would be a better choice. E.g. this would provide consistency with the names for the Eilenberg-Moore category of a monad.

@b-mehta
Copy link
Collaborator Author

b-mehta commented Oct 15, 2020

I don't like the free/forget choice here, since the Kleisli category isn't really adding structure like the EM category, and the forgetful functor is actually applying a function on objects - in particular I think the consistency is misleading rather than helpful. I'll use to_kleisli and from_kleisli instead.

@adamtopaz
Copy link
Collaborator

I don't like the free/forget choice here, since the Kleisli category isn't really adding structure like the EM category, and the forgetful functor is actually applying a function on objects - in particular I think the consistency is misleading rather than helpful. I'll use to_kleisli and from_kleisli instead.

I should say that I don't really have any strong opinions regarding the names. I just tend to think of the Kleisli category as related to the free objects in the Eilenberg-Moore category (via the comparison functor).

@semorrison semorrison added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Oct 15, 2020
@semorrison
Copy link
Collaborator

Yes, modulo the renaming, LGTM.

@b-mehta
Copy link
Collaborator Author

b-mehta commented Oct 16, 2020

Thanks for the suggestions all!

@b-mehta b-mehta closed this Oct 16, 2020
@b-mehta
Copy link
Collaborator Author

b-mehta commented Oct 16, 2020

bors r+

@bors
Copy link

bors bot commented Oct 16, 2020

Already running a review

@b-mehta b-mehta reopened this Oct 16, 2020
@bryangingechen
Copy link
Collaborator

Hmm, weird error message from bors. This wasn't on the queue yet, so:
bors r+

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Oct 16, 2020
bors bot pushed a commit that referenced this pull request Oct 16, 2020
…4542)

Adds the Kleisli category of a monad, and shows the Kleisli category for a lawful control monad is equivalent to the Kleisli category of its category-theoretic version.

Following discussion at https://leanprover.zulipchat.com/#narrow/stream/116395-maths/topic/kleisli.20vs.20kleisli.

I'd appreciate suggestions for names more sensible than the ones already there.
@b-mehta
Copy link
Collaborator Author

b-mehta commented Oct 16, 2020

Might be because I accidentally closed and reopened? Thanks for sorting it!

@bryangingechen
Copy link
Collaborator

No problem! Yeah, I would have expected bors to say something like "Cannot merge a closed PR" instead of "Already running a review"...

@bors
Copy link

bors bot commented Oct 16, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(category_theory/monad/kleisli): add Kleisli category of a monad [Merged by Bors] - feat(category_theory/monad/kleisli): add Kleisli category of a monad Oct 16, 2020
@bors bors bot closed this Oct 16, 2020
@bors bors bot deleted the kleisli branch October 16, 2020 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions. ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants