Path: blob/master/src/sage/combinat/hall_polynomial.py
8817 views
r"""1Hall Polynomials2"""3#*****************************************************************************4# Copyright (C) 2013 Travis Scrimshaw <tscrim at ucdavis.edu>,5#6# Distributed under the terms of the GNU General Public License (GPL)7#8# This code is distributed in the hope that it will be useful,9# but WITHOUT ANY WARRANTY; without even the implied warranty of10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11# General Public License for more details.12#13# The full text of the GPL is available at:14#15# http://www.gnu.org/licenses/16#*****************************************************************************1718from sage.misc.misc import prod19from sage.rings.all import ZZ20from sage.combinat.partition import Partition21from sage.combinat.q_analogues import q_binomial2223def hall_polynomial(nu, mu, la, q=None):24r"""25Return the (classical) Hall polynomial `P^{\nu}_{\mu,\lambda}`26(where `\nu`, `\mu` and `\lambda` are the inputs ``nu``, ``mu``27and ``la``).2829Let `\nu,\mu,\lambda` be partitions. The Hall polynomial30`P^{\nu}_{\mu,\lambda}(q)` (in the indeterminate `q`) is defined31as follows: Specialize `q` to a prime power, and consider the32category of `\GF{q}`-vector spaces with a distinguished33nilpotent endomorphism. The morphisms in this category shall be34the linear maps commuting with the distinguished endomorphisms.35The *type* of an object in the category will be the Jordan type36of the distinguished endomorphism; this is a partition. Now, if37`N` is any fixed object of type `\nu` in this category, then38the polynomial `P^{\nu}_{\mu,\lambda}(q)` specialized at the39prime power `q` counts the number of subobjects `L` of `N` having40type `\lambda` such that the quotient object `N / L` has type41`\mu`. This determines the values of the polynomial42`P^{\nu}_{\mu,\lambda}` at infinitely many points (namely, at all43prime powers), and hence `P^{\nu}_{\mu,\lambda}` is uniquely44determined. The degree of this polynomial is at most45`n(\nu) - n(\lambda) - n(\mu)`, where46`n(\kappa) = \sum_i (i-1) \kappa_i` for every partition `\kappa`.47(If this is negative, then the polynomial is zero.)4849These are the structure coefficients of the50:class:`(classical) Hall algebra <HallAlgebra>`.5152If `\lvert \nu \rvert \neq \lvert \mu \rvert + \lvert \lambda \rvert`,53then we have `P^{\nu}_{\mu,\lambda} = 0`. More generally, if the54Littlewood-Richardson coefficient `c^{\nu}_{\mu,\lambda}`55vanishes, then `P^{\nu}_{\mu,\lambda} = 0`.5657The Hall polynomials satisfy the symmetry property58`P^{\nu}_{\mu,\lambda} = P^{\nu}_{\lambda,\mu}`.5960ALGORITHM:6162If `\lambda = (1^r)` and63`\lvert \nu \rvert = \lvert \mu \rvert + \lvert \lambda \rvert`,64then we compute `P^{\nu}_{\mu,\lambda}` as follows (cf. Example 2.465in [Schiffmann]_):6667First, write `\nu = (1^{l_1}, 2^{l_2}, \ldots, n^{l_n})`, and68define a sequence `r = r_0 \geq r_1 \geq \cdots \geq r_n` such that6970.. MATH::7172\mu = \left( 1^{l_1 - r_0 + 2r_1 - r_2}, 2^{l_2 - r_1 + 2r_2 - r_3},73\ldots , (n-1)^{l_{n-1} - r_{n-2} + 2r_{n-1} - r_n},74n^{l_n - r_{n-1} + r_n} \right).7576Thus if `\mu = (1^{m_1}, \ldots, n^{m_n})`, we have the following system77of equations:7879.. MATH::8081\begin{aligned}82m_1 & = l_1 - r + 2r_1 - r_2,83\\ m_2 & = l_2 - r_1 + 2r_2 - r_3,84\\ & \vdots ,85\\ m_{n-1} & = l_{n-1} - r_{n-2} + 2r_{n-1} - r_n,86\\ m_n & = l_n - r_{n-1} + r_n87\end{aligned}8889and solving for `r_i` and back substituting we obtain the equations:9091.. MATH::9293\begin{aligned}94r_n & = r_{n-1} + m_n - l_n,95\\ r_{n-1} & = r_{n-2} + m_{n-1} - l_{n-1} + m_n - l_n,96\\ & \vdots ,97\\ r_1 & = r + \sum_{k=1}^n (m_k - l_k),98\end{aligned}99100or in general we have the recursive equation:101102.. MATH::103104r_i = r_{i-1} + \sum_{k=i}^n (m_k - l_k).105106This, combined with the condition that `r_0 = r`, determines the107`r_i` uniquely (recursively). Next we define108109.. MATH::110111t = (r_{n-2} - r_{n-1})(l_n - r_{n-1})112+ (r_{n-3} - r_{n-2})(l_{n-1} + l_n - r_{n-2}) + \cdots113+ (r_0 - r_1)(l_2 + \cdots + l_n - r_1),114115and with these notations we have116117.. MATH::118119P^{\nu}_{\mu,(1^r)} = q^t \binom{l_n}{r_{n-1}}_q120\binom{l_{n-1}}{r_{n-2} - r_{n-1}}_q \cdots \binom{l_1}{r_0 - r_1}_q.121122To compute `P^{\nu}_{\mu,\lambda}` in general, we compute the product123`I_{\mu} I_{\lambda}` in the Hall algebra and return the coefficient of124`I_{\nu}`.125126EXAMPLES::127128sage: from sage.combinat.hall_polynomial import hall_polynomial129sage: hall_polynomial([1,1],[1],[1])130q + 1131sage: hall_polynomial([2],[1],[1])1321133sage: hall_polynomial([2,1],[2],[1])134q135sage: hall_polynomial([2,2,1],[2,1],[1,1])136q^2 + q137sage: hall_polynomial([2,2,2,1],[2,2,1],[1,1])138q^4 + q^3 + q^2139sage: hall_polynomial([3,2,2,1], [3,2], [2,1])140q^6 + q^5141sage: hall_polynomial([4,2,1,1], [3,1,1], [2,1])1422*q^3 + q^2 - q - 1143sage: hall_polynomial([4,2], [2,1], [2,1], 0)1441145"""146if q is None:147q = ZZ['q'].gen()148R = q.parent()149150# Make sure they are partitions151nu = Partition(nu)152mu = Partition(mu)153la = Partition(la)154155if sum(nu) != sum(mu) + sum(la):156return R.zero()157158if all(x == 1 for x in la):159r = [len(la)] # r will be [r_0, r_1, ..., r_n].160exp_nu = nu.to_exp() # exp_nu == [l_1, l_2, ..., l_n].161exp_mu = mu.to_exp() # exp_mu == [m_1, m_2, ..., m_n].162n = max(len(exp_nu), len(exp_mu))163for k in range(n):164r.append(r[-1] + sum(exp_mu[k:]) - sum(exp_nu[k:]))165# Now, r is [r_0, r_1, ..., r_n].166exp_nu += [0]*(n - len(exp_nu)) # Pad with 0's until it has length n167# Note that all -1 for exp_nu is due to indexing168t = sum((r[k-2] - r[k-1])*(sum(exp_nu[k-1:]) - r[k-1]) for k in range(2,n+1))169if t < 0:170# This case needs short-circuiting, since otherwise q**-t171# might throw an exception if q is non-invertible.172return R.zero()173return q**t * q_binomial(exp_nu[n-1], r[n-1], q) \174* prod([q_binomial(exp_nu[k-1], r[k-1] - r[k], q)175for k in range(1, n)], R.one())176177from sage.algebras.hall_algebra import HallAlgebra178H = HallAlgebra(R, q)179return (H[mu]*H[la]).coefficient(nu)180181182183