/
EOType.mag
648 lines (512 loc) · 14.1 KB
/
EOType.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
declare attributes FldFun:H1deRham;
pullBack:=function(f, s);
s:=Image(f) meet s;
sol, N := Solution(f, Basis(s));
return sub<Generic(N)|[b : b in Basis(N + RowSpace(Matrix(sol)))]>;
end function;
intrinsic IsValidEO(EO::SeqEnum) ->.
{Checks if the length 2g sequence is a valid symmetric BT1 EO-type}
g:=Integers()!EO[#EO];
is_dual:=&and [(EO[j] eq EO[j+1]) eq (EO[2*g-j] eq (EO[2*g-j-1]+1)) : j in [1..2*g-2]];
is_increasing:= &and [EO[i+1] in {EO[i], EO[i]+1} : i in [1..#EO-1]];
return is_increasing and is_dual and (EO[#EO] eq (#EO div 2)) and (EO[1] in {0,1});
end intrinsic;
intrinsic ExtendEO(EO::SeqEnum) -> .
{Given a length g EO type return the length 2g type}
g:=#EO;
longEO:=EO cat [0 : i in [1..g]];
for i in [1..g-1] do
longEO[2*g-i] := EO[i]+g-i;
end for;
longEO[2*g] :=g;
assert IsValidEO(longEO);
return longEO;
end intrinsic;
FinalFiltration:=procedure(~EO);
last:=0;
thisrun:=[];
inputEO:=EO;
for i in [1..#EO] do
if EO[i] eq -1 then
Append(~thisrun,i);
else
for j in [1..#thisrun] do
if EO[i] eq last then
EO[i-j]:=last;
else
EO[i-j]:=EO[i] - j;
end if;
end for;
last:=EO[i];
thisrun:=[];
end if;
end for;
end procedure;
intrinsic H1dR(K::FldFun) -> AlgMat
{Return the F,V module of dimension 2g}
if assigned K`H1deRham then
return K`H1deRham;
end if;
p:=Characteristic(K);
Fq:=ConstantField(K);
Fp:=GF(p);
g:=Genus(K);
n:=Degree(Fq,Fp);
P:=[ZeroDivisor(d), PoleDivisor(d)] where d := Divisor(K!BaseField(K).1);
N:=Ceiling(2*g/Degree(P[1]));
NP1:= N*(P[1]);
NP2:= N*(P[2]);
pNP1:= p*NP1;
pNP2:= p*NP2;
//
// ------ Build the Riemann Roch Spaces for H^1(O) and H^0(Omega_1)
//
O, Om:=DifferentialSpace(DivisorGroup(K)!0);
O12, O12m:=DifferentialSpace(-(NP1+NP2) -P[1]-P[2]);
O1, O1m:=DifferentialSpace(-NP1-P[1]);
O2, O2m:=DifferentialSpace(-NP2-P[2]);
R12, R12m:=RiemannRochSpace(NP1+NP2);
R1, R1m:=RiemannRochSpace(NP1);
R2, R2m:=RiemannRochSpace(NP2);
H, Hm:=R12/(R1+R2);
if Dimension(H) ne g or g eq 0 then
print "WARNING: Constant field not exact!";
return RModule(MatrixRing(Fq,0));
end if;
// Deal with extension fields by restriction of scalars.
H_Fp, H_Fpm:=KModule(H, Fp);
pBasisfns:=[R12m(Inverse(Hm)(Inverse(H_Fpm)(b))) : b in Basis(H_Fp)];
O_Fp, O_Fpm :=KModule(O, Fp);
//
// ------ Build Riemann Roch Spaces with larger poles and the reduction map back
//
P12, P12m:=RiemannRochSpace(pNP1+pNP2);
P1, P1m:=RiemannRochSpace(pNP1);
P2, P2m:=RiemannRochSpace(pNP2);
Hp,Hpm:=P12/(P1+P2);
Basisfns:=[R12m(Inverse(Hm)(b)) : b in Basis(H)];
RtoP:=Matrix([Hpm(Inverse(P12m)(b)) : b in Basisfns]);
_, PtoR:=IsInvertible(RtoP);
//
// ------ Build Frobenius on H^1(O) -> H^1(O)
//
FirstFH:=Matrix([H_Fpm(Vector(Hpm(Inverse(P12m)(b ^ p))*PtoR)) : b in pBasisfns]);
FH, HBasis:=JordanForm(FirstFH);
//
// ------ Build Frobenius on H^1(O) -> H^0(Omega_1) on the kernel of the above
//
Q,Qm:=P12 / P1;
P2fns:=[P2m(b) : b in Basis(P2)];
PL1:=[Qm(Sm(b)) : b in Basis(S)] where S,Sm:=sub<P12|P2>;
FO:=[];
for i in [1..NumberOfRows(FH)] do
if IsZero(FH[i]) then
//
// Write f^p = u + v where u only has poles at P[1] and v at P[2]
// Then Frobenius(f) = du
//
u:=Qm(Inverse(P12m)(R12m(Inverse(Hm)(Inverse(H_Fpm)(HBasis[i])))^p));
//u:=Qm(Inverse(P12m)(R12m(Inverse(Hm)((HBasis[i])))^p));
sol:=Solution(Matrix(PL1), u);
fpu:=&+[sol[i]*P2fns[i] : i in [1..Dimension(P2)]];
Append(~FO, O_Fpm(Inverse(Om)(Differential(fpu))));
else
Append(~FO, O_Fp!0);
end if;
end for;
//
// ------ Set F on H^1_dR
//
F:=VerticalJoin(HorizontalJoin(FH, Matrix(FO)), ZeroMatrix(Fp,g*n,2*g*n));
//
// ------ Build Verchiebung on H^1(O) -> H^0(Omega_1)
//
Q,Qm:=O12 / O1;
O2fns:=[O2m(b) : b in Basis(O2)];
OL1:=[Qm(Sm(b)) : b in Basis(S)] where S,Sm:=sub<O12|O2>;
VO:=[];
ImF:=Image(FirstFH);
for b in Rows(HBasis) do
if not b in ImF then
//
// Write df = du + dv where du only has poles at P[1] and dv only have poles at P[2]
// Then V(f) = Cartier(dv)
//
dif:=Differential(R12m(Inverse(Hm)(Inverse(H_Fpm)(b))));
dv_vec:=Qm((Inverse(O12m)(dif)));
sol:=Solution(Matrix(OL1), dv_vec);
dv:=&+[sol[i]*O2fns[i] : i in [1..Dimension(O2)]];
Append(~VO, O_Fpm(Inverse(Om)(Cartier(dv))));
else
Append(~VO, O_Fp!0);
end if;
end for;
//
// ------ V on H^1_dR (NOTE: Verchiebung on H^0(Omega_1) -> H^0(Omega_1) is Cartier)
//
VH:=[];
for b in Basis(O_Fp) do
Append(~VH, O_Fpm(Inverse(Om)(Cartier(Om(Inverse(O_Fpm)(b))))));
end for;
Z:=ZeroMatrix(Fp, g*n,g*n);
V:=VerticalJoin(HorizontalJoin(Z, Matrix(VO)), HorizontalJoin(Z, Matrix(VH)));
// Set the attribute and return the module.
M:=RModule(MatrixRing<Fp, 2*g*n |F,V>);
K`H1deRham:=M;
return M;
end intrinsic;
intrinsic EOType(D::ModRng) -> .
{Return the EO type of the FV module}
H1:=VectorSpace(D);
S:=[*H1*];
Vit:=function(V,S, Filt);
VS:=[* *];
for s in S do
flag:=true;
thisS:=s;
while flag do
//Vs:=sub<H1|[b*V : b in Basis(thisS)]>;
Vs:=thisS*V;
Filt[Dimension(thisS)]:=Dimension(Vs);
if Dimension(Vs) eq 0 then
flag:=false;
else
if Filt[Dimension(Vs)] eq -1 then
Append(~VS, Vs);
thisS:=Vs;
else
flag:=false;
end if;
end if;
end while;
end for;
return Filt, VS;
end function;
Finit:=function(F,S, Filt);
FS:=[* *];
dims:={};
for s in S do
flag:=true;
Fi:=F;
while flag do
Fins:=pullBack(Fi, s);
if Filt[Dimension(Fins)] eq -1 and not Dimension(Fins) in dims then
Append(~FS, Fins);
Include(~dims, Dimension(Fins));
Fi:=Fi*F;
else
flag:=false;
end if;
end while;
end for;
return FS;
end function;
F:=Action(D).1;
V:=Action(D).2;
EO:=[-1: i in [1..Dimension(D)]];
EO1, VS:= Vit(V, S, EO);
while EO1 ne EO do
EO:=EO1;
FS:=Finit(F,VS, EO);
EO1,VS:=Vit(V,FS, EO);
end while;
FinalFiltration(~EO);
return EO;
end intrinsic;
intrinsic EOType(Kn::FldFun) -> []
{Return the lenght 2g sequence of the Ekedahl-Oort type of Kn}
M:=H1dR(Kn);
if Dimension(M) eq 0 then
return [];
end if;
EO:=EOType(M);
Fp:=GF(Characteristic(Kn));
Fq:=ConstantField(Kn);
n:=Degree(Fq,Fp);
g:=Genus(Kn);
eo_dim:=Integers()!(Dimension(M)/2);
NewEO:=[];
n:=Integers()!(eo_dim/g);
for i in [1..Floor(#EO/n)] do
Append(~NewEO,Integers()!(EO[i*n]/n));
end for;
EO:=NewEO;
assert IsValidEO(EO);
return EO;
end intrinsic;
//
// ------------------------- Conversion functions:
//
intrinsic EOToPermutation(EO::SeqEnum)-> .
{Convert EO type to a permutation}
pi:=[];
if EO[1] eq 1 then
pi[1]:=0;
else
pi[1]:=EO[#EO];
end if;
for i in [1..#EO-1] do;
if EO[i] eq EO[i+1] then
pi[i+1]:=EO[#EO]+i-EO[i];
else
pi[i+1]:=EO[i];
end if;
end for;
S2g:=SymmetricGroup(#EO);
cyc:=S2g![p+1: p in pi];
return cyc;
end intrinsic;
intrinsic PermutationToEO(c::GrpPermElt) -> .
{Permutation to EO}
EOC:=[];
c_elt:=Eltseq(c);
if c_elt[1] eq 1 then
EOC[1]:= 1;
count:=1;
else
EOC[1]:=0;
count:=0;
end if;
for i in [2..#c_elt] do
if c_elt[i] lt i then
count:=count+1;
end if;
if (c_elt[i] eq i) and i le (#c_elt div 2) then
count:=count+1;
end if;
EOC[i]:=count;
end for;
return EOC;
end intrinsic;
intrinsic PermutationToEO(c::SeqEnum) -> .
{Permutation to EO}
return PermutationToEO(SymmetricGroup(#c)!c);
end intrinsic;
intrinsic DecomposeEO(EO::SeqEnum) -> .
{Return the EO type of each irreducible submodule}
cyc:=EOToPermutation(EO);
C:=CycleDecomposition(cyc);
g:=EO[#EO];
EODec:=AssociativeArray();
for c in C do
if #c eq 1 then
if c[1] gt g then
EOC:=[0];
else
EOC:=[1];
end if;
else
table:=Sort(c);
newc:={@ Index(table,i) : i in c @};
EOC:=PermutationToEO(Sym(#newc)![newc]);
end if;
if not IsDefined(EODec, EOC) then
EODec[EOC]:=1;
else
EODec[EOC]+:=1;
end if;
end for;
return {*eo^^EODec[eo] : eo in Keys(EODec) *};
end intrinsic
NormalizeCycle:=function(fvword);
seq:=Eltseq(fvword);
P:=Parent(fvword);
return P!Min({Rotate(seq,i) : i in [1..#seq]});
end function;
CycletoFV:=function(c : P:=FreeGroup(2));
f:=P.1;
v:=P.2;
w:=P!1;
c:=IndexedSetToSequence(c);
for i in [2..#c] do
if c[i] gt c[i-1] then
w:=w*f;
else
w:=w*v;
end if;
end for;
if c[#c] gt c[1] then
w:=w*v;
end if;
return NormalizeCycle(w);
end function;
intrinsic EOToFVRelations(EO::SeqEnum : P:=FreeGroup(2)) ->.
{return the fv relations of the components}
if Names(P) eq Names(FreeGroup(2)) then
AssignNames(~P, ["F","V"]);
end if;
decomp:={* *};
for c in CycleDecomposition(EOToPermutation(EO)) do
if #c eq 1 then
if c[1] gt EO[#EO] then
fv_rel:=P.1;
else
fv_rel:=P.2;
end if;
else
fv_rel:=CycletoFV(c: P:=P);
end if;
Include(~decomp, [fv_rel]);
end for;
return decomp;
end intrinsic;
intrinsic FVRelationToEO(FVelt::GrpFPElt) ->.
{FV Relations to an EO type}
EO:=[];
fvseq:= Reverse(Eltseq(NormalizeCycle(FVelt)));
if #fvseq eq 1 then
if fvseq[1] eq 1 then
return [1];
else
return [0];
end if;
end if;
Mat_Ring:=MatrixRing(GF(2), #fvseq);
f:=Zero(Mat_Ring);
v:=Zero(Mat_Ring);
for i in [1..#fvseq-1] do
if fvseq[i] eq 2 then
v[i,i+1] +:=1;
else
f[i+1,i]+:=1;
end if;
end for;
f[1,#fvseq] +:=1;
M:=RModule(MatrixRing<GF(2), #fvseq | Transpose(f), Transpose(v)>);
return EOType(M);
end intrinsic;
F_iter:=function(EOs, S, Filt);
FS:=[* *];
dims:={};
genera := [e[#e] : e in EOs];
for s in S do
flag:=true;
thiss:=s;
while flag do
F_ins:=[thiss[i] eq 0 select genera[i] else (thiss[i] - EOs[i][thiss[i]]) + genera[i] : i in [1..#genera]];
if Filt[&+F_ins] eq -1 and not &+F_ins in dims then
Append(~FS, F_ins);
Include(~dims, &+F_ins);
thiss:=F_ins;
else
flag:=false;
end if;
end while;
end for;
return FS;
end function;
V_iter:=function(EOs, S, Filt);
VS:=[* *];
for s in S do
flag:=true;
thiss:=s;
while flag do
Vs:=[thiss[i] eq 0 select 0 else EOs[i][thiss[i]] : i in [1..#s]];
Filt[&+thiss] := &+Vs;
if &+Vs eq 0 then
flag:=false;
else
if Filt[&+Vs] eq -1 then
Append(~VS, Vs);
thiss:=Vs;
else
flag:=false;
end if;
end if;
end while;
end for;
return Filt, VS;
end function;
intrinsic ComposeEO(EOset::SetMulti) -> .
{Turns a multiset of EOs into a single EO}
if Type(EOset) eq SetMulti then
EOs:=MultisetToSequence(EOset);
else
EOs:=EOset;
end if;
//assert &and [IsEven(#e) or (#e eq 1) : e in EOs];
genera := [#e/2 : e in EOs];
g := Integers()!(&+genera);
EO:=[-1: i in [1..2*g-1]] cat [g];
S:=[[#eo : eo in EOs]];
EO1, VS:= V_iter(EOs, S, EO);
while EO1 ne EO do
EO:=EO1;
FS:=F_iter(EOs,VS, EO);
EO1,VS:=V_iter(EOs,FS, EO);
end while;
FinalFiltration(~EO);
assert IsValidEO(EO);
return(EO);
end intrinsic;
intrinsic FVRelationsToEO(FVelts::SetMulti) ->.
{From a collection of FV Relations to an EO type}
return ComposeEO({*FVRelationToEO(fv[1]) : fv in FVelts*});
end intrinsic;
intrinsic FVModule(EO::SeqEnum , p::RngIntElt) -> .
{Return the canonical FV module (over GF(p)) for a given type}
assert IsPrime(p);
g:=EO[#EO];
Mat_ring:=MatrixRing(GF(p),2*g);
F:=Zero(Mat_ring);
V:=Zero(Mat_ring);
IP:=Zero(Mat_ring);
jump_indices:=[];
if EO[1] eq 1 then
Append(~jump_indices, 1);
end if;
for i in [2..2*g] do
if EO[i] gt EO[i-1] then
Append(~jump_indices, i);
end if;
end for;
assert #jump_indices eq g;
non_indices:=[2*g+1-j : j in jump_indices];
for i in [1..g] do
IP[jump_indices[i],non_indices[i]] :=1;
IP[non_indices[i], jump_indices[i]] :=-1;
end for;
for i in [1..g] do
F[jump_indices[i], i] :=1;
end for;
for i in [1..g] do
sign:=1;
if 2*g+i-1 in jump_indices then
sign:=-1;
end if;
V[2*g-i+1, non_indices[i]] := sign;
end for;
return RModule(MatrixRing<GF(p), 2*g | Transpose(F), Transpose(V)>), IP;
end intrinsic;
intrinsic _Tester(g::.)
{testing the compose and decompose functions}
V:=VectorSpace(GF(2),g);
eolist:=[];
for v in V do
eo:=[0 : i in [1..g+1]];
for i in [2..g+1] do
eo[i] := eo[i-1]+ Integers()!(v[i-1]);
end for;
eo:=eo[2..g+1];
for i in [g+1..2*g-1] do
Append(~eo, eo[2*g-i]-g+i);
end for;
Append(~eo, g);
eolist cat:=[eo];
//tests
//print eo;
//Symmetric EO tests
try
assert eo eq ComposeEO(DecomposeEO(eo));
assert eo eq PermutationToEO(EOToPermutation(eo));
assert eo eq EOType(FVModule(eo,3));
assert eo eq FVRelationsToEO(EOToFVRelations(eo));
assert DecomposeEO(eo) eq {* EOType(s) : s in DirectSumDecomposition(FVModule(eo,3)) *};
catch e
error Sprint(eo), e;
end try;
end for;
assert #{e : e in eolist} eq 2^g;
//Sort(~eolist);
//print eolist;
end intrinsic;