Skip to content

Commit

Permalink
Trac #26144: principal_part_bound can be wrong when key has multiple …
Browse files Browse the repository at this point in the history
…slopes

Currently, the following fails:
{{{
sage: R.<x> = QQ[]
sage: v_2 = QQ.valuation(2)
sage: f = x^36 + 1160/81*x^31 + 9920/27*x^30 + 1040/81*x^26 +
52480/81*x^25 + 220160/81*x^24 - 5120/81*x^21 - 143360/81*x^20 -
573440/81*x^19 + 12451840/81*x^18 - 266240/567*x^16 - 20316160/567*x^15
- 198737920/189*x^14 - 1129840640/81*x^13 - 1907359744/27*x^12 +
8192/81*x^11 + 655360/81*x^10 + 5242880/21*x^9 + 2118123520/567*x^8 +
15460204544/567*x^7 + 6509559808/81*x^6 - 16777216/567*x^2 -
268435456/567*x - 1073741824/567
sage: v_2.mac_lane_approximants(f)
AssertionError
}}}

with the changes proposed by this ticket, this is
{{{
[[ Gauss valuation induced by 2-adic valuation, v(x + 2056) = 23/2 ],
 [ Gauss valuation induced by 2-adic valuation, v(x) = 11/9 ],
 [ Gauss valuation induced by 2-adic valuation, v(x) = 2/5, v(x^5 + 4) =
7/2 ],
 [ Gauss valuation induced by 2-adic valuation, v(x) = 3/5, v(x^10 +
8*x^5 + 64) = 7 ],
 [ Gauss valuation induced by 2-adic valuation, v(x) = 3/5, v(x^5 + 8) =
5 ]]
}}}

URL: https://trac.sagemath.org/26144
Reported by: saraedum
Ticket author(s): Julian Rüth
Reviewer(s): Stefan Wewers
  • Loading branch information
Release Manager authored and vbraun committed Dec 23, 2018
2 parents 9c89911 + e47eded commit eee1f25
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 13 deletions.
89 changes: 76 additions & 13 deletions src/sage/rings/valuation/inductive_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def augmentation(self, phi, mu, check=True):
from .augmented_valuation import AugmentedValuation
return AugmentedValuation(self, phi, mu, check)

def mac_lane_step(self, G, principal_part_bound=None, assume_squarefree=False, assume_equivalence_irreducible=False, report_degree_bounds_and_caches=False, coefficients=None, valuations=None, check=True):
def mac_lane_step(self, G, principal_part_bound=None, assume_squarefree=False, assume_equivalence_irreducible=False, report_degree_bounds_and_caches=False, coefficients=None, valuations=None, check=True, allow_equivalent_key=True):
r"""
Perform an approximation step towards the squarefree monic non-constant
integral polynomial ``G`` which is not an :meth:`equivalence unit <InductiveValuation.is_equivalence_unit>`.
Expand Down Expand Up @@ -698,6 +698,54 @@ def mac_lane_step(self, G, principal_part_bound=None, assume_squarefree=False, a
non-constant integral polynomial and not an :meth:`equivalence unit <InductiveValuation.is_equivalence_unit>`
(default: ``True``)
- ``allow_equivalent_key`` -- whether to return valuations which end in
essentially the same key polynomial as this valuation but have a
higher valuation assigned to that key polynomial (default: ``True``)
EXAMPLES:
We can use this method to perform the individual steps of
:meth:`~sage.rings.valuation.valuation.DiscreteValuation.mac_lane_approximants`::
sage: R.<x> = QQ[]
sage: v = QQ.valuation(2)
sage: f = x^36 + 1160/81*x^31 + 9920/27*x^30 + 1040/81*x^26 + 52480/81*x^25 + 220160/81*x^24 - 5120/81*x^21 - 143360/81*x^20 - 573440/81*x^19 + 12451840/81*x^18 - 266240/567*x^16 - 20316160/567*x^15 - 198737920/189*x^14 - 1129840640/81*x^13 - 1907359744/27*x^12 + 8192/81*x^11 + 655360/81*x^10 + 5242880/21*x^9 + 2118123520/567*x^8 + 15460204544/567*x^7 + 6509559808/81*x^6 - 16777216/567*x^2 - 268435456/567*x - 1073741824/567
sage: v.mac_lane_approximants(f)
[[ Gauss valuation induced by 2-adic valuation, v(x + 2056) = 23/2 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 11/9 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 2/5, v(x^5 + 4) = 7/2 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 3/5, v(x^10 + 8*x^5 + 64) = 7 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 3/5, v(x^5 + 8) = 5 ]]
Starting from the Gauss valuation, a MacLane step branches off with
some linear key polynomials in the above example::
sage: v0 = GaussValuation(R, v)
sage: V1 = v0.mac_lane_step(f); V1
[[ Gauss valuation induced by 2-adic valuation, v(x) = 3/5 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 2/5 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 3 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 11/9 ]]
The computation of MacLane approximants would now perform a MacLane
step on each of these branches, note however, that a direct call to
this method might produce some unexpected results::
sage: V1[0].mac_lane_step(f)
[[ Gauss valuation induced by 2-adic valuation, v(x) = 3/5, v(x^5 + 8) = 5 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 3/5, v(x^10 + 8*x^5 + 64) = 7 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 3 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 11/9 ]]
Note how this detected the two augmentations of ``V1[0]`` but also two
other valuations that we had seen in the previous step and that are
greater than ``V1[0]``. To ignore such trivial augmentations, we can
set ``allow_equivalent_key``::
sage: V1[0].mac_lane_step(f, allow_equivalent_key=False)
[[ Gauss valuation induced by 2-adic valuation, v(x) = 3/5, v(x^5 + 8) = 5 ],
[ Gauss valuation induced by 2-adic valuation, v(x) = 3/5, v(x^10 + 8*x^5 + 64) = 7 ]]
TESTS::
sage: K.<x> = FunctionField(QQ)
Expand Down Expand Up @@ -782,9 +830,28 @@ def mac_lane_step(self, G, principal_part_bound=None, assume_squarefree=False, a
assert len(F) == 1
break

if not allow_equivalent_key and self.phi().degree() == phi.degree():
# We ignore augmentations that could have been detected in
# the previous MacLane step, see [Rüt2014, Theorem 4.33],
# i.e., we ignore key polynomials that are equivalent to
# the current key in the sense of that theorem.
if self.is_equivalent(self.phi(), phi):
continue

verbose("Determining the augmentation of %s for %s" % (self, phi), level=11)

base = self
if phi.degree() == base.phi().degree():
# very frequently, the degree of the key polynomials
# stagnate for a bit while the valuation of the key
# polynomial is slowly increased.
# In this case, we can drop previous key polynomials
# of the same degree. (They have no influence on the
# phi-adic expansion.)
if not base.is_gauss_valuation():
base = base._base_valuation
old_mu = self(phi)
w = self.augmentation(phi, old_mu, check=False)
w = base.augmentation(phi, old_mu, check=False)

# we made some experiments here: instead of computing the
# coefficients again from scratch, update the coefficients when
Expand Down Expand Up @@ -822,23 +889,15 @@ def mac_lane_step(self, G, principal_part_bound=None, assume_squarefree=False, a
new_mu = old_mu - slope
new_valuations = [val - (j*slope if slope is not -infinity else (0 if j == 0 else -infinity))
for j,val in enumerate(w_valuations)]
base = self
if phi.degree() == base.phi().degree():
# very frequently, the degrees of the key polynomials
# stagnate for a bit while the valuation of the key
# polynomial is slowly increased.
# In this case, we can drop previous key polynomials
# of the same degree. (They have no influence on the
# phi-adic expansion.)
assert new_mu > self(phi)
if not base.is_gauss_valuation():
base = base._base_valuation
if phi.degree() == self.phi().degree():
assert new_mu > self(phi), "the valuation of the key polynomial must increase when the degree stagnates"
# phi has already been simplified internally by the
# equivalence_decomposition method but we can now possibly
# simplify it further as we know exactly up to which
# precision it needs to be defined.
phi = base.simplify(phi, new_mu, force=True)
w = base.augmentation(phi, new_mu, check=False)
verbose("Augmented %s to %s"%(self, w), level=13)
assert slope is -infinity or 0 in w.newton_polygon(G).slopes(repetition=False)

from sage.rings.all import ZZ
Expand All @@ -848,6 +907,10 @@ def mac_lane_step(self, G, principal_part_bound=None, assume_squarefree=False, a
assert degree_bound >= phi.degree()
ret.append((w, degree_bound, multiplicities[slope], w_coefficients, new_valuations))

if len(ret) == 0:
assert not allow_equivalent_key, "a MacLane step produced no augmentation"
assert 0 not in self.newton_polygon(G).slopes(), "a MacLane step produced no augmentation but the valuation given to the key polynomial was correct, i.e., it appears to come out of a call to mac_lane_approximants"

assert ret, "a MacLane step produced no augmentations"
if not report_degree_bounds_and_caches:
ret = [v for v,_,_,_,_ in ret]
Expand Down
14 changes: 14 additions & 0 deletions src/sage/rings/valuation/valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,20 @@ def create_children(node):
coefficients=node.coefficients,
valuations=node.valuations,
check=False,
# We do not want to see augmentations that are
# already part of other branches of the tree of
# valuations for obvious performance reasons and
# also because the principal_part_bound would be
# incorrect for these.
allow_equivalent_key=node.valuation.is_gauss_valuation(),
# The length of an edge in the Newton polygon in
# one MacLane step bounds the length of the
# principal part (i.e., the part with negative
# slopes) of the Newton polygons in the next
# MacLane step. Therefore, mac_lane_step does not
# need to compute valuations for coefficients
# beyond that bound as they do not contribute any
# augmentations.
principal_part_bound=node.principal_part_bound)
for w, bound, principal_part_bound, coefficients, valuations in augmentations:
ef = bound == w.E()*w.F()
Expand Down

0 comments on commit eee1f25

Please sign in to comment.