-
Notifications
You must be signed in to change notification settings - Fork 194
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
Bifunctors #1883
Comments
We had discussions about the name Since we've named binary products On the other hand, we don't really do any wild bicategory theory, nor do I see a reason to do it just yet (as almost all of our examples are wild (2,1)-categories). So maybe it is not as ambiguous as seems currently. |
@Alizter That's an orthogonal naming issue. I'm talking about how both |
What if we call |
Taking this as a concrete example: Global Instance is1bifunctor_bifunctor_uncurried {A B C : Type}
`{Is1Cat A, Is1Cat B, Is1Cat C}
(F : A * B -> C) `{!Is0Functor F, !Is1Functor F}
: Is1Bifunctor (fun a b => F (a, b)). we would change the name to
to
I'm ok either way. |
I think the second one reads better. We should also say "from a product category" as "on" is a bit ambiguous. |
So after some thinking, I've come to the conclusion that it might be better to define bifunctors using uncurry and having the coherence based definition as a "smart constructor". My reasoning is as follows: In many cases of functoriality, we can prove things in both variables simultaneously. Take for instance the smash functor I defined in #1892. There, the uncurried version of the bifunctor would have a more compact term. In that PR, I defined the functorial action of Smash simultaneously and then specialised to each variable and then proved that it was coherent. It seems like it would be less work and less space to define the unurried functor directly. The definition in most classical literature that I have seen define a bifunctor as the uncurried version and as a lemma it is shown to be equivalent to the component-wise data and coherence condition. Overall I think it would be best to redefine bifunctor as functoriality of the curried version and have a smart constructor for building them with the current definition's data and also derive the functoriality in a single variable. This way also has the advantage that it scales better with respect to the number of variables, but we hardly ever need a notion of trifunctor. (Or maybe it would be useful for TriJoin?) FTR the definition I have in mind is: Class Is0BiFunctor {A B C} `{Is1Cat A, Is1Cat B, Is1Cat C} (F : A -> B -> C) := {
is0functor_uncurry_bifunctor :: Is0Functor (uncurry F) ;
}. |
That might make sense. The same thing happened with |
@jdchristensen Yes |
Would it be helpful if I went through and repeated the proofs of e.g. Definition Build_Is0Bifunctor' {A B C : Type} `{Is01Cat A, Is01Cat B, IsGraph C}
(F : A -> B -> C) `{!Is0Functor (uncurry F)}
: Is0Bifunctor F
:= is0bifunctor_bifunctor_uncurried (uncurry F).
Definition Build_Is1Bifunctor' {A B C : Type} `{Is1Cat A, Is1Cat B, Is1Cat C}
(F : A -> B -> C) `{!Is0Functor (uncurry F), !Is1Functor (uncurry F)}
: Is1Bifunctor F
:= is1bifunctor_bifunctor_uncurried (uncurry F). I think either way around works well, though my guess would be that the current definition ends up being slightly easier to use while being slightly harder to define directly. It might just be me, but unification seems to struggle at times when product categories are involved. |
It does seem like @gio256 's approach also gives us the same simplifications that we would get if we changed the definition of Bifunctor. So maybe it is a better way to go? I do slightly prefer the current definition of Bifunctor as it doesn't involve product categories directly. |
The only difference is that the uncurried version will be more compact. Since it is more work to unpack an uncurried functor and pack it up again. There will be quite a large term size if we continue this way. The bifunctor data we have now is convenient, but I don't think it will be the most common form. I suppose for Ext, it makes sense, but when you consider other bifunctors you can see that choosing the one I suggested will keep all the term sizes smaller overall. In any case, it won't make any difference in the proofs if we start using the lemmas that @gio256 suggested as it can easily be changed. Only when we reason about the functors themselves will we notice that terms are larger than we would expect. |
I think that this issue is complete. I'll create another issue about experimenting with redefining bifunctor. I don't want to touch it right now because we are building a lot on it at the moment. |
A number of updates to
WildCat/Bifunctor.v
have been discussed in #1878. This is a tracking issue for changes that don't make it into that PR.TODOs include:
IsBifunctor
->Is0Bifunctor
)WildCat/Prod.v
or made to fit better with the other lemmas inWildCat/Bifunctor.v
.bifunctor_isbifunctor
) be moved intoIs1Bifunctor
, leavingIs0Bifunctor
with justIs0Functor
instances in each argument? This seems to be more consistent with the unbundled structure of functors. Also, in order to prove that an uncurried bifunctor is a curried bifunctor, I neededIs1Functor
to proveIs0Bifunctor
. My hope would be that moving the coherence condition intoIs1Bifunctor
would limit the extra assumptions needed to move between the curried and uncurried forms.The text was updated successfully, but these errors were encountered: