Binary polynomials as bit lists #
The executable side of the explicit binary fields. A binary polynomial is represented by its list
of coefficients, constant term first (Cslib.polyOfBits); the binary digits of a code m are the
coefficients of polyOfCode m (Cslib.polyOfBits_bits).
Reduction modulo a polynomial g of degree m uses one primitive, multiplication by X modulo
g on coefficient lists of length m (Cslib.mulXMod): shift up and add g
when the top coefficient overflows. The remainder of f is the sum of the remainders of the powers
X ^ j with f j = 1 (Cslib.modBits), so g ∣ f exactly when that sum vanishes
(Cslib.modBits_all_false_iff). Trial division by the polynomials of degree at most half the degree
decides irreducibility (Cslib.isIrreducibleCode_iff), and
an exhaustive search over codes finds the irreducible polynomial of least code
(Cslib.polyOfCode_leastIrreducibleCode). The remainders of X ^ e,
e < 2 m, give the arithmetic of 𝔽₂[X] / (g) in the power basis
(Cslib.pow_eq_sum_powerTable).
Main definitions #
Cslib.polyOfBits: the binary polynomial with a given coefficient list.Cslib.mulXMod,Cslib.modBits: reduction modulo a binary polynomial.Cslib.modMulBits: table-free modular multiplication.Cslib.isIrreducibleCode: the irreducibility test by trial division.Cslib.leastIrreducibleCode: the exhaustive search for the least code.Cslib.powerTable: the remainders of the powers ofX.
Main results #
Cslib.mk_polyOfBits_modBits:modBits g fis congruent tofmodulog.Cslib.modBits_all_false_iff: the divisibility test.Cslib.isIrreducibleCode_iff: trial division decides irreducibility.Cslib.polyOfCode_leastIrreducibleCode: the search findsleastIrreducible p.Cslib.pow_eq_sum_powerTable: powers of a root in the power basis.
References #
The binary polynomial with coefficient list l, constant term first.
Instances For
Concatenating coefficient lists shifts the upper polynomial by X ^ l.length.
If true appears in l, then polyOfBits l is nonzero.
The degree of polyOfBits l is strictly less than l.length.
Evaluating polyOfBits l at α sums l.getD d false • α ^ d over d < l.length.
The coefficient list of the code m, its binary digits, gives the polynomial with code m.
Reduction modulo a binary polynomial #
The remainder of the polynomial with coefficient list f modulo the one with coefficient list
g, as a coefficient list of length g.length - 1: the sum of the remainders of the powers
X ^ j with f j = 1, computed by repeated multiplication by X modulo g.
Instances For
With a padded to the degree of the modulus, any prefix of the multiplier leaves two
degree-sized words and its modular product is the product in the quotient.
For a coefficient list g = l ++ [true] with top coefficient one, modBits g f is congruent
to f modulo the polynomial of g: both have the same image in AdjoinRoot (polyOfBits g).
The divisibility test: the polynomial with coefficient list l ++ [true] divides the one
with coefficient list f exactly when the remainder modBits vanishes.
The divisibility test on codes: for d ≠ 0, some coefficient of the remainder of f modulo
the polynomial with code d is one exactly when that polynomial does not divide f.
One trial divisor passes when its degree is outside the tested range or its remainder is nonzero. Both codes use their little-endian binary coefficient words.
Instances For
Trial division: whether the binary polynomial with code m is irreducible. It is when
m ≥ 2 and no polynomial of degree between 1 and half the degree of m (a code d < m)
divides it.
Instances For
Trial division decides irreducibility: isIrreducibleCode m holds exactly when the binary
polynomial with code m is irreducible.
The exhaustive search: the least code m < B of an irreducible binary polynomial of degree
p, by trial division (0 if there is none).
Instances For
Remainders of powers #
At a root α of the polynomial with coefficient list l ++ [true], the power α ^ e,
e < 2 l.length, is the combination of the powers below l.length given by powerTable.