Since p-adic rings are completions (like the real numbers), it is difficult to represent their elements in an exact form. As described in Section Background, any element x of a local ring L can be expressed as a power series in the uniformizing element of L. Most problems can be solved by computing in a finite quotient of L, which is equivalent to truncating the infinite expansion of x at some point. More precisely, we work in the quotient rings L / πk L for non-negative k, which is called the precision of the ring L.
Unfortunately, working with finite approximations to elements does have problems. Some operations on these approximations will yield results with reduced precision. For example, in a ring constructed with precision k the quotient of two elements with valuations v1 ≥v2 lies in the local ring, but can only be determined up to k - v2 digits. Also, it is only possible in general to construct an approximation to the GCD of two polynomials f and g over a local ring.
Magma offers three models for computing in a local ring L. The first model (the fixed precision model) allows the user to work with the quotient rings defined above. These quotient rings are finite structures, and their elements can easily be represented exactly; hence, many exact algorithms can be applied to them. On the other hand, precision management is left to the user, since operations which may lose precision, such as division, will still return results to the full precision of the ring. In the second model (the free precision model), the user works more directly with L, instead of a finite quotient of L. Each element is still represented by a finite approximation, however, these approximations can be of varying precisions, thus freeing the user from precision management. However, these rings are inexact (for instance, there is no zero element of the ring, only approximations to it), and hence many algorithms in Magma which are designed for exact rings may cause significant precision loss. The situation is analogous to the support for real numbers in Magma.
The third model is that of the exact p-adic rings which use a lazy representation and delay any computations to a precision. Such exact objects know how to compute digits to a given precision although they may not know what any of those digits are. These rings are explained further in Section Exact p-Adic Rings.
A local field in Magma is the field of fractions of a local ring. Representing a local field on a machine causes some trouble, since there is no algebraic structure in which truncations of the elements could be interpreted (as in the case of the finite quotients for the local rings). Moreover, all structural information of a local field is already contained in its ring of integers, so that the main motivation for supporting local fields is to provide some basic arithmetic.
An element x of a local field L is stored internally as x = πv u + O(πv + k), where v is the (possibly negative) valuation of x, and u is a unit known to precision k in the ring of integers of L. It can happen that operations in a field yield elements with no known digits at all, since the unit parts may not overlap.
Free precision rings and fields can be created with bounded or unbounded precision. If they are created with some bounded precision k, then no element in the structure can have precision greater than k. Thus, bounded free precision rings are "inexact" versions of the fixed precision rings. Unbounded precision structures can have elements with arbitrarily large, but not infinite, precision. In general, it is recommended that free precision structures are utilized unless speed is absolutely critical.
In Magma, all measurements of precision are made with respect to a valuation function vπ which takes the uniformizer π of the local ring L to unity (throughout this chapter, the subscript will be dropped on vπ where there is no ambiguity). This can have surprising results. For instance, consider a local ring L1 which extends L2, such that the ramification degree of L1 over L2 is e. Let π1 and π2 be the uniformizing elements of L1 and L2, respectively. Then, v_(π1)(π1) = 1, and v_(π1)(π2) = e. Hence, an element of precision k in L2 will have precision ek in when mapped into L1. Thus, it is important to always remember in which ring precision is determined.