Equations
- Hex.GF2Poly.instDiv = { div := Hex.GF2Poly.div }
Equations
- Hex.GF2Poly.instMod = { mod := Hex.GF2Poly.mod }
Divisibility in GF(2)[x] is witnessed by an explicit quotient.
Equations
- Hex.GF2Poly.instDvd = { dvd := fun (p q : Hex.GF2Poly) => ∃ (r : Hex.GF2Poly), q = p * r }
Polynomial irreducibility over GF(2) phrased in terms of nontrivial
factorizations inside the packed Hex.GF2Poly execution model.
Equations
Instances For
Build the monic degree-n polynomial x^n + lower, truncating lower to
degrees < n as required by the packed GF(2^n) modulus convention.
Equations
- Hex.GF2Poly.ofUInt64Monic lower n = Hex.GF2Poly.monomial n + Hex.GF2Poly.ofUInt64 (lower &&& Hex.GF2Poly.lowerMask n)
Instances For
Reduce a packed polynomial modulo a single-word extension modulus and read back the low canonical word.
Equations
- Hex.GF2Poly.packedReduceWord n irr p = (p % Hex.GF2Poly.ofUInt64Monic irr n).toWords.getD 0 0 &&& Hex.GF2Poly.lowerMask n
Instances For
Repackage a word as a canonical representative below 2^n.
Equations
- Hex.GF2Poly.canonicalWordLT n hn64 w = UInt64.ofNatLT (w.toNat % 2 ^ n) ⋯
Instances For
Result package for the packed extended Euclidean algorithm.
Instances For
Tail-recursive extended Euclidean algorithm over packed GF(2)
polynomials.
Equations
Instances For
The single-word xgcd inverse candidate reduced modulo the packed irreducible modulus.
Equations
- Hex.GF2Poly.packedInvWord n irr w = Hex.GF2Poly.packedReduceWord n irr ((Hex.GF2Poly.ofUInt64 w).xgcd (Hex.GF2Poly.ofUInt64Monic irr n)).left
Instances For
Division by zero has quotient zero for packed GF(2) polynomials.
Remainder modulo zero is the dividend for packed GF(2) polynomials.
Zero divided by any packed GF(2) polynomial has quotient zero.
Zero has zero remainder modulo any packed GF(2) polynomial.
The gcd divides the right input.
The gcd with a zero right input is the left input.
The gcd with a zero left input is the right input.
The packed single-word monic modulus has the advertised degree when
n < 64.
The degree of ofUInt64Monic lower n is exactly n when n < 64.
The coefficients of the packed single-word monic modulus: the implicit
leading x^n term sets degree n, and the lower degrees read the bits of
lower.
packedReduceWord always returns a canonical word below 2^n for
single-word extension degrees.
Masking the low word of a degree-< n residue preserves the represented
polynomial.
Any nonzero reduced residue modulo an irreducible packed polynomial is coprime to the modulus, as computed by the packed Euclidean algorithm.
For a nonzero reduced residue modulo an irreducible packed polynomial, the
left Bezout coefficient computed by xgcd is a multiplicative inverse modulo
the modulus.
Reducing the xgcd left coefficient before multiplying preserves the left-inverse congruence for nonzero reduced residues modulo an irreducible.
The packed single-word CLMUL/reduction path agrees with the polynomial xgcd inverse for nonzero canonical representatives.