-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptimized.mg
More file actions
1922 lines (1566 loc) · 48.7 KB
/
optimized.mg
File metadata and controls
1922 lines (1566 loc) · 48.7 KB
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
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*****************************************************************************
Optimized Version
The following program computes a transformation matrix of a Hecke operator T_P
for a polynomial P in R = F_q[T] with q = p^n, which operates on the vector
space C_h(Gamma, X) of all Gamma-equivariant harmonic cocycles with values in
a finite-dimensional vector space X over a field of prime characteristic,
where Gamma is a congruence subgroup of GL_2(R) with regards to a polynomial N
in R.
For this purpose, there essentially are four steps. The first part of the
program computes the quotient graph Gamma \ BTT where BTT denotes the
Bruhat-Tits tree. Then, we write a function "cocycle" which will calculate the
value of a Gamma(N)- or Gamma_1(N)-equivariant cocycle on an arbitrary edge of
the BTT. In the third part of the program, we are interested in a function
which can compute a basis for C_h(Gamma, X) if Gamma is Gamma_0^1(N),
Gamma_0(N), or SL_2(R). Finally, we conclude the program in the forth part
with the function "operator".
Throughout the whole program, I will be regularly citing my master thesis,
where all major algorithms are detailed.
Update Note: In the main.mg program the operation is implemented by
matrix multiplication, but this version realizes it through a vector space
homomorphism (see function "operation"). Additionally, the last function
"operator" saves computed graphs in a list (see function description for
further information).
Copyright (C) 2018 Burak Cakir
*****************************************************************************/
/*
* Part 1: The Quotient Graph Gamma \ BTT
*/
/*
* The aim of the first part is to calculate the quotient graph Gamma \ BTT
* where Gamma is a congruence subgroup of GL_2(R) and BTT the Bruhat-Tits
* tree. For this purpose, we first implement a system of representative of
* Gamma \ GL_2(R). Afterwards, we compute the quotient graph.
*
* Throughout the program, let R := F_q[T] with q = p^n. A detailed
* explanation of Part 1 can be found in Section 2.6 of my master thesis.
*/
/*
* The function "lift" takes two polynomials x neq 0 and y with
* gcd(x, y, N) = 1 and returns a polynomial t such that
* gcd(x, y + t * N) = 1.
*/
function lift(x, y)
e := 1;
t := 0;
g := Gcd(x, y);
q := Factorization(x);
n := #q;
for i := 1 to n do
e := e * q[i][1];
end for;
for i := 1 to n do
p := e div q[i][1];
a, b, c := Xgcd(p, q[i][1]);
if g mod q[i][1] eq 0 then
t := t + b * p;
end if;
end for;
return t;
end function;
/*************** Representative system for Gamma(N) \ GL_2(R) ****************/
/*
* The following function compute a system of representatives for
* Gamma(N) \ GL_2(R), according to the algorithm in Lemma 2.28 and
* Theorem 2.29
*/
function gammasystem(R, N)
F := BaseRing(R);
Q := quo<R|N>;
list := [];
sl := {};
for a, b, c, d in Q do
if a * d - b * c eq 1 then
Include(~sl, Matrix(Q, 2, 2, [a, b, c, d]));
end if;
end for;
for M in sl do
a := R ! M[1][1];
b := R ! M[1][2];
c := R ! M[2][1];
d := R ! M[2][2];
if a * d - b * c eq 1 then
for x in F do
if x ne 0 then
A := Matrix(R, 2, 2, [x, 0, 0, 1]);
B := Matrix(R, 2, 2, [a, b, c, d]);
Append(~list, A * B);
end if;
end for;
else
r := (a * d - b * c - 1) div N;
if c ne 0 then
t := lift(c, d);
d := d + t * N;
v, f, g := Xgcd(c, d);
a_new := a - (r + a * t) * g * N;
b_new := b + (r + a * t) * f * N;
else
s := lift(d, c);
c := c + s * N;
v, f, g := Xgcd(c, d);
a_new := a - (r - b * s) * g * N;
b_new := b + (r - b * s) * f * N;
end if;
for x in F do
if x ne 0 then
A := Matrix(R, 2, 2, [x, 0, 0, 1]);
B := Matrix(R, 2, 2, [a_new, b_new, c, d]);
Append(~list, A * B);
end if;
end for;
end if;
end for;
return list;
end function;
/************** Representative system for Gamma_1(N) \ GL_2(R) ***************/
function gamma1system(R, N)
F := BaseRing(R);
Q := quo<R|N>;
list := [];
for x, y in Q do
u := R ! x;
v := R ! y;
e := Gcd(Gcd(u, v) mod N, N);
if e eq 1 then
if Gcd(u, v) eq 1 then
e, r, s := Xgcd(u, v);
A := Matrix(R, 2, 2, [s, -r, u, v]);
else
if u ne 0 then
t := lift(u, v);
v := v + t * N;
e, r, s := Xgcd(u, v);
A := Matrix(R, 2, 2, [s, -r, u, v]);
else
t := lift(v, u);
u := u + t * N;
e, r, s := Xgcd(u, v);
A := Matrix(R, 2, 2, [s, -r, u, v]);
end if;
end if;
for z in F do
if z ne 0 then
B := Matrix(R, 2, 2, [z, 0, 0, 1]);
Append(~list, A * B);
end if;
end for;
end if;
end for;
return list;
end function;
/************* Representative system for Gamma_0^1(N) \ GL_2(R) **************/
function gamma01system(R, N)
F := BaseRing(R);
Q := quo<R|N>;
PS := ProjectiveSpace(Q,1);
list := [];
p1 := [PS|];
for x in car<Q, Q> do
x1, x2 := [x[1], x[2]] in PS;
if x1 eq true then
if x2 notin p1 then
Append(~p1, x2);
end if;
end if;
end for;
for x in p1 do
u := R ! x[1];
v := R ! x[2];
e, r, s := Xgcd(u, v);
if e eq 1 then
A := Matrix(R, 2, 2, [s, -r, u, v]);
else
if u ne 0 then
t := lift(u, v);
v := v + t * N;
e, r, s := Xgcd(u, v);
A := Matrix(R, 2, 2, [s, -r, u, v]);
else
t := lift(v, u);
u := u + t * N;
e, r, s := Xgcd(u, v);
A := Matrix(R, 2, 2, [s, -r, u, v]);
end if;
end if;
for z in F do
if z ne 0 then
B := Matrix(R, 2, 2, [z, 0, 0, 1]);
Append(~list, A * B);
end if;
end for;
end for;
return list;
end function;
/************** Representative system for Gamma_0(N) \ GL_2(R) ***************/
function gamma0system(R, N)
F := BaseRing(R);
Q := quo<R|N>;
PS := ProjectiveSpace(Q,1);
list := [];
p1 := [PS|];
for x in car<Q, Q> do
x1, x2 := [x[1], x[2]] in PS;
if x1 eq true then
if x2 notin p1 then
Append(~p1, x2);
end if;
end if;
end for;
for x in p1 do
u := R ! x[1];
v := R ! x[2];
e, r, s := Xgcd(u, v);
if e eq 1 then
Append(~list, Matrix(R, 2, 2, [s, -r, u, v]));
else
if u ne 0 then
t := lift(u, v);
v := v + t * N;
e, r, s := Xgcd(u, v);
Append(~list, Matrix(R, 2, 2, [s, -r, u, v]));
else
t := lift(v, u);
u := u + t * N;
e, r, s := Xgcd(u, v);
Append(~list, Matrix(R, 2, 2, [s, -r, u, v]));
end if;
end if;
end for;
return list;
end function;
/************** Representative system for Gamma_0(N) \ GL_2(R) ***************/
function gl2sl2(R)
F := BaseRing(R);
list := [];
for x in F do
if x ne 0 then
Append(~list, Matrix(R, 2, 2, [x, 0, 0, 1]));
end if;
end for;
return list;
end function;
/*
* Before we introduce a function which calculates the quotient graphs, we
* need some auxiliary functions.
*/
/*
* The following function computes all polynomials in R[T] with degree =< n.
*/
function polynomials(R, n)
F := BaseRing(R);
T := Name(R, 1);
set := {R|};
for x in F do
Include(~set, x);
end for;
if n eq 0 then
return set;
else
for i := 1 to n do
set_temp := set;
for j in F do
for k in set_temp do
Include(~set, j*T^i + k);
end for;
end for;
end for;
return set;
end if;
end function;
/*
* "stabilizer" provides the group G_n, which is the stabilizer of the vertex
* Lambda_n in GL_2(R).
*/
function stabilizer(R, n)
F := BaseRing(R);
set := {};
polset := polynomials(R, n);
if n eq 0 then
for a, b, c, d in F do
if a * d - b * c ne 0 then
Include(~set, Matrix(R, 2, 2, [a, b, c, d]));
end if;
end for;
else
for b in polset do
for a, d in F do
if a ne 0 and d ne 0 then
Include(~set, Matrix(R, 2, 2, [a, b, 0, d]));
end if;
end for;
end for;
end if;
return set;
end function;
/*
* Next, we define a function, which checks if a matrix x is in one of the
* congruence subgroups of interest. The argument type sets the congruence
* subgroup, 0 meaning Gamma(N), 1 for Gamma_1(N), 2 for Gamma_0^1(N),
* 3 for Gamma_0(N), and 4 for SL_2(R).
*/
function inGamma(R, N, type, x)
a := R ! x[1][1];
b := R ! x[1][2];
c := R ! x[2][1];
d := R ! x[2][2];
if type eq 0 then
if (a mod N eq 1) and (b mod N eq 0) and (c mod N eq 0) and (d mod N eq 1) then
return true;
end if;
elif type eq 1 then
if (a mod N eq 1) and (c mod N eq 0) and (d mod N eq 1) then
return true;
end if;
elif type eq 2 then
if (c mod N eq 0) and (Determinant(x) eq 1) then
return true;
end if;
elif type eq 3 then
if (c mod N eq 0) then
return true;
end if;
elif type eq 4 then
if Determinant(x) eq 1 then
return true;
end if;
end if;
return false;
end function;
/*
* Finally, the following function "graph" calculates the quotient graph. The
* argument type sets the congruence subgroups, 0 meaning Gamma(N), 1 for
* Gamma_1(N), 2 for Gamma_0^1(N), 3 for Gamma_0(N), and 4 for SL_2(R).
*/
function graph(R, N, type)
if type eq 0 then
reps := gammasystem(R, N);
elif type eq 1 then
reps := gamma1system(R, N);
elif type eq 2 then
reps := gamma01system(R, N);
elif type eq 3 then
reps := gamma0system(R, N);
elif type eq 4 then
reps := gl2sl2(R);
end if;
string := "graph G {\n node [shape=point width=0.1];\n";
ActualNumber := [];
n := Degree(N) + 1; // number of columns
m := #reps; // number of rows
// Let A be a (m * n)x(m * n)-matrix.
A := ZeroMatrix(IntegerRing(), m * n, m * n);
// Set the value for the initial situation where we have m copies of
// GL_2(R) \backslash \mathcal{T}.
for i := 1 to m do
for j := 1 to n - 1 do
A[i + (j - 1) * m][i + j * m] := 1;
A[i + j * m][i + (j - 1) * m] := -1;
end for;
end for;
relevant := [true : z in [1..m*n]];
// Edges between stage 0 and 1
list := [];
for i := 1 to m do
Include(~list, < i , m + i >);
end for;
// Identify the edges between stage 0 and 1.
stab0 := stabilizer(R, 0);
stab1 := stabilizer(R, 1);
stab01 := stab0 meet stab1;
for i := 2 to m do
if relevant[i] then
for j := 1 to i - 1 do
if relevant[j] then
for g in stab01 do
if inGamma(R, N, type, reps[j] * g * reps[i]^(-1)) then
for l := 0 to n - 1 do
relevant[i + l * m] := false;
end for;
list[i] := < 0, 0 >;
break j;
end if;
end for;
end if;
end for;
end if;
end for;
// Identify vertices of stage 0.
for i := 2 to m do
if relevant[i] then
for j := 1 to i - 1 do
if relevant[j] then
for g in stab0 do
if inGamma(R, N, type, reps[j] * g * reps[i]^(-1)) then
relevant[i] := false;
A[i + m][i] := 0;
A[j][i + m] := 1;
A[i + m][j] := -1;
list[i][1] := j;
break j;
end if;
end for;
end if;
end for;
end if;
end for;
// Identify vertices of stage \geq 1 (and the corresponding edges).
for l := 1 to n - 1 do
stab := stabilizer(R, l);
for i := 2 to m do
if relevant[i + l * m] then
for j := 1 to i - 1 do
if relevant[j + l * m] then
for g in stab do
if inGamma(R, N, type, reps[j] * g * reps[i]^(-1)) then
for k := 1 to m do
if A[k + (l - 1) * m][i + l * m] ne 0 then
A[k + (l - 1) * m][j + l * m] := A[k + (l - 1) * m][j + l * m] + A[k + (l - 1) * m][i + l * m];
A[j + l * m][k + (l - 1) * m] := A[j + l * m][k + (l - 1) * m] + A[i + l * m][k + (l - 1) * m];
A[k + (l - 1) * m][i + l * m] := 0;
end if;
end for;
for h := 0 to n - 1 - l do
relevant[i + (l + h) * m] := false;
end for;
if l eq 1 then
list[i][2] := j + l * m;
end if;
break j;
end if;
end for;
end if;
end for;
end if;
end for;
end for;
// Erase the rows and columns of vertices which do not exist anymore.
x := 0;
for i := 1 to m * n do
if not relevant[i] then
RemoveRow(~A, i - x);
RemoveColumn(~A, i - x);
x := x + 1;
else
ActualNumber := Include(ActualNumber, i);
end if;
end for;
number := NumberOfRows(A);
Graph := MultiDigraph< number | >;
B := A;
counter := 0;
for i := 1 to number do
AssignLabel(~Graph, VertexSet(Graph).i, Sprintf("%o", ActualNumber[i]));
for j := 1 to number do
while B[i][j] gt 0 do
for k := 1 to m do
if list[k][1] eq ActualNumber[i] and list[k][2] eq ActualNumber[j] then
AddEdge(~Graph, VertexSet(Graph).i, VertexSet(Graph).j, Sprintf("%o", k));
counter := 1;
list[k] := < 0, 0 >;
break k;
end if;
end for;
if counter ne 1 then
AddEdge(~Graph, VertexSet(Graph).i, VertexSet(Graph).j);
else
counter := 0;
end if;
B[i][j] := B[i][j] - 1;
line := Sprintf(" %o -- %o;\n", i, j);
string := string cat line;
end while;
end for;
end for;
string := string cat "}\n\n";
return Graph, reps, string;
end function;
/*
* Part 2: Evaluating a Cocycle
*/
/*
* The following program computes the value of a Gamma-equivariant harmonic
* cocycle on an edge of the Bruhat-Tits tree. Throughout the program, let
* R := F_q[T] with q = p^n and K := Quot(R).
*
* Keep in mind, this part is dependent on the previous part. For
* further information on the exact approach, please consider Section 3.5 of
* my master thesis, which I will be refering to quite often in the following
* lines.
*/
/*
* Before we begin, we need to construct a valuation map for elements in K and
* a function "series", which writes an element of K as a finite sum in (1/T).
* In my master thesis, I explain why I avoid using "LaurentSeriesRing" of
* Magma and its functions "Valuation" and "Coefficient".
*
* If necessary, extend the precision in "C := LaurentSeriesRing(F, n + 100)".
*/
function valuation(x)
if x eq 0 then
return Infinity;
else
return Degree(Denominator(x)) - Degree(Numerator(x));
end if;
end function;
function series(R, x, n)
F := BaseRing(R);
K := FieldOfFractions(R);
C := LaurentSeriesRing(F, n + 100);
T := Name(K, 1); pi := Name(C, 1);
emb := hom< K -> C | 1/pi >;
y := K ! 0;
if x eq 0 then
return x;
else
val := Valuation(emb(x));
for i := val to n do
y := y + Coefficient(emb(x), i) * (1/T)^i;
end for;
end if;
return y;
end function;
/*
* The function "normal_form" computes the representative of a vertex A with
* entries in K. (see proof of Lemma 1.14)
*/
function normal_form(R, A)
K := FieldOfFractions(R);
T := Name(K, 1);
// The matrix A has to be invertible.
if not IsInvertible(A) then
return "The matrix A has to be invertible.";
end if;
// First, achieve v(c) ge v(d).
if A[2][1] eq 0 then
A := A;
elif A[2][2] eq 0 then
A := A * Matrix(K, 2, 2, [0, 1, 1, 0]);
elif valuation(A[2][1]) lt valuation(A[2][2]) then
A := A * Matrix(K, 2, 2, [0, 1, 1, 0]);
end if;
// In the next step, get a matrix [pi^n, y, 0, 1].
A := A * Matrix(K, 2, 2, [1, 0, -A[2][1]/A[2][2], 1]);
A := A * Matrix(K, 2, 2, [1/A[2][2], 0, 0, 1/A[2][2]]);
n := valuation(A[1][1]);
// Determine y, which is given mod pi^n.
if A[1][2] eq 0 then
return Matrix(K, 2, 2, [(1/T)^n, 0, 0, 1]);
elif valuation(A[1][2]) ge n then
return Matrix(K, 2, 2, [(1/T)^n, 0, 0, 1]);
else
return Matrix(K, 2, 2, [(1/T)^n, series(R, A[1][2], n - 1), 0, 1]);
end if;
end function;
/*
* A normal form of a vertex can now be assigned to a standard lattice in the
* half-line GL_2(R) \ BTT. It is assumed that the matrix A is already in its
* normal form. (see proof of Theorem 1.21)
*/
function half_line(R, A)
K := FieldOfFractions(R);
T := Name(K, 1);
B := Matrix(R, 2, 2, [1, 0, 0, 1]); // This will be its representative in GL_2(R).
n := valuation(A[1][1]);
// Consider the polynomial and non-polynomial part of y.
if A[1][2] eq 0 then
y_pol := 0;
elif valuation(A[1][2]) le 0 then
y_pol := series(R, A[1][2], 0);
else
y_pol := 0;
end if;
y_non := A[1][2] - y_pol;
// Continue with the non-polynomial part of y.
A := Matrix(K, 2, 2, [A[1][1], y_non, 0, 1]);
B := Matrix(R, 2, 2, [1, -y_pol, 0, 1]) * B;
// Assign A to a vertex in the half-line GL_2(R)\T.
if (n le 0) or (A[1][2] eq 0) then
if n gt 0 then
B := Matrix(R, 2, 2, [0, 1, 1, 0]) * B;
return B^(-1), Matrix(K, 2, 2, [1, 0, 0, (1/T)^n]);
else
return B^(-1), Matrix(K, 2, 2, [1, 0, 0, (1/T)^(-n)]);
end if;
else
while valuation(A[1][1]) gt 0 and A[1][2] ne 0 do
A := Matrix(K, 2, 2, [(1/T)^(valuation(A[1][1]) - 2 * valuation(A[1][2])), 1/A[1][2], 0, 1]);
B := Matrix(R, 2, 2, [0, 1, 1, 0]) * B;
A := normal_form(R, A);
if A[1][2] eq 0 then
y_pol := 0;
elif valuation(A[1][2]) le 0 then
y_pol := series(R, A[1][2], 0);
else
y_pol := 0;
end if;
y_non := A[1][2] - y_pol;
A := Matrix(K, 2, 2, [A[1][1], y_non, 0, 1]);
B := Matrix(R, 2, 2, [1, -y_pol, 0, 1]) * B;
end while;
if valuation(A[1][1]) gt 0 then
B := Matrix(R, 2, 2, [0, 1, 1, 0]) * B;
return B^(-1), Matrix(K, 2, 2, [1, 0, 0, (1/T)^(valuation(A[1][1]))]);
else
return B^(-1), Matrix(K, 2, 2, [1, 0, 0, (1/T)^(-valuation(A[1][1]))]);
end if;
end if;
end function;
/*
* Finally, if A is a matrix in GL_2(K) representing an edge of the
* Bruhat-Tits tree BTT and sigma * standard its representative on the
* quotient graph GL_2(R) \ BTT, find its representative in the quotient graph
* Gamma \ BTT. The following function does that.
*/
function quotient_rep(R, N, type, sigma, standard)
K := FieldOfFractions(R);
T := Name(K, 1);
if type eq 0 then
system := gammasystem(R, N);
elif type eq 1 then
system := gamma1system(R, N);
end if;
for g in system do
if inGamma(R, N, type, sigma * g^(-1)) then
return sigma * g^(-1), g, standard;
end if;
end for;
end function;
/*
* Up until now, the program takes an edge represented by the matrix A,
* computes its normal form A = [pi^n, y, 0, 1], divides it into
* A = B * [1, 0, 0, pi^n] with a matrix B in GL_2(R), and then further splits
* it into B = gamma * repr, where gamma is in Gamma and repr in
* Gamma \ GL_2(R). Now, we will find alpha, beta, and delta such that
* repr = beta * alpha * delta^(-1), where alpha is an representative of the
* edge of stage n, with which repr has been identified; beta is an
* element of Gamma; and delta is an element of the stabilizer of the edge
* [1, 0, 0, pi^n]. Thus, there will hold A = gamma * beta * alpha *
* delta^(-1) * [1, 0, 0, pi^n] = (gamma * beta) * alpha * [1, 0, 0, pi^n].
*/
function final_rep(R, N, type, Graph, Reps, gamma, gamma_rep, standard)
m := #Reps;
n := Degree(N);
stageA := valuation(standard[2][2]);
stage := [];
reprs := [];
E := EdgeSet(Graph);
if stageA eq 0 then
stabA := stabilizer(R, 0) meet stabilizer(R, 1);
else
stabA := stabilizer(R, stageA);
end if;
for i := 1 to #E do
ActualNumber1 := StringToInteger(Label(InitialVertex(E.i)));
if ActualNumber1 le m then
ActualNumber2 := StringToInteger(Label(E.i));
else
ActualNumber2 := ActualNumber1;
end if;
if ActualNumber2 mod m eq 0 then
reprs[i] := Reps[m];
else
reprs[i] := Reps[ActualNumber2 mod m];
end if;
if ActualNumber1 mod m eq 0 then
stage[i] := ActualNumber1 div m - 1;
else
stage[i] := ActualNumber1 div m;
end if;
if stageA eq stage[i] and stageA eq 0 then
for g in stabA do
if inGamma(R, N, type, gamma_rep * g * reprs[i]^(-1)) then
alpha := reprs[i];
return gamma * gamma_rep * g * alpha^(-1), alpha, standard;
end if;
end for;
elif stageA eq stage[i] and stageA ne 0 then
for g in stabA do
if inGamma(R, N, type, gamma_rep * g * reprs[i]^(-1)) then
alpha := reprs[i];
return gamma * gamma_rep * g * alpha^(-1), alpha, standard;
end if;
end for;
elif stageA ge n then
if stage[i] eq n - 1 then
for g in stabA do
if inGamma(R, N, type, gamma_rep * g * reprs[i]^(-1)) then
alpha := reprs[i];
return gamma * gamma_rep * g * alpha^(-1), alpha, standard;
end if;
end for;
end if;
end if;
end for;
end function;
/*
* The following function computes the stabilizer of an edge of stage n
* represented by the matrix M.
*/
function stab(R, N, type, M, n)
list := [];
if type eq 0 then
if n lt Degree(N) then
Include(~list, Matrix(R, 2, 2, [1, 0, 0, 1]));
return list;
else
polset := polynomials(R, n - Degree(N));
for f in polset do
Include(~list, M * Matrix(R, 2, 2, [1, f * N, 0, 1]) * M^(-1));
end for;
end if;
elif type eq 1 then
A := M^(-1);
D := N/Gcd(N, A[2][1]);
if n lt Degree(D) then
Include(~list, Matrix(R, 2, 2, [1, 0, 0, 1]));
return list;
else
polset := polynomials(R, n - Degree(D));
for f in polset do
Include(~list, M * Matrix(R, 2, 2, [1, f * D, 0, 1]) * M^(-1));
end for;
end if;
end if;
return list;
end function;
/*
* If dual = true, we consider the vector space Sym^(-r)(K^2) x det^(twist).
* If dual = false, we consider Sym^(r)(K^2) x det^(twist) if irr eq false or
* its irreducible subrepresentation L(r + twist, twist) = L(r) x det^(twist)
* if irr eq true.
*/
function vectorspace(R, dual, irr, r, twist)
K := FieldOfFractions(R);
Pol<X, Y> := PolynomialRing(K, 2);
n := #MonomialsOfDegree(Pol, r);
Vec := VectorSpace(K, n);
if dual eq false and irr eq true then
list := [];
p := Characteristic(K);
if r le p - 1 then
return Vec;
else
for j := 0 to r do
if not IsDivisibleBy(Binomial(r, j), p) then
Append(~list, BasisElement(Vec, j + 1));
end if;
end for;
end if;
Vec := sub< Vec | list >;
end if;
return Vec;
end function;
/*
* The operation on the vector space of the previous function
*/
function operation(R, dual, irr, r, twist, A, v)
K := FieldOfFractions(R);
a := K ! A[1][1];
b := K ! A[1][2];
c := K ! A[2][1];
d := K ! A[2][2];
Vec := vectorspace(K, dual, irr, r, twist);
n := Degree(Vec);
Pol<X, Y> := PolynomialRing(K, 2);
Monomials := MonomialsOfDegree(Pol, r);
list := [];
if dual eq true then
emb := hom< Pol -> Pol | a * X + b * Y, c * X + d * Y>;
for j := 0 to r do
Include(~list, emb(X^j * Y^(r-j)));
end for;
Graph := [];
for i := 1 to n do
Vector := &+[MonomialCoefficient(list[j], Monomials[(n+1)-i]) * Vec.j : j in [1..n]];
Include(~Graph, <Vec.i, Vector>);
end for;
op := hom < Vec -> Vec | Graph >;
if twist ge 0 then
return Determinant(A)^(twist) * op(v);
elif twist lt 0 then
return (1/(Determinant(A)^(Abs(twist)))) * op(v);
end if;
elif dual eq false then
emb := hom < Pol -> Pol | (1 / Determinant(A)) * (d * X - b * Y), (1 / Determinant(A)) * ((-1) * c * X + a * Y)>;
Vec2 := VectorSpace(K, r+1);
polynomial := &+[Coordinates(Vec2, Vec2!v)[i] * Monomials[(n+1)-i] : i in [1..n]];
polynomial := emb(polynomial);
vector := &+[MonomialCoefficient(polynomial, Monomials[(n+1)-i]) * Vec2.i : i in [1..n]];
if twist ge 0 then
return Determinant(A)^(twist) * vector;
elif twist lt 0 then
return (1/(Determinant(A)^(Abs(twist)))) * vector;
end if;
end if;
end function;
/*
* The following function computes the dimension of the vector space of the
* Gamma-equivariant harmonic cocycles, in order to know how many coefficients
* will be needed by the function "cocycle" following it.
*/
function preparation(R, N, type, dual, irr, r, twist, Graph, Reps)
F := BaseRing(R);
V := VertexSet(Graph);
E := EdgeSet(Graph);
EdgeCount := #E;
m := #Reps;
q := #F;
BasisEdges := [];
counter := 0;
for i := 1 to EdgeCount do