diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index a6227e29721..aeda3d54eb0 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -6123,18 +6123,30 @@ def conjugacy_class(self, g): from sage.groups.perm_gps.symgp_conjugacy_class import PermutationsConjugacyClass return PermutationsConjugacyClass(self, g) - def algebra(self, base_ring): + def algebra(self, base_ring, category=None): """ Return the symmetric group algebra associated to ``self``. + INPUT: + + - ``base_ring`` -- a ring + - ``category`` -- a category (default: the category of ``self``) + EXAMPLES:: sage: P = Permutations(4) - sage: P.algebra(QQ) + sage: A = P.algebra(QQ); A Symmetric group algebra of order 4 over Rational Field + + sage: A.category() + Join of Category of coxeter group algebras over Rational Field + and Category of finite group algebras over Rational Field + sage: A = P.algebra(QQ, category=Monoids()) + sage: A.category() + Category of finite dimensional monoid algebras over Rational Field """ from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra - return SymmetricGroupAlgebra(base_ring, self) + return SymmetricGroupAlgebra(base_ring, self, category=category) @cached_method def index_set(self): diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py index a7d3ffc71b0..367f6bf6edc 100644 --- a/src/sage/combinat/symmetric_group_algebra.py +++ b/src/sage/combinat/symmetric_group_algebra.py @@ -29,7 +29,7 @@ # TODO: Remove this function and replace it with the class # TODO: Create parents for other bases (such as the seminormal basis) -def SymmetricGroupAlgebra(R, W): +def SymmetricGroupAlgebra(R, W, category=None): """ Return the symmetric group algebra of order ``W`` over the ring ``R``. @@ -37,6 +37,8 @@ def SymmetricGroupAlgebra(R, W): - ``W`` -- a symmetric group; alternatively an integer `n` can be provided, as shorthand for ``Permutations(n)``. + - ``R`` -- a base ring + - ``category`` -- a category (default: the category of ``W``) This supports several implementations of the symmetric group. At this point this has been tested with ``W=Permutations(n)`` and @@ -169,6 +171,15 @@ def SymmetricGroupAlgebra(R, W): for multiplying permutations (these methods don't depend on the setting). See :trac:`14885` for more information. + We conclude by constructing the algebra of the symmetric group as + a monoid algebra:: + + sage: QS3 = SymmetricGroupAlgebra(QQ, 3, category=Monoids()) + sage: QS3.category() + Category of finite dimensional monoid algebras over Rational Field + sage: TestSuite(QS3).run() + + TESTS:: sage: QS3 = SymmetricGroupAlgebra(QQ, 3) @@ -202,11 +213,13 @@ def SymmetricGroupAlgebra(R, W): from sage.rings.semirings.non_negative_integer_semiring import NN if W in NN: W = Permutations(W) - return SymmetricGroupAlgebra_n(R, W) + if category is None: + category = W.category() + return SymmetricGroupAlgebra_n(R, W, category.Algebras(R)) class SymmetricGroupAlgebra_n(CombinatorialFreeModule): - def __init__(self, R, W): + def __init__(self, R, W, category): """ TESTS:: @@ -243,9 +256,8 @@ def __init__(self, R, W): self.n = len(W.one().fixed_points()) else: self.n = W.cartan_type().rank() + 1 - cat = W.category().Algebras(R) CombinatorialFreeModule.__init__(self, R, W, prefix='', - latex_prefix='', category=cat) + latex_prefix='', category=category) def _repr_(self): """ diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py index 2a3a6f9c12b..d849fc4ab09 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py @@ -538,10 +538,15 @@ def conjugacy_class(self, g): from sage.groups.perm_gps.symgp_conjugacy_class import SymmetricGroupConjugacyClass return SymmetricGroupConjugacyClass(self, g) - def algebra(self, base_ring): + def algebra(self, base_ring, category=None): """ Return the symmetric group algebra associated to ``self``. + INPUT: + + - ``base_ring`` -- a ring + - ``category`` -- a category (default: the category of ``self``) + If ``self`` is the symmetric group on `1,\ldots,n`, then this is special cased to take advantage of the features in :class:`SymmetricGroupAlgebra`. Otherwise the usual group @@ -554,13 +559,24 @@ def algebra(self, base_ring): Symmetric group algebra of order 4 over Rational Field sage: S3 = SymmetricGroup([1,2,3]) - sage: S3.algebra(QQ) + sage: A = S3.algebra(QQ); A Symmetric group algebra of order 3 over Rational Field sage: a = S3.an_element(); a (1,2,3) - sage: S3.algebra(QQ)(a) + sage: A(a) (1,2,3) + We illustrate the choice of the category:: + + sage: A.category() + Join of Category of coxeter group algebras over Rational Field + and Category of finite group algebras over Rational Field + sage: A = S3.algebra(QQ, category=Semigroups()) + sage: A.category() + Category of finite dimensional semigroup algebras over Rational Field + + In the following case, a usual group algebra is returned: + sage: S = SymmetricGroup([2,3,5]) sage: S.algebra(QQ) Group algebra of Symmetric group of order 3! as a permutation group over Rational Field @@ -572,7 +588,7 @@ def algebra(self, base_ring): from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra domain = self.domain() if list(domain) == range(1, len(domain)+1): - return SymmetricGroupAlgebra(base_ring, self) + return SymmetricGroupAlgebra(base_ring, self, category=category) else: return super(SymmetricGroup, self).algebra(base_ring)