Sets With a Grading¶
- class sage.categories.sets_with_grading.SetsWithGrading(s=None)¶
Bases:
sage.categories.category.Category
The category of sets with a grading.
A set with a grading is a set \(S\) equipped with a grading by some other set \(I\) (by default the set \(\NN\) of the non-negative integers):
\[S = \biguplus_{i\in I} S_i\]where the graded components \(S_i\) are (usually finite) sets. The grading function maps each element \(s\) of \(S\) to its grade \(i\), so that \(s\in S_i\).
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()
orsubset()
. If onlysubset()
is implemented, the first argument must be the grading for compatibility withgraded_component()
. Additionally either the parent must implementgrading()
or its elements must implement a methodgrade()
. See the examplesage.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 infinite 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 \(N_i\) is the set with one element \(i\):
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
This should be moved to
Sets().WithGrading()
.Should the grading set be a parameter for this category?
Does the enumeration need to be compatible with the grading? Be careful that the fact that graded components are allowed to be finite or infinite make the answer complicated.
- class ParentMethods¶
Bases:
object
- generating_series()¶
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)
- graded_component(grade)¶
Return the graded component of
self
with gradegrade
.The default implementation just calls the method
subset()
with the first argumentgrade
.EXAMPLES:
sage: N = SetsWithGrading().example(); N Non negative integers sage: N.graded_component(3) {3}
- grading(elt)¶
Return the grading of the element
elt
ofself
.This default implementation calls
elt.grade()
.EXAMPLES:
sage: N = SetsWithGrading().example(); N Non negative integers sage: N.grading(4) 4
- grading_set()¶
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
- subset(*args, **options)¶
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]
- super_categories()¶
EXAMPLES:
sage: SetsWithGrading().super_categories() [Category of sets]