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 all 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
153 changes: 142 additions & 11 deletions src/sage/categories/coxeter_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -1950,15 +1950,13 @@ def absolute_length(self):
Return the absolute length of ``self``.

The absolute length is the length of the shortest expression
of the element as a product of reflections.

For permutations in the symmetric groups, the absolute
length is the size minus the number of its disjoint
cycles.
of the element as a product of reflections. In general,
we use Theorem 1.1 in [Dy2001]_.

.. SEEALSO::

:meth:`absolute_le`
:meth:`absolute_le`,
:meth:`absolute_chain`

EXAMPLES::

Expand All @@ -1971,9 +1969,141 @@ def absolute_length(self):
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
sage: W = CoxeterGroup(['A', 3, 1])
sage: (r, s, t, u) = W.simple_reflections()
sage: (r * s * t * u).absolute_length()
4
sage: (r * s * t * u * s).absolute_length()
3
"""
M = self.canonical_matrix()
return (M - 1).image().dimension()
if self.length() <= 2: # trivial cases
return self.length()
return len(self.absolute_chain_reflections())

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

.. 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()
[
[1 0 0] [ 0 -1 2] [ 2 1 -2]
[0 1 0] [-1 0 2] [ 1 2 -2]
[0 0 1], [ 0 0 1], [ 1 1 -1]
]
"""
reflections = self.absolute_chain_reflections()
P = self.parent()
chain = [P.prod(reversed(reflections[:i]))
for i in range(len(reflections)+1)]
return chain

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

This method is based on Theorem 1.1 in [Dy2001]_, combined with
the strong exchange condition. As an example, if `W` is a type
`A_2` Coxeter group with simple reflections `a`, `b`, then the
absolute chain reflections for the element `w = ab` is the list
`[a, aba]` as `w = (aba) a = ab`.

.. SEEALSO::

:meth:`absolute_length`,
:meth:`absolute_chain`

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]
]
sage: W = CoxeterGroup(['A', 3, 1])
sage: (r, s, t, u) = W.simple_reflections()
sage: (r * s * t * u).absolute_chain_reflections()
[
[-1 1 0 1] [ 0 -1 1 1] [ 0 0 -1 2] [-3 2 0 2]
[ 0 1 0 0] [-1 0 1 1] [-1 1 -1 2] [-2 2 0 1]
[ 0 0 1 0] [ 0 0 1 0] [-1 0 0 2] [-2 1 1 1]
[ 0 0 0 1], [ 0 0 0 1], [ 0 0 0 1], [-2 1 0 2]
]
sage: (r * s * t * u * s).absolute_chain_reflections()
[
[-1 1 0 1] [ 0 0 -1 2] [-3 2 0 2]
[ 0 1 0 0] [-1 1 -1 2] [-2 2 0 1]
[ 0 0 1 0] [-1 0 0 2] [-2 1 1 1]
[ 0 0 0 1], [ 0 0 0 1], [-2 1 0 2]
]
"""
P = self.parent()
if self.is_one():
return []
w = self.reduced_word()
n = len(w)

if n == 1: # trivial case
return [self]
if n == 2: # trivial case
left_refl = P.simple_reflection(w[0])
return [left_refl, self * left_refl]

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

def absolute_le(self, other):
r"""
Expand Down Expand Up @@ -2059,7 +2189,7 @@ def absolute_covers(self):
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 +2198,9 @@ def absolute_covers(self):
]
"""
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
32 changes: 32 additions & 0 deletions src/sage/categories/finite_coxeter_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,38 @@ def coxeter_complex(self):

class ElementMethods:

def absolute_length(self):
"""
Return the absolute length of ``self``.

The absolute length is the length of the shortest expression
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 permutations in the symmetric groups, the absolute
length is the size minus the number of its disjoint
cycles.

.. SEEALSO::

:meth:`~sage.categories.coxeter_groups.absolute_le`

EXAMPLES::

sage: W = WeylGroup(["A", 3]) # needs sage.combinat sage.groups
sage: s = W.simple_reflections() # needs sage.combinat sage.groups
sage: (s[1]*s[2]*s[3]).absolute_length() # needs sage.combinat sage.groups
3

sage: W = SymmetricGroup(4) # needs sage.groups
sage: s = W.simple_reflections() # needs sage.groups
sage: (s[3]*s[2]*s[1]).absolute_length() # needs sage.combinat sage.groups
3
"""
M = self.canonical_matrix()
return (M - 1).image().dimension()

@cached_in_parent_method
def bruhat_upper_covers(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