Exponentiation by squaring in the quotient F_p[x] / (f), reducing after
every multiplication with the executable DensePoly.modByMonic routine.
Equations
- f.powModMonicAux hmonic 0 x✝¹ x✝ = x✝
- f.powModMonicAux hmonic n.succ x✝¹ x✝ = f.powModMonicAux hmonic ((n + 1) / 2) (f.modByMonic (x✝¹ * x✝¹) hmonic) (if (n + 1) % 2 = 0 then x✝ else f.modByMonic (x✝ * x✝¹) hmonic)
Instances For
Compute base^n mod f for monic f.
Equations
- base.powModMonic f hmonic n = f.powModMonicAux hmonic n (f.modByMonic base hmonic) 1
Instances For
Modulus-size boundary for compiled fast-multiplication modular powers. Below this size the reduced operands stay in the schoolbook kernel range, so the retained loop also avoids repeated dispatcher checks.
Equations
Instances For
Compiled square-and-multiply loop using the coefficient-owner dispatcher.
Equations
- One or more equations did not get rendered due to their size.
- f.powModMonicFastAux hmonic 0 x✝¹ x✝ = x✝
Instances For
Compiled modular-power dispatcher. Tiny moduli retain the reference loop;
larger moduli use mulPackedFast while retaining ordinary monic reduction.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Register the measured dispatcher as the compiled implementation.
The zeroth modular power is 1.
Structurally recursive modular exponentiation. This is intentionally linear in
the exponent: unlike powModMonic, it reduces by kernel computation on small
closed terms.
Equations
- base.powModMonicLinear f hmonic 0 = 1
- base.powModMonicLinear f hmonic n.succ = f.modByMonic (base.powModMonicLinear f hmonic n * base) hmonic
Instances For
Compute X^p mod f, the basic Frobenius generator used downstream.
Equations
- f.frobeniusXMod hmonic = Hex.FpPoly.X.powModMonic f hmonic p
Instances For
Kernel-reducible variant of frobeniusXMod for small closed terms.
Equations
- f.frobeniusXModLinear hmonic = Hex.FpPoly.X.powModMonicLinear f hmonic p
Instances For
Compute X^(p^k) mod f for arbitrary k.
Equations
- f.frobeniusXPowMod hmonic k = Hex.FpPoly.X.powModMonic f hmonic (p ^ k)
Instances For
Kernel-reducible variant of frobeniusXPowMod for small closed terms.
Equations
- f.frobeniusXPowModLinear hmonic k = Hex.FpPoly.X.powModMonicLinear f hmonic (p ^ k)
Instances For
The zeroth Frobenius power is the canonical representative of X modulo f.
linearPow has the same canonical remainder for bases with the same
canonical remainder.
For a positive exponent, powModMonic returns an already-reduced value.
The modByMonic spelling of powModMonic_pos_self_mod, useful for callers
working entirely with the executable monic-reduction API.
powModMonic computes the same residue as linearPow.
The kernel-reducible linear exponentiation path agrees with the production square-and-multiply implementation. It is intentionally not a global simp rule: some conformance proofs unfold the linear evaluator to get kernel-reduced closed terms.
The kernel-reducible X^p mod f evaluator agrees with the production
Frobenius generator.
The kernel-reducible X^(p^k) mod f evaluator agrees with the production
Frobenius power routine.
The basic Frobenius generator is the first indexed Frobenius power.
frobeniusXMod outputs an already-reduced polynomial.
The modByMonic spelling of frobeniusXMod_mod_self.
Successor step for frobeniusXPowMod: raising the previous Frobenius
image to the p-th power (mod f) advances the index by one.
frobeniusXPowMod f hmonic k reduces modulo f to the absolute monomial
X^(p^k) reduced modulo f. This is the key identity relating the executable
Frobenius computation to the absolute polynomial it represents.
frobeniusXPowMod outputs an already-reduced polynomial.
The modByMonic spelling of frobeniusXPowMod_mod_self.