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
I am introdicing a method sage.structure.parent.Parent._unset_category() that changes the class into the "category-free" base class and resets the ._category cdef attribute to None.
In this way, it is possible to redo a wrong initialisation or refinement of category.
The idea for creating this method arose in #15229: It is possible to do R = IntegerModRing(15, category=Fields()), and then R will believe that it is a field, and will actually be initialised in a sub-category of Fields(). With the new method, it would be possible to revert the wrong category initialisation and re-initialise it correctly.
Disclaimer:
I do not think that we should automatically apply this method, e.g., if R.is_field(proof=True) finds out that the modulus actually isn't prime. Its use should be reserved to expert users.
It is certainly impossible to erase all bad consequences of an originally wrong choice of a category. E.g., if one wrongly initialises/refines some ring R in the category of integral domains, then one can construct the fraction field, and after R._unset_category() the wrong fraction field would still exist, and would still be accessible from R. Hence, unsetting the category may help to cope with some mistakes, but it can of course not be a global eraser.
I am introdicing a method
sage.structure.parent.Parent._unset_category()
that changes the class into the "category-free" base class and resets the._category
cdef attribute to None.In this way, it is possible to redo a wrong initialisation or refinement of category.
The idea for creating this method arose in #15229: It is possible to do
R = IntegerModRing(15, category=Fields())
, and thenR
will believe that it is a field, and will actually be initialised in a sub-category ofFields()
. With the new method, it would be possible to revert the wrong category initialisation and re-initialise it correctly.Disclaimer:
R.is_field(proof=True)
finds out that the modulus actually isn't prime. Its use should be reserved to expert users.R._unset_category()
the wrong fraction field would still exist, and would still be accessible fromR
. Hence, unsetting the category may help to cope with some mistakes, but it can of course not be a global eraser.Component: categories
Keywords: category initialisation, sd53
Author: Simon King
Branch/Commit: u/SimonKing/ticket/15234 @
4f77364
Reviewer: Volker Braun
Issue created by migration from https://trac.sagemath.org/ticket/15234
The text was updated successfully, but these errors were encountered: