The basis size used for the Berlekamp matrix of f.
Equations
Instances For
Read a polynomial's first degree f coefficients as a vector.
Equations
- Hex.Berlekamp.coeffVector f g = Vector.ofFn fun (i : Fin (Hex.Berlekamp.basisSize f)) => Hex.DensePoly.coeff g ↑i
Instances For
The j-th Berlekamp-matrix column, obtained by reducing
(X^p mod f)^j modulo f and reading the result in the monomial basis.
Equations
- Hex.Berlekamp.berlekampColumn f hmonic j = Hex.Berlekamp.coeffVector f ((f.frobeniusXMod hmonic).powModMonic f hmonic ↑j)
Instances For
The executable j-th Berlekamp column represents X^(p*j) modulo f.
Iteratively build the array of Berlekamp-matrix column polynomials
[1, frobX, frobX^2, …, frobX^(n - 1)], each reduced modulo f.
Each step costs one polynomial product and one monic reduction, both
quadratic in n, so the array of n columns is built in O(n^3) total.
Equations
- Hex.Berlekamp.berlekampColumnPolys f hmonic frobX 0 x✝¹ x✝ = x✝
- Hex.Berlekamp.berlekampColumnPolys f hmonic frobX k.succ x✝¹ x✝ = Hex.Berlekamp.berlekampColumnPolys f hmonic frobX k (f.modByMonic (x✝¹ * frobX) hmonic) (x✝.push x✝¹)
Instances For
The Berlekamp matrix Q_f, whose j-th column records the coordinates of
X^(p * j) mod f in the basis {1, X, ..., X^(n - 1)}. Columns are computed
iteratively from the recurrence column (j + 1) = column j * (X^p mod f) mod f
to avoid the per-column fast-exponentiation log factor.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A Berlekamp matrix entry is the corresponding coefficient of the executable
column-polynomial array used by berlekampMatrix.
A Berlekamp matrix entry is the corresponding coefficient of the public
powModMonic column representative.
A public Berlekamp column entry is the corresponding coefficient of the
powModMonic column representative.
The public Berlekamp column representative has the expected X^(p*j)
residue modulo f.
The Berlekamp matrix acts on the basis-{1, X, …, X^(n-1)} coefficient
vector of w as the Frobenius map on F_p[X] / (f): when w has degree
less than n = basisSize f, multiplying coeffVector f w by
berlekampMatrix f hmonic returns the coefficient vector of
w^p mod f. The proof factors through the compose-form Frobenius identity
compose w (linearPow X p) = linearPow w p from HexPolyFp/Compose.lean.
The fixed-space matrix Q_f - I used in Berlekamp's kernel computation.
Built in place: only the diagonal of Q_f is decremented, via mapRowsIdx
setting one entry per row, rather than rebuilding the whole matrix with ofFn.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Entrywise characterization of fixedSpaceMatrix: it is Q_f with 1
subtracted on the diagonal.
fixedSpaceMatrix agrees with the Q_f - I matrix-subtraction form; lets the
sub_identity_mulVec algebra apply to the in-place definition.
Convert a coefficient vector back to its polynomial representative.
Equations
Instances For
Re-reading the coefficients of a polynomial built from a Berlekamp-basis coefficient vector recovers the original vector.
The fixed-space kernel of Q_f - I, reusing HexMatrix.nullspace instead of a
Berlekamp-local linear-algebra implementation.
Equations
- Hex.Berlekamp.fixedSpaceKernelVectors f hmonic = (Hex.Berlekamp.fixedSpaceMatrix f hmonic).nullspace
Instances For
Vector-level executable Berlekamp kernel condition for the fixed-space
matrix Q_f - I.
Equations
- Hex.Berlekamp.IsFixedSpaceKernelVector f hmonic v = ((Hex.Berlekamp.fixedSpaceMatrix f hmonic).mulVec v = 0)
Instances For
The executable kernel predicate for Q_f - I is equivalent to the usual
fixed-space equation Q_f * v = v.
Polynomial-level executable Berlekamp kernel condition, by reading the
representative in the quotient basis used by fixedSpaceMatrix.
Equations
- Hex.Berlekamp.IsFixedSpaceKernelPolynomial f hmonic g = Hex.Berlekamp.IsFixedSpaceKernelVector f hmonic (Hex.Berlekamp.coeffVector f g)
Instances For
Every vector returned by fixedSpaceKernelVectors satisfies the executable
fixed-space kernel condition.
Every vector satisfying the executable fixed-space kernel condition is a
linear combination of the public nullspace-basis matrix for Q_f - I.
Polynomial representatives satisfying the executable fixed-space kernel condition have coefficient vectors in the span of the nullspace basis.
Polynomial-level kernel form of the Berlekamp / fixed-space kernel condition:
for w of degree below basisSize f, w represents a fixed-space kernel
polynomial iff f divides w^p - w.