Skip to content

Commit 5bd0466

Browse files
author
Release Manager
committed
gh-36252: no generator for S1 Trying to explain that the symmetric group S(1) has no generator fixes #36204 ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. URL: #36252 Reported by: Frédéric Chapoton Reviewer(s): github-actions[bot], Travis Scrimshaw
2 parents 5b90f22 + 26ad664 commit 5bd0466

File tree

3 files changed

+50
-25
lines changed

3 files changed

+50
-25
lines changed

src/sage/groups/finitely_presented_named.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ def CyclicPresentation(n):
101101
n = Integer(n)
102102
if n < 1:
103103
raise ValueError('finitely presented group order must be positive')
104-
F = FreeGroup( 'a' )
104+
F = FreeGroup('a')
105105
rls = F([1])**n,
106-
return FinitelyPresentedGroup( F, rls )
106+
return FinitelyPresentedGroup(F, rls)
107+
107108

108109
def FinitelyGeneratedAbelianPresentation(int_list):
109110
r"""
@@ -384,6 +385,7 @@ def DiCyclicPresentation(n):
384385
rls = F([1])**(2*n), F([2,2])*F([-1])**n, F([-2,1,2,1])
385386
return FinitelyPresentedGroup(F, rls)
386387

388+
387389
def SymmetricPresentation(n):
388390
r"""
389391
Build the Symmetric group of order `n!` as a finitely presented group.
@@ -422,14 +424,18 @@ def SymmetricPresentation(n):
422424
from sage.groups.free_group import _lexi_gen
423425

424426
n = Integer(n)
427+
if n <= 1:
428+
return FinitelyPresentedGroup(FreeGroup(()), ())
429+
425430
perm_rep = SymmetricGroup(n)
426431
GAP_fp_rep = libgap.Image(libgap.IsomorphismFpGroupByGenerators(perm_rep, perm_rep.gens()))
427432
image_gens = GAP_fp_rep.FreeGeneratorsOfFpGroup()
428-
name_itr = _lexi_gen() # Python generator object for variable names
433+
name_itr = _lexi_gen() # Python generator object for variable names
429434
F = FreeGroup([next(name_itr) for x in perm_rep.gens()])
430435
ret_rls = tuple([F(rel_word.TietzeWordAbstractWord(image_gens).sage())
431-
for rel_word in GAP_fp_rep.RelatorsOfFpGroup()])
432-
return FinitelyPresentedGroup(F,ret_rls)
436+
for rel_word in GAP_fp_rep.RelatorsOfFpGroup()])
437+
return FinitelyPresentedGroup(F, ret_rls)
438+
433439

434440
def QuaternionPresentation():
435441
r"""
@@ -481,9 +487,10 @@ def AlternatingPresentation(n):
481487
sage: A6.as_permutation_group().is_isomorphic(AlternatingGroup(6)), A6.order()
482488
(True, 360)
483489
484-
TESTS::
490+
TESTS:
491+
492+
Even permutation tests::
485493
486-
sage: #even permutation test..
487494
sage: A1 = groups.presentation.Alternating(1); A2 = groups.presentation.Alternating(2)
488495
sage: A1.is_isomorphic(A2), A1.order()
489496
(True, 1)
@@ -496,14 +503,18 @@ def AlternatingPresentation(n):
496503
from sage.groups.free_group import _lexi_gen
497504

498505
n = Integer(n)
506+
if n <= 2:
507+
return FinitelyPresentedGroup(FreeGroup(()), ())
508+
499509
perm_rep = AlternatingGroup(n)
500510
GAP_fp_rep = libgap.Image(libgap.IsomorphismFpGroupByGenerators(perm_rep, perm_rep.gens()))
501511
image_gens = GAP_fp_rep.FreeGeneratorsOfFpGroup()
502-
name_itr = _lexi_gen() # Python generator object for variable names
512+
name_itr = _lexi_gen() # Python generator object for variable names
503513
F = FreeGroup([next(name_itr) for x in perm_rep.gens()])
504514
ret_rls = tuple([F(rel_word.TietzeWordAbstractWord(image_gens).sage())
505-
for rel_word in GAP_fp_rep.RelatorsOfFpGroup()])
506-
return FinitelyPresentedGroup(F,ret_rls)
515+
for rel_word in GAP_fp_rep.RelatorsOfFpGroup()])
516+
return FinitelyPresentedGroup(F, ret_rls)
517+
507518

508519
def KleinFourPresentation():
509520
r"""

src/sage/groups/perm_gps/permgroup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ def gens(self) -> tuple:
12791279
We make sure that the trivial group gets handled correctly::
12801280
12811281
sage: SymmetricGroup(1).gens()
1282-
((),)
1282+
()
12831283
"""
12841284
return self._gens
12851285

@@ -2034,8 +2034,11 @@ def strong_generating_system(self, base_of_group=None, implementation="sage"):
20342034
end;
20352035
return CosetsStabChain(S0);
20362036
end;""")
2037-
G = libgap.Group(self.gens()) # G = libgap(self)
2038-
S = G.StabChain()
2037+
if self._gens:
2038+
G = libgap.Group(self.gens()) # G = libgap(self)
2039+
else:
2040+
G = libgap.SymmetricGroup([])
2041+
S = G.StabChainImmutable()
20392042
cosets = gap_cosets(S)
20402043
one = self.one()
20412044
return [[one._generate_new_GAP(libgap.ListPerm(elt))

src/sage/groups/perm_gps/permgroup_named.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ class SymmetricGroup(PermutationGroup_symalt):
243243
244244
sage: groups.permutation.Symmetric(4)
245245
Symmetric group of order 4! as a permutation group
246+
sage: groups.permutation.Symmetric(1).gens()
247+
()
248+
249+
Check for :issue:`36204`::
250+
251+
sage: h = SymmetricGroup(1).hom(SymmetricGroup(2))
246252
"""
247253
def __init__(self, domain=None):
248254
"""
@@ -261,7 +267,8 @@ def __init__(self, domain=None):
261267
# Note that we skip the call to the superclass initializer in order to
262268
# avoid infinite recursion since SymmetricGroup is called by
263269
# PermutationGroupElement
264-
cat = Category.join([FinitePermutationGroups(), FiniteWeylGroups().Irreducible()])
270+
cat = Category.join([FinitePermutationGroups(),
271+
FiniteWeylGroups().Irreducible()])
265272
super(PermutationGroup_generic, self).__init__(category=cat)
266273

267274
self._domain = domain
@@ -270,11 +277,14 @@ def __init__(self, domain=None):
270277
self._domain_from_gap = {i+1: key for i, key in enumerate(self._domain)}
271278

272279
# Create the generators for the symmetric group
273-
gens = [tuple(self._domain)]
274-
if len(self._domain) > 2:
275-
gens.append(tuple(self._domain[:2]))
276-
self._gens = tuple([self.element_class(g, self, check=False)
277-
for g in gens])
280+
if self._deg <= 1:
281+
self._gens = ()
282+
else:
283+
gens = [tuple(self._domain)]
284+
if self._deg > 2:
285+
gens.append(tuple(self._domain[:2]))
286+
self._gens = tuple([self.element_class(g, self, check=False)
287+
for g in gens])
278288

279289
def _gap_init_(self, gap=None):
280290
"""
@@ -1946,11 +1956,11 @@ def TransitiveGroups(d=None):
19461956
"""
19471957
if d is None:
19481958
return TransitiveGroupsAll()
1949-
else:
1950-
d = Integer(d)
1951-
if d < 0:
1952-
raise ValueError("a transitive group acts on a non negative integer number of positions")
1953-
return TransitiveGroupsOfDegree(d)
1959+
1960+
d = Integer(d)
1961+
if d < 0:
1962+
raise ValueError("a transitive group acts on a non negative integer number of positions")
1963+
return TransitiveGroupsOfDegree(d)
19541964

19551965

19561966
class TransitiveGroupsAll(DisjointUnionEnumeratedSets):
@@ -3449,6 +3459,7 @@ def codegrees(self):
34493459
ret.append((self._n-1)*self._m - self._n)
34503460
return tuple(sorted(ret, reverse=True))
34513461

3462+
34523463
class SmallPermutationGroup(PermutationGroup_generic):
34533464
r"""
34543465
A GAP SmallGroup, returned as a permutation group.
@@ -3513,7 +3524,7 @@ def __init__(self, order, gap_id):
35133524
"""
35143525
self._n = order
35153526
self._gap_id = gap_id
3516-
self._gap_small_group = libgap.SmallGroup(order,gap_id)
3527+
self._gap_small_group = libgap.SmallGroup(order, gap_id)
35173528
gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image(self._gap_small_group)
35183529
PermutationGroup_generic.__init__(self, gap_group=gap_permutation_group)
35193530

0 commit comments

Comments
 (0)