def test_type_2_primes(f, class_number): K = NumberField(f, "a") Kgal = K.galois_closure("b") embeddings = K.embeddings(Kgal) type_two_not_momose = get_type_2_not_momose(K, embeddings) _ = type_2_primes(K, embeddings, **TEST_SETTINGS) if class_number == 1: assert type_two_not_momose == set()
def test_type_three_not_momose(f, class_number, strong_L_count): K = NumberField(f, "a") Kgal = K.galois_closure("b") embeddings = K.embeddings(Kgal) strong_type_3_epsilons = get_strong_type_3_epsilons(K, embeddings) assert len(strong_type_3_epsilons) == 2 * strong_L_count type_3_not_momose_primes, _ = type_three_not_momose( K, embeddings, strong_type_3_epsilons) if class_number == 1: assert type_3_not_momose_primes == []
def _semistable_reducible_primes(E): r"""Find a list containing all semistable primes l unramified in K/QQ for which the Galois image for E could be reducible. INPUT: - ``E`` - EllipticCurve - over a number field. OUTPUT: list - A list of primes, which contains all primes l unramified in K/QQ, such that E is semistable at all primes lying over l, and the Galois image at l is reducible. If E has CM defined over its ground field, a ValueError is raised. EXAMPLES:: sage: E = EllipticCurve([0, -1, 1, -10, -20]) # X_0(11) sage: 5 in sage.schemes.elliptic_curves.gal_reps_number_field._semistable_reducible_primes(E) True """ E = _over_numberfield(E) K = E.base_field() deg_one_primes = K.primes_of_degree_one_iter() bad_primes = set([]) # This will store the output. # We find two primes (of distinct residue characteristics) which are # of degree 1, unramified in K/Q, and at which E has good reduction. # Both of these primes will give us a nontrivial divisibility constraint # on the exceptional primes l. For both of these primes P, we precompute # a generator and the trace of Frob_P^12. precomp = [] last_char = 0 # The residue characteristic of the most recent prime. while len(precomp) < 2: P = deg_one_primes.next() if not P.is_principal(): continue det = P.norm() if det == last_char: continue if P.ramification_index() != 1: continue try: tr = E.change_ring(P.residue_field()).trace_of_frobenius() except ArithmeticError: # Bad reduction at P. continue x = P.gens_reduced()[0] precomp.append((x, _tr12(tr, det))) last_char = det x, tx = precomp[0] y, ty = precomp[1] Kgal = K.galois_closure('b') maps = K.embeddings(Kgal) for i in xrange(2 ** (K.degree() - 1)): ## We iterate through all possible characters. ## # Here, if i = i_{l-1} i_{l-2} cdots i_1 i_0 in binary, then i # corresponds to the character prod sigma_j^{i_j}. phi1x = 1 phi2x = 1 phi1y = 1 phi2y = 1 # We compute the two algebraic characters at x and y: for j in xrange(K.degree()): if i % 2 == 1: phi1x *= maps[j](x) phi1y *= maps[j](y) else: phi2x *= maps[j](x) phi2y *= maps[j](y) i = int(i/2) # Any prime with reducible image must divide both of: gx = phi1x**12 + phi2x**12 - tx gy = phi1y**12 + phi2y**12 - ty if (gx != 0) or (gy != 0): for prime in Integer(Kgal.ideal([gx, gy]).norm()).prime_factors(): bad_primes.add(prime) continue ## It is possible that our curve has CM. ## # Our character must be of the form Nm^K_F for an imaginary # quadratic subfield F of K (which is the CM field if E has CM). # We compute F: a = (Integer(phi1x + phi2x)**2 - 4 * x.norm()).squarefree_part() y = QQ['y'].gen() F = NumberField(y**2 - a, 'a') # Next, we turn K into relative number field over F. K = K.relativize(F.embeddings(K)[0], 'b') E = E.change_ring(K.structure()[1]) ## We try to find a nontrivial divisibility condition. ## patience = 5 * K.absolute_degree() # Number of Frobenius elements to check before suspecting that E # has CM and computing the set of CM j-invariants of K to check. # TODO: Is this the best value for this parameter? while True: P = deg_one_primes.next() if not P.is_principal(): continue try: tr = E.change_ring(P.residue_field()).trace_of_frobenius() except ArithmeticError: # Bad reduction at P. continue x = P.gens_reduced()[0].norm(F) div = (x**12).trace() - _tr12(tr, x.norm()) patience -= 1 if div != 0: # We found our divisibility constraint. for prime in Integer(div).prime_factors(): bad_primes.add(prime) # Turn K back into an absolute number field. E = E.change_ring(K.structure()[0]) K = K.structure()[0].codomain() break if patience == 0: # We suspect that E has CM, so we check: f = K.structure()[0] if f(E.j_invariant()) in cm_j_invariants(f.codomain()): raise ValueError("The curve E should not have CM.") L = sorted(bad_primes) return L
def _semistable_reducible_primes(E): r"""Find a list containing all semistable primes l unramified in K/QQ for which the Galois image for E could be reducible. INPUT: - ``E`` - EllipticCurve - over a number field. OUTPUT: A list of primes, which contains all primes `l` unramified in `K/\mathbb{QQ}`, such that `E` is semistable at all primes lying over `l`, and the Galois image at `l` is reducible. If `E` has CM defined over its ground field, a ``ValueError`` is raised. EXAMPLES:: sage: E = EllipticCurve([0, -1, 1, -10, -20]) # X_0(11) sage: 5 in sage.schemes.elliptic_curves.gal_reps_number_field._semistable_reducible_primes(E) True """ E = _over_numberfield(E) K = E.base_field() deg_one_primes = K.primes_of_degree_one_iter() bad_primes = set([]) # This will store the output. # We find two primes (of distinct residue characteristics) which are # of degree 1, unramified in K/Q, and at which E has good reduction. # Both of these primes will give us a nontrivial divisibility constraint # on the exceptional primes l. For both of these primes P, we precompute # a generator and the trace of Frob_P^12. precomp = [] last_char = 0 # The residue characteristic of the most recent prime. while len(precomp) < 2: P = next(deg_one_primes) if not P.is_principal(): continue det = P.norm() if det == last_char: continue if P.ramification_index() != 1: continue try: tr = E.change_ring(P.residue_field()).trace_of_frobenius() except ArithmeticError: # Bad reduction at P. continue x = P.gens_reduced()[0] precomp.append((x, _tr12(tr, det))) last_char = det x, tx = precomp[0] y, ty = precomp[1] Kgal = K.galois_closure('b') maps = K.embeddings(Kgal) for i in xrange(2**(K.degree() - 1)): ## We iterate through all possible characters. ## # Here, if i = i_{l-1} i_{l-2} cdots i_1 i_0 in binary, then i # corresponds to the character prod sigma_j^{i_j}. phi1x = 1 phi2x = 1 phi1y = 1 phi2y = 1 # We compute the two algebraic characters at x and y: for j in xrange(K.degree()): if i % 2 == 1: phi1x *= maps[j](x) phi1y *= maps[j](y) else: phi2x *= maps[j](x) phi2y *= maps[j](y) i = int(i / 2) # Any prime with reducible image must divide both of: gx = phi1x**12 + phi2x**12 - tx gy = phi1y**12 + phi2y**12 - ty if (gx != 0) or (gy != 0): for prime in Integer(Kgal.ideal([gx, gy]).norm()).prime_factors(): bad_primes.add(prime) continue ## It is possible that our curve has CM. ## # Our character must be of the form Nm^K_F for an imaginary # quadratic subfield F of K (which is the CM field if E has CM). # We compute F: a = (Integer(phi1x + phi2x)**2 - 4 * x.norm()).squarefree_part() y = QQ['y'].gen() F = NumberField(y**2 - a, 'a') # Next, we turn K into relative number field over F. K = K.relativize(F.embeddings(K)[0], 'b') E = E.change_ring(K.structure()[1]) ## We try to find a nontrivial divisibility condition. ## patience = 5 * K.absolute_degree() # Number of Frobenius elements to check before suspecting that E # has CM and computing the set of CM j-invariants of K to check. # TODO: Is this the best value for this parameter? while True: P = next(deg_one_primes) if not P.is_principal(): continue try: tr = E.change_ring(P.residue_field()).trace_of_frobenius() except ArithmeticError: # Bad reduction at P. continue x = P.gens_reduced()[0].norm(F) div = (x**12).trace() - _tr12(tr, x.norm()) patience -= 1 if div != 0: # We found our divisibility constraint. for prime in Integer(div).prime_factors(): bad_primes.add(prime) # Turn K back into an absolute number field. E = E.change_ring(K.structure()[0]) K = K.structure()[0].codomain() break if patience == 0: # We suspect that E has CM, so we check: f = K.structure()[0] if f(E.j_invariant()) in cm_j_invariants(f.codomain()): raise ValueError("The curve E should not have CM.") L = sorted(bad_primes) return L