Path: blob/master/sage/groups/perm_gps/permgroup_named.py
4069 views
r"""1"Named" Permutation groups (such as the symmetric group, S_n)23You can construct the following permutation groups:45-- SymmetricGroup, $S_n$ of order $n!$ (n can also be a list $X$ of distinct6positive integers, in which case it returns $S_X$)78-- AlternatingGroup, $A_n$ or order $n!/2$ (n can also be a list $X$9of distinct positive integers, in which case it returns10$A_X$)1112-- DihedralGroup, $D_n$ of order $2n$1314-- CyclicPermutationGroup, $C_n$ of order $n$1516-- DiCyclicGroup, nonabelian groups of order `4m` with a unique element of order 21718-- TransitiveGroup, $n^{th}$ transitive group of degree $d$19from the GAP tables of transitive groups (requires20the "optional" package database_gap)2122-- TransitiveGroups(d), TransitiveGroups(), set of all of the above2324-- MathieuGroup(degree), Mathieu group of degree 9, 10, 11, 12, 21, 22, 23, or 24.2526-- KleinFourGroup, subgroup of $S_4$ of order $4$ which is not $C_2 \times C_2$2728-- QuaternionGroup, non-abelian group of order `8`, `\{\pm 1, \pm I, \pm J, \pm K\}`2930-- PGL(n,q), projective general linear group of $n\times n$ matrices over31the finite field GF(q)3233-- PSL(n,q), projective special linear group of $n\times n$ matrices over34the finite field GF(q)3536-- PSp(2n,q), projective symplectic linear group of $2n\times 2n$ matrices37over the finite field GF(q)3839-- PSU(n,q), projective special unitary group of $n \times n$ matrices having40coefficients in the finite field $GF(q^2)$ that respect a41fixed nondegenerate sesquilinear form, of determinant 1.4243-- PGU(n,q), projective general unitary group of $n\times n$ matrices having44coefficients in the finite field $GF(q^2)$ that respect a45fixed nondegenerate sesquilinear form, modulo the centre.4647-- SuzukiGroup(q), Suzuki group over GF(q), $^2 B_2(2^{2k+1}) = Sz(2^{2k+1})$.484950AUTHOR:51- David Joyner (2007-06): split from permgp.py (suggested by Nick Alexander)5253REFERENCES:54Cameron, P., Permutation Groups. New York: Cambridge University Press, 1999.55Wielandt, H., Finite Permutation Groups. New York: Academic Press, 1964.56Dixon, J. and Mortimer, B., Permutation Groups, Springer-Verlag, Berlin/New York, 1996.5758NOTE:59Though Suzuki groups are okay, Ree groups should *not* be wrapped as60permutation groups - the construction is too slow - unless (for61small values or the parameter) they are made using explicit generators.62"""6364#*****************************************************************************65# Copyright (C) 2006 William Stein <[email protected]>66# David Joyner <[email protected]>67#68# Distributed under the terms of the GNU General Public License (GPL)69# http://www.gnu.org/licenses/70#*****************************************************************************7172from sage.rings.all import Integer73from sage.interfaces.all import gap74from sage.rings.finite_rings.constructor import FiniteField as GF75from sage.rings.arith import factor76from sage.rings.integer_ring import ZZ77from sage.groups.abelian_gps.abelian_group import AbelianGroup78from sage.misc.functional import is_even79from sage.misc.cachefunc import cached_method80from sage.misc.misc import deprecated_function_alias81from sage.groups.perm_gps.permgroup import PermutationGroup_generic82from sage.groups.perm_gps.permgroup_element import PermutationGroupElement83from sage.structure.unique_representation import UniqueRepresentation84from sage.structure.parent import Parent85from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets86from sage.sets.finite_enumerated_set import FiniteEnumeratedSet87from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets88from sage.categories.enumerated_sets import EnumeratedSets89from sage.sets.non_negative_integers import NonNegativeIntegers90from sage.sets.family import Family9192class PermutationGroup_unique(UniqueRepresentation, PermutationGroup_generic):93@staticmethod94def __classcall__(cls, *args, **kwds):95"""96This makes sure that domain is a FiniteEnumeratedSet before it gets passed97on to the __init__ method.9899EXAMPLES::100101sage: SymmetricGroup(['a','b']).domain() #indirect doctest102{'a', 'b'}103"""104domain = kwds.pop('domain', None)105if domain is not None:106if domain not in FiniteEnumeratedSets():107domain = FiniteEnumeratedSet(domain)108kwds['domain'] = domain109return super(PermutationGroup_unique, cls).__classcall__(cls, *args, **kwds)110111def __eq__(self, other):112"""113Overrides the default equality testing provided by114UniqueRepresentation by forcing a call to :meth:.`__cmp__`.115116EXAMPLES::117118sage: G = SymmetricGroup(6)119sage: G3 = G.subgroup([G((1,2,3,4,5,6)),G((1,2))])120sage: G == G3121True122"""123return self.__cmp__(other) == 0124125126class PermutationGroup_symalt(PermutationGroup_unique):127"""128This is a class used to factor out some of the commonality129in the SymmetricGroup and AlternatingGroup classes.130"""131132@staticmethod133def __classcall__(cls, domain):134"""135Normalizes the input of the constructor into a set136137INPUT:138139- ``n`` - an integer or list or tuple thereof140141Calls the constructor with a tuple representing the set.142143EXAMPLES::144145sage: S1 = SymmetricGroup(4)146sage: S2 = SymmetricGroup([1,2,3,4])147sage: S3 = SymmetricGroup((1,2,3,4))148sage: S1 is S2149True150sage: S1 is S3151True152153TESTS::154155sage: SymmetricGroup(0)156Symmetric group of order 0! as a permutation group157sage: SymmetricGroup(1)158Symmetric group of order 1! as a permutation group159sage: SymmetricGroup(-1)160Traceback (most recent call last):161...162ValueError: domain (=-1) must be an integer >= 0 or a list163"""164if domain not in FiniteEnumeratedSets():165if not isinstance(domain, (tuple, list)):166try:167domain = Integer(domain)168except TypeError:169raise ValueError, "domain (=%s) must be an integer >= 0 or a finite set (but domain has type %s)"%(domain,type(domain))170171if domain < 0:172raise ValueError, "domain (=%s) must be an integer >= 0 or a list"%domain173else:174domain = range(1, domain+1)175v = FiniteEnumeratedSet(domain)176else:177v = domain178179return super(PermutationGroup_symalt, cls).__classcall__(cls, domain=v)180181set = deprecated_function_alias(PermutationGroup_generic.domain, 'Sage Version 4.7.1')182183class SymmetricGroup(PermutationGroup_symalt):184def __init__(self, domain=None):185"""186The full symmetric group of order $n!$, as a permutation group.187If n is a list or tuple of positive integers then it returns the188symmetric group of the associated set.189190INPUT:191192- ``n`` - a positive integer, or list or tuple thereof193194EXAMPLES::195196sage: G = SymmetricGroup(8)197sage: G.order()19840320199sage: G200Symmetric group of order 8! as a permutation group201sage: G.degree()2028203sage: S8 = SymmetricGroup(8)204sage: G = SymmetricGroup([1,2,4,5])205sage: G206Symmetric group of order 4! as a permutation group207sage: G.domain()208{1, 2, 4, 5}209sage: G = SymmetricGroup(4)210sage: G211Symmetric group of order 4! as a permutation group212sage: G.domain()213{1, 2, 3, 4}214sage: G.category()215Join of Category of finite permutation groups and Category of finite weyl groups216sage: TestSuite(G).run()217218TESTS::219220sage: TestSuite(SymmetricGroup(0)).run()221"""222from sage.categories.finite_weyl_groups import FiniteWeylGroups223from sage.categories.finite_permutation_groups import FinitePermutationGroups224from sage.categories.category import Category225226#Note that we skip the call to the superclass initializer in order to227#avoid infinite recursion since SymmetricGroup is called by228#PermutationGroupElement229super(PermutationGroup_generic, self).__init__(category = Category.join([FinitePermutationGroups(), FiniteWeylGroups()]))230231self._domain = domain232self._deg = len(self._domain)233self._domain_to_gap = dict((key, i+1) for i, key in enumerate(self._domain))234self._domain_from_gap = dict((i+1, key) for i, key in enumerate(self._domain))235236#Create the generators for the symmetric group237gens = [ tuple(self._domain) ]238if len(self._domain) > 2:239gens.append( tuple(self._domain[:2]) )240self._gens = [PermutationGroupElement(g, self, check=False) for g in gens]241242243def _gap_init_(self, gap=None):244"""245Returns the string used to create this group in GAP.246247EXAMPLES::248249sage: S = SymmetricGroup(3)250sage: S._gap_init_()251'SymmetricGroup(3)'252sage: S = SymmetricGroup(['a', 'b', 'c'])253sage: S._gap_init_()254'SymmetricGroup(3)'255"""256return 'SymmetricGroup(%s)'%self.degree()257258@cached_method259def index_set(self):260"""261Indexing sets of descent of the symmetric group.262263EXAMPLES::264265sage: S8 = SymmetricGroup(8)266sage: S8.index_set()267[1, 2, 3, 4, 5, 6, 7]268269sage: S = SymmetricGroup([3,1,4,5])270sage: S.index_set()271[3, 1, 4]272"""273return self.domain()[:-1]274275def __cmp__(self, x):276"""277Fast comparison for SymmetricGroups.278279EXAMPLES:280sage: S8 = SymmetricGroup(8)281sage: S3 = SymmetricGroup(3)282sage: S8 > S3283True284"""285if isinstance(x, SymmetricGroup):286return cmp((self._deg, self._domain), (x._deg, x._domain))287else:288return PermutationGroup_generic.__cmp__(self, x)289290def _repr_(self):291"""292EXAMPLES:293sage: A = SymmetricGroup([2,3,7]); A294Symmetric group of order 3! as a permutation group295"""296return "Symmetric group of order %s! as a permutation group"%self.degree()297298def simple_reflection(self, i):299"""300For `i` in the index set of ``self``, this returns the301elementary transposition `s_i=(i,i+1)`.302303EXAMPLES::304305sage: A = SymmetricGroup(5)306sage: A.simple_reflection(3)307(3,4)308309sage: A = SymmetricGroup([2,3,7])310sage: A.simple_reflections()311Finite family {2: (2,3), 3: (3,7)}312"""313return self([(i, self._domain[self._domain.index(i)+1])], check=False)314315def major_index(self, parameter=None):316r"""317Returns the *major index generating polynomial* of ``self``,318which is a gadget counting the elements of ``self`` by major319index.320321INPUT:322323- ``parameter`` - an element of a ring. The result is324more explicit with a formal variable. (default:325element q of Univariate Polynomial Ring in q over326Integer Ring)327328.. math::329330P(q) = \sum_{g\in S_n} q^{ \operatorname{major\ index}(g) }331332EXAMPLES::333334sage: S4 = SymmetricGroup(4)335sage: S4.major_index()336q^6 + 3*q^5 + 5*q^4 + 6*q^3 + 5*q^2 + 3*q + 1337sage: K.<t> = QQ[]338sage: S4.major_index(t)339t^6 + 3*t^5 + 5*t^4 + 6*t^3 + 5*t^2 + 3*t + 1340"""341from sage.combinat.q_analogues import q_factorial342return q_factorial(self.degree(), parameter)343344class AlternatingGroup(PermutationGroup_symalt):345def __init__(self, domain=None):346"""347The alternating group of order $n!/2$, as a permutation group.348349INPUT:350351``n`` -- a positive integer, or list or tuple thereof352353EXAMPLES::354355sage: G = AlternatingGroup(6)356sage: G.order()357360358sage: G359Alternating group of order 6!/2 as a permutation group360sage: G.category()361Category of finite permutation groups362sage: TestSuite(G).run()363364sage: G = AlternatingGroup([1,2,4,5])365sage: G366Alternating group of order 4!/2 as a permutation group367sage: G.domain()368{1, 2, 4, 5}369sage: G.category()370Category of finite permutation groups371sage: TestSuite(G).run()372"""373PermutationGroup_symalt.__init__(self, gap_group='AlternatingGroup(%s)'%len(domain), domain=domain)374375def _repr_(self):376"""377EXAMPLES:378sage: A = AlternatingGroup([2,3,7]); A379Alternating group of order 3!/2 as a permutation group380"""381return "Alternating group of order %s!/2 as a permutation group"%self.degree()382383def _gap_init_(self, gap=None):384"""385Returns the string used to create this group in GAP.386387EXAMPLES::388389sage: A = AlternatingGroup(3)390sage: A._gap_init_()391'AlternatingGroup(3)'392sage: A = AlternatingGroup(['a', 'b', 'c'])393sage: A._gap_init_()394'AlternatingGroup(3)'395"""396return 'AlternatingGroup(%s)'%(self.degree())397398class CyclicPermutationGroup(PermutationGroup_unique):399def __init__(self, n):400"""401A cyclic group of order n, as a permutation group.402403INPUT:404n -- a positive integer405406EXAMPLES::407408sage: G = CyclicPermutationGroup(8)409sage: G.order()4108411sage: G412Cyclic group of order 8 as a permutation group413sage: G.category()414Category of finite permutation groups415sage: TestSuite(G).run()416sage: C = CyclicPermutationGroup(10)417sage: C.is_abelian()418True419sage: C = CyclicPermutationGroup(10)420sage: C.as_AbelianGroup()421Multiplicative Abelian Group isomorphic to C2 x C5422"""423n = Integer(n)424if n < 1:425raise ValueError, "n (=%s) must be >= 1"%n426gens = tuple(range(1, n+1))427PermutationGroup_generic.__init__(self, [gens], n)428429def _repr_(self):430"""431EXAMPLES:432sage: CyclicPermutationGroup(8)433Cyclic group of order 8 as a permutation group434"""435return "Cyclic group of order %s as a permutation group"%self.order()436437def is_commutative(self):438"""439Return True if this group is commutative.440441EXAMPLES:442sage: C = CyclicPermutationGroup(8)443sage: C.is_commutative()444True445"""446return True447448def is_abelian(self):449"""450Return True if this group is abelian.451452EXAMPLES:453sage: C = CyclicPermutationGroup(8)454sage: C.is_abelian()455True456"""457return True458459def as_AbelianGroup(self):460"""461Returns the corresponding Abelian Group instance.462463EXAMPLES:464sage: C = CyclicPermutationGroup(8)465sage: C.as_AbelianGroup()466Multiplicative Abelian Group isomorphic to C8467468"""469n = self.order()470a = list(factor(n))471invs = [x[0]**x[1] for x in a]472G = AbelianGroup(len(a), invs)473return G474475class DiCyclicGroup(PermutationGroup_unique):476r"""477The dicyclic group of order `4n`, for `n\geq 2`.478479INPUT:480- n -- a positive integer, two or greater481482OUTPUT:483484This is a nonabelian group similar in some respects to the485dihedral group of the same order, but with far fewer486elements of order 2 (it has just one). The permutation487representation constructed here is based on the presentation488489.. MATH::490491\langle a, x\mid a^{2n}=1, x^{2}=a^{n}, x^{-1}ax=a^{-1}\rangle492493For `n=2` this is the group of quaternions494(`{\pm 1, \pm I,\pm J, \pm K}`), which is the nonabelian495group of order 8 that is not the dihedral group `D_4`,496the symmetries of a square. For `n=3` this is the nonabelian497group of order 12 that is not the dihedral group `D_6`498nor the alternating group `A_4`. This group of order 12 is499also the semi-direct product of of `C_2` by `C_4`,500`C_3\rtimes C_4`. [CONRAD2009]_501502503When the order of the group is a504power of 2 it is known as a "generalized quaternion group."505506IMPLEMENTATION:507508The presentation above means every element can be written as509`a^{i}x^{j}` with `0\leq i<2n`, `j=0,1`. We code `a^i` as the symbol510`i+1` and code `a^{i}x` as the symbol `2n+i+1`. The two generators511are then represented using a left regular representation.512513EXAMPLES:514515A dicyclic group of order 384, with a large power of 2 as a divisor::516517sage: n = 3*2^5518sage: G = DiCyclicGroup(n)519sage: G.order()520384521sage: a = G.gen(0)522sage: x = G.gen(1)523sage: a^(2*n)524()525sage: a^n==x^2526True527sage: x^-1*a*x==a^-1528True529530A large generalized quaternion group (order is a power of 2)::531532sage: n = 2^10533sage: G=DiCyclicGroup(n)534sage: G.order()5354096536sage: a = G.gen(0)537sage: x = G.gen(1)538sage: a^(2*n)539()540sage: a^n==x^2541True542sage: x^-1*a*x==a^-1543True544545Just like the dihedral group, the dicyclic group has546an element whose order is half the order of the group.547Unlike the dihedral group, the dicyclic group has only548one element of order 2. Like the dihedral groups of549even order, the center of the dicyclic group is a550subgroup of order 2 (thus has the unique element of551order 2 as its non-identity element). ::552553sage: G=DiCyclicGroup(3*5*4)554sage: G.order()555240556sage: two = [g for g in G if g.order()==2]; two557[(1,5)(2,6)(3,7)(4,8)(9,13)(10,14)(11,15)(12,16)]558sage: G.center().order()5592560561For small orders, we check this is really a group562we do not have in Sage otherwise. ::563564sage: G = DiCyclicGroup(2)565sage: H = DihedralGroup(4)566sage: G.is_isomorphic(H)567False568sage: G = DiCyclicGroup(3)569sage: H = DihedralGroup(6)570sage: K = AlternatingGroup(6)571sage: G.is_isomorphic(H) or G.is_isomorphic(K)572False573574REFERENCES:575576.. [CONRAD2009] `Groups of order 12577<http://www.math.uconn.edu/~kconrad/blurbs/grouptheory/group12.pdf>`_.578Keith Conrad, accessed 21 October 2009.579580AUTHOR:581- Rob Beezer (2009-10-18)582"""583def __init__(self, n):584r"""585The dicyclic group of order `4*n`, as a permutation group.586587INPUT:588n -- a positive integer, two or greater589590EXAMPLES:591sage: G = DiCyclicGroup(3*8)592sage: G.order()59396594sage: TestSuite(G).run()595"""596n = Integer(n)597if n < 2:598raise ValueError, "n (=%s) must be 2 or greater"%n599600# Certainly 2^2 is part of the first factor of the order601# r is maximum power of 2 in the order602# m is the rest, the odd part603order = 4*n604factored = order.factor()605r = factored[0][0]**factored[0][1]606m = order//r607halfr, fourthr = r//2, r//4608609# Representation of a610# Two cycles of length halfr611a = [tuple(range(1, halfr+1)), tuple(range(halfr+1, r+1))]612# With an odd part, a cycle of length m will give the right order for a613if m > 1:614a.append( tuple(range(r+1, r+m+1)) )615616# Representation of x617# Four-cycles that will conjugate the generator a properly618x = [(i+1, (-i)%halfr + halfr + 1, (fourthr+i)%halfr + 1, (-fourthr-i)%halfr + halfr + 1)619for i in range(0, fourthr)]620# With an odd part, transpositions will conjugate the m-cycle to create inverse621if m > 1:622x += [(r+i+1, r+m-i) for i in range(0, (m-1)//2)]623624PermutationGroup_generic.__init__(self, gens=[a, x])625626def _repr_(self):627r"""628EXAMPLES:629sage: DiCyclicGroup(12)630Diyclic group of order 48 as a permutation group631"""632return "Diyclic group of order %s as a permutation group"%self.order()633634def is_commutative(self):635r"""636Return True if this group is commutative.637638EXAMPLES::639640sage: D = DiCyclicGroup(12)641sage: D.is_commutative()642False643"""644return False645646def is_abelian(self):647r"""648Return True if this group is abelian.649650EXAMPLES::651652sage: D = DiCyclicGroup(12)653sage: D.is_abelian()654False655"""656return False657658class KleinFourGroup(PermutationGroup_unique):659def __init__(self):660r"""661The Klein 4 Group, which has order $4$ and exponent $2$, viewed662as a subgroup of $S_4$.663664OUTPUT:665-- the Klein 4 group of order 4, as a permutation group of degree 4.666667EXAMPLES:668sage: G = KleinFourGroup(); G669The Klein 4 group of order 4, as a permutation group670sage: list(G)671[(), (3,4), (1,2), (1,2)(3,4)]672673TESTS::674675sage: G.category()676Category of finite permutation groups677sage: TestSuite(G).run()678679AUTHOR:680-- Bobby Moretti (2006-10)681"""682gens = [(1,2),(3,4)]683PermutationGroup_generic.__init__(self, gens)684685def _repr_(self):686"""687EXAMPLES:688sage: G = KleinFourGroup(); G689The Klein 4 group of order 4, as a permutation group690"""691return 'The Klein 4 group of order 4, as a permutation group'692693class QuaternionGroup(DiCyclicGroup):694r"""695The quaternion group of order 8.696697OUTPUT:698The quaternion group of order 8, as a permutation group.699See the ``DiCyclicGroup`` class for a generalization of this700construction.701702EXAMPLES:703704The quaternion group is one of two non-abelian groups of order 8,705the other being the dihedral group `D_4`. One way to describe this706group is with three generators, `I, J, K`, so the whole group is707then given as the set `\{\pm 1, \pm I, \pm J, \pm K\}` with relations708such as `I^2=J^2=K^2=-1`, `IJ=K` and `JI=-K`.709710The examples below illustrate how to use this group in a similar711manner, by testing some of these relations. The representation used712here is the left-regular representation. ::713714sage: Q = QuaternionGroup()715sage: I = Q.gen(0)716sage: J = Q.gen(1)717sage: K = I*J718sage: [I,J,K]719[(1,2,3,4)(5,6,7,8), (1,5,3,7)(2,8,4,6), (1,8,3,6)(2,7,4,5)]720sage: neg_one = I^2; neg_one721(1,3)(2,4)(5,7)(6,8)722sage: J^2 == neg_one and K^2 == neg_one723True724sage: J*I == neg_one*K725True726sage: Q.center().order() == 2727True728sage: neg_one in Q.center()729True730731AUTHOR:732-- Rob Beezer (2009-10-09)733"""734def __init__(self):735r"""736TESTS::737738sage: Q = QuaternionGroup()739sage: TestSuite(Q).run()740"""741DiCyclicGroup.__init__(self, 2)742743def _repr_(self):744r"""745EXAMPLES:746sage: Q=QuaternionGroup(); Q747Quaternion group of order 8 as a permutation group748"""749return "Quaternion group of order 8 as a permutation group"750751class DihedralGroup(PermutationGroup_unique):752def __init__(self, n):753"""754The Dihedral group of order $2n$ for any integer $n\geq 1$.755756INPUT:757n -- a positive integer758759OUTPUT:760-- the dihedral group of order 2*n, as a permutation group761762EXAMPLES:763sage: DihedralGroup(1)764Dihedral group of order 2 as a permutation group765766sage: DihedralGroup(2)767Dihedral group of order 4 as a permutation group768sage: DihedralGroup(2).gens()769[(3,4), (1,2)]770771sage: DihedralGroup(5).gens()772[(1,2,3,4,5), (1,5)(2,4)]773sage: list(DihedralGroup(5))774[(), (2,5)(3,4), (1,2)(3,5), (1,2,3,4,5), (1,3)(4,5), (1,3,5,2,4), (1,4)(2,3), (1,4,2,5,3), (1,5,4,3,2), (1,5)(2,4)]775776sage: G = DihedralGroup(6)777sage: G.order()77812779sage: G = DihedralGroup(5)780sage: G.order()78110782sage: G783Dihedral group of order 10 as a permutation group784sage: G.gens()785[(1,2,3,4,5), (1,5)(2,4)]786787sage: DihedralGroup(0)788Traceback (most recent call last):789...790ValueError: n must be positive791792TESTS::793794sage: TestSuite(G).run()795sage: G.category()796Category of finite permutation groups797sage: TestSuite(G).run()798"""799n = Integer(n)800if n <= 0:801raise ValueError, "n must be positive"802803# the first generator generates the cyclic subgroup of D_n, <(1...n)> in804# cycle notation805gen0 = range(1,n+1)806807if n < 1:808raise ValueError, "n (=%s) must be >= 1"%n809810# D_1 is a subgroup of S_2, we need the cyclic group of order 2811if n == 1:812gens = CyclicPermutationGroup(2).gens()813elif n == 2:814gens = ((1,2),(3,4))815else:816gen1 = [(i, n-i+1) for i in range(1, n//2 +1)]817gens = tuple([tuple(gen0),tuple(gen1)])818819PermutationGroup_generic.__init__(self, gens)820821def _repr_(self):822"""823EXAMPLES:824sage: G = DihedralGroup(5); G825Dihedral group of order 10 as a permutation group826"""827return "Dihedral group of order %s as a permutation group"%self.order()828829class MathieuGroup(PermutationGroup_unique):830def __init__(self, n):831"""832The Mathieu group of degree $n$.833834INPUT:835n -- a positive integer in {9, 10, 11, 12, 21, 22, 23, 24}.836837OUTPUT:838-- the Mathieu group of degree n, as a permutation group839840EXAMPLES::841842sage: G = MathieuGroup(12)843sage: G844Mathieu group of degree 12 and order 95040 as a permutation group845846TESTS::847848sage: G.category()849Category of finite permutation groups850sage: TestSuite(G).run(skip=["_test_enumerated_set_contains", "_test_enumerated_set_iter_list"])851852Note: this is a fairly big group, so we skip some tests that853currently require to list all the elements of the group,854because there is no proper iterator yet.855"""856n = Integer(n)857self._n = n858if not(n in [9, 10, 11, 12, 21, 22, 23, 24]):859raise ValueError,"argument must belong to {9, 10, 11, 12, 21, 22, 23, 24}."860id = 'MathieuGroup(%s)'%n861PermutationGroup_generic.__init__(self, gap_group=id)862863def _repr_(self):864"""865EXAMPLES:866sage: G = MathieuGroup(12); G867Mathieu group of degree 12 and order 95040 as a permutation group868"""869return "Mathieu group of degree %s and order %s as a permutation group"%(self._n,self.order())870871class TransitiveGroup(PermutationGroup_unique):872def __init__(self, d, n):873"""874The transitive group from the GAP tables of transitive groups.875876INPUT:877d -- positive integer; the degree878n -- positive integer; the number879880OUTPUT:881the n-th transitive group of degree d882883EXAMPLES::884885sage: TransitiveGroup(0,1)886Transitive group number 1 of degree 0887sage: TransitiveGroup(1,1)888Transitive group number 1 of degree 1889sage: G = TransitiveGroup(5, 2); G # requires optional database_gap890Transitive group number 2 of degree 5891sage: G.gens() # requires optional database_gap892[(1,2,3,4,5), (1,4)(2,3)]893894sage: G.category() # requires optional database_gap895Category of finite permutation groups896897.. warning:: this follows GAP's naming convention of indexing898the transitive groups starting from ``1``::899900sage: TransitiveGroup(5,0)901Traceback (most recent call last):902...903assert n > 0904AssertionError905906.. warning:: only transitive groups of "small" degree are907available in GAP's database::908909sage: TransitiveGroup(31,1) # requires optional database_gap910Traceback (most recent call last):911...912NotImplementedError: Only the transitive groups of order less than 30 are available in GAP's database913914TESTS::915916sage: TestSuite(TransitiveGroup(0,1)).run()917sage: TestSuite(TransitiveGroup(1,1)).run()918sage: TestSuite(TransitiveGroup(5,2)).run()# requires optional database_gap919920sage: TransitiveGroup(1,5)921Traceback (most recent call last):922...923AssertionError: n should be in {1,..,1}924"""925d = ZZ(d)926n = ZZ(n)927assert d >= 0928assert n > 0929max_n = TransitiveGroups(d).cardinality()930assert n <= max_n, "n should be in {1,..,%s}"%max_n931gap_group = 'Group([()])' if d in [0,1] else 'TransitiveGroup(%s,%s)'%(d,n)932try:933PermutationGroup_generic.__init__(self, gap_group=gap_group)934except RuntimeError:935from sage.misc.misc import verbose936verbose("Warning: Computing with TransitiveGroups requires the optional database_gap package. Please install it.", level=0)937938self._d = d939self._n = n940self._domain = range(1, d+1)941942def _repr_(self):943"""944EXAMPLES:945sage: G = TransitiveGroup(1,1); G946Transitive group number 1 of degree 1947"""948return "Transitive group number %s of degree %s"%(self._n, self._d)949950def TransitiveGroups(d=None):951"""952INPUT:953954- ``d`` -- an integer (optional)955956Returns the set of all transitive groups of a given degree957``d``. If ``d`` is not specified, it returns the set of all958transitive groups.959960Warning: TransitiveGroups requires the optional GAP database961package. Please install it with ``sage -i database_gap``.962963EXAMPLES::964965sage: TransitiveGroups(3)966Transitive Groups of degree 3967sage: TransitiveGroups(7)968Transitive Groups of degree 7969sage: TransitiveGroups(8)970Transitive Groups of degree 8971972sage: TransitiveGroups()973Transitive Groups974975.. warning:: in practice, the database currently only contains976transitive groups up to degree 30::977978sage: TransitiveGroups(31).cardinality() # requires optional database_gap979Traceback (most recent call last):980...981NotImplementedError: Only the transitive groups of order less than 30 are available in GAP's database982983"""984if d == None:985return TransitiveGroupsAll()986else:987d == Integer(d)988assert d >= 0, "A transitive group acts on a non negative integer number of positions"989return TransitiveGroupsOfDegree(d)990991class TransitiveGroupsAll(DisjointUnionEnumeratedSets):992"""993The infinite set of all transitive groups.994995EXAMPLES::996997sage: L = TransitiveGroups(); L998Transitive Groups999sage: L.category()1000Category of infinite enumerated sets1001sage: L.cardinality()1002+Infinity10031004sage: p = L.__iter__() # requires optional database_gap1005sage: (p.next(), p.next(), p.next(), p.next(), p.next(), p.next(), p.next(), p.next()) # requires optional database_gap1006(Transitive group number 1 of degree 0, Transitive group number 1 of degree 1, Transitive group number 1 of degree 2, Transitive group number 1 of degree 3, Transitive group number 2 of degree 3, Transitive group number 1 of degree 4, Transitive group number 2 of degree 4, Transitive group number 3 of degree 4)10071008TESTS::10091010sage: TestSuite(TransitiveGroups()).run() # requires optional database_gap # long time1011"""1012def __init__(self):1013"""1014TESTS::10151016sage: S = TransitiveGroups() # requires optional database_gap1017sage: S.category() # requires optional database_gap1018Category of infinite enumerated sets1019"""1020DisjointUnionEnumeratedSets.__init__(self, Family(NonNegativeIntegers(), lambda i: TransitiveGroups(i)) )10211022def _repr_(self):1023"""1024TESTS::10251026sage: TransitiveGroups() # requires optional database_gap # indirect doctest1027Transitive Groups1028"""1029return "Transitive Groups"10301031def __contains__(self, G):1032r"""1033EXAMPLES::10341035sage: TransitiveGroup(5,2) in TransitiveGroups() # requires optional database_gap1036True1037sage: TransitiveGroup(6,5) in TransitiveGroups() # requires optional database_gap1038True1039sage: 1 in TransitiveGroups() # requires optional database_gap1040False1041"""1042return isinstance(G,TransitiveGroup)10431044def _an_element_(self):1045"""1046Returns an element of ``self``.10471048EXAMPLES::10491050sage: TransitiveGroups(5).an_element() # requires optional database_gap # indirect doctest1051Transitive group number 1 of degree 51052"""1053return TransitiveGroup(7,3)10541055class TransitiveGroupsOfDegree(UniqueRepresentation, Parent):1056"""1057The set of all transitive groups of a given (small) degree.10581059EXAMPLES::10601061sage: S = TransitiveGroups(4); S # requires optional database_gap1062Transitive Groups of degree 41063sage: list(S) # requires optional database_gap1064[Transitive group number 1 of degree 4, Transitive group number 2 of degree 4, Transitive group number 3 of degree 4, Transitive group number 4 of degree 4, Transitive group number 5 of degree 4]10651066sage: TransitiveGroups(5).an_element() # requires optional database_gap1067Transitive group number 1 of degree 510681069We write the cardinality of all transitive groups of degree 5::10701071sage: for G in TransitiveGroups(5): # requires optional database_gap1072... print G.cardinality()10735107410107520107660107712010781079TESTS::10801081sage: TestSuite(TransitiveGroups(3)).run() # requires optional database_gap108210831084"""1085def __init__(self, n):1086"""1087TESTS::10881089sage: S = TransitiveGroups(4) # requires optional database_gap1090sage: S.category() # requires optional database_gap1091Category of finite enumerated sets1092"""1093self._degree = n1094Parent.__init__(self, category = FiniteEnumeratedSets())10951096def _repr_(self):1097"""1098TESTS::10991100sage: TransitiveGroups(6) # requires optional database_gap1101Transitive Groups of degree 61102"""1103return "Transitive Groups of degree %s"%(self._degree)11041105def __contains__(self, G):1106r"""1107EXAMPLES::11081109sage: TransitiveGroup(6,5) in TransitiveGroups(4) # requires optional database_gap1110False1111sage: TransitiveGroup(4,3) in TransitiveGroups(4) # requires optional database_gap1112True1113sage: 1 in TransitiveGroups(4) # requires optional database_gap1114False1115"""1116if isinstance(G,TransitiveGroup):1117return G._d == self._degree1118else:1119False11201121def __getitem__(self, n):1122r"""1123INPUT:11241125- ``n`` -- a positive integer11261127Returns the `n`-th transitive group of a given degree.11281129EXAMPLES::11301131sage: TransitiveGroups(5)[3] # requires optional database_gap#1132Transitive group number 3 of degree 511331134.. warning:: this follows GAP's naming convention of indexing1135the transitive groups starting from ``1``::11361137sage: TransitiveGroups(5)[0]1138Traceback (most recent call last):1139...1140assert n > 01141AssertionError1142"""1143return TransitiveGroup(self._degree, n)11441145def __iter__(self):1146"""1147EXAMPLES::11481149sage: list(TransitiveGroups(5)) # indirect doctest # requires optional database_gap1150[Transitive group number 1 of degree 5, Transitive group number 2 of degree 5, Transitive group number 3 of degree 5, Transitive group number 4 of degree 5, Transitive group number 5 of degree 5]1151"""1152for n in xrange(1, self.cardinality() + 1):1153yield self[n]11541155_an_element_ = EnumeratedSets.ParentMethods._an_element_11561157@cached_method1158def cardinality(self):1159r"""1160Returns the cardinality of ``self``, that is the number of1161transitive groups of a given degree.11621163EXAMPLES::11641165sage: TransitiveGroups(0).cardinality() # requires optional database_gap116611167sage: TransitiveGroups(2).cardinality() # requires optional database_gap116811169sage: TransitiveGroups(7).cardinality() # requires optional database_gap117071171sage: TransitiveGroups(12).cardinality() # requires optional database_gap11723011173sage: [TransitiveGroups(i).cardinality() for i in range(11)] # requires optional database_gap1174[1, 1, 1, 2, 5, 5, 16, 7, 50, 34, 45]11751176.. warning::11771178The database_gap contains all transitive groups1179up to degree 30::11801181sage: TransitiveGroups(31).cardinality() # requires optional database_gap1182Traceback (most recent call last):1183...1184NotImplementedError: Only the transitive groups of order less than 30 are available in GAP's database11851186TESTS::11871188sage: type(TransitiveGroups(12).cardinality()) # requires optional database_gap1189<type 'sage.rings.integer.Integer'>1190sage: type(TransitiveGroups(0).cardinality())1191<type 'sage.rings.integer.Integer'>1192"""1193# gap.NrTransitiveGroups(0) fails, so Sage needs to handle this11941195# While we are at it, and since Sage also handles the1196# transitive group of degree 1, we may as well handle 11197if self._degree <= 1:1198return ZZ(1)1199else:1200try:1201return Integer(gap.NrTransitiveGroups(gap(self._degree)))1202except RuntimeError:1203from sage.misc.misc import verbose1204verbose("Warning: TransitiveGroups requires the GAP database package. Please install it with ``sage -i database_gap``.", level=0)1205except TypeError:1206raise NotImplementedError, "Only the transitive groups of order less than 30 are available in GAP's database"12071208class PermutationGroup_plg(PermutationGroup_unique):1209def base_ring(self):1210"""1211EXAMPLES:1212sage: G = PGL(2,3)1213sage: G.base_ring()1214Finite Field of size 312151216sage: G = PSL(2,3)1217sage: G.base_ring()1218Finite Field of size 31219"""1220return self._base_ring12211222def matrix_degree(self):1223"""1224EXAMPLES:1225sage: G = PSL(2,3)1226sage: G.matrix_degree()122721228"""1229return self._n12301231class PGL(PermutationGroup_plg):1232def __init__(self, n, q, name='a'):1233"""1234The projective general linear groups over GF(q).12351236INPUT:1237n -- positive integer; the degree1238q -- prime power; the size of the ground field1239name -- (default: 'a') variable name of indeterminate of finite field GF(q)12401241OUTPUT:1242PGL(n,q)12431244EXAMPLES:1245sage: G = PGL(2,3); G1246Permutation Group with generators [(3,4), (1,2,4)]1247sage: print G1248The projective general linear group of degree 2 over Finite Field of size 31249sage: G.base_ring()1250Finite Field of size 31251sage: G.order()12522412531254sage: G = PGL(2, 9, 'b'); G1255Permutation Group with generators [(3,10,9,8,4,7,6,5), (1,2,4)(5,6,8)(7,9,10)]1256sage: G.base_ring()1257Finite Field in b of size 3^212581259sage: G.category()1260Category of finite permutation groups1261sage: TestSuite(G).run()1262"""1263id = 'Group([()])' if n == 1 else 'PGL(%s,%s)'%(n,q)1264PermutationGroup_generic.__init__(self, gap_group=id)1265self._q = q1266self._base_ring = GF(q, name=name)1267self._n = n12681269def __str__(self):1270"""1271EXAMPLES:1272sage: G = PGL(2,3); G1273Permutation Group with generators [(3,4), (1,2,4)]1274sage: print G1275The projective general linear group of degree 2 over Finite Field of size 31276"""1277return "The projective general linear group of degree %s over %s"%(self._n, self.base_ring())12781279class PSL(PermutationGroup_plg):1280def __init__(self, n, q, name='a'):1281"""1282The projective special linear groups over GF(q).12831284INPUT:1285n -- positive integer; the degree1286q -- prime power; the size of the ground field1287name -- (default: 'a') variable name of indeterminate of finite field GF(q)12881289OUTPUT:1290PSL(n,q)12911292EXAMPLES:1293sage: G = PSL(2,3); G1294Permutation Group with generators [(2,3,4), (1,2)(3,4)]1295sage: G.order()1296121297sage: G.base_ring()1298Finite Field of size 31299sage: print G1300The projective special linear group of degree 2 over Finite Field of size 313011302We create two groups over nontrivial finite fields:1303sage: G = PSL(2, 4, 'b'); G1304Permutation Group with generators [(3,4,5), (1,2,3)]1305sage: G.base_ring()1306Finite Field in b of size 2^21307sage: G = PSL(2, 8); G1308Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)]1309sage: G.base_ring()1310Finite Field in a of size 2^313111312sage: G.category()1313Category of finite permutation groups1314sage: TestSuite(G).run()1315"""1316if n == 1:1317id = 'Group([()])'1318else:1319id = 'PSL(%s,%s)'%(n,q)1320PermutationGroup_generic.__init__(self, gap_group=id)1321self._q = q1322self._base_ring = GF(q, name=name)1323self._n = n132413251326def __str__(self):1327"""1328EXAMPLES:1329sage: G = PSL(2,3)1330sage: print G1331The projective special linear group of degree 2 over Finite Field of size 31332"""1333return "The projective special linear group of degree %s over %s"%(self._n, self.base_ring())13341335def ramification_module_decomposition_hurwitz_curve(self):1336"""1337Helps compute the decomposition of the ramification module1338for the Hurwitz curves X (over CC say) with automorphism group1339G = PSL(2,q), q a "Hurwitz prime" (ie, p is $\pm 1 \pmod 7$).1340Using this computation and Borne's formula helps determine the1341G-module structure of the RR spaces of equivariant1342divisors can be determined explicitly.13431344The output is a list of integer multiplicities: [m1,...,mn],1345where n is the number of conj classes of G=PSL(2,p) and mi is the1346multiplicity of pi_i in the ramification module of a1347Hurwitz curve with automorphism group G.1348Here IrrRepns(G) = [pi_1,...,pi_n] (in the order listed in the1349output of self.character_table()).13501351REFERENCE: David Joyner, Amy Ksir, Roger Vogeler,1352"Group representations on Riemann-Roch spaces of some1353Hurwitz curves," preprint, 2006.13541355EXAMPLES:1356sage: G = PSL(2,13)1357sage: G.ramification_module_decomposition_hurwitz_curve() #random1358[0, 7, 7, 12, 12, 12, 13, 15, 14]13591360This means, for example, that the trivial representation does not1361occur in the ramification module of a Hurwitz curve with automorphism1362group PSL(2,13), since the trivial representation is listed first1363and that entry has multiplicity 0. The "randomness" is due to the1364fact that GAP randomly orders the conjugacy classes of the same order1365in the list of all conjugacy classes. Similarly, there is some1366randomness to the ordering of the characters.13671368If you try to use this function on a group PSL(2,q) where q is1369not a (smallish) "Hurwitz prime", an error message will be printed.1370"""1371if self.matrix_degree()!=2:1372raise ValueError("Degree must be 2.")1373F = self.base_ring()1374q = F.order()1375from sage.misc.misc import SAGE_EXTCODE1376gapcode = SAGE_EXTCODE + '/gap/joyner/hurwitz_crv_rr_sp.gap'1377gap.eval('Read("'+gapcode+'")')1378mults = gap.eval("ram_module_hurwitz("+str(q)+")")1379return eval(mults)13801381def ramification_module_decomposition_modular_curve(self):1382"""1383Helps compute the decomposition of the ramification module1384for the modular curve X(p) (over CC say) with automorphism group G = PSL(2,q),1385q a prime > 5. Using this computation and Borne's formula helps determine the1386G-module structure of the RR spaces of equivariant1387divisors can be determined explicitly.13881389The output is a list of integer multiplicities: [m1,...,mn],1390where n is the number of conj classes of G=PSL(2,p) and mi is the1391multiplicity of pi_i in the ramification module of a1392modular curve with automorphism group G.1393Here IrrRepns(G) = [pi_1,...,pi_n] (in the order listed in the1394output of self.character_table()).13951396REFERENCE: D. Joyner and A. Ksir, 'Modular representations1397on some Riemann-Roch spaces of modular curves1398$X(N)$', Computational Aspects of Algebraic Curves,1399(Editor: T. Shaska) Lecture Notes in Computing, WorldScientific,14002005.)14011402EXAMPLES:1403sage: G = PSL(2,7)1404sage: G.ramification_module_decomposition_modular_curve() ## random1405[0, 4, 3, 6, 7, 8]14061407This means, for example, that the trivial representation does not1408occur in the ramification module of X(7), since the trivial representation1409is listed first and that entry has multiplicity 0. The "randomness" is due to the1410fact that GAP randomly orders the conjugacy classes of the same order1411in the list of all conjugacy classes. Similarly, there is some1412randomness to the ordering of the characters.1413"""1414if self.matrix_degree()!=2:1415raise ValueError("Degree must be 2.")1416F = self.base_ring()1417q = F.order()1418from sage.misc.misc import SAGE_EXTCODE1419gapcode = SAGE_EXTCODE + '/gap/joyner/modular_crv_rr_sp.gap'1420gap.eval('Read("'+gapcode+'")')1421mults = gap.eval("ram_module_X("+str(q)+")")1422return eval(mults)14231424class PSp(PermutationGroup_plg):1425def __init__(self, n, q, name='a'):1426"""1427The projective symplectic linear groups over GF(q).14281429INPUT:1430n -- positive integer; the degree1431q -- prime power; the size of the ground field1432name -- (default: 'a') variable name of indeterminate of finite field GF(q)14331434OUTPUT:1435PSp(n,q)14361437EXAMPLES:1438sage: G = PSp(2,3); G1439Permutation Group with generators [(2,3,4), (1,2)(3,4)]1440sage: G.order()1441121442sage: G = PSp(4,3); G1443Permutation Group with generators [(3,4)(6,7)(9,10)(12,13)(17,20)(18,21)(19,22)(23,32)(24,33)(25,34)(26,38)(27,39)(28,40)(29,35)(30,36)(31,37), (1,5,14,17,27,22,19,36,3)(2,6,32)(4,7,23,20,37,13,16,26,40)(8,24,29,30,39,10,33,11,34)(9,15,35)(12,25,38)(21,28,31)]1444sage: G.order()1445259201446sage: print G1447The projective symplectic linear group of degree 4 over Finite Field of size 31448sage: G.base_ring()1449Finite Field of size 314501451sage: G = PSp(2, 8, name='alpha'); G1452Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)]1453sage: G.base_ring()1454Finite Field in alpha of size 2^31455"""1456if n%2 == 1:1457raise TypeError, "The degree n must be even"1458else:1459id = 'PSp(%s,%s)'%(n,q)1460PermutationGroup_generic.__init__(self, gap_group=id)1461self._q = q1462self._base_ring = GF(q, name=name)1463self._n = n14641465def __str__(self):1466"""1467EXAMPLES:1468sage: G = PSp(4,3)1469sage: print G1470The projective symplectic linear group of degree 4 over Finite Field of size 31471"""1472return "The projective symplectic linear group of degree %s over %s"%(self._n, self.base_ring())14731474PSP = PSp14751476class PermutationGroup_pug(PermutationGroup_plg):1477def field_of_definition(self):1478"""1479EXAMPLES:1480sage: PSU(2,3).field_of_definition()1481Finite Field in a of size 3^21482"""1483return self._field_of_definition14841485class PSU(PermutationGroup_pug):1486def __init__(self, n, q, name='a'):1487"""1488The projective special unitary groups over GF(q).14891490INPUT:1491n -- positive integer; the degree1492q -- prime power; the size of the ground field1493name -- (default: 'a') variable name of indeterminate of finite field GF(q)1494OUTPUT:1495PSU(n,q)14961497EXAMPLES:1498sage: PSU(2,3)1499The projective special unitary group of degree 2 over Finite Field of size 315001501sage: G = PSU(2, 8, name='alpha'); G1502The projective special unitary group of degree 2 over Finite Field in alpha of size 2^31503sage: G.base_ring()1504Finite Field in alpha of size 2^31505"""1506id = 'PSU(%s,%s)'%(n,q)1507PermutationGroup_generic.__init__(self, gap_group=id)1508self._q = q1509self._base_ring = GF(q, name=name)1510self._field_of_definition = GF(q**2, name)1511self._n = n15121513def _repr_(self):1514"""1515EXAMPLES:1516sage: PSU(2,3)1517The projective special unitary group of degree 2 over Finite Field of size 315181519"""1520return "The projective special unitary group of degree %s over %s"%(self._n, self.base_ring())15211522class PGU(PermutationGroup_pug):1523def __init__(self, n, q, name='a'):1524"""1525The projective general unitary groups over GF(q).15261527INPUT:1528n -- positive integer; the degree1529q -- prime power; the size of the ground field1530name -- (default: 'a') variable name of indeterminate of finite field GF(q)15311532OUTPUT:1533PGU(n,q)15341535EXAMPLES:1536sage: PGU(2,3)1537The projective general unitary group of degree 2 over Finite Field of size 315381539sage: G = PGU(2, 8, name='alpha'); G1540The projective general unitary group of degree 2 over Finite Field in alpha of size 2^31541sage: G.base_ring()1542Finite Field in alpha of size 2^31543"""1544id = 'PGU(%s,%s)'%(n,q)1545PermutationGroup_generic.__init__(self, gap_group=id)1546self._q = q1547self._base_ring = GF(q, name=name)1548self._field_of_definition = GF(q**2, name)1549self._n = n15501551def _repr_(self):1552"""1553EXAMPLES:1554sage: PGU(2,3)1555The projective general unitary group of degree 2 over Finite Field of size 315561557"""1558return "The projective general unitary group of degree %s over %s"%(self._n, self.base_ring())155915601561class SuzukiGroup(PermutationGroup_unique):1562def __init__(self, q, name='a'):1563r"""1564The Suzuki group over GF(q),1565$^2 B_2(2^{2k+1}) = Sz(2^{2k+1})$.15661567A wrapper for the GAP function SuzukiGroup.15681569INPUT:1570q -- 2^n, an odd power of 2; the size of the ground1571field. (Strictly speaking, n should be greater than 1, or1572else this group os not simple.)1573name -- (default: 'a') variable name of indeterminate of1574finite field GF(q)15751576OUTPUT:15771578- A Suzuki group.15791580EXAMPLES::15811582sage: SuzukiGroup(8)1583Permutation Group with generators [(1,2)(3,10)(4,42)(5,18)(6,50)(7,26)(8,58)(9,34)(12,28)(13,45)(14,44)(15,23)(16,31)(17,21)(19,39)(20,38)(22,25)(24,61)(27,60)(29,65)(30,55)(32,33)(35,52)(36,49)(37,59)(40,54)(41,62)(43,53)(46,48)(47,56)(51,63)(57,64), (1,28,10,44)(3,50,11,42)(4,43,53,64)(5,9,39,52)(6,36,63,13)(7,51,60,57)(8,33,37,16)(12,24,55,29)(14,30,48,47)(15,19,61,54)(17,59,22,62)(18,23,34,31)(20,38,49,25)(21,26,45,58)(27,32,41,65)(35,46,40,56)]1584sage: print SuzukiGroup(8)1585The Suzuki group over Finite Field in a of size 2^315861587sage: G = SuzukiGroup(32, name='alpha')1588sage: G.order()1589325376001590sage: G.order().factor()15912^10 * 5^2 * 31 * 411592sage: G.base_ring()1593Finite Field in alpha of size 2^515941595REFERENCES:15961597- http://en.wikipedia.org/wiki/Group_of_Lie_type\#Suzuki-Ree_groups1598"""1599q = Integer(q)1600from sage.rings.arith import valuation1601t = valuation(q, 2)1602if 2**t != q or is_even(t):1603raise ValueError,"The ground field size %s must be an odd power of 2."%q1604id = 'SuzukiGroup(IsPermGroup,%s)'%q1605PermutationGroup_generic.__init__(self, gap_group=id)1606self._q = q1607self._base_ring = GF(q, name=name)16081609def base_ring(self):1610"""1611EXAMPLES:1612sage: G = SuzukiGroup(32, name='alpha')1613sage: G.base_ring()1614Finite Field in alpha of size 2^516151616"""1617return self._base_ring16181619def __str__(self):1620"""1621EXAMPLES:1622sage: G = SuzukiGroup(32, name='alpha')1623sage: print G1624The Suzuki group over Finite Field in alpha of size 2^516251626"""1627return "The Suzuki group over %s"%self.base_ring()1628162916301631163216331634163516361637