Build a checked multi-prime degree-obstruction certificate for a primitive, positive-degree integer polynomial. Prime blocks are added only until every possible proper factor degree is obstructed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A certificate returned by the generator passes the complete executable irreducibility check, including primality, primitivity, and positive degree.
A successful modular factorization paired with its number of factors.
- data : PrimeChoiceData
The modular factorization data.
- factorCount : Nat
The number of factors in
data.factorsModP.
Instances For
Factor f at one explicit small-prime candidate, returning the same
PrimeChoiceData payload used by the production selector when the candidate
is good.
This is a diagnostic surface for attributing adaptive-prime work and inspecting
the modular degree information already computed by a trial. It deliberately
shares primeChoiceDataScore with the selector so benchmark instrumentation
cannot drift to a different modular computation.
Equations
- Hex.probePrimeData? f c = Option.map (fun (x : Hex.PrimeChoiceDataScore) => x.data) (Hex.primeChoiceDataScore✝ f c)
Instances For
Keep the prime factorization with the lower recombination score.
Equations
- Hex.choosePrimeDataScoreStep f (some old) c = some old
- Hex.choosePrimeDataScoreStep f none c = Hex.primeChoiceDataScore✝ f c
Instances For
Optional prime selection: returns some with the chosen PrimeChoiceData when
the fixed candidate search finds a good prime for f, and none otherwise.
The search first folds choosePrimeDataScoreStep over the deterministic
small-prime prefix. If that prefix selects an admissible prime, the original
tie-breaking is preserved. If the prefix exhausts without selecting any prime,
the search folds over the fixed extended prime list through 499, covering
every odd prime in the hot-path interval [3, 500].
Instances For
Select the first good prime, except that a split modular image receives a
bounded search for a good prime with fewer modular factors, with the early-stop
policy implemented by improvePrimeData?.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Adaptive prime selection returns only prime moduli.
Every prime returned by the adaptive selector is at most 500: its
look-ahead only rearranges the fixed small-prime candidate lists.
Adaptive prime selection caches the reduction of its input polynomial.
Adaptive prime selection returns a prime satisfying the admissibility test.
Ordinary prime selection returns only prime moduli.
Every prime returned by the fixed hot-path search is at most 500.
Ordinary prime selection caches the reduction of its input polynomial.
When choosePrimeData? f succeeds, the selected prime is a good prime for f
in the executable sense (modulus at least three, leading coefficient survives
reduction, modular image is square-free).
When choosePrimeData? f returns none, every candidate in the hot-path
prime list fails the executable good-prime predicate Hex.isGoodPrime f.
This records that failure of the fixed candidate fold means every retained candidate was tried and rejected.
A good member of the fixed hot-path list forces prime selection to succeed. This is the direct contrapositive of the selector's complete failure certificate.
A good member of the fixed hot-path list also forces the adaptive selector to succeed; its look-ahead changes only which successful record is returned.
Invariant capturing that data.factorsModP is exactly the Berlekamp factor
output for the monic modular image used by prime selection. Phrased as an
existential bundling the prime witness and the nonzero-image proof so that
it threads through the executable prime-selection fold; the Lean.Grind.Field
instance required by Berlekamp.berlekampFactor is constructed explicitly
from hprime, so callers can match it against any field instance built from
the same prime witness via proof irrelevance of ZMod64.PrimeModulus.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Primality provenance for one explicit diagnostic/degree-obstruction trial.
An explicit trial inherits any proved upper bound on its candidate prime.
Good-prime provenance for one explicit diagnostic/degree-obstruction trial.
Modular-image provenance for one explicit trial.
Berlekamp-factor provenance for one explicit trial.
Adaptive selection returns the certified Berlekamp factorization of the modular image.
When choosePrimeData? f succeeds, the stored modular factor array is exactly
the Berlekamp factor output for the monic modular image of the selected
candidate. Mirrors the _prime / _fModP_eq / _isGoodPrime provenance
chains, exposing the executable surface used by the small-mod singleton
irreducibility composition.
Small-mod singleton executable branch fact for the selected monic modular image.
When choosePrimeData? succeeds and the public factorsModP field has size at
most one, the underlying Berlekamp factor list for
monicModularImage (ZPoly.modP data.p f) also has length at most one. This is
the Mathlib-free shape fact needed before applying Berlekamp soundness in a
caller that already imports the heavier Rabin proof module.
Lift the chosen modular factors to the requested precision for integer recombination.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The lift data keeps the selected prime.
The lift data keeps the requested precision exponent.