do covariant constructions commute with WithBasis?
I have a category Cs
(which is a supercategory of VectorSpaces
) which implements axioms FinitelyGeneratedAsCs
and WithBasis
. When I want to consider Graded objects of C
I simply return GradedModulesCategory.category_of(self)
as the implementations of graded vector spaces or similar do. This preserves the axiom FinitelyGeneratedAsCs
, namely if I call Cs().FinitelyGeneratedAsCs().Graded()
I obtain the same as Cs().Graded().FinitelyGeneratedAsCs()
. However when I do this with WithBasis
the results differ. Given this TODO in https://doc.sagemath.org/html/en/reference//categories/sage/categories/modules.html
Todo
Explain why this does not commute with WithBasis()
I suppose that this is something that has come up even in the current stable Sage code. I thought of asking here what would be the cause admittedly without having looked deeper into Sage's code to see how this is implemented.
EDIT: I suppose this has to to with the fact that Cs().WithBasis().super_categories()
returns VectorSpaces(QQ).WithBasis()
and Cs()
in that order, so calling Graded()
applies the functor to each so that Cs().WithBasis().Graded().super_categories()
lists first VectorSpaces(QQ).WithBasis().Graded()
and then Cs().WithBasis()
and Cs().Graded()
, this latter one being a direct subcategory of VectorSpaces(QQ).Graded()
But I tried defining Cs.WithBasis._super_categories in the right order and failed anyway.
EDIT2: The following seems to be a workaround. I define Cs.Graded
and then on Cs.WithBasis.SubcategoryMethods
I have
def Graded(self):
axioms = self.axioms()
return self.base_category.Graded()._with_axioms(axioms)
The problem is that if this is called from a subcategory that is a join category it will fail.