Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prove p is prime for various prime order fields, useful for ECDH and EDDSA #1

Open
david415 opened this issue Aug 25, 2024 · 12 comments

Comments

@david415
Copy link
Member

david415 commented Aug 25, 2024

We have several cases of apologizing to the Lean compiler for not supplying proof of primality for some rather large primes:

def p : ℕ := 2^255 - 19
def basepoint : ZMod p := 9
def keySize : ℕ := 32

theorem p_is_prime : Nat.Prime p := by sorry
instance fact_p_is_prime : Fact (Nat.Prime p) := ⟨p_is_prime⟩
instance : Field (ZMod p) := ZMod.instField p

I'm told there exist various coqprime proofs for such things already. coqprime makes Pocklington certificates of primality:

https://github.com/thery/CoqPrime

https://github.com/mit-plv/fiat-crypto/blob/master/src/Spec/Curve25519.v#L16-L34

However someone from the Lean community has at least a partially working tactic for generating Pratt certificates of primality:

https://github.com/leanprover-community/mathlib4/blob/6439ce3f194a2acd309af6831d753e560c46bcf6/Mathlib/NumberTheory/LucasPrimality.lean#L567

According to one Lean community member: "you should probably manually create a Pratt certificate for your prime"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@david415 and others