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
fix(category_theory/limits): Add some missing instances for special shapes of limits #2083
Conversation
@@ -62,13 +63,21 @@ instance fintype_walking_parallel_pair : fintype walking_parallel_pair := | |||
open walking_parallel_pair | |||
|
|||
/-- The type family of morphisms for the diagram indexing a (co)equalizer. -/ | |||
inductive walking_parallel_pair_hom : walking_parallel_pair → walking_parallel_pair → Type v | |||
@[derive _root_.decidable_eq] inductive walking_parallel_pair_hom : |
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.
Why is _root_
needed here?
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.
After open walking_parallel_pair
, decidable_eq
refers to category_theory.limits.walking_parallel_pair.decidable_eq
(i.e., the decidable_eq
instance derived for walking_parallel_pair
).
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.
Discussed here, and a fix is in the works, so we'll leave this as is for now.
| left : walking_parallel_pair_hom zero one | ||
| right : walking_parallel_pair_hom zero one | ||
| id : Π X : walking_parallel_pair.{v}, walking_parallel_pair_hom X X | ||
|
||
open walking_parallel_pair_hom | ||
|
||
instance (j j' : walking_parallel_pair) : fintype (walking_parallel_pair_hom j j') := |
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 would really prefer to see a derive handler that can cope with this. Do you know why the existing one doesn't work here? (I haven't looked at all.)
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.
When I put attribute [derive fintype] walking_parallel_pair_hom
, I get failed to find a derive handler for 'fintype'
. Since even for object types like walking_parallel_pair
the fintype instance is implemented manually, I concluded that there simply is no derive handler for fintype
. A grep over the mathlib repository seems to support that conclusion.
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.
It seems the only other successful @[derive fintype]
is in archive/sensitivity.lean
, where delta_instance
is all that's required to get it done. A general purpose derive_handler
for fintype
unfortunately doesn't exist, but this seems like the sort of thing @cipher1024 likes. :-)
So what's the status of
What do you think of adding a bunch of lines like:
These shouldn't be global instances, but available in case someone wants them. |
…hapes of limits (leanprover-community#2083) * Add some instances for limit shapes * Deduce has_(equalizers|kernels|pullbacks) from has_finite_limits Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…hapes of limits (leanprover-community#2083) * Add some instances for limit shapes * Deduce has_(equalizers|kernels|pullbacks) from has_finite_limits Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This PR adds
fin_category
instances for the indexing categories for (co)equalizers, pushouts and pullbacks. This means that we can now correctly derive the existence of these special limits fromhas_finite_limits
andhas_finite_colimits
.It also adds missing instance attributes for
has_kernels
andhas_cokernels
.TO CONTRIBUTORS:
Make sure you have:
If this PR is related to a discussion on Zulip, please include a link in the discussion.
For reviewers: code review check list