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

Commit f86824e

Browse files
committedOct 14, 2014
10668: documentation for HomsetsCategory.category_of + fixed typo in doctest nearby
1 parent 877bfdb commit f86824e

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed
 

‎src/sage/categories/homsets.py

+53-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,58 @@ class HomsetsCategory(FunctorialConstructionCategory):
2525
@classmethod
2626
@cached_function
2727
def category_of(cls, category, *args):
28+
"""
29+
Return the homsets category of ``category``.
30+
31+
This class method centralizes the construction of all homset
32+
categories.
33+
34+
The ``cls`` and ``args`` arguments below are essentially
35+
unused. Their purpose is solely to let the code deviate as
36+
little as possible from the generic implementation of this
37+
method: :meth:`FunctorialConstructionCategory.category_of`.
38+
39+
INPUT:
40+
41+
- ``cls`` -- :class:`HomsetsCategory` or a subclass thereof
42+
- ``category`` -- a category `Cat`
43+
- ``*args`` -- (unused)
44+
45+
EXAMPLES:
46+
47+
If ``category`` implements a ``Homsets`` class, then this
48+
class is used to build the homset category::
49+
50+
sage: from sage.categories.homsets import HomsetsCategory
51+
sage: H = HomsetsCategory.category_of(Modules(ZZ)); H
52+
Category of homsets of modules over Integer Ring
53+
sage: type(H)
54+
<class 'sage.categories.modules.Modules.Homsets_with_category'>
55+
56+
Otherwise, if ``category`` has one or more full super
57+
categories, then the join of their respecitve homsets category
58+
is returned. In this example, the join is trivial::
59+
60+
sage: C = Modules(ZZ).WithBasis().FiniteDimensional()
61+
sage: C.full_super_categories()
62+
[Category of modules with basis over Integer Ring,
63+
Category of finite dimensional modules over Integer Ring]
64+
sage: H = HomsetsCategory.category_of(C); H
65+
Category of homsets of modules with basis over Integer Ring
66+
sage: type(H)
67+
<class 'sage.categories.modules_with_basis.ModulesWithBasis.Homsets_with_category'>
68+
69+
As a last resort, a :class:`HomsetsOf` of categories forming
70+
the structure of ``self`` is constructed::
71+
72+
sage: H = HomsetsCategory.category_of(Magmas()); H
73+
Category of homsets of magmas
74+
sage: type(H)
75+
<class 'sage.categories.homsets.HomsetsOf_with_category'>
76+
77+
sage: HomsetsCategory.category_of(Rings())
78+
Category of homsets of unital magmas and additive unital additive magmas
79+
"""
2880
functor_category = getattr(category.__class__, cls._functor_category)
2981
if isinstance(functor_category, type) and issubclass(functor_category, Category):
3082
return functor_category(category, *args)
@@ -251,7 +303,7 @@ def extra_super_categories(self):
251303
EXAMPLES::
252304
253305
sage: from sage.categories.homsets import Homsets
254-
sage: Homsets().Endsets().extra_super_categories()
306+
sage: Homsets().Endset().extra_super_categories()
255307
[Category of monoids]
256308
"""
257309
from monoids import Monoids

0 commit comments

Comments
 (0)
This repository has been archived.