  
  [1X2 [33X[0;0YSubgroups of [22XSL_2(ℤ)[122X[101X[1X[133X[101X
  
  [33X[0;0YFor  representing finite-index subgroups of [22XSL_2(ℤ)[122X, this package introduces
  the   new   object   [10XModularSubgroup[110X.  As  stated  in  the  introduction,  a
  [10XModularSubgroup[110X  essentially  consists  of  the two permutations [22Xσ_S[122X and [22Xσ_T[122X
  describing  the coset graph with respect to the generators [22XS[122X and [22XT[122X (with the
  convention  that  [22X1[122X  corresponds  to  the  identity  coset).  So  explicitly
  specifying   these   permutations  is  the  canonical  way  to  construct  a
  [10XModularSubgroup[110X.[133X
  [33X[0;0YThough you might not always have a coset graph of your subgroup at hand, but
  rather  a  list  of  generating  matrices.  Therefore  we implement multiple
  constructors  for [10XModularSubgroup[110X: three that take as input two permutations
  describing  the coset graph with respect to different pairs of generators of
  [22XSL_2(ℤ)[122X, and one that takes a list of [22XSL_2(ℤ)[122X matrices as generators.[133X
  
  
  [1X2.1 [33X[0;0YConstruction of modular subgroups[133X[101X
  
  
  [1X2.1-1 [33X[0;0YModularSubgroup[133X[101X
  
  [33X[1;0Y[29X[2XModularSubgroupViaRightAction[102X( [3Xs[103X, [3Xt[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YConstructs  a  [10XModularSubgroup[110X  object  corresponding  to  the  finite-index
  subgroup of [22XSL_2(ℤ)[122X described by the permutations [3Xs[103X and [3Xt[103X.[133X
  [33X[0;0YThis constructor tests if the given permutations actually describe the coset
  action of the matrices[133X
  
                   [ 0 -1 ]            [ 1  1 ]
               S = [ 1  0 ],       T = [ 0  1 ]
  
  [33X[0;0Yby checking that they act transitively and satisfy the relations[133X
  
  
  [24X[33X[0;6Ys^4 = (s^3 t)^3 = s^2 t s^{-2} t^{-1} = 1[133X
  
  [124X
  
  [33X[0;0YUpon   creation,   the   cosets   are   renamed   in   a   standardized  way
  ([7Xhttps://www.gap-system.org/Manuals/doc/ref/chap47.html#X85B882F782D7AFD0[107X)
  to make the internal interaction with existing [5XGAP[105X methods easier. (The fact
  that [22X1[122X corresponds to the identity coset is not changed by this)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroupViaRightAction([127X[104X
    [4X[25X>[125X [27X(1,2)(3,4)(5,6)(7,8)(9,10),[127X[104X
    [4X[25X>[125X [27X(1,4)(2,5,9,10,8)(3,7,6));[127X[104X
    [4X[28X<modular subgroup of index 10>[128X[104X
  [4X[32X[104X
  
  [33X[1;0Y[29X[2XModularSubgroupViaLeftAction[102X( [3Xs[103X, [3Xt[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YAnalogous to [2XModularSubgroupViaRightAction[102X, but with left coset actions.[133X
  
  
  [1X2.1-2 [33X[0;0YModularSubgroupST[133X[101X
  
  [33X[1;0Y[29X[2XModularSubgroupSTViaRightAction[102X( [3Xs[103X, [3Xt[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YSynonymous for [2XModularSubgroupViaRightAction[102X ([14X2.1-1[114X) (see above).[133X
  
  [33X[1;0Y[29X[2XModularSubgroupSTViaLeftAction[102X( [3Xs[103X, [3Xt[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YSynonymous for [2XModularSubgroupViaLeftAction[102X ([14X2.1-1[114X) (see above).[133X
  
  
  [1X2.1-3 [33X[0;0YModularSubgroupRT[133X[101X
  
  [33X[1;0Y[29X[2XModularSubgroupRTViaRightAction[102X( [3Xr[103X, [3Xt[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YConstructs  a  [10XModularSubgroup[110X  object  corresponding  to  the  finite-index
  subgroup  of  [22XSL_2(ℤ)[122X  determined by the permutations [3Xr[103X and [3Xt[103X which describe
  the action of the matrices[133X
  
                       [ 1  0 ]           [ 1  1 ]
                   R = [ 1  1 ]       T = [ 0  1 ]
  
  [33X[0;0Yon the right cosets.[133X
  [33X[0;0YA check is performed if the permutations actually describe such an action on
  the cosets of some subgroup.[133X
  [33X[0;0YUpon   creation,   the   cosets   are   renamed   in   a   standardized  way
  ([7Xhttps://www.gap-system.org/Manuals/doc/ref/chap47.html#X85B882F782D7AFD0[107X)
  to make the internal interaction with existing [5XGAP[105X methods easier. (The fact
  that [22X1[122X corresponds to the identity coset is not changed by this)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroupRTViaRightAction([127X[104X
    [4X[25X>[125X [27X(1,9,8,10,7)(2,6)(3,4,5),[127X[104X
    [4X[25X>[125X [27X(1,3)(2,4,8,10,5)(6,9,7));[127X[104X
    [4X[28X<modular subgroup of index 10>[128X[104X
  [4X[32X[104X
  
  [33X[1;0Y[29X[2XModularSubgroupRTViaLeftAction[102X( [3Xr[103X, [3Xt[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YAnalogous to [2XModularSubgroupRTViaRightAction[102X, but with left coset actions.[133X
  
  
  [1X2.1-4 [33X[0;0YModularSubgroupSJ[133X[101X
  
  [33X[1;0Y[29X[2XModularSubgroupSJViaRightAction[102X( [3Xs[103X, [3Xj[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YConstructs  a  [10XModularSubgroup[110X  object  corresponding  to  the  finite-index
  subgroup  of  [22XSL_2(ℤ)[122X  determined by the permutations [3Xs[103X and [3Xj[103X which describe
  the action of the matrices[133X
  
                       [ 0 -1 ]           [  0  1 ]
                   S = [ 1  0 ]       J = [ -1  1 ]
      
  
  [33X[0;0Yon the right cosets.[133X
  [33X[0;0YA check is performed if the permutations actually describe such an action on
  the cosets of some subgroup.[133X
  [33X[0;0YUpon   creation,   the   cosets   are   renamed   in   a   standardized  way
  ([7Xhttps://www.gap-system.org/Manuals/doc/ref/chap47.html#X85B882F782D7AFD0[107X)
  to make the internal interaction with existing [5XGAP[105X methods easier. (The fact
  that [22X1[122X corresponds to the identity coset is not changed by this)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroupSJViaRightAction([127X[104X
    [4X[25X>[125X [27X(1,2)(3,6)(4,7)(5,9)(8,10),[127X[104X
    [4X[25X>[125X [27X(1,5,6)(2,3,7)(4,9,10));[127X[104X
    [4X[28X<modular subgroup of index 10>[128X[104X
  [4X[32X[104X
  
  [33X[1;0Y[29X[2XModularSubgrouSJViaLeftAction[102X( [3Xs[103X, [3Xj[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YAnalogous to [2XModularSubgroupSJViaRightAction[102X, but with left coset actions.[133X
  
  [1X2.1-5 ModularSubgroup[101X
  
  [33X[1;0Y[29X[2XModularSubgroup[102X( [3Xgens[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YConstructs  a  [10XModularSubgroup[110X  object  corresponding  to  the  finite-index
  subgroup of [22XSL_2(ℤ)[122X generated by the matrices in [3Xgens[103X.[133X
  [33X[0;0YNo  test is performed to check if the generated subgroup actually has finite
  index![133X
  [33X[0;0YThis constructor implicitly computes a coset table of the subgroup. Hence it
  might be slow for very large index subgroups.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2], [0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0], [2,1]],[127X[104X
    [4X[25X>[125X [27X[[-1,0], [0,-1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 6>[128X[104X
  [4X[32X[104X
  
  
  [1X2.2 [33X[0;0YGetters for the coset action[133X[101X
  
  
  [1X2.2-1 [33X[0;0YSAction[133X[101X
  
  [33X[1;0Y[29X[2XSRightAction[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YReturns  the  permutation  [22Xσ_S[122X  describing the action of the matrix [22XS[122X on the
  right cosets of [3XG[103X.[133X
  
  [33X[1;0Y[29X[2XSLeftAction[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YAnalogous to [2XSRightAction[102X, but with left coset actions.[133X
  
  
  [1X2.2-2 [33X[0;0YTAction[133X[101X
  
  [33X[1;0Y[29X[2XTRightAction[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YReturns  the  permutation  [22Xσ_T[122X  describing the action of the matrix [22XT[122X on the
  right cosets of [3XG[103X.[133X
  
  [33X[1;0Y[29X[2XTLeftAction[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YAnalogous to [2XTRightAction[102X, but with left coset actions.[133X
  
  
  [1X2.2-3 [33X[0;0YRAction[133X[101X
  
  [33X[1;0Y[29X[2XRRightAction[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YReturns  the  permutation  [22Xσ_R[122X  describing the action of the matrix [22XR[122X on the
  right cosets of [3XG[103X.[133X
  
  [33X[1;0Y[29X[2XRLeftAction[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YAnalogous to [2XRRightAction[102X, but with left coset actions.[133X
  
  
  [1X2.2-4 [33X[0;0YJAction[133X[101X
  
  [33X[1;0Y[29X[2XJRightAction[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YReturns  the  permutation  [22Xσ_J[122X  describing the action of the matrix [22XJ[122X on the
  right cosets of [3XG[103X.[133X
  
  [33X[1;0Y[29X[2XJLeftAction[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YAnalogous to [2XJRightAction[102X, but with left coset actions.[133X
  
  
  [1X2.2-5 [33X[0;0YCosetActionOf[133X[101X
  
  [33X[1;0Y[29X[2XCosetRightActionOf[102X( [3XA[103X, [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YReturns  the permutation [22Xσ_A[122X describing the action of the matrix [22XA ∈ SL_2(ℤ)[122X
  on the right cosets of [3XG[103X.[133X
  
  [33X[1;0Y[29X[2XCosetLeftActionOf[102X( [3XA[103X, [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA permutation.[133X
  
  [33X[0;0YAnalogous to [2XCosetRightActionOf[102X, but with left coset actions.[133X
  
  
  [1X2.3 [33X[0;0YComputing with modular subgroups[133X[101X
  
  [1X2.3-1 Index[101X
  
  [33X[1;0Y[29X[2XIndex[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA natural number.[133X
  
  [33X[0;0YFor  a given modular subgroup [3XG[103X this method returns its index in [22XSL_2(ℤ)[122X. As
  [3XG[103X    is   internally   stored   as   permutations   [22X(s,t)[122X   this   is   just
  [10XLargestMovedPoint([s,t])[110X (or [22X1[122X if the permutations are trivial).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup((1,2)(3,5)(4,6), (1,3)(2,4)(5,6));[127X[104X
    [4X[28X<modular subgroup of index 6>[128X[104X
    [4X[25Xgap>[125X [27XIndex(G);[127X[104X
    [4X[28X6[128X[104X
  [4X[32X[104X
  
  [1X2.3-2 GeneralizedLevel[101X
  
  [33X[1;0Y[29X[2XGeneralizedLevel[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA natural number.[133X
  
  [33X[0;0YThis  method  calculates the general Wohlfahrt level (i.e. the lowest common
  multiple of all cusp widths) of [3XG[103X as defined in [Woh64].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup((1,2)(3,5)(4,6), (1,3)(2,4)(5,6));[127X[104X
    [4X[28X<modular subgroup of index 6>[128X[104X
    [4X[25Xgap>[125X [27XGeneralizedLevel(G);[127X[104X
    [4X[28X2[128X[104X
  [4X[32X[104X
  
  
  [1X2.3-3 [33X[0;0YCosetRepresentatives[133X[101X
  
  [33X[1;0Y[29X[2XRightCosetRepresentatives[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of words.[133X
  
  [33X[0;0YThis  function  returns a list of representatives of the (right) cosets of [3XG[103X
  as words in [22XS[122X and [22XT[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup((1,2),(2,3));[127X[104X
    [4X[28X<modular subgroup of index 3>[128X[104X
    [4X[25Xgap>[125X [27XRightCosetRepresentatives(G);[127X[104X
    [4X[28X[ <identity ...>, S, S*T ][128X[104X
  [4X[32X[104X
  
  [33X[1;0Y[29X[2XLeftCosetRepresentatives[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of words.[133X
  
  [33X[0;0YThis function returns a list of representatives of the (left) cosets of [3XG[103X as
  words in [22XS[122X and [22XT[122X.[133X
  
  [1X2.3-4 WordGeneratorsOfGroup[101X
  
  [33X[1;0Y[29X[2XWordGeneratorsOfGroup[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of words.[133X
  
  [33X[0;0YCalculates  a list of generators (as words in [22XS[122X and [22XT[122X) of [3XG[103X. This list might
  include redundant generators (or even duplicates).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup((1,2)(3,5)(4,6), (1,3)(2,4)(5,6));[127X[104X
    [4X[28X<modular subgroup of index 6>[128X[104X
    [4X[25Xgap>[125X [27XWordGeneratorsOfGroup(G);[127X[104X
    [4X[28X[ S^-2, T^-2, S*T^-2*S^-1 ][128X[104X
  [4X[32X[104X
  
  [1X2.3-5 GeneratorsOfGroup[101X
  
  [33X[1;0Y[29X[2XGeneratorsOfGroup[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of matrices.[133X
  
  [33X[0;0YCalculates  a  list  of  generator  matrices  of  [3XG[103X. This list might include
  redundant generators (or even duplicates).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup((1,2)(3,5)(4,6), (1,3)(2,4)(5,6));[127X[104X
    [4X[28X<modular subgroup of index 6>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfGroup(G);[127X[104X
    [4X[28X[ [ [ -1, 0 ], [ 0, -1 ] ], [ [ 1, -2 ], [ 0, 1 ] ], [ [ 1, 0 ], [ 2, 1 ] ] ][128X[104X
  [4X[32X[104X
  
  [1X2.3-6 IsCongruence[101X
  
  [33X[1;0Y[29X[2XIsCongruence[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YThis  method  test  whether  a  given  modular  subgroup  [3XG[103X  is a congruence
  subgroup.  It  is essentially an implementation of an algorithm described in
  [HL14].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XIsCongruence(G);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.3-7 Cusps[101X
  
  [33X[1;0Y[29X[2XCusps[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of rational numbers and infinity.[133X
  
  [33X[0;0YThis  method  computes  a  list  of  inequivalent  cusp representatives with
  respect to [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([127X[104X
    [4X[25X>[125X [27X(1,2)(3,6)(4,8)(5,9)(7,11)(10,13)(12,15)(14,17)(16,19)(18,21)(20,23)(22,24),[127X[104X
    [4X[25X>[125X [27X(1,3,7,4)(2,5)(6,9,8,12,14,10)(11,13,16,20,18,15)(17,21,22,19)(23,24)[127X[104X
    [4X[25X>[125X [27X);[127X[104X
    [4X[28X<modular subgroup of index 24>[128X[104X
    [4X[25Xgap>[125X [27XCusps(G);[127X[104X
    [4X[28X[ infinity, 0, 1, 2, 3/2, 5/3 ][128X[104X
  [4X[32X[104X
  
  [1X2.3-8 CuspWidth[101X
  
  [33X[1;0Y[29X[2XCuspWidth[102X( [3Xc[103X, [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA natural number.[133X
  
  [33X[0;0YThis  method  takes  as input a cusp [3Xc[103X (a rational number or infinity) and a
  modular group [3XG[103X and calculates the width of this cusp with respect to [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([127X[104X
    [4X[25X>[125X [27X(1,2,6,3)(4,11,15,12)(5,13,16,14)(7,17,9,18)(8,19,10,20)(21,24,22,23),[127X[104X
    [4X[25X>[125X [27X(1,4,5)(2,7,8)(3,9,10)(6,15,16)(11,20,21)(12,19,22)(13,23,17)(14,24,18)[127X[104X
    [4X[25X>[125X [27X);[127X[104X
    [4X[28X<modular subgroup of index 24>[128X[104X
    [4X[25Xgap>[125X [27XCuspWidth(-1, G);[127X[104X
    [4X[28X3[128X[104X
    [4X[25Xgap>[125X [27XCuspWidth(infinity, G);[127X[104X
    [4X[28X3[128X[104X
  [4X[32X[104X
  
  [1X2.3-9 CuspsEquivalent[101X
  
  [33X[1;0Y[29X[2XCuspsEquivalent[102X( [3Xp[103X, [3Xq[103X, [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YTakes  two  cusps  [3Xp[103X  and  [3Xq[103X and a modular subgroup [3XG[103X and checks if they are
  equivalent modulo [3XG[103X, i.e. if there exists a matrix [22XA ∈ G[122X with [22XAp = q[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([127X[104X
    [4X[25X>[125X [27X(1,2,6,3)(4,11,15,12)(5,13,16,14)(7,17,9,18)(8,19,10,20)(21,24,22,23),[127X[104X
    [4X[25X>[125X [27X(1,4,5)(2,7,8)(3,9,10)(6,15,16)(11,20,21)(12,19,22)(13,23,17)(14,24,18)[127X[104X
    [4X[25X>[125X [27X);[127X[104X
    [4X[28X<modular subgroup of index 24>[128X[104X
    [4X[25Xgap>[125X [27XCuspsEquivalent(infinity, 1, G);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XCuspsEquivalent(-1, 1/2, G);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.3-10 CosetRepresentativeOfCusp[101X
  
  [33X[1;0Y[29X[2XCosetRepresentativeOfCusp[102X( [3Xc[103X, [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA word in S and T.[133X
  
  [33X[0;0YFor  a cusp [3Xc[103X this function returns a right coset representative [22XA[122X of [3XG[103X such
  that [22XA ∞[122X and [3Xc[103X are equivalent with respect to [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([127X[104X
    [4X[25X>[125X [27X(1,2,6,3)(4,11,15,12)(5,13,16,14)(7,17,9,18)(8,19,10,20)(21,24,22,23),[127X[104X
    [4X[25X>[125X [27X(1,4,5)(2,7,8)(3,9,10)(6,15,16)(11,20,21)(12,19,22)(13,23,17)(14,24,18)[127X[104X
    [4X[25X>[125X [27X);[127X[104X
    [4X[28X<modular subgroup of index 24>[128X[104X
    [4X[25Xgap>[125X [27XCosetRepresentativeOfCusp(4, G);[127X[104X
    [4X[28XT*S[128X[104X
  [4X[32X[104X
  
  [1X2.3-11 IndexModN[101X
  
  [33X[1;0Y[29X[2XIndexModN[102X( [3XG[103X, [3XN[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA natural number.[133X
  
  [33X[0;0YFor  a  modular subgroup [3XG[103X and a natural number [3XN[103X this method calculates the
  index of the projection [22XbarG[122X of [22XG[122X in [22XSL_2(ℤ/Nℤ)[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup((1,2)(3,5)(4,6), (1,3)(2,4)(5,6));[127X[104X
    [4X[28X<modular subgroup of index 6>[128X[104X
    [4X[25Xgap>[125X [27XIndexModN(G, 2);[127X[104X
    [4X[28X6[128X[104X
  [4X[32X[104X
  
  [1X2.3-12 Deficiency[101X
  
  [33X[1;0Y[29X[2XDeficiency[102X( [3XG[103X, [3XN[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA natural number.[133X
  
  [33X[0;0YFor  a  modular subgroup [3XG[103X and a natural number [3XN[103X this method calculates the
  so-called [13Xdeficiency[113X of [3XG[103X from being a congruence subgroup of level [3XN[103X.[133X
  [33X[0;0YThe  deficiency  of  a  finite-index subgroup [22XΓ[122X of [22XSL_2(ℤ)[122X was introduced in
  [Wei15].  It  is  defined  as  the index [22X[Γ(N) : Γ(N) ∩ Γ][122X where [22XΓ(N)[122X is the
  principal congruence subgroup of level [22XN[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XDeficiency(G, 2);[127X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XDeficiency(G, 4);[127X[104X
    [4X[28X1[128X[104X
  [4X[32X[104X
  
  [1X2.3-13 Deficiency[101X
  
  [33X[1;0Y[29X[2XDeficiency[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA natural number.[133X
  
  [33X[0;0YShorthand for [10XDeficiency(G, GeneralizedLevel(G))[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XDeficiency(G);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XDeficiency(G, GeneralizedLevel(G));[127X[104X
    [4X[28X1[128X[104X
  [4X[32X[104X
  
  [1X2.3-14 Projectivization[101X
  
  [33X[1;0Y[29X[2XProjectivization[102X( [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA projective modular subgroup.[133X
  
  [33X[0;0YFor a given modular subgroup [3XG[103X this function calculates its image [22Xbar[3XG[103X[122X under
  the projection [22Xπ : SL_2(ℤ) → PSL_2(ℤ)[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XProjectivization(G);[127X[104X
    [4X[28X<projective modular subgroup of index 6>[128X[104X
  [4X[32X[104X
  
  [1X2.3-15 ConjugateGroup[101X
  
  [33X[1;0Y[29X[2XConjugateGroup[102X( [3XG[103X, [3XA[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA ModularSubgroup.[133X
  
  [33X[0;0YConjugates  the  group  [3XG[103X  by  the  [22XSL_2(ℤ)[122X  matrix  [3XA[103X and returns the group
  [22XA^-1*G*A[122X.[133X
  
  [1X2.3-16 NormalCore[101X
  
  [33X[1;0Y[29X[2XNormalCore[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA modular subgroup.[133X
  
  [33X[0;0YCalculates  the  normal core of [3XG[103X in [22XSL_2(ℤ)[122X, i.e. the maximal subgroup of [3XG[103X
  that is normal in [22XSL_2(ℤ)[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XNormalCore(G);[127X[104X
    [4X[28X<modular subgroup of index 48>[128X[104X
  [4X[32X[104X
  
  [1X2.3-17 QuotientByNormalCore[101X
  
  [33X[1;0Y[29X[2XQuotientByNormalCore[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA finite group.[133X
  
  [33X[0;0YCalculates the quotient of [22XSL_2(ℤ)[122X by the normal core of [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XQuotientByNormalCore(G);[127X[104X
    [4X[28X<permutation group with 2 generators>[128X[104X
  [4X[32X[104X
  
  [1X2.3-18 AssociatedCharacterTable[101X
  
  [33X[1;0Y[29X[2XAssociatedCharacterTable[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA character table.[133X
  
  [33X[0;0YReturns the character table of [22XSL_2(ℤ)/N[122X where [22XN[122X is the normal core of [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XAssociatedCharacterTable(G);[127X[104X
    [4X[28XCharacterTable( <permutation group of size 48 with 2 generators> )[128X[104X
  [4X[32X[104X
  
  [1X2.3-19 IsElementOf[101X
  
  [33X[1;0Y[29X[2XIsElementOf[102X( [3XA[103X, [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YThis  function  checks  if  a  given  matrix  [3XA[103X is an element of the modular
  subgroup [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XIsElementOf([[-1,0],[0,-1]], G);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsElementOf([[1,4],[0,1]], G);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.3-20 IsWordElementOf[101X
  
  [33X[1;0Y[29X[2XIsWordElementOf[102X( [3Xs[103X, [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YThis  function  checks  if  a  given  string  [3Xs[103X represents an element of the
  modular subgroup [3XG[103X, written in the generators [3XS[103X and [3XT[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XIsWordElementOf("S^4 * T^2", G);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.3-21 IsWordElementOf[101X
  
  [33X[1;0Y[29X[2XIsWordElementOf[102X( [3Xw[103X, [3XG[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YThis  function checks if a given word [3Xw[103X in the generators [3XS[103X and [3XT[103X represents
  an element of the modular subgroup [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X<modular subgroup of index 12>[128X[104X
    [4X[25Xgap>[125X [27XF := FreeGroup("S", "T");[127X[104X
    [4X[28X<free group on the generators [ S, T ]>[128X[104X
    [4X[25Xgap>[125X [27XS := F.1;[127X[104X
    [4X[28XS[128X[104X
    [4X[25Xgap>[125X [27XT := F.2;[127X[104X
    [4X[28XT[128X[104X
    [4X[25Xgap>[125X [27XSL2Z := F / ParseRelators([S, T], "S^4, (S^3*T)^3, S^2*T*S^-2*T^-1");[127X[104X
    [4X[28X<fp group on the generators [ S, T ]>[128X[104X
    [4X[25Xgap>[125X [27XS := GeneratorsOfGroup(SL2Z)[1];[127X[104X
    [4X[28XS[128X[104X
    [4X[25Xgap>[125X [27XT := GeneratorsOfGroup(SL2Z)[2];[127X[104X
    [4X[28XT[128X[104X
    [4X[25Xgap>[125X [27XIsWordElementOf(S^4 * T^2, G);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.3-22 Genus[101X
  
  [33X[1;0Y[29X[2XGenus[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA non-negative integer.[133X
  
  [33X[0;0YComputes  the  genus  of  the  quotient  [22XG ∖ ℍ[122X via an algorithm described in
  [Sch04].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := ModularSubgroup((1,2),(2,3));[127X[104X
    [4X[28X<modular subgroup of index 3>[128X[104X
    [4X[25Xgap>[125X [27XGenus(G);[127X[104X
    [4X[28X0[128X[104X
  [4X[32X[104X
  
  
  [1X2.4 [33X[0;0YMiscellaneous[133X[101X
  
  [33X[0;0YThe  following functions are mostly helper functions used internally and are
  only documented for sake of completeness.[133X
  
  [1X2.4-1 DefinesCosetActionST[101X
  
  [33X[1;0Y[29X[2XDefinesCosetActionST[102X( [3Xs[103X, [3Xt[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YChecks  if  two  given  permutations  [3Xs[103X  and  [3Xt[103X  describe  the action of the
  generator  matrices [22XS[122X and [22XT[122X on the cosets of some subgroup. This is the case
  if they satisfy the relations[133X
  
  
  [24X[33X[0;6Ys^4 = (s^3 t)^3 = s^2 t s^{-2} t^{-1} = 1[133X
  
  [124X
  
  [33X[0;0Yand act transitively.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs := (1,2)(3,4)(5,6)(7,8)(9,10);;[127X[104X
    [4X[25Xgap>[125X [27Xt := (1,4)(2,5,9,10,8)(3,7,6);;[127X[104X
    [4X[25Xgap>[125X [27XDefinesCosetActionST(s,t);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.4-2 DefinesCosetActionRT[101X
  
  [33X[1;0Y[29X[2XDefinesCosetActionRT[102X( [3Xr[103X, [3Xt[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YChecks  if  two  given  permutations  [3Xr[103X  and  [3Xt[103X  describe  the action of the
  generator  matrices [22XR[122X and [22XT[122X on the cosets of some subgroup. This is the case
  if they satisfy the relations[133X
  
  
  [24X[33X[0;6Y(r  t^{-1}  r)^4 = ((r t^{-1} r)^3 t)^3 = (r t^{-1} r)^2 t (r t^{-1} r)^{-2}
  t^{-1} = 1[133X
  
  [124X
  
  [33X[0;0Yand act transitively.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xr := (1,9,8,10,7)(2,6)(3,4,5);;[127X[104X
    [4X[25Xgap>[125X [27Xt := (1,3)(2,4,8,10,5)(6,9,7);;[127X[104X
    [4X[25Xgap>[125X [27XDefinesCosetActionRT(r,t);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X2.4-3 DefinesCosetActionSJ[101X
  
  [33X[1;0Y[29X[2XDefinesCosetActionSJ[102X( [3Xs[103X, [3Xj[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YChecks  if  two  given  permutations  [3Xs[103X  and  [3Xj[103X  describe  the action of the
  generator  matrices [22XS[122X and [22XJ[122X on the cosets of some subgroup. This is the case
  if they satisfy the relations[133X
  
  
  [24X[33X[0;6Ys^4 = (s^3 j^{-1} s^{-1})^3 = s^2 j^{-1} s^{-2} j = 1[133X
  
  [124X
  
  [33X[0;0Yand act transitively.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xs := (1,2)(3,4)(5,6)(7,8)(9,10);;[127X[104X
    [4X[25Xgap>[125X [27Xj := (1,5,6)(2,3,7)(4,9,10);;[127X[104X
    [4X[25Xgap>[125X [27XDefinesCosetActionSJ(s,j);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  
  [1X2.4-4 [33X[0;0YCosetActionFromGenerators[133X[101X
  
  [33X[1;0Y[29X[2XRightCosetActionFromGenerators[102X( [3Xgens[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA tuple of permutations.[133X
  
  [33X[0;0YTakes  a list of generator matrices and calculates the right coset graph (as
  two permutations [22Xσ_S[122X and [22Xσ_T[122X) of the generated subgroup of [22XSL_2(ℤ)[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XRightCosetActionFromGenerators([[127X[104X
    [4X[25X>[125X [27X[[1,2],[0,1]],[127X[104X
    [4X[25X>[125X [27X[[1,0],[2,1]][127X[104X
    [4X[25X>[125X [27X]);[127X[104X
    [4X[28X[ (1,2,5,3)(4,8,10,9)(6,11,7,12), (1,4)(2,6)(3,7)(5,10)(8,12,9,11) ][128X[104X
  [4X[32X[104X
  
  [33X[1;0Y[29X[2XLeftCosetActionFromGenerators[102X( [3Xgens[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA tuple of permutations.[133X
  
  [33X[0;0YAnalogous to [2XRightCosetActionFromGenerators[102X, but with left coset actions.[133X
  
  [1X2.4-5 STDecomposition[101X
  
  [33X[1;0Y[29X[2XSTDecomposition[102X( [3XA[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA word in [22XS[122X and [22XT[122X.[133X
  
  [33X[0;0YTakes  a  matrix  [22X[3XA[103X ∈ SL_2(ℤ)[122X and decomposes it into a word in the generator
  matrices [22XS[122X and [22XT[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM := [ [ 4, 3 ], [ -3, -2 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XSTDecomposition(M);[127X[104X
    [4X[28XS^2*T^-1*S^-1*T^2*S^-1*T^-1*S^-1[128X[104X
  [4X[32X[104X
  
  [1X2.4-6 RTDecomposition[101X
  
  [33X[1;0Y[29X[2XRTDecomposition[102X( [3XA[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA word in [22XR[122X and [22XT[122X.[133X
  
  [33X[0;0YTakes  a  matrix  [22X[3XA[103X ∈ SL_2(ℤ)[122X and decomposes it into a word in the generator
  matrices [22XR[122X and [22XT[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM := [ [ 4, 3 ], [ -3, -2 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XRTDecomposition(M);[127X[104X
    [4X[28X(R*T^-1*R)^2*T^-1*R^-1*(T*R^-1*T)^2*R^-1*T^-1*R^-1*T*R^-1[128X[104X
  [4X[32X[104X
  
  [1X2.4-7 SJDecomposition[101X
  
  [33X[1;0Y[29X[2XSJDecomposition[102X( [3XA[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA word in [22XS[122X and [22XJ[122X.[133X
  
  [33X[0;0YTakes  a  matrix  [22X[3XA[103X ∈ SL_2(ℤ)[122X and decomposes it into a word in the generator
  matrices [22XS[122X and [22XJ[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM := [ [ 4, 3 ], [ -3, -2 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XSJDecomposition(M);[127X[104X
    [4X[28XS^3*J*(S^-1*J^-1)^2*S^-1*J*S^-1[128X[104X
  [4X[32X[104X
  
  [1X2.4-8 STDecompositionAsList[101X
  
  [33X[1;0Y[29X[2XSTDecompositionAsList[102X( [3XA[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA list representing a word in [22XS[122X and [22XT[122X.[133X
  
  [33X[0;0YTakes  a  matrix  [22X[3XA[103X ∈ SL_2(ℤ)[122X and decomposes it into a word in the generator
  matrices  [22XS[122X  and  [22XT[122X.  The  word  is  represented  as  a  list  in the format
  [[generator, exponent], ... ][133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XM := [ [ 4, 3 ], [ -3, -2 ] ];;[127X[104X
    [4X[25Xgap>[125X [27XSTDecompositionAsList(M);[127X[104X
    [4X[28X[ [ "S", 2 ], [ "T", -1 ], [ "S", -1 ], [ "T", 2 ], [ "S", -1 ], [ "T", -1 ],[128X[104X
    [4X[28X  [ "S", -1 ], [ "T", 0 ] ][128X[104X
  [4X[32X[104X
  
