Repository navigation
Conversation
|
This would probably be best as 3 separate PRs (stacked):
We can probably merge as a single PR but it would be good to have the commits rebased into the above so each is meaningful in isolation. |
| by rewrite !exprS // -(modzMmr (m %% d)) ih modzMmr modzMml. | ||
| qed. | ||
|
|
||
| (* -------------------------------------------------------------------- *) |
There was a problem hiding this comment.
Should this entire section move to IntDiv or a related theory on modular arithmetic without the algebra?
There was a problem hiding this comment.
I am agree with you, I will do that
|
|
||
| hint simplify powmod0, powmodS. | ||
|
|
||
| (* -------------------------------------------------------------------- *) |
There was a problem hiding this comment.
Same, does this belong in IntDiv?
There was a problem hiding this comment.
Or perhaps all of the generic, but computable stuff should be in a ComputableIntDiv theory?
There was a problem hiding this comment.
In fact, I think the best solution is to add reduction lemma in database that can be used when needed.
9d89e03 to
07c6374
Compare
…y certificates IntDiv: a ^ k mod d (modzXm), the multiplicative order of a modulo n (mulorder), existence of a prime divisor (pdivP) and the sqrt bound for composites (primePns). Reduction rules for computing, kept out of the default database: modular exponentiation by squaring (powmod0, powmodE) in the hint database powmod, and Euclid's algorithm (gcdE) in the hint database gcd; use them with cbv delta hint +powmod +gcd. Pocklington: Pocklington's criterion (after coqprime) and a checker for certificates (list of prime factors of N - 1 with witnesses), sound by pock_certif and evaluated by cbv.
07c6374 to
0e8a382
Compare
Adds Pocklington's primality criterion with computable certificates. It is a port of coqprime's
Pocklington.v; names follow mathcomp where an equivalent exists.Stacked on #1238 (ZModP); followed by #1237 (ChaChaPoly: 2^130 - 5 is prime and the Poly1305 proofs).
theories/algebra/IntDiv.ec(generic modular arithmetic, moved here following review)modzXm; the multiplicative order on integersmulorder a nwithmulorder_spec,mulorder_gt0,expz_mulorder,mulorder_dvdz,mulorder_dvd_pred(namedmulorderto avoid a clash withGroup.order);pdivP(an integer> 1has a prime divisor) andprimePns(characterisation of non-primes by a prime divisorpwithp^2 <= n);powmod(powmod0,powmodE) in the hint databasepowmod, and Euclid's algorithmgcdE : gcd a b = if b = 0 then |a| else gcd b (a %% b)in the hint databasegcd. They are used ascbv delta hint +powmod +gcd; plaincbvis unchanged.theories/algebra/Pocklington.ec(new)pocklington: ifN - 1 = F1 * R1and, for every primep | F1, someasatisfiesa^(N-1) = 1 mod Nandgcd(a^((N-1)/p) - 1, N) = 1, then every prime divisor ofNis1 mod F1;pocklington_primeconcludesprime NwhenN < F1^2. Unlike coqprime, the combination of the prime factors ofF1goes throughgcd/Gaussinstead of prime powers, and there is no1 < ahypothesis;pock_certif : pock_check N c => all (fun pa => prime pa.1) c => prime N, where the certificateclists pairs(p, a)whosepmultiply toF1;pock_checkis decided bycbv delta hint +powmod +gcd.No new axioms. All of
stdlibandexamplescheck.