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

End calculus #422

Merged
merged 5 commits into from
Jul 1, 2024
Merged

End calculus #422

merged 5 commits into from
Jul 1, 2024

Conversation

4e554c4c
Copy link
Contributor

This PR is a collection of theorems and refactorings that were developed during my master's thesis.

This includes

  • Initial objects
    • are colimits
  • Strict initial objects
    • Initial objects in a Cartesian category are strict
  • The category of twisted arrows
    • has a forgetful functor
    • Twist (F ∘ J) is iso to F ∘ Twist J
  • End calculus
    • Ends are preserved by continuous functors
    • The setoid of natural transformations is an end (given size constraints)
    • Parameterized ends (EndF)
      • are ends
      • are preserved by continuous functors
    • The end of a parameterized end is an end in the product category (Fubini)

Many definitions could be simplified if #419 is resolved.

Considerations

--lossy-unification is currently necessary for Categories.Diagram.End.Fubini. I was hoping that refactoring EndF to use an opaque end-η could fix this, but it does not.

src/Categories/Category/CartesianClosed/Properties.agda Outdated Show resolved Hide resolved
src/Categories/Category/Construction/TwistedArrow.agda Outdated Show resolved Hide resolved
src/Categories/Diagram/Empty.agda Outdated Show resolved Hide resolved
src/Categories/Diagram/End/Fubini.agda Outdated Show resolved Hide resolved
src/Categories/Diagram/End/Fubini.agda Outdated Show resolved Hide resolved
src/Categories/Diagram/End/Fubini.agda Outdated Show resolved Hide resolved
src/Categories/Functor/Bifunctor/Properties.agda Outdated Show resolved Hide resolved
src/Categories/Functor/Instance/Twisted.agda Show resolved Hide resolved
where module F = Bifunctor F

end-η♯ : {F G : Functor (P ×ᶜ (Category.op C ×ᶜ C)) D} (η : NaturalTransformation F G)
⦃ ef : ∫ (F ♯) ⦄ ⦃ eg : ∫ (G ♯) ⦄ → NaturalTransformation (∫.E ef) (∫.E eg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

please don't use instance arguments. I'm fine with opaque and unfolding, but not these. Things are slow enough as it is, let's not make it worse.

Copy link
Contributor Author

@4e554c4c 4e554c4c Jun 15, 2024

Choose a reason for hiding this comment

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

I'm not sure if the instances are making things slow here.

They make a lot of definitions nicer. For example, in Properties.agda there is the type

end-η-resp-∘ : (α : NaturalTransformation F G) (β : NaturalTransformation G H)
  {{ef : ∫ F}} {{eg : ∫ G}} {{eh : ∫ H}} →
  end-η (β ∘ᵥ α) ≈ end-η β ∘ end-η α

Stating each end here for end-η complicates the definition a lot, and I don't think that it makes things nicer. Using implicit arguments isn't possible either, since the only portion of the end that is solved uniquely is the apex.

The instance arguments work less well for parameterized ends, which is probably why you noticed it in this file and not the other.

@JacquesCarette
Copy link
Collaborator

Re: --lossy-unification. Is this because otherwise it takes way too long? At this this is cause by Agda reconstructing some implicit arguments "the hard way" even though, to use, they are obvious. I've been able to cut some typechecking time down a lot by supplying just the right implicits. One big clue is if you ask Agda for the type of various things and stuff is eta-expanded. This definitely happens in the presence of things that compute, such as ×ᶜ.

@4e554c4c
Copy link
Contributor Author

Re: --lossy-unification. Is this because otherwise it takes way too long?

Yes, but I don't think this is all about reconstructing implicit arguments. It is also comparing terms. I reference #419 because one of the things that needs to be compared often is apices of ends

@4e554c4c
Copy link
Contributor Author

4e554c4c commented Jun 19, 2024

I can't resolve all of the <greek letter>.dinatural.α blah noise in the fubini proofs. I can move give names to some of them in where clauses if I define the ends using copatterns (as is probably more reasonable anyway). Really the main solution to this would be to resolve agda/agda#7156 and allow for "applying" wedges (or ends) to an object to get the appropriate map.

@4e554c4c
Copy link
Contributor Author

@JacquesCarette whenever you have the time, I would appreciate another look. I haven't changed everything that you suggested, but I left comments wherever I did not.

@Taneb
Copy link
Member

Taneb commented Jun 25, 2024

...would it be possible to split this into several other PRs? It's very big and scary to look at for me (this isn't a requirement but I'd appreciate it)

@4e554c4c
Copy link
Contributor Author

...would it be possible to split this into several other PRs? It's very big and scary to look at for me (this isn't a requirement but I'd appreciate it)

I can't split off too much, since github PRs can't depend on eachother. I split off some misc changes into #423 and #424 (will probably add to both of these later)

@JacquesCarette
Copy link
Collaborator

Sorry for the slowness - was on vacation all last week.

@JacquesCarette JacquesCarette merged commit 997559a into agda:master Jul 1, 2024
1 check passed
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.

3 participants