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

Trick to make Is1Cat definitionally involutive #1934

Merged
merged 6 commits into from
Apr 29, 2024

Conversation

jdchristensen
Copy link
Collaborator

@jdchristensen jdchristensen commented Apr 27, 2024

I was curious how close is1cat_op is to being definitionally involutive, and it turns out that the only thing that fails is associativity, because it requires using gpd_rev on the hom types.

We could consider making a variant of Is1Cat without associativity and using that where possible, to avoid duplicating dual proofs. But it would add one more layer in the WildCat hierarchy, so I don't think it's a great idea.

Instead, the second commit shows a trick that makes this work. It changes Is1Cat to have two associativity proofs, one for each direction, with is1cat_op' just switching the two. We could define Build_Is1Cat to only take one, and prove the other using gpd_rev, so almost no code would need to change. (And we already define cat_assoc_opp, so this is really no different from what we've got, except that it gets moved into the data of Is1Cat.)

In this PR, this is all done in test/WildCat/Opposite.v, but if it looks like a reasonable change, then I could make it to the main code. Then several other places with dual proofs would simplify.

@jdchristensen
Copy link
Collaborator Author

Hmm, this might not work like it is, since we probably use in some places that cat_assoc_opp is the inverse to cat_assoc. If so, we would need to add that (and its dual) to Is1Cat. Or maybe this would only come up with 2-categories?

@Alizter
Copy link
Collaborator

Alizter commented Apr 27, 2024

I guess you are right that this would only apply for (2,1)-cats. We could simply add some extra coherence stating that cat_assoc_opp is left and right inverse to cat_assoc. That way cat_assoc would be a natural equivalence in another way.

@jdchristensen
Copy link
Collaborator Author

I just pushed four commits.

The first one moves this trick from the tests/ folder and makes it our real definition of Is1Cat. In order to make things smooth, I had to also add the reverse associativity in other places, e.g. in Is1Cat_Strong and IsD1Cat (displayed).

Second commit: I also found a way to make core and op commute definitionally, by making some proofs more symmetric.

Third: is1functor_op' now simplifies.

Fourth: speed up a few things. Now the speed is unchanged within the noise.

Note: I didn't need to use anywhere that the two proofs of associativity are inverse to each other.

Question: Is the mild increase in complexity worth it? I'm inclined to think so.

Question: Can other things simplify now that is1cat_op is definitionally involutive? There's a spot in #1929. Anywhere else?

@jdchristensen jdchristensen marked this pull request as ready for review April 28, 2024 20:45
@Alizter
Copy link
Collaborator

Alizter commented Apr 28, 2024

Question: Is the mild increase in complexity worth it? I'm inclined to think so.

Yes, I agree. This isn't the only structure we have in the library with "redundant" data. I believe bundled equivalences and groups also fall into this category. I think the gain of a definitionally involutive op will be well worth it.

Question: Can other things simplify now that is1cat_op is definitionally involutive? There's a spot in #1929. Anywhere else?

I would check the binary coproduct functoriality proofs. IIUC these should follow definitionally now.

@jdchristensen
Copy link
Collaborator Author

I would check the binary coproduct functoriality proofs. IIUC these should follow definitionally now.

They use is0functor_op and related things, which are just the identity function, but with types that make things work smoothly. So I think that by fixing is1functor_op', I've handled this. But I didn't look through that file. Let me know if there is something you see there.

Copy link
Collaborator

@Alizter Alizter left a comment

Choose a reason for hiding this comment

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

Nice! I had a look at coproducts but didn't spot any obvious simplifications.

@Alizter Alizter merged commit 6a93fb9 into HoTT:master Apr 29, 2024
23 checks passed
@jdchristensen jdchristensen deleted the opposites-involutive branch April 29, 2024 13:16
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.

2 participants