Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no generator for S1 #36252

Merged
merged 2 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions src/sage/groups/finitely_presented_named.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ def CyclicPresentation(n):
n = Integer(n)
if n < 1:
raise ValueError('finitely presented group order must be positive')
F = FreeGroup( 'a' )
F = FreeGroup('a')
rls = F([1])**n,
return FinitelyPresentedGroup( F, rls )
return FinitelyPresentedGroup(F, rls)


def FinitelyGeneratedAbelianPresentation(int_list):
r"""
Expand Down Expand Up @@ -384,6 +385,7 @@ def DiCyclicPresentation(n):
rls = F([1])**(2*n), F([2,2])*F([-1])**n, F([-2,1,2,1])
return FinitelyPresentedGroup(F, rls)


def SymmetricPresentation(n):
r"""
Build the Symmetric group of order `n!` as a finitely presented group.
Expand Down Expand Up @@ -422,14 +424,18 @@ def SymmetricPresentation(n):
from sage.groups.free_group import _lexi_gen

n = Integer(n)
if n <= 1:
return FinitelyPresentedGroup(FreeGroup(()), ())

perm_rep = SymmetricGroup(n)
GAP_fp_rep = libgap.Image(libgap.IsomorphismFpGroupByGenerators(perm_rep, perm_rep.gens()))
image_gens = GAP_fp_rep.FreeGeneratorsOfFpGroup()
name_itr = _lexi_gen() # Python generator object for variable names
name_itr = _lexi_gen() # Python generator object for variable names
F = FreeGroup([next(name_itr) for x in perm_rep.gens()])
ret_rls = tuple([F(rel_word.TietzeWordAbstractWord(image_gens).sage())
for rel_word in GAP_fp_rep.RelatorsOfFpGroup()])
return FinitelyPresentedGroup(F,ret_rls)
for rel_word in GAP_fp_rep.RelatorsOfFpGroup()])
return FinitelyPresentedGroup(F, ret_rls)


def QuaternionPresentation():
r"""
Expand Down Expand Up @@ -481,9 +487,10 @@ def AlternatingPresentation(n):
sage: A6.as_permutation_group().is_isomorphic(AlternatingGroup(6)), A6.order()
(True, 360)

TESTS::
TESTS:

Even permutation tests::

sage: #even permutation test..
sage: A1 = groups.presentation.Alternating(1); A2 = groups.presentation.Alternating(2)
sage: A1.is_isomorphic(A2), A1.order()
(True, 1)
Expand All @@ -496,14 +503,18 @@ def AlternatingPresentation(n):
from sage.groups.free_group import _lexi_gen

n = Integer(n)
if n <= 2:
return FinitelyPresentedGroup(FreeGroup(()), ())

perm_rep = AlternatingGroup(n)
GAP_fp_rep = libgap.Image(libgap.IsomorphismFpGroupByGenerators(perm_rep, perm_rep.gens()))
image_gens = GAP_fp_rep.FreeGeneratorsOfFpGroup()
name_itr = _lexi_gen() # Python generator object for variable names
name_itr = _lexi_gen() # Python generator object for variable names
F = FreeGroup([next(name_itr) for x in perm_rep.gens()])
ret_rls = tuple([F(rel_word.TietzeWordAbstractWord(image_gens).sage())
for rel_word in GAP_fp_rep.RelatorsOfFpGroup()])
return FinitelyPresentedGroup(F,ret_rls)
for rel_word in GAP_fp_rep.RelatorsOfFpGroup()])
return FinitelyPresentedGroup(F, ret_rls)


def KleinFourPresentation():
r"""
Expand Down
9 changes: 6 additions & 3 deletions src/sage/groups/perm_gps/permgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ def gens(self) -> tuple:
We make sure that the trivial group gets handled correctly::

sage: SymmetricGroup(1).gens()
((),)
()
"""
return self._gens

Expand Down Expand Up @@ -2028,8 +2028,11 @@ def strong_generating_system(self, base_of_group=None, implementation="sage"):
end;
return CosetsStabChain(S0);
end;""")
G = libgap.Group(self.gens()) # G = libgap(self)
S = G.StabChain()
if self._gens:
G = libgap.Group(self.gens()) # G = libgap(self)
else:
G = libgap.SymmetricGroup([])
S = G.StabChainImmutable()
cosets = gap_cosets(S)
one = self.one()
return [[one._generate_new_GAP(libgap.ListPerm(elt))
Expand Down
27 changes: 19 additions & 8 deletions src/sage/groups/perm_gps/permgroup_named.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ class SymmetricGroup(PermutationGroup_symalt):

sage: groups.permutation.Symmetric(4)
Symmetric group of order 4! as a permutation group
sage: groups.permutation.Symmetric(1).gens()
()

Check for :issue:`36204`::

sage: h = SymmetricGroup(1).hom(SymmetricGroup(2))
"""
def __init__(self, domain=None):
"""
Expand All @@ -262,20 +268,24 @@ def __init__(self, domain=None):
# Note that we skip the call to the superclass initializer in order to
# avoid infinite recursion since SymmetricGroup is called by
# PermutationGroupElement
cat = Category.join([FinitePermutationGroups(), FiniteWeylGroups().Irreducible()])
cat = Category.join([FinitePermutationGroups(),
FiniteWeylGroups().Irreducible()])
super(PermutationGroup_generic, self).__init__(category=cat)

self._domain = domain
self._deg = len(self._domain)
self._deg = n = len(self._domain)
fchapoton marked this conversation as resolved.
Show resolved Hide resolved
self._domain_to_gap = {key: i+1 for i, key in enumerate(self._domain)}
self._domain_from_gap = {i+1: key for i, key in enumerate(self._domain)}

# Create the generators for the symmetric group
gens = [tuple(self._domain)]
if len(self._domain) > 2:
gens.append(tuple(self._domain[:2]))
self._gens = tuple([self.element_class(g, self, check=False)
for g in gens])
if n <= 1:
self._gens = ()
else:
gens = [tuple(self._domain)]
if n > 2:
gens.append(tuple(self._domain[:2]))
self._gens = tuple([self.element_class(g, self, check=False)
for g in gens])

def _gap_init_(self, gap=None):
"""
Expand Down Expand Up @@ -3440,6 +3450,7 @@ def codegrees(self):
ret.append((self._n-1)*self._m - self._n)
return tuple(sorted(ret, reverse=True))


class SmallPermutationGroup(PermutationGroup_generic):
r"""
A GAP SmallGroup, returned as a permutation group.
Expand Down Expand Up @@ -3500,7 +3511,7 @@ def __init__(self, order, gap_id):
"""
self._n = order
self._gap_id = gap_id
self._gap_small_group = libgap.SmallGroup(order,gap_id)
self._gap_small_group = libgap.SmallGroup(order, gap_id)
gap_permutation_group = self._gap_small_group.IsomorphismPermGroup().Image(self._gap_small_group)
PermutationGroup_generic.__init__(self, gap_group=gap_permutation_group)

Expand Down
Loading