Skip to content

Commit

Permalink
src/sage/combinat/sf/sfa.py: Deprecate is_SymmetricFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Jun 26, 2024
1 parent ab24dac commit 18ad088
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/sage/combinat/sf/classical.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _element_constructor_(self, x):
##############
# Dual bases #
##############
elif sfa.is_SymmetricFunction(x) and hasattr(x, 'dual'):
elif isinstance(x, sfa.SymmetricFunctionAlgebra_generic.Element) and hasattr(x, 'dual'):
# Check to see if it is the dual of some other basis
# If it is, try to coerce its corresponding element
# in the other basis
Expand Down
34 changes: 33 additions & 1 deletion src/sage/combinat/sf/sfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,20 @@ def is_SymmetricFunction(x):
sage: from sage.combinat.sf.sfa import is_SymmetricFunction
sage: s = SymmetricFunctions(QQ).s()
sage: is_SymmetricFunction(2)
doctest:warning...
DeprecationWarning: The function is_SymmetricFunction is deprecated;
use 'isinstance(..., SymmetricFunctionAlgebra_generic.Element)' instead.
See https://github.com/sagemath/sage/issues/38279 for details.
False
sage: is_SymmetricFunction(s(2))
True
sage: is_SymmetricFunction(s([2,1]))
True
"""
from sage.misc.superseded import deprecation
deprecation(38279,
"The function is_SymmetricFunction is deprecated; "
"use 'isinstance(..., SymmetricFunctionAlgebra_generic.Element)' instead.")
return isinstance(x, SymmetricFunctionAlgebra_generic.Element)

#####################################################################
Expand Down Expand Up @@ -374,6 +382,9 @@ def super_categories(self):
Category of unique factorization domains]
sage: Sym = SymmetricFunctions(ZZ["x"])

Check failure on line 384 in src/sage/combinat/sf/sfa.py

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got:
doctest:warning...
DeprecationWarning: The function is_MPolynomialRing is deprecated; use 'isinstance(..., MPolynomialRing_base)' instead.
See https://github.com/sagemath/sage/issues/38266 for details.
sage: bases = SymmetricFunctionsBases(Sym)
sage: bases.super_categories()
[Category of realizations of Symmetric Functions over Univariate Polynomial Ring in x over Integer Ring,
Expand Down Expand Up @@ -671,6 +682,9 @@ def corresponding_basis_over(self, R):
sage: Sym.w().change_ring(CyclotomicField())
Symmetric Functions over Universal Cyclotomic Field in the Witt basis
sage: Sym.macdonald().P().change_ring(CyclotomicField()['q', 't'])

Check failure on line 684 in src/sage/combinat/sf/sfa.py

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got: Symmetric Functions over Multivariate Polynomial Ring in q, t over Universal Cyclotomic Field in the Macdonald P basis
doctest:warning...
DeprecationWarning: The function is_MPolynomialRing is deprecated; use 'isinstance(..., MPolynomialRing_base)' instead.
See https://github.com/sagemath/sage/issues/38266 for details.
Symmetric Functions over Multivariate Polynomial Ring in q, t over Universal Cyclotomic Field in the Macdonald P basis
sage: Sym.macdonald().Q().change_ring(CyclotomicField()['q', 't'])
Symmetric Functions over Multivariate Polynomial Ring in q, t over Universal Cyclotomic Field in the Macdonald Q basis
Expand Down Expand Up @@ -1011,6 +1025,9 @@ def gessel_reutenauer(self, lam):
sage: P = Sym.macdonald().P()
sage: h = Sym.h()
sage: P.gessel_reutenauer(3) == P(h.gessel_reutenauer(3))

Check failure on line 1027 in src/sage/combinat/sf/sfa.py

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got: True
doctest:warning...
DeprecationWarning: The function is_MPolynomialRing is deprecated; use 'isinstance(..., MPolynomialRing_base)' instead.
See https://github.com/sagemath/sage/issues/38266 for details.
True
.. NOTE::
Expand Down Expand Up @@ -2088,6 +2105,9 @@ def _from_cache(self, element, cache_function, cache_dict, **subs_dict):
sage: s = Sym.s()
sage: p21 = Partition([2,1])
sage: a = s(p21)

Check failure on line 2107 in src/sage/combinat/sf/sfa.py

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got:
doctest:warning...
DeprecationWarning: The function is_MPolynomialRing is deprecated; use 'isinstance(..., MPolynomialRing_base)' instead.
See https://github.com/sagemath/sage/issues/38266 for details.
sage: e = Sym.e()
sage: cache_dict = {}
sage: cache_dict[3] = {}
Expand Down Expand Up @@ -3019,6 +3039,9 @@ def coproduct_by_coercion(self, elt):
McdH[] # McdH[2, 1] + ((q^2*t-1)/(q*t-1))*McdH[1] # McdH[1, 1] + ((q*t^2-1)/(q*t-1))*McdH[1] # McdH[2] + ((q^2*t-1)/(q*t-1))*McdH[1, 1] # McdH[1] + ((q*t^2-1)/(q*t-1))*McdH[2] # McdH[1] + McdH[2, 1] # McdH[]
sage: HLQp = SymmetricFunctions(QQ['t'].fraction_field()).hall_littlewood().Qp()
sage: HLQp[2,1].coproduct()

Check failure on line 3041 in src/sage/combinat/sf/sfa.py

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got: HLQp[] # HLQp[2, 1] + HLQp[1] # HLQp[1, 1] + HLQp[1] # HLQp[2] + HLQp[1, 1] # HLQp[1] + HLQp[2] # HLQp[1] + HLQp[2, 1] # HLQp[]
doctest:warning...
DeprecationWarning: The function is_MPolynomialRing is deprecated; use 'isinstance(..., MPolynomialRing_base)' instead.
See https://github.com/sagemath/sage/issues/38266 for details.
HLQp[] # HLQp[2, 1] + HLQp[1] # HLQp[1, 1] + HLQp[1] # HLQp[2] + HLQp[1, 1] # HLQp[1] + HLQp[2] # HLQp[1] + HLQp[2, 1] # HLQp[]
sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
sage: LLT = Sym.llt(3)
Expand Down Expand Up @@ -3093,6 +3116,9 @@ def factor(self):
sage: e = SymmetricFunctions(QQ).e()
sage: factor((5*e[3] + e[2,1] + e[1])*(7*e[2] + e[5,1]))

Check failure on line 3118 in src/sage/combinat/sf/sfa.py

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got: (e[1] + e[2, 1] + 5*e[3]) * (7*e[2] + e[5, 1])
doctest:warning...
DeprecationWarning: The function is_MPolynomialRing is deprecated; use 'isinstance(..., MPolynomialRing_base)' instead.
See https://github.com/sagemath/sage/issues/38266 for details.
(e[1] + e[2, 1] + 5*e[3]) * (7*e[2] + e[5, 1])
sage: R.<x, y> = QQ[]
Expand Down Expand Up @@ -3429,7 +3455,7 @@ def plethysm(self, x, include=None, exclude=None):

tHA = HopfAlgebrasWithBasis(R).TensorProducts()
tensorflag = Px in tHA
if not is_SymmetricFunction(x):
if not isinstance(x, SymmetricFunctionAlgebra_generic.Element):
if R.has_coerce_map_from(Px) or x in R:
x = R(x)
Px = R
Expand Down Expand Up @@ -4648,6 +4674,9 @@ def internal_coproduct(self):
True
sage: all( h([n]).internal_coproduct() == sum([tensor([h(lam), h(m(lam))]) for lam in Partitions(n)])

Check failure on line 4675 in src/sage/combinat/sf/sfa.py

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got: True
....: for n in range(6) )
doctest:warning...
DeprecationWarning: The function is_SymmetricFunction is deprecated; use 'isinstance(..., SymmetricFunctionAlgebra_generic.Element)' instead.
See https://github.com/sagemath/sage/issues/38279 for details.
True
sage: all( factorial(n) * h([n]).internal_coproduct()
....: == sum([lam.conjugacy_class_size() * tensor([h(p(lam)), h(p(lam))])
Expand Down Expand Up @@ -5780,6 +5809,9 @@ def expand(self, n, alphabet='x'):
sage: J([2,1]).expand(3)
4*x0^2*x1 + 4*x0*x1^2 + 4*x0^2*x2 + 6*x0*x1*x2 + 4*x1^2*x2 + 4*x0*x2^2 + 4*x1*x2^2
sage: (2*J([2])).expand(0)

Check failure on line 5811 in src/sage/combinat/sf/sfa.py

View workflow job for this annotation

GitHub Actions / test-new

Failed example:

Failed example:: Got: 0
doctest:warning...
DeprecationWarning: The function is_MPolynomialRing is deprecated; use 'isinstance(..., MPolynomialRing_base)' instead.
See https://github.com/sagemath/sage/issues/38266 for details.
0
sage: (3*J([])).expand(0)
3
Expand Down
10 changes: 4 additions & 6 deletions src/sage/rings/lazy_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -6981,9 +6981,8 @@ def functorial_composition(self, *args):
"""
if len(args) != self.parent()._arity:
raise ValueError("arity must be equal to the number of arguments provided")
from sage.combinat.sf.sfa import is_SymmetricFunction
if not all(isinstance(g, LazySymmetricFunction)
or is_SymmetricFunction(g)
from sage.combinat.sf.sfa import SymmetricFunctionAlgebra_generic
if not all(isinstance(g, (LazySymmetricFunction, SymmetricFunctionAlgebra_generic.Element))
or not g for g in args):
raise ValueError("all arguments must be (possibly lazy) symmetric functions")

Expand Down Expand Up @@ -7200,9 +7199,8 @@ def arithmetic_product(self, *args):
"""
if len(args) != self.parent()._arity:
raise ValueError("arity must be equal to the number of arguments provided")
from sage.combinat.sf.sfa import is_SymmetricFunction
if not all(isinstance(g, LazySymmetricFunction)
or is_SymmetricFunction(g)
from sage.combinat.sf.sfa import SymmetricFunctionAlgebra_generic
if not all(isinstance(g, (LazySymmetricFunction, SymmetricFunctionAlgebra_generic.Element))
or not g for g in args):
raise ValueError("all arguments must be (possibly lazy) symmetric functions")

Expand Down

0 comments on commit 18ad088

Please sign in to comment.