CoCalc Public Fileswww / tables / magma_src / ModFrm / creation.mOpen with one click!
Author: William A. Stein
1
freeze;
2
3
/****-*-magma-* EXPORT DATE: 2004-11-23 ************************************
4
5
MODFORM: Modular Forms in MAGMA
6
7
William A. Stein
8
9
FILE: creation.m
10
11
12
2004-10-24: (was) Changed CoerceModFrmElt(M,x) so coercion
13
into the parent of an element is the identity:
14
15
Revision 1.13 2002/09/12 15:13:41 was
16
changed k to 2 in a comment.
17
18
Revision 1.12 2002/09/11 18:18:07 was
19
Changed back to keeping bad characters, so construction of zero space is possible.
20
21
Revision 1.11 2002/09/11 18:12:09 was
22
Throw out characters that don't satisfy eps(-1) = (-1)^k in modular forms constructor.
23
24
Revision 1.10 2002/05/04 18:12:19 was
25
Added CuspForms.
26
27
Revision 1.9 2002/04/13 07:26:38 was
28
*** empty log message ***
29
30
Revision 1.8 2002/03/11 23:06:07 was
31
improved intrinsic ModularForms(M::ModFrm, N::RngIntElt).
32
33
Revision 1.7 2002/03/11 23:01:36 was
34
Added intrinsic ModularForms(M::ModFrm, N::RngIntElt) -> ModFrm.
35
36
Revision 1.6 2001/11/22 19:28:20 was
37
Added some more constructors for "ModularForms".
38
39
Revision 1.5 2001/05/30 18:54:19 was
40
Created.
41
42
Revision 1.4 2001/05/16 04:11:48 was
43
*** empty log message ***
44
45
Revision 1.3 2001/05/16 04:01:01 was
46
*** empty log message ***
47
48
Revision 1.2 2001/05/16 03:56:48 was
49
*** empty log message ***
50
51
Revision 1.1 2001/05/16 03:51:41 was
52
Initial revision
53
54
55
***************************************************************************/
56
57
import "categories.m" : CopyOfModFrmElt;
58
59
import "predicates.m" : SpaceType,
60
SpaceTypeParam,
61
AssociatedSpaceOverZ;
62
63
intrinsic ModularForms(R::Rng) -> ModFrm
64
{The space spanned by all modular forms of all weights over the ring R.}
65
M := HackobjCreateRaw(ModFrm);
66
M`base_ring := R;
67
M`is_complex := true;
68
M`is_padic := false;
69
M`is_modp := false;
70
M`dimension := Infinity();
71
M`type := "ring";
72
return M;
73
end intrinsic;
74
75
intrinsic ModularForms(N::RngIntElt) -> ModFrm
76
{The space of weight 2 modular forms on Gamma_0(N) over the integers.}
77
require N ge 1: "The first argument must be at least 1.";
78
return ModularForms(N,2);
79
end intrinsic;
80
81
intrinsic ModularForms(N::RngIntElt, k::RngIntElt) -> ModFrm
82
{The space of weight k modular forms on Gamma_0(N) over the integers.}
83
require N ge 1: "The first argument must be at least 1.";
84
requirege k,1;
85
return ModularForms([DirichletGroup(N)!1], k);
86
end intrinsic;
87
88
function ModularFormsGamma1(N, k)
89
assert Type(N) eq RngIntElt;
90
assert Type(k) eq RngIntElt;
91
M := HackobjCreateRaw(ModFrm);
92
M`base_ring := Integers();
93
M`is_gamma1 := true;
94
M`level := N;
95
M`weight := k;
96
M`type := "full";
97
return M;
98
end function;
99
100
intrinsic ModularForms(G::GrpPSL2) -> ModFrm
101
{The space of weight 2 modular forms on G over the integers.}
102
require IsGamma1(G) or IsGamma0(G) : "Argument 1 must be Gamma_0(N) or Gamma_1(N).";
103
return ModularForms(G,2);
104
end intrinsic;
105
106
intrinsic ModularForms(G::GrpPSL2, k::RngIntElt) -> ModFrm
107
{The space of weight k modular forms on G over the integers.}
108
requirege k,1;
109
if IsGamma1(G) then
110
return ModularFormsGamma1(Level(G),k);
111
elif IsGamma0(G) then
112
return ModularForms(Level(G),k);
113
else
114
require false : "Argument 1 must be Gamma_0(N) or Gamma_1(N).";
115
end if;
116
end intrinsic;
117
118
/*intrinsic ModularForms(eps::GrpDrchElt, k::RngIntElt) -> ModFrm
119
{The space M_k(N,eps) over Z.}
120
require Type(BaseRing(Parent(eps))) in {FldCyc, FldRat} :
121
"The base ring of argument 1 must be the rationals or cyclotomic.";
122
return ModularForms([eps],k);
123
end intrinsic;
124
*/
125
126
intrinsic ModularForms(chars::[GrpDrchElt], k::RngIntElt) -> ModFrm
127
{The direct sum of the spaces ModularForms(eps,k), where eps runs through
128
representatives of the Galois orbits of the characters in the
129
sequence chars.}
130
requirege k,1;
131
require #chars gt 0 : "Argument 1 must have length at least 1.";
132
require Type(BaseRing(Parent(chars[1]))) in {FldCyc, FldRat} :
133
"The base ring of argument 1 must be the rationals or cyclotomic.";
134
135
M := HackobjCreateRaw(ModFrm);
136
M`base_ring := Integers();
137
M`dirichlet_character := GaloisConjugacyRepresentatives(chars);
138
M`is_gamma1 := false;
139
M`weight := k;
140
M`type := "full";
141
return M;
142
end intrinsic;
143
144
intrinsic ModularForms(chars::[GrpDrchElt]) -> ModFrm
145
{The direct sum of the spaces ModularForms(eps,2), where eps runs through
146
representatives of the Galois orbits of the characters in the
147
sequence chars.}
148
require #chars gt 0 : "Argument 1 must have length at least 1.";
149
require Type(BaseRing(Parent(chars[1]))) in {FldCyc, FldRat} :
150
"The base ring of argument 1 must be the rationals or cyclotomic.";
151
return ModularForms(chars,2);
152
end intrinsic;
153
154
155
intrinsic ModularForms(eps::GrpDrchElt, k::RngIntElt) -> ModFrm
156
{The direct sum of the spaces ModularForms(eps,k), where eps runs through
157
representatives of the Galois orbit of eps.}
158
requirege k,2;
159
require Type(BaseRing(Parent(eps))) in {FldCyc, FldRat} :
160
"The base ring of argument 1 must be the rationals or cyclotomic.";
161
return ModularForms([eps],k);
162
end intrinsic;
163
164
intrinsic ModularForms(eps::GrpDrchElt) -> ModFrm
165
{The direct sum of the spaces ModularForms(eps,2), where eps runs through
166
representatives of the Galois orbit of eps.}
167
require Type(BaseRing(Parent(eps))) in {FldCyc, FldRat} :
168
"The base ring of argument 1 must be the rationals or cyclotomic.";
169
return ModularForms([eps],2);
170
end intrinsic;
171
172
// The following two intrinsic are cheats, because they don't
173
// have proper require statements.
174
intrinsic CuspForms(x::.) -> .
175
{}
176
return CuspidalSubspace(ModularForms(x));
177
end intrinsic;
178
179
intrinsic CuspForms(x::., y::.) -> .
180
{}
181
return CuspidalSubspace(ModularForms(x,y));
182
end intrinsic;
183
184
// Just copy the most very basic defining properties of M, not
185
// things like hecke operators and so on.
186
function CopyOfDefiningModularFormsObject(M)
187
C := HackobjCreateRaw(ModFrm); // C for "copy"
188
if assigned M`dimension then
189
C`dimension := M`dimension;
190
end if;
191
C`base_ring := BaseRing(M);
192
C`level := Level(M);
193
C`weight := Weight(M);
194
C`type := SpaceType(M);
195
C`type_param := SpaceTypeParam(M);
196
C`is_gamma1 := IsGamma1(M);
197
if assigned M`made_from_newform then
198
C`made_from_newform := M`made_from_newform;
199
end if;
200
if assigned M`dirichlet_character then
201
C`dirichlet_character := M`dirichlet_character;
202
end if;
203
if assigned M`ambient_space then
204
C`ambient_space := M`ambient_space;
205
end if;
206
if assigned M`associated_space_over_z then
207
C`associated_space_over_z := M`associated_space_over_z;
208
end if;
209
if assigned M`default_precision then
210
C`default_precision := M`default_precision;
211
end if;
212
return C;
213
end function;
214
215
intrinsic ModularForms(M::ModFrm, N::RngIntElt) -> ModFrm
216
{The full space of modular forms with the same defining
217
weight, base ring, etc. as M, but with level N.
218
If M is defined by nontrivial dirichlet characters, then
219
N must be a multiple at least one of the conductors
220
of the characters.}
221
T := HackobjCreateRaw(ModFrm);
222
T`base_ring := BaseRing(M);
223
T`level := N;
224
T`weight := Weight(M);
225
T`is_gamma1 := IsGamma1(M);
226
T`type := "full";
227
if not IsGamma1(M) and assigned M`dirichlet_character then
228
chars := [];
229
E := M`dirichlet_character;
230
G := DirichletGroup(N,BaseRing(Parent(E[1])));
231
for eps in [chi : chi in E | N mod Conductor(chi) eq 0] do
232
e1 := Restrict(eps,Conductor(eps));
233
e2 := N ne Conductor(eps) select Extend(e1,N) else e1;
234
Append(~chars, e2);
235
end for;
236
require #chars gt 0: "If M is defined by nontrivial dirichlet characters, then N must be a multiple at least one of the conductors of the characters.";
237
T`dirichlet_character := chars;
238
end if;
239
if assigned M`default_precision then
240
T`default_precision := M`default_precision;
241
end if;
242
return T;
243
end intrinsic;
244
245
246
/*
247
intrinsic ModularForms(eps::GrpDrchElt, k::RngIntElt) -> ModFrm
248
{This returns M_k(eps), which is the direct sum of the e parts
249
of M_k(Gamma_1(N)) as e varies over the Galois conjugates of eps.}
250
requirege k,2;
251
require Type(BaseRing(eps)) in {FldCyc, FldRat} :
252
"The base ring of argument 1 must be the rationals or cyclotomic.";
253
return ModularForms([eps],k);
254
end intrinsic;
255
*/
256
257
258
259
function CreateModularFormFromElement(parent, element)
260
assert Type(parent) eq ModFrm;
261
assert Type(element) in {ModTupRngElt, ModTupFldElt};
262
y := HackobjCreateRaw(ModFrmElt);
263
y`parent := parent;
264
y`element := element;
265
return y;
266
end function;
267
268
269
function CoerceRngIntElt(M,x)
270
assert Type(M) eq ModFrm;
271
assert Type(x) eq RngIntElt;
272
273
if x eq 0 then
274
return true, CreateModularFormFromElement(M,
275
RSpace(BaseRing(M), Dimension(M))!0);
276
else
277
return false, "Can't coerce nonzero integer in.";
278
end if;
279
280
end function;
281
282
function CoerceRngSerPowElt(M,x)
283
assert Type(M) eq ModFrm;
284
assert Type(x) eq RngSerPowElt;
285
286
/* If x agrees with the q-expansion of some element of M, then
287
this function returns that element. Otherwise, there is an error. */
288
error_message := "The series does not define a modular form in the space.";
289
290
if Dimension(M) eq 0 and x ne 0 then
291
return false, error_message;
292
end if;
293
294
if RelativePrecision(x) eq -1 then
295
return false, "Illegal coercision -- power series must have absolute precision.";
296
end if;
297
prec := AbsolutePrecision(x);
298
Q := [PowerSeries(f,prec) : f in Basis(M)];
299
elt := [BaseRing(M)|];
300
f := Parent(Q[1])!0;
301
zero := BaseRing(M)!0;
302
for n in [1..#Q] do
303
//v := Valuation(Q[n]); // this doesn't work right anymore, because
304
// of how the new p-adics are implemented.
305
seq := [Integers() | i : i in [0..prec-1] | zero ne Coefficient(Q[n],i)];
306
if #seq eq 0 then
307
v := prec;
308
else
309
v := Min(seq);
310
end if;
311
312
if v ge AbsolutePrecision(x-f) then
313
Append(~elt,0);
314
continue;
315
end if;
316
/* It's now no longer possible to work in K[x]/(f(x)) when f is irreducible.
317
Until this changes, working with modular forms over the p-adics in MAGMA
318
is essentially impossible, since generic extensions of the p-adics can't
319
be created. The problem is the XGCD doesn't work over p-adics, but I'm
320
sure this'll be fixed soon. (WAS, 06/16/03).
321
*/
322
coef := Coefficient(x-f,v) / Coefficient(Q[n],v);
323
if not (coef in BaseRing(M)) then
324
return false, error_message;
325
end if;
326
coef := BaseRing(M)!coef;
327
f +:= coef*Q[n];
328
Append(~elt,coef);
329
end for;
330
g := M!elt;
331
if x ne PowerSeries(g,prec) then
332
// the above test doesn't work over rings like C or Qp.
333
if Type(BaseRing(M)) in {FldRat, RngInt, FldNum, FldCyc, FldFin} then
334
// print "0 =/= coerced - x = ", x - PowerSeries(g,prec);
335
return false, error_message;
336
end if;
337
end if;
338
return true, g;
339
end function;
340
341
function CoerceSeqEnum(M,x)
342
val, el := IsCoercible(RSpace(M),x);
343
if val eq false then
344
return false,
345
"Illegal coercion.";
346
end if;
347
return true, CreateModularFormFromElement(M, el);
348
end function;
349
350
351
function CoerceModFrmElt(M,x)
352
if BaseRing(Parent(x)) cmpne BaseRing(M) then
353
return false, "Incompatible base rings.";
354
end if;
355
if IsRingOfAllModularForms(M) then
356
y := CopyOfModFrmElt(x);
357
y`parent := M;
358
delete y`element;
359
return true, y;
360
end if;
361
if Parent(x) eq M then
362
return true, x;
363
end if;
364
if Parent(x) subset M then
365
g := PowerSeries(x,PrecisionBound(M : Exact := false));
366
return IsCoercible(M,g);
367
end if;
368
if IsRingOfAllModularForms(Parent(x)) then
369
return false, "Illegal coercion.";
370
end if;
371
372
if Weight(M) ne Weight(Parent(x)) then
373
return false, "Incompatible weights.";
374
end if;
375
N := LCM(Level(M),Level(Parent(x)));
376
if IsGamma0(M) and IsGamma0(Parent(x)) then
377
G := Gamma0(N);
378
else
379
G := Gamma1(N);
380
end if;
381
Mbig := BaseExtend(ModularForms(G,Weight(M)), BaseRing(M));
382
prec := PrecisionBound(Mbig : Exact := false);
383
t, z := IsCoercible(M, PowerSeries(x,prec));
384
if not t then
385
return false, "Cannot coerce modular form.";
386
else
387
return t, z;
388
end if;
389
end function;
390
391
intrinsic HackobjCoerceModFrm(M::ModFrm,x::.) -> BoolElt, ModFrmElt
392
{Coerce x into M.}
393
case Type(x):
394
when RngIntElt:
395
return CoerceRngIntElt(M,x);
396
when ModTupRngElt, ModTupFldElt:
397
return CoerceSeqEnum(M,Eltseq(x));
398
when SeqEnum:
399
return CoerceSeqEnum(M,x);
400
when RngSerPowElt:
401
return CoerceRngSerPowElt(M,x);
402
when ModFrmElt:
403
return CoerceModFrmElt(M,x);
404
else
405
return false, "Illegal coercion";
406
end case;
407
end intrinsic;
408
409
410
intrinsic BaseExtend(M::ModFrm, R::Rng) -> ModFrm, Map
411
{The base extension of M to the commutative ring R and the induced map
412
from M to BaseExtend(M,R). The only requirement on R is that
413
there is a natural coercion map from BaseRing(M) to R. For
414
example, when BaseRing(M) is the integers then any commutative
415
ring R is allowed.}
416
require IsCommutative(R) : "Argument 2 must be commutative.";
417
if R cmpeq BaseRing(M) then
418
return M;
419
end if;
420
phi := hom<BaseRing(M) -> R | x :-> R!x>;
421
return BaseExtend(M,phi);
422
end intrinsic;
423
424
425
intrinsic BaseExtend(M::ModFrm, phi::Map) -> ModFrm, Map
426
{The base extension of M to R using the map phi:BaseRing(M) --> R,
427
and the induced map from M to BaseExtend(M,R).}
428
require IsCommutative(Codomain(phi)) : "Argument 2 must be commutative.";
429
M_R := CopyOfDefiningModularFormsObject(M);
430
if Characteristic(Codomain(phi)) ne 0 then
431
delete M_R`default_precision;
432
end if;
433
M_R`base_ring := Codomain(phi);
434
M_R`base_extend_map := phi;
435
if Type(BaseRing(M_R)) ne RngInt then
436
M_R`associated_space_over_z := AssociatedSpaceOverZ(M);
437
end if;
438
if not IsAmbientSpace(M) then
439
M_R`ambient_space := BaseExtend(AmbientSpace(M),phi);
440
end if;
441
psi := hom<M -> M_R | x :-> M_R![phi(a) : a in Eltseq(x)]>;
442
return M_R, psi;
443
end intrinsic;
444
445
intrinsic DisownChildren(M::ModFrm)
446
{Ambient modular symbols spaces M can create circular references, which
447
cause the memory manager to never de-allocate M.
448
Calling DisownChildren forces the circular references created
449
by M to be deleted.}
450
if assigned M`ambient_space then
451
delete M`ambient_space;
452
end if;
453
454
if assigned M`cusp then
455
delete M`cusp;
456
end if;
457
458
if assigned M`eis then
459
delete M`eis;
460
end if;
461
462
if assigned M`new then
463
delete M`new;
464
end if;
465
466
if assigned M`cusp_new then
467
delete M`cusp_new;
468
end if;
469
470
if assigned M`eis_new then
471
delete M`eis_new;
472
end if;
473
474
if assigned M`cuspidal_subspace then
475
delete M`cuspidal_subspace;
476
end if;
477
478
if assigned M`new_subspace then
479
delete M`new_subspace;
480
end if;
481
482
if assigned M`eisenstein_subspace then
483
delete M`eisenstein_subspace;
484
end if;
485
486
if assigned M`mf_modular_symbols then
487
for x in M`mf_modular_symbols do
488
if Type(x) ne BoolElt then
489
for y in x do
490
DisownChildren(y);
491
end for;
492
end if;
493
end for;
494
end if;
495
496
if assigned M`newforms then
497
for group in M`newforms do
498
for f in group do
499
DisownChildren(Parent(f));
500
end for;
501
end for;
502
end if;
503
504
if assigned M`basis then
505
delete M`basis;
506
end if;
507
508
if not IsAmbientSpace(M) then
509
DisownChildren(AmbientSpace(M));
510
end if;
511
end intrinsic;
512