-
Notifications
You must be signed in to change notification settings - Fork 450
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: only direct parents of classes create projections #5920
Conversation
Before, all class ancestors that were representable as subobject fields had their projections be instances. This (1) didn't include all direct parents and (2) might include indirect parents. Now, all direct parent classes are instances. Features: - Only parents that are not ancestors of other parents get instances. This allows "discretionary" indirect parents to be inserted without having an impact on typeclass synthesis for the purpose of computing strict resolution orders when `structure.strictResolutionOrder` is enabled. - Non-subobject projections are now theorems if the parent is a proposition. - Parent projections are no longer added as instances for the `structure` command. Only the `class` command`. Closes leanprover#2905
Mathlib CI status (docs):
|
/-! | ||
Check that `A` is not an instance, since it is implied by the others. | ||
-/ | ||
class E' extends C, D, A |
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 one surprises me a little; shouldn't it be an instance because the user asked for it in extends
?
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.
(unless this emits a warning, in which case I have no objection besides the test not checking for that warning)
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, there's no warning. This feature is necessary for being able to satisfy the strict C3 linearization algorithm in some cases without affecting what the actual instances are. Currently strict mode is not the default, but I hope we can refactor mathlib at some point to have a strict linearization.
) This PR changes the rule for which projections become instances. Before, all parents along with all indirect ancestors that were represented as subobject fields would have their projections become instances. Now only projections for direct parents become instances. Features: - Only parents that are not ancestors of other parents get instances. This allows "discretionary" indirect parents to be inserted for the purpose of computing strict resolution orders when `structure.strictResolutionOrder` is enabled, without having an impact on typeclass synthesis. - Non-subobject projections are now theorems if the parent is a proposition. These are also no longer `@[reducible]`. Closes leanprover#2905
This PR changes the rule for which projections become instances. Before, all parents along with all indirect ancestors that were represented as subobject fields would have their projections become instances. Now only projections for direct parents become instances.
Features:
structure.strictResolutionOrder
is enabled, without having an impact on typeclass synthesis.@[reducible]
.Closes #2905