Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement absolute length fix #37001

Merged
merged 16 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
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
6 changes: 6 additions & 0 deletions src/doc/en/reference/references/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,9 @@ REFERENCES:
.. [Car1972] \R. W. Carter. *Simple groups of Lie type*, volume 28 of
Pure and Applied Mathematics. John Wiley and Sons, 1972.

.. [Car1972a] \R. W. Carter. *Conjugacy classes in the Weyl group*, Comp. Math.
Vol 26 (1972) 1-59.

.. [Cha2005] \F. Chapoton, *Une Base Symétrique de l'algèbre des
Coinvariants Quasi-Symétriques*, Electronic Journal of
Combinatorics Vol 12(1) (2005) N16.
Expand Down Expand Up @@ -2347,6 +2350,9 @@ REFERENCES:
.. [Dy1994] \M. J. Dyer. *Bruhat intervals, polyhedral cones and
Kazhdan-Lusztig-Stanley polynomials*. Math.Z., 215(2):223-236, 1994.

.. [Dy2001] \M. J. Dyer. *On minimal lengths of expressions of Coxeter group elements as
products of reflections*. Proc. Amer. Math. Soc. Vol 129 (9) (Sep 2001) pp. 2591-2595

.. _ref-E:

**E**
Expand Down
133 changes: 127 additions & 6 deletions src/sage/categories/coxeter_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,10 @@
Return the absolute length of ``self``.

The absolute length is the length of the shortest expression
of the element as a product of reflections.
of the element as a product of reflections. For finite Coxeter
groups, the absolute length is the codimension of the
1-eigenspace of the element (Lemmas 1-3 in [Car1972a]_). For all
other Coxeter types, we use Theorem 1.1 in [Dy2001]_.

For permutations in the symmetric groups, the absolute
length is the size minus the number of its disjoint
Expand All @@ -1959,6 +1962,7 @@
.. SEEALSO::

:meth:`absolute_le`
:meth:`absolute_chain`
thecaligarmo marked this conversation as resolved.
Show resolved Hide resolved

EXAMPLES::

Expand All @@ -1971,9 +1975,125 @@
sage: s = W.simple_reflections() # needs sage.groups
sage: (s[3]*s[2]*s[1]).absolute_length() # needs sage.combinat sage.groups
3

sage: W = CoxeterGroup(["A",2,1])
sage: (r, s, t) = W.simple_reflections()
sage: (r * s * r * t).absolute_length()
2
sage: W.one().absolute_length()
0
sage: r.absolute_length()
1
sage: (r * s).absolute_length()
2
sage: (r * s * r).absolute_length()
1
"""
M = self.canonical_matrix()
return (M - 1).image().dimension()
P = self.parent()
if P.is_finite():
M = self.canonical_matrix()
return (M - 1).image().dimension()

n = self.length()
if n <= 2: # trivial cases
return n
return len(self.absolute_chain_reflections())

def absolute_chain(self):
r"""
Return a (saturated) chain in absolute order from ``self``
to ``1``.

.. SEEALSO::

:meth:`absolute_chain_reflections`

EXAMPLES::

sage: W = CoxeterGroup(['A', 2, 1])
sage: (r, s, t) = W.simple_reflections()
sage: (r * s * r * t).absolute_chain()
[
[ 2 1 -2] [ 0 -1 2] [1 0 0]
[ 1 2 -2] [-1 0 2] [0 1 0]
[ 1 1 -1], [ 0 0 1], [0 0 1]
]
"""

reflections = self.absolute_chain_reflections()
P = self.parent()
return [P.prod(reversed(reflections[:i]))
for i in range(len(reflections), -1, -1)]


def absolute_chain_reflections(self):
r"""
Return a list of reflection which, when multiplied in order, give
``self``.


thecaligarmo marked this conversation as resolved.
Show resolved Hide resolved
This method is based on Theorem 1.1 in [Dy2001]_, combined with
the strong exchange condition.

.. SEEALSO::

:meth:`absolute_length`
:meth:`absolute_chain`
thecaligarmo marked this conversation as resolved.
Show resolved Hide resolved

EXAMPLES::
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should also have examples where the absolute length is > 2 and equal to the usual length of the element (which should also be length 3 or more) to cover all of the code paths..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my forthcoming commit.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you. It would also be good to have one test in absolute_length() with a length > 2 (perhaps a different one with a length > 5?).


sage: W = CoxeterGroup(["A",2,1])
sage: W.one().absolute_chain_reflections()
[]
sage: (r, s, t) = W.simple_reflections()
sage: r.absolute_chain_reflections()
[
[-1 1 1]
[ 0 1 0]
[ 0 0 1]
]
sage: (r * s).absolute_chain_reflections()
[
[-1 1 1] [ 0 -1 2]
[ 0 1 0] [-1 0 2]
[ 0 0 1], [ 0 0 1]
]
sage: (r * s * r * t).absolute_chain_reflections()
[
[ 0 -1 2] [-1 -2 4]
[-1 0 2] [-2 -1 4]
[ 0 0 1], [-1 -1 3]
]

"""
thecaligarmo marked this conversation as resolved.
Show resolved Hide resolved
P = self.parent()
if self.is_one():
return []
w = self.reduced_word()
n = self.length()
thecaligarmo marked this conversation as resolved.
Show resolved Hide resolved

if n == 1: # trivial case
return [self]
if n == 2: # trivial case
leftRefl = P.simple_reflection(w[0])
return [leftRefl, self * leftRefl]
thecaligarmo marked this conversation as resolved.
Show resolved Hide resolved

import itertools
s = P.simple_reflections()
rev = P.one()
cur = P.one()
reflections = []
for val in w:
cur = cur * s[val]
reflections.append(cur * rev)
rev = s[val] * rev
for ell in range(n):
for chain in itertools.combinations(reflections, ell):
if P.prod(reversed(chain)) == self:
return list(chain)
# If we get here it's cause ell == n and so we need all of the
# refelctions
return reflections

Check warning on line 2096 in src/sage/categories/coxeter_groups.py

View check run for this annotation

Codecov / codecov/patch

src/sage/categories/coxeter_groups.py#L2096

Added line #L2096 was not covered by tests

def absolute_le(self, other):
r"""
Expand Down Expand Up @@ -2059,7 +2179,7 @@
sage: s = W.simple_reflections()
sage: w0 = s[1]
sage: w1 = s[1]*s[2]*s[3]
sage: w0.absolute_covers()
sage: list(w0.absolute_covers())
[
[0 0 1 0] [0 1 0 0] [0 1 0 0] [0 0 0 1] [0 1 0 0]
[1 0 0 0] [1 0 0 0] [0 0 1 0] [1 0 0 0] [0 0 0 1]
Expand All @@ -2068,8 +2188,9 @@
]
"""
W = self.parent()
return [self * t for t in W.reflections()
if self.absolute_length() < (self * t).absolute_length()]
for t in W.reflections():
if self.absolute_length() < (self * t).absolute_length():
yield self * t

def canonical_matrix(self):
r"""
Expand Down
6 changes: 3 additions & 3 deletions src/sage/combinat/posets/poset_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,8 +1287,8 @@ def CoxeterGroupAbsoluteOrderPoset(W, use_reduced_words=True):
"""
if use_reduced_words:
element_labels = {s: tuple(s.reduced_word()) for s in W}
return Poset({s: s.absolute_covers() for s in W}, element_labels)
return Poset({s: s.absolute_covers() for s in W})
return Poset({s: list(s.absolute_covers()) for s in W}, element_labels)
return Poset({s: list(s.absolute_covers()) for s in W})

@staticmethod
def NoncrossingPartitions(W):
Expand Down Expand Up @@ -1349,7 +1349,7 @@ def SymmetricGroupAbsoluteOrderPoset(n, labels="permutations"):
element_labels = {s: "".join(x for x in s.cycle_string() if x != ',')
for s in W}

return Poset({s: s.absolute_covers() for s in W}, element_labels)
return Poset({s: list(s.absolute_covers()) for s in W}, element_labels)

@staticmethod
def UpDownPoset(n, m=1):
Expand Down
Loading