Documentation

Mathlib.Tactic.Primality.Producers

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
    @[reducible, inline]

    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
      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
          • f₁.then f₂ n = do let __x ← f₁.decompose n match __x with | (ps, rest) => do let __do_lift ← f₂ rest pure (ps ++ __do_lift)
          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 bases.

              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.

                    • factors : List ℕ

                      Candidate prime factors, tried before trial division on p - 1 and on q - 1 for each prime q required on the way.

                    • rhoSteps : ℕ

                      The number of steps of Pollard's rho method on each number before it gives up.

                    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.

                        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 prime p takes the first entry whose factors are the prime factors of p - 1 and whose root is a primitive root of p.

                          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
                              @[reducible, inline]

                              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.
                                    Instances For