Skip to content

Commit

Permalink
gh-35432: Some fixes for Specht modules and diagrams
Browse files Browse the repository at this point in the history
    
<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes #12345", use "Add a new method to
multiply two integers" -->

### 📚 Description

This fixes a bug in the Specht modules when the cells of the diagram are
bigger than the number of boxes:
```python
sage: SGA = SymmetricGroupAlgebra(QQ, 2)
sage: SGA.specht_module([(2,2), (5,5)])
------------------------------------------------------------------------
---
KeyError                                  Traceback (most recent call
last)
...
IndexError: list index out of range
```

We also fix a few typos in `combinat/diagram.py`.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #35432
Reported by: Travis Scrimshaw
Reviewer(s): Darij Grinberg
  • Loading branch information
Release Manager committed May 21, 2023
2 parents 828ad22 + f0494de commit b02631d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/sage/combinat/diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@

class Diagram(ClonableArray, metaclass=InheritComparisonClasscallMetaclass):
r"""
Combinatorial diagrams with positions indexed by rows in columns.
Combinatorial diagrams with positions indexed by rows and columns.
The positions are indexed by rows and columns as in a matrix. For example,
a Ferrer's diagram is a diagram obtained from a partition
a Ferrers diagram is a diagram obtained from a partition
`\lambda = (\lambda_0, \lambda_1, \ldots, \lambda_{\ell})`, where the
cells are in rows `i` for `0 \leq i \leq \ell` and the cells in row `i`
consist of `(i,j)` for `0 \leq j < \lambda_i`. In English notation, the
Expand All @@ -57,7 +57,7 @@ class Diagram(ClonableArray, metaclass=InheritComparisonClasscallMetaclass):
EXAMPLES:
To create an arbirtrary diagram, pass a list of all cells::
To create an arbitrary diagram, pass a list of all cells::
sage: from sage.combinat.diagram import Diagram
sage: cells = [(0,0), (0,1), (1,0), (1,1), (4,4), (4,5), (4,6), (5,4), (7, 6)]
Expand Down Expand Up @@ -469,7 +469,7 @@ def check(self):
sage: D.check()
In the next two examples, a bad diagram is passed.
The first example fails because one cells is indexed by negative
The first example fails because one cell is indexed by negative
integers::
sage: D = Diagram([(0,0), (0,-3), (2,2), (2,4)])
Expand Down
41 changes: 26 additions & 15 deletions src/sage/combinat/specht_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,35 +394,46 @@ def specht_module_spanning_set(D, SGA=None):
sage: specht_module_spanning_set([(0,0), (1,1), (2,1)], SGA)
(() - (2,3), -(1,2) + (1,3,2), (1,2,3) - (1,3),
-() + (2,3), -(1,2,3) + (1,3), (1,2) - (1,3,2))
TESTS:
Verify that diagrams bigger than the rank work::
sage: specht_module_spanning_set([(0,0), (3,5)])
([1, 2], [2, 1])
sage: specht_module_spanning_set([(0,0), (5,3)])
([1, 2], [2, 1])
"""
n = len(D)
if SGA is None:
from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra
SGA = SymmetricGroupAlgebra(QQ, n)
elif SGA.group().rank() != n - 1:
raise ValueError("the rank does not match the size of the diagram")
row_diagram = [set() for _ in range(n)]
col_diagram = [set() for _ in range(n)]
for i,cell in enumerate(D):
x,y = cell
nr = max((c[0] for c in D), default=0) + 1
nc = max((c[1] for c in D), default=0) + 1
row_diagram = [set() for _ in range(nr)]
col_diagram = [set() for _ in range(nc)]
for i, cell in enumerate(D):
x, y = cell
row_diagram[x].add(i)
col_diagram[y].add(i)
# Construct the row and column stabilizer elements
row_stab = SGA.zero()
col_stab = SGA.zero()
B = SGA.basis()
for w in B.keys():
# Remember that the permutation w is 1-based
row_perm = [set() for _ in range(n)]
col_perm = [set() for _ in range(n)]
for i,cell in enumerate(D):
x,y = cell
row_perm[x].add(w(i+1)-1)
col_perm[y].add(w(i+1)-1)
if row_diagram == row_perm:
row_stab += B[w]
if col_diagram == col_perm:
col_stab += w.sign() * B[w]
# Remember that the permutation w is 1-based
row_perm = [set() for _ in range(nr)]
col_perm = [set() for _ in range(nc)]
for i, cell in enumerate(D):
x, y = cell
row_perm[x].add(w(i+1)-1)
col_perm[y].add(w(i+1)-1)
if row_diagram == row_perm:
row_stab += B[w]
if col_diagram == col_perm:
col_stab += w.sign() * B[w]
gen = col_stab * row_stab
return tuple([b * gen for b in B])

Expand Down

0 comments on commit b02631d

Please sign in to comment.