Homset categories¶
-
sage.categories.homsets.
Homsets
¶ The category of all homsets.
EXAMPLES:
sage: from sage.categories.homsets import Homsets sage: Homsets() Category of homsets
This is a subcategory of
Sets()
:sage: Homsets().super_categories() [Category of sets]
By this, we assume that all homsets implemented in Sage are sets, or equivalently that we only implement locally small categories. See Wikipedia article Category_(mathematics).
trac ticket #17364: every homset category shall be a subcategory of the category of all homsets:
sage: Schemes().Homsets().is_subcategory(Homsets()) True sage: AdditiveMagmas().Homsets().is_subcategory(Homsets()) True sage: AdditiveMagmas().AdditiveUnital().Homsets().is_subcategory(Homsets()) True
This is tested in
HomsetsCategory._test_homsets_category()
.
-
class
sage.categories.homsets.
HomsetsCategory
(category, *args)¶ Bases:
sage.categories.covariant_functorial_construction.FunctorialConstructionCategory
-
base
()¶ If this homsets category is subcategory of a category with a base, return that base.
Todo
Is this really useful?
EXAMPLES:
sage: ModulesWithBasis(ZZ).Homsets().base() Integer Ring
-
classmethod
default_super_categories
(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
As for the other functorial constructions, if
category
implements a nestedHomsets
class, this method is used in combination withcategory.Homsets().extra_super_categories()
to compute the super categories ofcategory.Homsets()
.EXAMPLES:
If
category
has one or more full super categories, then the join of their respective homsets category is returned. In this example, this join consists of a single category:sage: from sage.categories.homsets import HomsetsCategory sage: from sage.categories.additive_groups import AdditiveGroups sage: C = AdditiveGroups() sage: C.full_super_categories() [Category of additive inverse additive unital additive magmas, Category of additive monoids] sage: H = HomsetsCategory.default_super_categories(C); H Category of homsets of additive monoids sage: type(H) <class 'sage.categories.additive_monoids.AdditiveMonoids.Homsets_with_category'>
and, given that nothing specific is currently implemented for homsets of additive groups,
H
is directly the category thereof:sage: C.Homsets() Category of homsets of additive monoids
Similarly for rings: a ring homset is just a homset of unital magmas and additive magmas:
sage: Rings().Homsets() Category of homsets of unital magmas and additive unital additive magmas
Otherwise, if
category
implements a nested classHomsets
, this method returns the category of all homsets:sage: AdditiveMagmas.Homsets <class 'sage.categories.additive_magmas.AdditiveMagmas.Homsets'> sage: HomsetsCategory.default_super_categories(AdditiveMagmas()) Category of homsets
which gives one of the super categories of
category.Homsets()
:sage: AdditiveMagmas().Homsets().super_categories() [Category of additive magmas, Category of homsets] sage: AdditiveMagmas().AdditiveUnital().Homsets().super_categories() [Category of additive unital additive magmas, Category of homsets]
the other coming from
category.Homsets().extra_super_categories()
:sage: AdditiveMagmas().Homsets().extra_super_categories() [Category of additive magmas]
Finally, as a last resort, this method returns a stub category modelling the homsets of this category:
sage: hasattr(Posets, "Homsets") False sage: H = HomsetsCategory.default_super_categories(Posets()); H Category of homsets of posets sage: type(H) <class 'sage.categories.homsets.HomsetsOf_with_category'> sage: Posets().Homsets() Category of homsets of posets
-
-
sage.categories.homsets.
HomsetsOf
¶ Default class for homsets of a category.
This is used when a category \(C\) defines some additional structure but not a homset category of its own. Indeed, unlike for covariant functorial constructions, we cannot represent the homset category of \(C\) by just the join of the homset categories of its super categories.
EXAMPLES:
sage: C = (Magmas() & Posets()).Homsets(); C Category of homsets of magmas and posets sage: type(C) <class 'sage.categories.homsets.HomsetsOf_with_category'>