Documentation

PrimeCert.Meta.PrimeCert

Extensible framework for primality certificates #

The prime_cert% elaborator processes a sequence of step groups (e.g. small, pock, pock3), each registered via the @[prime_cert] attribute. A PrimeDict threads proof terms for already-certified primes through the ladder so later steps can reference earlier ones.

@[reducible, inline]

We store the metavariable assigned to each certified prime.

Equations
Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[reducible, inline]
      Equations
      Instances For

        A method to climb one step in the ladder, given the dictionary of previously proved primes.

        • syntaxName : Lean.Name

          The syntax specific to the certification method

        • methodName : Lean.Name

          The function to build the prime proof in the step

        Instances For

          Attribute to register a new certification method for use in prime_cert%.

          Usage: @[prime_cert key] def myExt : PrimeCertExt where ...

          This registers the method under key, generating syntax rules so it can be used as key spec or key {spec₁; spec₂; ...} inside prime_cert%.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Read a prime_cert extension from a declaration of the right type.

            Equations
            Instances For

              Read a prime certifying method from a declaration of the right type.

              Equations
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Convert a syntax category name to a TSyntax `stx dynamically.

                  Equations
                  Instances For

                    If we're given a syntax pock_spec for a step in pock, we do the following:

                    syntax "pock" pock_spec : step_spec
                    syntax "pock" "{" pock_spec;+ "}" : step_spec
                    
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        The main primality certificate elaborator.

                        Syntax: prime_cert% [group₁, group₂, ...]

                        Each group is a registered method name followed by one or more steps:

                        • small {p₁; p₂; ...} — look up pre-proved small primes
                        • pock (N, root, F₁) or pock {step₁; step₂; ...} — Pocklington certificates
                        • pock3 (N, root, m, mode, F) — cube-root Pocklington certificates

                        Groups are processed left-to-right. Within each group, steps are processed in order. Every certified prime is added to an internal PrimeDict so later steps can reference it. The last prime certified becomes the result.

                        theorem prime_60digit :
                            Nat.Prime 236684654874665389773181956283167565443541280517430278333971 := prime_cert%
                          [small {2; 3; 7; 11; 29; 31},
                           pock3 (73471, 3, 1, 7, 2 * 31),
                           pock3 (32560621, 2, 1, 7, 2 ^ 2 * 3 * 29),
                           pock3 (3586530508831189, 2, 1, 11, 2 ^ 2 * 73471),
                           pock3 (236684654874665389773181956283167565443541280517430278333971,
                             2, 1, 3, 2 * 32560621 * 3586530508831189)]
                        
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For