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

Define profunctors and representability of profunctors in 2 ways #945

Merged
merged 5 commits into from
Nov 18, 2022

Conversation

maxsnew
Copy link
Collaborator

@maxsnew maxsnew commented Oct 23, 2022

This defines profunctors and what it means for a functor to represent a profunctor. It gives two definitions, analogous to definitions of adjunctions by hom-iso and universal morphism: Representable defines it as a functor with a hom isomorphism Hom[ F , Id ] =~ R and Representable' defines it as a function on objects F_0 with a universal morphism and induction principle (very similar to a presentation of a positive type by constructors, induction principle and beta-eta). I provided mappings between these two notions but haven't proven that it's an equivalence yet because I wasn't quite sure how to do it. My hope is that this profunctor approach can be used to flesh out the category theory part of the library, as the simplest proofs of many theorems like RAPL are structured as isomorphisms of profunctors.

This is my first time contributing to the cubical library so I'm not sure I structured it in an idiomatic way. Advice on this would be appreciated.

Related discussion in #873.

@felixwellen
Copy link
Collaborator

Hi Max!
We have the (rarely followed) convention, to explain what happens in a file at the beginning of the file. I think it would make sense to add your description of this PR directly as a comment, since it is certainly about concept not everyone is familiar with. Here is an example of such a comment:

https://github.com/agda/cubical/blob/master/Cubical/Foundations/Equiv/PathSplit.agda

You might want to check out the hints about whitespaces here:

https://github.com/agda/cubical/blob/master/CONTRIBUTING.md

Maybe you already found this file:

https://github.com/agda/cubical/blob/master/Cubical/Algebra/NAMING.md

On a first glance, your code looks like you are already aware of this - I'm not too familiar with the category theory part of the library and will wait a bit to give @mortberg a chance to look at your PR in more detail.

@plt-amy
Copy link
Member

plt-amy commented Oct 25, 2022

(FWIW, PRs from new contributors need approval for every commit. I've approved this latest one)

@felixwellen felixwellen self-assigned this Nov 3, 2022
Copy link
Collaborator

@felixwellen felixwellen left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!
Looks good to me - I only have some comments/suggestions on formatting and things like that.
There is one additional issue: In the case of putting something into a folder, like Categories/Profunctor/Base.agda, we always have a Categories/Profunctor.agda, which just imports the defaults (Profunctor/Base in this case) publicly. Please add a file like that (there should be lots of examples).

Cubical/Categories/Profunctor/Base.agda Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Outdated Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Outdated Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Outdated Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Outdated Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Outdated Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Outdated Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Outdated Show resolved Hide resolved
Cubical/Categories/Profunctor/Base.agda Outdated Show resolved Hide resolved
1. Line breaks added, though some lines are still 100+
2. Equational reasoning proofs aligned
3. Re-written description of the choice of universe levels
4. Use an anonymous module
5. Some slightly different module opening to reduce number of projections
6. Comment on our convention for profunctors
@maxsnew
Copy link
Collaborator Author

maxsnew commented Nov 17, 2022

Ok I updated it with the notation I mentioned and added the Profunctor.agda file. Let me know if there's anything else

@felixwellen
Copy link
Collaborator

No - looks all good to me! -> Merging...

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.

None yet

3 participants