HexPolyFp packages the quotient `Fₚ[x] / (g)` as a type of
canonical representatives: each element stores the unique polynomial of
degree below the modulus, together with a proof of that bound.
The representative's degree is strictly below that of the modulus g.
The quotient is unconditionally a commutative ring. It becomes a
field only when g is irreducible, and HexPolyFp parametrizes
over that fact rather than deciding it. There is no unconditional
unconditional field instance. Instead the field-promoting laws are theorems that
take Hex.FpPoly.Irreducible of g as an explicit hypothesis. A downstream
caller supplies an irreducibility witness (in practice a checkable
Rabin certificate from HexBerlekamp), and only then are inverses
available. The inverse-cancellation laws are stated in
Key correctness theorems.
The block below works over FpPoly 5. It fixes the monic quadratic
modulus x² + 2 (whose reduction rule is x² ≡ -2 ≡ 3 (mod 5)) and a
linear modulus x + 3, then runs modular exponentiation, Frobenius,
composition, weighted products, and square-free decomposition. The
helper coeffNats converts a polynomial to a list of natural-number
coefficients. The expected values are the same ones pinned by the
library's conformance suite.