The areas / V34. The tactics of Mathlib
Mathlib.Tactic.Primality.Producers
39 declarations. Mathlib docs · Source
theorem Mathlib.Tactic.Primality.CertMode.search.injEq E0 #
∀ (cfg cfg_1 : Mathlib.Tactic.Primality.FactorizerConfig),
(Mathlib.Tactic.Primality.CertMode.search cfg = Mathlib.Tactic.Primality.CertMode.search cfg_1) = (cfg = cfg_1)
theorem Mathlib.Tactic.Primality.Witness.lucas.inj E1 #
∀ {w w_1 : Mathlib.Tactic.Primality.LucasWitness},
Mathlib.Tactic.Primality.Witness.lucas w = Mathlib.Tactic.Primality.Witness.lucas w_1 → w = w_1
theorem Mathlib.Tactic.Primality.CertMode.witnesses.injEq E0 #
∀ (witnesses witnesses_1 : List Mathlib.Tactic.Primality.Witness),
(Mathlib.Tactic.Primality.CertMode.witnesses witnesses = Mathlib.Tactic.Primality.CertMode.witnesses witnesses_1) =
(witnesses = witnesses_1)
abbrev Mathlib.Tactic.Primality.CertMode.ctorElimType E1 #
{motive : Mathlib.Tactic.Primality.CertMode → Sort u} → ℕ → Sort (max 1 u)
theorem Mathlib.Tactic.Primality.FactorizerConfig.mk.inj E1 #
∀ {factors : List ℕ} {rhoSteps : ℕ} {factors_1 : List ℕ} {rhoSteps_1 : ℕ},
{ factors := factors, rhoSteps := rhoSteps } = { factors := factors_1, rhoSteps := rhoSteps_1 } →
factors = factors_1 ∧ rhoSteps = rhoSteps_1
def Mathlib.Tactic.Primality.Witness.ctorIdx E1 #
Mathlib.Tactic.Primality.Witness → ℕ
theorem Mathlib.Tactic.Primality.Witness.lucas.injEq E0 #
∀ (w w_1 : Mathlib.Tactic.Primality.LucasWitness),
(Mathlib.Tactic.Primality.Witness.lucas w = Mathlib.Tactic.Primality.Witness.lucas w_1) = (w = w_1)
def Mathlib.Tactic.Primality.CertMode.ctorIdx E1 #
Mathlib.Tactic.Primality.CertMode → ℕ
theorem Mathlib.Tactic.Primality.CertMode.search.inj E1 #
∀ {cfg cfg_1 : Mathlib.Tactic.Primality.FactorizerConfig},
Mathlib.Tactic.Primality.CertMode.search cfg = Mathlib.Tactic.Primality.CertMode.search cfg_1 → cfg = cfg_1
def Mathlib.Tactic.Primality.FactorizerConfig.ctorIdx E1 #
Mathlib.Tactic.Primality.FactorizerConfig → ℕ
theorem Mathlib.Tactic.Primality.FactorizerConfig.mk.injEq E0 #
∀ (factors : List ℕ) (rhoSteps : ℕ) (factors_1 : List ℕ) (rhoSteps_1 : ℕ),
({ factors := factors, rhoSteps := rhoSteps } = { factors := factors_1, rhoSteps := rhoSteps_1 }) =
(factors = factors_1 ∧ rhoSteps = rhoSteps_1)
theorem Mathlib.Tactic.Primality.CertMode.witnesses.inj E1 #
∀ {witnesses witnesses_1 : List Mathlib.Tactic.Primality.Witness},
Mathlib.Tactic.Primality.CertMode.witnesses witnesses = Mathlib.Tactic.Primality.CertMode.witnesses witnesses_1 →
witnesses = witnesses_1
def Mathlib.Tactic.Primality.normNumBound E1 #
ℕ
Numbers below this bound are proved prime by norm_num's evaluation of Nat.minFac.
abbrev Mathlib.Tactic.Primality.Factorizer E1 #
Type
Returns an array of distinct prime factors of the input (not necessarily complete).
Works in CoreM to check heartbeats and handle cancellation.
def Mathlib.Tactic.Primality.Factorizer.decompose E1 #
Mathlib.Tactic.Primality.Factorizer → ℕ → Lean.CoreM (Array ℕ × ℕ)
Returns the prime factors of n that f finds, plus the remaining factor with all of the
found prime factors divided out.
def Mathlib.Tactic.Primality.Factorizer.ofArray E1 #
Array ℕ → Mathlib.Tactic.Primality.Factorizer
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.
def Mathlib.Tactic.Primality.Factorizer.then E1 #
Mathlib.Tactic.Primality.Factorizer → Mathlib.Tactic.Primality.Factorizer → Mathlib.Tactic.Primality.Factorizer
Runs f₁ on n, then f₂ on what is left after dividing out the factors f₁ returned.
def Mathlib.Tactic.Primality.smallPrimes E1 #
ℕ → Array ℕ
The primes below bound. This is currently called once per tactic run.
def Mathlib.Tactic.Primality.trialDivision E1 #
Mathlib.Tactic.Primality.Factorizer
Trial division by smallPrimes normNumBound.
def Mathlib.Tactic.Primality.millerRabin E1 #
Array ℕ → ℕ → Bool
Whether n passes the Miller–Rabin test to the prime bases bases.
def Mathlib.Tactic.Primality.isProbablePrime E1 #
ℕ → Bool
Whether n passes the Miller–Rabin test to the prime bases up to 41 (no false-positive up to
3.3 * 10 ^ 24).
def Mathlib.Tactic.Primality.rhoFactor? E1 #
ℕ → ℕ → Lean.CoreM (Option ℕ)
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.
opaque Mathlib.Tactic.Primality.pollardRho E1 #
ℕ → Mathlib.Tactic.Primality.Factorizer
Splits n by rhoFactor? into factors that pass isProbablePrime, and returns the distinct
ones. A part that it cannot split is left out.
structure Mathlib.Tactic.Primality.FactorizerConfig E1 #
Type
Options for factorizing p - 1.
ctor Mathlib.Tactic.Primality.FactorizerConfig.mk E0 #
List ℕ → ℕ → Mathlib.Tactic.Primality.FactorizerConfig
abbrev Mathlib.Tactic.Primality.FactorizerConfig.factors E1 #
Mathlib.Tactic.Primality.FactorizerConfig → List ℕ
Candidate prime factors, tried before trial division on p - 1 and on q - 1 for each prime
q required on the way.
abbrev Mathlib.Tactic.Primality.FactorizerConfig.rhoSteps E1 #
Mathlib.Tactic.Primality.FactorizerConfig → ℕ
The number of steps of Pollard's rho method on each number before it gives up.
def Mathlib.Tactic.Primality.FactorizerConfig.toFactorizer E1 #
Mathlib.Tactic.Primality.FactorizerConfig → Mathlib.Tactic.Primality.Factorizer
Tries factors, then trial division up to normNumBound, then Pollard's rho method.
def Mathlib.Tactic.Primality.findLucasWitness E1 #
Mathlib.Tactic.Primality.Factorizer → ℕ → Lean.CoreM (ℕ × List (ℕ × ℕ))
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.
inductive Mathlib.Tactic.Primality.Witness E1 #
Type
The witness of a primality certificate for one prime, tagged by the certificate type.
ctor Mathlib.Tactic.Primality.Witness.lucas E0 #
Mathlib.Tactic.Primality.LucasWitness → Mathlib.Tactic.Primality.Witness
The witness of a Lucas certificate.
inductive Mathlib.Tactic.Primality.CertMode E1 #
Type
Where the witnesses of a certificate come from.
ctor Mathlib.Tactic.Primality.CertMode.search E0 #
Mathlib.Tactic.Primality.FactorizerConfig → Mathlib.Tactic.Primality.CertMode
The witnesses are searched for, with the factorizer options cfg.
ctor Mathlib.Tactic.Primality.CertMode.witnesses E0 #
List Mathlib.Tactic.Primality.Witness → Mathlib.Tactic.Primality.CertMode
The certificate with a list of explicit witnesses in witnesses. A prime p takes the
first entry whose factors are the prime factors of p - 1 and whose root is a primitive root of
p.
def Mathlib.Tactic.Primality.witnessFor E1 #
List Mathlib.Tactic.Primality.Witness → ℕ → Lean.CoreM (ℕ × List (ℕ × ℕ))
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.
abbrev Mathlib.Tactic.Primality.CertBuilder E1 #
Type
Constructs the certificate of a prime, given the primes already proved, which need no certificate of their own.
def Mathlib.Tactic.Primality.Cert.build E1 #
(ℕ → Lean.CoreM (ℕ × List (ℕ × ℕ))) → Mathlib.Tactic.Primality.CertBuilder
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.
def Mathlib.Tactic.Primality.Cert.ofWitnesses E1 #
List Mathlib.Tactic.Primality.Witness → Mathlib.Tactic.Primality.CertBuilder
Builds each prime's certificate from the first entry of witnesses that fits it. Repeated
prime factors in an entry count once.
def Mathlib.Tactic.Primality.Cert.search E1 #
Mathlib.Tactic.Primality.FactorizerConfig → Mathlib.Tactic.Primality.CertBuilder
Builds the certificate of p from witnesses searched for with the factorizer options cfg,
trying the primes in known as factors first.