Documentation

HexPolyFast.Cyclic

Fold every coefficient into its exponent class modulo n, using one preallocated n-slot accumulator.

Equations
Instances For

    Fold every coefficient modulo x^n + 1, alternating the sign after each block of n exponents.

    Equations
    Instances For

      Sum coefficients of p whose exponents are congruent to k modulo n.

      Equations
      Instances For

        Alternating sum of coefficients in one congruence class, implementing reduction by x^n = -1.

        Equations
        Instances For

          The cyclic coefficient array has exactly the requested length.

          The negacyclic coefficient array has exactly the requested length.

          def Hex.DensePoly.mulCyclic {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (n : Nat) (_hn : 0 < n) (a b : DensePoly R) :

          Cyclic convolution of positive length n.

          Equations
          Instances For
            def Hex.DensePoly.mulNegacyclic {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (n : Nat) (_hn : 0 < n) (a b : DensePoly R) :

            Negacyclic convolution of positive length n.

            Equations
            Instances For

              Checked cyclic convolution; length zero has no quotient-ring meaning.

              Equations
              Instances For

                Checked negacyclic convolution; length zero has no quotient-ring meaning.

                Equations
                Instances For
                  theorem Hex.DensePoly.size_mulCyclic_le {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (n : Nat) (hn : 0 < n) (a b : DensePoly R) :
                  (mulCyclic plan n hn a b).size ≤ n

                  Cyclic products contain at most n stored coefficients.

                  theorem Hex.DensePoly.size_mulNegacyclic_le {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (n : Nat) (hn : 0 < n) (a b : DensePoly R) :
                  (mulNegacyclic plan n hn a b).size ≤ n

                  Negacyclic products contain at most n stored coefficients.

                  theorem Hex.DensePoly.coeff_mulCyclic {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (n : Nat) (hn : 0 < n) (a b : DensePoly R) (i : Nat) :
                  (mulCyclic plan n hn a b).coeff i = if i < n then cyclicCoeff n i (a * b) else 0

                  Coefficient description of cyclic folding.

                  theorem Hex.DensePoly.coeff_mulNegacyclic {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (plan : MulPlan R) (n : Nat) (hn : 0 < n) (a b : DensePoly R) (i : Nat) :
                  (mulNegacyclic plan n hn a b).coeff i = if i < n then negacyclicCoeff n i (a * b) else 0

                  Coefficient description of negacyclic folding.

                  theorem Hex.DensePoly.ofCoeffs_cyclicCoeffs {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (n : Nat) (hn : 0 < n) (p : DensePoly R) :
                  ofCoeffs (cyclicCoeffs n p) = List.foldl (fun (q : DensePoly R) (i : Nat) => q + monomial (i % n) (p.coeff i)) 0 (List.range p.size)

                  Cyclic folding sums monomials with degrees reduced modulo the length.

                  The signed residue of c * x^i modulo x^n + 1.

                  Equations
                  Instances For

                    The signed monomial contributed by coefficient i when reducing modulo x^n + 1.

                    Equations
                    Instances For
                      theorem Hex.DensePoly.ofCoeffs_negacyclicCoeffs {R : Type u} [DecidableEq R] [Lean.Grind.CommRing R] (n : Nat) (hn : 0 < n) (p : DensePoly R) :
                      ofCoeffs (negacyclicCoeffs n p) = List.foldl (fun (q : DensePoly R) (i : Nat) => q + negacyclicTerm n p i) 0 (List.range p.size)

                      Negacyclic folding sums degree-reduced monomials with alternating signs.