Bases: sage.categories.category.Category
The category of sets with a grading.
A set with a grading is a set equipped with a
grading by some other set
(by default the set
of the
non-negative integers):
where the graded components are (usually finite)
sets. The grading function maps each element
of
to its grade
, so that
.
From implementation point of view, if the graded set is enumerated then each graded component should be enumerated (there is a check in the method _test_graded_components()). The contrary needs not be true.
To implement this category, a parent must either implement graded_component() or subset(). If only subset() is implemented, the first argument must be the grading for compatibility with graded_component(). Additionally either the parent must implement grading() or its elements must implement a method grade(). See the example sage.categories.examples.sets_with_grading.NonNegativeIntegers.
Finally, if the graded set is enumerated (see EnumeratedSets) then each graded component should be enumerated. The contrary needs not be true.
EXAMPLES:
A typical example of a set with a grading is the set of non-negative integers graded by themselves:
sage: N = SetsWithGrading().example(); N
Non negative integers
sage: N.category()
Category of facade sets with grading
sage: N.grading_set()
Non negative integers
The grading function is given by N.grading:
sage: N.grading(4)
4
The graded component is the set of all integer partitions of
:
sage: N.graded_component(grade = 5)
{5}
sage: N.graded_component(grade = 42)
{42}
Here are some information about this category:
sage: SetsWithGrading()
Category of sets with grading
sage: SetsWithGrading().super_categories()
[Category of sets]
sage: SetsWithGrading().all_super_categories()
[Category of sets with grading,
Category of sets,
Category of sets with partial maps,
Category of objects]
Todo
TESTS:
sage: C = SetsWithGrading()
sage: TestSuite(C).run()
Default implementation for generating series.
OUTPUT:
A series, indexed by the grading set.
EXAMPLES:
sage: N = SetsWithGrading().example(); N
Non negative integers
sage: N.generating_series()
1/(-z + 1)
Return the graded component of self with grade grade.
The default implementation just calls the method subset() with the first argument grade.
EXAMPLES:
sage: N = SetsWithGrading().example(); N
Non negative integers
sage: N.graded_component(3)
{3}
Return the grading of the element elt of self.
This default implementation calls elt.grade().
EXAMPLES:
sage: N = SetsWithGrading().example(); N
Non negative integers
sage: N.grading(4)
4
Return the set self is graded by. By default, this is the set of non-negative integers.
EXAMPLES:
sage: SetsWithGrading().example().grading_set()
Non negative integers
Return the subset of self described by the given parameters.
See also
EXAMPLES:
sage: W = WeightedIntegerVectors([3,2,1]); W
Integer vectors weighted by [3, 2, 1]
sage: W.subset(4)
Integer vectors of 4 weighted by [3, 2, 1]
EXAMPLES:
sage: SetsWithGrading().super_categories()
[Category of sets]