Padics

P-adic fields are provided in Nemo by Flint. This allows construction of $p$-adic fields for any prime $p$.

P-adic fields are constructed using the FlintPadicField function. However, for convenience we define

PadicField = FlintPadicField

so that $p$-adic fields can be constructed using PadicField rather than FlintPadicField. Note that this is the name of the constructor, but not of padic field type.

The types of $p$-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Flint$\mathbb{Q}_p$padicPadicField

All the $p$-adic field types belong to the Field abstract type and the $p$-adic field element types belong to the FieldElem abstract type.

P-adic functionality

P-adic fields in Nemo implement all the AbstractAlgebra field functionality:.

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below, we document all the additional function that is provide by Nemo for p-adic fields.

Constructors

In order to construct $p$-adic field elements in Nemo, one must first construct the $p$-adic field itself. This is accomplished with one of the following constructors.

Nemo.FlintPadicFieldMethod
FlintPadicField(p::Integer, prec::Int; kw...)

Returns the parent object for the $p$-adic field for given prime $p$, where the default absolute precision of elements of the field is given by prec.

source

It is also possible to call the inner constructor directly. It has the following form.

FlintPadicField(p::fmpz, prec::Int)

Returns the parent object for the $p$-adic field for given prime $p$, where the default absolute precision of elements of the field is given by prec.

Here are some examples of creating $p$-adic fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

R = PadicField(7, 30)
S = PadicField(ZZ(65537), 30)

a = R()
b = S(1)
c = S(ZZ(123))
d = R(ZZ(1)//7^2)

Big-oh notation

Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.

AbstractAlgebra.OMethod
O(R::FlintPadicField, m::Integer)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintPadicField, m::fmpz)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintPadicField, m::fmpq)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source

The $O(p^n)$ construction can be used to construct $p$-adic values of precision $n$ by adding it to integer values representing the $p$-adic value modulo $p^n$ as in the examples.

Examples

R = PadicField(7, 30)
S = PadicField(ZZ(65537), 30)

c = 1 + 2*7 + 4*7^2 + O(R, 7^3)
d = 13 + 357*ZZ(65537) + O(S, ZZ(65537)^12)
f = ZZ(1)//7^2 + ZZ(2)//7 + 3 + 4*7 + O(R, 7^2)

Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.

Basic manipulation

Base.precisionMethod
precision(a::padic)

Return the precision of the given $p$-adic field element, i.e. if the element is known to $O(p^n)$ this function will return $n$.

source
AbstractAlgebra.valuationMethod
valuation(a::padic)

Return the valuation of the given $p$-adic field element, i.e. if the given element is divisible by $p^n$ but not a higher power of $p$ then the function will return $n$.

source
AbstractAlgebra.liftMethod
lift(R::FlintIntegerRing, a::padic)

Return a lift of the given $p$-adic field element to $\mathbb{Z}$.

source
AbstractAlgebra.liftMethod
lift(R::FlintRationalField, a::padic)

Return a lift of the given $p$-adic field element to $\mathbb{Q}$.

source

Examples

R = PadicField(7, 30)

a = 1 + 2*7 + 4*7^2 + O(R, 7^3)
b = 7^2 + 3*7^3 + O(R, 7^5)
c = R(2)

k = precision(a)
m = prime(R)
n = valuation(b)
p = lift(FlintZZ, a)
q = lift(FlintQQ, divexact(a, b))

Square root

Base.sqrtMethod
Base.sqrt(f::PolyElem{T}; check::Bool=true) where T <: RingElement

Return the square root of $f$. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.

Base.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem

Return the square root of $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::FieldElem)

Return the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement

Return the square root of the given Puiseux series $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Examples

R = PadicField(7, 30)

a = 1 + 7 + 2*7^2 + O(R, 7^3)
b = 2 + 3*7 + O(R, 7^5)
c = 7^2 + 2*7^3 + O(R, 7^4)

d = sqrt(a)
f = sqrt(b)
f = sqrt(c)
g = sqrt(R(121))

Special functions

Base.expMethod
exp(a::AbsSeriesElem)

Return the exponential of the power series $a$.

exp(a::RelSeriesElem)

Return the exponential of the power series $a$.

exp(a::Generic.LaurentSeriesElem)

Return the exponential of the power series $a$.

exp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the exponential of the given Puiseux series $a$.

Base.logMethod
log(a::SeriesElem{T}) where T <: FieldElement

Return the logarithm of the power series $a$.

log(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the logarithm of the given Puiseux series $a$.

Nemo.teichmullerMethod
teichmuller(a::padic)

Return the Teichmuller lift of the $p$-adic value $a$. We require the valuation of $a$ to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if $a$ is congruent to zero modulo $p$ we return zero. If the input is not valid an exception is thrown.

source

Examples

R = PadicField(7, 30)

a = 1 + 7 + 2*7^2 + O(R, 7^3)
b = 2 + 5*7 + 3*7^2 + O(R, 7^3)
c = 3*7 + 2*7^2 + O(R, 7^5)

c = exp(c)
d = log(a)
c = exp(R(0))
d = log(R(1))
f = teichmuller(b)