Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Adding more placeholder classes to fix MRO resolution issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Scrimshaw committed Jul 13, 2019
1 parent d29a86d commit 0c59b50
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/sage/algebras/associated_graded.py
Expand Up @@ -114,7 +114,7 @@ class AssociatedGradedAlgebra(CombinatorialFreeModule):
sage: A = Modules(QQ).WithBasis().Filtered().example()
sage: grA = A.graded_algebra()
sage: grA.category()
Category of graded modules with basis over Rational Field
Category of graded vector spaces with basis over Rational Field
sage: x = A.basis()[Partition([3,2,1])]
sage: grA(x)
Bbar[[3, 2, 1]]
Expand Down
8 changes: 4 additions & 4 deletions src/sage/categories/filtered_modules.py
Expand Up @@ -46,7 +46,7 @@ def __init__(self, base_category):
Category of algebras over Rational Field
sage: sorted(C.super_categories(), key=str)
[Category of algebras over Rational Field,
Category of filtered modules over Rational Field]
Category of filtered vector spaces over Rational Field]
sage: AlgebrasWithBasis(QQ).Filtered().base_ring()
Rational Field
Expand Down Expand Up @@ -99,8 +99,8 @@ def extra_super_categories(self):
EXAMPLES::
sage: Modules(QQ).Filtered().extra_super_categories()
[Category of vector spaces over Rational Field]
sage: Modules(QQ).Filtered().is_subcategory(VectorSpaces(QQ))
True
sage: Modules(ZZ).Filtered().extra_super_categories()
[]
Expand All @@ -109,7 +109,7 @@ def extra_super_categories(self):
an instance of this class and of ``VectorSpaces(QQ)``::
sage: type(Modules(QQ).Filtered())
<class 'sage.categories.filtered_modules.FilteredModules_with_category'>
<class 'sage.categories.vector_spaces.VectorSpaces.Filtered_with_category'>
.. TODO::
Expand Down
6 changes: 3 additions & 3 deletions src/sage/categories/graded_modules.py
Expand Up @@ -26,7 +26,7 @@ def __init__(self, base_category):
Category of algebras over Rational Field
sage: sorted(C.super_categories(), key=str)
[Category of filtered algebras over Rational Field,
Category of graded modules over Rational Field]
Category of graded vector spaces over Rational Field]
sage: AlgebrasWithBasis(QQ).Graded().base_ring()
Rational Field
Expand Down Expand Up @@ -85,13 +85,13 @@ def default_super_categories(cls, category, *args):
sage: Algebras(QQ).Graded().super_categories()
[Category of filtered algebras over Rational Field,
Category of graded modules over Rational Field]
Category of graded vector spaces over Rational Field]
This resulted from the following call::
sage: sage.categories.graded_modules.GradedModulesCategory.default_super_categories(Algebras(QQ))
Join of Category of filtered algebras over Rational Field
and Category of graded modules over Rational Field
and Category of graded vector spaces over Rational Field
"""
cat = super(GradedModulesCategory, cls).default_super_categories(category, *args)
return Category.join([category.Filtered(), cat])
Expand Down
3 changes: 2 additions & 1 deletion src/sage/categories/primer.py
Expand Up @@ -1438,7 +1438,8 @@ class naming and introspection. Sage currently works around the
compatible with the product on `O`::
sage: Modules(QQ).Graded() & Algebras(QQ)
Join of Category of algebras over Rational Field and Category of graded modules over Rational Field
Join of Category of algebras over Rational Field
and Category of graded vector spaces over Rational Field
The relevant difference between ``FiniteDimensional`` and ``Graded``
is that ``FiniteDimensional`` is a statement about the properties of
Expand Down
11 changes: 6 additions & 5 deletions src/sage/categories/super_modules_with_basis.py
Expand Up @@ -20,12 +20,13 @@ class SuperModulesWithBasis(SuperModulesCategory):
EXAMPLES::
sage: C = GradedModulesWithBasis(ZZ); C
Category of graded modules with basis over Integer Ring
sage: C = GradedModulesWithBasis(QQ); C
Category of graded vector spaces with basis over Rational Field
sage: sorted(C.super_categories(), key=str)
[Category of filtered modules with basis over Integer Ring,
Category of graded modules over Integer Ring]
sage: C is ModulesWithBasis(ZZ).Graded()
[Category of filtered vector spaces with basis over Rational Field,
Category of graded modules with basis over Rational Field,
Category of graded vector spaces over Rational Field]
sage: C is ModulesWithBasis(QQ).Graded()
True
TESTS::
Expand Down
55 changes: 55 additions & 0 deletions src/sage/categories/vector_spaces.py
Expand Up @@ -16,6 +16,8 @@
from sage.categories.cartesian_product import CartesianProductsCategory
from sage.categories.dual import DualObjectsCategory
from sage.categories.tensor import TensorProductsCategory
from sage.categories.filtered_modules import FilteredModulesCategory
from sage.categories.graded_modules import GradedModulesCategory
from sage.categories.fields import Fields
from sage.categories.modules import Modules
from sage.categories.modules_with_basis import ModulesWithBasis
Expand Down Expand Up @@ -193,6 +195,48 @@ def extra_super_categories(self):
"""
return [self.base_category()]

class Graded(GradedModulesCategory):
"""
Category of graded vector spaces with basis.
"""
def example(self, base_ring=None):
"""
Return an example of a graded vector space with basis,
as per :meth:`Category.example()
<sage.categories.category.Category.example>`.
EXAMPLES::
sage: Modules(QQ).WithBasis().Graded().example()
An example of a graded module with basis:
the free module on partitions over Rational Field
"""
from sage.categories.examples.graded_modules_with_basis import GradedPartitionModule
if base_ring is None:
base_ring = self.base_ring()
return GradedPartitionModule(base_ring=base_ring)

class Filtered(FilteredModulesCategory):
"""
Category of filtered vector spaces with basis.
"""
def example(self, base_ring=None):
"""
Return an example of a graded vector space with basis,
as per :meth:`Category.example()
<sage.categories.category.Category.example>`.
EXAMPLES::
sage: Modules(QQ).WithBasis().Graded().example()
An example of a graded module with basis:
the free module on partitions over Rational Field
"""
from sage.categories.examples.filtered_modules_with_basis import FilteredPartitionModule
if base_ring is None:
base_ring = self.base_ring()
return FilteredPartitionModule(base_ring=base_ring)

class DualObjects(DualObjectsCategory):

def extra_super_categories(self):
Expand Down Expand Up @@ -237,3 +281,14 @@ def extra_super_categories(self):
True
"""
return [self.base_category()]

class Filtered(FilteredModulesCategory):
"""
Category of filtered vector spaces.
"""

class Graded(GradedModulesCategory):
"""
Category of graded vector spaces.
"""

4 changes: 2 additions & 2 deletions src/sage/misc/c3_controlled.pyx
Expand Up @@ -331,9 +331,9 @@ For a typical category, few bases, if any, need to be added to force
sage: x.mro == x.mro_standard
False
sage: x.all_bases_len()
106
114
sage: x.all_bases_controlled_len()
109
117
The following can be used to search through the Sage named categories
for any that requires the addition of some bases. The output may
Expand Down

0 comments on commit 0c59b50

Please sign in to comment.