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

Displayed categories #382

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

Displayed categories #382

wants to merge 8 commits into from

Conversation

Taneb
Copy link
Member

@Taneb Taneb commented Aug 2, 2023

  • Displayed categories
  • Total categories
  • Displayed setoid reasoning and displayed morphism reasoning
  • Displayed functors (defined locally but would be improved by displayed morphism reasoning)
  • Displayed natural transformations
  • Investigate displayed category of displayed categories#
  • Vertical displayed functors
  • Vertical displayed natural transformations?
  • Category of displayed categories over a fixed base

@JacquesCarette
Copy link
Collaborator

I've done some work already based on your gist... see my Categorical Playground repo where your code is in Categorical/Displayed and mine in 2Level/Category.

Note that I'm not suggesting that my approach in 2Level/Category is 'right', it is very much an experiment that I'm in the middle of. But there might be things in there that could trigger an idea for you.

src/Categories/Category/Displayed.agda Show resolved Hide resolved
; ∘-resp-≈ = λ p q → -, ∘′-resp-[]≈ (proj₂ p) (proj₂ q)
}

display : Functor ∫ B
Copy link
Collaborator

Choose a reason for hiding this comment

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

Tempting to call this proj1, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not a huge fan of the name proj1 for this, personally. It feels like naming the functor after an implementation detail. That said, I'm not set on display either.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Part of my doodling is exploring how much Displayed is really the categorical equivalent of a Sigma type. So it's much more than an implementation detail, there is a very strong analogy at play.

I'm sure there are other, better names (certainly than proj1). I'm not set against display, BTW, but I do think it's worth thinking about.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This functor is normally called π in the literature, so proj1 is a fitting name.

F′.₁′ (G′.₁′ C.id′) ≈[]⟨ F′.F′-resp-≈[] G′.identity′ ⟩
F′.₁′ D.id′ ≈[]⟨ F′.identity′ ⟩
E.id′ ∎′
; homomorphism′ = λ {_} {_} {_} {_} {_} {_} {_} {_} {f′} {g′} → begin′
Copy link
Member Author

Choose a reason for hiding this comment

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

Is there a good way to avoid having to write quite this many {_}s to get two of the hidden arguments in scope?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes: use pattern-matching lambda and then name the ones you want.

Copy link

@jamesmckinna jamesmckinna Aug 8, 2023

Choose a reason for hiding this comment

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

Or else λ {f′ = f′} {g′ = g′} → ... (is that actually the same as, or different from, using a pattern matching lambda?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is different, it turns out. Sometimes this version isn't always accepted by Agda, I've never quite figured out why / when.

CommutativeSquare (a′ ∘ b′) c c″ (a ∘ b)
glue′ {a′ = a′} {c′ = c′} {c″ = c″} {a = a} {b′ = b′} {c = c} {b = b} sq-a sq-b = begin
-- A "rotated" version of glue. Equivalent to 'Equiv.sym (glue (Equiv.sym sq-a) (Equiv.sym sq-b))'
sym-glue : CommutativeSquare a′ c′ c″ a →
Copy link
Member Author

Choose a reason for hiding this comment

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

This name is not final! I just wanted to use the name glue′ for the displayed version of glue so had to name this something else

@Taneb
Copy link
Member Author

Taneb commented Aug 8, 2023

One thing I've noticed doing this, I care a lot more about the exact proof that two morphisms are equal than I normally would. This meant it matters, and is a little unfortunate, that equational reasoning syntax has an extraneous trans refl at the end. I don't know if this is fixable but it's definitely possible to work around it.

I've also been trying to make sure that little things that I'm building on top of have the "right" proofs ("right" is very subjective here). For example, defining some things in Categories.NaturalTransformation so that they don't use sym as much when they could use sym-assoc instead.

@TOTBWF
Copy link
Collaborator

TOTBWF commented Aug 8, 2023

Yeah, I was somewhat worried about this. In the 1Lab we define (pre)categories to have an hSet of morphisms, which means that we can ignore any sort of coherence issues involved with equalities of equalities. In general, agda-categories is really working with the theory of wild (2,1)-categories; normally we just perform a sneaky version of truncation by dropping equality proofs, but this is going to cause some pretty serious problems as this work continues.

As a concrete example, cartesian morphisms are going to be really problematic. The universal property requires that a morphism be displayed over a composite, which often involves some amount of transport. This comes up when defining the factorization system on a fibration; you end up using the fact that every morphism f' : Hom[ f ] x y is also displayed over f . id.

where
open DMorphismₚ D′

_ⓘₕ′_ : ∀ {C : Category bo bℓ be} {D : Category bo′ bℓ′ be′} {E : Category bo″ bℓ″ be″}
Copy link
Member Author

Choose a reason for hiding this comment

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

Agda struggled to use the variables declared in the variable block here, causing me to add the category, functor, and displayed category arguments explicitly. Not sure why.

unitor²′ = record { F′⇒G′ = id′∘id′⇒id′ ; F′⇐G′ = id′⇒id′∘id′ ; iso′ = LeftRightId′.iso-id′-id′ idF′ }

-- associator
module _
Copy link
Member Author

Choose a reason for hiding this comment

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

I've beaten my own record here, this module has 24 different Levels as arguments.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Impressive indeed. And a little crazy.

Copy link
Member Author

Choose a reason for hiding this comment

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

I suspect in most use cases, until we come up with a notion of "category where the objects can vary in level", this will collapse down to six (three for the base categories and three more for the displayed categories)

; identityˡ′ = unitorˡ′
; identityʳ′ = unitorʳ′
; identity²′ = unitor²′
; assoc′ = λ {_ _ _ _ _ _ _ _ _ _ _ F′ G′ H′} → associator′ H′ G′ F′
Copy link
Member Author

Choose a reason for hiding this comment

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

To revisit later: why do these arguments appear in the wrong order?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If they are via variables, they appear in first-use order, by Agda's definition of "first use", which isn't always easy to predict.

@Taneb
Copy link
Member Author

Taneb commented Aug 15, 2023

Composition of vertical functors is the first place I've hit where I've not been able to see a way around that we may have lots of different equalities between two functions. In particular, identity′ wants a F′.₁′ (G′.₁′ C.id′) E.≈[ refl ] E.id′ but I can only see how to get a F′.₁′ (G′.₁′ C.id′) E.≈[ trans refl refl ] E.id′.

@JacquesCarette
Copy link
Collaborator

Two things come to mind when I see this problem over things "over" equalities:

  1. you're not being weak enough somewhere to that you are demanding a very particular proof instead of any proof
  2. things are not strict enough, i.e. trans doesn't compute on refl.

Obviously these two things pull in polar opposite directions! I'd like to see more details as I'm stumbling in the dark a bit here. (And I'm super interested, as I think the same problem may well surface for both Multicategory and Double category.)

Influenced by the above, I would speculate that there are two needs for these proofs: we need them to be there so that things 'line up' properly, and we need them to 'properly exist' for well-definedness.

@TOTBWF
Copy link
Collaborator

TOTBWF commented Aug 15, 2023

Another perspective on this is that E-categories are sort of like half of a bicategory: we've got the 2-dimensional data of a bicategory, yet none of the equations or coherences.

Also, I'm pretty convinced that we need more than a type-family of morphisms: we need a setoid-family of morphisms!

If you have coherences, equations, and transport, then you might be able to work your way out of this jam.

@JacquesCarette
Copy link
Collaborator

I agree that E-categories are very much like bicategories with some of the coherences missing. What's so remarkable is how pretty much all of 1-category theory goes through!

Yes, some amount of transport is one way out of this jam. I'm quite curious to see if there are other ways around the problem. [There might not be - but I also thought that the current approach to agda-categories would fail miserably in the first 2 weeks of us porting the old code, and yet here we are...]

@TOTBWF
Copy link
Collaborator

TOTBWF commented Aug 15, 2023

I'm very interested in this as well; even in settings where you do have transport, it tends to be pretty miserable in practice.
(This is especially true in cubical, where transport does not compute on refl)

I see two ways forward on this: the first involves some co-yoneda trickery; instead of having displayed morphisms living directly over some f, you define a type like

record Over (f : Hom x y) (x' : Ob[ x ]) (y : Ob[ y ]) : Type where
  field
    base : Hom x y
    over : f ≈ base
    hom : Hom[ base ] x' y'

and then only work in terms of Over. It's pretty heavy-weight, but should work.

The other approach is to treat things like having fibre categories as honest-to-god structure. This is pretty interesting in its own right, though I'll admit I haven't thought too deeply on it.

@TOTBWF
Copy link
Collaborator

TOTBWF commented Aug 15, 2023

As another addendum: there is a second perspective on E-categories, which is that they are wild categories. FWIW, this makes agda-categories even more miraculous; it's really surprising that you can keep truncating and things keep working out!

@JacquesCarette
Copy link
Collaborator

I prefer the "maximally unsaturated" point of view of Peter LeFanu Lumsdaine and Erik Palmgren (i.e. I think the concept is Palmgren's but I learned it from Peter). Unfortunately the slides seem to have disappeared from the Internet per se, but still available in various archives / caches. But I think the video https://youtu.be/glC8tC7xdBY is still available.

But on Over: I agree that if f ≈ g then Hom[ f ] x' y' and Hom[ g ] x' y' should be equivalent (as types). And this dependency should not itself depend on the choice of proof of f ≈ g .

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.

4 participants