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

Indexed products and coproducts #1878

Merged
merged 14 commits into from
Mar 8, 2024
Merged

Indexed products and coproducts #1878

merged 14 commits into from
Mar 8, 2024

Conversation

gio256
Copy link
Contributor

@gio256 gio256 commented Mar 2, 2024

Generalizes binary products and coproducts to indexed products and coproducts, building on work by @Alizter.

The primary changes are to WildCat/Products.v and WildCat/Coproducts.v, i.e. I haven't touched any of the places where binary products and coproducts are currently used, but that may be ripe for another PR.

Copy link
Collaborator

@jdchristensen jdchristensen left a comment

Choose a reason for hiding this comment

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

It's really nice to see this generalization, and the way that some of the proofs become a bit shorter than in the specific case of binary products!

@Alizter
Copy link
Collaborator

Alizter commented Mar 3, 2024

@jdchristensen This should set us up nicely to investigate limits eventually (in a later PR). Note that as expected, there is no coherence on the indexing type I required to state any of the results. For limits we would expect I -> A being functorial to give the appropriate limit data.

theories/WildCat/Products.v Outdated Show resolved Hide resolved
theories/WildCat/Coproducts.v Show resolved Hide resolved
theories/WildCat/Products.v Outdated Show resolved Hide resolved
theories/WildCat/Products.v Outdated Show resolved Hide resolved
Comment on lines 91 to 94
Global Instance is0functor_bifunctor01 {A B C : Type}
`{Is01Cat A} `{IsGraph B} `{IsGraph C}
(F : A * B -> C) `{!Is0Functor F} (a : A)
: Is0Functor (fun b => F (a, b)).
Copy link
Collaborator

Choose a reason for hiding this comment

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

The material here is using bifunctor in a slightly different way. Earlier, it means F : A -> B -> C with certain properties.

  1. I think we should distinguish between the two types, but am not sure of the best name.

  2. Maybe these results should be combined to prove that a bifunctor of the type F : A * B -> C gives rise to a bifunctor of the type F : A -> B -> C, since that's missing. Then the results about functoriality in each variable follow. (Or these separate results could be kept, with followup results giving the IsBifunctor structure?)

  3. I'm not sure we actually need these results. I'll make another comment about this in the place where these are used.

theories/WildCat/Products.v Outdated Show resolved Hide resolved
Class Is1Bifunctor {A B C : Type} `{Is1Cat A, Is1Cat B, Is1Cat C}
(F : A -> B -> C) `{!IsBifunctor F}
:= {
bifunctor_is1functor_10 :: forall a : A, Is1Functor (F a);
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 followed the convention above here, but IMO it's more consistent to remove the final underscores and switch the 10 / 01 suffixes. In my mind bifunctor_is0functor01 should mean that you can fmap in the second argument.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than using indexes maybe we could write _fst and _snd? The index is not immediately understandably IMO.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think either 01/10 without the underscore or _fst/_snd are both fine.

@gio256 gio256 mentioned this pull request Mar 7, 2024
theories/WildCat/Products.v Outdated Show resolved Hide resolved
theories/WildCat/Products.v Show resolved Hide resolved
@gio256 gio256 mentioned this pull request Mar 7, 2024
@Alizter
Copy link
Collaborator

Alizter commented Mar 8, 2024

After finishing the review comments in #1884 and merging, I will take another look at this PR.

@Alizter
Copy link
Collaborator

Alizter commented Mar 8, 2024

@gio256 I've merged #1884, please rebase. If you get a conflict on my existing commit here, just skip during rebase and it should be fine.

Alizter and others added 5 commits March 8, 2024 07:42
Signed-off-by: Ali Caglayan <[email protected]>
WildCat/Products.v: Add to indexed products

WildCat/Products.v: cleanup

Fix indexed product functor

Initial implementation of indexed coproducts

Build indexed products and coproducts

Alternative proofs of functoriality of binary prod

Replace proofs of functoriality for binary product

Clean up indexed products and coproducts

Revert proofs of functoriality for binary products

Clean up indexed products and coproducts
@gio256
Copy link
Contributor Author

gio256 commented Mar 8, 2024

@Alizter should I squash this, or is the protocol to squash all commits before a PR and keep the review commits?

@Alizter
Copy link
Collaborator

Alizter commented Mar 8, 2024

@gio256 I think it is fine not to squash this one. I'm currently having another look and once I am done I will merge as is.

theories/WildCat/ZeroGroupoid.v Show resolved Hide resolved
theories/WildCat/ZeroGroupoid.v Show resolved Hide resolved
theories/WildCat/ZeroGroupoid.v Show resolved Hide resolved
@Alizter
Copy link
Collaborator

Alizter commented Mar 8, 2024

Something interesting that I noticed was that we don't need Funext to show all coproducts exist in Type, but we do for products. The eta-rule for products is obviously equivalent to path_forall, so I don't think we can do any better.

@jdchristensen
Copy link
Collaborator

Something interesting that I noticed was that we don't need Funext to show all coproducts exist in Type, but we do for products. The eta-rule for products is obviously equivalent to path_forall, so I don't think we can do any better.

That's interesting. This is a spot where the 0-groupoid structure isn't quite working in our favour. We do have an equivalence of types between Z -> (forall i, X i) and forall i, (Z -> X i) by swapping the order of variables, and the composites are even definitionally the identity maps. But when you add the 0-groupoid structure, we get homotopies in the Z variable on the left, but in both variables on the right, so things don't match up.

@gio256
Copy link
Contributor Author

gio256 commented Mar 8, 2024

I forgot to prove that Type has all coproducts. Thanks!

@Alizter
Copy link
Collaborator

Alizter commented Mar 8, 2024

@gio256 Thanks a lot! This turned out nicely.

@Alizter Alizter merged commit c3d80d0 into HoTT:master Mar 8, 2024
23 checks passed
@gio256
Copy link
Contributor Author

gio256 commented Mar 8, 2024

Thanks for the careful feedback, @Alizter @jdchristensen!

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