You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gh-39160: Add _make_named_class_key for several categories, miscellaneous changes
Fixes#39154
Let `C = Category.join([NumberFields(), QuotientFields(),
MetricSpaces()])`, then there are 4 categories being created
* `Modules(C)`
* `VectorSpaces(C)`
* `Modules(C).Filtered()`
* `VectorSpaces(C).Filtered()`
The last 2 have type `FilteredModulesCategory`, which inherit from
`RegressiveCovariantConstructionCategory, Category_over_base_ring` which
in turn inherits from `CategoryWithParameters`. Subclasses of
`CategoryWithParameters` 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. But
`FilteredModulesCategory` takes `_make_named_class_key` from
`Category_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` and
`VectorSpaces(C).parent_class` respectively, which is different.
Side note: by how things are implemented in SageMath, `Modules(C)`
actually returns the same thing as `VectorSpaces(C)`. The above diagram
is only for illustration purpose.
Side note 2: `Modules(C).Filtered()` is currently a subcategory of
`VectorSpaces(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
<!-- Put an `x` in all the boxes that apply. -->
- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
### ⌛ Dependencies
<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - #12345: short description why this is a dependency -->
<!-- - #34567: ... -->
URL: #39160
Reported by: user202729
Reviewer(s): Tobias Diez
0 commit comments