BHKS Lemma 5.1 column bound for the executable cldCoeffs.
If there exists an exact integer y (morally [x^j] (f * g'.derivative / g')
for a true integer factor g' of f that Hensel-lifts to g) congruent to
(cldQuotientMod f g p a).coeff j modulo p^a and satisfying
|y| ≤ bhksCoeffBound f j, then under the Hensel precision hypothesis
2 * bhksCoeffBound f j < p^a and p ≥ 2, the executable cldCoeffs entry
at index j is bounded by bhksCoeffBound f j.
The executable cut must be re-centered at the ambient modulus for this column
bound to hold. Hex.psiCut performs that recentering; the bound is then a
direct consequence of
abs_psiCut_le_of_natAbs_le plus precisionForCoeffBound_spec for the
lower cut threshold.
Lift the projected integer rows of L into a rational row-basis matrix
sized n × r, with n := L.projectedRows.size and r := L.factorCount.
The matrix is the input to BHKS Lemma 3.3 RREF-based equivalence-class
identification.
Equations
- Hex.bhksProjectedRowsAsRatMatrix rows n r = Hex.Matrix.ofFn fun (i : Fin n) (j : Fin r) => ↑((rows.getD ↑i #[]).getD (↑j) 0)
Instances For
Add a column index to the class with the same signature, or start a new class.
Equations
Instances For
BHKS equivalence-class indicator vectors over the projected lattice rows
of L.
Lifts the projected integer rows into a rational row-basis matrix, runs
Matrix.rowReduce over Q, and groups column indices 0, …, r - 1 by their
echelon-column signature: indices i and j are equivalent iff every
echelon row agrees at positions i and j (BHKS Lemma 3.3 / FLINT
Algorithm 8). Each equivalence class produces one compact 0/1 indicator
of length r. Classes are emitted in the order they are first observed by
ascending column index.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Replace every coefficient by its centred representative modulo m.
Equations
- Hex.centeredLiftPoly f m = Hex.DensePoly.ofCoeffs (Array.map (fun (coeff : Int) => Hex.centeredModNat coeff m) (Hex.DensePoly.toArray f))
Instances For
Coefficientwise description of centeredLiftPoly.
A sufficiently large modulus makes centred coefficient recovery exact.
Equal sufficiently precise residues recover the same coefficient-bounded polynomial.
Normalize a candidate integer factor by extracting its primitive part and
flipping sign so the leading coefficient is non-negative. Used by
bhksIndicatorCandidate? to produce a canonical witness from the centred
lift of a scaled lifted-factor product.
Equations
- Hex.normalizeCandidateFactor candidate = if Hex.DensePoly.leadingCoeff candidate.primitivePart < 0 then Hex.DensePoly.scale (-1) candidate.primitivePart else candidate.primitivePart
Instances For
normalizeCandidateFactor g = g when g is already primitive (content 1)
and has non-negative leading coefficient. This is the A2 reconstruction step
that asserts the canonical witness produced by bhksIndicatorCandidate?
agrees with the expected true factor under those normalization assumptions.
Successful branch of bhksIndicatorSelectedFactors for well-formed 0/1
indicator rows, returning the canonical selected-factor array.
Successful branch of bhksIndicatorSelectedFactors, stated with an explicit
name for the selected-factor array chosen by the caller.
Reconstruct and verify one BHKS equivalence-class indicator.
The indicator row is supplied by the later RREF recovery stage. This helper
only checks that the row is a nonempty 0/1 vector over the lifted factors,
forms the selected lifted-factor product, scales it by f's leading
coefficient in the same coordinate, applies the centred integer lift,
normalizes content and sign, and accepts the candidate only when exact
division of f succeeds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A successful BHKS indicator candidate divides f. The executable
bhksIndicatorCandidate? only returns some (candidate, _) after
exactQuotient? f candidate succeeds, so the candidate is a verified
integer divisor of f.
A successful BHKS indicator candidate is primitive: the candidate equals
normalizeFactorSign (normalizeCandidateFactor _), and shouldRecord = true
forces the inner factor to be nonzero, hence primitive.
The candidate returned by a successful bhksIndicatorCandidate? call is
exactly the canonical normalization of the direct-coordinate scaled centred
lift. This is a Mathlib-free surface lemma that avoids exposing the private
liftModulus definition.
A2 reconstruction surface for a single direct-coordinate BHKS indicator.
Reconstruct one direct-coordinate BHKS indicator when the canonical scaled recombination candidate is already known exactly.
Reconstruct one direct-coordinate BHKS indicator from its primitive-part recovery identity.
Count the entries equal to one among the first r indicator entries.
Equations
- Hex.bhksIndicatorOneCount r indicator = List.foldl (fun (count i : Nat) => if (indicator.getD i 0 == 1) = true then count + 1 else count) 0 (List.range r)
Instances For
Test whether an indicator has width r and consists entirely of ones.
Equations
- Hex.bhksIndicatorAllOnes r indicator = (indicator.size == r && Hex.bhksIndicatorOneCount r indicator == r)
Instances For
The recovery early-bailout predicate: the projected lattice is empty, the indicator partition is empty, or the indicator partition is the trivial all-ones single class.
Equations
- Hex.bhksDegenerateIndicatorPartition L indicators = (indicators.isEmpty || L.projectedRows.isEmpty || indicators.size == 1 && Hex.bhksIndicatorAllOnes L.factorCount (indicators.getD 0 #[]))
Instances For
The proof-facing successful branch of the BHKS degeneracy guard.
Reconstruct and verify every BHKS equivalence-class indicator candidate.
Folds bhksIndicatorCandidate? over the list of indicator vectors, pushing the
verified candidate factor onto the accumulator on success and short-circuiting
to none on the first reconstruction failure.
Equations
- Hex.bhksIndicatorCandidates? f d indicators = Array.foldl (Hex.bhksIndicatorCandidatesStep✝ f d) (some #[]) indicators
Instances For
Every candidate emitted by bhksIndicatorCandidates? divides the
input polynomial; this is the per-candidate version of the verified
exact-division check performed inside bhksIndicatorCandidate?.
Every candidate emitted by bhksIndicatorCandidates? is primitive. This
is the array-level form of the per-candidate primitivity guarantee from
normalizeCandidateFactor plus sign normalisation.
Every candidate emitted by bhksIndicatorCandidates? has nonnegative
leading coefficient; this is the array-level form of the per-candidate sign
normalisation guarantee.
Every candidate emitted by bhksIndicatorCandidates? has positive degree;
this is the array-level form of the per-candidate nonconstant guarantee.
If each BHKS equivalence-class indicator reconstructs and verifies to the corresponding candidate factor, the executable candidate fold returns the whole candidate array.
The quotients array records the exact-division witnesses returned by
bhksIndicatorCandidate?; only the first component is accumulated by
bhksIndicatorCandidates?.
Assemble the BHKS candidate fold from per-indicator reconstruction facts.
This is the proof-facing surface for callers that know every indicator row
reconstructs and exactly divides f: with a size agreement and one quotient
witness for each row, the executable fold returns the requested candidate
array.
A successful BHKS indicator-candidate fold produces a candidate array of the
same size as the input indicator array. This is the size identity used by
ExpectedTrueFactors-shaped consumers that need to align the per-index
indicator and factor views.
General coefficient law for the monic transform transformedCore. Below the
top degree the coefficient is core.coeff n scaled by a power of the leading
coefficient; the top coefficient is 1; higher coefficients vanish.
Keystone for toMonic inverse recovery. Dilating the monic transform
transformedCore core degree by the leading coefficient recovers core scaled
by leadingCoeff core ^ (degree - 1). The 1 ≤ degree hypothesis is essential:
for a constant core the identity fails unless the leading coefficient is 1.
Composed with dilate_mul, this is the inverse-factor correspondence the
recombination recovery proof rests on.
Public face of the inverse-recovery keystone, stated on the toMonic monic
field rather than the private transformedCore. For a square-free part of degree ≥ 1,
dilating (toMonic core).monic by the leading coefficient recovers core
scaled by leadingCoeff core ^ (degree - 1). Holds in both the already-monic
and the genuine transform branch.
Coefficient law for the monic transform (toMonic core).monic in the
genuine-transform branch (leading coefficient ≠ 1). Public face of the
private ToMonicData.transformedCore_coeff: below the top degree the
coefficient is core.coeff i scaled by a power of the leading coefficient, the
top coefficient is 1, and higher coefficients vanish.
The monic transform preserves the recorded degree in all cases (sign-free,
unconditional companion to toMonic_monic_degree_eq_of_pos_degree).
Stored size of the monic transform of a positive-degree square-free part: one more than the square-free part degree, in both the already-monic and genuine-transform branches.