GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
1[1X4 [33X[0;0YResidue-Class-Wise Affine Monoids[133X[101X23[33X[0;0YIn this short chapter, we describe how to compute with residue-class-wise4affine monoids. [13XResidue-class-wise affine[113X monoids, or [13Xrcwa[113X monoids for5short, are monoids whose elements are residue-class-wise affine mappings.[133X678[1X4.1 [33X[0;0YConstructing residue-class-wise affine monoids[133X[101X910[33X[0;0YAs any other monoids in [5XGAP[105X, residue-class-wise affine monoids can be11constructed by [10XMonoid[110X or [10XMonoidByGenerators[110X.[133X1213[4X[32X Example [32X[104X14[4X[28X[128X[104X15[4X[25Xgap>[125X [27XM := Monoid(RcwaMapping([[ 0,1,1],[1,1,1]]),[127X[104X16[4X[25X>[125X [27X RcwaMapping([[-1,3,1],[0,2,1]]));[127X[104X17[4X[28X<rcwa monoid over Z with 2 generators>[128X[104X18[4X[25Xgap>[125X [27XSize(M);[127X[104X19[4X[28X11[128X[104X20[4X[25Xgap>[125X [27XDisplay(MultiplicationTable(M));[127X[104X21[4X[28X[ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], [128X[104X22[4X[28X [ 2, 8, 5, 11, 8, 3, 10, 5, 2, 8, 5 ], [128X[104X23[4X[28X [ 3, 10, 11, 5, 5, 5, 8, 8, 8, 2, 3 ], [128X[104X24[4X[28X [ 4, 9, 6, 8, 8, 8, 5, 5, 5, 7, 4 ], [128X[104X25[4X[28X [ 5, 8, 5, 8, 8, 8, 5, 5, 5, 8, 5 ], [128X[104X26[4X[28X [ 6, 7, 4, 8, 8, 8, 5, 5, 5, 9, 6 ], [128X[104X27[4X[28X [ 7, 5, 8, 6, 5, 4, 9, 8, 7, 5, 8 ], [128X[104X28[4X[28X [ 8, 5, 8, 5, 5, 5, 8, 8, 8, 5, 8 ], [128X[104X29[4X[28X [ 9, 5, 8, 4, 5, 6, 7, 8, 9, 5, 8 ], [128X[104X30[4X[28X [ 10, 8, 5, 3, 8, 11, 2, 5, 10, 8, 5 ], [128X[104X31[4X[28X [ 11, 2, 3, 5, 5, 5, 8, 8, 8, 10, 11 ] ][128X[104X32[4X[28X[128X[104X33[4X[32X[104X3435[33X[0;0YThere are methods for the operations [10XView[110X, [10XDisplay[110X, [10XPrint[110X and [10XString[110X which36are applicable to rcwa monoids. All rcwa monoids over a ring [22XR[122X are37submonoids of Rcwa([22XR[122X). The monoid Rcwa([22XR[122X) itself is not finitely generated,38thus cannot be constructed as described above. It is handled as a special39case:[133X4041[1X4.1-1 Rcwa[101X4243[29X[2XRcwa[102X( [3XR[103X ) [32X function44[6XReturns:[106X [33X[0;10Ythe monoid Rcwa([3XR[103X) of all residue-class-wise affine mappings of45the ring [3XR[103X.[133X4647[4X[32X Example [32X[104X48[4X[28X[128X[104X49[4X[25Xgap>[125X [27XRcwaZ := Rcwa(Integers);[127X[104X50[4X[28XRcwa(Z)[128X[104X51[4X[25Xgap>[125X [27XIsSubset(RcwaZ,M);[127X[104X52[4X[28Xtrue[128X[104X53[4X[28X[128X[104X54[4X[32X[104X5556[33X[0;0YIn our methods to construct rcwa groups, two kinds of mappings played a57crucial role, namely the restriction monomorphisms (cf. [2XRestriction[102X ([14X3.1-6[114X))58and the induction epimorphisms (cf. [2XInduction[102X ([14X3.1-7[114X)). The restriction59monomorphisms extend in a natural way to the monoids Rcwa([22XR[122X), and the60induction epimorphisms have corresponding generalizations, also. Therefore61the operations [10XRestriction[110X and [10XInduction[110X can be applied to rcwa monoids as62well:[133X6364[4X[32X Example [32X[104X65[4X[28X[128X[104X66[4X[25Xgap>[125X [27XM2 := Restriction(M,2*One(Rcwa(Integers)));[127X[104X67[4X[28X<rcwa monoid over Z with 2 generators, of size 11>[128X[104X68[4X[25Xgap>[125X [27XSupport(M2);[127X[104X69[4X[28X0(2)[128X[104X70[4X[25Xgap>[125X [27XAction(M2,ResidueClass(1,2));[127X[104X71[4X[28XTrivial rcwa group over Z[128X[104X72[4X[25Xgap>[125X [27XInduction(M2,2*One(Rcwa(Integers))) = M;[127X[104X73[4X[28Xtrue[128X[104X74[4X[28X[128X[104X75[4X[32X[104X767778[1X4.2 [33X[0;0YComputing with residue-class-wise affine monoids[133X[101X7980[33X[0;0YThere is a method for [10XSize[110X which computes the order of an rcwa monoid.81Further there is a method for [10Xin[110X which checks whether a given rcwa mapping82lies in a given rcwa monoid (membership test), and there is a method for83[10XIsSubset[110X which checks for a submonoid relation.[133X8485[33X[0;0YThere are also methods for [10XSupport[110X, [10XModulus[110X, [10XIsTame[110X, [10XPrimeSet[110X, [10XIsIntegral[110X,86[10XIsClassWiseOrderPreserving[110X and [10XIsSignPreserving[110X available for rcwa monoids.[133X8788[33X[0;0YThe [13Xsupport[113X of an rcwa monoid is the union of the supports of its elements.89The [13Xmodulus[113X of an rcwa monoid is the lcm of the moduli of its elements in90case such an lcm exists and 0 otherwise. An rcwa monoid is called [13Xtame[113X if91its modulus is nonzero, and [13Xwild[113X otherwise. The [13Xprime set[113X of an rcwa monoid92is the union of the prime sets of its elements. An rcwa monoid is called93[13Xintegral[113X, [13Xclass-wise order-preserving[113X or [13Xsign-preserving[113X if all of its94elements are so.[133X9596[4X[32X Example [32X[104X97[4X[28X[128X[104X98[4X[25Xgap>[125X [27Xf1 := RcwaMapping([[-1, 1, 1],[ 0,-1, 1]]);;[127X[104X99[4X[25Xgap>[125X [27Xf2 := RcwaMapping([[ 1,-1, 1],[-1,-2, 1],[-1, 2, 1]]);; [127X[104X100[4X[25Xgap>[125X [27Xf3 := RcwaMapping([[ 1, 0, 1],[-1, 0, 1]]);; [127X[104X101[4X[25Xgap>[125X [27XN := Monoid(f1,f2,f3);;[127X[104X102[4X[25Xgap>[125X [27XSize(N);[127X[104X103[4X[28X366[128X[104X104[4X[25Xgap>[125X [27XList([Monoid(f1,f2),Monoid(f1,f3),Monoid(f2,f3)],Size);[127X[104X105[4X[28X[ 96, 6, 66 ][128X[104X106[4X[25Xgap>[125X [27Xf1*f2*f3 in N;[127X[104X107[4X[28Xtrue[128X[104X108[4X[25Xgap>[125X [27XIsSubset(N,M);[127X[104X109[4X[28Xfalse[128X[104X110[4X[25Xgap>[125X [27XIsSubset(N,Monoid(f1*f2,f3*f2));[127X[104X111[4X[28Xtrue[128X[104X112[4X[25Xgap>[125X [27XSupport(N);[127X[104X113[4X[28XIntegers[128X[104X114[4X[25Xgap>[125X [27XModulus(N);[127X[104X115[4X[28X6[128X[104X116[4X[25Xgap>[125X [27XIsTame(N) and IsIntegral(N);[127X[104X117[4X[28Xtrue[128X[104X118[4X[25Xgap>[125X [27XIsClassWiseOrderPreserving(N) or IsSignPreserving(N);[127X[104X119[4X[28Xfalse[128X[104X120[4X[25Xgap>[125X [27XCollected(List(AsList(N),Image)); # The images of the elements of N.[127X[104X121[4X[28X[ [ Integers, 2 ], [ 1(2), 2 ], [ Z \ 1(3), 32 ], [ 0(6), 44 ], [128X[104X122[4X[28X [ 0(6) U 1(6), 4 ], [ Z \ 4(6) U 5(6), 32 ], [ 0(6) U 2(6), 4 ], [128X[104X123[4X[28X [ 0(6) U 5(6), 4 ], [ 1(6), 44 ], [ 1(6) U [ -1 ], 2 ], [128X[104X124[4X[28X [ 1(6) U 3(6), 4 ], [ 1(6) U 5(6), 40 ], [ 2(6), 44 ], [128X[104X125[4X[28X [ 2(6) U 3(6), 4 ], [ 3(6), 44 ], [ 3(6) U 5(6), 4 ], [ 5(6), 44 ], [128X[104X126[4X[28X [ 5(6) U [ 1 ], 2 ], [ [ -5 ], 1 ], [ [ -4 ], 1 ], [ [ -3 ], 1 ], [128X[104X127[4X[28X [ [ -1 ], 1 ], [ [ 0 ], 1 ], [ [ 1 ], 1 ], [ [ 2 ], 1 ], [ [ 3 ], 1 ], [128X[104X128[4X[28X [ [ 5 ], 1 ], [ [ 6 ], 1 ] ][128X[104X129[4X[28X[128X[104X130[4X[32X[104X131132[33X[0;0YFinite forward orbits under the action of an rcwa monoid can be found by the133operation [10XShortOrbits[110X:[133X134135[1X4.2-1 ShortOrbits[101X136137[29X[2XShortOrbits[102X( [3XM[103X, [3XS[103X, [3Xmaxlng[103X ) [32X method138[6XReturns:[106X [33X[0;10Ya list of finite forward orbits of the rcwa monoid [3XM[103X of length at139most [3Xmaxlng[103X which start at points in the set [3XS[103X.[133X140141[4X[32X Example [32X[104X142[4X[28X[128X[104X143[4X[25Xgap>[125X [27XShortOrbits(M,[-5..5],20);[127X[104X144[4X[28X[ [ -5, -4, 1, 2, 7, 8 ], [ -3, -2, 1, 2, 5, 6 ], [ -1, 0, 1, 2, 3, 4 ] ][128X[104X145[4X[25Xgap>[125X [27XPrint(Action(M,last[1]),"\n");[127X[104X146[4X[28XMonoid( [ Transformation( [ 2, 3, 4, 3, 6, 3 ] ), [128X[104X147[4X[28X Transformation( [ 4, 5, 4, 3, 4, 1 ] ) ] )[128X[104X148[4X[25Xgap>[125X [27Xorbs := ShortOrbits(N,[0..10],100);[127X[104X149[4X[28X[ [ -5, -4, -3, -1, 0, 1, 2, 3, 5, 6 ], [128X[104X150[4X[28X [ -11, -10, -9, -7, -6, -5, -4, -3, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, [128X[104X151[4X[28X 11, 12 ], [128X[104X152[4X[28X [ -17, -16, -15, -13, -12, -11, -10, -9, -7, -6, -5, -4, -3, -1, 0, 1, [128X[104X153[4X[28X 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18 ] ][128X[104X154[4X[25Xgap>[125X [27Xquots := List(orbs,orb->Action(N,orb));;[127X[104X155[4X[25Xgap>[125X [27XList(quots,Size);[127X[104X156[4X[28X[ 268, 332, 366 ][128X[104X157[4X[28X[128X[104X158[4X[32X[104X159160[33X[0;0YBalls of given radius around an element of an rcwa monoid can be computed by161the operation [10XBall[110X. This operation can also be used for computing forward162orbits or subsets of such under the action of an rcwa monoid:[133X163164165[1X4.2-2 [33X[0;0YBall (for monoid, element and radius or monoid, point, radius and[101X166[1Xaction)[133X[101X167168[29X[2XBall[102X( [3XM[103X, [3Xf[103X, [3Xr[103X ) [32X method169[29X[2XBall[102X( [3XM[103X, [3Xp[103X, [3Xr[103X, [3Xaction[103X ) [32X method170[6XReturns:[106X [33X[0;10Ythe ball of radius [3Xr[103X around the element [3Xf[103X in the monoid [3XM[103X,171respectively the ball of radius [3Xr[103X around the point [3Xp[103X under the172action [3Xaction[103X of the monoid [3XM[103X.[133X173174[33X[0;0YAll balls are understood with respect to [10XGeneratorsOfMonoid([3XM[103X[10X)[110X. As175membership tests can be expensive, the first-mentioned method does not check176whether [3Xf[103X is indeed an element of [3XM[103X. The methods require that point- /177element comparisons are cheap. They are not only applicable to rcwa monoids.178If the option [3XSpheres[103X is set, the ball is split up and returned as a list of179spheres.[133X180181[4X[32X Example [32X[104X182[4X[28X[128X[104X183[4X[25Xgap>[125X [27XList([0..12],k->Length(Ball(N,One(N),k)));[127X[104X184[4X[28X[ 1, 4, 11, 26, 53, 99, 163, 228, 285, 329, 354, 364, 366 ][128X[104X185[4X[25Xgap>[125X [27XBall(N,[0..3],2,OnTuples);[127X[104X186[4X[28X[ [ -3, 3, 3, 3 ], [ -1, -3, 0, 2 ], [ -1, -1, -1, -1 ], [128X[104X187[4X[28X [ -1, -1, 1, -1 ], [ -1, 1, 1, 1 ], [ -1, 3, 0, -4 ], [ 0, -1, 2, -3 ], [128X[104X188[4X[28X [ 0, 1, 2, 3 ], [ 1, -1, -1, -1 ], [ 1, 3, 0, 2 ], [ 3, -4, -1, 0 ] ][128X[104X189[4X[25Xgap>[125X [27Xl := 2*IdentityRcwaMappingOfZ; r := l+1;[127X[104X190[4X[28XRcwa mapping of Z: n -> 2n[128X[104X191[4X[28XRcwa mapping of Z: n -> 2n + 1[128X[104X192[4X[25Xgap>[125X [27XBall(Monoid(l,r),1,4,OnPoints:Spheres);[127X[104X193[4X[28X[ [ 1 ], [ 2, 3 ], [ 4, 5, 6, 7 ], [ 8, 9, 10, 11, 12, 13, 14, 15 ], [128X[104X194[4X[28X [ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 ] ][128X[104X195[4X[28X[128X[104X196[4X[32X[104X197198199200