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

feat(category_theory): opposites, and the category of types #249

Merged
merged 11 commits into from Aug 18, 2018

Conversation

semorrison
Copy link
Collaborator

This adds

  • opposite categories and functors
  • the category of types
  • universe lifting for types
  • some lemmas about functors and transformations into the category of types
  • the hom pairing as a functor
  • an extensionality lemma for ulift

variables {D : Type u₂} [𝒟 : category.{u₂ v₂} D]
include 𝒟

definition opposite (F : C ↝ D) : (Cᵒᵖ) ↝ (Dᵒᵖ) :=
Copy link
Member

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.


variable (C)

definition hom_pairing : (Cᵒᵖ × C) ↝ (Type v₁) :=
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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?

Copy link
Member

@digama0 digama0 Aug 15, 2018

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...)

@[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
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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!

Copy link
Member

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.

-- Released under Apache 2.0 license as described in the file LICENSE.
-- Authors: Stephen Morgan, Scott Morrison

import .functor_category
Copy link
Member

Choose a reason for hiding this comment

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

No relative imports

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.


end functor_to_types

definition type_lift : (Type u) ↝ (Type (max u v)) :=
Copy link
Member

@digama0 digama0 Aug 15, 2018

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

@semorrison
Copy link
Collaborator Author

I think this has fixed all the suggestions above; thanks!

@johoelzl
Copy link
Collaborator

Does it make sense to de-bundle hom? I.e. have it as a parameter to category instead of as a field?

@digama0
Copy link
Member

digama0 commented Aug 17, 2018

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.

@semorrison
Copy link
Collaborator Author

semorrison commented Aug 17, 2018 via email

@digama0 digama0 merged commit cfb27cb into leanprover-community:master Aug 18, 2018
@semorrison semorrison deleted the category_theory_3 branch August 18, 2018 10:01
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.

None yet

3 participants