Skip to content

Commit

Permalink
Trac #23443: More Schubert polynomial shenanigans
Browse files Browse the repository at this point in the history
Title stolen from Stanley, but this is, alas, a bug, not a determinant
conjecture:
{{{
sage: X = SchubertPolynomialRing(ZZ)
sage: X([]).expand()
1
sage: X([1]).expand()
1
sage: X([]) == X([1])
False
}}}

Normally, `X(perm)` reduces the permutation `perm` by removing all fixed
points attached to its right end (i.e., if a permutation in `S_n` sends
`n` to `n`, then it reduces it to a permutation in `S_{n-1}` and so on,
until this reduction is no longer possible). And rightfully so, since
the Schubert basis is indexed by reduced permutations.
{{{
sage: X = SchubertPolynomialRing(ZZ)
sage: X([1])
X[1]
sage: X([1,2])
X[1]
sage: X([1,2,3])
X[1]
}}}
However, it fails to reduce `[1]` to `[]` due to the behavior of
`Permutation.remove_extra_fixed_points`.

Can we just fix it, or does symmetrica break on contact with the empty
list? In the latter case, should we reduce `[]` to `[1]` instead?

Related: #23403.

URL: https://trac.sagemath.org/23443
Reported by: darij
Ticket author(s): Darij Grinberg
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Jun 12, 2022
2 parents a6e696e + 94d9d75 commit 65e866a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
13 changes: 13 additions & 0 deletions src/sage/combinat/permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4756,18 +4756,31 @@ def remove_extra_fixed_points(self):
"""
Return the permutation obtained by removing any fixed points at
the end of ``self``.
However, return ``[1]`` rather than ``[]`` if ``self`` is the
identity permutation.
This is mostly a helper method for
:mod:`sage.combinat.schubert_polynomial`, where it is
used to normalize finitary permutations of
`\{1,2,3,\ldots\}`.
EXAMPLES::
sage: Permutation([2,1,3]).remove_extra_fixed_points()
[2, 1]
sage: Permutation([1,2,3,4]).remove_extra_fixed_points()
[1]
sage: Permutation([2,1]).remove_extra_fixed_points()
[2, 1]
sage: Permutation([]).remove_extra_fixed_points()
[1]
.. SEEALSO::
:meth:`retract_plain`
"""
if not self:
return Permutations()([1])
#Strip off all extra fixed points at the end of
#the permutation.
i = len(self)-1
Expand Down
18 changes: 14 additions & 4 deletions src/sage/combinat/schubert_polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ def expand(self):
TESTS:
Calling .expand() should always return an element of an
MPolynomialRing
::
MPolynomialRing::
sage: X = SchubertPolynomialRing(ZZ)
sage: f = X([1]); f
Expand All @@ -83,10 +81,16 @@ def expand(self):
sage: f = X([1,3,2,4])
sage: type(f.expand())
<class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
Now we check for correct handling of the empty
permutation (:trac:`23443`)::
sage: X([1]).expand() * X([2,1]).expand()
x0
"""
p = symmetrica.t_SCHUBERT_POLYNOM(self)
if not is_MPolynomial(p):
R = PolynomialRing(self.parent().base_ring(), 1, 'x')
R = PolynomialRing(self.parent().base_ring(), 1, 'x0')
p = R(p)
return p

Expand Down Expand Up @@ -361,6 +365,12 @@ def _element_constructor_(self, x):
Traceback (most recent call last):
...
ValueError: The input [1, 2, 1] is not a valid permutation
Now we check for correct handling of the empty
permutation (:trac:`23443`)::
sage: X([])
X[1]
"""
if isinstance(x, list):
# checking the input to avoid symmetrica crashing Sage, see trac 12924
Expand Down

0 comments on commit 65e866a

Please sign in to comment.