ILE Home Intuitionistic Logic Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  ILE Home  >  Th. List  >  pockthi Unicode version

Theorem pockthi 12358
Description: Pocklington's theorem, which gives a sufficient criterion for a number  N to be prime. This is the preferred method for verifying large primes, being much more efficient to compute than trial division. This form has been optimized for application to specific large primes; see pockthg 12357 for a more general closed-form version. (Contributed by Mario Carneiro, 2-Mar-2014.)
Hypotheses
Ref Expression
pockthi.p  |-  P  e. 
Prime
pockthi.g  |-  G  e.  NN
pockthi.m  |-  M  =  ( G  x.  P
)
pockthi.n  |-  N  =  ( M  +  1 )
pockthi.d  |-  D  e.  NN
pockthi.e  |-  E  e.  NN
pockthi.a  |-  A  e.  NN
pockthi.fac  |-  M  =  ( D  x.  ( P ^ E ) )
pockthi.gt  |-  D  < 
( P ^ E
)
pockthi.mod  |-  ( ( A ^ M )  mod  N )  =  ( 1  mod  N
)
pockthi.gcd  |-  ( ( ( A ^ G
)  -  1 )  gcd  N )  =  1
Assertion
Ref Expression
pockthi  |-  N  e. 
Prime

Proof of Theorem pockthi
Dummy variables  x  y are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 pockthi.d . 2  |-  D  e.  NN
2 pockthi.p . . . . . 6  |-  P  e. 
Prime
3 prmnn 12112 . . . . . 6  |-  ( P  e.  Prime  ->  P  e.  NN )
42, 3ax-mp 5 . . . . 5  |-  P  e.  NN
5 pockthi.e . . . . . 6  |-  E  e.  NN
65nnnn0i 9186 . . . . 5  |-  E  e. 
NN0
7 nnexpcl 10535 . . . . 5  |-  ( ( P  e.  NN  /\  E  e.  NN0 )  -> 
( P ^ E
)  e.  NN )
84, 6, 7mp2an 426 . . . 4  |-  ( P ^ E )  e.  NN
98a1i 9 . . 3  |-  ( D  e.  NN  ->  ( P ^ E )  e.  NN )
10 id 19 . . 3  |-  ( D  e.  NN  ->  D  e.  NN )
11 pockthi.gt . . . 4  |-  D  < 
( P ^ E
)
1211a1i 9 . . 3  |-  ( D  e.  NN  ->  D  <  ( P ^ E
) )
13 pockthi.n . . . . 5  |-  N  =  ( M  +  1 )
14 pockthi.fac . . . . . . 7  |-  M  =  ( D  x.  ( P ^ E ) )
151nncni 8931 . . . . . . . 8  |-  D  e.  CC
168nncni 8931 . . . . . . . 8  |-  ( P ^ E )  e.  CC
1715, 16mulcomi 7965 . . . . . . 7  |-  ( D  x.  ( P ^ E ) )  =  ( ( P ^ E )  x.  D
)
1814, 17eqtri 2198 . . . . . 6  |-  M  =  ( ( P ^ E )  x.  D
)
1918oveq1i 5887 . . . . 5  |-  ( M  +  1 )  =  ( ( ( P ^ E )  x.  D )  +  1 )
2013, 19eqtri 2198 . . . 4  |-  N  =  ( ( ( P ^ E )  x.  D )  +  1 )
2120a1i 9 . . 3  |-  ( D  e.  NN  ->  N  =  ( ( ( P ^ E )  x.  D )  +  1 ) )
22 prmdvdsexpb 12151 . . . . . . 7  |-  ( ( x  e.  Prime  /\  P  e.  Prime  /\  E  e.  NN )  ->  ( x 
||  ( P ^ E )  <->  x  =  P ) )
232, 5, 22mp3an23 1329 . . . . . 6  |-  ( x  e.  Prime  ->  ( x 
||  ( P ^ E )  <->  x  =  P ) )
24 pockthi.m . . . . . . . . . . . . 13  |-  M  =  ( G  x.  P
)
25 pockthi.g . . . . . . . . . . . . . 14  |-  G  e.  NN
2625, 4nnmulcli 8943 . . . . . . . . . . . . 13  |-  ( G  x.  P )  e.  NN
2724, 26eqeltri 2250 . . . . . . . . . . . 12  |-  M  e.  NN
2827nncni 8931 . . . . . . . . . . 11  |-  M  e.  CC
29 ax-1cn 7906 . . . . . . . . . . 11  |-  1  e.  CC
3028, 29, 13mvrraddi 8176 . . . . . . . . . 10  |-  ( N  -  1 )  =  M
3130oveq2i 5888 . . . . . . . . 9  |-  ( A ^ ( N  - 
1 ) )  =  ( A ^ M
)
3231oveq1i 5887 . . . . . . . 8  |-  ( ( A ^ ( N  -  1 ) )  mod  N )  =  ( ( A ^ M )  mod  N
)
33 pockthi.mod . . . . . . . . 9  |-  ( ( A ^ M )  mod  N )  =  ( 1  mod  N
)
34 peano2nn 8933 . . . . . . . . . . . . 13  |-  ( M  e.  NN  ->  ( M  +  1 )  e.  NN )
3527, 34ax-mp 5 . . . . . . . . . . . 12  |-  ( M  +  1 )  e.  NN
3613, 35eqeltri 2250 . . . . . . . . . . 11  |-  N  e.  NN
37 nnq 9635 . . . . . . . . . . 11  |-  ( N  e.  NN  ->  N  e.  QQ )
3836, 37ax-mp 5 . . . . . . . . . 10  |-  N  e.  QQ
3927nngt0i 8951 . . . . . . . . . . . 12  |-  0  <  M
4027nnrei 8930 . . . . . . . . . . . . 13  |-  M  e.  RR
41 1re 7958 . . . . . . . . . . . . 13  |-  1  e.  RR
42 ltaddpos2 8412 . . . . . . . . . . . . 13  |-  ( ( M  e.  RR  /\  1  e.  RR )  ->  ( 0  <  M  <->  1  <  ( M  + 
1 ) ) )
4340, 41, 42mp2an 426 . . . . . . . . . . . 12  |-  ( 0  <  M  <->  1  <  ( M  +  1 ) )
4439, 43mpbi 145 . . . . . . . . . . 11  |-  1  <  ( M  +  1 )
4544, 13breqtrri 4032 . . . . . . . . . 10  |-  1  <  N
46 q1mod 10358 . . . . . . . . . 10  |-  ( ( N  e.  QQ  /\  1  <  N )  -> 
( 1  mod  N
)  =  1 )
4738, 45, 46mp2an 426 . . . . . . . . 9  |-  ( 1  mod  N )  =  1
4833, 47eqtri 2198 . . . . . . . 8  |-  ( ( A ^ M )  mod  N )  =  1
4932, 48eqtri 2198 . . . . . . 7  |-  ( ( A ^ ( N  -  1 ) )  mod  N )  =  1
50 oveq2 5885 . . . . . . . . . . . 12  |-  ( x  =  P  ->  (
( N  -  1 )  /  x )  =  ( ( N  -  1 )  /  P ) )
5125nncni 8931 . . . . . . . . . . . . . . 15  |-  G  e.  CC
524nncni 8931 . . . . . . . . . . . . . . 15  |-  P  e.  CC
5351, 52mulcomi 7965 . . . . . . . . . . . . . 14  |-  ( G  x.  P )  =  ( P  x.  G
)
5430, 24, 533eqtrri 2203 . . . . . . . . . . . . 13  |-  ( P  x.  G )  =  ( N  -  1 )
5536nncni 8931 . . . . . . . . . . . . . . 15  |-  N  e.  CC
5655, 29subcli 8235 . . . . . . . . . . . . . 14  |-  ( N  -  1 )  e.  CC
574nnap0i 8952 . . . . . . . . . . . . . 14  |-  P #  0
5856, 52, 51, 57divmulapi 8725 . . . . . . . . . . . . 13  |-  ( ( ( N  -  1 )  /  P )  =  G  <->  ( P  x.  G )  =  ( N  -  1 ) )
5954, 58mpbir 146 . . . . . . . . . . . 12  |-  ( ( N  -  1 )  /  P )  =  G
6050, 59eqtrdi 2226 . . . . . . . . . . 11  |-  ( x  =  P  ->  (
( N  -  1 )  /  x )  =  G )
6160oveq2d 5893 . . . . . . . . . 10  |-  ( x  =  P  ->  ( A ^ ( ( N  -  1 )  /  x ) )  =  ( A ^ G
) )
6261oveq1d 5892 . . . . . . . . 9  |-  ( x  =  P  ->  (
( A ^ (
( N  -  1 )  /  x ) )  -  1 )  =  ( ( A ^ G )  - 
1 ) )
6362oveq1d 5892 . . . . . . . 8  |-  ( x  =  P  ->  (
( ( A ^
( ( N  - 
1 )  /  x
) )  -  1 )  gcd  N )  =  ( ( ( A ^ G )  -  1 )  gcd 
N ) )
64 pockthi.gcd . . . . . . . 8  |-  ( ( ( A ^ G
)  -  1 )  gcd  N )  =  1
6563, 64eqtrdi 2226 . . . . . . 7  |-  ( x  =  P  ->  (
( ( A ^
( ( N  - 
1 )  /  x
) )  -  1 )  gcd  N )  =  1 )
66 pockthi.a . . . . . . . . 9  |-  A  e.  NN
6766nnzi 9276 . . . . . . . 8  |-  A  e.  ZZ
68 oveq1 5884 . . . . . . . . . . . 12  |-  ( y  =  A  ->  (
y ^ ( N  -  1 ) )  =  ( A ^
( N  -  1 ) ) )
6968oveq1d 5892 . . . . . . . . . . 11  |-  ( y  =  A  ->  (
( y ^ ( N  -  1 ) )  mod  N )  =  ( ( A ^ ( N  - 
1 ) )  mod 
N ) )
7069eqeq1d 2186 . . . . . . . . . 10  |-  ( y  =  A  ->  (
( ( y ^
( N  -  1 ) )  mod  N
)  =  1  <->  (
( A ^ ( N  -  1 ) )  mod  N )  =  1 ) )
71 oveq1 5884 . . . . . . . . . . . . 13  |-  ( y  =  A  ->  (
y ^ ( ( N  -  1 )  /  x ) )  =  ( A ^
( ( N  - 
1 )  /  x
) ) )
7271oveq1d 5892 . . . . . . . . . . . 12  |-  ( y  =  A  ->  (
( y ^ (
( N  -  1 )  /  x ) )  -  1 )  =  ( ( A ^ ( ( N  -  1 )  /  x ) )  - 
1 ) )
7372oveq1d 5892 . . . . . . . . . . 11  |-  ( y  =  A  ->  (
( ( y ^
( ( N  - 
1 )  /  x
) )  -  1 )  gcd  N )  =  ( ( ( A ^ ( ( N  -  1 )  /  x ) )  -  1 )  gcd 
N ) )
7473eqeq1d 2186 . . . . . . . . . 10  |-  ( y  =  A  ->  (
( ( ( y ^ ( ( N  -  1 )  /  x ) )  - 
1 )  gcd  N
)  =  1  <->  (
( ( A ^
( ( N  - 
1 )  /  x
) )  -  1 )  gcd  N )  =  1 ) )
7570, 74anbi12d 473 . . . . . . . . 9  |-  ( y  =  A  ->  (
( ( ( y ^ ( N  - 
1 ) )  mod 
N )  =  1  /\  ( ( ( y ^ ( ( N  -  1 )  /  x ) )  -  1 )  gcd 
N )  =  1 )  <->  ( ( ( A ^ ( N  -  1 ) )  mod  N )  =  1  /\  ( ( ( A ^ (
( N  -  1 )  /  x ) )  -  1 )  gcd  N )  =  1 ) ) )
7675rspcev 2843 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  ( ( ( A ^ ( N  - 
1 ) )  mod 
N )  =  1  /\  ( ( ( A ^ ( ( N  -  1 )  /  x ) )  -  1 )  gcd 
N )  =  1 ) )  ->  E. y  e.  ZZ  ( ( ( y ^ ( N  -  1 ) )  mod  N )  =  1  /\  ( ( ( y ^ (
( N  -  1 )  /  x ) )  -  1 )  gcd  N )  =  1 ) )
7767, 76mpan 424 . . . . . . 7  |-  ( ( ( ( A ^
( N  -  1 ) )  mod  N
)  =  1  /\  ( ( ( A ^ ( ( N  -  1 )  /  x ) )  - 
1 )  gcd  N
)  =  1 )  ->  E. y  e.  ZZ  ( ( ( y ^ ( N  - 
1 ) )  mod 
N )  =  1  /\  ( ( ( y ^ ( ( N  -  1 )  /  x ) )  -  1 )  gcd 
N )  =  1 ) )
7849, 65, 77sylancr 414 . . . . . 6  |-  ( x  =  P  ->  E. y  e.  ZZ  ( ( ( y ^ ( N  -  1 ) )  mod  N )  =  1  /\  ( ( ( y ^ (
( N  -  1 )  /  x ) )  -  1 )  gcd  N )  =  1 ) )
7923, 78biimtrdi 163 . . . . 5  |-  ( x  e.  Prime  ->  ( x 
||  ( P ^ E )  ->  E. y  e.  ZZ  ( ( ( y ^ ( N  -  1 ) )  mod  N )  =  1  /\  ( ( ( y ^ (
( N  -  1 )  /  x ) )  -  1 )  gcd  N )  =  1 ) ) )
8079rgen 2530 . . . 4  |-  A. x  e.  Prime  ( x  ||  ( P ^ E )  ->  E. y  e.  ZZ  ( ( ( y ^ ( N  - 
1 ) )  mod 
N )  =  1  /\  ( ( ( y ^ ( ( N  -  1 )  /  x ) )  -  1 )  gcd 
N )  =  1 ) )
8180a1i 9 . . 3  |-  ( D  e.  NN  ->  A. x  e.  Prime  ( x  ||  ( P ^ E )  ->  E. y  e.  ZZ  ( ( ( y ^ ( N  - 
1 ) )  mod 
N )  =  1  /\  ( ( ( y ^ ( ( N  -  1 )  /  x ) )  -  1 )  gcd 
N )  =  1 ) ) )
829, 10, 12, 21, 81pockthg 12357 . 2  |-  ( D  e.  NN  ->  N  e.  Prime )
831, 82ax-mp 5 1  |-  N  e. 
Prime
Colors of variables: wff set class
Syntax hints:    -> wi 4    /\ wa 104    <-> wb 105    = wceq 1353    e. wcel 2148   A.wral 2455   E.wrex 2456   class class class wbr 4005  (class class class)co 5877   RRcr 7812   0cc0 7813   1c1 7814    + caddc 7816    x. cmul 7818    < clt 7994    - cmin 8130    / cdiv 8631   NNcn 8921   NN0cn0 9178   ZZcz 9255   QQcq 9621    mod cmo 10324   ^cexp 10521    || cdvds 11796    gcd cgcd 11945   Primecprime 12109
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-ia1 106  ax-ia2 107  ax-ia3 108  ax-in1 614  ax-in2 615  ax-io 709  ax-5 1447  ax-7 1448  ax-gen 1449  ax-ie1 1493  ax-ie2 1494  ax-8 1504  ax-10 1505  ax-11 1506  ax-i12 1507  ax-bndl 1509  ax-4 1510  ax-17 1526  ax-i9 1530  ax-ial 1534  ax-i5r 1535  ax-13 2150  ax-14 2151  ax-ext 2159  ax-coll 4120  ax-sep 4123  ax-nul 4131  ax-pow 4176  ax-pr 4211  ax-un 4435  ax-setind 4538  ax-iinf 4589  ax-cnex 7904  ax-resscn 7905  ax-1cn 7906  ax-1re 7907  ax-icn 7908  ax-addcl 7909  ax-addrcl 7910  ax-mulcl 7911  ax-mulrcl 7912  ax-addcom 7913  ax-mulcom 7914  ax-addass 7915  ax-mulass 7916  ax-distr 7917  ax-i2m1 7918  ax-0lt1 7919  ax-1rid 7920  ax-0id 7921  ax-rnegex 7922  ax-precex 7923  ax-cnre 7924  ax-pre-ltirr 7925  ax-pre-ltwlin 7926  ax-pre-lttrn 7927  ax-pre-apti 7928  ax-pre-ltadd 7929  ax-pre-mulgt0 7930  ax-pre-mulext 7931  ax-arch 7932  ax-caucvg 7933
This theorem depends on definitions:  df-bi 117  df-stab 831  df-dc 835  df-3or 979  df-3an 980  df-tru 1356  df-fal 1359  df-nf 1461  df-sb 1763  df-eu 2029  df-mo 2030  df-clab 2164  df-cleq 2170  df-clel 2173  df-nfc 2308  df-ne 2348  df-nel 2443  df-ral 2460  df-rex 2461  df-reu 2462  df-rmo 2463  df-rab 2464  df-v 2741  df-sbc 2965  df-csb 3060  df-dif 3133  df-un 3135  df-in 3137  df-ss 3144  df-nul 3425  df-if 3537  df-pw 3579  df-sn 3600  df-pr 3601  df-op 3603  df-uni 3812  df-int 3847  df-iun 3890  df-br 4006  df-opab 4067  df-mpt 4068  df-tr 4104  df-id 4295  df-po 4298  df-iso 4299  df-iord 4368  df-on 4370  df-ilim 4371  df-suc 4373  df-iom 4592  df-xp 4634  df-rel 4635  df-cnv 4636  df-co 4637  df-dm 4638  df-rn 4639  df-res 4640  df-ima 4641  df-iota 5180  df-fun 5220  df-fn 5221  df-f 5222  df-f1 5223  df-fo 5224  df-f1o 5225  df-fv 5226  df-isom 5227  df-riota 5833  df-ov 5880  df-oprab 5881  df-mpo 5882  df-1st 6143  df-2nd 6144  df-recs 6308  df-irdg 6373  df-frec 6394  df-1o 6419  df-2o 6420  df-oadd 6423  df-er 6537  df-en 6743  df-dom 6744  df-fin 6745  df-sup 6985  df-inf 6986  df-pnf 7996  df-mnf 7997  df-xr 7998  df-ltxr 7999  df-le 8000  df-sub 8132  df-neg 8133  df-reap 8534  df-ap 8541  df-div 8632  df-inn 8922  df-2 8980  df-3 8981  df-4 8982  df-n0 9179  df-xnn0 9242  df-z 9256  df-uz 9531  df-q 9622  df-rp 9656  df-fz 10011  df-fzo 10145  df-fl 10272  df-mod 10325  df-seqfrec 10448  df-exp 10522  df-ihash 10758  df-cj 10853  df-re 10854  df-im 10855  df-rsqrt 11009  df-abs 11010  df-clim 11289  df-proddc 11561  df-dvds 11797  df-gcd 11946  df-prm 12110  df-odz 12212  df-phi 12213  df-pc 12287
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator