Skip to content

Commit 886bad4

Browse files
committed
rename also set-like species
1 parent 1be0a58 commit 886bad4

File tree

1 file changed

+80
-36
lines changed

1 file changed

+80
-36
lines changed

src/sage/rings/species.py

Lines changed: 80 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from itertools import accumulate, chain, product
3535

36+
from sage.arith.misc import divisors
3637
from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis
3738
from sage.categories.modules import Modules
3839
from sage.categories.monoids import Monoids
@@ -48,9 +49,10 @@
4849
from sage.groups.perm_gps.permgroup import PermutationGroup, PermutationGroup_generic
4950
from sage.groups.perm_gps.permgroup_named import SymmetricGroup
5051
from sage.libs.gap.libgap import libgap
51-
from sage.misc.cachefunc import cached_method
52+
from sage.misc.cachefunc import cached_method, cached_function
5253
from sage.misc.fast_methods import WithEqualityById
5354
from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass
55+
from sage.misc.misc_c import prod
5456
from sage.modules.free_module_element import vector
5557
from sage.monoids.indexed_free_monoid import (IndexedFreeAbelianMonoid,
5658
IndexedFreeAbelianMonoidElement)
@@ -297,13 +299,13 @@ def __lt__(self, other):
297299
sage: len(P.cover_relations())
298300
7
299301
sage: sorted(P.cover_relations(), key=str)
300-
[[C_4, {((1,2)(3,4),)}],
302+
[[C_4, E_2(X^2)],
303+
[E_2(E_2), C_4],
304+
[E_2(E_2), Pb_4],
305+
[E_4, E_2(E_2)],
301306
[E_4, Eo_4],
302-
[E_4, P_4],
303307
[Eo_4, Pb_4],
304-
[P_4, C_4],
305-
[P_4, Pb_4],
306-
[Pb_4, {((1,2)(3,4),)}]]
308+
[Pb_4, E_2(X^2)]]
307309
308310
TESTS::
309311
@@ -531,7 +533,7 @@ def _element_constructor_(self, G, pi=None, check=True):
531533

532534
def _rename(self, n):
533535
r"""
534-
Names for common species.
536+
Give common species of degree `n` their traditional names.
535537
536538
EXAMPLES::
537539
@@ -589,6 +591,9 @@ def _rename(self, n):
589591
[(i, i+1) for i in range(1, n, 2)]]
590592
self(PermutationGroup(gens), pi, check=False).rename(f"Pb_{n}" + sort)
591593

594+
if self._arity == 1:
595+
_ = _atomic_set_like_species(n)
596+
592597
def __contains__(self, x):
593598
r"""
594599
Return whether ``x`` is in ``self``.
@@ -940,11 +945,11 @@ def _element_constructor_(self, G, pi=None, check=True):
940945
sage: a = lambda g, x: SetPartition([[g(e) for e in b] for b in x])
941946
sage: X = SetPartitions(4, [2, 2])
942947
sage: M((X, a, 'left'), {0: X.base_set()})
943-
P_4
948+
E_2(E_2)
944949
945950
sage: X = SetPartitions(8, [4, 2, 2])
946951
sage: M((X, a, 'left'), {0: X.base_set()}, check=False)
947-
E_4*P_4
952+
E_4*E_2(E_2)
948953
949954
TESTS::
950955
@@ -1176,23 +1181,23 @@ def _richcmp_(self, other, op):
11761181
sage: len(P.cover_relations())
11771182
17
11781183
sage: sorted(P.cover_relations(), key=str)
1179-
[[C_4, {((1,2)(3,4),)}],
1184+
[[C_4, E_2(X^2)],
1185+
[E_2(E_2), C_4],
1186+
[E_2(E_2), E_2^2],
1187+
[E_2(E_2), Pb_4],
1188+
[E_2(X^2), X^4],
1189+
[E_2^2, E_2(X^2)],
11801190
[E_2^2, X^2*E_2],
1181-
[E_2^2, {((1,2)(3,4),)}],
1191+
[E_4, E_2(E_2)],
11821192
[E_4, Eo_4],
1183-
[E_4, P_4],
11841193
[E_4, X*E_3],
11851194
[Eo_4, Pb_4],
11861195
[Eo_4, X*C_3],
1187-
[P_4, C_4],
1188-
[P_4, E_2^2],
1189-
[P_4, Pb_4],
1190-
[Pb_4, {((1,2)(3,4),)}],
1196+
[Pb_4, E_2(X^2)],
11911197
[X*C_3, X^4],
11921198
[X*E_3, X*C_3],
11931199
[X*E_3, X^2*E_2],
1194-
[X^2*E_2, X^4],
1195-
[{((1,2)(3,4),)}, X^4]]
1200+
[X^2*E_2, X^4]]
11961201
11971202
TESTS::
11981203
@@ -1439,7 +1444,7 @@ def __call__(self, *args):
14391444
sage: X(E2)
14401445
E_2
14411446
sage: E2(E2)
1442-
P_4
1447+
E_2(E_2)
14431448
14441449
sage: M = MolecularSpecies(["X","Y"])
14451450
sage: X = M(SymmetricGroup(1), {0: [1]})
@@ -1637,17 +1642,17 @@ def tilde(self):
16371642
sage: P = PolynomialSpecies(QQ, "X")
16381643
sage: sortkey = lambda x: (len(x[1]), sum(x[1].coefficients()), str(x[0]))
16391644
sage: n=4; table(sorted([(m, P.monomial(m).tilde()) for m in M.subset(n)], key=sortkey))
1640-
X^4 X^4
1641-
X^2*E_2 2*X^2*E_2
1642-
{((1,2)(3,4),)} 2*{((1,2)(3,4),)}
1643-
X*C_3 3*X*C_3
1644-
C_4 4*C_4
1645-
E_2^2 4*E_2^2
1646-
Pb_4 4*Pb_4
1647-
X*E_3 X*E_3 + X^2*E_2 + X*C_3
1648-
Eo_4 Eo_4 + 2*X*C_3 + Pb_4
1649-
P_4 2*P_4 + E_2^2 + Pb_4 + C_4
1650-
E_4 E_4 + E_2^2 + X*C_3 + P_4 + C_4
1645+
X^4 X^4
1646+
E_2(X^2) 2*E_2(X^2)
1647+
X^2*E_2 2*X^2*E_2
1648+
X*C_3 3*X*C_3
1649+
C_4 4*C_4
1650+
E_2^2 4*E_2^2
1651+
Pb_4 4*Pb_4
1652+
X*E_3 X*E_3 + X^2*E_2 + X*C_3
1653+
Eo_4 Eo_4 + 2*X*C_3 + Pb_4
1654+
E_2(E_2) 2*E_2(E_2) + E_2^2 + Pb_4 + C_4
1655+
E_4 E_4 + E_2^2 + X*C_3 + E_2(E_2) + C_4
16511656
16521657
sage: P.<X,Y> = PolynomialSpecies(QQ)
16531658
sage: E2 = PolynomialSpecies(QQ, "X")(SymmetricGroup(2))
@@ -1864,7 +1869,7 @@ def _compose_with_weighted_singletons(self, names, multiplicities, degrees):
18641869
18651870
sage: C4 = P(CyclicPermutationGroup(4))
18661871
sage: C4._compose_with_weighted_singletons(["X"], [-1], [[4]])
1867-
-C_4 + {((1,2)(3,4),)}
1872+
-C_4 + E_2(X^2)
18681873
18691874
Exercise (2.5.17) in [BLL1998]_::
18701875
@@ -1894,7 +1899,7 @@ def _compose_with_weighted_singletons(self, names, multiplicities, degrees):
18941899
TESTS::
18951900
18961901
sage: (C4+E2^2)._compose_with_weighted_singletons(["X"], [-1], [[4]])
1897-
-C_4 + E_2^2 + {((1,2)(3,4),)} - 2*X^2*E_2 + X^4
1902+
-C_4 + E_2^2 + E_2(X^2) - 2*X^2*E_2 + X^4
18981903
18991904
sage: C4._compose_with_weighted_singletons(["X"], [-1, 0], [[4]])
19001905
Traceback (most recent call last):
@@ -1967,10 +1972,10 @@ def __call__(self, *args):
19671972
sage: E2(-X)
19681973
-E_2 + X^2
19691974
sage: E2(X^2)
1970-
{((1,2)(3,4),)}
1975+
E_2(X^2)
19711976
19721977
sage: E2(X + X^2)
1973-
E_2 + X^3 + {((1,2)(3,4),)}
1978+
E_2 + X^3 + E_2(X^2)
19741979
19751980
sage: P2 = PolynomialSpecies(QQ, ["X", "Y"])
19761981
sage: X = P2(SymmetricGroup(1), {0: [1]})
@@ -2194,7 +2199,7 @@ def _element_constructor_(self, G, pi=None, check=True):
21942199
sage: X = SetPartitions(4, 2)
21952200
sage: a = lambda g, x: SetPartition([[g(e) for e in b] for b in x])
21962201
sage: P((X, a, 'left'), {0: [1,2,3,4]})
2197-
X*E_3 + P_4
2202+
X*E_3 + E_2(E_2)
21982203
21992204
The species of permutation groups::
22002205
@@ -2206,7 +2211,7 @@ def _element_constructor_(self, G, pi=None, check=True):
22062211
....: H = S.subgroup(G.conjugate(pi).gens())
22072212
....: return next(K for K in X if K == H)
22082213
sage: P((X, act), {0: range(1, n+1)}, check=False)
2209-
4*E_4 + 4*P_4 + E_2^2 + 2*X*E_3
2214+
4*E_4 + 4*E_2(E_2) + E_2^2 + 2*X*E_3
22102215
22112216
Create a multisort species given an action::
22122217
@@ -2505,3 +2510,42 @@ def factor(s, c, d):
25052510
for s in range(self._arity))
25062511

25072512
Element = PolynomialSpeciesElement
2513+
2514+
2515+
@cached_function
2516+
def _atomic_set_like_species(n):
2517+
r"""
2518+
Return a list of the atomic set like species of degree `n`,
2519+
and provide their traditional names.
2520+
2521+
INPUT:
2522+
2523+
- ``n`` -- positive integer, the degree
2524+
2525+
EXAMPLES::
2526+
2527+
sage: from sage.rings.species import _atomic_set_like_species
2528+
sage: _atomic_set_like_species(6)
2529+
[E_2(E_3), E_2(X*E_2), E_2(X^3), E_3(E_2), E_3(X^2), E_6]
2530+
2531+
sage: oeis([len(_atomic_set_like_species(n)) for n in range(1,10)]) # optional - internet
2532+
0: A007650: Number of set-like atomic species of degree n.
2533+
"""
2534+
M = MolecularSpecies("X")
2535+
if n == 1:
2536+
return [M(SymmetricGroup(1))]
2537+
result = []
2538+
for d in divisors(n):
2539+
if d == 1:
2540+
continue
2541+
E_d = M(SymmetricGroup(d))
2542+
if d == n:
2543+
result.append(E_d)
2544+
continue
2545+
for pi in Partitions(n // d):
2546+
for l_F in cartesian_product([_atomic_set_like_species(p) for p in pi]):
2547+
G = prod(l_F)
2548+
F = E_d(G)
2549+
F.support()[0].rename(f"E_{d}({G})")
2550+
result.append(F)
2551+
return result

0 commit comments

Comments
 (0)