Path: blob/master/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
8820 views
r"""1Surjectivity of Galois Representations for Elliptic Curves over Number Fields.23This file contains the code to compute for which primes the Galois4representation attached to an elliptic curve (over an arbitrary5number field) is surjective. The functions in this file are called by6the is_surjective and non_surjective methods in ell_number_field.py.78EXAMPLES::910sage: K = NumberField(x**2 - 29, 'a'); a = K.gen()11sage: E = EllipticCurve([1, 0, ((5 + a)/2)**2, 0, 0])12sage: rho = E.galois_representation()13sage: rho.is_surjective(29) # Cyclotomic character not surjective.14False15sage: rho.is_surjective(31) # See Section 5.10 of [Serre72].16True17sage: rho.non_surjective() # long time (4s on sage.math, 2014)18[3, 5, 29]1920sage: E = EllipticCurve_from_j(1728).change_ring(K) # CM21sage: E.galois_representation().non_surjective() # long time (2s on sage.math, 2014)22[0]2324AUTHORS:2526- Eric Larson (2012-05-28): initial version.2728REFERENCES:2930[Serre72] Serre. ``Proprietes Galoisiennes des Points d'Ordre Fini des Courbes31Elliptiques.'' Inventiones mathematicae, 1972.32"""3334#*****************************************************************************35# Copyright (C) 2012 Eric Larson <[email protected]>36#37# Distributed under the terms of the GNU General Public License (GPL)38# as published by the Free Software Foundation; either version 2 of39# the License, or (at your option) any later version.40# http://www.gnu.org/licenses/41#*****************************************************************************424344from sage.structure.sage_object import SageObject45from sage.rings.number_field.number_field import NumberField46from sage.schemes.elliptic_curves.cm import cm_j_invariants47from sage.rings.rational_field import QQ48from sage.modules.free_module import VectorSpace49from sage.rings.finite_rings.constructor import GF50from sage.rings.integer import Integer51from sage.misc.functional import cyclotomic_polynomial52from sage.rings.arith import legendre_symbol535455class GaloisRepresentation(SageObject):56r"""57The compatible family of Galois representation58attached to an elliptic curve over a number field.5960Given an elliptic curve `E` over a number field `K`61and a rational prime number `p`, the `p^n`-torsion62`E[p^n]` points of `E` is a representation of the63absolute Galois group `G_K` of `K`. As `n` varies64we obtain the Tate module `T_p E` which is a65a representation of `G_K` on a free `\ZZ_p`-module66of rank `2`. As `p` varies the representations67are compatible.6869EXAMPLES::7071sage: K = NumberField(x**2 + 1, 'a')72sage: E = EllipticCurve('11a1').change_ring(K)73sage: rho = E.galois_representation()74sage: rho75Compatible family of Galois representations associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in a with defining polynomial x^2 + 176"""777879def __init__(self, E):80r"""8182see ``GaloisRepresentation`` for documentation8384EXAMPLES::8586sage: K = NumberField(x**2 + 1, 'a')87sage: E = EllipticCurve('11a1').change_ring(K)88sage: rho = E.galois_representation()89sage: rho90Compatible family of Galois representations associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in a with defining polynomial x^2 + 191sage: loads(rho.dumps()) == rho92True93"""94self.E = E959697def __repr__(self):98r"""99string representation of the class100101EXAMPLES::102103sage: K = NumberField(x**2 + 1, 'a')104sage: E = EllipticCurve('11a1').change_ring(K)105sage: rho = E.galois_representation()106sage: rho107Compatible family of Galois representations associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in a with defining polynomial x^2 + 1108"""109return "Compatible family of Galois representations associated to the " + repr(self.E)110111112def __eq__(self,other):113r"""114Compares two Galois representations.115We define two compatible families of representations116attached to elliptic curves to be isomorphic if the curves are equal117118EXAMPLES::119120sage: K = NumberField(x**2 + 1, 'a'); a = K.gen()121sage: rho1 = EllipticCurve_from_j(1 + a).galois_representation()122sage: rho2 = EllipticCurve_from_j(2 + a).galois_representation()123sage: rho1 == rho1124True125sage: rho1 == rho2126False127sage: rho1 == 42128False129"""130if not type(self) == type(other):131return False132return self.E.is_isomorphic(other.E)133134135def elliptic_curve(self):136r"""137The elliptic curve associated to this representation.138139EXAMPLES::140141sage: K = NumberField(x**2 + 1, 'a'); a = K.gen()142sage: E = EllipticCurve_from_j(a)143sage: rho = E.galois_representation()144sage: rho.elliptic_curve() == E145True146"""147return self.E148149150def non_surjective(self, A=100):151r"""152Returns a list of primes `p` including all primes for which the mod-`p`153representation might not be surjective.154155INPUT:156157* ``A`` - int (a bound on the number of traces of Frobenius to use158while trying to prove surjectivity).159160OUTPUT:161162- ``list`` - A list of primes where mod-`p` representation is very likely163not surjective. At any prime not in this list, the representation is164definitely surjective. If E has CM, the list [0] is returned.165166EXAMPLES::167168sage: K = NumberField(x**2 - 29, 'a'); a = K.gen()169sage: E = EllipticCurve([1, 0, ((5 + a)/2)**2, 0, 0])170sage: rho = E.galois_representation()171sage: rho.non_surjective() # See Section 5.10 of [Serre72].172[3, 5, 29]173sage: K = NumberField(x**2 + 3, 'a'); a = K.gen()174sage: E = EllipticCurve([0, -1, 1, -10, -20]).change_ring(K) # X_0(11)175sage: rho = E.galois_representation()176sage: rho.non_surjective() # long time (4s on sage.math, 2014)177[3, 5]178sage: K = NumberField(x**2 + 1, 'a'); a = K.gen()179sage: E = EllipticCurve_from_j(1728).change_ring(K) # CM180sage: rho = E.galois_representation()181sage: rho.non_surjective()182[0]183sage: K = NumberField(x**2 - 5, 'a'); a = K.gen()184sage: E = EllipticCurve_from_j(146329141248*a - 327201914880) # CM185sage: rho = E.galois_representation()186sage: rho.non_surjective() # long time (3s on sage.math, 2014)187[0]188"""189try:190return _non_surjective(self.E, A)191except ValueError:192return [0]193194def is_surjective(self, p, A=100):195r"""196Returns True if the mod-p representation is (provably) surjective197onto `Aut(E[p]) = GL_2(\mathbb{F}_p)`.198199False if it is (probably) not.200201INPUT:202203* ``p`` - int - a prime number.204205* ``A`` - int - a bound on the number of traces of Frobenius to use206while trying to prove surjectivity.207208EXAMPLES::209210sage: K = NumberField(x**2 - 29, 'a'); a = K.gen()211sage: E = EllipticCurve([1, 0, ((5 + a)/2)**2, 0, 0])212sage: rho = E.galois_representation()213sage: rho.is_surjective(29) # Cyclotomic character not surjective.214False215sage: rho.is_surjective(7) # See Section 5.10 of [Serre72].216True217218If `E` is defined over `\QQ`, then the exceptional primes for `E_{/K}`219are the same as the exceptional primes for `E`, except for those primes220that are ramified in `K/\QQ` or are less than `[K:\QQ]`::221222sage: K = NumberField(x**2 + 11, 'a')223sage: E = EllipticCurve([2, 14])224sage: rhoQQ = E.galois_representation()225sage: rhoK = E.change_ring(K).galois_representation()226sage: rhoQQ.is_surjective(2) == rhoK.is_surjective(2)227False228sage: rhoQQ.is_surjective(3) == rhoK.is_surjective(3)229True230sage: rhoQQ.is_surjective(5) == rhoK.is_surjective(5)231True232"""233234return (_exceptionals(self.E, [p], A) == [])235236237def _non_surjective(E, patience=100):238r"""239Returns a list of primes `p` including all primes for which the mod-`p`240representation might not be surjective.241242INPUT:243244- ``E`` - EllipticCurve (over a number field).245246- ``A`` - int (a bound on the number of traces of Frobenius to use247while trying to prove surjectivity).248249OUTPUT:250251- ``list`` - A list of primes where mod-`p` representation is very likely252not surjective. At any prime not in this list, the representation is253definitely surjective. If E has CM, a ValueError is raised.254255EXAMPLES::256257sage: K = NumberField(x**2 - 29, 'a'); a = K.gen()258sage: E = EllipticCurve([1, 0, ((5 + a)/2)**2, 0, 0])259sage: sage.schemes.elliptic_curves.gal_reps_number_field._non_surjective(E) # See Section 5.10 of [Serre72].260[3, 5, 29]261sage: E = EllipticCurve_from_j(1728).change_ring(K) # CM262sage: sage.schemes.elliptic_curves.gal_reps_number_field._non_surjective(E)263Traceback (most recent call last):264...265ValueError: The curve E should not have CM.266"""267268E = _over_numberfield(E)269K = E.base_field()270271bad_primes = set([2, 3, 5, 7, 11, 13, 17, 19])272# The possible primes l unramified in K/QQ for which the image of the mod l273# Galois representation could be contained in an exceptional subgroup.274275# Find the places of additive reduction.276SA = []277for P, n in E.conductor().factor():278if n > 1:279SA.append(P)280# TODO: All we really require is a list of primes that include all281# primes at which E has additive reduction. Perhaps we can speed282# up things by doing something less time-consuming here that produces283# a list with some extra terms? (Of course, the longer this list is,284# the slower the rest of the computation is, so it is not clear that285# this would help...)286287for l in K.discriminant().prime_factors():288bad_primes.add(l)289290for l in _possible_normalizers(E, SA):291bad_primes.add(l)292293for l in _semistable_reducible_primes(E):294bad_primes.add(l)295for P in SA:296bad_primes.add(P.residue_field().characteristic())297298return _exceptionals(E, list(bad_primes), patience)299300301def _exceptionals(E, L, patience=1000):302r"""303Determine which primes in L are exceptional for E, using Proposition 19304of Section 2.8 of Serre's ``Proprietes Galoisiennes des Points d'Ordre305Fini des Courbes Elliptiques'' [Serre72].306307INPUT:308309- ``E`` - EllipticCurve - over a number field.310311- ``L`` - list - a list of prime numbers.312313- ``patience`` - int (a bound on the number of traces of Frobenius to314use while trying to prove surjectivity).315316OUTPUT: list - The list of all primes l in L for which the mod l image317might fail to be surjective.318319EXAMPLES::320321sage: K = NumberField(x**2 - 29, 'a'); a = K.gen()322sage: E = EllipticCurve([1, 0, ((5 + a)/2)**2, 0, 0])323sage: sage.schemes.elliptic_curves.gal_reps_number_field._exceptionals(E, [29, 31])324[29]325"""326327E = _over_numberfield(E)328K = E.base_field()329330output = []331332L = list(set(L)) # Remove duplicates from L.333334for l in L:335if l == 2: # c.f. Section 5.3(a) of [Serre72].336if (E.j_invariant() - 1728).is_square():337output.append(2)338elif not E.division_polynomial(2).is_irreducible():339output.append(2)340341elif l == 3: # c.f. Section 5.3(b) of [Serre72].342if K(-3).is_square():343output.append(3)344elif not (K['x'].gen()**3 - E.j_invariant()).is_irreducible():345output.append(3)346elif not E.division_polynomial(3).is_irreducible():347output.append(3)348349elif (K.discriminant() % l) == 0:350if not K['x'](cyclotomic_polynomial(l)).is_irreducible():351# I.E. if the action on lth roots of unity is not surjective352# (We want this since as a galois module, \wedge^2 E[l]353# is isomorphic to the lth roots of unity.)354output.append(l)355356for l in output:357L.remove(l)358if 2 in L:359L.remove(2)360if 3 in L:361L.remove(3)362363# If the image is not surjective, then it is contained in one of the364# maximal subgroups. So, we start by creating a dictionary between primes365# l in L and possible maximal subgroups in which the mod l image could366# be contained. This information is stored as a triple whose elements367# are True/False according to whether the mod l image could be contained368# in:369# 0. A borel or normalizer of split Cartan subgroup.370# 1. A nonsplit Cartan subgroup or its normalizer.371# 2. An exceptional subgroup of GL_2.372373D = {}374for l in L:375D[l] = [True, True, True]376377for P in K.primes_of_degree_one_iter():378try:379trace = E.change_ring(P.residue_field()).trace_of_frobenius()380except ArithmeticError: # Bad reduction at P.381continue382383patience -= 1384385determinant = P.norm()386discriminant = trace**2 - 4 * determinant387388unexc = [] # Primes we discover are unexceptional go here.389390for l in D.iterkeys():391tr = GF(l)(trace)392det = GF(l)(determinant)393disc = GF(l)(discriminant)394395if tr == 0:396# I.E. if Frob_P could be contained in the normalizer of397# a cartan subgroup, but not in the cartan subgroup.398continue399400if disc == 0:401# I.E. If the matrix might be non-diagonalizable over F_{p^2}.402continue403404if legendre_symbol(disc, l) == 1:405# If the matrix is diagonalizable over F_p, it can't be406# contained in a non-split cartan subgroup. Since we've407# gotten rid of the case where it is contained in the408# of a nonsplit cartan subgroup but not the cartan subgroup,409D[l][1] = False410else:411# If the matrix is not diagonalizable over F_p, it can't412# be contained borel subgroup.413D[l][0] = False414415if det != 0: # c.f. [Serre72], Section 2.8, Prop. 19416u = trace**2 / det417if u not in (1, 2, 4) and u**2 - 3 * u + 1 != 0:418D[l][2] = False419420421if D[l] == [False, False, False]:422unexc.append(l)423424for l in unexc:425D.pop(l)426unexc = []427428if (D == {}) or (patience == 0):429break430431for l in D.iterkeys():432output.append(l)433434output.sort()435return output436437438def _over_numberfield(E):439r"""Return `E`, defined over a NumberField object. This is necessary440since if `E` is defined over `\QQ`, then we cannot use SAGE commands441available for number fields.442443INPUT:444445- ``E`` - EllipticCurve - over a number field.446447OUTPUT:448449- If `E` is defined over a NumberField, returns E.450451- If `E` is defined over QQ, returns E defined over the NumberField QQ.452453EXAMPLES::454455sage: E = EllipticCurve([1, 2])456sage: sage.schemes.elliptic_curves.gal_reps_number_field._over_numberfield(E)457Elliptic Curve defined by y^2 = x^3 + x + 2 over Number Field in a with defining polynomial x458"""459460K = E.base_field()461462if K == QQ:463x = QQ['x'].gen()464K = NumberField(x, 'a')465E = E.change_ring(K)466467return E468469470def _tr12(tr, det):471r"""Compute `X^{12} + Y^{12}` given `X + Y` and `X * Y`.472473INPUT:474475- ``tr`` - The value of `X + Y`.476477- ``det`` - The value of `X * Y`.478479OUTPUT: The value of `X^{12} + Y^{12}`.480481EXAMPLES::482483sage: from sage.schemes.elliptic_curves.gal_reps_number_field import *484sage: X, Y = QQ['X, Y'].gens()485sage: sage.schemes.elliptic_curves.gal_reps_number_field._tr12(X + Y, X * Y)486X^12 + Y^12487"""488489det3 = det**3490return ((tr * (tr**2 - 3 * det))**2 - 2 * det3)**2 - 2 * det3**2491492493def _semistable_reducible_primes(E):494r"""Find a list containing all semistable primes l unramified in K/QQ495for which the Galois image for E could be reducible.496497INPUT:498499- ``E`` - EllipticCurve - over a number field.500501OUTPUT: list - A list of primes, which contains all primes l unramified502in K/QQ, such that E is semistable at all primes lying503over l, and the Galois image at l is reducible. If E has504CM defined over its ground field, a ValueError is raised.505506EXAMPLES::507508sage: E = EllipticCurve([0, -1, 1, -10, -20]) # X_0(11)509sage: 5 in sage.schemes.elliptic_curves.gal_reps_number_field._semistable_reducible_primes(E)510True511"""512513E = _over_numberfield(E)514K = E.base_field()515deg_one_primes = K.primes_of_degree_one_iter()516517bad_primes = set([]) # This will store the output.518519# We find two primes (of distinct residue characteristics) which are520# of degree 1, unramified in K/Q, and at which E has good reduction.521# Both of these primes will give us a nontrivial divisibility constraint522# on the exceptional primes l. For both of these primes P, we precompute523# a generator and the trace of Frob_P^12.524525precomp = []526last_char = 0 # The residue characteristic of the most recent prime.527528while len(precomp) < 2:529P = deg_one_primes.next()530531if not P.is_principal():532continue533534det = P.norm()535if det == last_char:536continue537538if P.ramification_index() != 1:539continue540541try:542tr = E.change_ring(P.residue_field()).trace_of_frobenius()543except ArithmeticError: # Bad reduction at P.544continue545546x = P.gens_reduced()[0]547548precomp.append((x, _tr12(tr, det)))549last_char = det550551x, tx = precomp[0]552y, ty = precomp[1]553554Kgal = K.galois_closure('b')555maps = K.embeddings(Kgal)556557for i in xrange(2 ** (K.degree() - 1)):558## We iterate through all possible characters. ##559560# Here, if i = i_{l-1} i_{l-2} cdots i_1 i_0 in binary, then i561# corresponds to the character prod sigma_j^{i_j}.562563phi1x = 1564phi2x = 1565phi1y = 1566phi2y = 1567568# We compute the two algebraic characters at x and y:569for j in xrange(K.degree()):570if i % 2 == 1:571phi1x *= maps[j](x)572phi1y *= maps[j](y)573else:574phi2x *= maps[j](x)575phi2y *= maps[j](y)576i = int(i/2)577578# Any prime with reducible image must divide both of:579gx = phi1x**12 + phi2x**12 - tx580gy = phi1y**12 + phi2y**12 - ty581582if (gx != 0) or (gy != 0):583for prime in Integer(Kgal.ideal([gx, gy]).norm()).prime_factors():584bad_primes.add(prime)585586continue587588## It is possible that our curve has CM. ##589590# Our character must be of the form Nm^K_F for an imaginary591# quadratic subfield F of K (which is the CM field if E has CM).592# We compute F:593594a = (Integer(phi1x + phi2x)**2 - 4 * x.norm()).squarefree_part()595596y = QQ['y'].gen()597F = NumberField(y**2 - a, 'a')598599# Next, we turn K into relative number field over F.600601K = K.relativize(F.embeddings(K)[0], 'b')602E = E.change_ring(K.structure()[1])603604## We try to find a nontrivial divisibility condition. ##605606patience = 5 * K.absolute_degree()607# Number of Frobenius elements to check before suspecting that E608# has CM and computing the set of CM j-invariants of K to check.609# TODO: Is this the best value for this parameter?610611while 1:612P = deg_one_primes.next()613614if not P.is_principal():615continue616617try:618tr = E.change_ring(P.residue_field()).trace_of_frobenius()619except ArithmeticError: # Bad reduction at P.620continue621622x = P.gens_reduced()[0].norm(F)623div = (x**12).trace() - _tr12(tr, x.norm())624625patience -= 1626627if div != 0:628# We found our divisibility constraint.629630for prime in Integer(div).prime_factors():631bad_primes.add(prime)632633# Turn K back into an absolute number field.634635E = E.change_ring(K.structure()[0])636K = K.structure()[0].codomain()637638break639640if patience == 0:641# We suspect that E has CM, so we check:642f = K.structure()[0]643if f(E.j_invariant()) in cm_j_invariants(f.codomain()):644raise ValueError, "The curve E should not have CM."645646L = list(bad_primes)647L.sort()648return L649650651def _possible_normalizers(E, SA):652r"""Find a list containing all primes `l` such that the Galois image at `l`653is contained in the normalizer of a Cartan subgroup, such that the654corresponding quadratic character is ramified only at the given primes.655656INPUT:657658- ``E`` - EllipticCurve - over a number field K.659660- ``SA`` - list - a list of primes of K.661662OUTPUT:663664- list - A list of primes, which contains all primes `l` such that the665Galois image at `l` is contained in the normalizer of a Cartan666subgroup, such that the corresponding quadratic character is667ramified only at primes in SA.668669- If `E` has geometric CM that is not defined over its ground field, a670ValueError is raised.671672EXAMPLES::673674sage: E = EllipticCurve([0,0,0,-56,4848])675sage: 5 in sage.schemes.elliptic_curves.gal_reps_number_field._possible_normalizers(E, [ZZ.ideal(2)])676True677"""678679E = _over_numberfield(E)680K = E.base_field()681SA = [K.ideal(I.gens()) for I in SA]682683x = K['x'].gen()684selmer_group = K.selmer_group(SA, 2) # Generators of the selmer group.685686if selmer_group == []:687return []688689V = VectorSpace(GF(2), len(selmer_group))690# We think of this as the character group of the selmer group.691692traces_list = []693W = V.zero_subspace()694695deg_one_primes = K.primes_of_degree_one_iter()696697while W.dimension() < V.dimension() - 1:698P = deg_one_primes.next()699700k = P.residue_field()701702defines_valid_character = True703# A prime P defines a quadratic residue character704# on the Selmer group. This variable will be set705# to zero if any elements of the selmer group are706# zero mod P (i.e. the character is ramified).707708splitting_vector = [] # This will be the values of this709# character on the generators of the Selmer group.710711for a in selmer_group:712abar = k(a)713if abar == 0:714# Ramification.715defines_valid_character = False716break717718if abar.is_square():719splitting_vector.append(GF(2)(0))720else:721splitting_vector.append(GF(2)(1))722723if not defines_valid_character:724continue725726if splitting_vector in W:727continue728729try:730Etilde = E.change_ring(k)731except ArithmeticError: # Bad reduction.732continue733734tr = Etilde.trace_of_frobenius()735736if tr == 0:737continue738739traces_list.append(tr)740741W = W + V.span([splitting_vector])742743bad_primes = set([])744745for i in traces_list:746for p in i.prime_factors():747bad_primes.add(p)748749# We find the unique vector v in V orthogonal to W:750v = W.matrix().transpose().kernel().basis()[0]751752# We find the element a of the selmer group corresponding to v:753a = 1754for i in xrange(len(selmer_group)):755if v[i] == 1:756a *= selmer_group[i]757758# Since we've already included the above bad primes, we can assume759# that the quadratic character corresponding to the exceptional primes760# we're looking for is given by mapping into Gal(K[\sqrt{a}]/K).761762patience = 5 * K.degree()763# Number of Frobenius elements to check before suspecting that E764# has CM and computing the set of CM j-invariants of K to check.765# TODO: Is this the best value for this parameter?766767while 1:768P = deg_one_primes.next()769770k = P.residue_field()771772if not k(a).is_square():773try:774tr = E.change_ring(k).trace_of_frobenius()775except ArithmeticError: # Bad reduction.776continue777778if tr == 0:779patience -= 1780781if patience == 0:782# We suspect E has CM, so we check:783if E.j_invariant() in cm_j_invariants(K):784raise ValueError, "The curve E should not have CM."785786else:787for p in tr.prime_factors():788bad_primes.add(p)789790bad_primes = list(bad_primes)791bad_primes.sort()792return bad_primes793794795796