Ticket #10193: trac_10193-graded_sets-review-ts.patch

File trac_10193-graded_sets-review-ts.patch, 6.1 KB (added by tscrim, 5 years ago)
  • doc/en/reference/categories/index.rst

    # HG changeset patch
    # User Travis Scrimshaw <tscrim@ucdavis.edur>
    # Date 1370108567 25200
    # Node ID 4170de4ee06d49d4c58172dd2c491932678444a2
    # Parent a8eaf420567d0d93d30190ca99c82e3cc2bd9921
    #10193: review patch.
    
    diff --git a/doc/en/reference/categories/index.rst b/doc/en/reference/categories/index.rst
    a b Examples of parents using categories 
    163163   sage/categories/examples/semigroups_cython
    164164   sage/categories/examples/sets_cat
    165165   sage/categories/examples/with_realizations
     166   sage/categories/examples/sets_with_grading
    166167
    167168Miscellaneous
    168169=============
  • sage/categories/examples/sets_with_grading.py

    diff --git a/sage/categories/examples/sets_with_grading.py b/sage/categories/examples/sets_with_grading.py
    a b  
    11r"""
    2 An example of graded set: non-negative integers graded by themselves.
     2Example of a set with grading
    33"""
    44
    55from sage.structure.parent import Parent
  • sage/categories/sets_with_grading.py

    diff --git a/sage/categories/sets_with_grading.py b/sage/categories/sets_with_grading.py
    a b class SetsWithGrading(Category): 
    1919    r"""
    2020    The category of sets with a grading.
    2121
    22     An *set with a grading* is a set `S` equipped with a
    23     grading by some other set `I` (by default the set `\NN` of the non
    24     negative integers):
     22    A *set with a grading* is a set `S` equipped with a
     23    grading by some other set `I` (by default the set `\NN` of the
     24    non-negative integers):
    2525
    26     .. math::
     26    .. MATH::
    2727
    2828         S = \biguplus_{i\in I} S_i
    2929
    class SetsWithGrading(Category): 
    3131    sets. The *grading* function maps each element `s` of
    3232    `S` to its *grade* `i`, so that `s\in S_i`.
    3333
    34     From implementation point of vue, if the graded set is enumerated then each
    35     graded component should be enumerated (there is a check in the method
     34    From implementation point of view, if the graded set is enumerated then
     35    each graded component should be enumerated (there is a check in the method
    3636    :meth:`~SetsWithGrading.ParentMethods._test_graded_components`). The
    3737    contrary needs not be true.
    3838
     39    To implement this category, a parent must either implement
     40    :meth:`~SetsWithGrading.ParentMethods.graded_component()` or
     41    :meth:`~SetsWithGrading.ParentMethods.subset()`. If only
     42    :meth:`~SetsWithGrading.ParentMethods.subset()` is implemented, the first
     43    argument must be the grading for compatibility with
     44    :meth:`~SetsWithGrading.ParentMethods.graded_component()`. Additionally
     45    either the parent must implement
     46    :meth:`~SetsWithGrading.ParentMethods.grading()` or its elements must
     47    implement a method ``grade()``. See the example
     48    :class:`sage.categories.examples.sets_with_grading.NonNegativeIntegers`.
     49
     50    Finally, if the graded set is enumerated (see
     51    :class:`~sage.categories.enumerated_sets.EnumeratedSets`) then each graded
     52    component should be enumerated. The contrary needs not be true.
     53
    3954    EXAMPLES:
    4055
    41     A typical example of set with grading is the set of non-negative integers
    42     graded by themselves::
     56    A typical example of a set with a grading is the set of non-negative
     57    integers graded by themselves::
    4358
    4459        sage: N = SetsWithGrading().example(); N
    4560        Non negative integers
    4661        sage: N.category()
    4762        Category of facade sets with grading
    48 
    49     It is graded by `\NN`::
    50 
    5163        sage: N.grading_set()
    5264        Non negative integers
    5365
    class SetsWithGrading(Category): 
    7890
    7991    .. TODO::
    8092
    81         - This should be moved to Sets().WithGrading()
     93        - This should be moved to ``Sets().WithGrading()``.
    8294        - Should the grading set be a parameter for this category?
    8395        - Does the enumeration need to be compatible with the grading? Be
    8496          careful that the fact that graded components are allowed to be finite
    class SetsWithGrading(Category): 
    106118            r"""
    107119            Test that some graded components of ``self`` are parent with
    108120            initialized category and that the parent has a properly implemented
    109             ``grading`` method.
     121            ``grading()`` method.
    110122
    111123            EXAMPLES::
    112124
    class SetsWithGrading(Category): 
    124136
    125137        def grading_set(self):
    126138            """
    127             Returns the set ``self`` is graded by. By default, this is
    128             the set of non negative integers.
     139            Return the set ``self`` is graded by. By default, this is
     140            the set of non-negative integers.
    129141
    130142            EXAMPLES::
    131143
    class SetsWithGrading(Category): 
    141153        @abstract_method(optional=True)
    142154        def subset(self, *args, **options):
    143155            """
    144             Returns the subset of ``self`` described by the given parameters
     156            Return the subset of ``self`` described by the given parameters.
    145157
    146             See also: :meth:`graded_component`
     158            .. SEEALSO::
     159
     160                -:meth:`graded_component()`
    147161
    148162            EXAMPLES::
    149163
    class SetsWithGrading(Category): 
    157171            """
    158172            Return the graded component of ``self`` with grade ``grade``.
    159173
    160             The default implementation just calls the method :meth:`subset` with
    161             the argument ``grade``.
     174            The default implementation just calls the method :meth:`subset()`
     175            with the first argument ``grade``.
    162176
    163177            EXAMPLES::
    164178
    class SetsWithGrading(Category): 
    171185
    172186        def grading(self, elt):
    173187            """
    174             Return the grading of the element ``elt`` of self.`
     188            Return the grading of the element ``elt`` of ``self``.
    175189
    176190            This default implementation calls ``elt.grade()``.
    177191
    class SetsWithGrading(Category): 
    188202            """
    189203            Default implementation for generating series.
    190204
    191             OUTPUT: a series, indexed by the grading set
     205            OUTPUT:
     206
     207            A series, indexed by the grading set.
    192208
    193209            EXAMPLES::
    194210