From 0412e2f76ff8f10bf86eb332d83df1f94ab29c2e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 25 Jun 2024 21:40:45 -0700 Subject: [PATCH 1/2] src/sage/combinat/sf/sfa.py: Deprecate is_SymmetricFunction --- src/sage/combinat/sf/classical.py | 2 +- src/sage/combinat/sf/sfa.py | 13 ++++++++++++- src/sage/rings/lazy_series.py | 10 ++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/sage/combinat/sf/classical.py b/src/sage/combinat/sf/classical.py index 792272417a8..badea76a0c5 100644 --- a/src/sage/combinat/sf/classical.py +++ b/src/sage/combinat/sf/classical.py @@ -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 diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 033a753f076..aff1f1b5164 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -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) ##################################################################### @@ -3429,7 +3437,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 @@ -4648,6 +4656,9 @@ def internal_coproduct(self): True sage: all( h([n]).internal_coproduct() == sum([tensor([h(lam), h(m(lam))]) for lam in Partitions(n)]) ....: 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))]) diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index 74744c311da..4aab7395464 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -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") @@ -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") From 9e126031c7354d57ed2e2ed31e833fa57b4fe8c0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 25 Jun 2024 22:52:01 -0700 Subject: [PATCH 2/2] src/sage/combinat/sf/sfa.py: Fix up --- src/sage/combinat/sf/sfa.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index aff1f1b5164..36168bd7e1e 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -4656,9 +4656,6 @@ def internal_coproduct(self): True sage: all( h([n]).internal_coproduct() == sum([tensor([h(lam), h(m(lam))]) for lam in Partitions(n)]) ....: 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))])