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
feat(category_theory): opposites, and the category of types #249
feat(category_theory): opposites, and the category of types #249
Conversation
category_theory/opposites.lean
Outdated
variables {D : Type u₂} [𝒟 : category.{u₂ v₂} D] | ||
include 𝒟 | ||
|
||
definition opposite (F : C ↝ D) : (Cᵒᵖ) ↝ (Dᵒᵖ) := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be just op
, protected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
category_theory/opposites.lean
Outdated
|
||
variable (C) | ||
|
||
definition hom_pairing : (Cᵒᵖ × C) ↝ (Type v₁) := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, to me this is not an obvious name. I guess this is the functor mathematicians call Hom(-,-)
; can we call it Hom
or functor.Hom
or functor.hom
? Or are you trying to call attention to the fact that this is an uncurried functor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fairly common name amongst mathematicians (ha!): the idea is that it is a pairing, like the pairing between a vector space and its dual. I think the common usage is just because "the hom functor for C" doesn't really specify what you mean, but "the hom pairing for C" is unambiguously a "bilinear" thing, i.e. a functor out of Cᵒᵖ × C
.
I can change it to just functor.hom
, but I think this is more descriptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing: I've been thinking that the field category.Hom
should be category.hom
. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: category.hom
: I think that's a good idea, and it will free Hom
up for other uses (such as here?).
I think "hom pairing" sounds more like a way to speak the symbol in a mathematical context without the opportunity for notational or typing disambiguation. In our case, I think this should be called functor.hom
rather than functor.hom_pairing
, unless you think that there is another definition that has a better claim to the name functor.hom
. (I thought about the curried version of this functor, but I guess that's usually called yoneda
or a variant...)
category_theory/products.lean
Outdated
@[simp, ematch] lemma prod_obj (F : A ↝ B) (G : C ↝ D) (a : A) (c : C) : F.prod G (a, c) = (F a, G c) := rfl | ||
@[simp, ematch] lemma prod_map (F : A ↝ B) (G : C ↝ D) {a a' : A} {c c' : C} (f : (a, c) ⟶ (a', c')) : (F.prod G).map f = (F.map f.1, G.map f.2) := rfl | ||
@[simp, ematch] lemma prod_obj (F : A ↝ B) (G : C ↝ D) (a : A) (c : C) : (functor.prod F G) (a, c) = (F a, G c) := rfl | ||
@[simp, ematch] lemma prod_map (F : A ↝ B) (G : C ↝ D) {a a' : A} {c c' : C} (f : (a, c) ⟶ (a', c')) : (functor.prod F G).map f = (F.map f.1, G.map f.2) := rfl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened here? I liked it better before - did projection stop working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Projection is still fine. It just looked awfully lopsided to me, for a very symmetric construction: like F
was doing something to G
, rather than just combining them side by side. The projection notation here saves 6 characters, but not much else that I can see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can of course change it back if you say so!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like to think of the projection notation as a poor-man's binary operator, since it puts the word in infix position. For uniformity I also remove unnecessary parentheses in places like this.
Part of my "what happened here" reaction was on the inclusion of strange extra spaces, though.
category_theory/types.lean
Outdated
-- Released under Apache 2.0 license as described in the file LICENSE. | ||
-- Authors: Stephen Morgan, Scott Morrison | ||
|
||
import .functor_category |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No relative imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
category_theory/types.lean
Outdated
|
||
end functor_to_types | ||
|
||
definition type_lift : (Type u) ↝ (Type (max u v)) := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just be called ulift
or functor.ulift
also explaining the lack of notation for functor.prod and nat_trans.prod
I think this has fixed all the suggestions above; thanks! |
Does it make sense to de-bundle |
This was an option we discussed during the plans leading to the first PR. I think the problem is that it makes it a lot more cumbersome to talk about specific categories, since you will always have to mention both the objects and the morphisms, i.e. "the category of groups and group homomorphisms" instead of "the category of groups". Since we don't usually have a terse notation for the homs, this is even more inconvenient. I can imagine that in some circumstances it can be useful to separate the homs out, but I think that the primary class for categories should be half-bundled like this. |
Further to Mario's comment, if you want to talk about multiple category
structures on the same objects, it seems fairly straightforward to just use
wrapper definitions as in `category_theory/opposities.lean`. I think even
this is quite intuitive to mathematicians, who will just read the wrapper
as a little flag "oh, I'm thinking of it as an object in this other
category now".
(I probably should add an explanation of this in the documentation.)
The current setup seems quite usable and notationally convenient (the
glaring exception being having to specify the universe levels of the homs
manually when declaring `category` variables), and moreover close to
standard mathematical usage.
If there's a particular use case where unbundling further seems useful I'd
by happy to investigate it further.
…On Sat, Aug 18, 2018 at 3:41 AM Mario Carneiro ***@***.***> wrote:
This was an option we discussed during the plans leading to the first PR.
I think the problem is that it makes it a lot more cumbersome to talk about
specific categories, since you will always have to mention both the objects
and the morphisms, i.e. "the category of groups and group homomorphisms"
instead of "the category of groups". Since we don't usually have a terse
notation for the homs, this is even more inconvenient. I can imagine that
in some circumstances it can be useful to separate the homs out, but I
think that the primary class for categories should be half-bundled like
this.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#249 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAdLBKrRxTot31iCgPMHPdO5n7JnXZlJks5uRwBBgaJpZM4V5MmV>
.
|
This adds
ulift