Sets With a Grading¶
-
sage.categories.sets_with_grading.
SetsWithGrading
¶ 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 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 \(S_i\) is the set of all integer partitions of \(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.
- This should be moved to