Polynomial irreducibility over F_p phrased as the absence of nontrivial
factorizations inside the executable dense-polynomial model.
Equations
- f.Irreducible = (f ≠ 0 ∧ ∀ (a b : Hex.FpPoly p), a * b = f → Hex.DensePoly.degree? a = some 0 ∨ Hex.DensePoly.degree? b = some 0)
Instances For
Build an FpPoly from raw coefficients, trimming trailing zero residues.
Equations
- Hex.FpPoly.ofCoeffs coeffs = Hex.DensePoly.ofCoeffs coeffs
Instances For
Constant polynomial in F_p[x].
Equations
Instances For
Reduction modulo a monic polynomial over F_p[x].
Equations
- f.modByMonic g hmonic = Hex.DensePoly.modByMonic g f hmonic
Instances For
The zero polynomial evaluates to zero at every point.
A constant polynomial evaluates to its constant at every point. This is the base case from which the evaluation map's homomorphism laws are built.
The variable X evaluates to the evaluation point. The companion base
case to eval_C for reasoning about the evaluation map.
Evaluating a monomial gives the coefficient times the corresponding power.
Coefficients of the constant polynomial wrapper are constant at degree zero and zero elsewhere.
The degree-zero coefficient of the indeterminate wrapper is zero.
The degree-one coefficient of the indeterminate wrapper is one.
Coefficients of the indeterminate wrapper are one at degree one and zero elsewhere.
Evaluating the monomial row c · Xⁱ · f at x multiplies the value of
f by c * xⁱ. This isolates one term of a product so that eval_mul and
related multiplicative laws can be assembled row by row.
Evaluation is additive: the value of a sum is the sum of the values. One half of the statement that evaluation at a point is a ring homomorphism.
Evaluation respects subtraction. Lets callers push an evaluation through a difference of polynomials, for example when checking that two polynomials agree at a point.
Evaluation respects additive inverses.
0 is a right identity for addition. Part of the commutative-ring
structure on FpPoly p.
0 is a left identity for addition. Part of the commutative-ring
structure on FpPoly p.
Polynomial addition is commutative. Part of the commutative-ring
structure on FpPoly p that downstream algebra relies on.
Polynomial addition is associative, letting callers regroup sums freely.
Part of the commutative-ring structure on FpPoly p.
The negation is a left additive inverse: -f + f = 0.
The negation is a right additive inverse: f + -f = 0.
Subtracting 0 leaves a polynomial unchanged.
Subtracting a polynomial from 0 yields its negation.
A polynomial minus itself is 0.
Subtraction unfolds to adding the negation. Rewrites subtraction in terms
of the additive operations, so results proved for + transfer to -.
0 is a left absorbing element for multiplication.
0 is a right absorbing element for multiplication.
1 is a left identity for multiplication.
1 is a right identity for multiplication.
The ith schoolbook contribution to coefficient n of f * g.
Ordinary FpPoly multiplication callers
should use coeff_mul, not this definition.
Equations
- f.mulCoeffTerm g n i = if n < i then 0 else Hex.DensePoly.coeff f i * Hex.DensePoly.coeff g (n - i)
Instances For
The executable schoolbook coefficient sum matching FpPoly
multiplication. Ordinary FpPoly
multiplication callers should use coeff_mul, not this definition.
Equations
- f.mulCoeffSum g n = List.foldl (fun (acc : Hex.ZMod64 p) (i : Nat) => acc + f.mulCoeffTerm g n i) 0 (List.range (Hex.DensePoly.size f))
Instances For
The n-th coefficient of a product is the convolution sum
Hex.FpPoly.mulCoeffSum.
This is the coefficient-level specification of the executable multiplication,
the entry point for proving every higher multiplicative law.
Polynomial multiplication is commutative. Part of the commutative-ring
structure on FpPoly p, and lets callers swap factors to match a lemma's
expected orientation.
Multiplying f by the scaled monomial c · Xⁱ shifts each coefficient up
by i and scales it by c. Gives a closed form for the coefficients produced
when a polynomial is multiplied by a single monomial term.
Polynomial multiplication is associative, letting callers regroup products
freely. Part of the commutative-ring structure on FpPoly p.
FpPoly p is a multiplicative monoid for Std, so the shared
List.foldl_mul_* algebra and the standard List.foldl_assoc apply to fold-products
of FpPoly.