Documentation

HexBerlekamp.BerlekampMatrix

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
    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
      Instances For

        The executable j-th Berlekamp column represents X^(p*j) modulo f.

        def Hex.Berlekamp.berlekampColumnPolys {p : Nat} [ZMod64.Bounds p] (f : FpPoly p) (hmonic : DensePoly.Monic f) (frobX : FpPoly p) :
        NatFpPoly pArray (FpPoly p)Array (FpPoly p)

        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
        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.

            theorem Hex.Berlekamp.berlekampColumn_entry_eq_powModMonic_coeff {p : Nat} [ZMod64.Bounds p] (f : FpPoly p) (hmonic : DensePoly.Monic f) (i j : Fin (basisSize f)) :
            (berlekampColumn f hmonic j)[i] = DensePoly.coeff ((f.frobeniusXMod hmonic).powModMonic f hmonic j) i

            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
              theorem Hex.Berlekamp.getElem_fixedSpaceMatrix {p : Nat} [ZMod64.Bounds p] (f : FpPoly p) (hmonic : DensePoly.Monic f) (i j : Fin (basisSize f)) :
              (fixedSpaceMatrix f hmonic)[i][j] = (berlekampMatrix f hmonic)[i][j] - if i = j then 1 else 0

              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
                Instances For

                  Vector-level executable Berlekamp kernel condition for the fixed-space matrix Q_f - I.

                  Equations
                  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
                    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.