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

wip(data/subtype_instances): introduce closed_under predicate typeclasses #7834

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eric-wieser
Copy link
Member

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 submonoid etc in a future PR.


Open in Gitpod

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
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's where everything goes wrong

@awainverse
Copy link
Collaborator

I think you can generalize these to an arbitrary number of inputs with arity. Also, I'm trying to do something similar in spirit at #7762.

@eric-wieser
Copy link
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 eric-wieser force-pushed the eric-wieser/subtype.closed_under-measurable branch from 8fb8837 to 38a5388 Compare June 10, 2021 06:44
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Aug 11, 2021
@semorrison semorrison added the too-late This PR was ready too late for inclusion in mathlib3 label Jul 16, 2023
@eric-wieser eric-wieser requested a review from a team as a code owner October 16, 2023 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-conflict Please `git merge origin/master` then a bot will remove this label. RFC Request for comment too-late This PR was ready too late for inclusion in mathlib3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants