chore: add unification hint for forgetful functor Bundled -> Type #17583
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.
We have a lot of
erw
s andrfl
s in files dealing with concrete categories. This seems to be mostly due to the existence of two casts:ConcreteCategory.hasCoeToSort
andBundled.coeSort
which both represent the forgetful functor from concrete categories to Type. The first is only a local instance but is needed to state lemmas on these concrete categories, while the second one is always available but only applies to categories defined asBundled
. The casts are defeq but not reducibly so, causing issues when rewriting with generic lemmas in the context of a specificBundled
category.For some specific categories we already have a workaround: a unification hint of the form
⊢ (forget CommRingCat).obj R ≟ R
also fires at reducible transparency. This PR does the same for any category of the formBundled _
, fixing a lot of the issues.Still, we have some regressions. These all seem to happen because the subtle unification order gets disrupted: where we expected
CommRingCat
(with many useful instances) now we getBundled CommRing
. The many improvements still weigh up to this drawback, and perhaps we can figure out how to get rid of the regressions altogether.