This repository was archived by the owner on Jul 24, 2024. It is now read-only.
wip(data/subtype_instances): introduce closed_under predicate typeclasses - #7834
Open
eric-wieser wants to merge 1 commit into
Open
wip(data/subtype_instances): introduce closed_under predicate typeclasses#7834eric-wieser wants to merge 1 commit into
eric-wieser wants to merge 1 commit into
Conversation
eric-wieser
commented
Jun 7, 2021
Comment on lines
+492
to
+551
| /-- Typeclass inference can't find this without a large amount of help :(. -/ | ||
| example [semiring β] [has_measurable_add₂ β] [has_measurable_mul₂ β]: | ||
| semiring (subtype (measurable : (α → β) → Prop)) := | ||
| begin | ||
| /- `id _` lets us see why typeclass inference is failing. -/ | ||
| refine @subtype.closed_under.subtype.semiring _ _ _ (id _) sorry sorry sorry, | ||
| convert measurable.subtype.closed_under_zero, | ||
| -- uh oh: `mul_zero_class.to_has_zero (α → β) = pi.has_zero` | ||
| swap, | ||
| apply_instance, | ||
| refl, | ||
| end |
Member
Author
There was a problem hiding this comment.
Here's where everything goes wrong
Collaborator
|
I think you can generalize these to an arbitrary number of inputs with |
Member
Author
|
That PR looks good and I was already aware of it, but I think that approach would make the typeclass problem worse. |
eric-wieser
force-pushed
the
eric-wieser/subtype.closed_under-measurable
branch
from
June 10, 2021 06:44
8fb8837 to
38a5388
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This seemed like it would be a nice generalization, but typeclass inference gets completely stuck in finding these new instances.
This is a more general version of #7833, with the hope of expanding the typeclasses to be used with
submonoidetc in a future PR.