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

Theorem pockthi 12267
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 12266 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 12021 . . . . . 6  |-  ( P  e.  Prime  ->  P  e.  NN )
42, 3ax-mp 5 . . . . 5  |-  P  e.  NN
5 pockthi.e . . . . . 6  |-  E  e.  NN
65nnnn0i 9113 . . . . 5  |-  E  e. 
NN0
7 nnexpcl 10458 . . . . 5  |-  ( ( P  e.  NN  /\  E  e.  NN0 )  -> 
( P ^ E
)  e.  NN )
84, 6, 7mp2an 423 . . . 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 8858 . . . . . . . 8  |-  D  e.  CC
168nncni 8858 . . . . . . . 8  |-  ( P ^ E )  e.  CC
1715, 16mulcomi 7896 . . . . . . 7  |-  ( D  x.  ( P ^ E ) )  =  ( ( P ^ E )  x.  D
)
1814, 17eqtri 2185 . . . . . 6  |-  M  =  ( ( P ^ E )  x.  D
)
1918oveq1i 5846 . . . . 5  |-  ( M  +  1 )  =  ( ( ( P ^ E )  x.  D )  +  1 )
2013, 19eqtri 2185 . . . 4  |-  N  =  ( ( ( P ^ E )  x.  D )  +  1 )
2120a1i 9 . . 3  |-  ( D  e.  NN  ->  N  =  ( ( ( P ^ E )  x.  D )  +  1 ) )
22 prmdvdsexpb 12060 . . . . . . 7  |-  ( ( x  e.  Prime  /\  P  e.  Prime  /\  E  e.  NN )  ->  ( x 
||  ( P ^ E )  <->  x  =  P ) )
232, 5, 22mp3an23 1318 . . . . . 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 8870 . . . . . . . . . . . . 13  |-  ( G  x.  P )  e.  NN
2724, 26eqeltri 2237 . . . . . . . . . . . 12  |-  M  e.  NN
2827nncni 8858 . . . . . . . . . . 11  |-  M  e.  CC
29 ax-1cn 7837 . . . . . . . . . . 11  |-  1  e.  CC
3028, 29, 13mvrraddi 8106 . . . . . . . . . 10  |-  ( N  -  1 )  =  M
3130oveq2i 5847 . . . . . . . . 9  |-  ( A ^ ( N  - 
1 ) )  =  ( A ^ M
)
3231oveq1i 5846 . . . . . . . 8  |-  ( ( A ^ ( N  -  1 ) )  mod  N )  =  ( ( A ^ M )  mod  N
)
33 pockthi.mod . . . . . . . . 9  |-  ( ( A ^ M )  mod  N )  =  ( 1  mod  N
)
34 peano2nn 8860 . . . . . . . . . . . . 13  |-  ( M  e.  NN  ->  ( M  +  1 )  e.  NN )
3527, 34ax-mp 5 . . . . . . . . . . . 12  |-  ( M  +  1 )  e.  NN
3613, 35eqeltri 2237 . . . . . . . . . . 11  |-  N  e.  NN
37 nnq 9562 . . . . . . . . . . 11  |-  ( N  e.  NN  ->  N  e.  QQ )
3836, 37ax-mp 5 . . . . . . . . . 10  |-  N  e.  QQ
3927nngt0i 8878 . . . . . . . . . . . 12  |-  0  <  M
4027nnrei 8857 . . . . . . . . . . . . 13  |-  M  e.  RR
41 1re 7889 . . . . . . . . . . . . 13  |-  1  e.  RR
42 ltaddpos2 8342 . . . . . . . . . . . . 13  |-  ( ( M  e.  RR  /\  1  e.  RR )  ->  ( 0  <  M  <->  1  <  ( M  + 
1 ) ) )
4340, 41, 42mp2an 423 . . . . . . . . . . . 12  |-  ( 0  <  M  <->  1  <  ( M  +  1 ) )
4439, 43mpbi 144 . . . . . . . . . . 11  |-  1  <  ( M  +  1 )
4544, 13breqtrri 4003 . . . . . . . . . 10  |-  1  <  N
46 q1mod 10281 . . . . . . . . . 10  |-  ( ( N  e.  QQ  /\  1  <  N )  -> 
( 1  mod  N
)  =  1 )
4738, 45, 46mp2an 423 . . . . . . . . 9  |-  ( 1  mod  N )  =  1
4833, 47eqtri 2185 . . . . . . . 8  |-  ( ( A ^ M )  mod  N )  =  1
4932, 48eqtri 2185 . . . . . . 7  |-  ( ( A ^ ( N  -  1 ) )  mod  N )  =  1
50 oveq2 5844 . . . . . . . . . . . 12  |-  ( x  =  P  ->  (
( N  -  1 )  /  x )  =  ( ( N  -  1 )  /  P ) )
5125nncni 8858 . . . . . . . . . . . . . . 15  |-  G  e.  CC
524nncni 8858 . . . . . . . . . . . . . . 15  |-  P  e.  CC
5351, 52mulcomi 7896 . . . . . . . . . . . . . 14  |-  ( G  x.  P )  =  ( P  x.  G
)
5430, 24, 533eqtrri 2190 . . . . . . . . . . . . 13  |-  ( P  x.  G )  =  ( N  -  1 )
5536nncni 8858 . . . . . . . . . . . . . . 15  |-  N  e.  CC
5655, 29subcli 8165 . . . . . . . . . . . . . 14  |-  ( N  -  1 )  e.  CC
574nnap0i 8879 . . . . . . . . . . . . . 14  |-  P #  0
5856, 52, 51, 57divmulapi 8653 . . . . . . . . . . . . 13  |-  ( ( ( N  -  1 )  /  P )  =  G  <->  ( P  x.  G )  =  ( N  -  1 ) )
5954, 58mpbir 145 . . . . . . . . . . . 12  |-  ( ( N  -  1 )  /  P )  =  G
6050, 59eqtrdi 2213 . . . . . . . . . . 11  |-  ( x  =  P  ->  (
( N  -  1 )  /  x )  =  G )
6160oveq2d 5852 . . . . . . . . . 10  |-  ( x  =  P  ->  ( A ^ ( ( N  -  1 )  /  x ) )  =  ( A ^ G
) )
6261oveq1d 5851 . . . . . . . . 9  |-  ( x  =  P  ->  (
( A ^ (
( N  -  1 )  /  x ) )  -  1 )  =  ( ( A ^ G )  - 
1 ) )
6362oveq1d 5851 . . . . . . . 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 2213 . . . . . . 7  |-  ( x  =  P  ->  (
( ( A ^
( ( N  - 
1 )  /  x
) )  -  1 )  gcd  N )  =  1 )
66 pockthi.a . . . . . . . . 9  |-  A  e.  NN
6766nnzi 9203 . . . . . . . 8  |-  A  e.  ZZ
68 oveq1 5843 . . . . . . . . . . . 12  |-  ( y  =  A  ->  (
y ^ ( N  -  1 ) )  =  ( A ^
( N  -  1 ) ) )
6968oveq1d 5851 . . . . . . . . . . 11  |-  ( y  =  A  ->  (
( y ^ ( N  -  1 ) )  mod  N )  =  ( ( A ^ ( N  - 
1 ) )  mod 
N ) )
7069eqeq1d 2173 . . . . . . . . . 10  |-  ( y  =  A  ->  (
( ( y ^
( N  -  1 ) )  mod  N
)  =  1  <->  (
( A ^ ( N  -  1 ) )  mod  N )  =  1 ) )
71 oveq1 5843 . . . . . . . . . . . . 13  |-  ( y  =  A  ->  (
y ^ ( ( N  -  1 )  /  x ) )  =  ( A ^
( ( N  - 
1 )  /  x
) ) )
7271oveq1d 5851 . . . . . . . . . . . 12  |-  ( y  =  A  ->  (
( y ^ (
( N  -  1 )  /  x ) )  -  1 )  =  ( ( A ^ ( ( N  -  1 )  /  x ) )  - 
1 ) )
7372oveq1d 5851 . . . . . . . . . . 11  |-  ( y  =  A  ->  (
( ( y ^
( ( N  - 
1 )  /  x
) )  -  1 )  gcd  N )  =  ( ( ( A ^ ( ( N  -  1 )  /  x ) )  -  1 )  gcd 
N ) )
7473eqeq1d 2173 . . . . . . . . . 10  |-  ( y  =  A  ->  (
( ( ( y ^ ( ( N  -  1 )  /  x ) )  - 
1 )  gcd  N
)  =  1  <->  (
( ( A ^
( ( N  - 
1 )  /  x
) )  -  1 )  gcd  N )  =  1 ) )
7570, 74anbi12d 465 . . . . . . . . 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 2825 . . . . . . . 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 421 . . . . . . 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 411 . . . . . 6  |-  ( x  =  P  ->  E. y  e.  ZZ  ( ( ( y ^ ( N  -  1 ) )  mod  N )  =  1  /\  ( ( ( y ^ (
( N  -  1 )  /  x ) )  -  1 )  gcd  N )  =  1 ) )
7923, 78syl6bi 162 . . . . 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 2517 . . . 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 12266 . 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 103    <-> wb 104    = wceq 1342    e. wcel 2135   A.wral 2442   E.wrex 2443   class class class wbr 3976  (class class class)co 5836   RRcr 7743   0cc0 7744   1c1 7745    + caddc 7747    x. cmul 7749    < clt 7924    - cmin 8060    / cdiv 8559   NNcn 8848   NN0cn0 9105   ZZcz 9182   QQcq 9548    mod cmo 10247   ^cexp 10444    || cdvds 11713    gcd cgcd 11860   Primecprime 12018
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-ia1 105  ax-ia2 106  ax-ia3 107  ax-in1 604  ax-in2 605  ax-io 699  ax-5 1434  ax-7 1435  ax-gen 1436  ax-ie1 1480  ax-ie2 1481  ax-8 1491  ax-10 1492  ax-11 1493  ax-i12 1494  ax-bndl 1496  ax-4 1497  ax-17 1513  ax-i9 1517  ax-ial 1521  ax-i5r 1522  ax-13 2137  ax-14 2138  ax-ext 2146  ax-coll 4091  ax-sep 4094  ax-nul 4102  ax-pow 4147  ax-pr 4181  ax-un 4405  ax-setind 4508  ax-iinf 4559  ax-cnex 7835  ax-resscn 7836  ax-1cn 7837  ax-1re 7838  ax-icn 7839  ax-addcl 7840  ax-addrcl 7841  ax-mulcl 7842  ax-mulrcl 7843  ax-addcom 7844  ax-mulcom 7845  ax-addass 7846  ax-mulass 7847  ax-distr 7848  ax-i2m1 7849  ax-0lt1 7850  ax-1rid 7851  ax-0id 7852  ax-rnegex 7853  ax-precex 7854  ax-cnre 7855  ax-pre-ltirr 7856  ax-pre-ltwlin 7857  ax-pre-lttrn 7858  ax-pre-apti 7859  ax-pre-ltadd 7860  ax-pre-mulgt0 7861  ax-pre-mulext 7862  ax-arch 7863  ax-caucvg 7864
This theorem depends on definitions:  df-bi 116  df-stab 821  df-dc 825  df-3or 968  df-3an 969  df-tru 1345  df-fal 1348  df-nf 1448  df-sb 1750  df-eu 2016  df-mo 2017  df-clab 2151  df-cleq 2157  df-clel 2160  df-nfc 2295  df-ne 2335  df-nel 2430  df-ral 2447  df-rex 2448  df-reu 2449  df-rmo 2450  df-rab 2451  df-v 2723  df-sbc 2947  df-csb 3041  df-dif 3113  df-un 3115  df-in 3117  df-ss 3124  df-nul 3405  df-if 3516  df-pw 3555  df-sn 3576  df-pr 3577  df-op 3579  df-uni 3784  df-int 3819  df-iun 3862  df-br 3977  df-opab 4038  df-mpt 4039  df-tr 4075  df-id 4265  df-po 4268  df-iso 4269  df-iord 4338  df-on 4340  df-ilim 4341  df-suc 4343  df-iom 4562  df-xp 4604  df-rel 4605  df-cnv 4606  df-co 4607  df-dm 4608  df-rn 4609  df-res 4610  df-ima 4611  df-iota 5147  df-fun 5184  df-fn 5185  df-f 5186  df-f1 5187  df-fo 5188  df-f1o 5189  df-fv 5190  df-isom 5191  df-riota 5792  df-ov 5839  df-oprab 5840  df-mpo 5841  df-1st 6100  df-2nd 6101  df-recs 6264  df-irdg 6329  df-frec 6350  df-1o 6375  df-2o 6376  df-oadd 6379  df-er 6492  df-en 6698  df-dom 6699  df-fin 6700  df-sup 6940  df-inf 6941  df-pnf 7926  df-mnf 7927  df-xr 7928  df-ltxr 7929  df-le 7930  df-sub 8062  df-neg 8063  df-reap 8464  df-ap 8471  df-div 8560  df-inn 8849  df-2 8907  df-3 8908  df-4 8909  df-n0 9106  df-xnn0 9169  df-z 9183  df-uz 9458  df-q 9549  df-rp 9581  df-fz 9936  df-fzo 10068  df-fl 10195  df-mod 10248  df-seqfrec 10371  df-exp 10445  df-ihash 10678  df-cj 10770  df-re 10771  df-im 10772  df-rsqrt 10926  df-abs 10927  df-clim 11206  df-proddc 11478  df-dvds 11714  df-gcd 11861  df-prm 12019  df-odz 12121  df-phi 12122  df-pc 12196
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator