Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/combinat/hall_polynomial.py
8817 views
1
r"""
2
Hall Polynomials
3
"""
4
#*****************************************************************************
5
# Copyright (C) 2013 Travis Scrimshaw <tscrim at ucdavis.edu>,
6
#
7
# Distributed under the terms of the GNU General Public License (GPL)
8
#
9
# This code is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
# General Public License for more details.
13
#
14
# The full text of the GPL is available at:
15
#
16
# http://www.gnu.org/licenses/
17
#*****************************************************************************
18
19
from sage.misc.misc import prod
20
from sage.rings.all import ZZ
21
from sage.combinat.partition import Partition
22
from sage.combinat.q_analogues import q_binomial
23
24
def hall_polynomial(nu, mu, la, q=None):
25
r"""
26
Return the (classical) Hall polynomial `P^{\nu}_{\mu,\lambda}`
27
(where `\nu`, `\mu` and `\lambda` are the inputs ``nu``, ``mu``
28
and ``la``).
29
30
Let `\nu,\mu,\lambda` be partitions. The Hall polynomial
31
`P^{\nu}_{\mu,\lambda}(q)` (in the indeterminate `q`) is defined
32
as follows: Specialize `q` to a prime power, and consider the
33
category of `\GF{q}`-vector spaces with a distinguished
34
nilpotent endomorphism. The morphisms in this category shall be
35
the linear maps commuting with the distinguished endomorphisms.
36
The *type* of an object in the category will be the Jordan type
37
of the distinguished endomorphism; this is a partition. Now, if
38
`N` is any fixed object of type `\nu` in this category, then
39
the polynomial `P^{\nu}_{\mu,\lambda}(q)` specialized at the
40
prime power `q` counts the number of subobjects `L` of `N` having
41
type `\lambda` such that the quotient object `N / L` has type
42
`\mu`. This determines the values of the polynomial
43
`P^{\nu}_{\mu,\lambda}` at infinitely many points (namely, at all
44
prime powers), and hence `P^{\nu}_{\mu,\lambda}` is uniquely
45
determined. The degree of this polynomial is at most
46
`n(\nu) - n(\lambda) - n(\mu)`, where
47
`n(\kappa) = \sum_i (i-1) \kappa_i` for every partition `\kappa`.
48
(If this is negative, then the polynomial is zero.)
49
50
These are the structure coefficients of the
51
:class:`(classical) Hall algebra <HallAlgebra>`.
52
53
If `\lvert \nu \rvert \neq \lvert \mu \rvert + \lvert \lambda \rvert`,
54
then we have `P^{\nu}_{\mu,\lambda} = 0`. More generally, if the
55
Littlewood-Richardson coefficient `c^{\nu}_{\mu,\lambda}`
56
vanishes, then `P^{\nu}_{\mu,\lambda} = 0`.
57
58
The Hall polynomials satisfy the symmetry property
59
`P^{\nu}_{\mu,\lambda} = P^{\nu}_{\lambda,\mu}`.
60
61
ALGORITHM:
62
63
If `\lambda = (1^r)` and
64
`\lvert \nu \rvert = \lvert \mu \rvert + \lvert \lambda \rvert`,
65
then we compute `P^{\nu}_{\mu,\lambda}` as follows (cf. Example 2.4
66
in [Schiffmann]_):
67
68
First, write `\nu = (1^{l_1}, 2^{l_2}, \ldots, n^{l_n})`, and
69
define a sequence `r = r_0 \geq r_1 \geq \cdots \geq r_n` such that
70
71
.. MATH::
72
73
\mu = \left( 1^{l_1 - r_0 + 2r_1 - r_2}, 2^{l_2 - r_1 + 2r_2 - r_3},
74
\ldots , (n-1)^{l_{n-1} - r_{n-2} + 2r_{n-1} - r_n},
75
n^{l_n - r_{n-1} + r_n} \right).
76
77
Thus if `\mu = (1^{m_1}, \ldots, n^{m_n})`, we have the following system
78
of equations:
79
80
.. MATH::
81
82
\begin{aligned}
83
m_1 & = l_1 - r + 2r_1 - r_2,
84
\\ m_2 & = l_2 - r_1 + 2r_2 - r_3,
85
\\ & \vdots ,
86
\\ m_{n-1} & = l_{n-1} - r_{n-2} + 2r_{n-1} - r_n,
87
\\ m_n & = l_n - r_{n-1} + r_n
88
\end{aligned}
89
90
and solving for `r_i` and back substituting we obtain the equations:
91
92
.. MATH::
93
94
\begin{aligned}
95
r_n & = r_{n-1} + m_n - l_n,
96
\\ r_{n-1} & = r_{n-2} + m_{n-1} - l_{n-1} + m_n - l_n,
97
\\ & \vdots ,
98
\\ r_1 & = r + \sum_{k=1}^n (m_k - l_k),
99
\end{aligned}
100
101
or in general we have the recursive equation:
102
103
.. MATH::
104
105
r_i = r_{i-1} + \sum_{k=i}^n (m_k - l_k).
106
107
This, combined with the condition that `r_0 = r`, determines the
108
`r_i` uniquely (recursively). Next we define
109
110
.. MATH::
111
112
t = (r_{n-2} - r_{n-1})(l_n - r_{n-1})
113
+ (r_{n-3} - r_{n-2})(l_{n-1} + l_n - r_{n-2}) + \cdots
114
+ (r_0 - r_1)(l_2 + \cdots + l_n - r_1),
115
116
and with these notations we have
117
118
.. MATH::
119
120
P^{\nu}_{\mu,(1^r)} = q^t \binom{l_n}{r_{n-1}}_q
121
\binom{l_{n-1}}{r_{n-2} - r_{n-1}}_q \cdots \binom{l_1}{r_0 - r_1}_q.
122
123
To compute `P^{\nu}_{\mu,\lambda}` in general, we compute the product
124
`I_{\mu} I_{\lambda}` in the Hall algebra and return the coefficient of
125
`I_{\nu}`.
126
127
EXAMPLES::
128
129
sage: from sage.combinat.hall_polynomial import hall_polynomial
130
sage: hall_polynomial([1,1],[1],[1])
131
q + 1
132
sage: hall_polynomial([2],[1],[1])
133
1
134
sage: hall_polynomial([2,1],[2],[1])
135
q
136
sage: hall_polynomial([2,2,1],[2,1],[1,1])
137
q^2 + q
138
sage: hall_polynomial([2,2,2,1],[2,2,1],[1,1])
139
q^4 + q^3 + q^2
140
sage: hall_polynomial([3,2,2,1], [3,2], [2,1])
141
q^6 + q^5
142
sage: hall_polynomial([4,2,1,1], [3,1,1], [2,1])
143
2*q^3 + q^2 - q - 1
144
sage: hall_polynomial([4,2], [2,1], [2,1], 0)
145
1
146
"""
147
if q is None:
148
q = ZZ['q'].gen()
149
R = q.parent()
150
151
# Make sure they are partitions
152
nu = Partition(nu)
153
mu = Partition(mu)
154
la = Partition(la)
155
156
if sum(nu) != sum(mu) + sum(la):
157
return R.zero()
158
159
if all(x == 1 for x in la):
160
r = [len(la)] # r will be [r_0, r_1, ..., r_n].
161
exp_nu = nu.to_exp() # exp_nu == [l_1, l_2, ..., l_n].
162
exp_mu = mu.to_exp() # exp_mu == [m_1, m_2, ..., m_n].
163
n = max(len(exp_nu), len(exp_mu))
164
for k in range(n):
165
r.append(r[-1] + sum(exp_mu[k:]) - sum(exp_nu[k:]))
166
# Now, r is [r_0, r_1, ..., r_n].
167
exp_nu += [0]*(n - len(exp_nu)) # Pad with 0's until it has length n
168
# Note that all -1 for exp_nu is due to indexing
169
t = sum((r[k-2] - r[k-1])*(sum(exp_nu[k-1:]) - r[k-1]) for k in range(2,n+1))
170
if t < 0:
171
# This case needs short-circuiting, since otherwise q**-t
172
# might throw an exception if q is non-invertible.
173
return R.zero()
174
return q**t * q_binomial(exp_nu[n-1], r[n-1], q) \
175
* prod([q_binomial(exp_nu[k-1], r[k-1] - r[k], q)
176
for k in range(1, n)], R.one())
177
178
from sage.algebras.hall_algebra import HallAlgebra
179
H = HallAlgebra(R, q)
180
return (H[mu]*H[la]).coefficient(nu)
181
182
183