Pocklington's primality certificate #
To use this certificate for primality of N, factorise N - 1 completely.
- If the largest factor
pis> √N, then setF₁ = p. - Otherwise, set
F₁to be the product of enough prime factors to be> √N. - Then, find a primitive root
aofN. - Then
awill satisfy the conditions required, which are:
a ^ (N - 1) ≡ 1 (mod N)- For each prime factor
pofF₁,gcd(a ^ ((N - 1) / p) - 1, N) = 1.
Let N be a natural number whose primality we want to certify.
Assume we have a partial factorisation N - 1 = F₁ * R₁, where F₁ is fully factorised with
prime factors pᵢ.
Now for each pᵢ find a pseudo-primitive root aᵢ such that aᵢ ^ (N - 1) ≡ 1 (mod N) and
gcd(aᵢ ^ ((N - 1) / pᵢ) - 1, N) = 1.
Then any prime factor n of N satisfies n ≡ 1 (mod F₁).
The Pocklington primitive-root predicate: for each prime factor p of F₁,
gcd(root ^ ((N-1)/p) - 1, N) = 1. Built incrementally by PocklingtonPred.step.
Equations
- PocklingtonPred N root F₁ = ∀ p ∈ F₁.primeFactors, (root ^ ((N - 1) / p) - 1).gcd N = 1
Instances For
A prime power is represented by either p ^ e or p.
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.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A full factorisation of a number, written like 3 ^ 4 * 29 * 41.
Equations
- PrimeCert.Meta.factored = Lean.ParserDescr.nodeWithAntiquot "factored" `PrimeCert.Meta.factored (PrimeCert.Meta.prime_pow.sepBy1 " * " (Lean.ParserDescr.symbol " * "))
Instances For
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
Syntax for a pock certificate step: (N, root, F₁).
N: the number to certify as primeroot: a value satisfyingroot ^ (N-1) ≡ 1 (mod N)and the GCD conditionsF₁: a fully-factored divisor ofN - 1withF₁ > √N, written asp₁ ^ e₁ * p₂ * ...
All prime factors appearing in F₁ must already be in the PrimeDict (certified by
earlier small or pock steps).
-- In a pock% or prime_cert% call:
pock (339392917, 2, 3 ^ 4 * 29 * 41)
pock (16290860017, 5, 339392917)
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
Equations
- PrimeCert.Meta.PrimeCertExt.pock = { syntaxName := `PrimeCert.Meta.pock_spec, methodName := `PrimeCert.Meta.parsePockSpec }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- step_groupPock_ = Lean.ParserDescr.node `step_groupPock_ 1022 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "pock") PrimeCert.Meta.pock_spec)
Instances For
Convenience elaborator combining small and pock steps into a single term.
Syntax: pock% [small_primes; pock_steps]
- Before the
;: comma-separated small prime literals whose primality is already known (looked up asPrimeCert.prime_<n>declarations, e.g.PrimeCert.prime_31). - After the
;: comma-separated Pocklington steps(N, root, F₁)where:Nis the number to certifyrootis a pseudo-primitive root ofNF₁is a factored divisor ofN - 1withF₁ > √N, written asp₁ ^ e₁ * p₂ * ...
Steps are processed in order; each step can reference primes certified by earlier steps.
The last step's N becomes the certified prime.
-- Certify 31: declare small primes 2, 3; then one Pocklington step
theorem prime_31 : Nat.Prime 31 := pock% [2, 3; (31, 3, 2 * 3)]
-- Multi-step ladder: small primes, then intermediate, then target
theorem prime_16290860017 : Nat.Prime 16290860017 :=
pock% [3, 29, 41; (339392917, 2, 3 ^ 4 * 29 * 41), (16290860017, 5, 339392917)]
Equations
- One or more equations did not get rendered due to their size.