Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit aff2689

Browse files
committed
17160: fixed category for finite set endomaps + minor __init__ refactoring
1 parent cf9b429 commit aff2689

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/sage/sets/finite_set_maps.py

+17-17
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
from sage.rings.integer import Integer
2323
from sage.structure.unique_representation import UniqueRepresentation
2424
from sage.categories.sets_cat import Sets, EmptySetError
25-
from sage.categories.finite_monoids import FiniteMonoids
26-
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
25+
from sage.categories.monoids import Monoids
26+
from sage.categories.enumerated_sets import EnumeratedSets
2727
from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
2828
from sage.combinat.cartesian_product import CartesianProduct
2929
from sage.sets.integer_range import IntegerRange
@@ -117,7 +117,7 @@ class FiniteSetMaps(UniqueRepresentation, Parent):
117117
This makes `M` into a monoid::
118118
119119
sage: M.category()
120-
Category of finite monoids
120+
Join of Category of finite monoids and Category of finite enumerated sets
121121
sage: M.one()
122122
map: 1 -> 1, 2 -> 2, 3 -> 3
123123
@@ -216,7 +216,7 @@ class FiniteSetMaps_MN(FiniteSetMaps):
216216
217217
- ``category`` -- the category in which the sets of maps is
218218
constructed. It must be a sub-category of
219-
``FiniteEnumeratedSets()`` which is the default value.
219+
``EnumeratedSets().Finite()`` which is the default value.
220220
"""
221221

222222
def __init__(self, m, n, category=None):
@@ -231,7 +231,7 @@ def __init__(self, m, n, category=None):
231231
sage: TestSuite(M).run()
232232
"""
233233
Parent.__init__(self,
234-
category=FiniteEnumeratedSets().or_subcategory(category))
234+
category=EnumeratedSets().Finite().or_subcategory(category))
235235
self._m = Integer(m)
236236
self._n = Integer(n)
237237

@@ -378,8 +378,8 @@ class FiniteSetMaps_Set(FiniteSetMaps_MN):
378378
- ``codomain`` -- an object in the category ``FiniteSets()``.
379379
380380
- ``category`` -- the category in which the sets of maps is
381-
constructed. It must be a sub-category of ``FiniteEnumeratedSets()``
382-
which is the default value.
381+
constructed. It must be a sub-category of
382+
``EnumeratedSets().Finite`` which is the default value.
383383
"""
384384
def __init__(self, domain, codomain, category=None):
385385
"""
@@ -488,8 +488,8 @@ class FiniteSetEndoMaps_N(FiniteSetMaps_MN):
488488
- ``n`` -- an integer.
489489
490490
- ``category`` -- the category in which the sets of maps is
491-
constructed. It must be a sub-category of ``FiniteMonoids()``
492-
which is the default value.
491+
constructed. It must be a sub-category of ``Monoids().Finite()``
492+
and ``EnumeratedSets().Finite()`` which is the default value.
493493
"""
494494

495495
def __init__(self, n, action, category=None):
@@ -498,14 +498,13 @@ def __init__(self, n, action, category=None):
498498
499499
sage: M = FiniteSetMaps(3)
500500
sage: M.category()
501-
Category of finite monoids
501+
Join of Category of finite monoids and Category of finite enumerated sets
502502
sage: M.__class__
503503
<class 'sage.sets.finite_set_maps.FiniteSetEndoMaps_N_with_category'>
504504
sage: TestSuite(M).run()
505505
"""
506-
Parent.__init__(self, category=FiniteMonoids().or_subcategory(category))
507-
self._m = n
508-
self._n = n
506+
category = (EnumeratedSets() & Monoids().Finite()).or_subcategory(category)
507+
FiniteSetMaps_MN.__init__(self, n, n, category=category)
509508
self._action = action
510509

511510
@cached_method
@@ -554,22 +553,23 @@ class FiniteSetEndoMaps_Set(FiniteSetMaps_Set, FiniteSetEndoMaps_N):
554553
- ``domain`` -- an object in the category ``FiniteSets()``.
555554
556555
- ``category`` -- the category in which the sets of maps is
557-
constructed. It must be a sub-category of ``FiniteMonoids()``
558-
which is the default value.
556+
constructed. It must be a sub-category of ``Monoids().Finite()``
557+
and ``EnumeratedSets().Finite()`` which is the default value.
559558
"""
560559
def __init__(self, domain, action, category=None):
561560
"""
562561
TESTS::
563562
564563
sage: M = FiniteSetMaps(["a", "b", "c"])
565564
sage: M.category()
566-
Category of finite monoids
565+
Join of Category of finite monoids and Category of finite enumerated sets
567566
sage: M.__class__
568567
<class 'sage.sets.finite_set_maps.FiniteSetEndoMaps_Set_with_category'>
569568
sage: TestSuite(M).run()
570569
"""
570+
category = (EnumeratedSets() & Monoids().Finite()).or_subcategory(category)
571571
FiniteSetMaps_MN.__init__(self, domain.cardinality(), domain.cardinality(),
572-
category=FiniteMonoids().or_subcategory(category))
572+
category=category)
573573

574574
self._domain = domain
575575
self._codomain = domain

0 commit comments

Comments
 (0)