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

Basic definitions and constructions for enriched category theory #1453

Merged

Conversation

umedaikiti
Copy link
Contributor

I added the following.

  • enriched natural transformation
  • unit enriched category
  • change-of-base construction
  • opposite construction

@benediktahrens benediktahrens marked this pull request as ready for review February 11, 2022 10:15
@benediktahrens
Copy link
Member

I have converted this PR from "draft" to "ready for review", so that I and others are able to comment.

Comment on lines 19 to 27
use make_enriched_precat.
- use make_enriched_precat_data.
+ exact A.
+ intros x y.
exact (F (enriched_cat_mor x y)).
+ intro x.
exact (lax_monoidal_functor_ϵ F · #F (enriched_cat_id _)).
+ intros x y z.
exact (lax_monoidal_functor_μ F (_, _) · #F (enriched_cat_comp _ y _)).
Copy link
Member

Choose a reason for hiding this comment

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

This part of the construction should be split out into a separate definition. The proof of the axioms can then be made opaque using Qed. instead of Defined..

Comment on lines 87 to 90
- use make_enriched_functor_data.
+ exact G.
+ intros x y.
exact (#F (enriched_functor_on_morphisms G _ _)).
Copy link
Member

Choose a reason for hiding this comment

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

This part of the construction should be split out into a separate definition. The proof of the axioms can then be made opaque using Qed. instead of Defined..

Comment on lines 161 to 167
- intros x y.
cbn.
rewrite <- lax_monoidal_functor_on_postcompose_underlying_morphism.
rewrite <- lax_monoidal_functor_on_precompose_underlying_morphism.
rewrite <- !(functor_comp F).
apply maponpaths.
apply enriched_nat_trans_ax.
Copy link
Member

Choose a reason for hiding this comment

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

The proof of naturality should probably be made opaque, using abstract(...).

Comment on lines 613 to 622
- intros x y.
rewrite postcompose_underlying_morphism_composite.
rewrite assoc.
rewrite enriched_nat_trans_ax.
rewrite assoc'.
rewrite pre_post_compose_commute.
rewrite assoc.
rewrite enriched_nat_trans_ax.
rewrite precompose_underlying_morphism_composite.
apply assoc'.
Copy link
Member

Choose a reason for hiding this comment

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

It will be useful to make this part of the construction opaque.

@nmvdw
Copy link
Collaborator

nmvdw commented Feb 11, 2022

A suggestion (relating to Benedikt's comments): to make these changes easier, the definition enriched_precat (https://github.com/UniMath/UniMath/blob/master/UniMath/CategoryTheory/Enriched/Enriched.v#L119) can be improved. A definition enriched_precat_laws (which is just (enriched_id_ax d) × (enriched_assoc_ax d).) can be added, and then for each enriched precategory, you can then just add a separate statement (which is just laws) can be proven and ended with Qed. The same idea can be used for functors.

apply assoc.
Defined.

Definition enriched_functor_category (A B : enriched_precat) : category.
Copy link
Member

Choose a reason for hiding this comment

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

It will be useful to make part of the construction opaque.

Let tensor : Mon_V ⊠ Mon_V ⟶ Mon_V := monoidal_cat_tensor Mon_V.
Let α : associator tensor := monoidal_cat_associator Mon_V.
Let l_unitor : left_unitor tensor I := monoidal_cat_left_unitor Mon_V.
Let r_unitor : right_unitor tensor I := monoidal_cat_right_unitor Mon_V.
Copy link
Member

Choose a reason for hiding this comment

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

I think there should be a global discussion about the respective advantages of "Local Definition" and "Let". What is the reason for the change in this place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I intended to use these names as aliases that are not visible outside the section at all. However, I found that the name of Local Definition tensor is visible as MonoidalCategories.tensor when we use a lemma like tensor_comp_left. I think that there should not be names like MonoidalCategories.tensor because these are just accessor functions applied to Mon_V.

@rmatthes
Copy link
Member

I have been asked by @benediktahrens to provide a review for this PR. My feeling is that this changes the status of the development of enriched category theory in UniMath (which I welcome in principle), which therefore also requires a more rigorous review of the already existing code. Anyway, coqwc presently (before merging this PR) only sees 120 lines of definitions and 37 lines of proofs in the whole Enriched directory. And to the best of my knowledge, these definitions are not used elsewhere in UniMath. In particular, there is no validation of this code against the rest of UniMath, such as verifying that enriched categories are indeed a generalization of ordinary categories (in which sense will this hold in the UniMath library and not only mathematically?). It does not seem right either that composition is not given in diagrammatic order, which is the standard in UniMath. Previous to the PR, there were only three declared coercions. This is probably not enough (there are maybe too many pr1 already in that code, and this could become much worse when working with the definitions in application scenarios). The code is not so beautiful either: there are still dirprod and tpair in definitions, and axioms are stated with placeholders _.

The PR proposes more coercions and many more lines of verification, but still no validation w.r.t to the UniMath environment. I think that the problems at the base should be addressed at the same time and not later when there is much more code to "tame".

@DanGrayson
Copy link
Member

Is our composition operator in categories backwards? If so, I forgot.

By the way, the phrase "diagrammatic order" is ambiguous, because diagrams can also be drawn with leftward pointing arrows.

@rmatthes
Copy link
Member

I cite from Categories.v:
Definition precategory_id_comp (C : precategory_ob_mor) : UU := (∏ c : C, c --> c) (* identities *) × (∏ a b c : C, a --> b -> b --> c -> a --> c). (* composition *)
Vertical composition in bicategories follows the same pattern.

By the way, it could be worth defining enrichment over bicategories instead of the special case of over monoidal categories.

@benediktahrens
Copy link
Member

@rmatthes : Thanks a lot for forming and sharing thoughts about this PR and the state of enriched categories in UniMath.

  • I agree that the existing code needs to be improved to become usable at scale.
  • I also agree that a validation (in the form of an equivalence of types between categories and categories enriched over set?) would be important for the sake of completeness. (I don't see any obstacle to constructing such an equivalence, it just needs to be done.)

@umedaikiti : in case you are interested in working on enriched categories in UniMath, and in case you are willing to spend a little bit of effort on getting the basic definitions into shape, I am very happy to help. I have already given feedback to your code - in case you have questions or comments, please let me know!

@umedaikiti
Copy link
Contributor Author

Thanks for the reviews. Yes, I am happy to work on the improvement.

  • I agree that the code should be more beautiful.
  • The equivalence between ordinary categories and Set-enriched categories would be easily proved if we have the cartesian monoidal category of sets. I know that the category of set is defined under UniMath/CategoryTheory/categories/HSET/ together with the terminal object and binary products, but it seems that the cartesian monoidal category is not defined. I believe that the (theoretically) best way is to define the general cartesian monoidal category and then instantiate it to HSET. Unfortunately the general cartesian monoidal category Monoidal structure on cartesian categories #1031 is left unmerged. I don't know yet how much work is needed to fix Monoidal structure on cartesian categories #1031, but I will try to take a look.
  • I prefer the current order of composition rather than the diagrammatic order because the standard order in the enriched category theory is the current one and reversing it would be a little bit confusing especially when the monoidal category is not symmetric. For example, when we define left/right modules in the enriched category theory (see e.g. https://doi.org/10.1016/j.aim.2015.11.012), "left" and "right" must be reversed if we reverse the composition order. I think that this leads to inconsistent terminology between UniMath and the standard mathematics.

umedaikiti and others added 2 commits February 12, 2022 12:13
Defined -> Qed

Co-authored-by: Benedikt Ahrens <benedikt.ahrens@gmail.com>
@rmatthes
Copy link
Member

I only comment on the last point about the order of composition. I did not find it easy to read the UniMath library with the compositions turned around. I had to accept this decision by those who created the library. But the library does not deviate from standard mathematical notions. Even if left and right whiskering are rather called pre_whisker and post_whisker, respectively (which is even more suggestive as notation), they properly map to lwhisker and rwhisker in the notion of bicategories. Regardless of composition order or other notational/presentational devices, no one would exchange the notions of left and right adjoint either. In the development of monads, there is the file LModules.v with left modules for monads. They also properly correspond to the left modules as published by Hirschowitz and Maggesi. However, the development makes use of a legacy notation □ (I show one line from the output of git grep □):
UniMath/CategoryTheory/Core/Functors.v:Notation "G □ F" := (functor_composite F G) (at level 35, only parsing) : cat.
So, on the level of notation, the order of composition is again turned around (with respect to the standard UniMath notation for functor composition: Notation "F ∙ G" := (functor_composite F G) : cat. whose symbol looks different in Emacs from here.

The grep output is not vast at all and also shows uses of □ for different purposes. So, it should at least be very easy to remove this identified (legacy) inconsistency in notation. And no new one should enter, and as I argued before, the "lonesome" file Enriched.v was not considered a problem, but when making more out of it, the usual standards should apply.

@benediktahrens
Copy link
Member

@umedaikiti : Thanks a lot for implementing the suggestions!

For me, this PR represents a definite improvement, even though it does not yet fix all the problems identified by @rmatthes. Hence, I am very happy to merge this PR if @umedaikiti agrees - recall that this PR was marked as "draft" by @umedaikiti, and I only marked it as "ready for review" to be able to comment on it.

@umedaikiti
Copy link
Contributor Author

I have no objection to merging this PR. I will probably prove the equivalence between ordinary and Set-enriched categories later, but this can be discussed as a separate issue or PR.

@benediktahrens benediktahrens merged commit 6679488 into UniMath:master Feb 13, 2022
@benediktahrens
Copy link
Member

Thanks a lot for your contribution to UniMath!

@umedaikiti umedaikiti deleted the basic-enriched-category-theory branch February 14, 2022 03:10
Skantz pushed a commit to Skantz/UniMath that referenced this pull request Nov 12, 2022
…ry-theory

Basic definitions and constructions for enriched category theory
Skantz pushed a commit to Skantz/UniMath that referenced this pull request Nov 12, 2022
…ry-theory

Basic definitions and constructions for enriched category theory
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.

5 participants