-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenvectors.mag
779 lines (539 loc) · 17.5 KB
/
genvectors.mag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
/* genvectors.mag
Last Updated: May 19, 2023
These functions are primarily Magma versions of GAP programs
written by Thomas Breuer.
Breuer, Thomas. Characters and automorphism groups of compact Riemann surfaces. London Mathematical Society Lecture Note Series, v. 280. Cambridge University Press, Cambridge, 2000.
The original GAP code has the following copyright:
Copyright (C) 1997, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany
We are grateful to Thomas Breuer for permission to post the Magma version of this code.
Functions:
ConvertToPerm(G)
CardinalityOfHom(C, g0, tbl, classlengths, ordG)
NonGenerationByScottCriterion(tbl, C, sizeconjclass, ordG)
WeakTestGeneration(C, g0, G : Con:=[], tbl:=[], sizeconjclass:=[], sizecenter:=0)
HardTestGeneration(C, g0, G : Con:=[])
RepresentativesEpimorphisms(signature, G : Con:=[], tbl:=[], orders:=[], sizecon:=[], sizecenter:=0)
Procedure:
AddMonodromy(g)
*/
Z:=Integers(); // Used for coersion below
SetColumns(0); // Better Printing
/* ***************************************
ConvertToPerm(G)
Inputs: G group
Outputs: a group of type GrpPerm in Magma
Based on Magma algorithm here:
https://magma.maths.usyd.edu.au/magma/handbook/text/752
************************************ */
ConvertToPerm:=function(G);
if Type(G) eq GrpPC then
SL := Subgroups(G);
T := {X`subgroup: X in SL};
TrivCore := {H:H in T| #Core(G,H) eq 1};
mdeg := Min({Index(G,H):H in TrivCore});
Good := {H: H in TrivCore| Index(G,H) eq mdeg};
H := Rep(Good);
f,G,K := CosetAction(G,H);
end if;
return G;
end function;
/* ***************************************
CardinalityOfHom( C, g0, tbl, classlengths,ordG)
Inputs: C
g0 orbit genus
tbl character table of a group G
classlength list of size of each conj class
ordG order of a group G
Outputs: the cardinality of Hom_C(g_0,G) computed using
a result of Jones (Section 14 of Breuer)
Used in WeakTestGeneration
************************************ */
CardinalityOfHom := function( C, g0, tbl ,classlength, ordG)
r:=#C;
M:=[];
for i in [ 1 .. r ] do
if C[i] in Z then
M[i]:= [C[i]];
else
M[i]:=C[i];
end if;
end for;
C:=M;
exp:= 2 - 2*g0 - r;
sum:=0;
for i in [1..#tbl] do
chi:=tbl[i];
product:=1;
for Ci in C do
temp:=0;
for j in [1..#Ci] do
temp:=temp+chi[Ci[j]]*classlength[Ci[j]];
end for;
product:=product*temp;
end for;
sum:=sum+(chi[1]^exp*product);
end for;
sum:=Rationals()!sum;
return ordG^( 2*g0 - 1 )* sum;
end function;
/* ***************************************
NonGenerationByScottCriterion(tbl, C, G, Con)
Tests the Nongeneration Criterion of Scott
(Section 15.3 in Breuer)
Input: Character Table of a group
C list of
sizeconjclass
ordG The order of the group G
Output: true if the nongeneration criterion of Scott
confirms that there is no epimorphism
false otherwise
Used in: WeakTestGeneration
************************************ */
NonGenerationByScottCriterion := function( tbl,C,G,Con)
for chi in tbl do
degree:= chi[1];
dim:= 2 * ( degree - InnerProduct( chi,tbl[1]));
for i in C do
xi:= Con[i,3];
S:=sub<G|xi>;
Ts:=CharacterTable(S);
dim:= dim - degree + InnerProduct(Restriction(chi,S) ,Ts[1]);
end for;
if 0 lt dim then
return true;
end if;
end for;
return false;
end function;
/* ***************************************
WeakTestGeneration(C, g0, G : Con:=[], tbl:=[], sizeconjclass:=[], sizecenter:=0)
Inputs: C the class structure of G
g0 the orbit genus
G a finite group
Con ConjugacyClasses(G) (optional)
tbl CharacterTable(G) (optional)
sizeconjclass list of orders of elements in each conjugacy class, based on order of Con
size center #Center(G) (optional)
Outputs: false if Epi_C(g,G) is empty based on
Nongeneration criterion of Scott or
conditions on the cardinality of Hom
(Section 15.1 of Breuer)
true otherwise
Used in RepresentativesEpimorphisms
************************************ */
WeakTestGeneration := function( C, g0, G : Con:=[], tbl:=[], sizeconjclass:=[], sizecenter:=0 )
if #tbl eq 0 then
tbl:= CharacterTable( G );
end if;
size:=#G;
if #Con eq 0 then
Con:=ConjugacyClasses(G);
end if;
if #sizeconjclass eq 0 then
for i in [1..#Con] do
Append(~sizeconjclass,Con[i][2]);
end for;
end if;
if sizecenter eq 0 then
sizecenter:=#Center(G);
end if;
if CardinalityOfHom(C, g0, tbl, sizeconjclass,size) lt size/sizecenter then
return false;
elif g0 eq 0 and NonGenerationByScottCriterion( tbl, C, G, Con ) then
return false;
end if;
return true;
end function;
/* ***************************************
HardTestGeneration(C, g0, G : Con:=[])
Inputs: C the class structure of G
g0 the orbit genus
G a finite group
Con CojugacyClasses(G) (optional)
Outputs: tup which is a list of elements of G
representing the monodromy
[id_G,id_G] otherwise
Used in RepresentativesEpimorphisms
************************************ */
HardTestGeneration := function( C, g0, G : Con:=[] )
r:=#C;
n:=#( G );
id:=Identity(G);
if #Con eq 0 then
Con:=ConjugacyClasses(G);
end if;
sigma:=[]; // list of representatives of conjugacy classes
for i in [1..r] do
Append(~sigma,Con[C[i]][3]);
end for;
rep_cen:=[]; // list of centralizers for each element of sigma
for s in sigma do
Append(~rep_cen,Centralizer(G,s));
end for;
// Initialize iteration
if 0 lt r then
iter_cen:= [rep_cen[1]];
R:= [[id]];
else
iter_cen:= [];
R:= [];
end if;
for i in [ 2 .. r-1 ] do
R[i]:= DoubleCosetRepresentatives(G, rep_cen[i],iter_cen[i-1] );
iter_cen[i]:= iter_cen[i-1] meet Centralizer(G,sigma[i]^R[i][1] );
end for;
if 1 lt r then
R[r]:= DoubleCosetRepresentatives( G, rep_cen[r], iter_cen[r-1] );
end if;
max:=[];
for i in [1..#R] do
Append(~max,#R[i]);
end for;
// List of all ones
choice:= [];
for i in [1..r] do
Append(~choice,1);
end for;
// list of sigma[i]^R[i][1];
tuple:=[];
for i in [1..r] do
Append(~tuple, sigma[i]^R[i][1] );
end for;
// function: NextElementTuple
NextElementTuple:= function(choice, bleck, iter_cen, R, max)
pos:= r;
while 1 lt pos and choice[pos] eq max[pos] do
pos:= pos - 1;
end while;
if pos le 1 then
return choice, [id,id], iter_cen, R, max;
end if;
choice[pos]:= choice[pos] + 1;
bleck[pos]:= sigma[pos]^R[pos][choice[pos]];
if pos lt r then
iter_cen[pos]:= iter_cen[pos-1] meet Centralizer(G,sigma[pos]^R[pos][choice[pos]]);
pos:= pos + 1;
while pos le r do
R[pos]:= DoubleCosetRepresentatives(G, rep_cen[pos], iter_cen[pos-1]);
bleck[pos]:= sigma[pos]^R[pos][1];
choice[pos]:= 1;
max[pos]:= #R[pos] ;
iter_cen[pos]:=iter_cen[pos-1] meet Centralizer(G,sigma[pos]^R[pos][1]);
pos:= pos + 1;
end while;
end if;
return choice, bleck, iter_cen, R, max;
end function;
tup:= tuple;
genvecs:=[];
while tup ne [id,id] do
prod:= id;
for i in [1..r] do
prod:= prod * tup[i];
end for;
if g0 eq 0 then
if prod eq id and #sub<G | tup > eq n then
hypgens:=[];
for t in tup do
Append(~hypgens,t);
end for;
Append(~genvecs, hypgens);
end if;
else
ReduceGenerators(~G); // removes redundancies
if prod eq id and NumberOfGenerators(G) le g0 then
hypgens:=[];
for h in Generators(G) do
Append(~hypgens,h);
Append(~hypgens,id);
end for;
for i in [#hypgens+1..2*g0] do
Append(~hypgens,id);
end for;
for t in tup do
Append(~hypgens,t);
end for;
Append(~genvecs, hypgens);
elif prod eq id and IsAbelian(G) and NumberOfGenerators(G) le 2*g0 then
hypgens:=Generators(G);
hypgens:=SetToSequence(hypgens);
for i in [#hypgens+1..2*g0] do
Append(~hypgens,id);
end for;
for t in tup do
Append(~hypgens,t);
end for;
Append(~genvecs, hypgens);
else
elms:=[];
for h in G do
Append(~elms,h);
end for;
counter:=[];
counter[1]:= 0;
for i in [2..2*g0] do
Append(~counter,1);
end for;
repeat
i:= 1;
while i le 2*g0 and counter[i] eq n do
counter[i]:= 1;
i:= i+1;
end while;
if i le 2*g0 then
counter[i]:=counter[i] + 1;
commprod:= id;
for j in [1..g0] do
commprod:=commprod*(elms[counter[2*j-1]], elms[counter[2*j]]);
// commutator is (g,h)
end for;
if commprod*prod eq id then
tempelms:=[];
for c in counter do
Append(~tempelms,elms[c]);
end for;
H:=tup;
for h in tempelms do
Append(~H,h);
end for;
if #sub<G|H> eq n then
for t in tup do
Append(~tempelms, t);
end for;
Append(~genvecs, tempelms);
end if;
end if;
end if ;
until i gt 2*g0;
end if; end if;
choice, tup, iter_cen, R, max:= NextElementTuple(choice, tup, iter_cen, R, max);
end while;
if #genvecs gt 0 then
return genvecs;
else
return [[id,id]];
end if;
end function;
/* ***************************************
RepresentativesEpimorphisms(signature,G : Con:=[], tbl:=[], orders:=[], sizecon:=[], sizecenter:=0)
Input: signature
group G
Con the conjugacy classes of G (optional)
tbl the character table of G (optional)
orders list of orders of conjugacy classes corresponding to Con (optional)
sizecon size of each conjugacy class corresponding to Con (optional)
sizecenter size of center (optional)
Output: a list of records containing
the signature,
the numbers listing which conjugacy classes
contain branching data,
the group,
the monodromy
Breuer's notes:
## Let <signature> be the list $[ g_0, r, m_1, m_2, \ldots, m_r ]$,
## with $m_1 \leq m_2 \leq \cdots m_r$.
##
## First the conjugacy classes of <G> are computed.
## Then all possible class structures $C = ( C_1, C_2, \ldots, C_r )$
## are checked for a surface kernel epimorphism with image of $c_i$ in
## class $C_i$.
##
## We restrict the search to the class structures where the elements of
## class $C_i$ have order $m_i$,
## and for $m_i = m_{i+1}$, we consider only the case that $C_i$ comes
## not after $C_{i+1}$ in the fixed ordering of classes.
##
************************************ */
RepresentativesEpimorphisms := function(signature,G : Con:=[], tbl:=[], orders:=[], sizecon:=[], sizecenter:=0 )
g0:= signature[1]; // orbit genus
r:= #signature - 1; // number of branch points
m:= Reverse(Prune(Reverse(signature)));
// If the user enters conjugacy classes or character table,
// the group must already by a permutation group
if (#Con ne 0 or #tbl ne 0) and Type(G) ne GrpPerm then
error "If you define a conjugacy class or character table of the group, the group must already be a GrpPerm.";
end if;
// Change G to GrpPerm if of type GrpPC
if Type(G) ne GrpPerm then
if Type(G) eq GrpPC then
G:=ConvertToPerm(G);
else
error "You must enter a group of type GrpPerm or GrpPC.";
end if;
end if;
if #Con eq 0 then
Con:= ConjugacyClasses( G );
end if;
nccl:= #Con;
// print #orders;
if #orders eq 0 then
for conjclass in Con do
Append(~orders, conjclass[1] );
end for;
end if;
//print #orders;
images:=[];
for i in [1..r] do
temp:=[];
for j in [1..nccl] do
if orders[j] eq m[i] then
Append(~temp,j);
end if;
end for;
Append(~images, temp);
end for;
if exists(u){x: x in images | #x eq 0} then
error "At least one entry in the signature is not a valid order for elements in the designated group.";
end if;
epi:= [];
ReFo := recformat< signature,Con,Gro,genimages>;
max:= [];
for im in images do
Append(~max, #im);
end for;
counter:= [];
for i in [1..#images] do
Append(~counter,1 );
end for;
if 0 lt r then
counter[r]:= 0;
end if;
// FUNCTION NextClassStructure
if r eq 0 then // create function for case where there is no ramification
NextClassStructure:= function(counter,max)
if counter ne [-100] then
counter:= [-100];
return [],counter;
else
return [-100],counter;
end if;
end function;
else // function for case where there is ramification
NextClassStructure:= function(counter,max)
for i:=r to 1 by -1 do
if counter[i] eq max[i] then
counter[i]:= 1;
else
counter[i]:= counter[i] + 1;
j:= i;
while j lt r and m[j] eq m[j+1] do
if counter[j+1] lt counter[j] then
counter[j+1]:= counter[j];
end if;
j:= j+1;
end while;
templist:=[];
for j in [1..r] do
Append(~templist,images[j][counter[j]]);
end for;
return templist,counter;
end if;
end for;
return [-100],counter;
end function;
end if;
C,counter:= NextClassStructure(counter,max);
while C ne [-100] do
weak:= WeakTestGeneration( C, g0, G : Con:=Con, tbl:=tbl, sizeconjclass:=sizecon, sizecenter:=sizecenter );
if weak ne false then
test:= HardTestGeneration( C, g0, G : Con:=Con);
if test ne [[Identity(G), Identity(G)]] then
for t in test do
Append(~epi, rec<ReFo|signature:=signature, Con:=C, Gro:=G, genimages:=t>);
end for;
end if;
end if;
C,counter:= NextClassStructure(counter,max);
end while;
if #epi eq 0 then
error "This group and signature pair are not valid pairs for a group action on a Riemann surface.";
else
return epi;
end if;
end function;
/* *************************************
Add Monodromy(g)
Input: g genus
BrDataPath location of Breuer data
OutputPath location to store monodromy data
Output: write to file "storefilename" with monodromy data
**************************************** */
AddMonodromy:=procedure(g,BrDataPath,OutputPath)
// Load Data from Breuer
if g lt 10 then
filename:=BrDataPath cat "genus" cat "0" cat IntegerToString(g) cat "/groups" cat "0" cat IntegerToString(g);
storefilename:= OutputPath cat "grpmono" cat "0" cat IntegerToString(g);
else
filename:=BrDataPath cat "genus" cat IntegerToString(g) cat "/groups" cat IntegerToString(g);
storefilename:=OutputPath cat "grpmono" cat IntegerToString(g);
end if;
FP:=Open(filename, "r");
dataline:=Gets(FP);
count:=1;
while IsEof(dataline) eq false do
// if starts with "#" or "R" skip
if dataline[1] ne "#" and dataline[1] ne "R" then
i:=1;
while dataline[i] ne "[" do
i+:=1;
end while;
i+:=1;
sign:=[];
while dataline[i] ne "]" do
if (dataline[i] ne ",") and (dataline[i] ne " ") then
term:=dataline[i];
i+:=1;
while dataline[i] ne "," and dataline[i] ne " " do
term:=term cat dataline[i];
i+:=1;
end while;
Append(~sign,StringToInteger(term));
end if;
i+:=1;
end while;
while dataline[i] ne "[" do
i+:=1;
end while;
i+:=1;
gpsize:=dataline[i];
while dataline[i+1] ne "," do
gpsize:=gpsize cat dataline[i+1];
i+:=1;
end while;
i+:=3;
gpnum:=dataline[i];
while dataline[i+2] ne "]" do
gpnum:=gpnum cat dataline[i+1];
i+:=1;
end while;
gpsize:=StringToInteger(gpsize);
gpnum:=StringToInteger(gpnum);
G:=SmallGroup(gpsize,gpnum);
if #sign eq 1 then // deal with case of no monodromy separately
groupstring:= "(" cat IntegerToString(gpsize) cat"," cat IntegerToString(gpnum) cat")";
PrintFile( storefilename, groupstring);
PrintFile( storefilename, sign);
PrintFile(storefilename, "[]");
PrintFile(storefilename, "*");
else
RepEp:=RepresentativesEpimorphisms(sign, G);
for rep in RepEp do
groupstring:= "(" cat IntegerToString(gpsize) cat"," cat IntegerToString(gpnum) cat")";
PrintFile( storefilename, groupstring);
PrintFile( storefilename,Sprint(rep`signature));
PrintFile(storefilename, Sprint(rep`Con));
for i in [1..#rep`genimages] do
tempval:=Eltseq(rep`genimages[i]);
stringperm:=IntegerToString(tempval[1]);
for j in [2..#tempval] do
stringperm:=stringperm cat " " cat IntegerToString(tempval[j]);
end for;
PrintFile( storefilename, stringperm);
end for;
PrintFile(storefilename, "*");
end for;
end if;
end if;
dataline:=Gets(FP);
end while;
end procedure;