Ticket #10668: trac10668-category_support_for_homsets.patch

File trac10668-category_support_for_homsets.patch, 40.8 KB (added by SimonKing, 11 years ago)

Category support for hom categories - depends on #10667

  • sage/categories/bimodules.py

    # HG changeset patch
    # User Simon King <simon.king@uni-jena.de>
    # Date 1295811794 -3600
    # Node ID a9793dccfdd287c4d367faf6df6091953987b91a
    # Parent  de4a05f5ccdf23e52fed33d84af18907244c0efa
    #10668: hom category refactory - preliminary version
    introduce hom_structure and full_subcategory_of
    
    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/bimodules.py
    a b  
    1414from sage.categories.category import Category
    1515from sage.categories.all import LeftModules, RightModules
    1616from sage.misc.cachefunc import cached_method
     17from sage.misc.lazy_attribute import lazy_attribute
    1718
    1819#?class Bimodules(Category_over_base_rng, Category_over_base_rng):
    1920class Bimodules(Category):
     
    4647        self._left_base_ring = left_base
    4748        self._right_base_ring = right_base
    4849
     50    # We can't define it as usual attribute in init,
     51    # since this would lead into an infinite recursion
     52    @lazy_attribute
     53    def hom_structure(self):
     54        return Bimodules(self._right_base_ring, self._left_base_ring)
     55
    4956    def an_object(self):
    5057        """
    5158        Example of a bimodule.
  • sage/categories/category.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/category.py
    a b  
    14631463            sage: HomCategory(Sets()).super_categories()
    14641464            [Category of hom sets in Category of sets with partial maps]
    14651465        """
     1466        from sage.categories.objects import Objects
    14661467        return Category.join(self.extra_super_categories() +
    1467                              [category.hom_category()
    1468                               for category in self.base_category.super_categories()],
     1468                             [Objects().hom_category()], #this is contained in Sets()
     1469#                             [category.hom_category()
     1470#                              for category in self.base_category.super_categories()],
    14691471                             as_list=True)
    14701472    @cached_method
    14711473    def extra_super_categories(self):
     
    14781480            sage: HomCategory(Sets()).extra_super_categories()
    14791481            []
    14801482        """
    1481         return []
     1483        try:
     1484            hom_structure = [self.base_category.hom_structure]
     1485        except AttributeError:
     1486            hom_structure = []
     1487        try:
     1488            full_cats = self.base_category.full_subcategory_of
     1489        except AttributeError:
     1490            full_cats = []
     1491        return hom_structure+[X.hom_category() for X in full_cats]
    14821492
    14831493
    14841494#############################################################
  • sage/categories/classical_crystals.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/classical_crystals.py
    a b  
    5151        running ._test_pickling() . . . pass
    5252        running ._test_some_elements() . . . pass
    5353    """
    54 
     54    full_subcategory_of = [FiniteCrystals(), HighestWeightCrystals()]
    5555    @cached_method
    5656    def super_categories(self):
    5757        r"""
  • sage/categories/commutative_additive_groups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/commutative_additive_groups.py
    a b  
    3131
    3232        sage: TestSuite(CommutativeAdditiveGroups()).run()
    3333    """
    34 
     34    full_subcategory_of = [CommutativeAdditiveMonoids()]
    3535    def an_object(self):
    3636        """
    3737        Example of a commutative additive group.
  • sage/categories/commutative_additive_monoids.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/commutative_additive_monoids.py
    a b  
    3232
    3333        sage: TestSuite(CommutativeAdditiveMonoids()).run()
    3434    """
    35 
     35    full_subcategory_of = [CommutativeAdditiveSemigroups()]
    3636    @cached_method
    3737    def super_categories(self):
    3838        """
  • sage/categories/commutative_additive_semigroups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/commutative_additive_semigroups.py
    a b  
    3535        sage: TestSuite(C).run()
    3636
    3737    """
    38 
     38    full_subcategory_of = [AdditiveMagmas()]
    3939    @cached_method
    4040    def super_categories(self):
    4141        """
  • sage/categories/commutative_algebra_ideals.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/commutative_algebra_ideals.py
    a b  
    1111#******************************************************************************
    1212
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415from category_types import Category_ideal, Category_in_ambient
    1516
    1617class CommutativeAlgebraIdeals(Category_ideal):
     
    8283        """
    8384        return self.ambient()
    8485
     86    @lazy_attribute
     87    def full_subcategory_of(self):
     88        from algebra_ideals import AlgebraIdeals
     89        R = self.algebra()
     90        return [AlgebraIdeals(R)]
     91
    8592    @cached_method
    8693    def super_categories(self):
    8794        """
  • sage/categories/commutative_algebras.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/commutative_algebras.py
    a b  
    1111#******************************************************************************
    1212
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415from category_types import Category_over_base_ring
    1516from algebras import Algebras
    1617
     
    6869        return super(CommutativeAlgebras, self).__contains__(A) or \
    6970            (A in Algebras(self.base_ring()) and hasattr(A, "is_commutative") and A.is_commutative())
    7071
     72    @lazy_attribute
     73    def full_subcategory_of(self):
     74        R = self.base_ring()
     75        return [Algebras(R)]
     76
    7177    @cached_method
    7278    def super_categories(self):
    7379        """
  • sage/categories/commutative_ring_ideals.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/commutative_ring_ideals.py
    a b  
    4848        if R not in CommutativeRings():
    4949            raise TypeError, "R (=%s) must be a commutative ring"%R
    5050        Category_ideal.__init__(self, R)
     51        from ring_ideals import RingIdeals
     52        self.full_subcategory_of = [RingIdeals(R)]
    5153
    5254    def an_object(self):
    5355        """
  • sage/categories/commutative_rings.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/commutative_rings.py
    a b  
    1313
    1414from sage.categories.category import Category
    1515from sage.misc.cachefunc import cached_method
     16from sage.misc.lazy_attribute import lazy_attribute
    1617
    1718class CommutativeRings(Category):
    1819    """
     
    5859        from sage.all import ZZ
    5960        return ZZ['x','y']
    6061
     62    @lazy_attribute
     63    def full_subcategory_of(self):
     64        from sage.categories.rings import Rings
     65        return [Rings()]
     66
    6167    @cached_method
    6268    def super_categories(self):
    6369        """
  • sage/categories/coxeter_groups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/coxeter_groups.py
    a b  
    9292        running ._test_simple_projections() . . . pass
    9393        running ._test_some_elements() . . . pass
    9494    """
    95 
     95    full_subcategory_of = [Groups()]
    9696    @cached_method
    9797    def super_categories(self):
    9898        """
  • sage/categories/division_rings.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/division_rings.py
    a b  
    1010
    1111from sage.categories.category import Category
    1212from sage.misc.cachefunc import cached_method
     13from sage.misc.lazy_attribute import lazy_attribute
    1314
    1415class DivisionRings(Category):
    1516    """
    1617    The category of division rings
    1718
    18     a division ring (or skew field) is a not necessarily commutative
     19    A division ring (or skew field) is a not necessarily commutative
    1920    ring where all non-zero elements have multiplicative inverses
    2021
    2122    EXAMPLES::
     
    4748        from sage.all import Frac, QQ
    4849        return Frac(QQ['x','y'])
    4950
     51    @lazy_attribute
     52    def full_subcategory_of(self):
     53        from sage.categories.domains import Domains
     54        return [Domains()]
     55
    5056    @cached_method
    5157    def super_categories(self):
    5258        """
  • sage/categories/domains.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/domains.py
    a b  
    4343        from sage.all import ZZ
    4444        return ZZ
    4545
     46    full_subcategory_of = [Rings()]
     47
    4648    @cached_method
    4749    def super_categories(self):
    4850        """
  • sage/categories/enumerated_sets.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/enumerated_sets.py
    a b  
    9595        from sage.all import NN
    9696        return NN
    9797
     98    full_subcategory_of = [Sets()]
     99
    98100    @cached_method
    99101    def super_categories(self):
    100102        """
  • sage/categories/euclidean_domains.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/euclidean_domains.py
    a b  
    4848        from sage.all import ZZ
    4949        return ZZ
    5050
     51    full_subcategory_of = [PrincipalIdealDomains()]
     52
    5153    @cached_method
    5254    def super_categories(self):
    5355        """
  • sage/categories/fields.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/fields.py
    a b  
    1313
    1414from sage.categories.category import Category
    1515from sage.misc.cachefunc import cached_method
     16from sage.categories.rings import Rings
    1617
    1718class Fields(Category):
    1819    """
     
    3940
    4041        sage: TestSuite(Fields()).run()
    4142    """
     43    full_subcategory_of = [Rings()]
     44
    4245    def an_object(self):
    4346        """
    4447        Example of a field
  • sage/categories/finite_coxeter_groups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_coxeter_groups.py
    a b  
    4545        sage: DihedralGroup(5)
    4646        Dihedral group of order 10 as a permutation group
    4747    """
     48    full_subcategory_of = [CoxeterGroups(), FiniteGroups()]
    4849
    4950    @cached_method
    5051    def super_categories(self):
  • sage/categories/finite_crystals.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_crystals.py
    a b  
    5151        running ._test_pickling() . . . pass
    5252        running ._test_some_elements() . . . pass
    5353    """
     54    full_subcategory_of = [Crystals()]
    5455
    5556    @cached_method
    5657    def super_categories(self):
  • sage/categories/finite_dimensional_algebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_dimensional_algebras_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import FiniteDimensionalModulesWithBasis, AlgebrasWithBasis
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class FiniteDimensionalAlgebrasWithBasis(Category_over_base_ring):
    1617    """
     
    4142        from sage.all import IwahoriHeckeAlgebraT
    4243        return IwahoriHeckeAlgebraT("A3",1,prefix = "s", base_ring=self.base())
    4344
     45    @lazy_attribute
     46    def full_subcategory_of(self):
     47        return [AlgebrasWithBasis(self.base_ring())]
     48
    4449    @cached_method
    4550    def super_categories(self):
    4651        """
  • sage/categories/finite_dimensional_bialgebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_dimensional_bialgebras_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import FiniteDimensionalAlgebrasWithBasis, FiniteDimensionalCoalgebrasWithBasis, Bialgebras
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class FiniteDimensionalBialgebrasWithBasis(Category_over_base_ring):
    1617    """
     
    3031
    3132        sage: TestSuite(FiniteDimensionalBialgebrasWithBasis(ZZ)).run(skip=["_test_a_morphism", "_test_an_object", "_test_hom_category", "_test_morphisms", "_test_objects"])
    3233    """
     34    @lazy_attribute
     35    def full_subcategory_of(self):
     36        return [Bialgebras(self.base_ring())]
    3337
    3438    @cached_method
    3539    def super_categories(self):
  • sage/categories/finite_dimensional_coalgebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_dimensional_coalgebras_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import FiniteDimensionalModulesWithBasis, CoalgebrasWithBasis
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class FiniteDimensionalCoalgebrasWithBasis(Category_over_base_ring):
    1617    """
     
    3031
    3132        sage: TestSuite(FiniteDimensionalCoalgebrasWithBasis(ZZ)).run(skip=["_test_a_morphism", "_test_an_object", "_test_hom_category", "_test_morphisms", "_test_objects"])
    3233    """
     34    @lazy_attribute
     35    def full_subcategory_of(self):
     36        return [CoalgebrasWithBasis(self.base_ring())]
    3337
    3438    @cached_method
    3539    def super_categories(self):
  • sage/categories/finite_dimensional_hopf_algebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_dimensional_hopf_algebras_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import FiniteDimensionalBialgebrasWithBasis, HopfAlgebrasWithBasis
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class FiniteDimensionalHopfAlgebrasWithBasis(Category_over_base_ring):
    1617    """
     
    3031
    3132        sage: TestSuite(FiniteDimensionalHopfAlgebrasWithBasis(ZZ)).run(skip = ["_test_a_morphism", "_test_an_object", "_test_hom_category", "_test_morphisms", "_test_objects"])
    3233    """
     34    @lazy_attribute
     35    def full_subcategory_of(self):
     36        return [HopfAlgebrasWithBasis(self.base_ring())]
    3337
    3438    @cached_method
    3539    def super_categories(self):
  • sage/categories/finite_dimensional_modules_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_dimensional_modules_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import ModulesWithBasis
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class FiniteDimensionalModulesWithBasis(Category_over_base_ring):
    1617    """
     
    4445
    4546        sage: TestSuite(FiniteDimensionalModulesWithBasis(ZZ)).run(skip=["_test_a_morphism", "_test_an_object", "_test_hom_category", "_test_morphisms", "_test_objects"])
    4647    """
     48    @lazy_attribute
     49    def full_subcategory_of(self):
     50        return [ModulesWithBasis(self.base_ring())]
     51
     52    @lazy_attribute
     53    def hom_structure(self):
     54        return self
    4755
    4856    @cached_method
    4957    def super_categories(self):
  • sage/categories/finite_enumerated_sets.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_enumerated_sets.py
    a b  
    3737        sage: C = FiniteEnumeratedSets()
    3838        sage: TestSuite(C).run()
    3939    """
     40    full_subcategory_of = [EnumeratedSets()]
    4041
    4142    @cached_method
    4243    def super_categories(self):
  • sage/categories/finite_fields.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_fields.py
    a b  
    5252        from sage.all import GF
    5353        return GF(5)
    5454
     55    @lazy_attribute
     56    def full_subcategory_of(self):
     57        from sage.categories.all import Fields
     58        return [Fields()]
     59
    5560    @cached_method
    5661    def super_categories(self):
    5762        """
  • sage/categories/finite_groups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_groups.py
    a b  
    8585    TODO: define an iterator compatible with GAP's list method
    8686    Does GAP provide such an iterator?
    8787    """
     88    full_subcategory_of = [Groups(), FiniteMonoids()]
     89
    8890    @cached_method
    8991    def super_categories(self):
    9092        r"""
  • sage/categories/finite_monoids.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_monoids.py
    a b  
    3030
    3131        sage: TestSuite(FiniteMonoids()).run()
    3232    """
     33    full_subcategory_of = [FiniteSemigroups(), Monoids()]
    3334
    3435    @cached_method
    3536    def super_categories(self):
  • sage/categories/finite_permutation_groups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_permutation_groups.py
    a b  
    104104        running ._test_prod() . . . pass
    105105        running ._test_some_elements() . . . pass
    106106    """
     107    full_subcategory_of = [FiniteGroups()]
     108
    107109    @cached_method
    108110    def super_categories(self):
    109111        r"""
  • sage/categories/finite_semigroups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_semigroups.py
    a b  
    9292        running ._test_pickling() . . . pass
    9393
    9494    """
     95    full_subcategory_of = [Semigroups()]
     96
    9597    @cached_method
    9698    def super_categories(self):
    9799        r"""
  • sage/categories/finite_weyl_groups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/finite_weyl_groups.py
    a b  
    5656        running ._test_simple_projections() . . . pass
    5757        running ._test_some_elements() . . . pass
    5858    """
     59    full_subcategory_of = [WeylGroups(), FiniteCoxeterGroups()]
    5960
    6061    @cached_method
    6162    def super_categories(self):
  • sage/categories/gcd_domains.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/gcd_domains.py
    a b  
    1010
    1111from sage.categories.category import Category
    1212from sage.misc.cachefunc import cached_method
     13from sage.misc.lazy_attribute import lazy_attribute
    1314
    1415class GcdDomains(Category):
    1516    """
     
    4142        from sage.all import ZZ
    4243        return ZZ
    4344
     45    @lazy_attribute
     46    def full_subcategory_of(self):
     47        return self.super_categories()
     48
    4449    @cached_method
    4550    def super_categories(self):
    4651        """
  • sage/categories/graded_algebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/graded_algebras_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import GradedAlgebras, GradedModulesWithBasis, AlgebrasWithBasis
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class GradedAlgebrasWithBasis(Category_over_base_ring):
    1617    """
     
    4849        from sage.all import SymmetricFunctionAlgebra
    4950        return SymmetricFunctionAlgebra(self.base())
    5051
     52    @lazy_attribute
     53    def full_subcategory_of(self):
     54        return [GradedAlgebras(self.base_ring())]
     55
    5156    @cached_method
    5257    def super_categories(self):
    5358        """
  • sage/categories/graded_bialgebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/graded_bialgebras_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import GradedBialgebras, GradedAlgebrasWithBasis, GradedCoalgebrasWithBasis
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class GradedBialgebrasWithBasis(Category_over_base_ring):
    1617    """
     
    3132
    3233        sage: TestSuite(GradedBialgebrasWithBasis(ZZ)).run(skip=["_test_a_morphism", "_test_an_object", "_test_hom_category", "_test_morphisms", "_test_objects"])
    3334    """
     35    @lazy_attribute
     36    def full_subcategory_of(self):
     37        return [GradedBialgebras(self.base_ring())]
    3438
    3539    @cached_method
    3640    def super_categories(self):
  • sage/categories/graded_coalgebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/graded_coalgebras_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import GradedCoalgebras, GradedModulesWithBasis, CoalgebrasWithBasis
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class GradedCoalgebrasWithBasis(Category_over_base_ring):
    1617    """
     
    4445        from sage.all import SymmetricFunctionAlgebra
    4546        return SymmetricFunctionAlgebra(self.base())
    4647
     48    @lazy_attribute
     49    def full_subcategory_of(self):
     50        return [GradedCoalgebras(self.base_ring())]
     51
    4752    @cached_method
    4853    def super_categories(self):
    4954        """
  • sage/categories/graded_hopf_algebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/graded_hopf_algebras_with_basis.py
    a b  
    1212from category_types import Category_over_base_ring
    1313from sage.categories.all import AbstractCategory, GradedHopfAlgebras, HopfAlgebrasWithBasis, GradedBialgebrasWithBasis
    1414from sage.misc.cachefunc import cached_method
     15from sage.misc.lazy_attribute import lazy_attribute
    1516
    1617class GradedHopfAlgebrasWithBasis(Category_over_base_ring):
    1718    """
     
    4142        from sage.all import SymmetricFunctionAlgebra
    4243        return SymmetricFunctionAlgebra(self.base(), basis='power')
    4344
     45    @lazy_attribute
     46    def full_subcategory_of(self):
     47        return [GradedHopfAlgebras(self.base_ring())]
    4448    @cached_method
    4549    def super_categories(self):
    4650        """
  • sage/categories/graded_modules.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/graded_modules.py
    a b  
    1212from category_types import Category_over_base_ring
    1313from sage.categories.all import Modules
    1414from sage.misc.cachefunc import cached_method
     15from sage.misc.lazy_attribute import lazy_attribute
    1516
    1617class GradedModules(Category_over_base_ring):
    1718    """
     
    4546        from sage.all import GradedAlgebras
    4647        return GradedAlgebras(self.base()).an_object()
    4748
     49    @lazy_attribute
     50    def hom_structure(self):
     51        return Modules(self.base_ring())
     52
    4853    @cached_method
    4954    def super_categories(self):
    5055        """
  • sage/categories/graded_modules_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/graded_modules_with_basis.py
    a b  
    1111from category_types import Category_over_base_ring
    1212from sage.categories.all import GradedModules, ModulesWithBasis
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class GradedModulesWithBasis(Category_over_base_ring):
    1617    """
     
    4344        """
    4445        from sage.all import GradedAlgebrasWithBasis
    4546        return GradedAlgebrasWithBasis(self.base()).an_object()
     47    @lazy_attribute
     48    def full_subcategory_of(self):
     49        return [GradedModules(self.base_ring())]
    4650
    4751    @cached_method
    4852    def super_categories(self):
  • sage/categories/groupoid.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/groupoid.py
    a b  
    1717
    1818from sage.categories.category import Category
    1919from sage.misc.cachefunc import cached_method
     20from sage.misc.lazy_attribute import lazy_attribute
    2021from sage.structure.parent import Parent
    2122from sage.structure.unique_representation import UniqueRepresentation
    2223
     
    208209
    209210    #def construction(self):
    210211    #    return (self.__class__, self.__G)
     212    @lazy_attribute
     213    def hom_structure(self):
     214        return self.__G.category()
    211215
    212216    @cached_method
    213217    def super_categories(self):
  • sage/categories/groups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/groups.py
    a b  
    3232
    3333        sage: TestSuite(Groups()).run()
    3434    """
     35    full_subcategory_of = [Monoids()]
    3536
    3637    @cached_method
    3738    def super_categories(self):
  • sage/categories/highest_weight_crystals.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/highest_weight_crystals.py
    a b  
    5454        running ._test_pickling() . . . pass
    5555        running ._test_some_elements() . . . pass
    5656    """
     57    full_subcategory_of = [Crystals()]
    5758
    5859    @cached_method
    5960    def super_categories(self):
  • sage/categories/hopf_algebras_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/hopf_algebras_with_basis.py
    a b  
    101101        sage: TestSuite(A).run()
    102102        sage: TestSuite(C).run()
    103103    """
     104    @lazy_attribute
     105    def full_subcategory_of(self):
     106        return [HopfAlgebras(self.base_ring())]
    104107
    105108    @cached_method
    106109    def super_categories(self):
  • sage/categories/infinite_enumerated_sets.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/infinite_enumerated_sets.py
    a b  
    4343        sage: C = InfiniteEnumeratedSets()
    4444        sage: TestSuite(C).run()
    4545    """
     46    full_subcategory_of = [EnumeratedSets()]
     47
    4648    @cached_method
    4749    def super_categories(self):
    4850        """
  • sage/categories/integral_domains.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/integral_domains.py
    a b  
    1010
    1111from sage.categories.category import Category
    1212from sage.misc.cachefunc import cached_method
     13from sage.misc.lazy_attribute import lazy_attribute
    1314
    1415class IntegralDomains(Category):
    1516    """
     
    3940        from sage.all import ZZ
    4041        return ZZ
    4142
     43    @lazy_attribute
     44    def full_subcategory_of(self):
     45        return self.super_categories()
     46
    4247    @cached_method
    4348    def super_categories(self):
    4449        """
  • sage/categories/left_modules.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/left_modules.py
    a b  
    1111from sage.categories.all import CommutativeAdditiveGroups
    1212from category_types import Category_over_base_ring
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516#?class LeftModules(Category_over_base_rng):
    1617class LeftModules(Category_over_base_ring):
     
    5556        from sage.all import span
    5657        return span([[1,2,3],[1,1,1]], self.base())
    5758
     59    @lazy_attribute
     60    def hom_structure(self):
     61        from sage.categories.right_modules import RightModules
     62        return RightModules(self.base_ring())
     63
    5864    @cached_method
    5965    def super_categories(self):
    6066        """
  • sage/categories/matrix_algebras.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/matrix_algebras.py
    a b  
    1212
    1313from category_types import Category_over_base_ring
    1414from sage.misc.cachefunc import cached_method
     15from sage.misc.lazy_attribute import lazy_attribute
    1516
    1617class MatrixAlgebras(Category_over_base_ring):
    1718    """
     
    3940        from sage.all import MatrixSpace
    4041        return MatrixSpace(self.base(),3)
    4142
     43    @lazy_attribute
     44    def full_subcategory_of(self):
     45        return [Algebras(self.base_ring())]
     46
    4247    @cached_method
    4348    def super_categories(self):
    4449        """
  • sage/categories/modules.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/modules.py
    a b  
    1414from sage.categories.all import Bimodules, HomCategory, Fields
    1515from category_types import Category_module
    1616from sage.misc.cachefunc import cached_method
     17from sage.misc.lazy_attribute import lazy_attribute
    1718
    1819class Modules(Category_module):
    1920    r"""
     
    133134        """
    134135        return self.base()**3
    135136
     137    @lazy_attribute
     138    def hom_structure(self):
     139        return self
     140
     141    @lazy_attribute
     142    def full_subcategory_of(self):
     143        return [Bimodules(self.base_ring(), self.base_ring())]
     144
    136145    @cached_method
    137146    def super_categories(self):
    138147        """
  • sage/categories/modules_with_basis.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/modules_with_basis.py
    a b  
    135135        from sage.all import span,ZZ
    136136        return span([[ZZ(1),ZZ(2),ZZ(3)],[ZZ(1),ZZ(1),ZZ(1)]], self._Category_over_base_ring__base)
    137137
     138    @lazy_attribute
     139    def full_subcategory_of(self):
     140        return [Modules(self.base_ring())]
     141
    138142    @cached_method
    139143    def super_categories(self):
    140144        """
  • sage/categories/monoid_algebras.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/monoid_algebras.py
    a b  
    1212
    1313from category_types import Category_over_base_ring
    1414from sage.misc.cachefunc import cached_method
     15from sage.misc.lazy_attribute import lazy_attribute
    1516
    1617class MonoidAlgebras(Category_over_base_ring):
    1718    """
     
    4445        from sage.all import GroupAlgebras
    4546        return GroupAlgebras(self.base()).an_object()
    4647
     48    @lazy_attribute
     49    def full_subcategory_of(self):
     50        return [Algebras(self.base_ring())]
     51
    4752    @cached_method
    4853    def super_categories(self):
    4954        """
  • sage/categories/monoids.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/monoids.py
    a b  
    4545        sage: TestSuite(C).run()
    4646
    4747    """
     48    full_subcategory_of = [Semigroups()]
     49
    4850    @cached_method
    4951    def super_categories(self):
    5052        """
  • sage/categories/number_fields.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/number_fields.py
    a b  
    6868        x = QQ['x'].gen()
    6969        return NumberField(x**3-x+1, 'k')
    7070
     71    full_subcategory_of = [Fields()]
     72
    7173    @cached_method
    7274    def super_categories(self):
    7375        """
  • sage/categories/objects.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/objects.py
    a b  
    9191        pass
    9292
    9393    class HomCategory(HomCategory):
    94         def extra_super_categories(self):
     94        def super_categories(self):
    9595            """
    9696            This declares that any homset `Hom(A, B)` for `A` and `B`
    9797            in the category of objects is a set.
     
    100100
    101101            EXAMPLES::
    102102
    103                 sage: Objects().hom_category().extra_super_categories()
     103                sage: Objects().hom_category().super_categories()
    104104                [Category of sets]
    105105            """
    106106            from sets_cat import Sets
  • sage/categories/principal_ideal_domains.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/principal_ideal_domains.py
    a b  
    4949        from sage.all import ZZ
    5050        return ZZ
    5151
     52    full_subcategory_of = [GcdDomains()]
     53
    5254    @cached_method
    5355    def super_categories(self):
    5456        """
  • sage/categories/quotient_fields.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/quotient_fields.py
    a b  
    1111from sage.categories.category import Category
    1212from sage.misc.cachefunc import cached_method
    1313from sage.misc.abstract_method import abstract_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516class QuotientFields(Category):
    1617    """
     
    4142        from sage.all import QQ
    4243        return QQ
    4344
     45    @lazy_attribute
     46    def full_subcategory_of(self):
     47        return self.super_categories()
     48
    4449    @cached_method
    4550    def super_categories(self):
    4651        """
  • sage/categories/right_modules.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/right_modules.py
    a b  
    1111from sage.categories.all import CommutativeAdditiveGroups
    1212from category_types import Category_over_base_ring
    1313from sage.misc.cachefunc import cached_method
     14from sage.misc.lazy_attribute import lazy_attribute
    1415
    1516##?class RightModules(Category_over_base_rng):
    1617class RightModules(Category_over_base_ring):
     
    5556        from sage.all import span
    5657        return span([[1,2,3],[1,1,1]], self.base())
    5758
     59    @lazy_attribute
     60    def hom_structure(self):
     61        from sage.categories.left_modules import LeftModules
     62        return LeftModules(self.base_ring())
    5863 
    5964    @cached_method
    6065    def super_categories(self):
  • sage/categories/ring_ideals.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/ring_ideals.py
    a b  
    1212
    1313from category_types import Category_ideal
    1414from sage.misc.cachefunc import cached_method
     15from sage.misc.lazy_attribute import lazy_attribute
    1516
    1617class RingIdeals(Category_ideal):
    1718    """
     
    7273        R = self.ambient()
    7374        return R.ideal([x**2 for x in R.gens()])
    7475
     76    @lazy_attribute
     77    def full_subcategory_of(self):
     78        return [Modules(self.ring())]
     79
    7580    @cached_method
    7681    def super_categories(self):
    7782        """
  • sage/categories/rings.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/rings.py
    a b  
    1414from sage.categories.category import Category
    1515from category import HomCategory
    1616from sage.misc.cachefunc import cached_method
     17from sage.misc.lazy_attribute import lazy_attribute
    1718
    1819class Rings(Category):
    1920    """
     
    3940     - A parent P in the category ``Rings()`` should automatically be
    4041       in the category ``Algebras(P)``.
    4142    """
     43    @lazy_attribute
     44    def full_subcategory_of(self):
     45        return self.super_categories()
    4246
    4347    @cached_method
    4448    def super_categories(self):
     
    7377
    7478
    7579    class HomCategory(HomCategory):
    76         def extra_super_categories(self):
    77             """
    78             EXAMPLES::
    79 
    80                 sage: Rings().hom_category().extra_super_categories()
    81                 [Category of sets]
    82             """
    83             from sage.categories.sets_cat import Sets
    84             return [Sets()]
     80#        def extra_super_categories(self):
     81#            """
     82#            EXAMPLES::
     83#
     84#                sage: Rings().hom_category().extra_super_categories()
     85#                [Category of sets]
     86#            """
     87#            from sage.categories.sets_cat import Sets
     88#            return [Sets()]
    8589
    8690#         def get_Parent(self, X, Y):
    8791#             """
  • sage/categories/semigroups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/semigroups.py
    a b  
    8888        running ._test_pickling() . . . pass
    8989
    9090    """
     91    full_subcategory_of = [Magmas()]
     92
    9193    @cached_method
    9294    def super_categories(self):
    9395        """
  • sage/categories/sets_cat.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/sets_cat.py
    a b  
    155155          sage: TestSuite(Set([])).run()
    156156
    157157    """
    158 
     158    full_subcategory_of = [SetsWithPartialMaps()]
    159159    @cached_method
    160160    def super_categories(self):
    161161        r"""
  • sage/categories/sets_with_partial_maps.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/sets_with_partial_maps.py
    a b  
    1212
    1313from sage.categories.category import Category, HomCategory
    1414from sage.misc.cachefunc import cached_method
     15from objects import Objects
    1516
    1617class SetsWithPartialMaps(Category):
    1718    """
     
    3940    #def __call__(self, X, pt):
    4041    #    import sage.sets.all
    4142    #    return sage.sets.all.Set(X, pt)
    42 
    4343    def an_object(self):
    4444        """
    4545        An example of a set with partial maps.
  • sage/categories/unique_factorization_domains.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/unique_factorization_domains.py
    a b  
    1010
    1111from sage.categories.category import Category
    1212from sage.misc.cachefunc import cached_method
     13from sage.misc.lazy_attribute import lazy_attribute
    1314
    1415class UniqueFactorizationDomains(Category):
    1516    """
     
    3839
    3940        sage: TestSuite(UniqueFactorizationDomains()).run(skip=["_test_a_morphism", "_test_an_object", "_test_hom_category", "_test_morphisms", "_test_objects"])
    4041    """
     42    @lazy_attribute
     43    def full_subcategory_of(self):
     44        return self.super_categories()
    4145
    4246    @cached_method
    4347    def super_categories(self):
  • sage/categories/vector_spaces.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/vector_spaces.py
    a b  
    1515from sage.categories.all import Fields, Modules
    1616from sage.categories.dual import DualObjectsCategory
    1717from sage.misc.cachefunc import cached_method
     18from sage.misc.lazy_attribute import lazy_attribute
    1819
    1920class VectorSpaces(Category_module):
    2021    """
     
    9293        """
    9394        return self.base_ring()
    9495
     96    @lazy_attribute
     97    def full_subcategory_of(self):
     98        return self.super_categories()
     99
     100    @lazy_attribute
     101    def hom_structure(self):
     102        return self
     103
    95104    @cached_method
    96105    def super_categories(self):
    97106        """
  • sage/categories/weyl_groups.py

    diff -r de4a05f5ccdf -r a9793dccfdd2 sage/categories/weyl_groups.py
    a b  
    7878        r_ = ~r
    7979        return O.hom([r*x*r_ for x in O.gens()])
    8080
     81    full_subcategory_of = [CoxeterGroups()]
     82
    8183    @cached_method
    8284    def super_categories(self):
    8385        r"""