Hex.isPerfectSquare decides IsSquare on ℤ.
There are 2ⁿ - 1 subproducts, one per nonempty sublist. Stated additively
so no truncated subtraction appears.
The executable check decides independence: this is the whole arithmetic trust surface of the certificate's first half.
Prepending one zero coefficient is multiplication by X.
Coefficientwise scaling is multiplication by a constant.
Reading one more coefficient off the front is one Horner step.
The polynomial the iteration starts from.
The synthetic shift is correct: with r² = d in K, the pair (p, q) that
Hex.quadShift builds off the coefficient list l satisfies
p + r · q = g(X - r) over K, where g is the polynomial with those
coefficients.
Everything else follows from this by substituting -r for r and multiplying.
The norm correspondence: over a commutative ring K carrying a square root
r of d, the executable quadratic norm is g(X - r) · g(X + r).
The 2ⁿ signed sums ∑ᵢ εᵢ rᵢ, in the order the tower builds them.
Equations
- HexBerlekampZassenhausMathlib.signedSums rs = List.foldl (fun (ss : List K) (r : K) => List.flatMap (fun (s : K) => [s + r, s - r]) ss) [0] rs
Instances For
F(c; d₁, …, dₙ) = ∏_{ε ∈ {±1}ⁿ} (X - c - ∑ᵢ εᵢ rᵢ), the polynomial the
multiquadratic tower theorem is about, written over the square roots rs.
Equations
- HexBerlekampZassenhausMathlib.signPatternPoly c rs = (List.map (fun (s : K) => Polynomial.X - Polynomial.C (c + s)) (HexBerlekampZassenhausMathlib.signedSums rs)).prod
Instances For
There are 2ⁿ sign patterns, so the certified polynomial has 2ⁿ roots
counted with multiplicity.
The sign-pattern product is monic.
The sign-pattern product has degree 2ⁿ, so the correspondence is not
vacuous: the certified polynomial really has the doubled degree at every level.
Each successive norm is one composition pair, for any starting polynomial.
The iterated quadratic norm is the sign-pattern product: over any commutative
ring carrying square roots rs of the radicands ds, the executable
Hex.iteratedNorm maps to ∏_ε (X - c - ∑ᵢ εᵢ rᵢ).
Coefficient equality is polynomial equality: the identification half of the
check compares dense coefficient arrays, and that comparison is exactly equality
in Polynomial ℤ.
A successful check certifies independent square classes.
A successful check identifies the input with the iterated norm, up to sign.
The identification half, in Polynomial ℤ: a successful check pins the input
to the iterated norm up to the unit -1.
A successful check makes the input an associate of the iterated norm, so the two are irreducible together.