Exemplo n.º 1
0
    def __classcall_private__(cls, crystals, facade=True, keepkey=False, category=None):
        """
        Normalization of arguments; see :class:`UniqueRepresentation`.

        TESTS:

        We check that direct sum of crystals have unique representation::

            sage: B = crystals.Tableaux(['A',2], shape=[2,1])
            sage: C = crystals.Letters(['A',2])
            sage: D1 = crystals.DirectSum([B, C])
            sage: D2 = crystals.DirectSum((B, C))
            sage: D1 is D2
            True
            sage: D3 = crystals.DirectSum([B, C, C])
            sage: D4 = crystals.DirectSum([D1, C])
            sage: D3 is D4
            True
        """
        if not isinstance(facade, bool) or not isinstance(keepkey, bool):
            raise TypeError
        # Normalize the facade-keepkey by giving keepkey dominance
        facade = not keepkey

        # We expand out direct sums of crystals
        ret = []
        for x in Family(crystals):
            if isinstance(x, DirectSumOfCrystals):
                ret += list(x.crystals)
            else:
                ret.append(x)
        category = Category.meet([Category.join(c.categories()) for c in ret])
        return super(DirectSumOfCrystals, cls).__classcall__(cls,
            Family(ret), facade=facade, keepkey=keepkey, category=category)
Exemplo n.º 2
0
    def __init__(self, G):
        """
        TESTS::

            sage: S8 = SymmetricGroup(8)
            sage: TestSuite(GSets(S8)).run()
        """
        Category.__init__(self)
        self.__G = G
Exemplo n.º 3
0
    def __init__(self, G):
        """
        TESTS::

            sage: S8 = SymmetricGroup(8)
            sage: TestSuite(GSets(S8)).run()
        """
        Category.__init__(self, "G-sets")
        self.__G = G
Exemplo n.º 4
0
    def __init__(self):
        """
        TESTS::

            sage: C = Schemes()
            sage: C
            Category of Schemes
            sage: TestSuite(C).run()
        """
        Category.__init__(self, "Schemes")
Exemplo n.º 5
0
    def __init__(self, left_base, right_base, name=None):
        """
        EXAMPLES::

            sage: C = Bimodules(QQ, ZZ)
            sage: TestSuite(C).run()
        """
        Category.__init__(self, name)
        assert left_base in _Rings, "The left base must be a ring"
        assert right_base in _Rings, "The right base must be a ring"
        self._left_base_ring = left_base
        self._right_base_ring = right_base
Exemplo n.º 6
0
    def __init__(self, left_base, right_base, name=None):
        """
        EXAMPLES::

            sage: C = Bimodules(QQ, ZZ)
            sage: TestSuite(C).run()
        """
        Category.__init__(self, name)
        assert left_base  in _Rings, "The left base must be a ring"
        assert right_base in _Rings, "The right base must be a ring"
        self._left_base_ring = left_base
        self._right_base_ring = right_base
Exemplo n.º 7
0
    def __init__(self, G = None):
        """
        TESTS::

            sage: S8 = SymmetricGroup(8)
            sage: C = Groupoid(S8)
            sage: TestSuite(C).run()
        """
        Category.__init__(self) #, "Groupoid")
        if G is None:
            from sage.groups.perm_gps.permgroup_named import SymmetricGroup
            G = SymmetricGroup(8)
        self.__G = G
Exemplo n.º 8
0
    def __init__(self, G=None):
        """
        TESTS::

            sage: S8 = SymmetricGroup(8)
            sage: C = Groupoid(S8)
            sage: TestSuite(C).run()
        """
        Category.__init__(self)  #, "Groupoid")
        if G is None:
            from sage.groups.perm_gps.permgroup_named import SymmetricGroup
            G = SymmetricGroup(8)
        self.__G = G
Exemplo n.º 9
0
    def __init__(self, left_base, right_base, name=None):
        """
        EXAMPLES::

            sage: C = Bimodules(QQ, ZZ)
            sage: TestSuite(C).run()
        """
        if not (left_base in Rings or (isinstance(left_base, Category) and left_base.is_subcategory(Rings()))):
            raise ValueError("the left base must be a ring or a subcategory of Rings()")
        if not (right_base in Rings or (isinstance(right_base, Category) and right_base.is_subcategory(Rings()))):
            raise ValueError("the right base must be a ring or a subcategory of Rings()")
        self._left_base_ring = left_base
        self._right_base_ring = right_base
        Category.__init__(self, name)
Exemplo n.º 10
0
    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: C = crystals.Letters(['A',2])
            sage: B = crystals.DirectSum([C,C], keepkey=True)
            sage: B
            Direct sum of the crystals Family (The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2])
            sage: B.cartan_type()
            ['A', 2]

            sage: from sage.combinat.crystals.direct_sum import DirectSumOfCrystals
            sage: isinstance(B, DirectSumOfCrystals)
            True
        """
        if 'keepkey' in options:
            keepkey = options['keepkey']
        else:
            keepkey = False
#        facade = options['facade']
        if keepkey:
            facade = False
        else:
            facade = True
        category = Category.meet(
            [Category.join(crystal.categories()) for crystal in crystals])
        Parent.__init__(self, category=category)
        DisjointUnionEnumeratedSets.__init__(self,
                                             crystals,
                                             keepkey=keepkey,
                                             facade=facade)
        self.rename("Direct sum of the crystals %s" % (crystals, ))
        self._keepkey = keepkey
        self.crystals = crystals
        if len(crystals) == 0:
            raise ValueError("The direct sum is empty")
        else:
            assert (crystal.cartan_type() == crystals[0].cartan_type()
                    for crystal in crystals)
            self._cartan_type = crystals[0].cartan_type()
        if keepkey:
            self.module_generators = [
                self(tuple([i, b])) for i in range(len(crystals))
                for b in crystals[i].module_generators
            ]
        else:
            self.module_generators = sum(
                (list(B.module_generators) for B in crystals), [])
Exemplo n.º 11
0
    def __init__(self, cartan_type):
        """
        Construct this Coxeter group as a Sage permutation group, by
        fetching the permutation representation of the generators from
        Chevie's database.

        TESTS::

            sage: from sage.combinat.root_system.coxeter_group import CoxeterGroupAsPermutationGroup
            sage: W = CoxeterGroupAsPermutationGroup(CartanType(["H",3])) # optional - chevie
            sage: TestSuite(W).run()             # optional - chevie
        """
        assert cartan_type.is_finite()
        assert cartan_type.is_irreducible()
        self._semi_simple_rank = cartan_type.n
        from sage.interfaces.gap3 import gap3
        gap3._start()
        gap3.load_package("chevie")
        self._gap_group = gap3('CoxeterGroup("%s",%s)' %
                               (cartan_type.letter, cartan_type.n))
        # Following #9032, x.N is an alias for x.numerical_approx in every Sage object ...
        N = self._gap_group.__getattr__("N").sage()
        generators = [str(x) for x in self._gap_group.generators]
        self._is_positive_root = [None] + [True] * N + [False] * N
        PermutationGroup_generic.__init__(self,
                                          gens=generators,
                                          category=Category.join([
                                              FinitePermutationGroups(),
                                              FiniteCoxeterGroups()
                                          ]))
    def default_super_categories(cls, category, *args):
        """
        Returns the default super categories of ``...``

        INPUT:

         - ``category`` -- a category

        OUTPUT: a join category

        This implements the property that an induced subcategory is a
        subcategory.

        EXAMPLES:

        A subquotient of a monoid is a monoid, and a subquotient of
        semigroup::

            sage: Monoids().Subquotients().super_categories()
            [Category of monoids, Category of subquotients of semigroups]

        TESTS::

            sage: C = Monoids().Subquotients()
            sage: C.__class__.default_super_categories(C.base_category(), *C._args)
            Join of Category of monoids and Category of subquotients of semigroups
        """
        return Category.join([category, super(RegressiveCovariantConstructionCategory, cls).default_super_categories(category, *args)])
Exemplo n.º 13
0
    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: from sage.combinat.crystals.tensor_product import FullTensorProductOfCrystals
            sage: C = crystals.Letters(['A',2])
            sage: T = crystals.TensorProduct(C,C)
            sage: isinstance(T, FullTensorProductOfCrystals)
            True
            sage: TestSuite(T).run()
        """
        category = Category.meet([crystal.category() for crystal in crystals])
        category = category.TensorProducts()
        if any(c in Sets().Infinite() for c in crystals):
            category = category.Infinite()
        Parent.__init__(self, category=category)
        self.crystals = crystals
        if 'cartan_type' in options:
            self._cartan_type = CartanType(options['cartan_type'])
        else:
            if not crystals:
                raise ValueError(
                    "you need to specify the Cartan type if the tensor product list is empty"
                )
            else:
                self._cartan_type = crystals[0].cartan_type()
        self.cartesian_product = cartesian_product(self.crystals)
        self.module_generators = self
Exemplo n.º 14
0
    def category_from_categories(self, categories):
        """
        Return the category of `F(A,B,...)` for `A,B,...` parents in
        the given categories.

        INPUT:

         - ``self``: a functor `F`
         - ``categories``: a non empty tuple of categories

        EXAMPLES::

            sage: Cat1 = Rings()
            sage: Cat2 = Groups()
            sage: cartesian_product.category_from_categories((Cat1, Cat1, Cat1))
            Join of Category of rings and ...
                and Category of Cartesian products of semigroups and ...
                and Category of Cartesian products of commutative additive groups

            sage: cartesian_product.category_from_categories((Cat1, Cat2))
            Join of Category of monoids
                and Category of Cartesian products of semigroups
                and Category of Cartesian products of unital magmas
        """
        assert(len(categories) > 0)
        return self.category_from_category(Category.meet(categories))
Exemplo n.º 15
0
    def __init__(self, sets, category, order=None, **kwargs):
        r"""
        See :class:`CartesianProductPoset` for details.

        TESTS::

            sage: P = Poset((srange(3), lambda left, right: left <= right))
            sage: C = cartesian_product((P, P), order='notexisting')
            Traceback (most recent call last):
            ...
            ValueError: No order 'notexisting' known.
            sage: C = cartesian_product((P, P), category=(Groups(),))
            sage: C.category()
            Join of Category of groups and Category of posets
        """
        if order is None:
            self._le_ = self.le_product
        elif isinstance(order, str):
            try:
                self._le_ = getattr(self, 'le_' + order)
            except AttributeError:
                raise ValueError("No order '%s' known." % (order,))
        else:
            self._le_ = order

        from sage.categories.category import Category
        from sage.categories.posets import Posets
        if not isinstance(category, tuple):
            category = (category,)
        category = Category.join(category + (Posets(),))
        super(CartesianProductPoset, self).__init__(
            sets, category, **kwargs)
Exemplo n.º 16
0
    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: from sage.combinat.crystals.tensor_product import FullTensorProductOfCrystals
            sage: C = crystals.Letters(['A',2])
            sage: T = crystals.TensorProduct(C,C)
            sage: isinstance(T, FullTensorProductOfCrystals)
            True
            sage: TestSuite(T).run()
        """
        category = Category.meet([crystal.category() for crystal in crystals])
        category = category.TensorProducts()
        if any(c in Sets().Infinite() for c in crystals):
            category = category.Infinite()
        Parent.__init__(self, category=category)
        self.crystals = crystals
        if 'cartan_type' in options:
            self._cartan_type = CartanType(options['cartan_type'])
        else:
            if not crystals:
                raise ValueError("you need to specify the Cartan type if the tensor product list is empty")
            else:
                self._cartan_type = crystals[0].cartan_type()
        self.cartesian_product = cartesian_product(self.crystals)
        self.module_generators = self
Exemplo n.º 17
0
    def __init__(self, sets, category, order=None, **kwargs):
        r"""
        See :class:`CartesianProductPoset` for details.

        TESTS::

            sage: P = Poset((srange(3), lambda left, right: left <= right))
            sage: C = cartesian_product((P, P), order='notexisting')
            Traceback (most recent call last):
            ...
            ValueError: No order 'notexisting' known.
            sage: C = cartesian_product((P, P), category=(Groups(),))
            sage: C.category()
            Join of Category of groups and Category of posets
        """
        if order is None:
            self._le_ = self.le_product
        elif isinstance(order, str):
            try:
                self._le_ = getattr(self, 'le_' + order)
            except AttributeError:
                raise ValueError("No order '%s' known." % (order, ))
        else:
            self._le_ = order

        from sage.categories.category import Category
        from sage.categories.posets import Posets
        if not isinstance(category, tuple):
            category = (category, )
        category = Category.join(category + (Posets(), ))
        super(CartesianProductPoset, self).__init__(sets, category, **kwargs)
Exemplo n.º 18
0
    def default_super_categories(cls, category, *args):
        """
        Return the default super categories of `F_{Cat}(A,B,...)` for
        `A,B,...` parents in `Cat`.

        INPUT:

        - ``cls`` -- the category class for the functor `F`
        - ``category`` -- a category `Cat`
        - ``*args`` -- further arguments for the functor

        OUTPUT:

        A join category.

        This implements the property that an induced subcategory is a
        subcategory.

        EXAMPLES:

        A subquotient of a monoid is a monoid, and a subquotient of
        semigroup::

            sage: Monoids().Subquotients().super_categories()
            [Category of monoids, Category of subquotients of semigroups]

        TESTS::

            sage: C = Monoids().Subquotients()
            sage: C.__class__.default_super_categories(C.base_category(), *C._args)
            Category of unital subquotients of semigroups
        """
        return Category.join([category, super(RegressiveCovariantConstructionCategory, cls).default_super_categories(category, *args)])
Exemplo n.º 19
0
    def __init__(self, cartan_type):
        """
        Construct this Coxeter group as a Sage permutation group, by
        fetching the permutation representation of the generators from
        Chevie's database.

        TESTS::

            sage: from sage.combinat.root_system.coxeter_group import CoxeterGroupAsPermutationGroup
            sage: W = CoxeterGroupAsPermutationGroup(CartanType(["H",3])) # optional - chevie
            sage: TestSuite(W).run()             # optional - chevie
        """
        assert cartan_type.is_finite()
        assert cartan_type.is_irreducible()
        self._semi_simple_rank = cartan_type.n
        from sage.interfaces.gap3 import gap3
        gap3._start()
        gap3.load_package("chevie")
        self._gap_group = gap3('CoxeterGroup("%s",%s)'%(cartan_type.letter,cartan_type.n))
        # Following #9032, x.N is an alias for x.numerical_approx in every Sage object ...
        N = self._gap_group.__getattr__("N").sage()
        generators = [str(x) for x in self._gap_group.generators]
        self._is_positive_root = [None] + [ True ] * N + [False]*N
        PermutationGroup_generic.__init__(self, gens = generators,
                                          category = Category.join([FinitePermutationGroups(), FiniteCoxeterGroups()]))
Exemplo n.º 20
0
    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: from sage.combinat.crystals.tensor_product import FullTensorProductOfCrystals
            sage: C = CrystalOfLetters(['A',2])
            sage: T = TensorProductOfCrystals(C,C)
            sage: isinstance(T, FullTensorProductOfCrystals)
            True
            sage: TestSuite(T).run()
        """
        crystals = list(crystals)
        category = Category.meet([crystal.category() for crystal in crystals])
        Parent.__init__(self, category = category)
        self.rename("Full tensor product of the crystals %s"%(crystals,))
        self.crystals = crystals
        if options.has_key('cartan_type'):
            self._cartan_type = CartanType(options['cartan_type'])
        else:
            if len(crystals) == 0:
                raise ValueError, "you need to specify the Cartan type if the tensor product list is empty"
            else:
                self._cartan_type = crystals[0].cartan_type()
        self.cartesian_product = CartesianProduct(*self.crystals)
        self.module_generators = self
Exemplo n.º 21
0
    def default_super_categories(cls, category, *args):
        """
        Returns the default super categories of `F_{Cat}(A,B,C)` for `A,B,C`
        parents in `Cat`.

        INPUT:

         - ``cls`` -- the category class for the functor `F`
         - ``category`` -- a category `Cat`
         - ``*args`` -- further arguments for the functor

        OUTPUT: a (join) category

        The default implementation is to return the join of the
        categories of `F(A,B,C)` for `A,B,C` in turn in each of the
        super categories of ``category``.

        This is implemented as a class method, in order to be able to
        reconstruct the functorial category associated to each of the
        super categories of ``category``.

        EXAMPLES:

        Bialgebras are both algebras and coalgebras::

            sage: Bialgebras(QQ).super_categories()
            [Category of algebras over Rational Field, Category of coalgebras over Rational Field]

        Hence tensor products of bialgebras are tensor products of
        algebras and tensor products of coalgebras::

            sage: Bialgebras(QQ).TensorProducts().super_categories()
            [Category of tensor products of algebras over Rational Field, Category of tensor products of coalgebras over Rational Field]

        Here is how :meth:`default_super_categories` was called internally::

            sage: sage.categories.tensor.TensorProductsCategory.default_super_categories(Bialgebras(QQ))
            Join of Category of tensor products of algebras over Rational Field and Category of tensor products of coalgebras over Rational Field

        We now show a similar example, with the ``Algebra`` functor
        which takes a parameter `\QQ`::

            sage: FiniteMonoids().super_categories()
            [Category of finite semigroups, Category of monoids]
            sage: FiniteMonoids().Algebras(QQ).super_categories()
            [Category of semigroup algebras over Rational Field]

        Note that neither the category of *finite* semigroup algebras
        nor that of monoid algebras appear in the result; this is
        because there is currently nothing specific implemented about them.

        Here is how :meth:`default_super_categories` was called internally::

            sage: sage.categories.algebra_functor.AlgebrasCategory.default_super_categories(FiniteMonoids(), QQ)
            Category of monoid algebras over Rational Field
        """
        return Category.join([
            getattr(cat, cls._functor_category)(*args)
            for cat in category._super_categories
        ])
Exemplo n.º 22
0
    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: from sage.combinat.crystals.tensor_product import FullTensorProductOfCrystals
            sage: C = CrystalOfLetters(['A',2])
            sage: T = TensorProductOfCrystals(C,C)
            sage: isinstance(T, FullTensorProductOfCrystals)
            True
            sage: TestSuite(T).run()
        """
        crystals = list(crystals)
        category = Category.meet([crystal.category() for crystal in crystals])
        Parent.__init__(self, category = category)
        self.rename("Full tensor product of the crystals %s"%(crystals,))
        self.crystals = crystals
        if options.has_key('cartan_type'):
            self._cartan_type = CartanType(options['cartan_type'])
        else:
            if len(crystals) == 0:
                raise ValueError, "you need to specify the Cartan type if the tensor product list is empty"
            else:
                self._cartan_type = crystals[0].cartan_type()
        self.cartesian_product = CartesianProduct(*self.crystals)
        self.module_generators = self
    def _repr_object_names(self):
        """
        EXAMPLES::

            sage: Semigroups().Subquotients()  # indirect doctest
            Category of subquotients of semigroups
        """
        return "%s of %s"%(Category._repr_object_names(self), self.base_category()._repr_object_names())
Exemplo n.º 24
0
    def __init__(self, left_base, right_base, name=None):
        """
        EXAMPLES::

            sage: C = Bimodules(QQ, ZZ)
            sage: TestSuite(C).run()
        """
        if not ( left_base in Rings() or
                 (isinstance(left_base, Category)
                  and left_base.is_subcategory(Rings())) ):
            raise ValueError("the left base must be a ring or a subcategory of Rings()")
        if not ( right_base in Rings() or
                 (isinstance(right_base, Category)
                  and right_base.is_subcategory(Rings())) ):
            raise ValueError("the right base must be a ring or a subcategory of Rings()")
        self._left_base_ring = left_base
        self._right_base_ring = right_base
        Category.__init__(self, name)
Exemplo n.º 25
0
    def _latex_(self):
        """
        EXAMPLES::

            sage: print Bimodules(QQ, ZZ)._latex_()
            {\mathbf{Bimodules}}_{\Bold{Q}}_{\Bold{Z}}
        """
        from sage.misc.latex import latex
        return "{%s}_{%s}_{%s}"%(Category._latex_(self), latex(self._left_base_ring), latex(self._right_base_ring))
    def default_super_categories(cls, category, *args):
        """
        Returns the default super categories of `F_{Cat}(A,B,C)` for `A,B,C`
        parents in `Cat`.

        INPUT:

         - ``cls`` -- the category class for the functor `F`
         - ``category`` -- a category `Cat`
         - ``*args`` -- further arguments for the functor

        OUTPUT: a (join) category

        The default implementation is to return the join of the
        categories of `F(A,B,C)` for `A,B,C` in turn in each of the
        super categories of ``category``.

        This is implemented as a class method, in order to be able to
        reconstruct the functorial category associated to each of the
        super categories of ``category``.

        EXAMPLES:

        Bialgebras are both algebras and coalgebras::

            sage: Bialgebras(QQ).super_categories()
            [Category of algebras over Rational Field, Category of coalgebras over Rational Field]

        Hence tensor products of bialgebras are tensor products of
        algebras and tensor products of coalgebras::

            sage: Bialgebras(QQ).TensorProducts().super_categories()
            [Category of tensor products of algebras over Rational Field, Category of tensor products of coalgebras over Rational Field]

        Here is how :meth:`default_super_categories` was called internally::

            sage: sage.categories.tensor.TensorProductsCategory.default_super_categories(Bialgebras(QQ))
            Join of Category of tensor products of algebras over Rational Field and Category of tensor products of coalgebras over Rational Field

        We now show a similar example, with the ``Algebra`` functor
        which takes a parameter `\QQ`::

            sage: FiniteMonoids().super_categories()
            [Category of finite semigroups, Category of monoids]
            sage: FiniteMonoids().Algebras(QQ).super_categories()
            [Category of semigroup algebras over Rational Field]

        Note that neither the category of *finite* semigroup algebras
        nor that of monoid algebras appear in the result; this is
        because there is currently nothing specific implemented about them.

        Here is how :meth:`default_super_categories` was called internally::

            sage: sage.categories.algebra_functor.AlgebrasCategory.default_super_categories(FiniteMonoids(), QQ)
            Category of monoid algebras over Rational Field
        """
        return Category.join([getattr(cat, cls._functor_category)(*args) for cat in category._super_categories])
Exemplo n.º 27
0
    def __classcall_private__(cls,
                              crystals,
                              facade=True,
                              keepkey=False,
                              category=None):
        """
        Normalization of arguments; see :class:`UniqueRepresentation`.

        TESTS:

        We check that direct sum of crystals have unique representation::

            sage: B = crystals.Tableaux(['A',2], shape=[2,1])
            sage: C = crystals.Letters(['A',2])
            sage: D1 = crystals.DirectSum([B, C])
            sage: D2 = crystals.DirectSum((B, C))
            sage: D1 is D2
            True
            sage: D3 = crystals.DirectSum([B, C, C])
            sage: D4 = crystals.DirectSum([D1, C])
            sage: D3 is D4
            True
        """
        if not isinstance(facade, bool) or not isinstance(keepkey, bool):
            raise TypeError
        # Normalize the facade-keepkey by giving keepkey dominance
        if keepkey:
            facade = False
        else:
            facade = True

        # We expand out direct sums of crystals
        ret = []
        for x in Family(crystals):
            if isinstance(x, DirectSumOfCrystals):
                ret += list(x.crystals)
            else:
                ret.append(x)
        category = Category.meet([Category.join(c.categories()) for c in ret])
        return super(DirectSumOfCrystals, cls).__classcall__(cls,
                                                             Family(ret),
                                                             facade=facade,
                                                             keepkey=keepkey,
                                                             category=category)
    def __init__(self, order, cache=None, category=None):
        """
        Create with the command ``IntegerModRing(order)``.

        TESTS::

            sage: FF = IntegerModRing(29)
            sage: TestSuite(FF).run()
            sage: F19 = IntegerModRing(19, category = Fields())
            sage: TestSuite(F19).run()
            sage: F23 = IntegerModRing(23)
            sage: F23 in Fields()
            True
            sage: TestSuite(F23).run()
            sage: Z16 = IntegerModRing(16)
            sage: TestSuite(Z16).run()
            sage: R = Integers(100000)
            sage: TestSuite(R).run()  # long time (17s on sage.math, 2011)
        """
        order = ZZ(order)
        if order <= 0:
            raise ZeroDivisionError("order must be positive")
        self.__order = order
        self._pyx_order = integer_mod.NativeIntStruct(order)
        if category is None:
            from sage.categories.commutative_rings import CommutativeRings
            from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
            from sage.categories.category import Category
            category = Category.join(
                [CommutativeRings(),
                 FiniteEnumeratedSets()])


#            category = default_category
# If the category is given then we trust that is it right.
# Give the generator a 'name' to make quotients work.  The
# name 'x' is used because it's also used for the ring of
# integers: see the __init__ method for IntegerRing_class in
# sage/rings/integer_ring.pyx.
        quotient_ring.QuotientRing_generic.__init__(self,
                                                    ZZ,
                                                    ZZ.ideal(order),
                                                    names=('x', ),
                                                    category=category)
        # Calling ParentWithGens is not needed, the job is done in
        # the quotient ring initialisation.
        #ParentWithGens.__init__(self, self, category = category)
        # We want that the ring is its own base ring.
        self._base = self
        if cache is None:
            cache = order < 500
        if cache:
            self._precompute_table()
        self._zero_element = integer_mod.IntegerMod(self, 0)
        self._one_element = integer_mod.IntegerMod(self, 1)
Exemplo n.º 29
0
    def __init__(self, A, gens=None):
        """
        A subring of the endomorphism ring.

        INPUT:


        -  ``A`` - an abelian variety

        -  ``gens`` - (default: None); optional; if given
           should be a tuple of the generators as matrices


        EXAMPLES::

            sage: J0(23).endomorphism_ring()
            Endomorphism ring of Abelian variety J0(23) of dimension 2
            sage: sage.modular.abvar.homspace.EndomorphismSubring(J0(25))
            Endomorphism ring of Abelian variety J0(25) of dimension 0
            sage: E = J0(11).endomorphism_ring()
            sage: type(E)
            <class 'sage.modular.abvar.homspace.EndomorphismSubring_with_category'>
            sage: E.category()
            Join of Category of hom sets in Category of sets and Category of rings
            sage: E.homset_category()
            Category of modular abelian varieties over Rational Field
            sage: TestSuite(E).run(skip=["_test_elements"])

        TESTS:

        The following tests against a problem on 32 bit machines that
        occured while working on trac ticket #9944::

            sage: sage.modular.abvar.homspace.EndomorphismSubring(J1(12345))
            Endomorphism ring of Abelian variety J1(12345) of dimension 5405473

        """
        self._J = A.ambient_variety()
        self._A = A

        # Initialise self with the correct category.
        # TODO: a category should be able to specify the appropriate
        # category for its endomorphism sets
        # We need to initialise it as a ring first
        homset_cat = A.category()
        cat = Category.join([homset_cat.hom_category(),Rings()])
        Ring.__init__(self, A.base_ring())
        Homspace.__init__(self, A, A, cat=homset_cat)
        self._refine_category_(Rings())
        if gens is None:
            self._gens = None
        else:
            self._gens = tuple([ self._get_matrix(g) for g in gens ])
        self._is_full_ring = gens is None
Exemplo n.º 30
0
    def _latex_(self):
        """
        EXAMPLES::

            sage: print Bimodules(QQ, ZZ)._latex_()
            {\mathbf{Bimodules}}_{\Bold{Q}}_{\Bold{Z}}
        """
        from sage.misc.latex import latex
        return "{%s}_{%s}_{%s}" % (Category._latex_(self),
                                   latex(self._left_base_ring),
                                   latex(self._right_base_ring))
Exemplo n.º 31
0
    def __init__(self, A, gens=None):
        """
        A subring of the endomorphism ring.
        
        INPUT:
        
        
        -  ``A`` - an abelian variety
        
        -  ``gens`` - (default: None); optional; if given
           should be a tuple of the generators as matrices
        
        
        EXAMPLES::
        
            sage: J0(23).endomorphism_ring()
            Endomorphism ring of Abelian variety J0(23) of dimension 2
            sage: sage.modular.abvar.homspace.EndomorphismSubring(J0(25))
            Endomorphism ring of Abelian variety J0(25) of dimension 0
            sage: E = J0(11).endomorphism_ring()
            sage: type(E)
            <class 'sage.modular.abvar.homspace.EndomorphismSubring_with_category'>
            sage: E.category()
            Join of Category of hom sets in Category of sets and Category of rings
            sage: E.homset_category()
            Category of modular abelian varieties over Rational Field
            sage: TestSuite(E).run(skip=["_test_elements"])

        TESTS:

        The following tests against a problem on 32 bit machines that
        occured while working on trac ticket #9944::

            sage: sage.modular.abvar.homspace.EndomorphismSubring(J1(12345))
            Endomorphism ring of Abelian variety J1(12345) of dimension 5405473

        """
        self._J = A.ambient_variety()
        self._A = A

        # Initialise self with the correct category.
        # TODO: a category should be able to specify the appropriate
        # category for its endomorphism sets
        # We need to initialise it as a ring first
        homset_cat = A.category()
        cat = Category.join([homset_cat.hom_category(), Rings()])
        Ring.__init__(self, A.base_ring())
        Homspace.__init__(self, A, A, cat=homset_cat)
        self._refine_category_(Rings())
        if gens is None:
            self._gens = None
        else:
            self._gens = tuple([self._get_matrix(g) for g in gens])
        self._is_full_ring = gens is None
Exemplo n.º 32
0
    def __init__(self, crystals, **options):
        """
        TESTS::

            sage: C = crystals.Letters(['A',2])
            sage: B = crystals.DirectSum([C,C], keepkey=True)
            sage: B
            Direct sum of the crystals Family (The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2])
            sage: B.cartan_type()
            ['A', 2]

            sage: from sage.combinat.crystals.direct_sum import DirectSumOfCrystals
            sage: isinstance(B, DirectSumOfCrystals)
            True
        """
        if "keepkey" in options:
            keepkey = options["keepkey"]
        else:
            keepkey = False
        #        facade = options['facade']
        if keepkey:
            facade = False
        else:
            facade = True
        category = Category.meet([Category.join(crystal.categories()) for crystal in crystals])
        Parent.__init__(self, category=category)
        DisjointUnionEnumeratedSets.__init__(self, crystals, keepkey=keepkey, facade=facade)
        self.rename("Direct sum of the crystals %s" % (crystals,))
        self._keepkey = keepkey
        self.crystals = crystals
        if len(crystals) == 0:
            raise ValueError("The direct sum is empty")
        else:
            assert (crystal.cartan_type() == crystals[0].cartan_type() for crystal in crystals)
            self._cartan_type = crystals[0].cartan_type()
        if keepkey:
            self.module_generators = [
                self(tuple([i, b])) for i in range(len(crystals)) for b in crystals[i].module_generators
            ]
        else:
            self.module_generators = sum((list(B.module_generators) for B in crystals), [])
Exemplo n.º 33
0
    def __init__(self, category, *args):
        """
        TESTS::

            sage: from sage.categories.covariant_functorial_construction import CovariantConstructionCategory
            sage: class FooBars(CovariantConstructionCategory):
            ...       pass
            sage: C = FooBars(ModulesWithBasis(QQ))
            sage: C
            Category of foo bars of modules with basis over Rational Field
            sage: C.base_category()
            Category of modules with basis over Rational Field
            sage: latex(C)
            \mathbf{FooBars}(\mathbf{ModulesWithBasis}_{\Bold{Q}})
            sage: import __main__; __main__.FooBars = FooBars # Fake FooBars being defined in a python module
            sage: TestSuite(C).run()
        """
        assert isinstance(category, Category)
        Category.__init__(self)
        self._base_category = category
        self._args = args
Exemplo n.º 34
0
    def default_super_categories(cls, category):
        """
        Returns the default super categories of ``category.IsomorphicObjects()``

        Mathematical meaning: if `A` is the image of `B` by an
        isomorphism in the category `C`, then `A` is both a subobject
        of `B` and a quotient of `B` in the category `C`.

        INPUT:

         - ``cls`` -- the class ``IsomorphicObjectsCategory``
         - ``category`` -- a category `Cat`

        OUTPUT: a (join) category

        In practice, this returns ``category.Subobjects()`` and
        ``category.Quotients()``, joined together with the result of the method
        :meth:`RegressiveCovariantConstructionCategory.default_super_categories() <sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory.default_super_categories>`
        (that is the join of ``category`` and
        ``cat.IsomorphicObjects()`` for each ``cat`` in the super
        categories of ``category``).

        EXAMPLES:

        Consider ``category=Groups()``, which has ``cat=Monoids()`` as
        super category. Then, the image of a group `G'` by a group
        isomorphism is simultaneously a subgroup of `G`, a subquotient
        of `G`, a group by itself, and the image of `G` by a monoid
        isomorphism::

            sage: Groups().IsomorphicObjects().super_categories()
            [Category of groups,
             Category of subquotients of monoids,
             Category of quotients of semigroups,
             Category of isomorphic objects of sets]

        Mind the last item above: there is indeed currently nothing
        implemented about isomorphic objects of monoids.

        This resulted from the following call::

            sage: sage.categories.isomorphic_objects.IsomorphicObjectsCategory.default_super_categories(Groups())
            Join of Category of groups and
            Category of subquotients of monoids and
            Category of quotients of semigroups and
            Category of isomorphic objects of sets
        """
        return Category.join([
            category.Subobjects(),
            category.Quotients(),
            super(IsomorphicObjectsCategory,
                  cls).default_super_categories(category)
        ])
Exemplo n.º 35
0
    def _latex_(self):
        """
        Return a latex representation of ``self``.

        EXAMPLES::

            sage: print Bimodules(QQ, ZZ)._latex_()
            {\mathbf{Bimodules}}_{\Bold{Q}, \Bold{Z}}
        """
        from sage.misc.latex import latex
        return "{{{0}}}_{{{1}, {2}}}".format(Category._latex_(self),
                                             latex(self._left_base_ring),
                                             latex(self._right_base_ring))
Exemplo n.º 36
0
    def _latex_(self):
        """
        Return a latex representation of ``self``.

        EXAMPLES::

            sage: print(Bimodules(QQ, ZZ)._latex_())
            {\mathbf{Bimodules}}_{\Bold{Q}, \Bold{Z}}
        """
        from sage.misc.latex import latex
        return "{{{0}}}_{{{1}, {2}}}".format(Category._latex_(self),
                                             latex(self._left_base_ring),
                                             latex(self._right_base_ring))
    def super_categories(self):
        """
        Returns the super categories of a construction category

        EXAMPLES::

            sage: Sets().Subquotients().super_categories()
            [Category of sets]
            sage: Semigroups().Quotients().super_categories()
            [Category of subquotients of semigroups, Category of quotients of sets]
        """
        return Category.join(self.extra_super_categories() +
                             [self.__class__.default_super_categories(self.base_category(), *self._args)],
                             as_list = True)
Exemplo n.º 38
0
    def __init__(self, order, cache=None, category=None):
        """
        Create with the command ``IntegerModRing(order)``.

        TESTS::

            sage: FF = IntegerModRing(29)
            sage: TestSuite(FF).run()
            sage: F19 = IntegerModRing(19, category = Fields())
            sage: TestSuite(F19).run()
            sage: F23 = IntegerModRing(23)
            sage: F23 in Fields()
            True
            sage: TestSuite(F23).run()
            sage: Z16 = IntegerModRing(16)
            sage: TestSuite(Z16).run()
            sage: R = Integers(100000)
            sage: TestSuite(R).run()  # long time (17s on sage.math, 2011)
        """
        order = ZZ(order)
        if order <= 0:
            raise ZeroDivisionError("order must be positive")
        self.__order = order
        self._pyx_order = integer_mod.NativeIntStruct(order)
        if category is None:
            from sage.categories.commutative_rings import CommutativeRings
            from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
            from sage.categories.category import Category
            category = Category.join([CommutativeRings(), FiniteEnumeratedSets()])
#            category = default_category
        # If the category is given then we trust that is it right.
        # Give the generator a 'name' to make quotients work.  The
        # name 'x' is used because it's also used for the ring of
        # integers: see the __init__ method for IntegerRing_class in
        # sage/rings/integer_ring.pyx.
        quotient_ring.QuotientRing_generic.__init__(self, ZZ, ZZ.ideal(order),
                                                    names=('x',),
                                                    category=category)
        # Calling ParentWithGens is not needed, the job is done in
        # the quotient ring initialisation.
        #ParentWithGens.__init__(self, self, category = category)
        # We want that the ring is its own base ring.
        self._base = self
        if cache is None:
            cache = order < 500
        if cache:
            self._precompute_table()
        self._zero_element = integer_mod.IntegerMod(self, 0)
        self._one_element = integer_mod.IntegerMod(self, 1)
Exemplo n.º 39
0
    def default_super_categories(cls, category):
        """
        Returns the default super categories of ``category.IsomorphicObjects()``

        Mathematical meaning: if `A` is the image of `B` by an
        isomorphism in the category `C`, then `A` is both a subobject
        of `B` and a quotient of `B` in the category `C`.

        INPUT:

         - ``cls`` -- the class ``IsomorphicObjectsCategory``
         - ``category`` -- a category `Cat`

        OUTPUT: a (join) category

        In practice, this returns ``category.Subobjects()`` and
        ``category.Quotients()``, joined together with the result of the method
        :meth:`RegressiveCovariantConstructionCategory.default_super_categories() <sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory.default_super_categories>`
        (that is the join of ``category`` and
        ``cat.IsomorphicObjects()`` for each ``cat`` in the super
        categories of ``category``).

        EXAMPLES:

        Consider ``category=Groups()``, which has ``cat=Monoids()`` as
        super category. Then, the image of a group `G'` by a group
        isomorphism is simultaneously a subgroup of `G`, a subquotient
        of `G`, a group by itself, and the image of `G` by a monoid
        isomorphism::

            sage: Groups().IsomorphicObjects().super_categories()
            [Category of groups,
             Category of subquotients of monoids,
             Category of quotients of semigroups,
             Category of isomorphic objects of sets]

        Mind the last item above: there is indeed currently nothing
        implemented about isomorphic objects of monoids.

        This resulted from the following call::

            sage: sage.categories.isomorphic_objects.IsomorphicObjectsCategory.default_super_categories(Groups())
            Join of Category of groups and
            Category of subquotients of monoids and
            Category of quotients of semigroups and
            Category of isomorphic objects of sets
        """
        return Category.join([category.Subobjects(), category.Quotients(),
                              super(IsomorphicObjectsCategory, cls).default_super_categories(category)])
Exemplo n.º 40
0
    def __init__(self, crystals, generators, cartan_type):
        """
        EXAMPLES::

            sage: C = crystals.Letters(['A',2])
            sage: T = crystals.TensorProduct(C,C,C,generators=[[C(2),C(1),C(1)]])
            sage: TestSuite(T).run()
        """
        assert isinstance(crystals, tuple)
        assert isinstance(generators, tuple)
        category = Category.meet([crystal.category() for crystal in crystals])
        Parent.__init__(self, category=category)
        self.crystals = crystals
        self._cartan_type = cartan_type
        self.module_generators = tuple([self(*x) for x in generators])
Exemplo n.º 41
0
    def __init__(self, crystals, generators, cartan_type):
        """
        EXAMPLES::

            sage: C = crystals.Letters(['A',2])
            sage: T = crystals.TensorProduct(C,C,C,generators=[[C(2),C(1),C(1)]])
            sage: TestSuite(T).run()
        """
        assert isinstance(crystals, tuple)
        assert isinstance(generators, tuple)
        category = Category.meet([crystal.category() for crystal in crystals])
        Parent.__init__(self, category = category)
        self.crystals = crystals
        self._cartan_type = cartan_type
        self.module_generators = tuple([self(*x) for x in generators])
Exemplo n.º 42
0
    def _test_homsets_category(self, **options):
        r"""
        Run generic tests on this homsets category

        .. SEEALSO:: :class:`TestSuite`.

        EXAMPLES::

            sage: Sets().Homsets()._test_homsets_category()
        """
        # TODO: remove if unneeded
        #from sage.categories.objects    import Objects
        #from sage.categories.sets_cat import Sets
        tester = self._tester(**options)
        tester.assert_(self.is_subcategory(Category.join(self.base_category().structure()).Homsets()))
Exemplo n.º 43
0
    def default_super_categories_yacop(cls, category, *args):
        """
        TESTS::

            sage: import yacop

            sage: # an earlier version of this hack broke the MRO for quasi symmetric functions:
            sage: QuasiSymmetricFunctions(GF(3))
            Quasisymmetric functions over the Finite Field of size 3

        """
        sageresult = Category.join([
            category,
            super(RegressiveCovariantConstructionCategory,
                  cls).default_super_categories(category, *args)
        ])
        ans = sageresult
        if isinstance(ans, sage.categories.category.JoinCategory):
            j = [
                cat for cat in sageresult.super_categories()
                if not hasattr(cat, "yacop_no_default_inheritance")
            ]
            ans = Category.join(j)
        return ans
Exemplo n.º 44
0
    def _test_homsets_category(self, **options):
        r"""
        Run generic tests on this homsets category

        .. SEEALSO:: :class:`TestSuite`.

        EXAMPLES::

            sage: Sets().Homsets()._test_homsets_category()
        """
        # TODO: remove if unneeded
        #from sage.categories.objects    import Objects
        #from sage.categories.sets_cat import Sets
        tester = self._tester(**options)
        tester.assertTrue(self.is_subcategory(Category.join(self.base_category().structure()).Homsets()))
        tester.assertTrue(self.is_subcategory(Homsets()))
Exemplo n.º 45
0
    def default_super_categories(cls, category):
        """
        Return the default super categories of ``category.Homsets()``

        INPUT:

         - ``cls`` -- the category class for the functor `F`
         - ``category`` -- a category `Cat`

        OUTPUT: a category

        .. TODO:: adapt everything below

        The default implementation is to return the join of the
        categories of `F(A,B,...)` for `A,B,...` in turn in each of
        the super categories of ``category``.

        This is implemented as a class method, in order to be able to
        reconstruct the functorial category associated to each of the
        super categories of ``category``.

        EXAMPLES::

            sage: AdditiveMagmas().Homsets().super_categories()
            [Category of additive magmas]
            sage: AdditiveMagmas().AdditiveUnital().Homsets().super_categories()
            [Category of additive unital additive magmas]

        For now nothing specific is implemented for homsets of
        additive groups compared to homsets of monoids::

            sage: from sage.categories.additive_groups import AdditiveGroups
            sage: AdditiveGroups().Homsets()
            Category of homsets of additive monoids

        Similarly for rings; so a ring homset is a homset of unital
        magmas and additive magmas::

            sage: Rings().Homsets()
            Category of homsets of unital magmas and additive unital additive magmas
        """
        return Category.join([getattr(cat, cls._functor_category)()
                              for cat in category.full_super_categories()])
Exemplo n.º 46
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: from sage.categories.magmatic_algebras import MagmaticAlgebras
            sage: MagmaticAlgebras(ZZ).super_categories()
            [Category of additive commutative additive associative additive unital distributive magmas and additive magmas, Category of modules over Integer Ring]

            sage: from sage.categories.additive_semigroups import AdditiveSemigroups
            sage: MagmaticAlgebras(ZZ).is_subcategory((AdditiveSemigroups() & Magmas()).Distributive())
            True

        """
        R = self.base_ring()
        # Note: The specifications impose `self` to be a subcategory
        # of the join of its super categories. Here the join is non
        # trivial, since some of the axioms of Modules (like the
        # commutativity of '+') are added to the left hand side.  We
        # might want the infrastructure to take this join for us.
        return Category.join([(Magmas() & AdditiveMagmas()).Distributive(), Modules(R)], as_list=True)
Exemplo n.º 47
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: from sage.categories.magmatic_algebras import MagmaticAlgebras
            sage: MagmaticAlgebras(ZZ).super_categories()
            [Category of additive commutative additive associative additive unital distributive magmas and additive magmas, Category of modules over Integer Ring]

            sage: from sage.categories.additive_semigroups import AdditiveSemigroups
            sage: MagmaticAlgebras(ZZ).is_subcategory((AdditiveSemigroups() & Magmas()).Distributive())
            True

        """
        R = self.base_ring()
        # Note: The specifications impose `self` to be a subcategory
        # of the join of its super categories. Here the join is non
        # trivial, since some of the axioms of Modules (like the
        # commutativity of '+') are added to the left hand side.  We
        # might want the infrastructure to take this join for us.
        return Category.join([(Magmas() & AdditiveMagmas()).Distributive(), Modules(R)], as_list=True)
Exemplo n.º 48
0
    def default_super_categories(cls, category):
        """
        Return the default super categories of ``category.Metric()``.

        Mathematical meaning: if `A` is a metric space in the
        category `C`, then `A` is also a topological space.

        INPUT:

        - ``cls`` -- the class ``MetricSpaces``
        - ``category`` -- a category `Cat`

        OUTPUT:

        A (join) category

        In practice, this returns ``category.Metric()``, joined
        together with the result of the method
        :meth:`RegressiveCovariantConstructionCategory.default_super_categories()
        <sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory.default_super_categories>`
        (that is the join of ``category`` and ``cat.Metric()`` for
        each ``cat`` in the super categories of ``category``).

        EXAMPLES:

        Consider ``category=Groups()``. Then, a group `G` with a metric
        is simultaneously a topological group by itself, and a
        metric space::

            sage: Groups().Metric().super_categories()
            [Category of topological groups, Category of metric spaces]

        This resulted from the following call::

            sage: sage.categories.metric_spaces.MetricSpacesCategory.default_super_categories(Groups())
            Join of Category of topological groups and Category of metric spaces
        """
        return Category.join([
            category.Topological(),
            super(MetricSpacesCategory, cls).default_super_categories(category)
        ])
    def category_from_categories(self, categories):
        """
        Returns the category of `F(A,B,C)` for `A,B,C` parents in the given categories

        INPUT:

         - ``self``: a functor `F`
         - ``categories``: a non empty tuple of categories

        EXAMPLES::

            sage: Cat1 = Rings()
            sage: Cat2 = Groups()
            sage: cartesian_product.category_from_categories((Cat1, Cat1, Cat1))
            Category of Cartesian products of monoids

            sage: cartesian_product.category_from_categories((Cat1, Cat2))
            Category of Cartesian products of monoids
        """
        assert(len(categories) > 0)
        return self.category_from_category(Category.meet(categories))
Exemplo n.º 50
0
    def default_super_categories(cls, category, *args):
        r"""
        Return the default super categories of ``category.Graded()``.

        Mathematical meaning: every graded object (module, algebra,
        etc.) is a filtered object with the (implicit) filtration
        defined by `F_i = \bigoplus_{j \leq i} G_j`.

        INPUT:

        - ``cls`` -- the class ``GradedModulesCategory``
        - ``category`` -- a category

        OUTPUT: a (join) category

        In practice, this returns ``category.Filtered()``, joined
        together with the result of the method
        :meth:`RegressiveCovariantConstructionCategory.default_super_categories() <sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory.default_super_categories>`
        (that is the join of ``category.Filtered()`` and ``cat`` for
        each ``cat`` in the super categories of ``category``).

        EXAMPLES:

        Consider ``category=Algebras()``, which has ``cat=Modules()``
        as super category. Then, a grading of an algebra `G`
        is also a filtration of `G`::

            sage: Algebras(QQ).Graded().super_categories()
            [Category of filtered algebras over Rational Field,
             Category of graded modules 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
        """
        cat = super(GradedModulesCategory,
                    cls).default_super_categories(category, *args)
        return Category.join([category.Filtered(), cat])
Exemplo n.º 51
0
    def default_super_categories(cls, category):
        """
        Return the default super categories of ``category.Metric()``.

        Mathematical meaning: if `A` is a metric space in the
        category `C`, then `A` is also a topological space.

        INPUT:

        - ``cls`` -- the class ``MetricSpaces``
        - ``category`` -- a category `Cat`

        OUTPUT:

        A (join) category

        In practice, this returns ``category.Metric()``, joined
        together with the result of the method
        :meth:`RegressiveCovariantConstructionCategory.default_super_categories()
        <sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory.default_super_categories>`
        (that is the join of ``category`` and ``cat.Metric()`` for
        each ``cat`` in the super categories of ``category``).

        EXAMPLES:

        Consider ``category=Groups()``. Then, a group `G` with a metric
        is simultaneously a topological group by itself, and a
        metric space::

            sage: Groups().Metric().super_categories()
            [Category of topological groups, Category of metric spaces]

        This resulted from the following call::

            sage: sage.categories.metric_spaces.MetricSpacesCategory.default_super_categories(Groups())
            Join of Category of topological groups and Category of metric spaces
        """
        return Category.join([category.Topological(),
                              super(MetricSpacesCategory, cls).default_super_categories(category)])
Exemplo n.º 52
0
    def default_super_categories(cls, category, *args):
        r"""
        Return the default super categories of ``category.Graded()``.

        Mathematical meaning: every graded object (module, algebra,
        etc.) is a filtered object with the (implicit) filtration
        defined by `F_i = \bigoplus_{j \leq i} G_j`.

        INPUT:

        - ``cls`` -- the class ``GradedModulesCategory``
        - ``category`` -- a category

        OUTPUT: a (join) category

        In practice, this returns ``category.Filtered()``, joined
        together with the result of the method
        :meth:`RegressiveCovariantConstructionCategory.default_super_categories() <sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory.default_super_categories>`
        (that is the join of ``category.Filtered()`` and ``cat`` for
        each ``cat`` in the super categories of ``category``).

        EXAMPLES:

        Consider ``category=Algebras()``, which has ``cat=Modules()``
        as super category. Then, a grading of an algebra `G`
        is also a filtration of `G`::

            sage: Algebras(QQ).Graded().super_categories()
            [Category of filtered algebras over Rational Field,
             Category of graded modules 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
        """
        cat = super(GradedModulesCategory, cls).default_super_categories(category, *args)
        return Category.join([category.Filtered(), cat])