/** * Dense univariate polynomial arithmetic over the finite field 𝔽_p, backed * by the same `bigint[]` representation as `integer-poly.ts` (index = * degree). Every coefficient produced by an operation in this module is * kept reduced into the canonical range `[0, p)` and trimmed so the * highest-degree entry (if any) is nonzero. * * This module is part of the univariate factorization engine * (`functions/src/typed/factorization/`) and is `bigint`-only by design. */ import { type IntPoly } from './integer-poly.js'; export type { IntPoly } from './integer-poly.js'; /** * Reduces every coefficient of `a` into `[0, p)`, then trims trailing * (highest-degree) zero coefficients. Does not mutate the input. */ export declare function reduceModP(a: IntPoly, p: bigint): IntPoly; /** `a + b` over 𝔽_p, coefficients reduced into `[0, p)`. */ export declare function addP(a: IntPoly, b: IntPoly, p: bigint): IntPoly; /** `a - b` over 𝔽_p, coefficients reduced into `[0, p)`. */ export declare function subP(a: IntPoly, b: IntPoly, p: bigint): IntPoly; /** `a * b` over 𝔽_p via schoolbook convolution, coefficients in `[0, p)`. */ export declare function mulP(a: IntPoly, b: IntPoly, p: bigint): IntPoly; /** * Modular inverse of a scalar `a` modulo prime `p`, via the extended * Euclidean algorithm. Returns a value in `[1, p)`. Throws if `a ≡ 0 (mod p)` * (no inverse exists). */ export declare function invModP(a: bigint, p: bigint): bigint; /** * Scales `a` so its leading coefficient becomes 1 (multiplies by * `invModP(lc(a), p)`). Returns `[]` unchanged for the zero polynomial. */ export declare function makeMonicP(a: IntPoly, p: bigint): IntPoly; /** * Polynomial division over 𝔽_p: `a = q*b + r` with `deg(r) < deg(b)`. * `b` must be nonzero. Coefficients of `q` and `r` are reduced into `[0, p)`. */ export declare function divmodP(a: IntPoly, b: IntPoly, p: bigint): { q: IntPoly; r: IntPoly; }; /** * Monic gcd of `a` and `b` over 𝔽_p via the Euclidean algorithm. Returns * `[]` (zero polynomial) only when both inputs are zero; otherwise the * result is monic (leading coefficient 1). */ export declare function gcdP(a: IntPoly, b: IntPoly, p: bigint): IntPoly; /** * `base^e mod (mod, p)`: modular exponentiation of `base` by non-negative * bigint `e`, reducing modulo the polynomial `mod` (via `divmodP`) and * modulo `p` at each step, using square-and-multiply. `e` must be >= 0. */ export declare function powModPolyP(base: IntPoly, e: bigint, mod: IntPoly, p: bigint): IntPoly; /** * Distinct-degree factorization of a monic, square-free polynomial `f` over * 𝔽_p. Returns the distinct-degree decomposition: each entry's `prod` is the * product of ALL monic irreducible factors of `f` that have degree exactly * `deg`. Uses the standard algorithm built on `x^(p^i) mod f` computed via * `powModPolyP`, peeling off `gcd(v, x^(p^i) - x)` at each step and shrinking * the working polynomial `v` as factors are removed. * * Precondition: `f` is monic and square-free over 𝔽_p. The empty array is * returned for a constant (degree ≤ 0) input. */ export declare function distinctDegreeFactor(f: IntPoly, p: bigint): Array<{ deg: number; prod: IntPoly; }>; /** * Equal-degree factorization (Cantor–Zassenhaus): given a monic, square-free * `f` that is a product of degree-`d` irreducibles over 𝔽_p, returns those * monic irreducible factors. The candidate polynomials are enumerated * deterministically (see `trialPolys`), so the factorization is reproducible. */ export declare function equalDegreeFactor(f: IntPoly, d: number, p: bigint): IntPoly[]; /** * Full factorization of a square-free monic polynomial `f` over 𝔽_p into its * monic irreducible factors: distinct-degree decomposition followed by * Cantor–Zassenhaus equal-degree splitting of each degree class. Constant * (degree ≤ 0) inputs yield the empty array; a linear input yields itself. */ export declare function factorModP(f: IntPoly, p: bigint): IntPoly[]; //# sourceMappingURL=finite-field.d.ts.map