Ticket #13762: trac_13762_k_quotient.2.patch

File trac_13762_k_quotient.2.patch, 104.9 KB (added by Mike Zabrocki, 10 years ago)
  • doc/en/reference/combinat/symmetric_functions.rst

    # HG changeset patch
    # User Chris Berg <cberg at lacim.ca>
    # Date 1353948369 18000
    # Node ID 02867f60db84eb6ea23866e081bcbe909a0693eb
    # Parent 4d351c049c9212c8e5d3bc092b6a6089957d4dcb
    Ticket #13762. This patch implements the k-bounded quotient basis of the symmetric 
    functions, spanned by the k-bounded monomials. It also implements several bases of 
    the algebra, including the affine Schur basis and the affine Grothendieck basis.
    
    diff --git a/doc/en/reference/combinat/symmetric_functions.rst b/doc/en/reference/combinat/symmetric_functions.rst
    a b Symmetric Functions 
    1919   ../sage/combinat/sf/hall_littlewood
    2020   ../sage/combinat/sf/jack
    2121   ../sage/combinat/sf/new_kschur
     22   ../sage/combinat/sf/k_dual
    2223   ../sage/combinat/sf/llt
    2324   ../sage/combinat/sf/macdonald
    2425   ../sage/combinat/sf/ns_macdonald
  • sage/combinat/partition.py

    diff --git a/sage/combinat/partition.py b/sage/combinat/partition.py
    a b def Partitions(n=None, **kwargs): 
    35253525        Traceback (most recent call last):
    35263526        ...
    35273527        ValueError: the size must be specified with any keyword argument
     3528       
     3529        sage: Partitions(max_part = 3)
     3530        3-Bounded Partitions
    35283531    """
    35293532    if n == infinity:
    35303533        raise ValueError, "n cannot be infinite"
    35313534    if n is None:
    35323535        if len(kwargs) > 0:
     3536            if len(kwargs) == 1:
     3537                if 'max_part' in kwargs:
     3538                    return Partitions_all_bounded(kwargs['max_part'])
    35333539            raise ValueError, 'the size must be specified with any keyword argument'
    35343540        return Partitions_all()
    35353541    else:
    class Partitions_all(InfiniteAbstractCom 
    36803686            sage: it = iter(Partitions())    # indirect doctest
    36813687            sage: [it.next() for i in range(10)]
    36823688            [[], [1], [2], [1, 1], [3], [2, 1], [1, 1, 1], [4], [3, 1], [2, 2]]
    3683          """
     3689        """
    36843690        return Partitions_n(n)
    36853691
     3692class Partitions_all_bounded(InfiniteAbstractCombinatorialClass):
     3693    def __init__(self, k):
     3694        """
     3695        TESTS::
     3696
     3697            sage: from sage.combinat.sf.k_dual import Partitions_all_bounded
     3698            sage: P = Partitions_all_bounded(3)
     3699            sage: P == loads(dumps(P))
     3700            True
     3701        """
     3702        self.k = k
     3703
     3704    Element = Partition_class
     3705
     3706    def cardinality(self):
     3707        """
     3708        Returns the cardinality of the set of bounded integer partitions.
     3709
     3710        EXAMPLES::
     3711
     3712            sage: from sage.combinat.sf.k_dual import Partitions_all_bounded
     3713            sage: Partitions_all_bounded(3).cardinality()
     3714            +Infinity
     3715        """
     3716        return infinity
     3717
     3718    def __contains__(self, x):
     3719        """
     3720        TESTS::
     3721
     3722            sage: from sage.combinat.sf.k_dual import Partitions_all_bounded
     3723            sage: P = Partitions_all_bounded(3)
     3724            sage: Partition([2,1]) in P
     3725            True
     3726            sage: [2,1] in P
     3727            True
     3728            sage: [3,2,1] in P
     3729            True
     3730            sage: [1,2] in P
     3731            False
     3732            sage: [5,1] in P
     3733            False
     3734            sage: [0] in P
     3735            False
     3736            sage: [] in P
     3737            True
     3738            sage: x in P
     3739            False
     3740        """
     3741        try:
     3742            return Partitions()(x).get_part(0) <= self.k
     3743        except (ValueError, TypeError):
     3744            return False
     3745
     3746    def __repr__(self):
     3747        """
     3748        TESTS::
     3749
     3750            sage: from sage.combinat.sf.k_dual import Partitions_all_bounded
     3751            sage: repr(Partitions_all_bounded(3))
     3752            '3-Bounded Partitions'
     3753        """
     3754        return "%d-Bounded Partitions"%self.k
     3755
     3756    def _infinite_cclass_slice(self, n):
     3757        """
     3758        Needed by InfiniteAbstractCombinatorialClass to build __iter__.
     3759
     3760        TESTS::
     3761
     3762            sage: from sage.combinat.sf.k_dual import Partitions_all_bounded
     3763            sage: Partitions_all_bounded(3)._infinite_cclass_slice(4) == Partitions(4, max_part = 3)
     3764            True
     3765            sage: it = iter(Partitions_all_bounded(3))    # indirect doctest
     3766            sage: [it.next() for i in range(10)]
     3767            [[], [1], [2], [1, 1], [3], [2, 1], [1, 1, 1], [3, 1], [2, 2], [2, 1, 1]]
     3768        """
     3769        return Partitions(n, max_part = self.k)
     3770
     3771
    36863772
    36873773class Partitions_n(CombinatorialClass):
    36883774    Element = Partition_class
  • new file sage/combinat/sf/k_dual.py

    diff --git a/sage/combinat/sf/k_dual.py b/sage/combinat/sf/k_dual.py
    new file mode 100644
    - +  
     1r"""
     2Quotient of symmetric function space by ideal generated by Hall-Littlewood symmetric functions
     3
     4The quotient of symmetric functions by the ideal generated by the Hall-Littlewood P
     5symmetric functions indexed by partitions with first part greater than `k`.  When `t=1`
     6this space is the quotient of the symmetric functions by the ideal generated by the
     7monomial symmetric functions indexed by partitions with first part greater than `k`.
     8
     9AUTHORS:
     10
     11- Chris Berg (2012-12-01)
     12
     13- Mike Zabrocki - `k`-bounded Hall Littlewood P and dual `k`-Schur functions (2012-12-02)
     14"""
     15#*****************************************************************************
     16#       Copyright (C) 2012 Chris Berg <chrisjamesberg@gmail.com>
     17#       Based off of similar code of Jason Bandlow, Anne Schilling
     18#                                    and Mike Zabrocki
     19#
     20#  Distributed under the terms of the GNU General Public License (GPL)
     21#
     22#    This code is distributed in the hope that it will be useful,
     23#    but WITHOUT ANY WARRANTY; without even the implied warranty of
     24#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     25#    General Public License for more details.
     26#
     27#  The full text of the GPL is available at:
     28#
     29#                  http://www.gnu.org/licenses/
     30#*****************************************************************************
     31from sage.structure.parent import Parent
     32from sage.structure.unique_representation import UniqueRepresentation
     33from sage.categories.all import Rings, GradedHopfAlgebras
     34from sage.combinat.partition import Partitions, Partitions_all_bounded
     35from sage.combinat.free_module import CombinatorialFreeModule
     36from sage.rings.rational_field import QQ
     37from sage.categories.realizations import Realizations, Category_realization_of_parent
     38from sage.misc.cachefunc import cached_method
     39from sage.categories.magmas import Magmas
     40from sage.misc.constant_function import ConstantFunction
     41from sage.categories.graded_hopf_algebras_with_basis import GradedHopfAlgebrasWithBasis
     42from sage.combinat.partition import Partition, Partitions, Partition_class
     43from sage.rings.all import Integer
     44from sage.combinat.combinat import InfiniteAbstractCombinatorialClass
     45import sage.combinat.sf.sfa as sfa
     46import sage.combinat.sf.sf
     47import monomial
     48from sage.rings.infinity import infinity
     49
     50class KBoundedQuotient(UniqueRepresentation, Parent):
     51
     52    def __init__(self, Sym, k, t='t'):
     53        r"""
     54        Initialization of the ring of Symmetric functions modulo the ideal of monomial
     55        symmetric functions which are indexed by partitions whose first part is greater
     56        than `k`.
     57
     58        INPUT:
     59
     60        - ``Sym`` -- an element of class :class:`sage.combinat.sf.sf.SymmetricFunctions`
     61
     62        - ``k`` -- a positive integer
     63
     64        - ``R`` -- a ring
     65
     66        EXAMPLES::
     67
     68            sage: Sym = SymmetricFunctions(QQ)
     69            sage: Q = Sym.kBoundedQuotient(3,t=1)
     70            sage: Q
     71            3-Bounded Quotient of Symmetric Functions over Rational Field with t=1
     72            sage: km = Q.km()
     73            sage: km
     74            3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded monomial basis
     75            sage: F = Q.affineSchur()
     76            sage: F(km(F[3,1,1])) == F[3,1,1]
     77            True
     78            sage: km(F(km([3,2]))) == km[3,2]
     79            True
     80            sage: F[3,2].lift()
     81            m[1, 1, 1, 1, 1] + m[2, 1, 1, 1] + m[2, 2, 1] + m[3, 1, 1] + m[3, 2]
     82            sage: F[2,1]*F[2,1]
     83            2*F3[1, 1, 1, 1, 1, 1] + 4*F3[2, 1, 1, 1, 1] + 4*F3[2, 2, 1, 1] + 4*F3[2, 2, 2] + 2*F3[3, 1, 1, 1] + 4*F3[3, 2, 1] + 2*F3[3, 3]
     84            sage: F[1,2]
     85            Traceback (most recent call last):
     86            ...
     87            ValueError: [1, 2] is not a valid partition
     88            sage: F[4,2]
     89            Traceback (most recent call last):
     90            ...
     91            ValueError: Partition is not 3-bounded
     92            sage: km[2,1]*km[2,1]
     93            4*m3[2, 2, 1, 1] + 6*m3[2, 2, 2] + 2*m3[3, 2, 1] + 2*m3[3, 3]
     94            sage: HLPk = Q.kHallLittlewoodP()
     95            sage: HLPk[2,1]*HLPk[2,1]
     96            4*HLP3[2, 2, 1, 1] + 6*HLP3[2, 2, 2] + 2*HLP3[3, 2, 1] + 2*HLP3[3, 3]
     97            sage: dks = Q.dual_k_Schur()
     98            sage: dks[2,1]*dks[2,1]
     99            2*dks3[1, 1, 1, 1, 1, 1] + 4*dks3[2, 1, 1, 1, 1] + 4*dks3[2, 2, 1, 1] + 4*dks3[2, 2, 2] + 2*dks3[3, 1, 1, 1] + 4*dks3[3, 2, 1] + 2*dks3[3, 3]
     100
     101        ::
     102
     103            sage: Q = Sym.kBoundedQuotient(3)
     104            Traceback (most recent call last):
     105            ...
     106            TypeError: unable to convert t to a rational
     107            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     108            sage: Q = Sym.kBoundedQuotient(3)
     109            sage: km = Q.km()
     110            sage: F = Q.affineSchur()
     111            sage: F(km(F[3,1,1])) == F[3,1,1]
     112            True
     113            sage: km(F(km([3,2]))) == km[3,2]
     114            True
     115            sage: dks = Q.dual_k_Schur()
     116            sage: HLPk = Q.kHallLittlewoodP()
     117            sage: dks(HLPk(dks[3,1,1])) == dks[3,1,1]
     118            True
     119            sage: km(dks(km([3,2]))) == km[3,2]
     120            True
     121            sage: dks[2,1]*dks[2,1]
     122            (t^3+t^2)*dks3[1, 1, 1, 1, 1, 1] + (2*t^2+2*t)*dks3[2, 1, 1, 1, 1] + (t^2+2*t+1)*dks3[2, 2, 1, 1] + (t^2+2*t+1)*dks3[2, 2, 2] + (t+1)*dks3[3, 1, 1, 1] + (2*t+2)*dks3[3, 2, 1] + (t+1)*dks3[3, 3]
     123
     124        TESTS::
     125
     126            sage: TestSuite(Q).run()
     127
     128        """
     129        R = Sym.base_ring()
     130        self.k = k
     131        self.t = R(t)
     132        self._base = R # Won't be needed when CategoryObject won't override anymore base_ring
     133        self._sym = Sym
     134        if t==1:
     135            self._quotient_basis = Sym.m()
     136        else:
     137            self._quotient_basis = Sym.hall_littlewood(t=self.t).P()
     138        Parent.__init__(self, category = GradedHopfAlgebras(R).Quotients().WithRealizations())
     139        self.indices = ConstantFunction(Partitions_all_bounded(k))
     140
     141    def ambient(self):
     142        r"""
     143
     144        Returns the Symmetric Functions over the same ring as ``self``. This is needed to
     145        realize our ring as a quotient.
     146
     147        TESTS::
     148
     149            sage: Sym = SymmetricFunctions(QQ)
     150            sage: Q = Sym.kBoundedQuotient(3,t=1)
     151            sage: Q.ambient()
     152            Symmetric Functions over Rational Field
     153
     154        """
     155        return self._sym
     156
     157    def a_realization(self):
     158        r"""
     159        Returns a particular realization of ``self`` (the basis of `k`-bounded monomials
     160        if `t=1` and the basis of `k`-bounded Hall-Littlewood functions otherwise).
     161
     162        EXAMPLES::
     163
     164            sage: Sym = SymmetricFunctions(QQ)
     165            sage: Q = Sym.kBoundedQuotient(3,t=1)
     166            sage: Q.a_realization()
     167            3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded monomial basis
     168            sage: Q = Sym.kBoundedQuotient(3,t=2)
     169            sage: Q.a_realization()
     170            3-Bounded Quotient of Symmetric Functions over Rational Field with t=2 in the 3-bounded Hall-Littlewood P basis
     171        """
     172        if self.t==1:
     173            return self.kmonomial()
     174        else:
     175            return self.kHallLittlewoodP()
     176
     177    def _repr_(self):
     178        r"""
     179        Representation of ``self``.
     180
     181        TESTS::
     182
     183            sage: Sym = SymmetricFunctions(RR) # indirect doctest
     184            sage: Sym.kBoundedQuotient(4,t=1)
     185            4-Bounded Quotient of Symmetric Functions over Real Field with 53 bits of precision with t=1.00000000000000
     186        """
     187        ending = ""
     188        if str(self.t)!='t':
     189            ending = ' with t=%s'%(self.t)
     190        return "%s-Bounded Quotient of Symmetric Functions over %s"%(self.k, self.base_ring())+ending
     191
     192    def kmonomial(self):
     193        r"""
     194        The monomial basis of the `k`-bounded quotient of symmetric functions, indexed by
     195        `k`-bounded partitions.
     196
     197        EXAMPLES::
     198
     199            sage: SymmetricFunctions(QQ).kBoundedQuotient(2,t=1).kmonomial()
     200            2-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 2-bounded monomial basis
     201        """
     202        return kMonomial(self)
     203
     204    km = kmonomial
     205
     206    def kHallLittlewoodP(self):
     207        r"""
     208        The Hall-Littlewood P basis of the `k`-bounded quotient of symmetric functions,
     209        indexed by `k`-bounded partitions.  At `t=1` this basis is equal to the
     210        `k`-bounded monomial basis and calculations will be faster using elements in the
     211        `k`-bounded monomial basis (see :meth:`kmonomial`).
     212
     213        EXAMPLES::
     214
     215            sage: SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(2).kHallLittlewoodP()
     216            2-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 2-bounded Hall-Littlewood P basis
     217        """
     218        return kbounded_HallLittlewoodP(self)
     219
     220    kHLP = kHallLittlewoodP
     221
     222    def dual_k_Schur(self):
     223        r"""
     224        The dual `k`-Schur basis of the `k`-bounded quotient of symmetric functions,
     225        indexed by `k`-bounded partitions.  At `t=1` this is also equal to the affine
     226        Schur basis and calculations will be faster using elements in the :meth:`affineSchur`
     227        basis.
     228
     229        EXAMPLES::
     230
     231            sage: SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(2).dual_k_Schur()
     232            2-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the dual 2-Schur basis
     233        """
     234        return DualkSchurFunctions(self)
     235
     236    dks = dual_k_Schur
     237
     238    def affineSchur(self):
     239        r"""
     240        The affine Schur basis of the `k`-bounded quotient of symmetric functions,
     241        indexed by `k`-bounded partitions.  This is also equal to the affine Stanley
     242        symmetric functions (see :meth:`WeylGroups.ElementMethods.stanley_symmetric_function`)
     243        indexed by an affine Grassmannian permutation.
     244
     245        EXAMPLES::
     246
     247            sage: SymmetricFunctions(QQ).kBoundedQuotient(2,t=1).affineSchur()
     248            2-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 2-bounded affine Schur basis
     249        """
     250        return AffineSchurFunctions(self)
     251
     252    F = affineSchur
     253
     254    @cached_method
     255    def _G_to_km_on_basis_single_level(self, w, m):
     256        r"""
     257        Returns the `m^{th}` level of the affine Grothendieck polynomial indexed by the
     258        affine Permutation ``w``.  This code could be significantly sped up if it didn't
     259        depend on the Iwahori Hecke algebra code.
     260
     261        INPUT:
     262
     263        - ``w`` -- An affine permutation (an element of the affine type `A` Weyl group).
     264
     265        - ``m`` -- An integer.
     266
     267        OUTPUT:
     268
     269        - An element of the `k`-bounded quotient.
     270
     271        EXAMPLES::
     272
     273            sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     274            sage: W = WeylGroup(['A',3,1])
     275            sage: Q._G_to_km_on_basis_single_level(W.an_element(), 3)
     276            0
     277            sage: Q._G_to_km_on_basis_single_level(W.an_element(), 4)
     278            m3[1, 1, 1, 1]
     279            sage: Q._G_to_km_on_basis_single_level(W.an_element(), 5)
     280            -4*m3[1, 1, 1, 1, 1]
     281
     282        """
     283        kB = self._sym.kBoundedSubspace(self.k,t=1)
     284        g = kB.K_kschur()
     285        mon = self.km()
     286        if m < w.length():
     287            return 0
     288        ans = self.zero()
     289        for la in Partitions(m, max_part = self.k):
     290                ans += g.homogeneous_basis_noncommutative_variables_zero_Hecke((la)).coefficient(w)*mon(la)
     291        return ans
     292
     293    def _AffineGrothendieck(self, w,m):
     294        r"""
     295        Returns the affine Grothendieck polynomial indexed by the affine permutation
     296        ``w``.  Because this belongs to the completion of the algebra, and hence is an
     297        infinite sum, it computes only up to those symmetric functions of degree at most
     298        ``m``.
     299
     300        INPUT:
     301
     302        - ``w`` -- An affine permutation (an element of the affine type `A` Weyl group).
     303
     304        - ``m`` -- An integer.
     305
     306        OUTPUT:
     307
     308        - An element of the `k`-bounded quotient.
     309
     310        EXAMPLES::
     311
     312            sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     313            sage: W = WeylGroup(['A',3,1])
     314            sage: Q._AffineGrothendieck(W.an_element(), 5)
     315            m3[1, 1, 1, 1] - 4*m3[1, 1, 1, 1, 1]
     316        """
     317        return sum(self._G_to_km_on_basis_single_level(w,j) for j in range(w.length(),m+1))
     318
     319    @cached_method
     320    def _AffineGrothendieckPolynomial(self, la, m):
     321        r"""
     322        Returns the affine Grothendieck polynomial indexed by the partition ``la``.
     323        Because this belongs to the completion of the algebra, and hence is an infinite
     324        sum, it computes only up to those symmetric functions of degree at most ``m``.
     325        This method is here to cache the polynomials.
     326
     327        INPUT:
     328
     329        - ``la`` -- A `k`-bounded partition
     330
     331        - ``m`` -- An integer
     332
     333        EXAMPLES::
     334
     335            sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     336            sage: Q._AffineGrothendieckPolynomial(Partition([2,1]),4)
     337            2*m3[1, 1, 1] - 8*m3[1, 1, 1, 1] + m3[2, 1] - 3*m3[2, 1, 1] - m3[2, 2]
     338        """
     339        return self._AffineGrothendieck(la.to_core(self.k).to_grassmannian(),m)
     340
     341    def AffineGrothendieckPolynomial(self, la, m):
     342        r"""
     343        Returns the affine Grothendieck polynomial indexed by the partition ``la``.
     344        Because this belongs to the completion of the algebra, and hence is an infinite
     345        sum, it computes only up to those symmetric functions of degree at most ``m``.
     346        See :meth:`_AffineGrothendieckPolynomial` for the code.
     347
     348        INPUT:
     349
     350        - ``la`` -- A `k`-bounded partition
     351
     352        - ``m`` -- An integer
     353
     354        EXAMPLES::
     355
     356            sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     357            sage: Q.AffineGrothendieckPolynomial([2,1],4)
     358            2*m3[1, 1, 1] - 8*m3[1, 1, 1, 1] + m3[2, 1] - 3*m3[2, 1, 1] - m3[2, 2]
     359        """
     360        if la == []:
     361            return self.a_realization().one()
     362        return self._AffineGrothendieckPolynomial(Partition(la),m)
     363
     364    def an_element(self):
     365        r"""
     366        Returns an element of the quotient ring of `k`-bounded symmetric functions. This
     367        method is here to make the TestSuite run properly.
     368
     369        EXAMPLES::
     370
     371            sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     372            sage: Q.an_element()
     373            m3[] + 2*m3[1] + 3*m3[2]
     374        """
     375        return self.a_realization().an_element()
     376
     377    def one(self):
     378        r"""
     379        Returns the unit of the quotient ring of `k`-bounded symmetric functions. This
     380        method is here to make the TestSuite run properly.
     381
     382        EXAMPLES::
     383
     384            sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     385            sage: Q.one()
     386            m3[]
     387        """
     388        return self.a_realization().one()
     389
     390    def retract(self,la):
     391        r"""
     392        Gives the retract map from the symmetric functions to the quotient ring of
     393        `k`-bounded symmetric functions. This method is here to make the TestSuite run
     394        properly.
     395
     396        INPUT:
     397
     398        - ``la`` -- A partition
     399
     400        OUTPUT:
     401
     402        - The monomial element of the `k`-bounded quotient indexed by ``la``.
     403
     404        EXAMPLES::
     405
     406            sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     407            sage: Q.retract([2,1])
     408            m3[2, 1]
     409        """
     410        km = self.a_realization()
     411        return km.retract(la)
     412
     413    def lift(self, la):
     414        r"""
     415        Gives the lift map from the quotient ring of `k`-bounded symmetric functions to
     416        the symmetric functions. This method is here to make the TestSuite run properly.
     417
     418        INPUT:
     419
     420        - ``la`` -- A `k`-bounded partition
     421
     422        OUTPUT:
     423
     424        - The monomial element or a Hall-Littlewood P element of the symmetric functions
     425            indexed by the partition ``la``.
     426
     427        EXAMPLES::
     428
     429            sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     430            sage: Q.lift([2,1])
     431            m[2, 1]
     432            sage: Q = SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(3)
     433            sage: Q.lift([2,1])
     434            HLP[2, 1]
     435       """
     436        km = self.a_realization()
     437        return km.lift(la)
     438
     439    def realizations(self):
     440        """
     441        A list of realizations of the `k`-bounded quotient.
     442
     443        EXAMPLES::
     444
     445            sage: kQ = SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(3)
     446            sage: kQ.realizations()
     447            [3-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 3-bounded monomial basis, 3-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 3-bounded Hall-Littlewood P basis, 3-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 3-bounded affine Schur basis, 3-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the dual 3-Schur basis]
     448            sage: HLP = kQ.ambient().hall_littlewood().P()
     449            sage: all( rzn(HLP[3,2,1]).lift() == HLP[3,2,1] for rzn in kQ.realizations())
     450            True
     451            sage: kQ = SymmetricFunctions(QQ).kBoundedQuotient(3,1)
     452            sage: kQ.realizations()
     453            [3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded monomial basis, 3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded Hall-Littlewood P basis, 3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded affine Schur basis, 3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the dual 3-Schur basis]
     454            sage: m = kQ.ambient().m()
     455            sage: all( rzn(m[3,2,1]).lift() == m[3,2,1] for rzn in kQ.realizations())
     456            True
     457        """
     458        return [ self.km(), self.kHLP(), self.affineSchur(), self.dual_k_Schur()]
     459
     460class KBoundedQuotientBases(Category_realization_of_parent):
     461    r"""
     462    The category of bases for the `k`-bounded subspace of symmetric functions.
     463    """
     464
     465    def __init__(self, base):
     466        """
     467        Initialization of the bases of the `k`-bounded subspace.
     468
     469        INPUT:
     470
     471        - ``base`` -- a basis in the `k`-bounded subspace
     472
     473        TESTS::
     474
     475            sage: Sym = SymmetricFunctions(QQ['t'])
     476            sage: from sage.combinat.sf.k_dual import KBoundedQuotientBases
     477            sage: Q = Sym.kBoundedQuotient(3,t=1)
     478            sage: F = Q.affineSchur()
     479            sage: KQB = KBoundedQuotientBases(F); KQB
     480            Category of k bounded quotient bases of 3-Bounded Quotient of Symmetric Functions over Univariate Polynomial Ring in t over Rational Field with t=1 in the 3-bounded affine Schur basis
     481        """
     482        Category_realization_of_parent.__init__(self, base)
     483
     484    def super_categories(self):
     485        r"""
     486        The super categories of ``self``.
     487
     488        EXAMPLES::
     489
     490            sage: Sym = SymmetricFunctions(QQ['t'])
     491            sage: from sage.combinat.sf.k_dual import KBoundedQuotientBases
     492            sage: Q = Sym.kBoundedQuotient(3,t=1)
     493            sage: KQB = KBoundedQuotientBases(Q)
     494            sage: KQB.super_categories()
     495            [Category of realizations of 3-Bounded Quotient of Symmetric Functions over Univariate Polynomial Ring in t over Rational Field with t=1, Join of Category of graded hopf algebras with basis over Univariate Polynomial Ring in t over Rational Field and Category of subquotients of monoids and Category of quotients of semigroups]
     496        """
     497        R = self.base().base_ring()
     498        category = GradedHopfAlgebrasWithBasis(R)
     499        return [Realizations(self.base()), category.Quotients()]
     500
     501
     502    class ParentMethods:
     503
     504        def retract(self,la):
     505            r"""
     506            Gives the retract map from the symmetric functions to the quotient ring of
     507            `k`-bounded symmetric functions. This method is here to make the TestSuite run
     508            properly.
     509
     510            INPUT:
     511
     512            - ``la`` -- A partition
     513
     514            OUTPUT:
     515
     516            - The monomial element of the `k`-bounded quotient indexed by ``la``.
     517
     518            EXAMPLES::
     519
     520                sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     521                sage: Q.retract([2,1])
     522                m3[2, 1]
     523            """
     524            kmhlp = self.realization_of().a_realization()
     525            return kmhlp.retract(la)
     526
     527        def _element_constructor_(self, x):
     528            r"""
     529            Needed to rewrite the element constructor because of a bug in free_module.py.
     530            Ideally :meth:`_element_constructor_` would be inherited from free_module.py,
     531            but it allows for bad inputs.
     532
     533            INPUT:
     534
     535            - ``x`` -- a `k`-bounded partition
     536
     537            OUTPUT:
     538
     539            - an element of the `k`-bounded basis
     540
     541            EXAMPLES::
     542
     543                sage: Q = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1)
     544                sage: F = Q.affineSchur()
     545                sage: F([2,1])
     546                F3[2, 1]
     547                sage: F(Partition([4,1]))
     548                Traceback (most recent call last):
     549                ...
     550                TypeError: do not know how to make x (= [4, 1]) an element of self (=3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded affine Schur basis)
     551            """
     552            R = self.base_ring()
     553            eclass = self.element_class
     554
     555            #Coerce ints to Integers
     556            if isinstance(x, int):
     557                x = Integer(x)
     558            if x in R:
     559                if x == 0:
     560                    return self.zero()
     561                else:
     562                    raise TypeError, "do not know how to make x (= %s) an element of %s"%(x, self)
     563            #x is an element of the basis enumerated set;
     564            elif x in self._basis_keys:
     565                return self.monomial(self._basis_keys(x))
     566            raise TypeError, "do not know how to make x (= %s) an element of self (=%s)"%(x,self)
     567
     568        def ambient(self):
     569            r"""
     570            Returns the symmetric functions.
     571
     572            EXAMPLES::
     573
     574                sage: km = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).km()
     575                sage: km.ambient()
     576                Symmetric Functions over Rational Field
     577            """
     578            return self.realization_of()._sym
     579
     580        def __getitem__(self, c, *rest):
     581            r"""
     582            Implements shorthand for accessing basis elements.
     583
     584            For a basis `X` indexed by partitions, this method allows for
     585            `X[[3,2]]` and `X[3,2]` to be equivalent to `X[Partition([3,2])]`.
     586
     587            Due to limitations in Python syntax, one must use `X[[]]` and not
     588            `X[]` for the basis element indexed by the empty partition.
     589
     590            EXAMPLES::
     591
     592                sage: F = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).affineSchur()
     593                sage: F[3,2]
     594                F3[3, 2]
     595                sage: F[[]]
     596                F3[]
     597            """
     598            if isinstance(c, Partition_class):
     599                assert len(rest) == 0
     600            else:
     601                if len(rest) > 0 or isinstance(c,(int,Integer)):
     602                    c = Partition([c]+list(rest))
     603                else:
     604                    c = Partition(list(c))
     605            if len(c) != 0 and c[0] > self.k:
     606                raise ValueError, "Partition is not %d-bounded" %self.k
     607            return self.monomial(c)
     608
     609        def _repr_term(self, c):
     610            """
     611            Display elements with single brackets.
     612
     613            The default implementation of CombinatorialFreeModule gives double
     614            brackets for basis elements indexed by partitions, i.e.,
     615            `X[[3,2]]`.
     616
     617            EXAMPLES::
     618
     619                sage: F = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).affineSchur()
     620                sage: F[3,2]    # indirect doctest
     621                F3[3, 2]
     622            """
     623            return self.prefix()+str(c)
     624
     625        @cached_method
     626        def one_basis(self):
     627            r"""
     628            Return the basis element indexing ``1``.
     629
     630            EXAMPLES::
     631
     632                sage: F = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).affineSchur()
     633                sage: F.one()  # indirect doctest
     634                F3[]
     635            """
     636            return Partition([])
     637
     638        def an_element(self):
     639            r"""
     640            Return an element of ``self``.
     641
     642            EXAMPLES::
     643
     644                sage: SymmetricFunctions(QQ['t']).kBoundedQuotient(3,t=1).an_element()
     645                m3[] + 2*m3[1] + 3*m3[2]
     646            """
     647
     648            return self( Partition(srange(self.k,0,-1)))
     649
     650        # This is sufficient for degree to work
     651
     652        def degree_on_basis(self, b):
     653            r"""
     654            Return the degree of the basis element indexed by ``b``.
     655
     656            INPUT:
     657
     658            - ``b`` -- a partition
     659
     660            EXAMPLES::
     661
     662                sage: F = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).affineSchur()
     663                sage: F.degree_on_basis(Partition([3,2]))
     664                5
     665            """
     666            return sum(b)
     667
     668        def indices(self):
     669            r"""
     670            The set of `k`-bounded partitions of all non-negative integers.
     671
     672            EXAMPLES::
     673                sage: km = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).km()
     674                sage: km.indices()
     675                3-Bounded Partitions
     676            """
     677            return Partitions_all_bounded(self.k)
     678
     679        def lift(self, la):
     680            r"""
     681            Implements the lift map from the basis ``self`` to the monomial basis of
     682            symmetric functions.
     683
     684            INPUT:
     685
     686            - ``la`` -- A `k`-bounded partition.
     687
     688            OUTPUT:
     689
     690            - A symmetric function in the monomial basis.
     691
     692            EXAMPLES::
     693
     694                sage: F = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).affineSchur()
     695                sage: F.lift([3,1])
     696                m[1, 1, 1, 1] + m[2, 1, 1] + m[2, 2] + m[3, 1]
     697                sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     698                sage: dks = Sym.kBoundedQuotient(3).dual_k_Schur()
     699                sage: dks.lift([3,1])
     700                t^5*HLP[1, 1, 1, 1] + t^2*HLP[2, 1, 1] + t*HLP[2, 2] + HLP[3, 1]
     701                sage: dks = Sym.kBoundedQuotient(3,t=1).dual_k_Schur()
     702                sage: dks.lift([3,1])
     703                m[1, 1, 1, 1] + m[2, 1, 1] + m[2, 2] + m[3, 1]
     704            """
     705            kmhlp = self.realization_of().a_realization()
     706            return kmhlp(self(la)).lift()
     707
     708        def product(self, x, y):
     709            r"""
     710            Returns the product of two elements ``x`` and ``y``.
     711
     712            INPUT:
     713
     714            - ``x``, ``y`` -- Elements of the `k`-bounded quotient of symmetric functions.
     715
     716            OUTPUT:
     717
     718            - A `k`-bounded symmetric function in the dual `k`-Schur function basis
     719
     720            EXAMPLES::
     721
     722                sage: dks3 = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).dual_k_Schur()
     723                sage: dks3.product(dks3[2,1],dks3[1,1])
     724                2*dks3[1, 1, 1, 1, 1] + 2*dks3[2, 1, 1, 1] + 2*dks3[2, 2, 1] + dks3[3, 1, 1] + dks3[3, 2]
     725                sage: dks3.product(dks3[2,1]+dks3[1], dks3[1,1])
     726                dks3[1, 1, 1] + 2*dks3[1, 1, 1, 1, 1] + dks3[2, 1] + 2*dks3[2, 1, 1, 1] + 2*dks3[2, 2, 1] + dks3[3, 1, 1] + dks3[3, 2]
     727                sage: dks3.product(dks3[2,1]+dks3[1], dks3([]))
     728                dks3[1] + dks3[2, 1]
     729                sage: dks3.product(dks3([]), dks3([]))
     730                dks3[]
     731                sage: dks3.product(dks3([]), dks3([4,1]))
     732                Traceback (most recent call last):
     733                ...
     734                TypeError: do not know how to make x (= [4, 1]) an element of self (=3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the dual 3-Schur basis)
     735
     736            ::
     737
     738                sage: dks3 = SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(3).dual_k_Schur()
     739                sage: dks3.product(dks3[2,1],dks3[1,1])
     740                (t^2+t)*dks3[1, 1, 1, 1, 1] + (t+1)*dks3[2, 1, 1, 1] + (t+1)*dks3[2, 2, 1] + dks3[3, 1, 1] + dks3[3, 2]
     741                sage: dks3.product(dks3[2,1]+dks3[1], dks3[1,1])
     742                dks3[1, 1, 1] + (t^2+t)*dks3[1, 1, 1, 1, 1] + dks3[2, 1] + (t+1)*dks3[2, 1, 1, 1] + (t+1)*dks3[2, 2, 1] + dks3[3, 1, 1] + dks3[3, 2]
     743                sage: dks3.product(dks3[2,1]+dks3[1], dks3([]))
     744                dks3[1] + dks3[2, 1]
     745                sage: dks3.product(dks3([]), dks3([]))
     746                dks3[]
     747
     748            ::
     749
     750                sage: F = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).affineSchur()
     751                sage: F.product(F[2,1],F[1,1])
     752                2*F3[1, 1, 1, 1, 1] + 2*F3[2, 1, 1, 1] + 2*F3[2, 2, 1] + F3[3, 1, 1] + F3[3, 2]
     753                sage: F.product(F[2,1]+F[1], F[1,1])
     754                F3[1, 1, 1] + 2*F3[1, 1, 1, 1, 1] + F3[2, 1] + 2*F3[2, 1, 1, 1] + 2*F3[2, 2, 1] + F3[3, 1, 1] + F3[3, 2]
     755                sage: F.product(F[2,1]+F[1], F([]))
     756                F3[1] + F3[2, 1]
     757                sage: F.product(F([]), F([]))
     758                F3[]
     759                sage: F.product(F([]), F([4,1]))
     760                Traceback (most recent call last):
     761                ...
     762                TypeError: do not know how to make x (= [4, 1]) an element of self (=3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded affine Schur basis)
     763
     764            ::
     765
     766                sage: F = SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(3).affineSchur()
     767                sage: F.product(F[2,1],F[1,1])
     768                2*F3[1, 1, 1, 1, 1] + 2*F3[2, 1, 1, 1] + 2*F3[2, 2, 1] + F3[3, 1, 1] + F3[3, 2]
     769                sage: F.product(F[2,1],F[2])
     770                (t^4+t^3-2*t^2+1)*F3[1, 1, 1, 1, 1] + (-t^2+t+1)*F3[2, 1, 1, 1] + (-t^2+t+2)*F3[2, 2, 1] + (t+1)*F3[3, 1, 1] + (t+1)*F3[3, 2]
     771                sage: F.product(F[2,1]+F[1], F[1,1])
     772                F3[1, 1, 1] + 2*F3[1, 1, 1, 1, 1] + F3[2, 1] + 2*F3[2, 1, 1, 1] + 2*F3[2, 2, 1] + F3[3, 1, 1] + F3[3, 2]
     773                sage: F.product(F[2,1]+F[1], F([]))
     774                F3[1] + F3[2, 1]
     775                sage: F.product(F([]), F([]))
     776                F3[]
     777
     778            ::
     779
     780                sage: km = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).km()
     781                sage: km.product(km[2,1],km[2,1])
     782                4*m3[2, 2, 1, 1] + 6*m3[2, 2, 2] + 2*m3[3, 2, 1] + 2*m3[3, 3]
     783                sage: Q3 = SymmetricFunctions(FractionField(QQ['t'])).kBoundedQuotient(3)
     784                sage: km = Q3.km()
     785                sage: km.product(km[2,1],km[2,1])
     786                (t^5+7*t^4-8*t^3-28*t^2+47*t-19)*m3[1, 1, 1, 1, 1, 1] + (t^4-3*t^3-9*t^2+23*t-12)*m3[2, 1, 1, 1, 1] + (-t^3-3*t^2+11*t-3)*m3[2, 2, 1, 1] + (-t^2+5*t+2)*m3[2, 2, 2] + (6*t-6)*m3[3, 1, 1, 1] + (3*t-1)*m3[3, 2, 1] + (t+1)*m3[3, 3]
     787                sage: dks = Q3.dual_k_Schur()
     788                sage: km.product(dks[2,1],dks[1,1])
     789                20*m3[1, 1, 1, 1, 1] + 9*m3[2, 1, 1, 1] + 4*m3[2, 2, 1] + 2*m3[3, 1, 1] + m3[3, 2]
     790            """
     791            return self( x.lift() * y.lift() )
     792
     793    class ElementMethods:
     794        pass
     795
     796class kMonomial(CombinatorialFreeModule):
     797    r"""
     798    The basis of monomial symmetric functions indexed by partitions with first
     799    part less than or equal to `k`.
     800    """
     801
     802    def __init__(self, kBoundedRing):
     803        r"""
     804        Initializes the ring which is the `k`-Bounded monomial quotient basis.
     805
     806        INPUT:
     807
     808        - ``kBoundedRing`` -- an element which is of class :class:`KBoundedQuotient`
     809
     810        EXAMPLES::
     811
     812            sage: from sage.combinat.sf.k_dual import kMonomial
     813            sage: km = kMonomial(SymmetricFunctions(QQ).kBoundedQuotient(4,t=1))
     814            sage: km
     815            4-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 4-bounded monomial basis
     816            sage: TestSuite(km).run()
     817        """
     818        CombinatorialFreeModule.__init__(self, kBoundedRing.base_ring(),
     819            kBoundedRing.indices(),
     820            category= KBoundedQuotientBases(kBoundedRing),
     821            prefix='m%d'%kBoundedRing.k)
     822
     823        self._kBoundedRing = kBoundedRing
     824
     825        self.k = kBoundedRing.k
     826        self.t = kBoundedRing.t
     827        Sym = kBoundedRing.ambient()
     828        Sym_m_to_mk = Sym.m().module_morphism(self.retract,codomain=self).register_as_coercion()
     829
     830    # The following are meant to be inherited with the category framework, but
     831    # this fails because they are methods of Parent. The trick below overcomes
     832    # this problem.
     833    __getitem__ = KBoundedQuotientBases.ParentMethods.__getitem__.im_func
     834    _repr_term = KBoundedQuotientBases.ParentMethods._repr_term.im_func
     835    _element_constructor_ = KBoundedQuotientBases.ParentMethods._element_constructor_.im_func
     836    _element_constructor = _element_constructor_
     837
     838    def _repr_(self):
     839        """
     840        TESTS::
     841
     842            sage: Sym = SymmetricFunctions(QQ)
     843            sage: km = Sym.kBoundedQuotient(3,t=1).km()
     844            sage: km._repr_()
     845            '3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded monomial basis'
     846        """
     847        return self.realization_of()._repr_()+' in the %s-bounded monomial basis'%(self.k)
     848
     849    def retract(self, la):
     850        r"""
     851        Implements the retract function on the monomial basis. Given a partition ``la``,
     852        the retract will return the corresponding `k`-bounded monomial basis element if
     853        ``la`` is `k`-bounded; zero otherwise.
     854
     855        INPUT:
     856
     857        - ``la`` -- A partition
     858
     859        OUTPUT:
     860
     861        - A `k`-bounded monomial symmetric function in the `k`-quotient of symmetric
     862            functions.
     863
     864        EXAMPLES::
     865
     866            sage: km = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).km()
     867            sage: km.retract(Partition([3,1]))
     868            m3[3, 1]
     869            sage: km.retract(Partition([4,1]))
     870            0
     871            sage: km.retract([])
     872            m3[]
     873            sage: m = SymmetricFunctions(QQ).m()
     874            sage: km(m[3, 1])
     875            m3[3, 1]
     876            sage: km(m[4, 1])
     877            0
     878
     879        ::
     880
     881            sage: km = SymmetricFunctions(FractionField(QQ['t'])).kBoundedQuotient(3).km()
     882            sage: km.retract(Partition([3,1]))
     883            m3[3, 1]
     884            sage: km.retract(Partition([4,1]))
     885            (t^4+t^3-9*t^2+11*t-4)*m3[1, 1, 1, 1, 1] + (-3*t^2+6*t-3)*m3[2, 1, 1, 1] + (-t^2+3*t-2)*m3[2, 2, 1] + (2*t-2)*m3[3, 1, 1] + (t-1)*m3[3, 2]
     886            sage: m = SymmetricFunctions(FractionField(QQ['t'])).m()
     887            sage: km(m[3, 1])
     888            m3[3, 1]
     889            sage: km(m[4, 1])
     890            (t^4+t^3-9*t^2+11*t-4)*m3[1, 1, 1, 1, 1] + (-3*t^2+6*t-3)*m3[2, 1, 1, 1] + (-t^2+3*t-2)*m3[2, 2, 1] + (2*t-2)*m3[3, 1, 1] + (t-1)*m3[3, 2]
     891        """
     892        if la == []:
     893            return self([])
     894        if la[0] <= self.k:
     895            return self(la)
     896        if self.t==1:
     897            return self(0)
     898        else:
     899            kHLP = self._kBoundedRing.kHallLittlewoodP()
     900            return self(kHLP._m_to_kHLP_on_basis(la))
     901
     902    def lift(self, la):
     903        r"""
     904        Implements the lift function on the monomial basis. Given a `k`-bounded partition
     905        ``la``, the lift will return the corresponding monomial basis element.
     906
     907        INPUT:
     908
     909        - ``la`` -- A `k`-bounded partition
     910
     911        OUTPUT:
     912
     913        - A monomial symmetric function.
     914
     915        EXAMPLES::
     916
     917            sage: km = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).km()
     918            sage: km.lift(Partition([3,1]))
     919            m[3, 1]
     920            sage: km.lift([])
     921            m[]
     922            sage: km.lift(Partition([4,1]))
     923            Traceback (most recent call last):
     924            ...
     925            TypeError: do not know how to make x (= [4, 1]) an element of self (=3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded monomial basis)
     926        """
     927        m = self._kBoundedRing.ambient().m()
     928        return m._from_dict(dict(self(la)))
     929
     930class kbounded_HallLittlewoodP(CombinatorialFreeModule):
     931    r"""
     932    The basis of P Hall-Littlewood symmetric functions indexed by partitions with first
     933    part less than or equal to `k`.
     934    """
     935
     936    def __init__(self, kBoundedRing):
     937        r"""
     938        Initializes the ring which is the `k`-Bounded Hall-Littlewood P quotient basis.
     939
     940        INPUT:
     941
     942        - ``kBoundedRing`` -- an element which is of class :class:`KBoundedQuotient`
     943
     944        EXAMPLES::
     945
     946            sage: from sage.combinat.sf.k_dual import kbounded_HallLittlewoodP
     947            sage: kP = kbounded_HallLittlewoodP(SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(4))
     948            sage: kP
     949            4-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 4-bounded Hall-Littlewood P basis
     950            sage: TestSuite(kP).run()
     951        """
     952        CombinatorialFreeModule.__init__(self, kBoundedRing.base_ring(),
     953            kBoundedRing.indices(),
     954            category= KBoundedQuotientBases(kBoundedRing),
     955            prefix='HLP%d'%kBoundedRing.k)
     956
     957        self._kBoundedRing = kBoundedRing
     958
     959        self.k = kBoundedRing.k
     960        self.t = kBoundedRing.t
     961        Sym = kBoundedRing.ambient()
     962        Sym_HLP_to_kHLP = Sym.hall_littlewood(self.t).P().module_morphism(self.retract,codomain=self).register_as_coercion()
     963        km = self._kBoundedRing.km()
     964        kHLP_to_mk = self.module_morphism(self._HLP_to_mk_on_basis, codomain=km, triangular='lower', unitriangular=True).register_as_coercion()
     965        mk_to_kHLP = km.module_morphism(self._m_to_kHLP_on_basis, codomain=self, triangular='lower', unitriangular=True).register_as_coercion()
     966
     967    # The following are meant to be inherited with the category framework, but
     968    # this fails because they are methods of Parent. The trick below overcomes
     969    # this problem.
     970    __getitem__ = KBoundedQuotientBases.ParentMethods.__getitem__.im_func
     971    _repr_term = KBoundedQuotientBases.ParentMethods._repr_term.im_func
     972    _element_constructor_ = KBoundedQuotientBases.ParentMethods._element_constructor_.im_func
     973    _element_constructor = _element_constructor_
     974
     975    def _repr_(self):
     976        """
     977        TESTS::
     978
     979            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     980            sage: kHLP = Sym.kBoundedQuotient(3).kHallLittlewoodP()
     981            sage: kHLP._repr_()
     982            '3-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 3-bounded Hall-Littlewood P basis'
     983        """
     984        return self.realization_of()._repr_()+' in the %s-bounded Hall-Littlewood P basis'%(self.k)
     985
     986    def _m_to_kHLP_on_basis(self, la):
     987        r"""
     988        Converts from the monomial basis to the `k`-bounded Hall-Littlewood
     989        P basis.  If ``la`` is not `k`-bounded then it returns the projection of
     990        the monomial by the ideal generated by the Hall-Littlewood P basis indexed
     991        by partitions whose first part is greater than `k`.
     992
     993        INPUT:
     994
     995        - ``la`` - a partition
     996
     997        OUTPUT:
     998
     999        - an element of the `k`-bounded Hall-Littlewood P basis.
     1000
     1001        EXAMPLES::
     1002
     1003            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     1004            sage: kHLP = Sym.kBoundedQuotient(3).kHallLittlewoodP()
     1005            sage: kHLP._m_to_kHLP_on_basis([3,1])
     1006            (t^5-2*t^2-t+2)*HLP3[1, 1, 1, 1] + (t^2-1)*HLP3[2, 1, 1] + (t-1)*HLP3[2, 2] + HLP3[3, 1]
     1007            sage: kHLP._m_to_kHLP_on_basis([4])
     1008            (t^6-t^5-t^4+t^2+t-1)*HLP3[1, 1, 1, 1] + (t^3-t^2-t+1)*HLP3[2, 1, 1] + (t^2-t)*HLP3[2, 2] + (t-1)*HLP3[3, 1]
     1009            sage: mk = kHLP.realization_of().km()
     1010            sage: kHLP(mk([1,1])^2)
     1011            (t^4+t^3+2*t^2+t+1)*HLP3[1, 1, 1, 1] + (t+1)*HLP3[2, 1, 1] + HLP3[2, 2]
     1012            sage: kHLP._m_to_kHLP_on_basis([])
     1013            HLP3[]
     1014            sage: kHLP = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).kHallLittlewoodP()
     1015            sage: kHLP._m_to_kHLP_on_basis([3,1])
     1016            HLP3[3, 1]
     1017            sage: kHLP._m_to_kHLP_on_basis([4])
     1018            0
     1019            sage: mk = kHLP.realization_of().km()
     1020            sage: kHLP(mk([1,1])^2)
     1021            6*HLP3[1, 1, 1, 1] + 2*HLP3[2, 1, 1] + HLP3[2, 2]
     1022            sage: kHLP(mk([2,1])^2)
     1023            4*HLP3[2, 2, 1, 1] + 6*HLP3[2, 2, 2] + 2*HLP3[3, 2, 1] + 2*HLP3[3, 3]
     1024        """
     1025        if self.t==1:
     1026            if la in Partitions_all_bounded(self.k):
     1027                return self(la)
     1028            else:
     1029                return self(0)
     1030        else:
     1031            HLP = self._kBoundedRing._quotient_basis
     1032            m = self._kBoundedRing._sym.m()
     1033            elt = dict({ x for x in dict(HLP(m(la))).iteritems() if x[0] in Partitions_all_bounded(self.k) })
     1034            return self._from_dict(elt)
     1035
     1036    def _HLP_to_mk_on_basis(self, la):
     1037        r"""
     1038        Converts from the Hall-Littlewood P basis to the `k`-bounded monomial basis and
     1039        projects into the `k`-bounded quotient if ``la`` is not a bounded partition.
     1040
     1041        INPUT:
     1042
     1043        - ``la`` - a partition
     1044
     1045        OUTPUT:
     1046
     1047        - an element of the `k`-bounded monomial basis
     1048
     1049        EXAMPLES::
     1050
     1051            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     1052            sage: kHLP = Sym.kBoundedQuotient(3).kHallLittlewoodP()
     1053            sage: kHLP._HLP_to_mk_on_basis([3,1])
     1054            (t^3+t^2-5*t+3)*m3[1, 1, 1, 1] + (-2*t+2)*m3[2, 1, 1] + (-t+1)*m3[2, 2] + m3[3, 1]
     1055            sage: kHLP._HLP_to_mk_on_basis([4,1])
     1056            0
     1057            sage: kHLP._HLP_to_mk_on_basis([])
     1058            m3[]
     1059            sage: kHLP = Sym.kBoundedQuotient(3,t=1).kHallLittlewoodP()
     1060            sage: kHLP._HLP_to_mk_on_basis([3,1])
     1061            m3[3, 1]
     1062            sage: kHLP._HLP_to_mk_on_basis([4,1])
     1063            0
     1064            sage: kHLP._HLP_to_mk_on_basis([])
     1065            m3[]
     1066        """
     1067        mk = self._kBoundedRing.km()
     1068        if la not in Partitions_all_bounded(self.k):
     1069            return mk(0)
     1070        if self.t==1:
     1071            return mk(la)
     1072        else:
     1073            HLP = self._kBoundedRing._quotient_basis
     1074            return mk(HLP(la))
     1075
     1076    def retract(self, la):
     1077        r"""
     1078        Implements the retract function on the Hall-Littlewood P basis. Given a partition
     1079        ``la``, the retract will return the corresponding `k`-bounded Hall-Littlewood P
     1080        basis element if ``la`` is `k`-bounded; zero otherwise.
     1081
     1082        INPUT:
     1083
     1084        - ``la`` -- A partition
     1085
     1086        OUTPUT:
     1087
     1088        - A `k`-bounded Hall-Littlewood P symmetric function in the `k`-quotient of
     1089            symmetric functions.
     1090
     1091        EXAMPLES::
     1092
     1093            sage: kHLP = SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(3).kHallLittlewoodP()
     1094            sage: kHLP.retract(Partition([3,1]))
     1095            HLP3[3, 1]
     1096            sage: kHLP.retract(Partition([4,1]))
     1097            0
     1098            sage: kHLP.retract([])
     1099            HLP3[]
     1100            sage: m = kHLP.realization_of().ambient().m()
     1101            sage: kHLP(m[2,2])
     1102            (t^4-t^3-t+1)*HLP3[1, 1, 1, 1] + (t-1)*HLP3[2, 1, 1] + HLP3[2, 2]
     1103        """
     1104        if la == []:
     1105            return self([])
     1106        if la[0] > self.k:
     1107            return self.zero()
     1108        hlp = self._kBoundedRing.ambient().hall_littlewood(self.t).P()
     1109        f = hlp(la)
     1110        return sum(self(x)*f.coefficient(x) for x in f.support() if x in Partitions_all_bounded(self.k))
     1111
     1112    def lift(self, la):
     1113        r"""
     1114        Implements the lift function on the Hall-Littlewood P basis. Given a `k`-bounded
     1115        partition ``la``, the lift will return the corresponding Hall-Littlewood P basis
     1116        element.
     1117
     1118        INPUT:
     1119
     1120        - ``la`` -- A `k`-bounded partition
     1121
     1122        OUTPUT:
     1123
     1124        - A Hall-Littlewood symmetric function.
     1125
     1126        EXAMPLES::
     1127
     1128            sage: kHLP = SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(3).kHallLittlewoodP()
     1129            sage: kHLP.lift(Partition([3,1]))
     1130            HLP[3, 1]
     1131            sage: kHLP.lift([])
     1132            HLP[]
     1133            sage: kHLP.lift(Partition([4,1]))
     1134            Traceback (most recent call last):
     1135            ...
     1136            TypeError: do not know how to make x (= [4, 1]) an element of self (=3-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 3-bounded Hall-Littlewood P basis)
     1137        """
     1138        HLP = self._kBoundedRing.ambient().hall_littlewood(t=self.t).P()
     1139        return HLP._from_dict(dict(self(la)))
     1140
     1141class DualkSchurFunctions(CombinatorialFreeModule):
     1142    r"""
     1143    This basis is dual to the `k`-Schur functions.  The expansion is given
     1144    in Section 4.12 of [LLMSSZ]_.  When `t=1` this basis is equal to the
     1145    :class:`AffineSchurFunctions` and that basis is more efficient in this case.
     1146
     1147    REFERENCES:
     1148
     1149    .. [LLMSSZ] T. Lam, L. Lapointe, J. Morse, A. Schilling, M. Shimozono, M. Zabrocki,
     1150        k-Schur functions and affine Schubert calculus.
     1151    """
     1152
     1153    def __init__(self, kBoundedRing):
     1154        r"""
     1155        Initializes the ring which is the dual `k`-Schur function basis.
     1156
     1157        INPUT:
     1158
     1159        - ``kBoundedRing`` -- an element which is of class :class:`KBoundedQuotient`
     1160
     1161        EXAMPLES::
     1162
     1163            sage: from sage.combinat.sf.k_dual import DualkSchurFunctions
     1164            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     1165            sage: dks4 = DualkSchurFunctions(Sym.kBoundedQuotient(4))
     1166            sage: dks4
     1167            4-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the dual 4-Schur basis
     1168            sage: TestSuite(dks4).run()
     1169            sage: dks4 = DualkSchurFunctions(Sym.kBoundedQuotient(4,t=1))
     1170            sage: TestSuite(dks4).run()
     1171        """
     1172        CombinatorialFreeModule.__init__(self, kBoundedRing.base_ring(),
     1173            kBoundedRing.indices(),
     1174            category= KBoundedQuotientBases(kBoundedRing),
     1175            prefix='dks%d'%kBoundedRing.k)
     1176
     1177        self._kBoundedRing = kBoundedRing
     1178
     1179        self.k = kBoundedRing.k
     1180        self.t = kBoundedRing.t
     1181        kHLP = kBoundedRing.kHallLittlewoodP()
     1182        dks_to_khlp = self.module_morphism(self._dks_to_khlp_on_basis,codomain=kHLP).register_as_coercion()
     1183        khlp_to_dks = kHLP.module_morphism(self._khlp_to_dks_on_basis,codomain=self).register_as_coercion()
     1184
     1185    # The following are meant to be inherited with the category framework, but
     1186    # this fails because they are methods of Parent. The trick below overcomes
     1187    # this problem.
     1188    __getitem__ = KBoundedQuotientBases.ParentMethods.__getitem__.im_func
     1189    _repr_term = KBoundedQuotientBases.ParentMethods._repr_term.im_func
     1190    _element_constructor_ = KBoundedQuotientBases.ParentMethods._element_constructor_.im_func
     1191    _element_constructor = _element_constructor_
     1192
     1193    def _repr_(self):
     1194        """
     1195        TESTS::
     1196
     1197            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     1198            sage: dks3 = Sym.kBoundedQuotient(3).dual_k_Schur()
     1199            sage: dks3._repr_()
     1200            '3-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the dual 3-Schur basis'
     1201        """
     1202        return self.realization_of()._repr_()+' in the dual %s-Schur basis'%(self.k)
     1203
     1204    def _dks_to_khlp_on_basis(self, la):
     1205        r"""
     1206        Gives the expansion of the dual `k`-Schur basis element indexed by ``la`` into
     1207        the Hall-Littlewood P basis.
     1208
     1209        INPUT:
     1210
     1211        - ``la`` -- A `k`-bounded partition.
     1212
     1213        OUTPUT:
     1214
     1215        - A symmetric function in the Hall-Littlewood P basis
     1216
     1217        EXAMPLES::
     1218
     1219            sage: dks3 = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).dual_k_Schur()
     1220            sage: dks3._dks_to_khlp_on_basis(Partition([2,1]))
     1221            2*HLP3[1, 1, 1] + HLP3[2, 1]
     1222            sage: dks3._dks_to_khlp_on_basis(Partition([]))
     1223            HLP3[]
     1224            sage: dks3._dks_to_khlp_on_basis(Partition([4,1]))
     1225            Traceback (most recent call last):
     1226            ...
     1227            AssertionError: [4, 1] should be an element of 3-Bounded Partitions
     1228        """
     1229        Sym = self._kBoundedRing.ambient()
     1230        kB = Sym.kBoundedSubspace(self.k, t=self.t)
     1231        Qp = Sym.hall_littlewood(t=self.t).Qp()
     1232        ks = kB.kschur()
     1233        kHLP = self._kBoundedRing.kHallLittlewoodP()
     1234        return sum( ks(Qp(x)).coefficient(la) * kHLP(x) for x in Partitions(Partition(la).size(), max_part = self.k))
     1235
     1236    def _khlp_to_dks_on_basis(self, la):
     1237        r"""
     1238        Gives the expansion of the `k`-bounded Hall-Littlewood P basis element indexed by
     1239        ``la`` into the dual `k`-Schur basis.
     1240
     1241        INPUT:
     1242
     1243        - ``la`` -- A `k`-bounded partition.
     1244
     1245        OUTPUT:
     1246
     1247        - A `k`-bounded quotient symmetric function in the dual `k`-Schur basis
     1248
     1249        EXAMPLES::
     1250
     1251            sage: dks3 = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).dual_k_Schur()
     1252            sage: dks3._khlp_to_dks_on_basis(Partition([2,1]))
     1253            -2*dks3[1, 1, 1] + dks3[2, 1]
     1254            sage: dks3._khlp_to_dks_on_basis([2,1])
     1255            -2*dks3[1, 1, 1] + dks3[2, 1]
     1256            sage: dks3._khlp_to_dks_on_basis(Partition([]))
     1257            dks3[]
     1258            sage: dks3._khlp_to_dks_on_basis(Partition([4,1]))
     1259            0
     1260
     1261        ::
     1262
     1263            sage: dks3 = SymmetricFunctions(QQ['t'].fraction_field()).kBoundedQuotient(3).dual_k_Schur()
     1264            sage: dks3._khlp_to_dks_on_basis(Partition([2,1]))
     1265            (-t^2-t)*dks3[1, 1, 1] + dks3[2, 1]
     1266            sage: dks3._khlp_to_dks_on_basis(Partition([2,2]))
     1267            (t^3-t^2)*dks3[1, 1, 1, 1] - t*dks3[2, 1, 1] + dks3[2, 2]
     1268            sage: dks3._khlp_to_dks_on_basis(Partition([]))
     1269            dks3[]
     1270            sage: dks3._khlp_to_dks_on_basis(Partition([4,1]))
     1271            0
     1272        """
     1273        Sym = self._kBoundedRing.ambient()
     1274        kB = Sym.kBoundedSubspace(self.k, t=self.t)
     1275        Qp = Sym.hall_littlewood(t=self.t).Qp()
     1276        ks = kB.kschur()
     1277        return sum( Qp(ks(x)).coefficient(la) * self(x) for x in Partitions(Partition(la).size(), max_part = self.k))
     1278
     1279class AffineSchurFunctions(CombinatorialFreeModule):
     1280    r"""
     1281    This basis is dual to the `k`-Schur functions at `t=1`.  This realization
     1282    follows the monomial expansion given by Lam [Lam2006]_.
     1283
     1284    REFERENCES:
     1285
     1286    .. [Lam2006] T. Lam, Schubert polynomials for the affine Grassmannian, J. Amer.
     1287        Math. Soc., 21 (2008), 259-281.
     1288    """
     1289
     1290    def __init__(self, kBoundedRing):
     1291        r"""
     1292        Initializes the ring which is the `k`-Bounded affine Schur quotient basis.
     1293
     1294        INPUT:
     1295
     1296        - ``kBoundedRing`` -- an element which is of class :class:`KBoundedQuotient`
     1297
     1298        EXAMPLES::
     1299
     1300            sage: from sage.combinat.sf.k_dual import AffineSchurFunctions
     1301            sage: F = AffineSchurFunctions(SymmetricFunctions(QQ['t']).kBoundedQuotient(4,t=1))
     1302            sage: F
     1303            4-Bounded Quotient of Symmetric Functions over Univariate Polynomial Ring in t over Rational Field with t=1 in the 4-bounded affine Schur basis
     1304            sage: TestSuite(F).run()
     1305        """
     1306        CombinatorialFreeModule.__init__(self, kBoundedRing.base_ring(),
     1307            kBoundedRing.indices(),
     1308            category= KBoundedQuotientBases(kBoundedRing),
     1309            prefix='F%d'%kBoundedRing.k)
     1310
     1311        self._kBoundedRing = kBoundedRing
     1312
     1313        self.k = kBoundedRing.k
     1314        self.t = kBoundedRing.t
     1315        km = kBoundedRing.km()
     1316        F_to_mk = self.module_morphism(self._F_to_m_on_basis,codomain=km).register_as_coercion()
     1317        mk_to_F = km.module_morphism(self._m_to_F_on_basis,codomain=self).register_as_coercion()
     1318
     1319    # The following are meant to be inherited with the category framework, but
     1320    # this fails because they are methods of Parent. The trick below overcomes
     1321    # this problem.
     1322    __getitem__ = KBoundedQuotientBases.ParentMethods.__getitem__.im_func
     1323    _repr_term = KBoundedQuotientBases.ParentMethods._repr_term.im_func
     1324    _element_constructor_ = KBoundedQuotientBases.ParentMethods._element_constructor_.im_func
     1325    _element_constructor = _element_constructor_
     1326
     1327    def _repr_(self):
     1328        """
     1329        TESTS::
     1330
     1331            sage: Sym = SymmetricFunctions(QQ)
     1332            sage: F = Sym.kBoundedQuotient(3,t=1).affineSchur()
     1333            sage: F._repr_()
     1334            '3-Bounded Quotient of Symmetric Functions over Rational Field with t=1 in the 3-bounded affine Schur basis'
     1335        """
     1336        return self.realization_of()._repr_()+' in the %s-bounded affine Schur basis'%(self.k)
     1337
     1338    def _F_to_m_on_basis(self, la):
     1339        r"""
     1340        Gives the expansion of the affine Schur basis element indexed by ``la`` into
     1341        the monomial basis.
     1342
     1343        INPUT:
     1344
     1345        - ``la`` -- A `k`-bounded partition.
     1346
     1347        OUTPUT:
     1348
     1349        - A symmetric function in the monomial basis
     1350
     1351        EXAMPLES::
     1352
     1353            sage: F = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).affineSchur()
     1354            sage: F._F_to_m_on_basis(Partition([2,1]))
     1355            2*m[1, 1, 1] + m[2, 1]
     1356            sage: F._F_to_m_on_basis(Partition([]))
     1357            m[]
     1358            sage: km = F.realization_of().km()
     1359            sage: km( F[2,2] )
     1360            2*m3[1, 1, 1, 1] + m3[2, 1, 1] + m3[2, 2]
     1361            sage: F._F_to_m_on_basis(Partition([4,1]))
     1362            Traceback (most recent call last):
     1363            ...
     1364            ValueError: the partition must be 3-bounded
     1365        """
     1366        return la.to_core(self.k).to_grassmannian().stanley_symmetric_function()
     1367
     1368    def _m_to_F_on_basis(self, la):
     1369        r"""
     1370        Gives the expansion of the `k`-monomial basis element indexed by ``la`` into
     1371        the affine Schur basis.
     1372
     1373        INPUT:
     1374
     1375        - ``la`` -- A `k`-bounded partition.
     1376
     1377        OUTPUT:
     1378
     1379        - A `k`-bounded quotient symmetric function in the affine Schur basis
     1380
     1381        EXAMPLES::
     1382
     1383            sage: F = SymmetricFunctions(QQ).kBoundedQuotient(3,t=1).affineSchur()
     1384            sage: F._m_to_F_on_basis(Partition([2,1]))
     1385            -2*F3[1, 1, 1] + F3[2, 1]
     1386            sage: F._m_to_F_on_basis([2,1])
     1387            -2*F3[1, 1, 1] + F3[2, 1]
     1388            sage: F._m_to_F_on_basis(Partition([]))
     1389            F3[]
     1390            sage: F._m_to_F_on_basis(Partition([4,1]))
     1391            Traceback (most recent call last):
     1392            ...
     1393            AssertionError: [4, 1] should be an element of 3-Bounded Partitions
     1394        """
     1395        Sym = self._kBoundedRing.ambient()
     1396        kB = Sym.kBoundedSubspace(self.k, t=1)
     1397        h = kB.khomogeneous()
     1398        ks = kB.kschur()
     1399        return sum( h(ks(x)).coefficient(la) * self(x) for x in Partitions(Partition(la).size(), max_part = self.k))
  • sage/combinat/sf/kschur.py

    diff --git a/sage/combinat/sf/kschur.py b/sage/combinat/sf/kschur.py
    a b  
    22k-Schur Functions
    33"""
    44#*****************************************************************************
    5 #       Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>, 
     5#       Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>,
    66#
    77#  Distributed under the terms of the GNU General Public License (GPL)
    88#
    k-Schur Functions 
    1111#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1212#    General Public License for more details.
    1313#
    14 
     14#
    1515#  The full text of the GPL is available at:
    1616#
    1717#                  http://www.gnu.org/licenses/
    def kSchurFunctions(R, k, t=None): 
    2727    """
    2828    Returns the k-Schur functions. See the examples below for caveats
    2929    on their use.
    30    
     30
    3131    EXAMPLES::
    32    
     32
    3333        sage: ks3 = kSchurFunctions(QQ, 3); ks3
    3434        doctest:1: DeprecationWarning: Deprecation warning: Please use SymmetricFunctions(QQ).kschur() instead!
    3535        See http://trac.sagemath.org/5457 for details.
    def kSchurFunctions(R, k, t=None): 
    4141        sage: t = ks3.t # Allow 't' as input
    4242        sage: s(ks3([3,2,1]))
    4343        s[3, 2, 1] + t*s[4, 1, 1] + t*s[4, 2] + t^2*s[5, 1]
    44    
     44
    4545    ::
    46    
     46
    4747        sage: ks3(s([3, 2, 1]) + t*s([4, 1, 1]) + t*s([4, 2]) + t^2*s([5, 1]))
    4848        ks3[3, 2, 1]
    49    
     49
    5050    k-Schurs are indexed by partitions with first part `\le
    5151    k`. Constructing a k-Schur function for a larger partition raises
    5252    an error::
    5353
    54         sage: ks3([4,3,2,1])  # 
     54        sage: ks3([4,3,2,1])  #
    5555        Traceback (most recent call last):
    5656        ...
    5757        TypeError: do not know how to make x (= [4, 3, 2, 1]) an element of self (=k-Schur Functions at level 3 over Univariate Polynomial Ring in t over Rational Field)
    5858
    5959    Note: this used to return 0 instead. What is preferable?
    60    
     60
    6161    Similarly, attempting to convert a function that is not in the
    6262    linear span of the k-Schur's raises an error::
    63    
     63
    6464        sage: ks3(s([4]))
    6565        Traceback (most recent call last):
    6666        ...
    6767        ValueError: s[4] is not in the space spanned by k-Schur Functions at level 3 over Univariate Polynomial Ring in t over Rational Field.
    68    
     68
    6969    Note that the product of k-Schurs is not guaranteed to be in the
    7070    space spanned by the k-Schurs. In general, we only have that a
    7171    k-Schur times a j-Schur is a (k+j)-Schur. This fact is not
    7272    currently incorporated into the Sage design, so the multiplication
    7373    of k-Schur functions may return an error. This example shows how to
    7474    get around this 'manually'.
    75    
     75
    7676    ::
    77    
     77
    7878        sage: ks2 = kSchurFunctions(QQ, 2)
    7979        sage: ks2([2,1])^2
    8080        Traceback (most recent call last):
    def kSchurFunctions(R, k, t=None): 
    8383        3] + (2*t+1)*s[4, 1, 1] + (t^2+2*t+1)*s[4, 2] + (t^2+2*t)*s[5, 1] + t^2*s[6] is not in the
    8484        space spanned by k-Schur Functions at level 2 over Univariate Polynomial Ring in t over
    8585        Rational Field.
    86    
     86
    8787    ::
    88    
     88
    8989        sage: f = s(ks2([2,1]))^2; f # Convert to Schur functions first and multiply there.
    9090        s[2, 2, 1, 1] + s[2, 2, 2] + s[3, 1, 1, 1] + (2*t+2)*s[3, 2, 1] + (t^2+1)*s[3,
    9191        3] + (2*t+1)*s[4, 1, 1] + (t^2+2*t+1)*s[4, 2] + (t^2+2*t)*s[5, 1] + t^2*s[6]
    9292        sage: ks4 = kSchurFunctions(QQ, 4)
    9393        sage: ks4(f) # The product of two 'ks2's is a 'ks4'.
    9494        ks4[2, 2, 1, 1] + ks4[2, 2, 2] + ks4[3, 1, 1, 1] + (t+2)*ks4[3, 2, 1] + (t^2+1)*ks4[3, 3] + (t+1)*ks4[4, 1, 1] + ks4[4, 2]
    95    
     95
    9696    However, at t=1, the product of k-Schurs is in the span of the
    9797    k-Schurs. Below are some examples at t=1.
    98    
     98
    9999    ::
    100    
     100
    101101        sage: ks3 = kSchurFunctions(QQ, 3, 1); ks3
    102102        k-Schur Functions at level 3 with t=1 over Rational Field
    103103        sage: s = SFASchur(ks3.base_ring())
    class kSchurFunctions_generic(sfa.Symmet 
    116116    def _change_by_triangularity(self, el, to_other_cache, unitriang=False):
    117117        """
    118118        Returns self(el) converted by triangularity.
    119        
     119
    120120        INPUT:
    121        
    122        
     121
    123122        -  ``el`` - a symmetric function
    124        
     123
    125124        -  ``to_other_cache`` - a dictionary containing the
    126125           change of basis from self to el's basis
    127        
     126
    128127        -  ``unitriang`` - a boolean, if True, the coefficient
    129128           of part in self( el.parent()(part) ) is assumed to be 1.
    130        
    131        
     129
     130
    132131        EXAMPLES::
    133        
     132
    134133            sage: ks3 = kSchurFunctions(QQ, 3)
    135134            doctest:1: DeprecationWarning: Deprecation warning: Please use SymmetricFunctions(QQ).kschur() instead!
    136135            See http://trac.sagemath.org/5457 for details.
    class kSchurFunctions_generic(sfa.Symmet 
    152151            l.sort()
    153152            part2 = l[0]
    154153            n = part2.size()
    155            
     154
    156155            if not to_other_cache[n][part2]:
    157156                raise ValueError,"%s is not in the space spanned by %s."%(orig,self)
    158157
    class kSchurFunctions_generic(sfa.Symmet 
    160159            if not unitriang:
    161160                c /= to_other_cache[n][part2][part2]
    162161            el -= c*P._from_dict(to_other_cache[n][part2])
    163            
     162
    164163            out[part2] = out.get(part2,zero) + c
    165            
     164
    166165        return self._from_dict(out)
    167166
    168167
    class kSchurFunctions_generic(sfa.Symmet 
    171170        Multiply left and right by converting to the Schurs, multiplying
    172171        there, and converting back. Note that the product of k-Schurs with
    173172        t is only guaranteed to be a sum of k-Schurs when t = 1.
    174        
     173
    175174        EXAMPLES::
    176        
     175
    177176            sage: ks3 = kSchurFunctions(QQ, 3)
    178177            doctest:1: DeprecationWarning: Deprecation warning: Please use SymmetricFunctions(QQ).kschur() instead!
    179178            See http://trac.sagemath.org/5457 for details.
    180        
     179
    181180        ::
    182        
     181
    183182            sage: ks3([1])^2 # indirect doctest
    184183            ks3[1, 1] + ks3[2]
    185        
     184
    186185        ::
    187        
     186
    188187            sage: ks3([2,1])^2
    189188            Traceback (most recent call last):
    190189            ...
    class kSchurFunctions_generic(sfa.Symmet 
    192191            s[3, 3] + s[4, 1, 1] + s[4, 2] is not in the space spanned by k-Schur
    193192            Functions at level 3 over Univariate Polynomial Ring in t over Rational
    194193            Field.
    195        
     194
    196195        ::
    197        
     196
    198197            sage: ks3 = kSchurFunctions(QQ,3,1)
    199198            sage: ks3([2,1])^2
    200199            ks3[2, 2, 1, 1] + ks3[2, 2, 2] + ks3[3, 1, 1, 1]
    201200        """
    202201        return self( self._s(left) * self._s(right) )
    203202
    204    
     203
    205204    class Element(sfa.SymmetricFunctionAlgebra_generic.Element):
    206205        pass
    207206
    class kSchurFunctions_t(kSchurFunctions_ 
    211210    def __init__(self, R, k, t=None):
    212211        """
    213212        EXAMPLES::
    214        
     213
    215214            sage: kSchurFunctions(QQ, 3).base_ring()
    216215            doctest:1: DeprecationWarning: Deprecation warning: Please use SymmetricFunctions(QQ).kschur() instead!
    217216            See http://trac.sagemath.org/5457 for details.
    class kSchurFunctions_t(kSchurFunctions_ 
    226225        self._name = "k-Schur Functions at level %s"%k
    227226        self._prefix = "ks%s"%k
    228227        self._element_class = kSchurFunctions_t.Element
    229    
     228
    230229        if t is None:
    231230            R = R['t']
    232231            self.t = R.gen()
    class kSchurFunctions_t(kSchurFunctions_ 
    236235            self.t = R(t)
    237236            if str(t) != 't':
    238237                self._name += " with t=%s"%self.t
    239            
     238
    240239        self._s_to_self_cache = s_to_k_cache.get(k, {})
    241240        self._self_to_s_cache = k_to_s_cache.get(k, {})
    242241
    class kSchurFunctions_t(kSchurFunctions_ 
    289288        for p in x.support():
    290289            self._s_cache(p.size())
    291290        return self._change_by_triangularity(x, self._self_to_s_cache, True)
    292  
     291
    293292    def _self_to_s(self, x):
    294293        r"""
    295294        Embedding from self to the Schur basis
    class kSchurFunctions_t(kSchurFunctions_ 
    315314    def _coerce_start_disabled(self, x):
    316315        """
    317316        Coerce things into the k-Schurs through the Schurs.
    318        
     317
    319318        EXAMPLES::
    320        
     319
    321320            sage: ks3 = kSchurFunctions(QQ, 3)
    322321            doctest:1: DeprecationWarning: Deprecation warning: Please use SymmetricFunctions(QQ).kschur() instead!
    323322            See http://trac.sagemath.org/5457 for details.
    class kSchurFunctions_t(kSchurFunctions_ 
    344343            x = sage.combinat.partition.Partition(x)
    345344            return self._from_dict({x:self.base_ring()(1)})
    346345
    347  
     346
    348347    def _s_cache(self, n):
    349348        """
    350349        Computes the change of basis from the kSchurs to the Schurs for
    351350        partitions of size n.
    352        
     351
    353352        EXAMPLES::
    354        
     353
    355354            sage: ks3 = kSchurFunctions(QQ, 3)
    356355            doctest:1: DeprecationWarning: Deprecation warning: Please use SymmetricFunctions(QQ).kschur() instead!
    357356            See http://trac.sagemath.org/5457 for details.
    class kSchurFunctions_t(kSchurFunctions_ 
    367366        t = self.t
    368367        s = self._s
    369368        zero = s(0)
    370        
     369
    371370        if n == 0:
    372371            p = sage.combinat.partition.Partition_class([])
    373372            self._self_to_s_cache[0] = {p: {p:R(1)}}
    374             return 
     373            return
    375374        else:
    376375            self._self_to_s_cache[n] = {}
    377376
    378        
     377
    379378        #Fill in the cache from the k-Schurs to the Schurs
    380379        for p in sage.combinat.partition.Partitions_n(n):
    381380            if max(p) > self.k:
  • sage/combinat/sf/new_kschur.py

    diff --git a/sage/combinat/sf/new_kschur.py b/sage/combinat/sf/new_kschur.py
    a b  
    11"""
    2 k-Schur Functions
     2`k`-Schur Functions
    33"""
    44#*****************************************************************************
    5 #       Copyright (C) 2011 Jason Bandlow <jbandlow@gmail.com>, 
     5#       Copyright (C) 2011 Jason Bandlow <jbandlow@gmail.com>,
    66#                     2012 Anne Schilling <anne@math.ucdavis.edu>
    77#
    88#  Distributed under the terms of the GNU General Public License (GPL)
    from sage.categories.realizations import 
    2323from sage.categories.graded_hopf_algebras import GradedHopfAlgebras
    2424from sage.categories.graded_hopf_algebras_with_basis import GradedHopfAlgebrasWithBasis
    2525from sage.categories.graded_coalgebras import GradedCoalgebras
    26 from sage.categories.graded_coalgebras_with_basis import GradedCoalgebrasWithBasis 
     26from sage.categories.graded_coalgebras_with_basis import GradedCoalgebrasWithBasis
    2727from sage.categories.magmas import Magmas
    2828from sage.categories.examples.infinite_enumerated_sets import NonNegativeIntegers
    2929from sage.categories.tensor import tensor
    from sage.combinat.free_module import Co 
    3737from sage.misc.constant_function import ConstantFunction
    3838from sage.matrix.constructor import matrix
    3939from sage.misc.misc import srange
     40from sage.combinat.partition import Partitions_all_bounded
     41from sage.misc.misc_c import prod
     42
    4043
    4144class KBoundedSubspace(UniqueRepresentation, Parent):
    4245    r"""
    class KBoundedSubspace(UniqueRepresentat 
    6164        sage: ks = KB.kschur(); ks
    6265        3-bounded Symmetric Functions over Univariate Polynomial Ring in t over Rational Field in the 3-Schur basis
    6366    """
    64    
     67
    6568    def __init__(self, Sym, k, t='t'):
    6669        r"""
    67         The class modeling the abstract vector space of `k`-Schur functions; if `t=1` this 
    68         is actually an abstract ring. Another way to describe this space is as the subspace of 
     70        The class modeling the abstract vector space of `k`-Schur functions; if `t=1` this
     71        is actually an abstract ring. Another way to describe this space is as the subspace of
    6972        a ring of symmetric functions generated by the complete homogeneous symmetric functions
    7073        `h_i` for `1\le i \le k`.
    7174
    class KBoundedSubspace(UniqueRepresentat 
    8891
    8992        if not isinstance(Sym,SymmetricFunctions):
    9093            raise ValueError, "Sym must be an algebra of symmetric functions"
    91        
    92         self.indices = ConstantFunction(Partitions(NonNegativeIntegers(), max_part=k))
     94
     95        self.indices = ConstantFunction(Partitions_all_bounded(k))
    9396
    9497        R = Sym.base_ring()
    9598
    class KBoundedSubspace(UniqueRepresentat 
    97100        # self.base_ring as NotImplemented, hence it cannot be defined by the
    98101        # category framework.
    99102        self.base_ring = ConstantFunction(R)
    100        
     103
    101104        self.ambient = ConstantFunction(Sym)
    102105
    103106        self.k = k
    class KBoundedSubspace(UniqueRepresentat 
    126129        r"""
    127130        Retracts ``sym`` from ``self`` to the ring of symmetric functions.
    128131
    129         INPUT: 
     132        INPUT:
    130133
    131134        - ``sym`` -- a symmetric function
    132135
    133         OUTPUT: 
     136        OUTPUT:
    134137
    135138        - the analogue of the symmetric function in the `k`-bounded subspace (if possible)
    136139
    class KBoundedSubspace(UniqueRepresentat 
    160163        EXAMPLES::
    161164
    162165            sage: SymmetricFunctions(QQ).kBoundedSubspace(3,1).realizations()
    163             [3-bounded Symmetric Functions over Rational Field with t=1 in the 3-Schur basis also with t=1, 3-bounded Symmetric Functions over Rational Field with t=1 in the 3-bounded homogeneous basis]
     166            [3-bounded Symmetric Functions over Rational Field with t=1 in the 3-Schur basis also with t=1, 3-bounded Symmetric Functions over Rational Field with t=1 in the 3-bounded homogeneous basis, 3-bounded Symmetric Functions over Rational Field with t=1 in the K-3-Schur basis]
    164167
    165168            sage: SymmetricFunctions(QQ['t']).kBoundedSubspace(3).realizations()
    166169            [3-bounded Symmetric Functions over Univariate Polynomial Ring in t over Rational Field in the 3-Schur basis]
    167170        """
    168171        if self.t == 1:
    169             return [self.kschur(), self.khomogeneous()]
     172            return [self.kschur(), self.khomogeneous(), self.K_kschur()]
    170173        else:
    171174            return [self.kschur()]
    172        
     175
    173176    def kschur(self):
    174177        r"""
    175178        The `k`-Schur basis of this algebra.
    176179
    177         .. SEEALSO:: :meth:`kSchur` 
     180        .. SEEALSO:: :meth:`kSchur`
    178181
    179182        EXAMPLES::
    180183
    class KBoundedSubspace(UniqueRepresentat 
    194197            sage: kh3 = SymmetricFunctions(QQ).kBoundedSubspace(3,1).khomogeneous()
    195198            sage: TestSuite(kh3).run()
    196199        """
    197         assert self.t == 1, "This basis only exists for t=1"
     200        if self.t!=1:
     201            raise ValueError, "This basis only exists for t=1"
    198202        return kHomogeneous(self)
    199203
     204    def K_kschur(self):
     205        r"""
     206        Returns the `k`-bounded basis called the K-`k`-Schur basis.  See [Morse11]_ and
     207        [LamSchillingShimozono10]_.
     208
     209        REFERENCES:
     210
     211        .. [Morse11] J. Morse, Combinatorics of the K-theory of affine Grassmannians,
     212           Adv. in Math., Volume 229, Issue 5, pp. 2950--2984.
     213
     214        .. [LamSchillingShimozono10] T. Lam, A. Schilling, M.Shimozono, K-theory Schubert calculus of the affine Grassmannian,
     215           Compositio Math. 146 (2010), 811-852.
     216
     217
     218        EXAMPLES::
     219
     220            sage: kB = SymmetricFunctions(QQ).kBoundedSubspace(3,1)
     221            sage: g = kB.K_kschur()
     222            sage: g
     223            3-bounded Symmetric Functions over Rational Field with t=1 in the K-3-Schur basis
     224            sage: kB = SymmetricFunctions(QQ['t']).kBoundedSubspace(3)
     225            sage: g = kB.K_kschur()
     226            Traceback (most recent call last):
     227            ...
     228            ValueError: This basis only exists for t=1
     229        """
     230        if self.t!=1:
     231            raise ValueError, "This basis only exists for t=1"
     232        return K_kSchur(self)
     233
     234
    200235    def _repr_(self):
    201236        r"""
    202237        Representation of this algebra.
    class KBoundedSubspaceBases(Category_rea 
    260295        return [Realizations(self.base()), category.Subobjects()]
    261296
    262297    class ParentMethods:
    263        
     298
     299        def _element_constructor_(self, x):
     300            r"""
     301            Needed to rewrite the element constructor because of a bug in free_module.py.
     302            Ideally _element_constructor_ would be inherited from free_module.py, but
     303            it allows for bad inputs.
     304
     305            EXAMPLES::
     306
     307                sage: kB = SymmetricFunctions(QQ).kBoundedSubspace(3,1)
     308                sage: ks = kB.kschur()
     309                sage: ks([2,1])
     310                ks3[2, 1]
     311                sage: ks(Partition([4,1]))
     312                Traceback (most recent call last):
     313                ...
     314                TypeError: do not know how to make x (= [4, 1]) an element of self (=3-bounded Symmetric Functions over Rational Field with t=1 in the 3-Schur basis also with t=1)
     315            """
     316            R = self.base_ring()
     317            eclass = self.element_class
     318
     319            #Coerce ints to Integers
     320            if isinstance(x, int):
     321                x = Integer(x)
     322            if x in R:
     323                if x == 0:
     324                    return self.zero()
     325                else:
     326                    raise TypeError, "do not know how to make x (= %s) an element of %s"%(x, self)
     327            #x is an element of the basis enumerated set;
     328            elif x in self._basis_keys:
     329                return self.monomial(self._basis_keys(x))
     330            raise TypeError, "do not know how to make x (= %s) an element of self (=%s)"%(x,self)
     331
    264332        def _convert_map_from_(self,Q):
    265333            r"""
    266334            Implements conversion from an arbitrary parent to ``self``.
    class KBoundedSubspaceBases(Category_rea 
    278346            if P.has_coerce_map_from(Q):
    279347                return self.retract * P.coerce_map_from(Q)
    280348            return None
    281        
     349
    282350        def __getitem__(self, c, *rest):
    283351            r"""
    284352            Implements shorthand for accessing basis elements.
    class KBoundedSubspaceBases(Category_rea 
    315383            `X[[3,2]]`.
    316384
    317385            EXAMPLES::
    318            
     386
    319387                sage: ks3 = SymmetricFunctions(QQ).kschur(3,1)
    320388                sage: ks3[3,2]    # indirect doctest
    321389                ks3[3, 2]
    class KBoundedSubspaceBases(Category_rea 
    348416            coefficient obtained by writing the `i^{th}` element of the
    349417            basis of ``self`` in terms of the basis ``other``, and extracting the
    350418            `j^{th}` coefficient.
    351            
     419
    352420            EXAMPLES::
    353421
    354422                sage: Sym = SymmetricFunctions(QQ); s = Sym.schur()
    class KBoundedSubspaceBases(Category_rea 
    382450            Return an element of ``self``.
    383451
    384452            EXAMPLES::
    385                
     453
    386454                sage: SymmetricFunctions(QQ['t']).kschur(3).an_element()
    387455                ks3[] + 2*ks3[1] + 3*ks3[2]
    388             """   
     456            """
    389457            return self( Partition(srange(self.k,0,-1)))
    390458
    391459        # This is sufficient for degree to work
    class KBoundedSubspaceBases(Category_rea 
    413481            r"""
    414482            Method for multiplying two elements.
    415483
    416             When `t=1`, the `k`-bounded subspace is an algebra, so the product of two elements
    417             is always in the space. For generic `t`, the `k`-bounded subspace is not closed under
    418             multiplication, so the result is returned in the `k`-bounded subspace if possible and
    419             else in the ring of symmetric functions.
     484            When `t=1`, the `k`-bounded subspace is an algebra, so the product of two
     485            elements is always in the space. For generic `t`, the `k`-bounded subspace is
     486            not closed under multiplication, so the result is returned in the `k`-bounded
     487            subspace if possible and else in the ring of symmetric functions.
    420488
    421489            EXAMPLES::
    422490
    class KBoundedSubspaceBases(Category_rea 
    522590                sage: ks3t[2,1].coproduct()
    523591                ks3[] # ks3[2, 1] + ks3[1] # ks3[1, 1] + ks3[1] # ks3[2] + ks3[1, 1] # ks3[1] + ks3[2] # ks3[1] + ks3[2, 1] # ks3[]
    524592                sage: ks3t[3,1].coproduct()
    525                 ks3[] # ks3[3, 1] + ks3[1] # ks3[2, 1] + (t+1)*ks3[1] # ks3[3] + ks3[1, 1] # ks3[2] + ks3[2] # ks3[1, 1] 
     593                ks3[] # ks3[3, 1] + ks3[1] # ks3[2, 1] + (t+1)*ks3[1] # ks3[3] + ks3[1, 1] # ks3[2] + ks3[2] # ks3[1, 1]
    526594                + (t+1)*ks3[2] # ks3[2] + ks3[2, 1] # ks3[1] + (t+1)*ks3[3] # ks3[1] + ks3[3, 1] # ks3[]
    527595            """
    528596            lifted = self.lift()
    class KBoundedSubspaceBases(Category_rea 
    540608        def omega(self):
    541609            r"""
    542610            Returns the `\omega` operator on ``self``.
    543            
     611
    544612            At `t=1`, `\omega` maps the `k`-Schur function `s^{(k)}_\lambda` to `s^{(k)}_{\lambda^{(k)}}`, where
    545613            `\lambda^{(k)}` is the `k`-conjugate of the partition `\lambda`.
    546614
    class KBoundedSubspaceBases(Category_rea 
    551619            this result is not in the `k`-bounded subspace.
    552620
    553621            .. SEEALSO:: :meth:`omega_t_inverse`.
    554            
     622
    555623            EXAMPLES::
    556624
    557625                sage: Sym = SymmetricFunctions(QQ)
    class KBoundedSubspaceBases(Category_rea 
    577645            r"""
    578646            Returns the map `t\to 1/t` composed with `\omega` on ``self``.
    579647
    580             Unlike the map :meth:`omega`, the result of :meth:`omega_t_inverse` lives in the
    581             `k`-bounded subspace and hence will return an element even for generic `t`. For `t=1`,
    582             :meth:`omega` and :meth:`omega_t_inverse` return the same result.
     648            Unlike the map :meth:`omega`, the result of :meth:`omega_t_inverse` lives in
     649            the `k`-bounded subspace and hence will return an element even for generic
     650            `t`. For `t=1`, :meth:`omega` and :meth:`omega_t_inverse` return the same
     651            result.
    583652
    584653            EXAMPLES::
    585654
    class KBoundedSubspaceBases(Category_rea 
    625694            r"""
    626695            Returns the monomial expansion of ``self`` in `n` variables.
    627696
    628             INPUT: 
     697            INPUT:
    629698
    630699            - ``n`` -- positive integer
    631700
    class KBoundedSubspaceBases(Category_rea 
    649718            """
    650719            return self.lift().expand(*args,**kwargs)
    651720
    652        
    653 class kSchur(CombinatorialFreeModule):       
     721
     722class kSchur(CombinatorialFreeModule):
    654723
    655724    def __init__(self, kBoundedRing):
    656725        r"""
    657726        TESTS::
    658  
     727
    659728            sage: Sym = SymmetricFunctions(QQ)
    660729            sage: from sage.combinat.sf.new_kschur import kSchur
    661730            sage: KB = Sym.kBoundedSubspace(3,t=1)
    class kSchur(CombinatorialFreeModule): 
    674743        s = self.realization_of().ambient().schur()
    675744
    676745        self.ambient = ConstantFunction(s)
    677        
     746
    678747        self.lift = self._module_morphism(self._to_schur_on_basis,
    679                 codomain=s, triangular='lower', unitriangular=True, 
     748                codomain=s, triangular='lower', unitriangular=True,
    680749                inverse_on_support=lambda p: p if p.get_part(0) <= self.k else None)
    681750
    682751        self.lift.register_as_coercion()
    class kSchur(CombinatorialFreeModule): 
    691760    __getitem__ = KBoundedSubspaceBases.ParentMethods.__getitem__.im_func
    692761    _repr_term = KBoundedSubspaceBases.ParentMethods._repr_term.im_func
    693762    _convert_map_from_ = KBoundedSubspaceBases.ParentMethods._convert_map_from_.im_func
     763    _element_constructor_ = KBoundedSubspaceBases.ParentMethods._element_constructor_.im_func
     764    _element_constructor = _element_constructor_
    694765
    695766    def _repr_(self):
    696767        """
    class kSchur(CombinatorialFreeModule): 
    720791
    721792        - ``p`` -- a partition
    722793
    723         OUTPUT: conversion of the `k`-Schur function indexed by ``p`` in terms of Schur functions 
    724        
     794        OUTPUT: conversion of the `k`-Schur function indexed by ``p`` in terms of Schur functions
     795
    725796        EXAMPLES::
    726797
    727798            sage: Sym = SymmetricFunctions(QQ['t'])
    class kSchur(CombinatorialFreeModule): 
    735806        if t == 1:
    736807            return s.sum_of_monomials(tab.shape() for tab in katom)
    737808        return s.sum_of_terms((tab.shape(), t**tab.charge()) for tab in katom)
    738      
     809
    739810
    740811class kHomogeneous(CombinatorialFreeModule):
    741812    r"""
    class kHomogeneous(CombinatorialFreeModu 
    773844        h = self.realization_of().ambient().homogeneous()
    774845
    775846        self.lift = self._module_morphism(lambda x: h[x],
    776                 codomain=h, triangular='lower', unitriangular=True, 
     847                codomain=h, triangular='lower', unitriangular=True,
    777848                inverse_on_support=lambda p:p if p.get_part(0) <= self.k else None)
    778849
    779         self.ambient = ConstantFunction(h) 
     850        self.ambient = ConstantFunction(h)
    780851
    781852        self.lift.register_as_coercion()
    782853
    class kHomogeneous(CombinatorialFreeModu 
    791862    _repr_term = KBoundedSubspaceBases.ParentMethods._repr_term.im_func
    792863    _convert_map_from_ =\
    793864            KBoundedSubspaceBases.ParentMethods._convert_map_from_.im_func
     865    _element_constructor_ = KBoundedSubspaceBases.ParentMethods._element_constructor_.im_func
     866    _element_constructor = _element_constructor_
    794867
    795868    def _repr_(self):
    796869        """
    class kHomogeneous(CombinatorialFreeModu 
    802875            '3-bounded Symmetric Functions over Rational Field with t=1 in the 3-bounded homogeneous basis'
    803876        """
    804877        return self.realization_of()._repr_()+' in the %s-bounded homogeneous basis'%(self.k)
     878
     879class K_kSchur(CombinatorialFreeModule):
     880    r"""
     881    This class implements the basis of the `k`-bounded subspace called the K-`k`-Schur
     882    basis.  See [Morse2011]_, [LamSchillingShimozono2010]_.
     883
     884    REFERENCES:
     885
     886    .. [Morse2011] J. Morse, Combinatorics of the K-theory of affine Grassmannians,
     887        Adv. in Math., Volume 229, Issue 5, pp. 2950--2984.
     888
     889    .. [LamSchillingShimozono2010] T. Lam, A. Schilling, M.Shimozono, K-theory Schubert calculus of the affine Grassmannian,
     890        Compositio Math. 146 (2010), 811-852.
     891    """
     892
     893    def __init__(self, kBoundedRing):
     894        r"""
     895        TESTS::
     896
     897            sage: from sage.combinat.sf.new_kschur import K_kSchur
     898            sage: kB = SymmetricFunctions(QQ).kBoundedSubspace(3,1)
     899            sage: g = K_kSchur(kB)
     900            sage: g
     901            3-bounded Symmetric Functions over Rational Field with t=1 in the K-3-Schur basis
     902            sage: g[2,1]*g[1]
     903            -2*Kks3[2, 1] + Kks3[2, 1, 1] + Kks3[2, 2]
     904            sage: g([])
     905            Kks3[]
     906            sage: TestSuite(g).run()
     907            sage: h = SymmetricFunctions(QQ).h()
     908            sage: g(h[1,1])
     909            -Kks3[1] + Kks3[1, 1] + Kks3[2]
     910        """
     911        CombinatorialFreeModule.__init__(self, kBoundedRing.base_ring(),
     912            kBoundedRing.indices(),
     913            category= KBoundedSubspaceBases(kBoundedRing, kBoundedRing.base_ring().one()),
     914            prefix='Kks%d'%kBoundedRing.k)
     915
     916        self._kBoundedRing = kBoundedRing
     917
     918        self.k = kBoundedRing.k
     919
     920        s = self.realization_of().ambient().schur()
     921
     922        self.ambient = ConstantFunction(s)
     923        kh = self.realization_of().khomogeneous()
     924        g_to_kh = self.module_morphism(self._g_to_kh_on_basis,codomain=kh)
     925        g_to_kh.register_as_coercion()
     926        kh_to_g = kh.module_morphism(self._kh_to_g_on_basis, codomain=self)
     927        kh_to_g.register_as_coercion()
     928        h = self.realization_of().ambient().h()
     929        lift = self._module_morphism(self.lift, triangular='lower', unitriangular=True, codomain=h)
     930        lift.register_as_coercion()
     931        retract = h._module_morphism(self.retract, codomain=self)
     932        #retract = SetMorphism(Hom(h, self, SetsWithPartialMaps()), lift.preimage)
     933        self.register_conversion(retract)
     934
     935
     936    # The following are meant to be inherited with the category framework, but
     937    # this fails because they are methods of Parent. The trick below overcomes
     938    # this problem.
     939    __getitem__ = KBoundedSubspaceBases.ParentMethods.__getitem__.im_func
     940    _repr_term = KBoundedSubspaceBases.ParentMethods._repr_term.im_func
     941    _element_constructor_ = KBoundedSubspaceBases.ParentMethods._element_constructor_.im_func
     942    _element_constructor = _element_constructor_
     943
     944    def _repr_(self):
     945        r"""
     946        TESTS::
     947
     948            sage: Sym = SymmetricFunctions(QQ)
     949            sage: kB = Sym.kBoundedSubspace(3,1)
     950            sage: g = kB.K_kschur()
     951            sage: g._repr_()
     952            '3-bounded Symmetric Functions over Rational Field with t=1 in the K-3-Schur basis'
     953        """
     954        return self.realization_of()._repr_()+' in the K-%s-Schur basis'%(self.k)
     955
     956    def _homogeneous_generators_noncommutative_variables_zero_Hecke(self, r):
     957        r"""
     958        Returns the ``r^{th}`` homogeneous generator, viewed as an element inside the
     959        affine zero Hecke algebra. This is the sum of all cyclicly decreasing elements
     960        of order ``r``.
     961
     962        INPUT:
     963
     964        - ``r`` -- A positive integer
     965
     966        OUTPUT:
     967
     968        - An element of the affine zero Hecke algebra.
     969
     970        EXAMPLES::
     971
     972            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     973            sage: g._homogeneous_generators_noncommutative_variables_zero_Hecke(2)
     974            T1*T0 + T2*T0 + T0*T3 + T3*T2 + T3*T1 + T2*T1
     975            sage: g._homogeneous_generators_noncommutative_variables_zero_Hecke(0)
     976            1
     977        """
     978        from sage.combinat.root_system.weyl_group import WeylGroup
     979        from sage.algebras.iwahori_hecke_algebra import IwahoriHeckeAlgebraT
     980        W = WeylGroup(['A',self.k,1])
     981        H = IwahoriHeckeAlgebraT(W, 0, base_ring = self.base_ring())
     982        Hgens = H.algebra_generators()
     983        S = [w.reduced_word() for w in W.pieri_factors() if w.length() == r]
     984        return sum( (prod((Hgens[i] for i in w), 1) for w in S), 0 )
     985
     986    @cached_method
     987    def _homogeneous_basis(self,la):
     988        r"""
     989        Returns the homogeneous basis element indexed by ``la``, viewed as an element
     990        inside the affine zero Hecke algebra. This method is only here for caching purposes.
     991
     992        INPUT:
     993
     994        - ``la`` -- A `k`-bounded partition
     995
     996        OUTPUT:
     997
     998        - An element of the affine zero Hecke algebra.
     999
     1000        EXAMPLES::
     1001
     1002            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1003            sage: g._homogeneous_basis(Partition([2,1]))
     1004            T2*T1*T0 + T3*T1*T0 - T1*T0 + T1*T2*T0 + T3*T2*T0 - 2*T2*T0 + T0*T1*T0 + T2*T0*T1 + T1*T0*T3 + T0*T3*T0 - T0*T3 + T2*T0*T3 + T0*T3*T2 + T0*T3*T1 - T3*T2 + T2*T3*T2 - 2*T3*T1 - T2*T1 + T3*T2*T1 + T2*T3*T1 + T3*T1*T2 + T1*T2*T1
     1005            sage: g._homogeneous_basis(Partition([]))
     1006            1
     1007        """
     1008        return prod(self._homogeneous_generators_noncommutative_variables_zero_Hecke(la[i]) for i in range(len(la)))
     1009
     1010    def homogeneous_basis_noncommutative_variables_zero_Hecke(self,la):
     1011        r"""
     1012        Returns the homogeneous basis element indexed by ``la``, viewed as an element
     1013        inside the affine zero Hecke algebra. For the code, see method _homogeneous_basis.
     1014
     1015        INPUT:
     1016
     1017        - ``la`` -- A `k`-bounded partition
     1018
     1019        OUTPUT:
     1020
     1021        - An element of the affine zero Hecke algebra.
     1022
     1023        EXAMPLES::
     1024
     1025            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1026            sage: g.homogeneous_basis_noncommutative_variables_zero_Hecke([2,1])
     1027            T2*T1*T0 + T3*T1*T0 - T1*T0 + T1*T2*T0 + T3*T2*T0 - 2*T2*T0 + T0*T1*T0 + T2*T0*T1 + T1*T0*T3 + T0*T3*T0 - T0*T3 + T2*T0*T3 + T0*T3*T2 + T0*T3*T1 - T3*T2 + T2*T3*T2 - 2*T3*T1 - T2*T1 + T3*T2*T1 + T2*T3*T1 + T3*T1*T2 + T1*T2*T1
     1028            sage: g.homogeneous_basis_noncommutative_variables_zero_Hecke([])
     1029            1
     1030        """
     1031        return self._homogeneous_basis(Partition(la))
     1032
     1033    @cached_method
     1034    def _DualGrothMatrix(self, m):
     1035        r"""
     1036        Returns the change of basis matrix between the K_kschur basis and the `k`-bounded
     1037        homogeneous basis.
     1038
     1039        INPUT:
     1040
     1041        - ``m`` -- An integer
     1042
     1043        OUTPUT:
     1044
     1045        - A matrix.
     1046
     1047        EXAMPLES::
     1048
     1049            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1050            sage: g._DualGrothMatrix(3)
     1051            [ 1  1  1  0  0  0  0]
     1052            [ 0  1  2  0  0  0  0]
     1053            [ 0  0  1  0  0  0  0]
     1054            [ 0 -1 -2  1  1  0  0]
     1055            [ 0  0 -2  0  1  0  0]
     1056            [ 0  0  1  0 -1  1  0]
     1057            [ 0  0  0  0  0  0  1]
     1058            sage: g._DualGrothMatrix(0)
     1059            [1]
     1060        """
     1061        new_mat = []
     1062        Sym = SymmetricFunctions(self.base_ring())
     1063        Q = Sym.kBoundedQuotient(self.k,t=1)
     1064        mon = Q.km()
     1065        G = Q.AffineGrothendieckPolynomial
     1066        for i in range(m+1):
     1067            for x in Partitions(m-i, max_part = self.k):
     1068                f =  mon(G(x,m))
     1069                vec = []
     1070                for j in range(m+1):
     1071                    for y in Partitions(m-j, max_part = self.k):
     1072                        vec.append(f.coefficient(y))
     1073                new_mat.append(vec)
     1074        from sage.matrix.constructor import Matrix
     1075        return Matrix(new_mat)
     1076
     1077
     1078    @cached_method
     1079    def _DualGrothendieck(self,la):
     1080        r"""
     1081        Returns the expansion of the K-`k`-Schur function in the homogeneous basis. This
     1082        method is here for caching purposes.
     1083
     1084        INPUT:
     1085
     1086        - ``la`` -- A `k`-bounded partition.
     1087
     1088        OUTPUT:
     1089
     1090        - A symmetric function in the homogeneous basis.
     1091
     1092        EXAMPLES::
     1093
     1094            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1095            sage: g._DualGrothendieck(Partition([2,1]))
     1096            h[2] + h[2, 1] - h[3]
     1097            sage: g._DualGrothendieck(Partition([]))
     1098            h[]
     1099            sage: g._DualGrothendieck(Partition([4,1]))
     1100            0
     1101        """
     1102        m = la.size()
     1103        h = SymmetricFunctions(self.base_ring()).h()
     1104        M = self._DualGrothMatrix(m)
     1105        vec = []
     1106        for i in range(m+1):
     1107            for x in Partitions(m-i, max_part=self.k):
     1108                if x == la:
     1109                    vec.append(1)
     1110                else:
     1111                    vec.append(0)
     1112        from sage.modules.free_module_element import vector
     1113        vec = vector(vec)
     1114        sol = M.solve_right(vec)
     1115        new_function = h.zero()
     1116        count = 0
     1117        for i in range(m+1):
     1118            for x in Partitions(m-i, max_part=self.k):
     1119                new_function+= h(x) * sol[count]
     1120                count += 1
     1121        return new_function
     1122
     1123    def _g_to_kh_on_basis(self,la):
     1124        r"""
     1125        Returns the expansion of the K-`k`-Schur function in the homogeneous basis. See
     1126        method _DualGrothendieck for the code.
     1127
     1128        INPUT:
     1129
     1130        - ``la`` -- A `k`-bounded partition.
     1131
     1132        OUTPUT:
     1133
     1134        - A symmetric function in the homogeneous basis.
     1135
     1136        EXAMPLES::
     1137
     1138            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1139            sage: g._g_to_kh_on_basis([2,1])
     1140            h[2] + h[2, 1] - h[3]
     1141            sage: g._g_to_kh_on_basis([])
     1142            h[]
     1143            sage: g._g_to_kh_on_basis([4,1])
     1144            Traceback (most recent call last):
     1145            ValueError: Partition should be 3-bounded
     1146        """
     1147        if la != [] and (la[0] > self.k):
     1148            raise  ValueError, "Partition should be %d-bounded"%self.k
     1149        return self._DualGrothendieck(Partition(la))
     1150
     1151    def K_k_Schur_non_commutative_variables(self,la):
     1152        r"""
     1153        Returns the K-`k`-Schur function, as embedded inside the affine zero Hecke algebra.
     1154
     1155        INPUT:
     1156
     1157        - ``la`` -- A `k`-bounded Partition
     1158
     1159        OUTPUT:
     1160
     1161        - An element of the affine zero Hecke algebra.
     1162
     1163        EXAMPLES::
     1164
     1165            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1166            sage: g.K_k_Schur_non_commutative_variables([2,1])
     1167            T3*T1*T0 + T1*T2*T0 + T3*T2*T0 - T2*T0 + T0*T1*T0 + T2*T0*T1 + T0*T3*T0 + T2*T0*T3 + T0*T3*T1 + T2*T3*T2 - T3*T1 + T2*T3*T1 + T3*T1*T2 + T1*T2*T1
     1168            sage: g.K_k_Schur_non_commutative_variables([])
     1169            1
     1170            sage: g.K_k_Schur_non_commutative_variables([4,1])
     1171            Traceback (most recent call last):
     1172            ...
     1173            ValueError: Partition should be 3-bounded
     1174        """
     1175        SF = SymmetricFunctions(self.base_ring())
     1176        h = SF.h()
     1177        S = h(self._g_to_kh_on_basis(la)).support()
     1178        return sum(h(self._g_to_kh_on_basis(la)).coefficient(x)*self.homogeneous_basis_noncommutative_variables_zero_Hecke(x) for x in S)
     1179
     1180    def _kh_to_g_on_basis(self, la):
     1181        r"""
     1182        Given a `k`-homogeneous basis element, this returns the element written in the
     1183        K-`k`-Schur basis.
     1184
     1185        INPUT:
     1186
     1187        - ``la`` -- A `k`-bounded partition
     1188
     1189        OUTPUT:
     1190
     1191        - An element of the `k`-bounded subspace, written in the K-`k`-Schur basis.
     1192
     1193        EXAMPLES::
     1194
     1195            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1196            sage: g._kh_to_g_on_basis([2,1])
     1197            -Kks3[2] + Kks3[2, 1] + Kks3[3]
     1198            sage: g._kh_to_g_on_basis([])
     1199            Kks3[]
     1200            sage: g._kh_to_g_on_basis([4,1])
     1201            Traceback (most recent call last):
     1202            ...
     1203            TypeError: do not know how to make x (= [4, 1]) an element of self (=3-bounded Symmetric Functions over Rational Field with t=1 in the K-3-Schur basis)
     1204        """
     1205        if la == []:
     1206            return self([])
     1207        h = self.realization_of().khomogeneous()
     1208        f = h(self(la)) - h(la)
     1209        return self(la) - sum(self._kh_to_g_on_basis(x)*f.coefficient(x) for x in f.support())
     1210
     1211    def product(self, x,y):
     1212        r"""
     1213        Returns the product of the two K-`k`-Schur functions.
     1214
     1215        INPUT:
     1216
     1217        - ``x``, ``y`` -- elements of the `k`-bounded subspace, in the K-`k`-Schur basis.
     1218
     1219        OUTPUT:
     1220
     1221        - An element of the `k`-bounded subspace, in the K-`k`-Schur basis
     1222
     1223        EXAMPLES::
     1224
     1225            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1226            sage: g.product(g([2,1]), g[1])
     1227            -2*Kks3[2, 1] + Kks3[2, 1, 1] + Kks3[2, 2]
     1228            sage: g.product(g([2,1]), g([]))
     1229            Kks3[2, 1]
     1230        """
     1231        kh = self.realization_of().khomogeneous()
     1232        return self(kh(x)*kh(y))
     1233
     1234    def lift(self, x):
     1235        r"""
     1236        Returns the lift of a `k`-bounded symmetric function.
     1237
     1238        INPUT:
     1239
     1240        - ``x`` -- An expression in the K-`k`-Schur basis. Equivalently, ``x`` can be a
     1241            `k`-bounded partition (then ``x`` corresponds to the basis element indexed by ``x``)
     1242
     1243        OUTPUT:
     1244
     1245        - A symmetric function.
     1246
     1247        EXAMPLES::
     1248
     1249            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1250            sage: g.lift([2,1])
     1251            h[2] + h[2, 1] - h[3]
     1252            sage: g.lift([])
     1253            h[]
     1254            sage: g.lift([4,1])
     1255            Traceback (most recent call last):
     1256            ...
     1257            TypeError: do not know how to make x (= [4, 1]) an element of self (=3-bounded Symmetric Functions over Rational Field with t=1 in the K-3-Schur basis)
     1258        """
     1259        kh = self.realization_of().khomogeneous()
     1260        return kh(self(x)).lift()
     1261
     1262    def retract(self, x):
     1263        r"""
     1264        Returns the retract of a symmetric function.
     1265
     1266        INPUT:
     1267
     1268        - ``x`` -- A symmetric function.
     1269
     1270        OUTPUT:
     1271
     1272        - A `k`-bounded symmetric function in the K-`k`-Schur basis.
     1273
     1274        EXAMPLES::
     1275
     1276            sage: g = SymmetricFunctions(QQ).kBoundedSubspace(3,1).K_kschur()
     1277            sage: m = SymmetricFunctions(QQ).m()
     1278            sage: g.retract(m[2,1])
     1279            -2*Kks3[1] + 4*Kks3[1, 1] - 2*Kks3[1, 1, 1] - Kks3[2] + Kks3[2, 1]
     1280            sage: g.retract(m([]))
     1281            Kks3[]
     1282        """
     1283        kh = self.realization_of().khomogeneous()
     1284        return self(kh.retract(x))
  • sage/combinat/sf/sf.py

    diff --git a/sage/combinat/sf/sf.py b/sage/combinat/sf/sf.py
    a b class SymmetricFunctions(UniqueRepresent 
    568568          From: 3-bounded Symmetric Functions over Rational Field with t=1 in the 3-Schur basis also with t=1
    569569          To:   Symmetric Functions over Rational Field in the Schur basis
    570570
     571    The `k`-Schur functions are more generally defined with a parameter `t` and they are
     572    a basis of the subspace spanned by the the Hall-Littlewood ``Qp`` symmetric functions
     573    indexed by partitions whose first part is less than or equal to `k`.::
     574
     575        sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     576        sage: SymS3 = Sym.kBoundedSubspace(3) # default t='t'
     577        sage: ks = SymS3.kschur()
     578        sage: Qp = Sym.hall_littlewood().Qp()
     579        sage: ks(Qp[2,1,1,1])
     580        ks3[2, 1, 1, 1] + (t^2+t)*ks3[2, 2, 1] + (t^3+t^2)*ks3[3, 1, 1] + t^4*ks3[3, 2]
     581
     582    The subspace spanned by the `k`-Schur functions with a parameter `t` are not known
     583    to form a natural algebra.  However it is known that the product of a `k`-Schur
     584    function and an `\ell`-Schur function is in the linear span of the `k+\ell`-Schur
     585    functions.::
     586
     587        sage: ks(ks[2,1]*ks[1,1])
     588        Traceback (most recent call last):
     589        ...
     590        ValueError: s[2, 1, 1, 1] + s[2, 2, 1] + s[3, 1, 1] + s[3, 2] is not in the image of Generic morphism:
     591          From: 3-bounded Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 3-Schur basis
     592          To:   Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Schur basis
     593        sage: ks[2,1]*ks[1,1]
     594        s[2, 1, 1, 1] + s[2, 2, 1] + s[3, 1, 1] + s[3, 2]
     595        sage: ks6 = Sym.kBoundedSubspace(6).kschur()
     596        sage: ks6(ks[3,1,1]*ks[3])
     597        ks6[3, 3, 1, 1] + ks6[4, 2, 1, 1] + (t+1)*ks6[4, 3, 1] + t*ks6[4, 4]
     598        + ks6[5, 1, 1, 1] + ks6[5, 2, 1] + t*ks6[5, 3] + ks6[6, 1, 1]
     599
     600    .. rubric:: dual `k`-Schur functions
     601
     602    The dual space to the subspace spanned by the `k`-Schur functions is most naturally
     603    realized as a quotient of the ring of symmetric functions by an ideal.  When `t=1`
     604    the ideal is generated by the monomial symmetric functions indexed by partitions
     605    whose first part is greater than `k`.::
     606
     607        sage: Sym = SymmetricFunctions(QQ)
     608        sage: SymQ3 = Sym.kBoundedQuotient(3,t=1)
     609        sage: km = SymQ3.kmonomial()
     610        sage: km[2,1]*km[2,1]
     611        4*m3[2, 2, 1, 1] + 6*m3[2, 2, 2] + 2*m3[3, 2, 1] + 2*m3[3, 3]
     612        sage: F = SymQ3.affineSchur()
     613        sage: F[2,1]*F[2,1]
     614        2*F3[1, 1, 1, 1, 1, 1] + 4*F3[2, 1, 1, 1, 1] + 4*F3[2, 2, 1, 1] + 4*F3[2, 2, 2]
     615        + 2*F3[3, 1, 1, 1] + 4*F3[3, 2, 1] + 2*F3[3, 3]
     616
     617    When `t` is not equal to `1`, the subspace spanned by the `k`-Schur functions is
     618    realized as a quotient of the ring of symmetric functions by the ideal generated by
     619    the Hall-Littlewood symmetric functions in the P basis indexed by partitions with
     620    first part greater than `k`.::
     621
     622        sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
     623        sage: SymQ3 = Sym.kBoundedQuotient(3)
     624        sage: kHLP = SymQ3.kHallLittlewoodP()
     625        sage: kHLP[2,1]*kHLP[2,1]
     626        (t^2+2*t+1)*HLP3[2, 2, 1, 1] + (t^3+2*t^2+2*t+1)*HLP3[2, 2, 2]
     627        + (-t^4-t^3+t+1)*HLP3[3, 1, 1, 1] + (-t^2+t+2)*HLP3[3, 2, 1] + (t+1)*HLP3[3, 3]
     628        sage: HLP = Sym.hall_littlewood().P()
     629        sage: kHLP(HLP[3,1])
     630        HLP3[3, 1]
     631        sage: kHLP(HLP[4])
     632        0
     633
     634    In this space, the basis which is dual to the `k`-Schur functions conjecturally
     635    expands positively in the `k`-bounded Hall-Littlewood functions and has positive
     636    structure coefficients.::
     637
     638        sage: dks = SymQ3.dual_k_Schur()
     639        sage: kHLP(dks[2,2])
     640        (t^4+t^2)*HLP3[1, 1, 1, 1] + t*HLP3[2, 1, 1] + HLP3[2, 2]
     641        sage: dks[2,1]*dks[1,1]
     642        (t^2+t)*dks3[1, 1, 1, 1, 1] + (t+1)*dks3[2, 1, 1, 1] + (t+1)*dks3[2, 2, 1]
     643        + dks3[3, 1, 1] + dks3[3, 2]
     644
     645    At `t=1` the `k`-bounded Hall-Littlewood basis is equal to the `k`-bounded monomial
     646    basis and the dual `k`-Schur elements are equal to the affine Schur basis.  The
     647    `k`-bounded monomial basis and affine Schur functions are faster and should be used
     648    instead of the `k`-bounded Hall Littlewood P basis and dual `k`-Schur functions when
     649    `t=1`.::
     650
     651        sage: SymQ3 = Sym.kBoundedQuotient(3,t=1)
     652        sage: dks = SymQ3.dual_k_Schur()
     653        sage: F = SymQ3.affineSchur()
     654        sage: F[3,1]==dks[3,1]
     655        True
     656
    571657    .. rubric:: Implementing new bases
    572658
    573659    .. todo:: to be described
    class SymmetricFunctions(UniqueRepresent 
    10911177        """
    10921178        return self.kBoundedSubspace(k, t=1).khomogeneous()
    10931179
     1180    def kBoundedQuotient(self, k, t='t'):
     1181        r"""
     1182        Returns the `k`-bounded quotient space of the ring of symmetric functions.
     1183
     1184        INPUT:
     1185
     1186        - ``k`` - a positive integer
     1187
     1188        The quotient of the ring of symmetric functions ...
     1189
     1190        .. seealso:: :meth:`sage.combinat.sf.k_dual.KBoundedQuotient`
     1191
     1192        EXAMPLES::
     1193
     1194            sage: Sym = SymmetricFunctions(QQ)
     1195            sage: KQ = Sym.kBoundedQuotient(3); KQ
     1196            Traceback (most recent call last):
     1197            ...
     1198            TypeError: unable to convert t to a rational
     1199            sage: KQ = Sym.kBoundedQuotient(3,t=1); KQ
     1200            3-Bounded Quotient of Symmetric Functions over Rational Field with t=1
     1201            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
     1202            sage: KQ = Sym.kBoundedQuotient(3); KQ
     1203            3-Bounded Quotient of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field
     1204        """
     1205        from sage.combinat.sf.k_dual import KBoundedQuotient
     1206        return KBoundedQuotient(self, k, t)
     1207
    10941208class SymmetricaConversionOnBasis:
    10951209    def __init__(self, t, domain, codomain):
    10961210        """
    class SymmetricaConversionOnBasis: 
    11341248        # will have an optional optimization for the case when there
    11351249        # is no repetition in the support
    11361250        return self._codomain._from_dict(dict(self._t(self.fake_sym.monomial(partition))), coerce = True)
    1137