\(p\)-adic valuations on number fields and their subrings and completions

EXAMPLES:

sage: ZZ.valuation(2)
2-adic valuation
sage: QQ.valuation(3)
3-adic valuation
sage: CyclotomicField(5).valuation(5)
5-adic valuation
sage: GaussianIntegers().valuation(7)
7-adic valuation
sage: Zp(11).valuation()
11-adic valuation

These valuations can then, e.g., be used to compute approximate factorizations in the completion of a ring:

sage: v = ZZ.valuation(2)
sage: R.<x> = ZZ[]
sage: f = x^5 + x^4 + x^3 + x^2 + x - 1
sage: v.montes_factorization(f, required_precision=20)
(x + 676027) * (x^4 + 372550*x^3 + 464863*x^2 + 385052*x + 297869)

AUTHORS:

  • Julian Rüth (2013-03-16): initial version

REFERENCES:

The theory used here was originally developed in [Mac1936I] and [Mac1936II]. An overview can also be found in Chapter 4 of [Rüt2014].

class sage.rings.padics.padic_valuation.PadicValuationFactory

Bases: sage.structure.factory.UniqueFactory

Create a prime-adic valuation on R.

INPUT:

  • R – a subring of a number field or a subring of a local field in characteristic zero

  • prime – a prime that does not split, a discrete (pseudo-)valuation, a fractional ideal, or None (default: None)

EXAMPLES:

For integers and rational numbers, prime is just a prime of the integers:

sage: valuations.pAdicValuation(ZZ, 3)
3-adic valuation

sage: valuations.pAdicValuation(QQ, 3)
3-adic valuation

prime may be None for local rings:

sage: valuations.pAdicValuation(Qp(2))
2-adic valuation

sage: valuations.pAdicValuation(Zp(2))
2-adic valuation

But it must be specified in all other cases:

sage: valuations.pAdicValuation(ZZ)
Traceback (most recent call last):
...
ValueError: prime must be specified for this ring

It can sometimes be beneficial to define a number field extension as a quotient of a polynomial ring (since number field extensions always compute an absolute polynomial defining the extension which can be very costly):

sage: R.<x> = QQ[]
sage: K.<a> = NumberField(x^2 + 1)
sage: R.<x> = K[]
sage: L.<b> = R.quo(x^2 + a)
sage: valuations.pAdicValuation(L, 2)
2-adic valuation
create_key_and_extra_args(R, prime=None, approximants=None)

Create a unique key identifying the valuation of R with respect to prime.

EXAMPLES:

sage: QQ.valuation(2) # indirect doctest
2-adic valuation
create_key_and_extra_args_for_number_field(R, prime, approximants)

Create a unique key identifying the valuation of R with respect to prime.

EXAMPLES:

sage: GaussianIntegers().valuation(2) # indirect doctest
2-adic valuation
create_key_and_extra_args_for_number_field_from_ideal(R, I, prime)

Create a unique key identifying the valuation of R with respect to I.

Note

prime, the original parameter that was passed to create_key_and_extra_args(), is only used to provide more meaningful error messages

EXAMPLES:

sage: GaussianIntegers().valuation(GaussianIntegers().ideal(2)) # indirect doctest
2-adic valuation
create_key_and_extra_args_for_number_field_from_valuation(R, v, prime, approximants)

Create a unique key identifying the valuation of R with respect to v.

Note

prime, the original parameter that was passed to create_key_and_extra_args(), is only used to provide more meaningful error messages

EXAMPLES:

sage: GaussianIntegers().valuation(ZZ.valuation(2)) # indirect doctest
2-adic valuation
create_key_for_integers(R, prime)

Create a unique key identifying the valuation of R with respect to prime.

EXAMPLES:

sage: QQ.valuation(2) # indirect doctest
2-adic valuation
create_key_for_local_ring(R, prime)

Create a unique key identifying the valuation of R with respect to prime.

EXAMPLES:

sage: Qp(2).valuation() # indirect doctest
2-adic valuation
create_object(version, key, **extra_args)

Create a \(p\)-adic valuation from key.

EXAMPLES:

sage: ZZ.valuation(5) # indirect doctest
5-adic valuation
class sage.rings.padics.padic_valuation.pAdicFromLimitValuation(parent, approximant, G, approximants)

Bases: sage.rings.valuation.mapped_valuation.FiniteExtensionFromLimitValuation, sage.rings.padics.padic_valuation.pAdicValuation_base

A \(p\)-adic valuation on a number field or a subring thereof, i.e., a valuation that extends the \(p\)-adic valuation on the integers.

EXAMPLES:

sage: v = GaussianIntegers().valuation(3); v
3-adic valuation
extensions(ring)

Return the extensions of this valuation to ring.

EXAMPLES:

sage: v = GaussianIntegers().valuation(3)
sage: v.extensions(v.domain().fraction_field())
[3-adic valuation]
class sage.rings.padics.padic_valuation.pAdicValuation_base(parent, p)

Bases: sage.rings.valuation.valuation.DiscreteValuation

Abstract base class for \(p\)-adic valuations.

INPUT:

  • ring – an integral domain

  • p – a rational prime over which this valuation lies, not necessarily a uniformizer for the valuation

EXAMPLES:

   sage: ZZ.valuation(3)
   3-adic valuation

   sage: QQ.valuation(5)
   5-adic valuation

For `p`-adic rings, ``p`` has to match the `p` of the ring.

   sage: v = valuations.pAdicValuation(Zp(3), 2); v
   Traceback (most recent call last):
   ...
   ValueError: prime must be an element of positive valuation
change_domain(ring)

Change the domain of this valuation to ring if possible.

EXAMPLES:

sage: v = ZZ.valuation(2)
sage: v.change_domain(QQ).domain()
Rational Field
extensions(ring)

Return the extensions of this valuation to ring.

EXAMPLES:

sage: v = ZZ.valuation(2)
sage: v.extensions(GaussianIntegers())
[2-adic valuation]
is_totally_ramified(G, include_steps=False, assume_squarefree=False)

Return whether G defines a single totally ramified extension of the completion of the domain of this valuation.

INPUT:

  • G – a monic squarefree polynomial over the domain of this valuation

  • include_steps – a boolean (default: False); where to include the valuations produced during the process of checking whether G is totally ramified in the return value

  • assume_squarefree – a boolean (default: False); whether to assume that G is square-free over the completion of the domain of this valuation. Setting this to True can significantly improve the performance.

ALGORITHM:

This is a simplified version of sage.rings.valuation.valuation.DiscreteValuation.mac_lane_approximants().

EXAMPLES:

sage: k = Qp(5,4)
sage: v = k.valuation()
sage: R.<x> = k[]
sage: G = x^2 + 1
sage: v.is_totally_ramified(G)
False
sage: G = x + 1
sage: v.is_totally_ramified(G)
True
sage: G = x^2 + 2
sage: v.is_totally_ramified(G)
False
sage: G = x^2 + 5
sage: v.is_totally_ramified(G)
True
sage: v.is_totally_ramified(G, include_steps=True)
(True, [Gauss valuation induced by 5-adic valuation, [ Gauss valuation induced by 5-adic valuation, v((1 + O(5^4))*x) = 1/2 ]])

We consider an extension as totally ramified if its ramification index matches the degree. Hence, a trivial extension is totally ramified:

sage: R.<x> = QQ[]
sage: v = QQ.valuation(2)
sage: v.is_totally_ramified(x)
True
is_unramified(G, include_steps=False, assume_squarefree=False)

Return whether G defines a single unramified extension of the completion of the domain of this valuation.

INPUT:

  • G – a monic squarefree polynomial over the domain of this valuation

  • include_steps – a boolean (default: False); whether to include the approximate valuations that were used to determine the result in the return value.

  • assume_squarefree – a boolean (default: False); whether to assume that G is square-free over the completion of the domain of this valuation. Setting this to True can significantly improve the performance.

EXAMPLES:

We consider an extension as unramified if its ramification index is 1. Hence, a trivial extension is unramified:

sage: R.<x> = QQ[]
sage: v = QQ.valuation(2)
sage: v.is_unramified(x)
True

If G remains irreducible in reduction, then it defines an unramified extension:

sage: v.is_unramified(x^2 + x + 1)
True

However, even if G factors, it might define an unramified extension:

sage: v.is_unramified(x^2 + 2*x + 4)
True
lift(x)

Lift x from the residue field to the domain of this valuation.

INPUT:

EXAMPLES:

sage: v = ZZ.valuation(3)
sage: xbar = v.reduce(4)
sage: v.lift(xbar)
1
p()

Return the \(p\) of this \(p\)-adic valuation.

EXAMPLES:

sage: GaussianIntegers().valuation(2).p()
2
reduce(x)

Reduce x modulo the ideal of elements of positive valuation.

INPUT:

  • x – an element in the domain of this valuation

OUTPUT:

An element of the residue_field().

EXAMPLES:

sage: v = ZZ.valuation(3)
sage: v.reduce(4)
1
restriction(ring)

Return the restriction of this valuation to ring.

EXAMPLES:

sage: v = GaussianIntegers().valuation(2)
sage: v.restriction(ZZ)
2-adic valuation
value_semigroup()

Return the value semigroup of this valuation.

EXAMPLES:

sage: v = GaussianIntegers().valuation(2)
sage: v.value_semigroup()
Additive Abelian Semigroup generated by 1/2
class sage.rings.padics.padic_valuation.pAdicValuation_int(parent, p)

Bases: sage.rings.padics.padic_valuation.pAdicValuation_base

A \(p\)-adic valuation on the integers or the rationals.

EXAMPLES:

sage: v = ZZ.valuation(3); v
3-adic valuation
inverse(x, precision)

Return an approximate inverse of x.

The element returned is such that the product differs from 1 by an element of valuation at least precision.

INPUT:

  • x – an element in the domain of this valuation

  • precision – a rational or infinity

EXAMPLES:

sage: v = ZZ.valuation(2)
sage: x = 3
sage: y = v.inverse(3, 2); y
3
sage: x*y - 1
8

This might not be possible for elements of positive valuation:

sage: v.inverse(2, 2)
Traceback (most recent call last):
...
ValueError: element has no approximate inverse in this ring

Unless the precision is very small:

sage: v.inverse(2, 0)
1
residue_ring()

Return the residue field of this valuation.

EXAMPLES:

sage: v = ZZ.valuation(3)
sage: v.residue_ring()
Finite Field of size 3
simplify(x, error=None, force=False, size_heuristic_bound=32)

Return a simplified version of x.

Produce an element which differs from x by an element of valuation strictly greater than the valuation of x (or strictly greater than error if set.)

INPUT:

  • x – an element in the domain of this valuation

  • error – a rational, infinity, or None (default: None), the error allowed to introduce through the simplification

  • force – ignored

  • size_heuristic_bound – when force is not set, the expected factor by which the x need to shrink to perform an actual simplification (default: 32)

EXAMPLES:

sage: v = ZZ.valuation(2)
sage: v.simplify(6, force=True)
2
sage: v.simplify(6, error=0, force=True)
0

In this example, the usual rational reconstruction misses a good answer for some moduli (because the absolute value of the numerator is not bounded by the square root of the modulus):

sage: v = QQ.valuation(2)
sage: v.simplify(110406, error=16, force=True)
562/19
sage: Qp(2, 16)(110406).rational_reconstruction()
Traceback (most recent call last):
...
ArithmeticError: rational reconstruction of 55203 (mod 65536) does not exist
uniformizer()

Return a uniformizer of this \(p\)-adic valuation, i.e., \(p\) as an element of the domain.

EXAMPLES:

sage: v = ZZ.valuation(3)
sage: v.uniformizer()
3
class sage.rings.padics.padic_valuation.pAdicValuation_padic(parent)

Bases: sage.rings.padics.padic_valuation.pAdicValuation_base

The \(p\)-adic valuation of a complete \(p\)-adic ring.

INPUT:

  • R – a \(p\)-adic ring

EXAMPLES:

sage: v = Qp(2).valuation(); v #indirect doctest
2-adic valuation
element_with_valuation(v)

Return an element of valuation v.

INPUT:

EXAMPLES:

sage: R = Zp(3)
sage: v = R.valuation()
sage: v.element_with_valuation(3)
3^3 + O(3^23)

sage: K = Qp(3)
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^2 + 3*y + 3)
sage: L.valuation().element_with_valuation(3/2)
y^3 + O(y^43)
lift(x)

Lift x from the residue_field() to the domain of this valuation.

INPUT:

  • x – an element of the residue field of this valuation

EXAMPLES:

sage: R = Zp(3)
sage: v = R.valuation()
sage: xbar = v.reduce(R(4))
sage: v.lift(xbar)
1 + O(3^20)
reduce(x)

Reduce x modulo the ideal of elements of positive valuation.

INPUT:

  • x – an element of the domain of this valuation

OUTPUT:

An element of the residue_field().

EXAMPLES:

sage: R = Zp(3)
sage: Zp(3).valuation().reduce(R(4))
1
residue_ring()

Return the residue field of this valuation.

EXAMPLES:

sage: Qq(9, names='a').valuation().residue_ring()
Finite Field in a0 of size 3^2
shift(x, s)

Shift x in its expansion with respect to uniformizer() by s “digits”.

For non-negative s, this just returns x multiplied by a power of the uniformizer \(\pi\).

For negative s, it does the same but when not over a field, it drops coefficients in the \(\pi\)-adic expansion which have negative valuation.

EXAMPLES:

sage: R = ZpCA(2)
sage: v = R.valuation()
sage: v.shift(R.one(), 1)
2 + O(2^20)
sage: v.shift(R.one(), -1)
O(2^19)

sage: S.<y> = R[]
sage: S.<y> = R.extension(y^3 - 2)
sage: v = S.valuation()
sage: v.shift(1, 5)
y^5 + O(y^60)
simplify(x, error=None, force=False)

Return a simplified version of x.

Produce an element which differs from x by an element of valuation strictly greater than the valuation of x (or strictly greater than error if set.)

INPUT:

  • x – an element in the domain of this valuation

  • error – a rational, infinity, or None (default: None), the error allowed to introduce through the simplification

  • force – ignored

EXAMPLES:

sage: R = Zp(2)
sage: v = R.valuation()
sage: v.simplify(6)
2 + O(2^21)
sage: v.simplify(6, error=0)
0
uniformizer()

Return a uniformizer of this valuation.

EXAMPLES:

sage: v = Zp(3).valuation()
sage: v.uniformizer()
3 + O(3^21)