Path: blob/master/sage/schemes/elliptic_curves/gal_reps.py
4156 views
# -*- coding: utf-8 -*-1r"""2Galois representations attached to elliptic curves34Given an elliptic curve `E` over a number field `K`5and a rational prime number `p`, the `p^n`-torsion6`E[p^n]` points of `E` is a representation of the7absolute Galois group `G_K` of `K`. As `n` varies8we obtain the Tate module `T_p E` which is a9a representation of `G_K` on a free `\ZZ_p`-module10of rank `2`. As `p` varies the representations11are compatible.1213So far only the case `K =\QQ` is implemented.14Currently sage can decide whether the Galois module15`E[p]` is reducible, i.e. if `E` admits an isogeny16of degree `p`, and whether the image of17the representation on `E[p]` is surjective onto18`\text{Aut}(E[p]) = GL_2(\mathbb{F}_p)`.1920The following are the most useful functions for the class ``GaloisRepresentation``.2122For the reducibility:2324- ``is_reducible(p)``25- ``is_irreducible(p)``26- ``reducible_primes()``2728For the image:2930- ``is_surjective(p)``31- ``non_surjective()``32- ``image_type(p)``3334For the classification of the representation3536- ``is_semistable(p)``37- ``is_unramified(p, ell)``38- ``is_crystalline(p)``3940EXAMPLES::4142sage: E = EllipticCurve('196a1')43sage: rho = E.galois_representation()44sage: rho.is_irreducible(7)45True46sage: rho.is_reducible(3)47True48sage: rho.is_irreducible(2)49True50sage: rho.is_surjective(2)51False52sage: rho.is_surjective(3)53False54sage: rho.is_surjective(5)55True56sage: rho.reducible_primes()57[3]58sage: rho.non_surjective()59[2, 3]60sage: rho.image_type(2)61'The image is cyclic of order 3.'62sage: rho.image_type(3)63'The image is contained in a Borel subgroup as there is a 3-isogeny.'64sage: rho.image_type(5)65'The image is all of GL_2(F_5).'6667For semi-stable curve it is known that the representation is68surjective if and only if it is irreducible::6970sage: E = EllipticCurve('11a1')71sage: rho = E.galois_representation()72sage: rho.non_surjective()73[5]74sage: rho.reducible_primes()75[5]767778For cm curves it is not true that there are only finitely many primes for which the79Galois representation mod p is surjective onto `GL_2(\mathbb{F}_p)`::8081sage: E = EllipticCurve('27a1')82sage: rho = E.galois_representation()83sage: rho.non_surjective()84[0]85sage: rho.reducible_primes()86[3]87sage: E.has_cm()88True89sage: rho.image_type(11)90'The image is contained in the normalizer of a non-split Cartan group. (cm)'9192REFERENCES:9394.. [Se1] Jean-Pierre Serre,95Propriétés galoisiennes des points d'ordre fini96des courbes elliptiques.97Invent. Math. 15 (1972), no. 4, 259--331.98.. [Se2] Jean-Pierre Serre,99Sur les représentations modulaires de degré1002 de `\text{Gal}(\bar\QQ/\QQ)`.101Duke Math. J. 54 (1987), no. 1, 179--230.102.. [Co] Alina Carmen Cojocaru,103On the surjectivity of the Galois representations104associated to non-CM elliptic curves.105With an appendix by Ernst Kani.106Canad. Math. Bull. 48 (2005), no. 1, 16--31.107108109AUTHORS:110111- chris wuthrich (02/10) - moved from ell_rational_field.py.112113"""114115######################################################################116# Copyright (C) 2010 William Stein <[email protected]>117#118# Distributed under the terms of the GNU General Public License (GPL)119#120# This code is distributed in the hope that it will be useful,121# but WITHOUT ANY WARRANTY; without even the implied warranty of122# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU123# General Public License for more details.124#125# The full text of the GPL is available at:126#127# http://www.gnu.org/licenses/128######################################################################129130from sage.structure.sage_object import SageObject131import sage.rings.arith as arith132import sage.misc.misc as misc133import sage.rings.all as rings134from sage.rings.all import RealField, GF135from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing136137from math import sqrt138from sage.libs.pari.all import pari139140def _ex_set(p):141"""142Gives the set of the only values of trace^2/det143that appear in a exceptional subgroup in PGL_2(F_p)144145EXAMPLES::146147sage: from sage.schemes.elliptic_curves.gal_reps import _ex_set148sage: for p in prime_range(3,30): print p, _ex_set(p)1493 [0, 1, 2, 1]1505 [0, 1, 2, 4]1517 [0, 1, 2, 4]15211 [0, 1, 2, 4, 9, 5]15313 [0, 1, 2, 4]15417 [0, 1, 2, 4]15519 [0, 1, 2, 4, 16, 6]15623 [0, 1, 2, 4]15729 [0, 1, 2, 4, 25, 7]158"""159k = GF(p)160res = [ k(0), k(1), k(2), k(4) ]161R = k['X']162f = R([1,-3,1]) #(X**2 - 3*X+1)163ro = f.roots()164for a in ro:165if a[0] not in res:166res.append(a[0])167return res168169# these two function could be moved to a better place later170171def _splitting_field(f):172"""173Given a polynomial over `\QQ`, this returns the splitting field (as an absolute field over `\QQ`.174175EXAMPLES::176177sage: from sage.schemes.elliptic_curves.gal_reps import _splitting_field178sage: R.<X> = QQ[]179sage: f = X^2 + 1180sage: _splitting_field(f)181Number Field in b with defining polynomial X^2 + 1182sage: f = (X^6-1)*(X^4+1)183sage: _splitting_field(f)184Number Field in b with defining polynomial x^8 + 4*x^7 + 10*x^6 + 16*x^5 + 21*x^4 + 20*x^3 + 4*x^2 - 4*x + 1185sage: f = X^3 - 4*X^2 - 160*X - 1264186sage: _splitting_field(f)187Number Field in b with defining polynomial x^6 - 992*x^4 + 246016*x^2 + 41229056188189sage: f3 = 4*X^3 - 4*X^2 - 40*X - 79190sage: _splitting_field(f3)191Number Field in b with defining polynomial x^6 - 992*x^4 + 246016*x^2 + 41229056192193sage: f3 = 4*X^3 - 4*X^2 - 40*X - 79194sage: _splitting_field(f3/4)195Number Field in b with defining polynomial x^6 - 992*x^4 + 246016*x^2 + 41229056196197"""198from sage.rings.all import QQ199from sage.misc.flatten import flatten200# make an integral monic polynomial out of it201d = f.denominator()202f = d*f203R = PolynomialRing(QQ,'X')204f = R(f)205X = R.gens()[0]206an = f.leading_coefficient()207f = an**(f.degree() - 1) * f(X/an)208if an != 1:209misc.verbose("polynomial changed to %s"%f,3)210211fs = [ff[0] for ff in f.factor() if ff[0].degree() > 1 ]212while fs != []:213K = fs[0].root_field('a')214R = PolynomialRing(K,'X')215fs = [R(f) for f in fs]216K = K.absolute_field('b')217inc = K.structure()[1]218misc.verbose("degree of the field is now %s"%K.degree(), 2)219R = PolynomialRing(K,'X')220fs = [R([inc(u) for u in g.coeffs()]) for g in fs]221fs = [[ff[0] for ff in g.factor() if ff[0].degree() > 1] for g in fs]222fs = flatten(fs)223return K224225def _division_field(E,p):226"""227Given an elliptic curve and a prime `p`, this constructs the field `\QQ(E[p])`.228229Note this takes a LONG time when p is large or when the representation is surjective.230231EXAMPLES::232233sage: from sage.schemes.elliptic_curves.gal_reps import _division_field234sage: E = EllipticCurve('14a1')235sage: _division_field(E,2)236Number Field in b with defining polynomial X^2 + 5*X + 92237sage: _division_field(E,3)238Number Field in b with defining polynomial X^2 + 6*X + 117239240sage: E = EllipticCurve('11a1')241sage: K = _division_field(E,5); K242Number Field in b with defining polynomial x^4 + 5*x^3 + 275*x^2 + 5125*x + 63125243sage: E.base_extend(K).torsion_subgroup()244Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in b with defining polynomial x^4 + 5*x^3 + 275*x^2 + 5125*x + 63125245246sage: E = EllipticCurve('27a1')247sage: _division_field(E,3)248Number Field in b with defining polynomial X^2 + 9*X + 81249sage: _division_field(E,2)250Number Field in b with defining polynomial x^6 + 5038848251sage: E = EllipticCurve('27a1')252sage: L = _division_field(E,5); L # long time (4s on sage.math, 2011)253Number Field in b with defining polynomial x^48 + 24*x^47 - 2634*x^46 - 64906*x^45 + 2726775*x^44 + 70841232*x^43 + 224413842693*x^42 + 4701700599732*x^41 - 3592508072137596/5*x^40 - 15012293781179144*x^39 + 968283011174870355*x^38 + 20267256109653557724*x^37 + 12067484020318191883430*x^36 + 1074616923704149785005406/5*x^35 - 36733858365780941833244052*x^34 - 645743028366047451133249842*x^33 + 220969510763490262549458235143/5*x^32 + 3821508904338000023273602548048/5*x^31 - 116959091827892505647463476639056/5*x^30 - 410999736248972608356551138775366*x^29 - 14893829970063945547808915701339152/5*x^28 - 65364599206437988881942239704947194/5*x^27 + 67673426654602996794997806980859832818/5*x^26 + 881882930983056033772717698410508954006/5*x^25 - 222881687343119655077359346112642829420824/25*x^24 - 2895120823335191010101881263518064564214338/25*x^23 + 45001727573606034388747893503112487075055856/25*x^22 + 123791333776720160716501836669886842723129232/5*x^21 + 33784656476525285313173627304265791556761499182/25*x^20 + 315309937263412002519549766396743184287341740362/25*x^19 - 29809326189907478934703273836943134749630766073937/25*x^18 - 277139669604549129326940625213109992460300794466472/25*x^17 + 48267417458901196371693187503590931071511693353624403/125*x^16 + 417747951937480880271176634423393038757023573062901214/125*x^15 + 2007263826796309855277267487981686566625095650300775449/125*x^14 + 6629329384200142639862088631838847849519261327732912678/125*x^13 - 7890086815228540044028318696011082482007739165946890467526/125*x^12 - 47407282438244289856698339380010252170030182743016263979758/125*x^11 + 3298070588288796211686670268348031992948626610010905491413867/125*x^10 + 16925026780847521477088033404397720576309067225732939278573654/125*x^9 - 12606276975554600131707859641843171596158942063398834295739121081/3125*x^8 - 52976903401697668325123474606327892765221094244312074003749191524/3125*x^7 - 1938266538684772533113390852600216820719603074035866039130578333001/3125*x^6 - 5627590284654484129751875434157935192705922694236805197727447225544/3125*x^5 + 285380988605606088041604497638523394233117370690633546039125252974974/625*x^4 + 2863126544037648956156470697472798773649141080128520101958284622979502/3125*x^3 - 292971118345690446877843351574720458113286307337430973163488739432371577/3125*x^2 - 294403610592013769220290971977947932182340270515731034223504446414069348/3125*x + 128890191901531504726282929609520479109501654595823184011440588325811602871/15625254sage: L.absolute_degree() # long time25548256257Even _division_field(E,7) works within a few minutes258"""259misc.verbose("trying to build the extension by adjoining the %s-torsion poitns"%p,2)260f = E.division_polynomial(p)261K = _splitting_field(f)262EK = E.base_extend(K)263if len(EK._p_primary_torsion_basis(p,1)) < 2:264misc.verbose("the y-coordinate need to be adjoined, too",2)265R = PolynomialRing(K,'Y')266Y = R.gens()[0]267for xxm in R(f).roots():268xx = xxm[0]269g = Y**2 + (EK.a1() * xx + EK.a3() ) * Y - xx**3 - EK.a2()*xx**2 - EK.a4()*xx - EK.a6()270if g.roots() == []:271K = g.root_field('a').absolute_field('b')272break273return K274275276class GaloisRepresentation(SageObject):277r"""278The compatible family of Galois representation279attached to an elliptic curve over a number field.280281Given an elliptic curve `E` over a number field `K`282and a rational prime number `p`, the `p^n`-torsion283`E[p^n]` points of `E` is a representation of the284absolute Galois group `G_K` of `K`. As `n` varies285we obtain the Tate module `T_p E` which is a286a representation of `G_K` on a free `\ZZ_p`-module287of rank `2`. As `p` varies the representations288are compatible.289290EXAMPLES::291292sage: rho = EllipticCurve('11a1').galois_representation()293sage: rho294Compatible family of Galois representations associated to the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field295296"""297298def __init__(self, E):299r"""300301see ``GaloisRepresentation`` for documentation302303EXAMPLES::304305sage: rho = EllipticCurve('11a1').galois_representation()306sage: loads(rho.dumps()) == rho307True308309"""310self.__image_type = {}311self.E = E312313def __repr__(self):314r"""315string representation of the class316317EXAMPLES::318319sage: rho = EllipticCurve([0,1]).galois_representation()320sage: rho321Compatible family of Galois representations associated to the Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field322323"""324return "Compatible family of Galois representations associated to the " + repr(self.E)325326def __eq__(self,other):327r"""328Compares two Galois representations.329We define tho compatible families of representations330attached to elliptic curves to be isomorphic if the curves are equal331332EXAMPLES::333334sage: rho = EllipticCurve('11a1').galois_representation()335sage: rho2 = EllipticCurve('11a2').galois_representation()336sage: rho == rho337True338sage: rho == rho2339False340sage: rho == 34341False342343"""344# if rho_E = rho_E' then the L-functions agree,345# so E and E' are isogenous346# except for p=2347# the mod p representations will be different348# for p dividing the degree of the isogeny349# anyway, there should not be a _compatible_350# isomorphism between rho and rho' unless E351# is isomorphic to E'352# Note that rho can not depend on the Weierstrass model353if not type(self) == type(other):354return False355return self.E.is_isomorphic(other.E)356357358def elliptic_curve(self):359r"""360The elliptic curve associated to this representation.361362EXAMPLES::363364sage: E = EllipticCurve('11a1')365sage: rho = E.galois_representation()366sage: rho.elliptic_curve() == E367True368369"""370return self.E371372#####################################################################373# reducibility374#####################################################################375376def is_reducible(self, p):377r"""378Return True if the mod-p representation is379reducible. This is equivalent to the existence of an380isogeny of degree `p` from the elliptic curve.381382INPUT:383384- ``p`` - a prime number385386OUTPUT:387388- a boolean389390.. note::391392The answer is cached.393394EXAMPLES::395396sage: rho = EllipticCurve('121a').galois_representation()397sage: rho.is_reducible(7)398False399sage: rho.is_reducible(11)400True401sage: EllipticCurve('11a').galois_representation().is_reducible(5)402True403sage: rho = EllipticCurve('11a2').galois_representation()404sage: rho.is_reducible(5)405True406sage: EllipticCurve('11a2').torsion_order()4071408409"""410try:411return self.__is_reducible[p]412except AttributeError:413self.__is_reducible = {}414except KeyError:415pass416417if not arith.is_prime(p):418raise ValueError, 'p (=%s) must be prime'%p419# we do is_surjective first, since this is420# much easier than computing isogeny_class421t = self.is_surjective(p)422if t == True:423self.__is_reducible[p] = False424return False # definitely not reducible425isogeny_matrix = self.E.isogeny_class()[ 1 ]426v = isogeny_matrix.row(0) # first row427for a in v:428if a != 0 and a % p == 0:429self.__is_reducible[p] = True430return True431self.__is_reducible[p] = False432return False433434def is_irreducible(self, p):435r"""436Return True if the mod p representation is irreducible.437438INPUT:439440- ``p`` - a prime number441442OUTPUT:443444- a boolean445446EXAMPLES::447448sage: rho = EllipticCurve('37b').galois_representation()449sage: rho.is_irreducible(2)450True451sage: rho.is_irreducible(3)452False453sage: rho.is_reducible(2)454False455sage: rho.is_reducible(3)456True457"""458return not self.is_reducible(p)459460def reducible_primes(self):461r"""462Returns a list of the primes `p` such that the mod463`p` representation is reducible. For464all other primes the representation is irreducible.465466EXAMPLES::467468sage: rho = EllipticCurve('225a').galois_representation()469sage: rho.reducible_primes()470[3]471"""472try:473return self.__reducible_primes474except AttributeError:475pass476C, I = self.E.isogeny_class(algorithm='sage')477X = set(I.list())478R = [p for p in X if arith.is_prime(p)]479self.__reducible_primes = R480return R481482#####################################################################483# image484#####################################################################485486def is_surjective(self, p, A=1000):487r"""488Return True if the mod-p representation is489surjective onto `Aut(E[p]) = GL_2(\mathbb{F}_p)`.490491False if it is not, or None if we were unable to492determine whether it is or not.493494INPUT:495496- ``p`` - int (a prime number)497498- ``A`` - int (a bound on the number of a_p to use)499500OUTPUT:501502- boolean. True if the mod-p representation is surjective503and False if (probably) not504505.. note::506507The answer is cached.508509EXAMPLES::510511sage: rho = EllipticCurve('37b').galois_representation()512sage: rho.is_surjective(2)513True514sage: rho.is_surjective(3)515False516517::518519sage: rho = EllipticCurve('121a1').galois_representation()520sage: rho.non_surjective()521[11]522sage: rho.is_surjective(5)523True524sage: rho.is_surjective(11)525False526sage: rho = EllipticCurve('121d1').galois_representation()527sage: rho.is_surjective(5)528False529sage: rho.is_surjective(11)530True531532REMARKS:5335341. If `p \geq 5` then the mod-p representation is535surjective if and only if the p-adic representation is536surjective. When `p = 2, 3` there are537counterexamples. See a paper of Elkies for more538details when `p=3`.5395402. When `p = 2, 3` this function always gives the correct result541and it does not depend on ``A``, since it explicitly determines the542`p`-division polynomial.543544"""545if not arith.is_prime(p):546raise TypeError, "p (=%s) must be prime."%p547A = int(A)548key = (p, A)549try:550return self.__is_surjective[key]551except KeyError:552pass553except AttributeError:554self.__is_surjective = {}555556ans = self._is_surjective(p, A)557self.__is_surjective[key] = ans558return ans559560561def _is_surjective(self, p, A):562r"""563helper function for ``is_surjective``564565EXAMPLES::566567sage: rho = EllipticCurve('37b').galois_representation()568sage: rho._is_surjective(7,100)569True570571TEST for trac #8451::572573sage: E = EllipticCurve('648a1')574sage: rho = E.galois_representation()575sage: rho._is_surjective(5,1000)576False577578"""579T = self.E.torsion_subgroup().order()580if T % p == 0 and p != 2 :581# we could probably determine the group structure directly582self.__image_type[p] = "The image is meta-cyclic inside a Borel subgroup as there is a %s-torsion point on the curve."%p583return False584585if p == 2:586# E is isomorphic to [0,b2,0,8*b4,16*b6]587b2,b4,b6,b8=self.E.b_invariants()588R = rings.PolynomialRing(self.E.base_ring(), 'x')589x = R.gen()590f = x**3 + b2*x**2 + 8*b4*x + 16*b6591if not f.is_irreducible():592if len(f.roots()) > 2:593self.__image_type[p] = "The image is trivial as all 2-torsion points are rational."594else:595self.__image_type[p] = "The image is cyclic of order 2 as there is exactly one rational 2-torsion point."596return False #, '2-torsion'597if arith.is_square(f.discriminant()):598self.__image_type[p] = "The image is cyclic of order 3."599return False #, "A3"600self.__image_type[p] = "The image is all of GL_2(F_2), i.e. a symmetric group of order 6."601return True #, None602603if p == 3:604# Algorithm: Let f be the 3-division polynomial, which is605# a polynomial of degree 4. Then I claim that this606# polynomial has Galois group S_4 if and only if the607# representation rhobar_{E,3} is surjective. If the group608# is S_4, then S_4 is a quotient of the image of609# rhobar_{E,3}. Since S_4 has order 24 and GL_2(F_3)610# has order 48, the only possibility we have to consider611# is that the image of rhobar is isomorphic to S_4.612# But this is not the case because S_4 is not a subgroup613# of GL_2(F_3). If it were, it would be normal, since614# it would have index 2. But there is a *unique* normal615# subgroup of GL_2(F_3) of index 2, namely SL_2(F_3),616# and SL_2(F_3) is not isomorphic to S_4 (S_4 has a normal617# subgroup of index 2 and SL_2(F_3) does not.)618# (What's a simple way to see that SL_2(F_3) is the619# unique index-2 normal subgroup? I didn't see an obvious620# reason, so just used the NormalSubgroups command in MAGMA621# and it output exactly one of index 2.)622623#sage: G = SymmetricGroup(4)624#sage: [H.group_id() for H in G.conjugacy_classes_subgroups()]625#[[1, 1], [2, 1], [2, 1], [3, 1], [4, 2], [4, 2], [4, 1], [6, 1], [8, 3], [12, 3], [24, 12]]626#sage: G = GL(2,GF(3)).as_matrix_group().as_permutation_group()627#sage: [H.group_id() for H in G.conjugacy_classes_subgroups()]628#[[1, 1], [2, 1], [2, 1], [3, 1], [4, 2], [4, 1], [6, 2], [6, 1], [6, 1], [8, 4], [8, 1], [8, 3], [12, 4], [16, 8], [24, 3], [48, 29]]629630# Here's Noam Elkies proof for the other direction:631632#> Let E be an elliptic curve over Q. Is the mod-3633#> representation E[3] surjective if and only if the634#> (degree 4) division polynomial has Galois group S_4? I635#> can see why the group being S_4 implies the636#> representation is surjective, but the converse is not637#> clear to me.638# I would have thought that this is the easier part: to639# say that E[3] is surjective is to say the 3-torsion640# field Q(E[3]) has Galois group GL_2(Z/3) over Q. Let641# E[3]+ be the subfield fixed by the element -1 of642# GL_2(Z/3). Then E[3] has Galois group PGL_2(Z/3), which643# is identified with S_4 by its action on the four644# 3-element subgroups of E[3]. Each such subgroup is in645# turn determined by the x-coordinate shared by its two646# nonzero points. So, if E[3] is surjective then any647# permutation of those x-coordinates is realized by some648# element of Gal(E[3]+/Q). Thus the Galois group of the649# division polynomial (whose roots are those650# x-coordinates) maps surjectively to S_4, which means it651# equals S_4.652653f = self.E.division_polynomial(3)654if not f.is_irreducible():655return False #, "reducible_3-divpoly"656n = pari(f).polgalois()[0]657if n == 24:658self.__image_type[p] = "The image is all of GL_2(F_3)."659return True #, None660else:661return False #, "3-divpoly_galgroup_order_%s"%n662663if self.E.has_cm():664return False #, "CM"665666Np = self.E.conductor() * p667signs = []668# there was a bug in the original implementation,669# this follows not Proposition 19 in Serre.670# counter-examples were 324b1 and 324d1, 648a1 and 648c1 for p=5671exclude_exceptional_image = False672ex_setp = _ex_set(p)673ell = 4674k = GF(p)675676while ell < A:677ell = arith.next_prime(ell)678if Np % ell != 0:679a_ell = self.E.ap(ell)680if a_ell % p != 0:681if not exclude_exceptional_image:682u = k(a_ell)**2 * k(ell)**(-1)683if u not in ex_setp:684exclude_exceptional_image = True685s = arith.kronecker(a_ell**2 - 4*ell, p)686if s != 0 and s not in signs:687signs.append(s)688if len(signs) == 2 and exclude_exceptional_image:689self.__image_type[p] = "The image is all of GL_2(F_%s)."%p690return True #,None691692return False #, signs693694def non_surjective(self, A=1000):695r"""696Returns a list of primes p such that the mod-p representation697*might* not be surjective (this list698usually contains 2, because of shortcomings of the algorithm). If `p`699is not in the returned list, then the mod-p representation700is provably surjective.701702By a theorem of Serre, there are only finitely703many primes in this list, except when the curve has704complex multiplication.705706If the curve has CM, we simply return the707sequence [0] and do no further computation.708709INPUT:710711- ``A`` - an integer712713OUTPUT:714715- ``list`` - if curve has CM, returns [0].716Otherwise, returns a list of primes where mod-p representation is717very likely not surjective. At any prime not in this list, the718representation is definitely surjective.719720EXAMPLES::721722sage: E = EllipticCurve([0, 0, 1, -38, 90]) # 361A723sage: E.galois_representation().non_surjective() # CM curve724[0]725726::727728sage: E = EllipticCurve([0, -1, 1, 0, 0]) # X_1(11)729sage: E.galois_representation().non_surjective()730[5]731732sage: E = EllipticCurve([0, 0, 1, -1, 0]) # 37A733sage: E.galois_representation().non_surjective()734[]735736sage: E = EllipticCurve([0,-1,1,-2,-1]) # 141C737sage: E.galois_representation().non_surjective()738[13]739740::741742sage: E = EllipticCurve([1,-1,1,-9965,385220]) # 9999a1743sage: rho = E.galois_representation()744sage: rho.non_surjective()745[2]746747sage: E = EllipticCurve('324b1')748sage: rho = E.galois_representation()749sage: rho.non_surjective()750[3, 5]751752ALGORITHM:753We first find an upper bound `B` on the possible primes. If `E`754is semi-stable, we can take `B=11` by a result of Mazur. There is755a bound by Serre in the case that the `j`-invariant is not integral756in terms of the minimal prime of good reduction. Finally757there is an unconditional bound by Cojocaru, but which depends758on the conductor of `E`.759For the prime below that bound we call ``is_surjective``.760761"""762if self.E.has_cm():763misc.verbose("cm curve")764return [0]765N = self.E.conductor()766if self.E.is_semistable():767# Mazur's bound768C = 11769misc.verbose("semistable -- so bound is 11")770elif not self.E.j_invariant().is_integral():771# prop 24 in Serre772vs = self.E.j_invariant().denominator().prime_factors()773C1 = arith.gcd([-arith.valuation(self.E.j_invariant(),v) for v in vs])774p0 = 2775while self.E.has_bad_reduction(p0):776p0 = arith.next_prime(p0+1)777C2 = (sqrt(p0)+1)**8778C = max(C1,C2)779misc.verbose("j is not integral -- Serre's bound is %s"%C)780C3 = 1 + 4*sqrt(6)*int(N)/3 * sqrt(misc.mul([1+1.0/int(p) for p,_ in arith.factor(N)]))781C = min(C,C3)782misc.verbose("conductor = %s, and bound is %s"%(N,C))783else:784# Cojocaru's bound (depends on the conductor)785C = 1 + 4*sqrt(6)*int(N)/3 * sqrt(misc.mul([1+1.0/int(p) for p,_ in arith.factor(N)]))786misc.verbose("conductor = %s, and bound is %s"%(N,C))787B = []788p = 2789while p <= C:790t = self.is_surjective(p, A=A)791misc.verbose("(%s,%s)"%(p,t))792if not t:793B.append(p)794p = arith.next_prime(p)795return B796797def image_type(self, p):798r"""799Returns a string describing the image of the800mod-p representation.801The result is provably correct, but only indicates what sort of an image we have. If one wishes to determine the exact group one needs to work a bit harder. The probabilistic method of image_classes or Sutherland's galrep package can give a very good guess what the image should be.802803INPUT:804805- ``p`` a prime number806807OUTPUT:808809- a string.810811EXAMPLES ::812813sage: E = EllipticCurve('14a1')814sage: rho = E.galois_representation()815sage: rho.image_type(5)816'The image is all of GL_2(F_5).'817818sage: E = EllipticCurve('11a1')819sage: rho = E.galois_representation()820sage: rho.image_type(5)821'The image is meta-cyclic inside a Borel subgroup as there is a 5-torsion point on the curve.'822823sage: EllipticCurve('27a1').galois_representation().image_type(5)824'The image is contained in the normalizer of a non-split Cartan group. (cm)'825sage: EllipticCurve('30a1').galois_representation().image_type(5)826'The image is all of GL_2(F_5).'827sage: EllipticCurve("324b1").galois_representation().image_type(5)828'The image in PGL_2(F_5) is the exceptional group S_4.'829830sage: E = EllipticCurve([0,0,0,-56,4848])831sage: rho = E.galois_representation()832sage: rho.image_type(5)833'The image is contained in the normalizer of a split Cartan group.'834835sage: EllipticCurve('49a1').galois_representation().image_type(7)836'The image is contained in a Borel subgroup as there is a 7-isogeny.'837838sage: EllipticCurve('121c1').galois_representation().image_type(11)839'The image is contained in a Borel subgroup as there is a 11-isogeny.'840sage: EllipticCurve('121d1').galois_representation().image_type(11)841'The image is all of GL_2(F_11).'842sage: EllipticCurve('441f1').galois_representation().image_type(13)843'The image is contained in a Borel subgroup as there is a 13-isogeny.'844845sage: EllipticCurve([1,-1,1,-5,2]).galois_representation().image_type(5)846'The image is contained in the normalizer of a non-split Cartan group.'847sage: EllipticCurve([0,0,1,-25650,1570826]).galois_representation().image_type(5)848'The image is contained in the normalizer of a split Cartan group.'849sage: EllipticCurve([1,-1,1,-2680,-50053]).galois_representation().image_type(7) # the dots (...) in the output fix #11937 (installed 'Kash' may give additional output); long time (26s on sage.math, 2012)850'The image is a... group of order 18.'851sage: EllipticCurve([1,-1,0,-107,-379]).galois_representation().image_type(7) # the dots (...) in the output fix #11937 (installed 'Kash' may give additional output); long time (5s on sage.math, 2012)852'The image is a... group of order 36.'853sage: EllipticCurve([0,0,1,2580,549326]).galois_representation().image_type(7)854'The image is contained in the normalizer of a split Cartan group.'855856For `p=2`::857858sage: E = EllipticCurve('11a1')859sage: rho = E.galois_representation()860sage: rho.image_type(2)861'The image is all of GL_2(F_2), i.e. a symmetric group of order 6.'862863sage: rho = EllipticCurve('14a1').galois_representation()864sage: rho.image_type(2)865'The image is cyclic of order 2 as there is exactly one rational 2-torsion point.'866867sage: rho = EllipticCurve('15a1').galois_representation()868sage: rho.image_type(2)869'The image is trivial as all 2-torsion points are rational.'870871sage: rho = EllipticCurve('196a1').galois_representation()872sage: rho.image_type(2)873'The image is cyclic of order 3.'874875`p=3`::876877sage: rho = EllipticCurve('33a1').galois_representation()878sage: rho.image_type(3)879'The image is all of GL_2(F_3).'880881sage: rho = EllipticCurve('30a1').galois_representation()882sage: rho.image_type(3)883'The image is meta-cyclic inside a Borel subgroup as there is a 3-torsion point on the curve.'884885sage: rho = EllipticCurve('50b1').galois_representation()886sage: rho.image_type(3)887'The image is contained in a Borel subgroup as there is a 3-isogeny.'888889sage: rho = EllipticCurve('3840h1').galois_representation()890sage: rho.image_type(3)891'The image is contained in a dihedral group of order 8.'892893sage: rho = EllipticCurve('32a1').galois_representation()894sage: rho.image_type(3)895'The image is a semi-dihedral group of order 16, gap.SmallGroup([16,8]).'896897898ALGORITHM: Mainly based on Serre's paper.899"""900if not arith.is_prime(p):901raise TypeError, "p (=%s) must be prime."%p902try:903return self.__image_type[p]904except KeyError:905pass906except AttributeError:907self.__image_type = {}908909910# we eliminate step by step possibilities.911# checks if the image is all of GL_2, while doing so, it may detect certain other classes already912# see _is_surjective. It will have set __image_type913914ans = self._is_surjective(p, A=1000)915try:916return self.__image_type[p]917except KeyError:918pass919920# check if the rep is reducible921922if self.is_reducible(p):923self.__image_type[p] = "The image is contained in a Borel subgroup as there is a %s-isogeny."%p924return self.__image_type[p]925926# if we are then the image of rho is not surjective and not contained in a Borel subgroup927# there are three cases left:928# it could be in a normalizer of a split Cartan,929# normalizer of a non-split Cartan,930# or the image in PGL_2 is one of the three exceptional groups A_4 S_4 A_5931932non_split_str = "The image is contained in the normalizer of a non-split Cartan group."933split_str = "The image is contained in the normalizer of a split Cartan group."934s4_str = "The image in PGL_2(F_%s) is the exceptional group S_4."%p935a4_str = "The image in PGL_2(F_%s) is the exceptional group A_4."%p936a5_str = "The image in PGL_2(F_%s) is the exceptional group A_5."%p937938# we first treat p=3 and 5 seperately. p=2 has already been done.939940if p == 3:941# this implies that the image of rhobar in PGL_2 = S_4942# determines completely the image of rho943f = self.E.division_polynomial(3)944if not f.is_irreducible():945# must be a product of two polynomials of degree 2946self.__image_type[p] = "The image is contained in a dihedral group of order 8."947return self.__image_type[p]948n = pari(f).polgalois()[0]949# the following is due to a simple classification of all subgroups of GL_2(F_3)950if n == 2:951self.__image_type[p] = "The image is a cyclic group of order 4."952elif n == 4:953for ell in prime_range(5,1000):954if ell % 3 == 2 and self.E.ap(ell) % 3 != 0:955# there is an element of order 8 in the image956self.__image_type[p] = "The image is a cyclic group of order 8."957return self.__image_type[p]958self.__image_type[p] = "The image is a group of order 8, most likely a quaternion group."959elif n == 6:960self.__image_type[p] = "The image is a dihedral group of order 12."961elif n == 8:962self.__image_type[p] = "The image is a semi-dihedral group of order 16, gap.SmallGroup([16,8])."963elif n == 12:964self.__image_type[p] = "The image is SL_2(F_3)."965else:966raise RuntimeError, "Bug in image_type for p = 3."967return self.__image_type[p]968969# we also eliminate cm curves970971if self.E.has_cm():972if self.E.is_good(p) and self.E.is_ordinary(p):973self.__image_type[p] = split_str + " (cm)"974return self.__image_type[p]975if self.E.is_supersingular(p):976self.__image_type[p] = non_split_str + " (cm)"977return self.__image_type[p]978else:979# if the reduction is bad (additive nec.) then980# the image is in a Borel subgroup and we should have found this before981raise NotImplementedError, "image_type is not implemented for cm-curves at bad prime."982983# now to p=5 where a lot of non-standard thing happen984# we run through primes if we hit an element of order 6 in PGL_2, we know that it is the normaliser of a NON-split Cartan985# if we find both an element of order 3 and one of order 4, we know that we have a S_4 in PGL_2986987if p == 5:988# we filter here a few cases and leave the rest to the computation of the galois group later989ell = 1990k = GF(p)991Np = self.E.conductor()*p992has_an_el_order_4 = False993has_an_el_order_3 = False994while ell < 10000:995ell = arith.next_prime(ell)996if Np % ell != 0:997a_ell = self.E.ap(ell)998u = k(a_ell)**2 * k(ell)**(-1)999if u == 3:1000misc.verbose("found an element of order 6",2)1001# found an element of order 6:1002self.__image_type[p] = non_split_str1003return self.__image_type[p]10041005if u == 2 and not has_an_el_order_4:1006# found an element of order 41007misc.verbose("found an element of order 4",2)1008has_an_el_order_4 = True1009if has_an_el_order_3:1010self.__image_type[p] = s4_str1011return self.__image_type[p]10121013if u == 1 and not has_an_el_order_3:1014# found an element of order 31015misc.verbose("found an element of order 3",2)1016has_an_el_order_3 = True1017if has_an_el_order_4:1018self.__image_type[p] = s4_str1019return self.__image_type[p]10201021misc.verbose("p=5 and we could not determine the image, yet", 2)1022# we have not yet determined the image, there are only the following possible subgroups of PGL_21023# (unless we were unlucky and none of the elements of order 6 showed up above, for instance)1024# A_4 of order 12 with elements of order 2 and 31025# D_4 of order 8 with elements of order 2 and 4 (normalizer of the SPLIT)1026# Z/2 x Z/2 of order 4 with elements of order 2 (in the normalizer of the SPLIT)1027# S_3 of order 6 with elements of order 2 and 3 (inside the normalizer of the NON-split)10281029# we compute the splitting field of the 5-division polynomial. Its degree is equal to the above order or the double of it.1030# That allows us to determine almost all cases.10311032f = self.E.division_polynomial(5)1033K = _splitting_field(f)1034#EK = self.E.base_extend(K)1035#d = K.degree()1036#if len(EK._p_primary_torsion_basis(5,1)) < 2:1037# d *= 21038# d is the order of the image in GL_210391040if K.degree() in [4,8,16]:1041self.__image_type[p] = split_str1042return self.__image_type[p]1043if K.degree() == 24:1044self.__image_type[p] = a4_str1045return self.__image_type[p]1046if K.degree() == 6:1047self.__image_type[p] = nonsplit_str1048return self.__image_type[p]10491050if K.degree() == 12:1051# PGL - image could be a S_3 in the normalizer of the split or A41052self.__image_type[p] = "The image is of order %s. Probably contained in the normalizer of the split Cartan g."1053return self.__image_type[p]105410551056## now E has no cm, is not semi-stable,1057## p > 5,1058## rho_p it is (most probably) not surjective , it is not contained in a Borel subgroup.1059# trying to detect that the image is not exceptional in PGL_21060# this uses Serre 2.6.iii and Prop 191061# the existence of certain classes in the image rules out certain cases.1062# we run over the small prime until we are left with only one case1063# for p = 5 this could never distinguish any from an exceptional S_4 ot A_4,1064# that is why the case 5 is treated a part before10651066else:1067ex_setp = _ex_set(p)1068ell = 11069k = GF(p)1070Np = self.E.conductor()*p1071could_be_exc = 11072could_be_split = 11073could_be_non_split = 11074# loops over primes as long as we still have two options left1075while ell < 10000 and (could_be_exc + could_be_split + could_be_non_split > 1):1076ell = arith.next_prime(ell)1077if Np % ell != 0:1078a_ell = self.E.ap(ell)1079u = k(a_ell)**2 * k(ell)**(-1)1080if (u not in ex_setp) and could_be_exc == 1:1081# it can not be in the exceptional1082misc.verbose("the image cannot be exceptional, found u=%s"%u,2)1083could_be_exc = 01084if a_ell != 0 and arith.kronecker(a_ell**2 - 4*ell,p) == 1 and could_be_non_split == 1:1085# it can not be in the noramlizer of the non-split Cartan1086misc.verbose("the image cannot be non-split, found u=%s"%u,2)1087could_be_non_split = 01088if a_ell != 0 and arith.kronecker(a_ell**2 - 4*ell,p) == -1 and could_be_split == 1:1089# it can not be in the noramlizer of the split Cartan1090misc.verbose("the image cannot be split, found u=%s"%u,2)1091could_be_split = 010921093assert could_be_exc + could_be_split + could_be_non_split > 0, "bug in image_type."10941095if could_be_exc + could_be_split + could_be_non_split == 1:1096# it is only one of the three cases:1097if could_be_split == 1 :1098self.__image_type[p] = split_str1099return self.__image_type[p]1100if could_be_non_split == 1 :1101self.__image_type[p] = nonsplit_str1102return self.__image_type[p]1103if could_be_exc == 1:1104# here we can distinguish further1105could_be_a4 = 11106could_be_s4 = 11107could_be_a5 = 11108if p % 5 != 1 and p % 5 != 4 :1109could_be_a5 = 01110el5 = [ex_setp[-1],ex_setp[-2]] # elements of order 51111# loops over primes as long as we still have two options left1112while ell < 10000 and (could_be_s4 + could_be_a4 + could_be_a5 > 1):1113ell = arith.next_prime(ell)1114if Np % ell != 0:1115a_ell = self.E.ap(ell)1116u = k(a_ell)**2 * k(ell)**(-1)1117if u == 2:1118# it can not be A4 not A5 as they have no elements of order 41119could_be_a4 = 01120could_be_a5 = 01121if u in el5 :1122# it can not be A4 or S4 as they have no elements of order 51123could_be_a4 = 01124could_be_s4 = 011251126assert (could_be_s4 + could_be_a4 + could_be_a5 > 0), "bug in image_type."11271128if could_be_s4 + could_be_a4 + could_be_a5 == 1:1129if could_be_s4 == 1:1130self.__image_type[p] = s4_str1131return self.__image_type[p]1132if could_be_a4 == 1:1133self.__image_type[p] = a4_str1134return self.__image_type[p]1135if could_be_a5 == 1:1136self.__image_type[p] = a5_str1137return self.__image_type[p]11381139else:1140self.__image_type[p] = "The image in PGL_2(F_%s) is an exceptional group A_4, S_4 or A_5, but we could not determine which one."%p1141return self.__image_type[p]11421143# is all fails, we probably have a fairly small group and we can try to detect it using the galois_group11441145if p <= 13:1146K = _division_field(self.E,p)1147d = K.absolute_degree()11481149misc.verbose("field of degree %s. try to compute galois group"%(d),2)1150try:1151G = K.galois_group()1152except:1153self.__image_type[p] = "The image is a group of order %s."%d1154return self.__image_type[p]11551156else:1157if G.is_abelian():1158ab = ""1159else:1160ab = "non-"1161self.__image_type[p] = "The image is a " + ab + "abelian group of order %s."%G.order()1162return self.__image_type[p]11631164## everything failed :11651166self.__image_type[p] = "The image could not be determined. Sorry."1167return self.__image_type[p]11681169117011711172def image_classes(self,p,bound=10000):1173r"""1174This function returns, given the representation `\rho`1175a list of `p` values that add up to 1, representing the1176frequency of the conjugacy classes of the projective image1177of `\rho` in `PGL_2(\mathbb{F}_p)`.11781179Let `M` be a matrix in `GL_2(\mathbb{F}_p)`, then define1180`u(M) = \text{tr}(M)^2/\det(M)`, which only depends on the1181conjugacy class of `M` in `PGL_2(\mathbb{F}_p)`. So this defines1182a map `u: PGL_2(\mathbb{F}_p) \to \mathbb{F}_p`, which is almost1183a bijection (the elements of order `p` and the identity1184map to `4` and both classes of elements of order 2 map to 0).11851186This function returns the frequency with which the values of1187`u` appeared among the images of the Frobenius elements at `\ell`1188for good primes `\ell\neq p` below a the given ``bound``.11891190INPUT:11911192- a prime ``p``1193- a natural number ``bound`` (optional, default=10000)11941195OUTPUT:11961197- a list of `p` real numbers in the interval `[0,1]` adding up to 111981199EXAMPLES::12001201sage: E = EllipticCurve('14a1')1202sage: rho = E.galois_representation()1203sage: rho.image_classes(5)1204[0.2095, 0.1516, 0.2445, 0.1728, 0.2217]12051206sage: E = EllipticCurve('11a1')1207sage: rho = E.galois_representation()1208sage: rho.image_classes(5)1209[0.2467, 0.0000, 0.5049, 0.0000, 0.2484]12101211::12121213sage: EllipticCurve('27a1').galois_representation().image_classes(5)1214[0.5839, 0.1645, 0.0000, 0.1702, 0.08143]1215sage: EllipticCurve('30a1').galois_representation().image_classes(5)1216[0.1956, 0.1801, 0.2543, 0.1728, 0.1972]1217sage: EllipticCurve('32a1').galois_representation().image_classes(5)1218[0.6319, 0.0000, 0.2492, 0.0000, 0.1189]1219sage: EllipticCurve('900a1').galois_representation().image_classes(5)1220[0.5852, 0.1679, 0.0000, 0.1687, 0.07824]1221sage: EllipticCurve('441a1').galois_representation().image_classes(5)1222[0.5860, 0.1646, 0.0000, 0.1679, 0.08150]1223sage: EllipticCurve('648a1').galois_representation().image_classes(5)1224[0.3945, 0.3293, 0.2388, 0.0000, 0.03749]12251226::12271228sage: EllipticCurve('784h1').galois_representation().image_classes(7)1229[0.5049, 0.0000, 0.0000, 0.0000, 0.4951, 0.0000, 0.0000]1230sage: EllipticCurve('49a1').galois_representation().image_classes(7)1231[0.5045, 0.0000, 0.0000, 0.0000, 0.4955, 0.0000, 0.0000]12321233sage: EllipticCurve('121c1').galois_representation().image_classes(11)1234[0.1001, 0.0000, 0.0000, 0.0000, 0.1017, 0.1953, 0.1993, 0.0000, 0.0000, 0.2010, 0.2026]1235sage: EllipticCurve('121d1').galois_representation().image_classes(11)1236[0.08869, 0.07974, 0.08706, 0.08137, 0.1001, 0.09439, 0.09764, 0.08218, 0.08625, 0.1017, 0.1009]12371238sage: EllipticCurve('441f1').galois_representation().image_classes(13)1239[0.08232, 0.1663, 0.1663, 0.1663, 0.08232, 0.0000, 0.1549, 0.0000, 0.0000, 0.0000, 0.0000, 0.1817, 0.0000]12401241REMARKS:12421243Conjugacy classes of subgroups of `PGL_2(\mathbb{F}_5)`12441245For the case `p=5`, the order of an element determines almost the value of `u`:12461247+-------+---+---+---+---+--------+1248|`u` | 0 | 1 | 2 | 3 | 4 |1249+-------+---+---+---+---+--------+1250|orders | 2 | 3 | 4 | 6 | 1 or 5 |1251+-------+---+---+---+---+--------+12521253Here we give here the full table of all conjugacy classes of subgroups with the values1254that ``image_classes`` should give (as ``bound`` tends to `\infty`). Comparing with the output1255of the above examples, it is now easy to guess what the image is.12561257+---------+-----+------------------------------------------+1258|subgroup |order| frequencies of values of `u` |1259+=========+=====+==========================================+1260| trivial | 1 | [0.0000, 0.0000, 0.0000, 0.0000, 1.000] |1261+---------+-----+------------------------------------------+1262| cyclic | 2 | [0.5000, 0.0000, 0.0000, 0.0000, 0.5000] |1263+---------+-----+------------------------------------------+1264| cyclic | 2 | [0.5000, 0.0000, 0.0000, 0.0000, 0.5000]|1265+---------+-----+------------------------------------------+1266| cyclic | 3 | [0.0000, 0.6667, 0.0000, 0.0000, 0.3333]|1267+---------+-----+------------------------------------------+1268| Klein | 4 | [0.7500, 0.0000, 0.0000, 0.0000, 0.2500]|1269+---------+-----+------------------------------------------+1270| cyclic | 4 | [0.2500, 0.0000, 0.5000, 0.0000, 0.2500]|1271+---------+-----+------------------------------------------+1272| Klein | 4 | [0.7500, 0.0000, 0.0000, 0.0000, 0.2500]|1273+---------+-----+------------------------------------------+1274| cyclic | 5 | [0.0000, 0.0000, 0.0000, 0.0000, 1.000]|1275+---------+-----+------------------------------------------+1276| cyclic | 6 | [0.1667, 0.3333, 0.0000, 0.3333, 0.1667]|1277+---------+-----+------------------------------------------+1278| `S_3` | 6 | [0.5000, 0.3333, 0.0000, 0.0000, 0.1667]|1279+---------+-----+------------------------------------------+1280| `S_3` | 6 | [0.5000, 0.3333, 0.0000, 0.0000, 0.1667] |1281+---------+-----+------------------------------------------+1282| `D_4` | 8 | [0.6250, 0.0000, 0.2500, 0.0000, 0.1250]|1283+---------+-----+------------------------------------------+1284| `D_5` | 10 | [0.5000, 0.0000, 0.0000, 0.0000, 0.5000]|1285+---------+-----+------------------------------------------+1286| `A_4` | 12 | [0.2500, 0.6667, 0.0000, 0.0000, 0.08333]|1287+---------+-----+------------------------------------------+1288| `D_6` | 12 | [0.5833, 0.1667, 0.0000, 0.1667, 0.08333]|1289+---------+-----+------------------------------------------+1290| Borel | 20 | [0.2500, 0.0000, 0.5000, 0.0000, 0.2500]|1291+---------+-----+------------------------------------------+1292| `S_4` | 24 | [0.3750, 0.3333, 0.2500, 0.0000, 0.04167]|1293+---------+-----+------------------------------------------+1294| `PSL_2` | 60 | [0.2500, 0.3333, 0.0000, 0.0000, 0.4167]|1295+---------+-----+------------------------------------------+1296| `PGL_2` | 120| [0.2083, 0.1667, 0.2500, 0.1667, 0.2083] |1297+---------+-----+------------------------------------------+1298"""1299res = [0 for i in range(p)]1300co = 01301ell = 11302while ell <= bound:1303ell = arith.next_prime(ell)1304if ell != p and self.E.is_good(ell):1305d = (self.E.ap(ell)**2 * ell.inverse_mod(p)) % p1306res[d] += 11307co += 11308# print res1309Rt = RealField(16)1310res = [Rt(x)/Rt(co) for x in res]1311return res13121313#####################################################################1314# classification of ell and p-adic reps1315#####################################################################13161317# ell-adic reps13181319def is_unramified(self,p,ell):1320r"""1321Returns true if the Galois representation to `GL_2(\ZZ_p)` is unramified at `\ell`, i.e.1322if the inertia group at a place above `\ell` in `\text{Gal}(\bar\QQ/\QQ)` has trivial image in1323`GL_2(\ZZ_p)`.13241325For a Galois representation attached to an elliptic curve `E`, this returns True if `\ell\neq p`1326and `E` has good reduction at `\ell`.13271328INPUT:13291330- ``p`` a prime1331- ``ell`` another prime13321333OUTPUT:13341335- Boolean13361337EXAMPLES::13381339sage: rho = EllipticCurve('20a3').galois_representation()1340sage: rho.is_unramified(5,7)1341True1342sage: rho.is_unramified(5,5)1343False1344sage: rho.is_unramified(7,5)1345False13461347This says that the 5-adic representation is unramified at 7, but the 7-adic representation is ramified at 5.1348"""1349if not arith.is_prime(p):1350raise ValueError, 'p (=%s) must be prime'%p1351if not arith.is_prime(ell):1352raise ValueError, 'ell (=%s) must be prime'%ell1353return (ell != p) and self.E.has_good_reduction(ell)13541355def is_unipotent(self,p,ell):1356r"""1357Returns true if the Galois representation to `GL_2(\ZZ_p)` is unipotent at `\ell\neq p`, i.e.1358if the inertia group at a place above `\ell` in `\text{Gal}(\bar\QQ/\QQ)` maps into a Borel subgroup.13591360For a Galois representation attached to an elliptic curve `E`, this returns True if1361`E` has semi-stable reduction at `\ell`.13621363INPUT:13641365- ``p`` a prime1366- ``ell`` a different prime13671368OUTPUT:13691370- Boolean13711372EXAMPLES::13731374sage: rho = EllipticCurve('120a1').galois_representation()1375sage: rho.is_unipotent(2,5)1376True1377sage: rho.is_unipotent(5,2)1378False1379sage: rho.is_unipotent(5,7)1380True1381sage: rho.is_unipotent(5,3)1382True1383sage: rho.is_unipotent(5,5)1384Traceback (most recent call last):1385...1386ValueError: unipotent is not defined for l = p, use semistable instead.1387"""1388if not arith.is_prime(p):1389raise ValueError, 'p (=%s) must be prime'%p1390if not arith.is_prime(ell):1391raise ValueError, 'ell (=%s) must be prime'%ell1392if ell == p:1393raise ValueError, "unipotent is not defined for l = p, use semistable instead."1394return not self.E.has_additive_reduction(ell)13951396def is_quasi_unipotent(self,p,ell):1397r"""1398Returns true if the Galois representation to `GL_2(\ZZ_p)` is quasi-unipotent at `\ell\neq p`, i.e. if there is a fintie extension `K/\QQ` such that the inertia group at a place above `\ell` in `\text{Gal}(\bar\QQ/K)` maps into a Borel subgroup.13991400For a Galois representation attached to an elliptic curve `E`, this returns always True.14011402INPUT:14031404- ``p`` a prime1405- ``ell`` a different prime14061407OUTPUT:14081409- Boolean14101411EXAMPLES::14121413sage: rho = EllipticCurve('11a3').galois_representation()1414sage: rho.is_quasi_unipotent(11,13)1415True1416"""1417if not arith.is_prime(p):1418raise ValueError, 'p (=%s) must be prime'%p1419if not arith.is_prime(ell):1420raise ValueError, 'ell (=%s) must be prime'%ell1421if ell == p:1422raise ValueError, "quasi unipotent is not defined for l = p, use semistable instead."1423return True14241425# p-adic reps14261427def is_ordinary(self,p):1428r"""1429Returns true if the `p`-adic Galois representation to `GL_2(\ZZ_p)` is ordinary, i.e.1430if the image of the decomposition group in `\text{Gal}(\bar\QQ/\QQ)` above he prime `p` maps into1431a Borel subgroup.14321433For an elliptic curve `E`, this is to ask whether `E` is ordinary at `p`, i.e. good ordinary or multiplicative.14341435INPUT:14361437- ``p`` a prime14381439OUTPUT:14401441- a Boolean14421443EXAMPLES::14441445sage: rho = EllipticCurve('11a3').galois_representation()1446sage: rho.is_ordinary(11)1447True1448sage: rho.is_ordinary(5)1449True1450sage: rho.is_ordinary(19)1451False1452"""1453if not arith.is_prime(p):1454raise ValueError, 'p (=%s) must be prime'%p1455if self.E.has_additive_reduction(p):1456raise NotImplementedError, 'is_ordinary is only implemented for semi-stable representations'1457return self.E.has_multiplicative_reduction(p) or (self.E.has_good_reduction(p) and self.E.ap(p) % p != 0)14581459def is_crystalline(self,p):1460r"""1461Returns true is the `p`-adic Galois representation to `GL_2(\ZZ_p)` is crystalline.14621463For an elliptic curve `E`, this is to ask whether `E` has good reduction at `p`.14641465INPUT:14661467- ``p`` a prime14681469OUTPUT:14701471- a Boolean14721473EXAMPLES::14741475sage: rho = EllipticCurve('64a1').galois_representation()1476sage: rho.is_crystalline(5)1477True1478sage: rho.is_crystalline(2)1479False1480"""1481if not arith.is_prime(p):1482raise ValueError, 'p (=%s) must be prime'%p1483return self.E.has_good_reduction(p)14841485def is_potentially_crystalline(self,p):1486r"""1487Returns true is the `p`-adic Galois representation to `GL_2(\ZZ_p)` is potentially crystalline, i.e.1488if there is a finite extension `K/\QQ_p` such that the `p`-adic representation becomes crystalline.14891490For an elliptic curve `E`, this is to ask whether `E` has potentially good reduction at `p`.14911492INPUT:14931494- ``p`` a prime14951496OUTPUT:14971498- a Boolean14991500EXAMPLES::15011502sage: rho = EllipticCurve('37b1').galois_representation()1503sage: rho.is_potentially_crystalline(37)1504False1505sage: rho.is_potentially_crystalline(7)1506True1507"""1508if not arith.is_prime(p):1509raise ValueError, 'p (=%s) must be prime'%p1510return self.E.j_invariant().valuation(p) >= 0151115121513def is_semistable(self,p):1514r"""1515Returns true if the `p`-adic Galois representation to `GL_2(\ZZ_p)` is semistable.15161517For an elliptic curve `E`, this is to ask whether `E` has semistable reduction at `p`.15181519INPUT:15201521- ``p`` a prime15221523OUTPUT:15241525- a Boolean15261527EXAMPLES::15281529sage: rho = EllipticCurve('20a3').galois_representation()1530sage: rho.is_semistable(2)1531False1532sage: rho.is_semistable(3)1533True1534sage: rho.is_semistable(5)1535True1536"""1537if not arith.is_prime(p):1538raise ValueError, 'p (=%s) must be prime'%p1539return not self.E.has_additive_reduction(p)15401541def is_potentially_semistable(self,p):1542r"""1543Returns true if the `p`-adic Galois representation to `GL_2(\ZZ_p)` is potentially semistable.15441545For an elliptic curve `E`, this returns True always15461547INPUT:15481549- ``p`` a prime15501551OUTPUT:15521553- a Boolean15541555EXAMPLES::15561557sage: rho = EllipticCurve('27a2').galois_representation()1558sage: rho.is_potentially_semistable(3)1559True1560"""1561if not arith.is_prime(p):1562raise ValueError, 'p (=%s) must be prime'%p1563return True156415651566