-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
Add _make_named_class_key for several categories, miscellaneous changes #39160
base: develop
Are you sure you want to change the base?
Add _make_named_class_key for several categories, miscellaneous changes #39160
Conversation
Documentation preview for this PR (built with commit 7d69eaf; changes) is ready! 🎉 |
06d6368
to
c6b3b55
Compare
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.
Thanks a lot! I can confirm that the linked bug is indeed fixed by these changes. Tests pass as well (modulo the usual random issues).
I don't really feel comfortable reviewing such fundamental changes in the category framework. So it would be awesome if one of the experts have a look as well.
Actually while working on this I realize the bug runs deeper than it looked. Just see how many tests #39170 breaks. The current implementation is suboptimal as well (but yes, at least it works slightly better than the previous one). I think @simon-king-jena is the best one tocomment on this (as author of #11943 and #11935 ) butthe PR was 13 years ago so I've no idea if the author is still contactable. There's a better way to implement this. Will copy from #39170 once it works. |
b5176a5
to
97db4bf
Compare
I implement the cleaner solution (just The debug option to check the MRO is not in though (#39170). That would take more time. |
Fixes #39154
Let
C = Category.join([NumberFields(), QuotientFields(), MetricSpaces()])
, then there are 4 categories being createdModules(C)
VectorSpaces(C)
Modules(C).Filtered()
VectorSpaces(C).Filtered()
The last 2 have type
FilteredModulesCategory
, which inherit fromRegressiveCovariantConstructionCategory, Category_over_base_ring
which in turn inherits fromCategoryWithParameters
. Subclasses ofCategoryWithParameters
need to override_make_named_class_key
correctly so that category A and B can only return same key if their parent class, element class, subcategory class etc. are identical. ButFilteredModulesCategory
takes_make_named_class_key
fromCategory_over_base_ring
, which returns the base category (C
) for the key.With this change, the returned key is e.g.
Modules(C).parent_class
andVectorSpaces(C).parent_class
respectively, which is different.Side note: by how things are implemented in SageMath,
Modules(C)
actually returns the same thing asVectorSpaces(C)
. The above diagram is only for illustration purpose.Side note 2:
Modules(C).Filtered()
is currently a subcategory ofVectorSpaces(C)
… so the above is not a diamond, rather it's a linear chain.Also make
Modules(Fields())).Filtered()
≤VectorSpaces(Fields())
, and a few other changes e.g. make_test_category_graph
works for hom categories.📝 Checklist
⌛ Dependencies