-
Notifications
You must be signed in to change notification settings - Fork 132
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
Functor Comprehension #1106
Functor Comprehension #1106
Conversation
Originially we had comprehension under I'm torn on this though. After all we are constructing a functor, even if the implementation makes use of profunctors |
b1c1dbe
to
bdd1a05
Compare
module _ (C : Category ℓC ℓC') (D : Category ℓD ℓD') where | ||
open Category | ||
open Categoryᴰ | ||
weaken : Categoryᴰ C ℓD ℓD' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this name too similar to weakenᴰ
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this not be factorized as "display over *", then weaken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If by weaken you mean "reindex" then unfortunately no as that leads to too many transports that don't reduce
@@ -0,0 +1,131 @@ | |||
{-# OPTIONS --safe #-} | |||
-- | |||
module Cubical.Categories.Displayed.DisplayOverProjections where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any good ideas for naming this module.
I had this in Displayed.Base
but it got too bloated. A rough first naming was DisplayOverProjections
because we turn a display over C ×C D
into a display over C
or D
, but I don't think this is a good module name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe more principled naming for the terms here, instead of things like mk∫ᴰsrFunctorᴰ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My (biased) opinion would be to sacrifice a bit of usability for generality instead, and define the "left adjoint" of reindexation along any functor (the dependent sum if you will), and apply this to the projection. The usual ∫Cᴰ
is an example of this for the terminal functor as well.
I would understand if this is a bit too annoying to add for now, but this feels way too specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! We'll try it out
(F : Functor D C) | ||
(Fᴰ : Functorᴰ F (Unitᴰ D) Cᴰ) | ||
where | ||
mk∫Functor : Functor D (∫C Cᴰ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the above comment, maybe a more descriptive naming scheme should be used for all of these mk<X>
constructions? I have no current ideas, but they should all be consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a specific case of the left adjointness of "existential quantification" in Cat, but specialized to Unitᴰ
, so part of the UP for ∫
. Somehow this seems ok because of that, although maybe the more general version could inherit that name as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were discussing maybe to call all of these principles intro
as they are the dual of elim
.
→ Cᴰ.Hom[ f ][ xᴰ , yᴰ ] | ||
→ Qᴰ.Hom[ F .F-hom f ][ F-obᴰ xᴰ , F-obᴰ yᴰ ]) where | ||
|
||
mkP→CᴰFunctorᴰ : Functorᴰ F Cᴰ (Preorderᴰ→Catᴰ Qᴰ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same principle as detailed in HLevel
, one of them has to go.
module Cᴰ = Categoryᴰ Cᴰ | ||
module Dᴰ = Categoryᴰ Dᴰ | ||
|
||
mkFunctorᴰPropHoms : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming?
mkFunctorᴰPropHoms propHoms F-obᴰ F-homᴰ .Functorᴰ.F-seqᴰ _ _ = | ||
isProp→PathP (λ i → propHoms _ _ _) _ _ | ||
|
||
mkFunctorᴰContrHoms : (contrHoms : hasContrHoms Dᴰ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming?
(Gᴰ : Functorᴰ (∫F Fᴰ) (Unitᴰ (∫C Eᴰ)) Dᴰ) | ||
where | ||
|
||
mk∫ᴰFunctorᴰ : Functorᴰ F Eᴰ (∫Cᴰ Cᴰ Dᴰ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming?
|
||
open Functorᴰ | ||
|
||
mk∫ᴰsrFunctorᴰ : Functorᴰ F Eᴰ ∫Cᴰsr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming?
|
||
-- s for "simple" because D is not dependent on C | ||
-- r for "right" because D is on the right of the product | ||
∫Cᴰsr : Categoryᴰ C (ℓ-max ℓD ℓCᴰ) (ℓ-max ℓD' ℓCᴰ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming?
@@ -24,6 +24,69 @@ record WeakInverse {C : Category ℓC ℓC'} {D : Category ℓD ℓD'} | |||
η : 𝟙⟨ C ⟩ ≅ᶜ invFunc ∘F func | |||
ε : func ∘F invFunc ≅ᶜ 𝟙⟨ D ⟩ | |||
|
|||
-- Composition of weak inverses is a weak inverse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsure if here or Properties
is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without looking at it: We usually do not split up things enough in the library, so most of the time the good idea is to have more files. So it might also sense to have something on 'composition' or 'weak equivalences'.
I have no opinion on the names so far. |
@felixwellen For splitting up the PR, would you prefer something like rebased commits by topics all in a single PR or distinct PRs? We have written a big web of mess building up to this comprehension construction, but I think these can be decoupled roughly into
|
If it is easy for you to split it into multiple PRs by topic, that would be great. |
open Functor | ||
open NatTrans | ||
|
||
record Bifunctor (C : Category ℓc ℓc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition is subsumed by BifunctorSep
in Bifunctor.Redundant
. I don't think we need this file at all, and we should just include Bifunctor.Redundant
as Bifunctor.Base
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall seems okay to me, but it's hard to see at what level of generality the new categorical additions should be done. I'm wondering though, isn't the ff.ness of Yoneda enough for all this?
open NatTrans | ||
|
||
-- This definition is the most convenient to use | ||
-- But its axioms are redundant as well as its |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this comment cut short?
2. and that they agree | ||
|
||
The full definition includes some redundant *axioms* to make it | ||
convenient to use, so we include two alternative formulations to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly makes it more convenient than the usual definition? I'm not criticizing the choice of definition here but I'm curious wrt. what works better here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The convenience here relates to better definitional equality.
The quick sell is that we would like to act functorially only on one side of C ×C D
without additional identities tossed in the resulting term. If you had some F : Functor (C ×C D) E
, in regular math F
would reduce to a functorial action on f : C [ c , c' ]
via F .F-hom (f , D .id)
, but this introduces a composition with an unnecessary identity. So we build these redundant axioms to give a native action that isn't over some D .⋆IdR
/D .⋆IdL
path.
I'm eliding a fair bit of detail here, but this definitional behavior is crucial for the comprehension construction.
Like we discussed, this PR will be split out into a few separate ones by topic and one of them will just be these bifunctor/binproduct definitions and some motivating examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm eliding a fair bit of detail here, but this definitional behavior is crucial for the comprehension construction.
Specifically, it's crucial for making certain compositional constructions spit out the "right" definitions. The main example where it came up for us was when we defined the exponential a -> -
as a right adjoint to a x -
, the universal property for exponentials involved an annoying id
because we were fixing the product functor on one side. We'll be sure to include more info about this in comments when we make the non-draft PR
-- A version of bifunctor that only requires the parallel action and | ||
-- constructs the joint acions using id. This is definitionally | ||
-- isomorphic to a functor out of the ordinary cartesian product of C | ||
-- and D. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason you'd rather use this than Functor (C ×C D) E
in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This move probably shouldn't be in this commit.
(isUnivC : isUnivalent C) (F : Functor C (SET ℓS)) where | ||
open Covariant {C = C} | ||
open isUnivalent | ||
isUnivalent∫ : isUnivalent (∫ F) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be in a separate commit/PR. Nice to see this proof, I remember wanting it but never got around to writing it down.
variable | ||
ℓC ℓC' ℓCᴰ ℓCᴰ' ℓD ℓD' ℓDᴰ ℓDᴰ' : Level | ||
|
||
record Preorderᴰ (C : Category ℓC ℓC') ℓCᴰ ℓCᴰ' : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit torn on this, I think it would be more maintainable to simply use the hasPropHoms
predicate instead of having another structure on which the same operations are defined (eg. reindex
lower in this file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, sort of. You shouldn't be passing around Preorderᴰ
structures, you should use Categoryᴰ
with hasPropHoms
, but if you want to define a Categoryᴰ
that hasPropHoms
, you define a Preorderᴰ
and then use Preorderᴰ→Catᴰ
. So think of this as analogous to FullSubcategory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with that in mind, I think Monotoneᴰ
and reindex
should be removed
→ Cᴰ.Hom[ f ][ xᴰ , yᴰ ] | ||
→ Qᴰ.Hom[ F .F-hom f ][ F-obᴰ xᴰ , F-obᴰ yᴰ ]) where | ||
|
||
mkP→CᴰFunctorᴰ : Functorᴰ F Cᴰ (Preorderᴰ→Catᴰ Qᴰ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same principle as detailed in HLevel
, one of them has to go.
|
||
-- Preimage for the ESO proof | ||
-- i.e. an object in (FUNCTOR Γ (FUNCTOR C D)) that maps to λF | ||
curryF-ESO-object-preimage : (FUNCTOR Γ (FUNCTOR C D)) .ob → |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe naming it uncurryF-ob
would be clearer?
D .id | ||
∎ ) | ||
-- Half of the isomorphism between (curryF-ESO-object-preimage λF) and λF | ||
curryF-ESO-morphism-preimage : (λF : (FUNCTOR Γ (FUNCTOR C D)) .ob) → |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncurryF-curryF→id-ob
or something like this?
-- | whereas the category of presheaves as defined currently in the | ||
-- | library only gives the "separate" functorial action. In practice, | ||
-- | relators tend to only come with a separate action anyway (e.g., | ||
-- | Hom) but in principle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commentary is cut short.
Adding a module called
Comprehension
, and associated dependencies, that provides a method for constructing functors without providing the full functorial structure up front.That is, say you wish to define a functor
F : C → D
via some universal propertyP
. Instead of manually constructing the action on objects, morphisms, and proving functoriality, one can instead just give an action on objects and prove the functoriality of the propertyP
.This is a pretty big PR. I have tried to integrate most of our changes into the appropriate spots so far, and I'll be marking it as a draft until I address these
More
Comprehension.agda
back under theProfunctor
directory.