コード例 #1
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: PolyhedralSets(QQ).super_categories()
            [Category of magmas, Category of additive magmas]
        """
        from sage.categories.all import Magmas, AdditiveMagmas
        return [Magmas(), AdditiveMagmas()]
コード例 #2
0
    def __init__(self, generators):
        r"""
        TESTS::

            sage: sys.path.append(os.getcwd()); from mac_lane import * # optional: standalone
            sage: isinstance(DiscreteValueSemigroup([0]), DiscreteValueSemigroup)
            True

        """
        from sage.categories.all import AdditiveMagmas
        self._generators = generators

        category = AdditiveMagmas().AdditiveAssociative().AdditiveUnital()
        if all([-g in generators for g in generators]):
            # check whether this is trivially a group
            # is_group() performs a complete check that is very costly and
            # refines the category
            category = category.AdditiveInverse()

        # We can not set the facade to DiscreteValuationCodomain since there
        # are some issues with iterated facades currently
        Parent.__init__(self, facade=QQ, category=category)