Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 281ffdd

Browse files
committed
Fix creating valuations from prime ideals
The initial versions of the valuations coming out of mac_lane_approximants() might not be able to detect the generators of the defining prime ideal depending on how those generators were chosen. However, eventually the correct refinement must have v(g)>0 for all generators. Since v'(g) ≥ v(g) for a refinement v' of v, we are also sure not to detect the wrong extension in the initial steps.
1 parent 10ed24e commit 281ffdd

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

src/sage/rings/padics/padic_valuation.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
3636
"""
3737
#*****************************************************************************
38-
# Copyright (C) 2013-2018 Julian Rüth <[email protected]>
38+
# Copyright (C) 2013-2020 Julian Rüth <[email protected]>
3939
#
4040
# Distributed under the terms of the GNU General Public License (GPL)
4141
# as published by the Free Software Foundation; either version 2 of
@@ -285,6 +285,20 @@ def create_key_and_extra_args_for_number_field_from_ideal(self, R, I, prime):
285285
sage: GaussianIntegers().valuation(GaussianIntegers().ideal(2)) # indirect doctest
286286
2-adic valuation
287287
288+
TESTS:
289+
290+
Verify that :trac:`28976` has been resolved::
291+
292+
sage: R.<x> = QQ[]
293+
sage: K.<a> = NumberField(x^6 - 18*x^4 - 24*x^3 + 27*x^2 + 36*x - 6)
294+
sage: I = K.fractional_ideal((2, -7/44*a^5 + 19/44*a^4 + 87/44*a^3 - 87/44*a^2 - 5/2*a + 39/22))
295+
sage: I.norm()
296+
2
297+
sage: I in K.primes_above(2)
298+
True
299+
sage: K.valuation(I)
300+
[ 2-adic valuation, v(x + 1) = 1/2 ]-adic valuation
301+
288302
"""
289303
K, L, G = self._normalize_number_field_data(R)
290304

@@ -297,14 +311,20 @@ def create_key_and_extra_args_for_number_field_from_ideal(self, R, I, prime):
297311
if len(F) != 1:
298312
raise ValueError("%r does not lie over a single prime of %r"%(I, K))
299313
vK = K.valuation(F[0][0])
300-
candidates = vK.mac_lane_approximants(G, require_incomparability=True)
314+
approximants = vK.mac_lane_approximants(G, require_incomparability=True)
301315

302-
candidates_for_I = [c for c in candidates if all(c(g.polynomial()) > 0 for g in I.gens())]
303-
assert(len(candidates_for_I) > 0) # This should not be possible, unless I contains a unit
304-
if len(candidates_for_I) > 1:
305-
raise ValueError("%s does not single out a unique extension of %s to %s"%(prime, vK, L))
306-
else:
307-
return (R, candidates_for_I[0]), {'approximants': candidates}
316+
candidates = approximants[:]
317+
318+
# Refine candidates until we can detect which valuation corresponds to the ideal I
319+
while True:
320+
match = [i for (i, v) in enumerate(candidates) if all(v(g.polynomial()) > 0 for g in I.gens())]
321+
322+
if len(match) > 1:
323+
raise ValueError("%s does not single out a unique extension of %s to %s"%(prime, vK, L))
324+
if len(match) == 1:
325+
return (R, approximants[match[0]]), {'approximants': approximants}
326+
327+
candidates = [v.mac_lane_step(G)[0] for v in candidates]
308328

309329
def _normalize_number_field_data(self, R):
310330
r"""

0 commit comments

Comments
 (0)