Skip to content

Commit

Permalink
Trac #18273: SymmetricGroup(...).algebra(..., category=...) for consi…
Browse files Browse the repository at this point in the history
…stency

The generic algebra method takes a category option. This option is
missing for `SymmetricGroup` and `Permutations` which use
`SymmetricGroupAlgebra`. This ticket fixes this.

URL: http://trac.sagemath.org/18273
Reported by: nthiery
Ticket author(s): Nicolas M. Thiéry
Reviewer(s): Aladin Virmaux
  • Loading branch information
Release Manager authored and vbraun committed Apr 23, 2015
2 parents 90333a9 + db95e00 commit 9c013fb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 12 deletions.
18 changes: 15 additions & 3 deletions src/sage/combinat/permutation.py
Expand Up @@ -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):
Expand Down
22 changes: 17 additions & 5 deletions src/sage/combinat/symmetric_group_algebra.py
Expand Up @@ -29,14 +29,16 @@

# 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``.
INPUT:
- ``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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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::
Expand Down Expand Up @@ -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):
"""
Expand Down
24 changes: 20 additions & 4 deletions src/sage/groups/perm_gps/permgroup_named.py
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 9c013fb

Please sign in to comment.