FLINT3.7.0-dev
Algorithm

Arithmetic in unramified extensions

Cost
Multiplication: O(M(d⋅Nlog⁡p))O(M(d \cdot N\log p)) by Kronecker substitution plus O(dt)O(dt) for the reduction (tt terms in ff); trace: O(dt)O(dt) operations modulo pNp^N; norm: one (2d−1)×(2d−1)(2d-1) \times (2d-1) determinant modulo pNp^N, or a logarithm, a trace and an exponential.

An unramified extension of Qp\mathbf{Q}_p of degree dd is Qq=Qp[X]/(f)\mathbf{Q}_q = \mathbf{Q}_p[X]/(f), q=pdq = p^d, for a monic f∈Zp[X]f \in \mathbf{Z}_p[X] whose reduction fˉ\bar f modulo pp is irreducible over Fp\mathbf{F}_p. It depends only on dd, its ring of integers is Zq=Zp[X]/(f)\mathbf{Z}_q = \mathbf{Z}_p[X]/(f), and its residue field is Zq/pZq≅Fp[X]/(fˉ)=Fq\mathbf{Z}_q / p\mathbf{Z}_q \cong \mathbf{F}_p[X]/(\bar f) = \mathbf{F}_q. In particular pp is still a uniformiser: every nonzero element is pvup^v u with u∈Zq×u \in \mathbf{Z}_q^\times, and u∈Zqu \in \mathbf{Z}_q is a unit if and only if its reduction in Fq\mathbf{F}_q is nonzero [Rob2000, Ch. 3]. The Frobenius automorphism and Teichmüller lifts are treated in Frobenius automorphism and Teichmüller lifts in unramified extensions.

Representation#

A qadic_ctx_t stores ff with integer coefficients in [0,p)[0, p) as a sparse list of terms f=∑kakXjkf = \sum_k a_k X^{j_k}, j0<⋯<jt−1=dj_0 < \cdots < j_{t-1} = d, at−1=1a_{t-1} = 1. By default (qadic_ctx_init) ff is the Conway polynomial for (p,d)(p, d) if the database has it, otherwise the polynomial chosen by nmod_poly_minimal_irreducible for word-size pp, or a random sparse irreducible polynomial for larger pp; any monic polynomial irreducible modulo pp can be supplied instead (Defining polynomials).

An element is a padic_poly_t pvg(X)p^v g(X) with deg⁡g<d\deg g < d, where the coefficients of gg are reduced modulo pN−vp^{N - v} and not all divisible by pp; this is the fixed-precision model of The fixed-precision model of padic and qadic. Since gg has a coefficient that is a unit of Zp\mathbf{Z}_p, its image in Fq\mathbf{F}_q is nonzero, so vv is the valuation of the element and gg represents a unit of Zq\mathbf{Z}_q.

Multiplication and reduction#

The product of pvgp^{v} g and pwhp^{w} h is pv+wghp^{v + w} gh; as gˉhˉ≠0\bar g \bar h \ne 0 in the field Fq\mathbf{F}_q, the product is again canonical and no factor of pp has to be removed. qadic_mul multiplies gg and hh in Z[X]\mathbb{Z}[X] (_fmpz_poly_mul, which uses Kronecker substitution or other methods depending on the sizes, Multiplying polynomials over Z) and reduces the product modulo ff and pN−v−wp^{N - v - w}.

Algorithm 1: Reduction modulo a sparse monic polynomial

Input: R=∑i<ℓriXi∈Z[X]R = \sum_{i < \ell} r_i X^i \in \mathbb{Z}[X] and f=Xd+∑k<t−1akXjkf = X^d + \sum_{k < t - 1} a_k X^{j_k}.

Output: R mod fR \bmod f, of length at most dd.

  1. For i=ℓ−1,ℓ−2,…,di = \ell - 1, \ell - 2, \ldots, d: for each k<t−1k < t - 1, subtract riakr_i a_k from ri−d+jkr_{i - d + j_k}; then set ri=0r_i = 0.

Each step removes the term riXir_i X^i by subtracting riXi−dfr_i X^{i - d} f, so the result is congruent to RR modulo ff. The reduction costs (ℓ−d)(t−1)(\ell - d)(t - 1) multiply-subtracts, which is small compared with the product when ff is sparse, as Conway polynomials and the minimal-weight polynomials used by default usually are. The coefficients are reduced modulo pN−vp^{N - v} once, after the reduction modulo ff (_fmpz_mod_poly_reduce). The same functions serve qadic_reduce and the powering, inversion, Frobenius and series evaluation routines of qadic. The finite field modules use the same sparse elimination (Reduction modulo the defining polynomial).

qadic_pow uses left-to-right binary exponentiation with this reduction.

Inversion#

The inverse of pvgp^v g is p−vg−1p^{-v} g^{-1}, and g−1g^{-1} is computed by the Newton iteration z←2z−gz2z \gets 2z - gz^2 in Zq\mathbf{Z}_q (Inverses), starting from the inverse of gˉ\bar g in Fq\mathbf{F}_q, which _qadic_inv computes by the extended Euclidean algorithm in Fp[X]\mathbf{F}_p[X] modulo fˉ\bar f. The total cost is a constant number of multiplications in Zq\mathbf{Z}_q at precision NN.

Trace#

The trace Tr⁡(x)\operatorname{Tr}(x) of x∈Qqx \in \mathbf{Q}_q is the trace of multiplication by xx as a Qp\mathbf{Q}_p-linear map, equivalently the sum of the images of xx under the dd embeddings into an algebraic closure. For x=∑i<dciXix = \sum_{i < d} c_i X^i it is ∑iciSi\sum_i c_i S_i, where Si=∑f(θ)=0θiS_i = \sum_{f(\theta) = 0} \theta^i are the power sums of the roots of ff.

Proposition 1 (Newton's identities). For monic f=Xd+∑m=1dbmXd−mf = X^d + \sum_{m = 1}^{d} b_m X^{d - m} the power sums satisfy S0=dS_0 = d and, for 1≤i<d1 \le i < d,

Si=−(i bi+∑m=1i−1bmSi−m).S_i = -\Bigl(i\, b_i + \sum_{m = 1}^{i - 1} b_m S_{i - m}\Bigr).

_qadic_trace evaluates this recurrence on the sparse representation, in which only the m=d−jkm = d - j_k with ak≠0a_k \ne 0 contribute, so that S0,…,Sℓ−1S_0, \ldots, S_{\ell-1} for an element of length ℓ\ell cost O(ℓt)O(\ell t) operations modulo pNp^N, and then forms ∑ciSi\sum c_i S_i. As Qq/Qp\mathbf{Q}_q/\mathbf{Q}_p is unramified, Tr⁡(Zq)=Zp\operatorname{Tr}(\mathbf{Z}_q) = \mathbf{Z}_p; the trace of pvgp^v g is pvTr⁡(g)p^v \operatorname{Tr}(g), which may have valuation larger than vv, and qadic_trace canonicalises it.

Norm#

The norm N(x)N(x) is the determinant of multiplication by xx, or the product of the conjugates of xx; N(pvg)=pdvN(g)N(p^v g) = p^{dv} N(g), and N(g)N(g) is a unit for a unit gg. FLINT has two methods.

The resultant method uses N(g)=Res⁡(f,g)N(g) = \operatorname{Res}(f, g) for monic ff, which holds because Res⁡(f,g)=∏f(θ)=0g(θ)\operatorname{Res}(f, g) = \prod_{f(\theta) = 0} g(\theta). _qadic_norm_resultant builds the Sylvester matrix of ff and gg, of dimension at most 2d−12d - 1, and computes its determinant modulo pNp^N with fmpz_mod_mat_det, which uses Gaussian elimination when the pivots it meets are invertible and falls back to the division-free Berkowitz algorithm otherwise.

The analytic method applies when g≡1(modp)g \equiv 1 \pmod p (modulo 4 if p=2p = 2).

Proposition 2. If x∈1+pZqx \in 1 + p\mathbf{Z}_q (1+4Zq1 + 4\mathbf{Z}_q if p=2p = 2), then N(x)=exp⁡(Tr⁡(log⁡x))N(x) = \exp(\operatorname{Tr}(\log x)).

Proof. The automorphisms σ\sigma of Qq/Qp\mathbf{Q}_q/\mathbf{Q}_p are continuous, so they commute with the power series: log⁡(σx)=σ(log⁡x)\log(\sigma x) = \sigma(\log x). Hence log⁡N(x)=log⁡∏σσ(x)=∑σσ(log⁡x)=Tr⁡(log⁡x)\log N(x) = \log \prod_\sigma \sigma(x) = \sum_\sigma \sigma(\log x) = \operatorname{Tr}(\log x). Both log⁡x\log x and its trace lie in pZpp\mathbf{Z}_p (in 4Z24\mathbf{Z}_2 for p=2p = 2), where exp⁡\exp converges and inverts log⁡\log, and N(x)∈1+pZpN(x) \in 1 + p\mathbf{Z}_p (respectively 1+4Z21 + 4\mathbf{Z}_2), so exp⁡(log⁡N(x))=N(x)\exp(\log N(x)) = N(x).

_qadic_norm_analytic computes the logarithm in Zq\mathbf{Z}_q, its trace and the exponential in Zp\mathbf{Z}_p (The p-adic exponential and logarithm); its cost is quasi-linear in dd and NN. _qadic_norm chooses the analytic method when it applies and 4⌊log⁡2N⌋2⌊log⁡2d⌋<d34 \lfloor \log_2 N \rfloor^2 \lfloor \log_2 d \rfloor < d^3, and the resultant method otherwise; for elements of Qp\mathbf{Q}_p (length 1) it returns gdg^d.

Square roots#

A nonzero pvup^v u is a square in Qq\mathbf{Q}_q if and only if vv is even and uu is a square in Zq\mathbf{Z}_q. For odd pp, Hensel's lemma reduces the latter to uˉ\bar u being a square in Fq\mathbf{F}_q. qadic_sqrt computes a square root in Fq\mathbf{F}_q by x(q+1)/4x^{(q+1)/4} if q≡3(mod4)q \equiv 3 \pmod 4, by Atkin's formula if q≡5(mod8)q \equiv 5 \pmod 8 (with y=x(q−1)/4=±1y = x^{(q-1)/4} = \pm 1, the root is x(q+3)/8x^{(q+3)/8} or 2(q−1)/4x(q+3)/82^{(q-1)/4} x^{(q+3)/8}), and otherwise by the Tonelli–Shanks algorithm with a quadratic non-residue found by enumerating the elements of Fq\mathbf{F}_q in a fixed order (Frobenius map, norm, trace and roots). It then lifts the inverse square root as in Square roots.

For p=2p = 2 every element of Fq\mathbf{F}_q is a square, xˉq/2\bar x^{q/2} being the square root of xˉ\bar x, but not every unit of Zq\mathbf{Z}_q is a square. Let r=u−1r = u^{-1} and let ss lift the square root of rˉ\bar r. A lift s+2Xs + 2X is an inverse square root of uu modulo 8 if and only if r−s2≡4(X2+sX)(mod8)r - s^2 \equiv 4(X^2 + sX) \pmod 8. This requires r≡s2(mod4)r \equiv s^2 \pmod 4, a condition independent of the choice of ss, and then, with c=(r−s2)/4c = (r - s^2)/4 and X=sYX = sY, the Artin–Schreier equation

Y2+Y=c uˉin Fq.Y^2 + Y = c\,\bar u \quad \text{in } \mathbf{F}_q .

The map Y↦Y2+YY \mapsto Y^2 + Y is F2\mathbf{F}_2-linear with kernel F2\mathbf{F}_2, so the equation is solved by linear algebra over F2\mathbf{F}_2: qadic_sqrt builds the d×dd \times d matrix of the map and its LUP decomposition, and _qadic_char2_sqrt_precomp_init stores that decomposition so that _qadic_char2_sqrt_with_precomp can reuse it for many square roots in the same field. If the equation has no solution, uu is not a square. Otherwise the lift is refined by the 2-adic inverse square root iteration of Lemma 3 of Hensel lifting of inverses, square roots and Teichmüller lifts.

Use in FLINT#

Referenced from#

References#

Cite this page

The FLINT team, “Arithmetic in unramified extensions,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/p-adic/unramified-extensions.html (generated 2026-11-02).