Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Doing some refactoring and doc work.
  • Loading branch information
tscrim committed Mar 25, 2023
commit 0c7d77987c459a2acf3abebf4c1e0eb3a8ecf992
1 change: 1 addition & 0 deletions src/sage/combinat/algebraic_combinatorics.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- :ref:`sage.combinat.cluster_algebra_quiver.all`
- :class:`~sage.combinat.kazhdan_lusztig.KazhdanLusztigPolynomial`
- :class:`~sage.combinat.symmetric_group_representations.SymmetricGroupRepresentation`
- :class:`~sage.combinat.specht_module.SpechtModule`
- :ref:`sage.combinat.yang_baxter_graph`
- :ref:`sage.combinat.hall_polynomial`
- :ref:`sage.combinat.key_polynomial`
Expand Down
28 changes: 22 additions & 6 deletions src/sage/combinat/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,15 @@ def count(self, n):
def specht_module(self, BR=None):
r"""
Return the Specht module corresponding to ``self``.

EXAMPLES::

sage: SM = Composition([1,2,2]).specht_module(QQ)
sage: SM
Free module generated by {0, 1, 2, 3, 4} over Rational Field
sage: s = SymmetricFunctions(QQ).s()
sage: s(SM.frobenius_image())
s[2, 2, 1]
"""
from sage.combinat.specht_module import SpechtModule
from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra
Expand All @@ -1402,16 +1411,23 @@ def specht_module(self, BR=None):
cells.append((i, j))
return SpechtModule(R, cells)

def specht_module_dimension(self):
def specht_module_dimension(self, BR=None):
r"""
Return the dimension of the Specht module corresponding to ``self``.

INPUT:

- ``BR`` -- (default: `\QQ`) the base ring

EXAMPLES::

sage: Composition([1,2,2]).specht_module_dimension()
5
sage: Composition([1,2,2]).specht_module_dimension(GF(2))
5
"""
from sage.combinat.specht_module import specht_module_rank
cells = []
for i, row in enumerate(self):
for j in range(row):
cells.append((i, j))
return specht_module_rank(cells)
return specht_module_rank(self, BR)

Sequence.register(Composition)
##############################################################
Expand Down
17 changes: 14 additions & 3 deletions src/sage/combinat/diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,23 @@ def specht_module(self, BR=None):
R = SymmetricGroupAlgebra(BR, len(self))
return SpechtModule(R, self)

def specht_module_dimension(self):
"""
def specht_module_dimension(self, BR=None):
r"""
Return the dimension of the Specht module corresponding to ``self``.

INPUT:

- ``BR`` -- (default: `\QQ`) the base ring

EXAMPLES::

sage: from sage.combinat.diagram import Diagram
sage: D = Diagram([(0,0), (1,1), (2,2), (2,3)])
sage: D.specht_module_dimension()
sage: D.specht_module(QQ).dimension()
"""
from sage.combinat.specht_module import specht_module_rank
return specht_module_rank(self)
return specht_module_rank(self, BR)

class Diagrams(UniqueRepresentation, Parent):
r"""
Expand Down
25 changes: 14 additions & 11 deletions src/sage/combinat/integer_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,22 +530,25 @@ def specht_module(self, BR=None):
from sage.rings.rational_field import QQ
BR = QQ
R = SymmetricGroupAlgebra(BR, sum(self))
cells = []
for i, row in enumerate(self):
for j in range(row):
cells.append((i, j))
return SpechtModule(R, cells)
return SpechtModule(R, self)

def specht_module_dimension(self):
def specht_module_dimension(self, BR=None):
r"""
Return the dimension of the Specht module corresponding to ``self``.

INPUT:

- ``BR`` -- (default: `\QQ`) the base ring

EXAMPLES::

sage: IntegerVectors()([2,0,1,0,2]).specht_module_dimension()
5
sage: IntegerVectors()([2,0,1,0,2]).specht_module_dimension(GF(2))
5
"""
from sage.combinat.specht_module import specht_module_rank
cells = []
for i, row in enumerate(self):
for j in range(row):
cells.append((i, j))
return specht_module_rank(cells)
return specht_module_rank(self, BR)


class IntegerVectors(Parent, metaclass=ClasscallMetaclass):
Expand Down
42 changes: 34 additions & 8 deletions src/sage/combinat/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -5484,25 +5484,51 @@ def coloring(i):
return self.dual_equivalence_graph(directed, coloring)

def specht_module(self, BR=None):
"""
Return the Specht module corresponding to ``self``.
r"""
Return the Specht module corresponding to ``self``.

EXAMPLES::

sage: SM = Partition([2,2,1]).specht_module(QQ)
sage: SM
Free module generated by {0, 1, 2, 3, 4} over Rational Field
sage: s = SymmetricFunctions(QQ).s()
sage: s(SM.frobenius_image())
s[2, 2, 1]
"""
from sage.combinat.specht_module import SpechtModule
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe factor out a function specht_module_builder that takes a ring, a size and cells ? Instead of doing these double imports everywhere ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see the benefit. To me, it adds more indirection and complexity to save on just doing one import at each point of the code instead of two (as the second import is still done). To me, it is equivalent to having

class Bar:
    def __init__(self, x):
        self._x = x

def foo(x):
    from above import Bar
    return Bar(x)

which I would want to just call Bar(x) within my code.

from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra
if BR is None:
from sage.rings.rational_field import QQ
BR = QQ
R = SymmetricGroupAlgebra(BR, sum(self))
return SpechtModule(R, self.cells())
return SpechtModule(R, self)

def specht_module_dimension(self):
"""
def specht_module_dimension(self, BR=None):
r"""
Return the dimension of the Specht module corresponding to ``self``.

This is equal to the number of standard tableaux of shape ``self`` when
over a field of characteristic `0`.

INPUT:

- ``BR`` -- (default: `\QQ`) the base ring

EXAMPLES::

This is equal to the number of standard tableaux of shape ``self``.
sage: Partition([2,2,1]).specht_module_dimension()
5
sage: Partition([2,2,1]).specht_module_dimension(GF(2))
5
"""
from sage.combinat.tableau import StandardTableaux
return StandardTableaux(self).cardinality()
from sage.categories.fields import Fields
if BR is None or (BR in Fields() and BR.characteristic() == 0):
from sage.combinat.tableau import StandardTableaux
return StandardTableaux(self).cardinality()
from sage.combinat.specht_module import specht_module_rank
return specht_module_rank(self, BR)


##############
# Partitions #
Expand Down
8 changes: 6 additions & 2 deletions src/sage/combinat/skew_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,8 +1323,12 @@ def specht_module_dimension(self):
sage: SM = mu.specht_module_dimension(QQ)
8
"""
from sage.combinat.skew_tableau import StandardSkewTableaux
return StandardSkewTableaux(self).cardinality()
from sage.categories.fields import Fields
if BR is None or (BR in Fields() and BR.characteristic() == 0):
from sage.combinat.skew_tableau import StandardSkewTableaux
return StandardSkewTableaux(self).cardinality()
from sage.combinat.specht_module import specht_module_rank
return specht_module_rank(self, BR)


def row_lengths_aux(skp):
Expand Down
45 changes: 39 additions & 6 deletions src/sage/combinat/specht_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ class SpechtModule(SubmoduleWithBasis):

- ``SGA`` -- a symmetric group algebra
- ``D`` -- a diagram

.. SEEALSO::

:class:`~sage.combinat.symmetric_group_representations.SpechtRepresentation`
for an implementation of the representation by matrices.
"""
@staticmethod
def __classcall_private__(cls, SGA, D):
Expand All @@ -73,8 +78,8 @@ def __classcall_private__(cls, SGA, D):
...
the rank (=3) does not match the size (=2) of the diagram
"""
if not isinstance(D, Diagram):
D = Diagram(D)
D = _to_diagram(D)
D = Diagram(D)
n = len(D)
if SGA.group().rank() != n - 1:
rk = SGA.group().rank()
Expand Down Expand Up @@ -105,6 +110,11 @@ def representation_matrix(self, elt):
Return the matrix corresponding to the left action of the symmetric
group (algebra) element ``elt`` on ``self``.


.. SEEALSO::

:class:`~sage.combinat.symmetric_group_representations.SpechtRepresentation`

EXAMPLES::

sage: SM = Partition([3,1,1]).specht_module(QQ)
Expand Down Expand Up @@ -192,6 +202,27 @@ def _acted_upon_(self, x, self_on_left=False):
return P.retract(P._ambient(x) * self.lift())
return super()._acted_upon_(self, x, self_on_left)

def _to_diagram(D):
r"""
Convert ``D`` to a list of cells representing a diagram.
"""
from sage.combinat.integer_vector import IntegerVectors
from sage.combinat.skew_partition import SkewPartitions
from sage.combinat.partition import _Partitions
if isinstance(D, Diagram):
return D
if D in _Partitions:
D = _Partitions(D).cells()
elif D in SkewPartitions():
D = SkewPartitions()(D).cells()
elif D in IntegerVectors():
cells = []
for i, row in enumerate(D):
for j in range(row):
cells.append((i, j))
D = cells
return D

def specht_module_spanning_set(D, SGA=None):
r"""
Return a spanning set of the Specht module of diagram ``D``.
Expand All @@ -214,8 +245,6 @@ def specht_module_spanning_set(D, SGA=None):
(() - (2,3), -(1,2) + (1,3,2), (1,2,3) - (1,3),
-() + (2,3), -(1,2,3) + (1,3), (1,2) - (1,3,2))
"""
if not isinstance(D, Diagram):
D = Diagram(D)
n = len(D)
if SGA is None:
from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra
Expand Down Expand Up @@ -247,7 +276,7 @@ def specht_module_spanning_set(D, SGA=None):
gen = col_stab * row_stab
return tuple([b * gen for b in B])

def specht_module_rank(D):
def specht_module_rank(D, BR=None):
r"""
Return the rank of the Specht module of diagram ``D``.

Expand All @@ -257,5 +286,9 @@ def specht_module_rank(D):
sage: specht_module_rank([(0,0), (1,1), (2,2)])
6
"""
D = _to_diagram(D)
span_set = specht_module_spanning_set(D)
return matrix(QQ, [v.to_vector() for v in span_set]).rank()
if BR is None:
BR = QQ
return matrix(BR, [v.to_vector() for v in span_set]).rank()

16 changes: 16 additions & 0 deletions src/sage/combinat/symmetric_group_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,22 @@ def complement(xs):
return self.sum_of_monomials([self._indices(P(list(q) + complement(q)))
for q in itertools.combinations(range(1, n + 1), int(k))])

def specht_module(self, D):
r"""
Return the Specht module of ``self`` indexed by the diagram ``D``.
"""
from sage.combinat.specht_module import SpechtModule
return SpechtModule(self, D)

def specht_module_dimension(self, D):
r"""
Return the dimension of the Specht module of ``self`` indexed by ``D``.
"""
from sage.combinat.specht_module import specht_module_spanning_set, _to_diagram
D = _to_diagram(D)
span_set = specht_module_spanning_set(D, self)
return matrix(self.base_ring(), [v.to_vector() for v in span_set]).rank()

def jucys_murphy(self, k):
r"""
Return the Jucys-Murphy element `J_k` (also known as a
Expand Down