Elements of the p-adic field Q_p c_(e)p^(e) + c_(e + 1)p^(e + 1) + ... (with e in Z and c_e != 0) are stored in truncated form c_(e)p^(e) + c_(e + 1)p^(e + 1) + ... + O(p^s). The (p-adic) valuation of such an element is the integer e.
Elements with non-negative valuation in Q_p, form the ring of integers Z_p of Q_p.
There are four main types of p-adic structure in Magma for any prime p. Two of those concern Q_p, and two relate to Z_p. In both cases there is a structure type for elements to arbitrary precision and one for elements to a fixed precision. We will sometimes refer to structures representing Q_p as p-adic fields, and to those representing Z_p as p-adic rings. We will describe these four different kinds of structure in more detail below.
Associated to any element of x in Q_p are two kinds of precision:
the absolute precision s and the relative precision
r. The absolute precision is related to the largest known term in the
expansion of x, that is, it is s in:
x=c_(e)p^(e) + c_(e + 1)p^(e + 1) + ... + c_(s - 1)p^(s - 1) + O(p^s).
The relative precision indicates the range of known coefficients
(starting at the first non-zero), and
equals the number s - e in the above expansion, where c_e != 0.
Thus absolute precision s, relative precision r and valuation e
are related by s=r + e.
Every p-adic field or ring will have a default precision to which
elements are shown by default, even though they may well be stored to
a higher precision.
Arbitrary versus fixed precision
The Magma structures in which elements can have arbitrary precision most closely resemble the mathematical objects Z_p and Q_p. For lack of a better word we will sometimes refer to these structures as the free field or ring. Elements in those carry their own absolute precision with them. Operations usually return results to a precision that is maximal given the input (and the nature of the operation). Elements of free structures that have finite p-adic expansion (integers and rationals) can be created and stored exactly, with infinite (absolute and relative) precision. Also note that the relative precision will be 0 for approximations to 0.
The structures with fixed precision, which we will sometimes refer to
as quotient structures behave differently. All elements in the
rings of fixed precision have the same fixed absolute precision.
This means that the ring
with fixed precision r behaves like Z_p/p^r Z_p isomorphic to Z/p^rZ,
the residue class ring with p^r elements.
Elements of the fields of fixed precision, the `quotient fields'
roughly equal to Q_p/p^r Q_p, consist of fixed precision ring elements
multiplied by a power of p (`shifted' left or right). Hence the
fixed precision fields contain elements of bounded relative precision
but arbitrary absolute precision.
The element 0 in the quotient field is stored as zero with infinite absolute
precision.
Equality
Some care has to be taken with the interpretation of equality
in p-adic structures.
Two elements a and b in
the same p-adic ring are considered
equal if and only if their absolute precisions r_1, r_2,
are equal as well as
all of their known coefficients;
that is, if and only if
for every n <= r_1=r_2 the coefficients a_n and b_n are equal.
Coercion
Homomorphisms