This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
/
abvar.py
5131 lines (4130 loc) · 176 KB
/
abvar.py
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
"""
Base class for modular abelian varieties
AUTHORS:
- William Stein (2007-03)
TESTS::
sage: A = J0(33)
sage: D = A.decomposition(); D
[
Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33),
Simple abelian subvariety 11a(3,33) of dimension 1 of J0(33),
Simple abelian subvariety 33a(1,33) of dimension 1 of J0(33)
]
sage: loads(dumps(D)) == D
True
sage: loads(dumps(A)) == A
True
"""
from __future__ import absolute_import
#*****************************************************************************
# Copyright (C) 2007 William Stein <wstein@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from sage.categories.all import ModularAbelianVarieties
from sage.structure.sequence import Sequence, Sequence_generic
from sage.structure.parent_base import ParentWithBase
from .morphism import HeckeOperator, Morphism, DegeneracyMap
from .torsion_subgroup import RationalTorsionSubgroup, QQbarTorsionSubgroup
from .finite_subgroup import (FiniteSubgroup_lattice, FiniteSubgroup, TorsionPoint)
from .cuspidal_subgroup import CuspidalSubgroup, RationalCuspidalSubgroup, RationalCuspSubgroup
from sage.rings.all import ZZ, QQ, QQbar, Integer
from sage.arith.all import LCM, divisors, prime_range, next_prime
from sage.rings.ring import is_Ring
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.polynomial.polynomial_element import Polynomial
from sage.rings.infinity import infinity
from sage.rings.fraction_field import FractionField
from sage.modules.free_module import is_FreeModule
from sage.modular.arithgroup.all import is_CongruenceSubgroup, is_Gamma0, is_Gamma1, is_GammaH
from sage.modular.modsym.all import ModularSymbols
from sage.modular.modsym.space import ModularSymbolsSpace
from sage.modular.modform.constructor import Newform
from sage.matrix.all import matrix, block_diagonal_matrix, identity_matrix
from sage.modules.all import vector
from sage.groups.all import AbelianGroup
from sage.databases.cremona import cremona_letter_code
from sage.misc.all import prod
from sage.arith.misc import is_prime
from sage.databases.cremona import CremonaDatabase
from sage.schemes.elliptic_curves.constructor import EllipticCurve
from sage.sets.primes import Primes
from sage.functions.other import real
from copy import copy
from . import homspace
from . import lseries
def is_ModularAbelianVariety(x):
"""
Return True if x is a modular abelian variety.
INPUT:
- ``x`` - object
EXAMPLES::
sage: from sage.modular.abvar.abvar import is_ModularAbelianVariety
sage: is_ModularAbelianVariety(5)
False
sage: is_ModularAbelianVariety(J0(37))
True
Returning True is a statement about the data type not whether or
not some abelian variety is modular::
sage: is_ModularAbelianVariety(EllipticCurve('37a'))
False
"""
return isinstance(x, ModularAbelianVariety_abstract)
class ModularAbelianVariety_abstract(ParentWithBase):
def __init__(self, groups, base_field, is_simple=None, newform_level=None,
isogeny_number=None, number=None, check=True):
"""
Abstract base class for modular abelian varieties.
INPUT:
- ``groups`` - a tuple of congruence subgroups
- ``base_field`` - a field
- ``is_simple`` - bool; whether or not self is
simple
- ``newform_level`` - if self is isogenous to a
newform abelian variety, returns the level of that abelian variety
- ``isogeny_number`` - which isogeny class the
corresponding newform is in; this corresponds to the Cremona letter
code
- ``number`` - the t number of the degeneracy map that
this abelian variety is the image under
- ``check`` - whether to do some type checking on the
defining data
EXAMPLES: One should not create an instance of this class, but we
do so anyways here as an example::
sage: A = sage.modular.abvar.abvar.ModularAbelianVariety_abstract((Gamma0(37),), QQ)
sage: type(A)
<class 'sage.modular.abvar.abvar.ModularAbelianVariety_abstract_with_category'>
All hell breaks loose if you try to do anything with `A`::
sage: A
<repr(<sage.modular.abvar.abvar.ModularAbelianVariety_abstract_with_category at 0x...>) failed: NotImplementedError: BUG -- lattice method must be defined in derived class>
All instances of this class are in the category of modular
abelian varieties::
sage: A.category()
Category of modular abelian varieties over Rational Field
sage: J0(23).category()
Category of modular abelian varieties over Rational Field
"""
if check:
if not isinstance(groups, tuple):
raise TypeError("groups must be a tuple")
for G in groups:
if not is_CongruenceSubgroup(G):
raise TypeError("each element of groups must be a congruence subgroup")
self.__groups = groups
if is_simple is not None:
self.__is_simple = is_simple
if newform_level is not None:
self.__newform_level = newform_level
if number is not None:
self.__degen_t = number
if isogeny_number is not None:
self.__isogeny_number = isogeny_number
if check and not is_Ring(base_field) and base_field.is_field():
raise TypeError("base_field must be a field")
ParentWithBase.__init__(self, base_field, category = ModularAbelianVarieties(base_field))
def groups(self):
r"""
Return an ordered tuple of the congruence subgroups that the
ambient product Jacobian is attached to.
Every modular abelian variety is a finite quotient of an abelian
subvariety of a product of modular Jacobians `J_\Gamma`.
This function returns a tuple containing the groups
`\Gamma`.
EXAMPLES::
sage: A = (J0(37) * J1(13))[0]; A
Simple abelian subvariety 13aG1(1,13) of dimension 2 of J0(37) x J1(13)
sage: A.groups()
(Congruence Subgroup Gamma0(37), Congruence Subgroup Gamma1(13))
"""
return self.__groups
def is_J0(self):
"""
Return whether of not self is of the form J0(N).
OUTPUT: bool
EXAMPLES::
sage: J0(23).is_J0()
True
sage: J1(11).is_J0()
False
sage: (J0(23) * J1(11)).is_J0()
False
sage: J0(37)[0].is_J0()
False
sage: (J0(23) * J0(21)).is_J0()
False
"""
return len(self.groups()) == 1 and is_Gamma0(self.groups()[0]) \
and self.is_ambient()
def is_J1(self):
"""
Return whether of not self is of the form J1(N).
OUTPUT: bool
EXAMPLES::
sage: J1(23).is_J1()
True
sage: J0(23).is_J1()
False
sage: (J1(11) * J1(13)).is_J1()
False
sage: (J1(11) * J0(13)).is_J1()
False
sage: J1(23)[0].is_J1()
False
"""
return len(self.groups()) == 1 and is_Gamma1(self.groups()[0]) \
and self.is_ambient()
#############################################################################
# lattice() *must* be defined by every derived class!!!!
def lattice(self):
"""
Return lattice in ambient cuspidal modular symbols product that
defines this modular abelian variety.
This must be defined in each derived class.
OUTPUT: a free module over `\ZZ`
EXAMPLES::
sage: A = sage.modular.abvar.abvar.ModularAbelianVariety_abstract((Gamma0(37),), QQ)
sage: A
<repr(<sage.modular.abvar.abvar.ModularAbelianVariety_abstract_with_category at 0x...>) failed: NotImplementedError: BUG -- lattice method must be defined in derived class>
"""
raise NotImplementedError("BUG -- lattice method must be defined in derived class")
#############################################################################
def free_module(self):
r"""
Synonym for ``self.lattice()``.
OUTPUT: a free module over `\ZZ`
EXAMPLES::
sage: J0(37).free_module()
Ambient free module of rank 4 over the principal ideal domain Integer Ring
sage: J0(37)[0].free_module()
Free module of degree 4 and rank 2 over Integer Ring
Echelon basis matrix:
[ 1 -1 1 0]
[ 0 0 2 -1]
"""
return self.lattice()
def vector_space(self):
r"""
Return vector space corresponding to the modular abelian variety.
This is the lattice tensored with `\QQ`.
EXAMPLES::
sage: J0(37).vector_space()
Vector space of dimension 4 over Rational Field
sage: J0(37)[0].vector_space()
Vector space of degree 4 and dimension 2 over Rational Field
Basis matrix:
[ 1 -1 0 1/2]
[ 0 0 1 -1/2]
"""
try:
return self.__vector_space
except AttributeError:
self.__vector_space = self.lattice().change_ring(QQ)
return self.__vector_space
def base_field(self):
r"""
Synonym for ``self.base_ring()``.
EXAMPLES::
sage: J0(11).base_field()
Rational Field
"""
return self.base_ring()
def base_extend(self, K):
"""
EXAMPLES::
sage: A = J0(37); A
Abelian variety J0(37) of dimension 2
sage: A.base_extend(QQbar)
Abelian variety J0(37) over Algebraic Field of dimension 2
sage: A.base_extend(GF(7))
Abelian variety J0(37) over Finite Field of size 7 of dimension 2
"""
N = self.__newform_level if hasattr(self, '__newform_level') else None
return ModularAbelianVariety(self.groups(), self.lattice(), K, newform_level=N)
def __contains__(self, x):
"""
Determine whether or not self contains x.
EXAMPLES::
sage: J = J0(67); G = (J[0] + J[1]).intersection(J[1] + J[2])
sage: G[0]
Finite subgroup with invariants [5, 10] over QQbar of Abelian subvariety of dimension 3 of J0(67)
sage: a = G[0].0; a
[(1/10, 1/10, 3/10, 1/2, 1, -2, -3, 33/10, 0, -1/2)]
sage: a in J[0]
False
sage: a in (J[0]+J[1])
True
sage: a in (J[1]+J[2])
True
sage: C = G[1] # abelian variety in kernel
sage: G[0].0
[(1/10, 1/10, 3/10, 1/2, 1, -2, -3, 33/10, 0, -1/2)]
sage: 5*G[0].0
[(1/2, 1/2, 3/2, 5/2, 5, -10, -15, 33/2, 0, -5/2)]
sage: 5*G[0].0 in C
True
"""
if not isinstance(x, TorsionPoint):
return False
if x.parent().abelian_variety().groups() != self.groups():
return False
v = x.element()
n = v.denominator()
nLambda = self.ambient_variety().lattice().scale(n)
return n*v in self.lattice() + nLambda
def __cmp__(self, other):
"""
Compare two modular abelian varieties.
If other is not a modular abelian variety, compares the types of
self and other. If other is a modular abelian variety, compares the
groups, then if those are the same, compares the newform level and
isogeny class number and degeneracy map numbers. If those are not
defined or matched up, compare the underlying lattices.
EXAMPLES::
sage: cmp(J0(37)[0], J0(37)[1])
-1
sage: cmp(J0(33)[0], J0(33)[1])
-1
sage: cmp(J0(37), 5) #random
1
"""
if not isinstance(other, ModularAbelianVariety_abstract):
return cmp(type(self), type(other))
if self is other:
return 0
c = cmp(self.groups(), other.groups())
if c: return c
try:
c = cmp(self.__newform_level, other.__newform_level)
if c: return c
except AttributeError:
pass
try:
c = cmp(self.__isogeny_number, other.__isogeny_number)
if c: return c
except AttributeError:
pass
try:
c = cmp(self.__degen_t, other.__degen_t)
if c: return c
except AttributeError:
pass
# NOTE!! having the same newform level, isogeny class number,
# and degen_t does not imply two abelian varieties are equal.
# See the docstring for self.label.
return cmp(self.lattice(), other.lattice())
def __radd__(self,other):
"""
Return other + self when other is 0. Otherwise raise a TypeError.
EXAMPLES::
sage: int(0) + J0(37)
Abelian variety J0(37) of dimension 2
"""
if other == 0:
return self
raise TypeError
def _repr_(self):
"""
Return string representation of this modular abelian variety.
This is just the generic base class, so it's unlikely to be called
in practice.
EXAMPLES::
sage: A = J0(23)
sage: import sage.modular.abvar.abvar as abvar
sage: abvar.ModularAbelianVariety_abstract._repr_(A)
'Abelian variety J0(23) of dimension 2'
::
sage: (J0(11) * J0(33))._repr_()
'Abelian variety J0(11) x J0(33) of dimension 4'
"""
field = '' if self.base_field() == QQ else ' over %s'%self.base_field()
#if self.newform_level(none_if_not_known=True) is None:
simple = self.is_simple(none_if_not_known=True)
if simple and self.dimension() > 0:
label = self.label() + ' '
else:
label = ''
simple = 'Simple a' if simple else 'A'
if self.is_ambient():
return '%sbelian variety %s%s of dimension %s'%(simple, self._ambient_repr(), field, self.dimension())
if self.is_subvariety_of_ambient_jacobian():
sub = 'subvariety'
else:
sub = 'variety factor'
return "%sbelian %s %sof dimension %s of %s%s"%(
simple, sub, label, self.dimension(), self._ambient_repr(), field)
def label(self):
r"""
Return the label associated to this modular abelian variety.
The format of the label is [level][isogeny class][group](t, ambient
level)
If this abelian variety `B` has the above label, this
implies only that `B` is isogenous to the newform abelian
variety `A_f` associated to the newform with label
[level][isogeny class][group]. The [group] is empty for
`\Gamma_0(N)`, is G1 for `\Gamma_1(N)` and is
GH[...] for `\Gamma_H(N)`.
.. warning::
The sum of `\delta_s(A_f)` for all `s\mid t`
contains `A`, but no sum for a proper divisor of
`t` contains `A`. It need *not* be the case
that `B` is equal to `\delta_t(A_f)`!!!
OUTPUT: string
EXAMPLES::
sage: J0(11).label()
'11a(1,11)'
sage: J0(11)[0].label()
'11a(1,11)'
sage: J0(33)[2].label()
'33a(1,33)'
sage: J0(22).label()
Traceback (most recent call last):
...
ValueError: self must be simple
We illustrate that self need not equal `\delta_t(A_f)`::
sage: J = J0(11); phi = J.degeneracy_map(33, 1) + J.degeneracy_map(33,3)
sage: B = phi.image(); B
Abelian subvariety of dimension 1 of J0(33)
sage: B.decomposition()
[
Simple abelian subvariety 11a(3,33) of dimension 1 of J0(33)
]
sage: C = J.degeneracy_map(33,3).image(); C
Abelian subvariety of dimension 1 of J0(33)
sage: C == B
False
"""
degen = str(self.degen_t()).replace(' ','')
return '%s%s'%(self.newform_label(), degen)
def newform(self, names=None):
"""
Return the newform `f` such that this abelian variety is isogenous to
the newform abelian variety `A_f`. If this abelian variety is not
simple, raise a ValueError.
INPUT:
- ``names`` -- (default: None) If the newform has coefficients in a
number field, then a generator name must be specified.
OUTPUT: A newform `f` so that self is isogenous to `A_f`.
EXAMPLES::
sage: J0(11).newform()
q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6)
sage: f = J0(23).newform(names='a')
sage: AbelianVariety(f) == J0(23)
True
sage: J = J0(33)
sage: [s.newform('a') for s in J.decomposition()]
[q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6),
q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6),
q + q^2 - q^3 - q^4 - 2*q^5 + O(q^6)]
The following fails since `J_0(33)` is not simple::
sage: J0(33).newform()
Traceback (most recent call last):
...
ValueError: self must be simple
"""
return Newform(self.newform_label(), names=names)
def newform_decomposition(self, names=None):
"""
Return the newforms of the simple subvarieties in the decomposition of
self as a product of simple subvarieties, up to isogeny.
OUTPUT:
- an array of newforms
EXAMPLES::
sage: J = J1(11) * J0(23)
sage: J.newform_decomposition('a')
[q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6),
q + a0*q^2 + (-2*a0 - 1)*q^3 + (-a0 - 1)*q^4 + 2*a0*q^5 + O(q^6)]
"""
return [S.newform(names=names) for S in self.decomposition()]
def newform_label(self):
"""
Return the label [level][isogeny class][group] of the newform
`f` such that this abelian variety is isogenous to the
newform abelian variety `A_f`. If this abelian variety is
not simple, raise a ValueError.
OUTPUT: string
EXAMPLES::
sage: J0(11).newform_label()
'11a'
sage: J0(33)[2].newform_label()
'33a'
The following fails since `J_0(33)` is not simple::
sage: J0(33).newform_label()
Traceback (most recent call last):
...
ValueError: self must be simple
"""
N, G = self.newform_level()
if is_Gamma0(G):
group = ''
elif is_Gamma1(G):
group = 'G1'
elif is_GammaH(G):
group = 'GH%s'%(str(G._generators_for_H()).replace(' ',''))
return '%s%s%s'%(N, cremona_letter_code(self.isogeny_number()), group)
def elliptic_curve(self):
"""
Return an elliptic curve isogenous to self. If self is not dimension 1
with rational base ring, raise a ValueError.
The elliptic curve is found by looking it up in the CremonaDatabase.
The CremonaDatabase contains all curves up to some large conductor. If
a curve is not found in the CremonaDatabase, a RuntimeError will be
raised. In practice, only the most committed users will see this
RuntimeError.
OUTPUT: an elliptic curve isogenous to self.
EXAMPLES::
sage: J = J0(11)
sage: J.elliptic_curve()
Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
sage: J = J0(49)
sage: J.elliptic_curve()
Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 2*x - 1 over Rational Field
sage: A = J0(37)[1]
sage: E = A.elliptic_curve()
sage: A.lseries()(1)
0.725681061936153
sage: E.lseries()(1)
0.725681061936153
Elliptic curves are of dimension 1. ::
sage: J = J0(23)
sage: J.elliptic_curve()
Traceback (most recent call last):
...
ValueError: self must be of dimension 1
This is only implemented for curves over QQ. ::
sage: J = J0(11).change_ring(CC)
sage: J.elliptic_curve()
Traceback (most recent call last):
...
ValueError: base ring must be QQ
"""
if self.dimension() > 1:
raise ValueError("self must be of dimension 1")
if self.base_ring() != QQ:
raise ValueError("base ring must be QQ")
f = self.newform('a')
N = f.level()
c = CremonaDatabase()
if N > c.largest_conductor():
raise RuntimeError("Elliptic curve not found" +
" in installed database")
isogeny_classes = c.isogeny_classes(N)
curves = [EllipticCurve(x[0][0]) for x in isogeny_classes]
if len(curves) == 1:
return curves[0]
for p in Primes():
for E in curves:
if E.ap(p) != f.coefficient(p):
curves.remove(E)
if len(curves) == 1:
return curves[0]
def _isogeny_to_newform_abelian_variety(self):
r"""
Return an isogeny from self to an abelian variety `A_f`
attached to a newform. If self is not simple (so that no such
isogeny exists), raise a ValueError.
EXAMPLES::
sage: J0(22)[0]._isogeny_to_newform_abelian_variety()
Abelian variety morphism:
From: Simple abelian subvariety 11a(1,22) of dimension 1 of J0(22)
To: Newform abelian subvariety 11a of dimension 1 of J0(11)
sage: J = J0(11); phi = J.degeneracy_map(33, 1) + J.degeneracy_map(33,3)
sage: A = phi.image()
sage: A._isogeny_to_newform_abelian_variety().matrix()
[-3 3]
[ 0 -3]
"""
try:
return self._newform_isogeny
except AttributeError:
pass
if not self.is_simple():
raise ValueError("self is not simple")
ls = []
t, N = self.decomposition()[0].degen_t()
A = self.ambient_variety()
for i in range(len(self.groups())):
g = self.groups()[i]
if N == g.level():
J = g.modular_abelian_variety()
d = J.degeneracy_map(self.newform_level()[0], t)
p = A.project_to_factor(i)
mat = p.matrix() * d.matrix()
if not (self.lattice().matrix() * mat).is_zero():
break
from .constructor import AbelianVariety
Af = AbelianVariety(self.newform_label())
H = A.Hom(Af.ambient_variety())
m = H(Morphism(H, mat))
self._newform_isogeny = m.restrict_domain(self).restrict_codomain(Af)
return self._newform_isogeny
def _simple_isogeny(self, other):
"""
Given self and other, if both are simple, and correspond to the
same newform with the same congruence subgroup, return an isogeny.
Otherwise, raise a ValueError.
INPUT:
- ``self, other`` - modular abelian varieties
OUTPUT: an isogeny
EXAMPLES::
sage: J = J0(33); J
Abelian variety J0(33) of dimension 3
sage: J[0]._simple_isogeny(J[1])
Abelian variety morphism:
From: Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33)
To: Simple abelian subvariety 11a(3,33) of dimension 1 of J0(33)
The following illustrates how simple isogeny is only implemented
when the ambients are the same::
sage: J[0]._simple_isogeny(J1(11))
Traceback (most recent call last):
...
NotImplementedError: _simple_isogeny only implemented when both abelian variety have the same ambient product Jacobian
"""
if not is_ModularAbelianVariety(other):
raise TypeError("other must be a modular abelian variety")
if not self.is_simple():
raise ValueError("self is not simple")
if not other.is_simple():
raise ValueError("other is not simple")
if self.groups() != other.groups():
# The issue here is that the stuff below probably won't make any sense at all if we don't know
# that the two newform abelian varieties $A_f$ are identical.
raise NotImplementedError("_simple_isogeny only implemented when both abelian variety have the same ambient product Jacobian")
if (self.newform_level() != other.newform_level()) or \
(self.isogeny_number() != other.isogeny_number()):
raise ValueError("self and other do not correspond to the same newform")
return other._isogeny_to_newform_abelian_variety().complementary_isogeny() * \
self._isogeny_to_newform_abelian_variety()
def _Hom_(self, B, cat=None):
"""
INPUT:
- ``B`` - modular abelian varieties
- ``cat`` - category
EXAMPLES::
sage: J0(37)._Hom_(J1(37))
Space of homomorphisms from Abelian variety J0(37) of dimension 2 to Abelian variety J1(37) of dimension 40
sage: J0(37)._Hom_(J1(37)).homset_category()
Category of modular abelian varieties over Rational Field
"""
if cat is None:
K = self.base_field()
L = B.base_field()
if K == L:
F = K
elif K == QQbar or L == QQbar:
F = QQbar
else:
# TODO -- improve this
raise ValueError("please specify a category")
cat = ModularAbelianVarieties(F)
if self is B:
return self.endomorphism_ring(cat)
else:
return homspace.Homspace(self, B, cat)
def in_same_ambient_variety(self, other):
"""
Return True if self and other are abelian subvarieties of the same
ambient product Jacobian.
EXAMPLES::
sage: A,B,C = J0(33)
sage: A.in_same_ambient_variety(B)
True
sage: A.in_same_ambient_variety(J0(11))
False
"""
if not is_ModularAbelianVariety(other):
return False
if self.groups() != other.groups():
return False
if not self.is_subvariety_of_ambient_jacobian() or not other.is_subvariety_of_ambient_jacobian():
return False
return True
def modular_kernel(self):
"""
Return the modular kernel of this abelian variety, which is the
kernel of the canonical polarization of self.
EXAMPLES::
sage: A = AbelianVariety('33a'); A
Newform abelian subvariety 33a of dimension 1 of J0(33)
sage: A.modular_kernel()
Finite subgroup with invariants [3, 3] over QQ of Newform abelian subvariety 33a of dimension 1 of J0(33)
"""
try:
return self.__modular_kernel
except AttributeError:
_, f, _ = self.dual()
G = f.kernel()[0]
self.__modular_kernel = G
return G
def modular_degree(self):
"""
Return the modular degree of this abelian variety, which is the
square root of the degree of the modular kernel.
EXAMPLES::
sage: A = AbelianVariety('37a')
sage: A.modular_degree()
2
"""
n = self.modular_kernel().order()
return ZZ(n.sqrt())
def intersection(self, other):
"""
Return the intersection of self and other inside a common ambient
Jacobian product.
INPUT:
- ``other`` - a modular abelian variety or a finite
group
OUTPUT: If other is a modular abelian variety:
- ``G`` - finite subgroup of self
- ``A`` - abelian variety (identity component of
intersection) If other is a finite group:
- ``G`` - a finite group
EXAMPLES: We intersect some abelian varieties with finite
intersection.
::
sage: J = J0(37)
sage: J[0].intersection(J[1])
(Finite subgroup with invariants [2, 2] over QQ of Simple abelian subvariety 37a(1,37) of dimension 1 of J0(37), Simple abelian subvariety of dimension 0 of J0(37))
::
sage: D = list(J0(65)); D
[Simple abelian subvariety 65a(1,65) of dimension 1 of J0(65), Simple abelian subvariety 65b(1,65) of dimension 2 of J0(65), Simple abelian subvariety 65c(1,65) of dimension 2 of J0(65)]
sage: D[0].intersection(D[1])
(Finite subgroup with invariants [2] over QQ of Simple abelian subvariety 65a(1,65) of dimension 1 of J0(65), Simple abelian subvariety of dimension 0 of J0(65))
sage: (D[0]+D[1]).intersection(D[1]+D[2])
(Finite subgroup with invariants [2] over QQbar of Abelian subvariety of dimension 3 of J0(65), Abelian subvariety of dimension 2 of J0(65))
::
sage: J = J0(33)
sage: J[0].intersection(J[1])
(Finite subgroup with invariants [5] over QQ of Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33), Simple abelian subvariety of dimension 0 of J0(33))
Next we intersect two abelian varieties with non-finite
intersection::
sage: J = J0(67); D = J.decomposition(); D
[
Simple abelian subvariety 67a(1,67) of dimension 1 of J0(67),
Simple abelian subvariety 67b(1,67) of dimension 2 of J0(67),
Simple abelian subvariety 67c(1,67) of dimension 2 of J0(67)
]
sage: (D[0] + D[1]).intersection(D[1] + D[2])
(Finite subgroup with invariants [5, 10] over QQbar of Abelian subvariety of dimension 3 of J0(67), Abelian subvariety of dimension 2 of J0(67))
"""
# First check whether we are intersecting an abelian variety
# with a finite subgroup. If so, call the intersection method
# for the finite group, which does know how to intersect with
# an abelian variety.
if isinstance(other, FiniteSubgroup):
return other.intersection(self)
# Now both self and other are abelian varieties. We require
# at least that the ambient Jacobian product is the same for
# them.
if not self.in_same_ambient_variety(other):
raise TypeError("other must be an abelian variety in the same ambient space")
# 1. Compute the abelian variety (connected) part of the intersection
V = self.vector_space().intersection(other.vector_space())
if V.dimension() > 0:
# If there is a nonzero abelian variety, get the actual
# lattice that defines it. We intersect (=saturate) in
# the sum of the lattices, to ensure that the intersection
# is an abelian subvariety of both self and other (even if
# they aren't subvarieties of the ambient Jacobian).
lattice = V.intersection(self.lattice() + other.lattice())
A = ModularAbelianVariety(self.groups(), lattice, self.base_field(), check=False)
else:
A = self.zero_subvariety()
# 2. Compute the finite intersection group when the
# intersection is finite, or a group that maps surjectively
# onto the component group in general.
# First we get basis matrices for the lattices that define
# both abelian varieties.
L = self.lattice().basis_matrix()
M = other.lattice().basis_matrix()
# Then we stack matrices and find a subset that forms a
# basis.
LM = L.stack(M)
P = LM.pivot_rows()
V = (ZZ**L.ncols()).span_of_basis([LM.row(p) for p in P])
S = (self.lattice() + other.lattice()).saturation()
n = self.lattice().rank()
# Finally we project onto the L factor.
gens = [L.linear_combination_of_rows(v.list()[:n])
for v in V.coordinate_module(S).basis()]
if A.dimension() > 0:
finitegroup_base_field = QQbar
else:
finitegroup_base_field = self.base_field()
G = self.finite_subgroup(gens, field_of_definition=finitegroup_base_field)
return G, A
def __add__(self, other):
r"""
Return the sum of the *images* of self and other inside the
ambient Jacobian product. self and other must be abelian
subvarieties of the ambient Jacobian product.
..warning::
The sum of course only makes sense in some ambient variety,
and by definition this function takes the sum of the images
of both self and other in the ambient product Jacobian.
EXAMPLES: We compute the sum of two abelian varieties of
`J_0(33)`::
sage: J = J0(33)
sage: J[0] + J[1]
Abelian subvariety of dimension 2 of J0(33)
We sum all three and get the full `J_0(33)`::
sage: (J[0] + J[1]) + (J[1] + J[2])
Abelian variety J0(33) of dimension 3
Adding to zero works::
sage: J[0] + 0
Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33)
Hence the sum command works::
sage: sum([J[0], J[2]])
Abelian subvariety of dimension 2 of J0(33)
We try to add something in `J_0(33)` to something in