44InstallMethod(RightTransversal,
55" right transversal for finite index subgroups of SL(2,Integers)" ,
66[ IsMatrixGroup,IsMatrixGroup] ,
7- function (H,HH )
7+ function (H,HH );
88if not ( IsHapSL2ZSubgroup(H) or IsHapSL2ZSubgroup(HH)) then TryNextMethod (); fi ;
99if H= SL(2 ,Integers) then
10- return HAP_RightTransversalSL2ZSubgroups(H,HH);
10+ # return HAP_RightTransversalSL2ZSubgroups(H,HH); #Works surprisingly well!
11+ return HAP_TransversalCongruenceSubgroups(H,HH);
1112else
1213return HAP_RightTransversalSL2ZSubgroups_alt(H,HH);
1314fi ;
1415end );
1516# ###########################################################
1617# ###########################################################
1718
19+ # ##################################################################
20+ # ##################################################################
21+ InstallGlobalFunction(HAP_TransversalCongruenceSubgroups,
22+ function (G,H )
23+ local tree,InH,S,T,U,v,p,g,s,n,q,vv,gens,
24+ nodes, nodesinv, leaves, ambientGenerators, InLowDegreeNodesModH,
25+ one, poscan, nind ;
26+
27+ # ###################
28+ S:= [[ 0 ,- 1 ] ,[ 1 ,0 ]] ;;
29+ T:= [[ 1 ,1 ] ,[ 0 ,1 ]] ;
30+ U:= S* T;
31+ one:= IdentityMat(2 );
32+ # ###################
33+
34+ ambientGenerators:= [ S,S* U] ;
35+ tree:= [ 1 ] ;
36+ cnt:= 1 ;
37+ leaves:= NewDictionary(S,true ,SL(2 ,Integers));
38+ nodes:= [ one] ;
39+ AddDictionary(leaves,one,1 );
40+
41+ InH:= H!. membership;
42+
43+ # ##########################################
44+ InLowDegreeNodesModH := function (g )
45+ local x,gg,B1,B2;
46+ gg:= g^- 1 ;
47+
48+ for x in nodes do
49+ if InH(x* gg) then return x; fi ;
50+ od ;
51+
52+ return false ;
53+ end ;
54+ # ##########################################
55+
56+
57+
58+
59+ # ###########Tree Construction########################
60+ while Size(leaves)> 0 do
61+ vv:= leaves!. entries[ 1 ] ;
62+ v:= vv[ 1 ] ;
63+ for s in [ 1 .. Length(ambientGenerators)] do
64+ g:= v* ambientGenerators[ s] ;
65+ q:= InLowDegreeNodesModH(g);
66+ if q= false then
67+ Add(nodes,g);
68+ AddDictionary(leaves,g,Length(nodes));
69+ p:= LookupDictionary(leaves,v);
70+ Add(tree,[ p, s] );
71+ fi ;
72+ od ;
73+ RemoveDictionary(leaves,v);
74+ od ;
75+ # ####################################################
76+
77+ nodes:= Filtered(nodes,g-> g in G);
78+ nodesinv:= List(nodes,g-> g^- 1 );
79+ nind:= [ 1 .. Length(nodes)] ;
80+
81+ # ###################################################
82+ poscan := function (x )
83+ local i;
84+
85+ for i in nind do
86+ if InH( x* nodesinv[ i] ) then return i; fi ;
87+ od ;
88+ return fail ;
89+ end ;
90+ # ###################################################
91+
92+ return Objectify( NewType( FamilyObj( G ),
93+ IsHapRightTransversalSL2ZSubgroup and IsList and
94+ IsDuplicateFreeList and IsAttributeStoringRep ),
95+ rec ( group := G,
96+ subgroup := H,
97+ cosets:= nodes,
98+ poscan:= poscan ));
99+ end );
100+ # ##################################################################
101+ # ##################################################################
102+
18103
19104# ###########################################################
20105# ###########################################################
@@ -45,159 +130,6 @@ end);
45130# ###########################################################
46131# ###########################################################
47132
48- # ###########################################################
49- # ###########################################################
50- InstallGlobalFunction(HAP_RightTransversalSL2ZSubgroups,
51- function (H,HH )
52- local F, rels, S, T, G, FhomG, Q, gensQ, epi, ElementToWord,
53- gensH, gensHH, QH, QHH, R, R1, R2, s, t, poscan, iso;
54-
55- G:= SL(2 ,Integers);
56- F:= FreeGroup(2 );s:= F.1 ;t:= F.2 ;
57- rels:= [ s^ 4 ,(s* t)^ 3 * s^- 2 ] ;
58- S:= [[ 0 ,- 1 ] ,[ 1 ,0 ]] ;
59- T:= [[ 1 ,1 ] ,[ 0 ,1 ]] ;
60- Q:= F/ rels;
61- FhomG:= GroupHomomorphismByImages(F,G,[ s,t] ,[ S,T] );
62- gensQ:= GeneratorsOfGroup(Q);
63- epi:= GroupHomomorphismByImages(F,Q,GeneratorsOfGroup(F),GeneratorsOfGroup(Q));
64-
65- # ##########################################################
66- # ##########################################################
67- ElementToWord := function (g )
68- local A, d,i, b,L, bool;
69-
70- # bool is true if S^n was the last added element
71- bool:= false ;
72-
73- L:= [ One(F)] ;
74- A:= 1 * g;
75-
76- while not A[ 2 ][ 1 ] = 0 do
77- if AbsInt(A[ 2 ][ 1 ] )> AbsInt(A[ 1 ][ 1 ] ) then
78- A:= S* A; Add(L,s); bool:= true ;
79- fi ;
80- if not A[ 2 ][ 1 ] = 0 then
81- if A[ 1 ][ 1 ] / A[ 2 ][ 1 ] >= 0 then
82- A:= T^- 1 * A;
83- Add(L,t^- 1 ); bool:= false ;
84- else
85- A:= T* A; bool:= false ;
86- Add(L,t);
87- fi ;
88- fi ;
89- od ;
90-
91-
92-
93-
94- d:=- A[ 1 ][ 1 ] * A[ 1 ][ 2 ] ;
95-
96-
97- if not bool then
98- A:= T^ SignInt(d)* A;
99-
100- if SignInt(d)= 1 then
101- Add(L,t);
102- fi ;
103- if SignInt(d)=- 1 then
104- Add(L,t^- 1 );
105- fi ;
106- else
107- A:= T^ SignInt(d)* A;
108- bool:= false ;
109- if SignInt(d)= 1 then
110- Add(L,t);
111- fi ;
112- if SignInt(d)=- 1 then
113- Add(L,t^- 1 );
114- fi ;
115- fi ;
116-
117- for i in [ 2 .. AbsInt(d)] do
118- A:= T^ SignInt(d)* A;
119-
120- if SignInt(d)= 1 then
121- Add(L,t);
122- fi ;
123- if SignInt(d)=- 1 then
124- Add(L,t^- 1 );
125- fi ;
126- od ;
127-
128- if IsEvenInt(Length(L)) then
129-
130- if A[ 1 ][ 1 ] =- 1 then
131- A:= S^ 2 * A;
132- Add(L,s^ 2 );
133- fi ;
134-
135- else
136-
137- if A[ 1 ][ 1 ] =- 1 then
138- A:= S^ 2 * A;
139- Add(L,s^ 2 );
140- fi ;
141-
142- fi ;
143-
144- # Print(A,"\n");
145- return Product(List(L,x-> x^- 1 ));
146- end ;
147- # ########################################################
148- # ########################################################
149-
150- gensH:= List(GeneratorsOfGroup(H),x-> ElementToWord(x));
151- gensH:= List(gensH,x-> Image(epi,x));
152- QH:= Subgroup(Q,gensH);
153-
154- # ###################
155- if HH= false then
156-
157- QH!. epimorphism:= epi;
158- QH!. ElementToWord:= ElementToWord;
159- return QH;
160-
161- iso:= IsomorphismFpGroup(QH);
162- QH!. isoFpGroup:= GroupHomomorphismByFunction(H, Image(iso), x->
163- Image(iso,Image(epi,ElementToWord(x)) ) );
164-
165- fi ;
166- # ###################
167-
168- gensHH:= List(GeneratorsOfGroup(HH),x-> ElementToWord(x));
169- gensHH:= List(gensHH,x-> Image(epi,x));
170- QHH:= Subgroup(QH,gensHH);
171- R1:= RightTransversal(QH,QHH);;
172- R2:= List(R1,x-> PreImagesRepresentative(epi,x));
173- Apply(R2,x-> Image(FhomG,x));
174-
175- # ####################################################
176- # ####################################################
177- poscan := function (g )
178- local w, a;
179-
180- w:= ElementToWord(g);
181- w:= Image(epi,w);
182- return PositionCanonical(R1,w);
183-
184- end ;
185- # ####################################################
186- # ####################################################
187-
188- # Print("stop\n");
189- return Objectify( NewType( FamilyObj( G ),
190- IsHapRightTransversalSL2ZSubgroup and IsList and
191- IsDuplicateFreeList and IsAttributeStoringRep ),
192- rec ( group := H,
193- subgroup := HH,
194- cosets:= R2,
195- poscan:= poscan ));
196-
197- end );;
198- # ##########################################################
199- # ##########################################################
200-
201133# ##########################################################
202134# ##########################################################
203135InstallOtherMethod(PositionCanonical,
@@ -216,7 +148,7 @@ end);
216148InstallOtherMethod(IndexNC,
217149" index for HapSLOSubgroups" ,
218150[ IsMatrixGroup,IsHapSL2ZSubgroup] ,
219- function (G,H )
151+ function (G,H );
220152return Length(RightTransversal(G,H));
221153end );
222154# ###############################################
@@ -227,7 +159,7 @@ end);
227159InstallOtherMethod(IndexNC,
228160" index for HapSLOSubgroups" ,
229161[ IsMatrixGroup,IsHapSL2OSubgroup] ,
230- function (G,H )
162+ function (G,H );
231163return Length(RightTransversal(G,H));
232164end );
233165# ###############################################
0 commit comments