Producers #
This file defines producers of primality witnesses, and certificate builders taking witnesses found by the producers or provided by the user.
Numbers below this bound are proved prime by norm_num's evaluation of Nat.minFac.
Equations
Instances For
Returns an array of distinct prime factors of the input (not necessarily complete).
Works in CoreM to check heartbeats and handle cancellation.
Equations
Instances For
Returns the prime factors of n that f finds, plus the remaining factor with all of the
found prime factors divided out.
Equations
- f.decompose n = do let ps ← f n pure (ps, Array.foldl Nat.divMaxPow n ps)
Instances For
Returns the candidates in factors that divide its input. To ensure that the returned array
consists of primes only, the array of factors should ideally all be prime.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Runs f₁ on n, then f₂ on what is left after dividing out the factors f₁ returned.
Equations
Instances For
The primes below bound. This is currently called once per tactic run.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Whether n passes the Miller–Rabin test to the prime bases up to 41 (no false-positive up to
3.3 * 10 ^ 24).
Equations
Instances For
Finds a nontrivial factor of n by Pollard's rho method with x ↦ x ^ 2 + c in at most
steps steps, starting with c = 1 and moving to the next c when a run finds n itself.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Splits n by rhoFactor? into factors that pass isProbablePrime, and returns the distinct
ones. A part that it cannot split is left out.
Options for factorizing p - 1.
Candidate prime factors, tried before trial division on
p - 1and onq - 1for each primeqrequired on the way.- rhoSteps : ℕ
The number of steps of Pollard's rho method on each number before it gives up.
Instances For
Tries factors, then trial division up to normNumBound, then Pollard's rho method.
Equations
Instances For
Searches for the root and the factorization of p - 1 of a Lucas witness for p, trying
2, …, 1023 as primitive roots. The part of p - 1 that the factorizer leaves must pass
isProbablePrime, and is then taken to be prime.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The witness of a primality certificate for one prime, tagged by the certificate type.
- lucas (w : LucasWitness) : Witness
The witness of a Lucas certificate.
Instances For
Where the witnesses of a certificate come from.
- search (cfg : FactorizerConfig) : CertMode
The witnesses are searched for, with the factorizer options
cfg. - witnesses (witnesses : List Witness) : CertMode
The certificate with a list of explicit witnesses in
witnesses. A primeptakes the first entry whose factors are the prime factors ofp - 1and whose root is a primitive root ofp.
Instances For
Find the root and the factorization of p - 1 given by the first entry of witnesses that is
a Lucas witness for the prime p.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Constructs the certificate of a prime, given the primes already proved, which need no certificate of their own.
Equations
Instances For
Builds the certificate of p from the root and the factorization of p - 1 that witness
gives for each prime, with norm_num below normNumBound and the available proofs for the primes
in known. Each prime's certificate is built once.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds each prime's certificate from the first entry of witnesses that fits it. Repeated
prime factors in an entry count once.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds the certificate of p from witnesses searched for with the factorizer options cfg,
trying the primes in known as factors first.
Equations
- One or more equations did not get rendered due to their size.