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

Theorem powm2modprm 12178
Description: If an integer minus 1 is divisible by a prime number, then the integer to the power of the prime number minus 2 is 1 modulo the prime number. (Contributed by Alexander van der Vekens, 30-Aug-2018.)
Assertion
Ref Expression
powm2modprm  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( P  ||  ( A  - 
1 )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  =  1 ) )

Proof of Theorem powm2modprm
StepHypRef Expression
1 simpll 519 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  P  e.  Prime )
2 simpr 109 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  A  e.  ZZ )
32adantr 274 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  A  e.  ZZ )
4 m1dvdsndvds 12174 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( P  ||  ( A  - 
1 )  ->  -.  P  ||  A ) )
54imp 123 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  -.  P  ||  A )
6 eqid 2164 . . . . . 6  |-  ( ( A ^ ( P  -  2 ) )  mod  P )  =  ( ( A ^
( P  -  2 ) )  mod  P
)
76modprminv 12175 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( ( A ^
( P  -  2 ) )  mod  P
)  e.  ( 1 ... ( P  - 
1 ) )  /\  ( ( A  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
)  =  1 ) )
8 simpr 109 . . . . . 6  |-  ( ( ( ( A ^
( P  -  2 ) )  mod  P
)  e.  ( 1 ... ( P  - 
1 ) )  /\  ( ( A  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
)  =  1 )  ->  ( ( A  x.  ( ( A ^ ( P  - 
2 ) )  mod 
P ) )  mod 
P )  =  1 )
98eqcomd 2170 . . . . 5  |-  ( ( ( ( A ^
( P  -  2 ) )  mod  P
)  e.  ( 1 ... ( P  - 
1 ) )  /\  ( ( A  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
)  =  1 )  ->  1  =  ( ( A  x.  (
( A ^ ( P  -  2 ) )  mod  P ) )  mod  P ) )
107, 9syl 14 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  =  ( ( A  x.  ( ( A ^ ( P  - 
2 ) )  mod 
P ) )  mod 
P ) )
111, 3, 5, 10syl3anc 1227 . . 3  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  1  =  ( ( A  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
) )
12 modprm1div 12173 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A  mod  P
)  =  1  <->  P  ||  ( A  -  1 ) ) )
1312biimpar 295 . . . . . 6  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( A  mod  P )  =  1 )
1413oveq1d 5854 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A  mod  P )  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  =  ( 1  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) ) )
1514oveq1d 5854 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( (
( A  mod  P
)  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  mod  P )  =  ( ( 1  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
) )
16 zq 9558 . . . . . 6  |-  ( A  e.  ZZ  ->  A  e.  QQ )
173, 16syl 14 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  A  e.  QQ )
18 prmm2nn0 12059 . . . . . . . . . 10  |-  ( P  e.  Prime  ->  ( P  -  2 )  e. 
NN0 )
1918anim1ci 339 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( A  e.  ZZ  /\  ( P  -  2 )  e.  NN0 ) )
2019adantr 274 . . . . . . . 8  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( A  e.  ZZ  /\  ( P  -  2 )  e. 
NN0 ) )
21 zexpcl 10464 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  ( P  -  2
)  e.  NN0 )  ->  ( A ^ ( P  -  2 ) )  e.  ZZ )
2220, 21syl 14 . . . . . . 7  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( A ^ ( P  - 
2 ) )  e.  ZZ )
23 prmnn 12036 . . . . . . . . 9  |-  ( P  e.  Prime  ->  P  e.  NN )
2423adantr 274 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  P  e.  NN )
2524adantr 274 . . . . . . 7  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  P  e.  NN )
2622, 25zmodcld 10274 . . . . . 6  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A ^ ( P  - 
2 ) )  mod 
P )  e.  NN0 )
2726nn0zd 9305 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A ^ ( P  - 
2 ) )  mod 
P )  e.  ZZ )
2825nnzd 9306 . . . . . 6  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  P  e.  ZZ )
29 zq 9558 . . . . . 6  |-  ( P  e.  ZZ  ->  P  e.  QQ )
3028, 29syl 14 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  P  e.  QQ )
3125nngt0d 8895 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  0  <  P )
32 modqmulmod 10318 . . . . 5  |-  ( ( ( A  e.  QQ  /\  ( ( A ^
( P  -  2 ) )  mod  P
)  e.  ZZ )  /\  ( P  e.  QQ  /\  0  < 
P ) )  -> 
( ( ( A  mod  P )  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
)  =  ( ( A  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  mod  P ) )
3317, 27, 30, 31, 32syl22anc 1228 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( (
( A  mod  P
)  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  mod  P )  =  ( ( A  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
) )
3419, 21syl 14 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( A ^ ( P  - 
2 ) )  e.  ZZ )
3534, 24zmodcld 10274 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  e.  NN0 )
3635nn0cnd 9163 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  e.  CC )
3736mulid2d 7911 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
1  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  =  ( ( A ^ ( P  - 
2 ) )  mod 
P ) )
3837oveq1d 5854 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( 1  x.  (
( A ^ ( P  -  2 ) )  mod  P ) )  mod  P )  =  ( ( ( A ^ ( P  -  2 ) )  mod  P )  mod 
P ) )
3938adantr 274 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( (
1  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  mod  P )  =  ( ( ( A ^ ( P  - 
2 ) )  mod 
P )  mod  P
) )
40 zq 9558 . . . . . . 7  |-  ( ( A ^ ( P  -  2 ) )  e.  ZZ  ->  ( A ^ ( P  - 
2 ) )  e.  QQ )
4122, 40syl 14 . . . . . 6  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( A ^ ( P  - 
2 ) )  e.  QQ )
42 modqabs2 10287 . . . . . 6  |-  ( ( ( A ^ ( P  -  2 ) )  e.  QQ  /\  P  e.  QQ  /\  0  <  P )  ->  (
( ( A ^
( P  -  2 ) )  mod  P
)  mod  P )  =  ( ( A ^ ( P  - 
2 ) )  mod 
P ) )
4341, 30, 31, 42syl3anc 1227 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( (
( A ^ ( P  -  2 ) )  mod  P )  mod  P )  =  ( ( A ^
( P  -  2 ) )  mod  P
) )
4439, 43eqtrd 2197 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( (
1  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  mod  P )  =  ( ( A ^
( P  -  2 ) )  mod  P
) )
4515, 33, 443eqtr3d 2205 . . 3  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A  x.  ( ( A ^ ( P  - 
2 ) )  mod 
P ) )  mod 
P )  =  ( ( A ^ ( P  -  2 ) )  mod  P ) )
4611, 45eqtr2d 2198 . 2  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A ^ ( P  - 
2 ) )  mod 
P )  =  1 )
4746ex 114 1  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( P  ||  ( A  - 
1 )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  =  1 ) )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 103    /\ w3a 967    = wceq 1342    e. wcel 2135   class class class wbr 3979  (class class class)co 5839   0cc0 7747   1c1 7748    x. cmul 7752    < clt 7927    - cmin 8063   NNcn 8851   2c2 8902   NN0cn0 9108   ZZcz 9185   QQcq 9551   ...cfz 9938    mod cmo 10251   ^cexp 10448    || cdvds 11721   Primecprime 12033
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 4094  ax-sep 4097  ax-nul 4105  ax-pow 4150  ax-pr 4184  ax-un 4408  ax-setind 4511  ax-iinf 4562  ax-cnex 7838  ax-resscn 7839  ax-1cn 7840  ax-1re 7841  ax-icn 7842  ax-addcl 7843  ax-addrcl 7844  ax-mulcl 7845  ax-mulrcl 7846  ax-addcom 7847  ax-mulcom 7848  ax-addass 7849  ax-mulass 7850  ax-distr 7851  ax-i2m1 7852  ax-0lt1 7853  ax-1rid 7854  ax-0id 7855  ax-rnegex 7856  ax-precex 7857  ax-cnre 7858  ax-pre-ltirr 7859  ax-pre-ltwlin 7860  ax-pre-lttrn 7861  ax-pre-apti 7862  ax-pre-ltadd 7863  ax-pre-mulgt0 7864  ax-pre-mulext 7865  ax-arch 7866  ax-caucvg 7867
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 2726  df-sbc 2950  df-csb 3044  df-dif 3116  df-un 3118  df-in 3120  df-ss 3127  df-nul 3408  df-if 3519  df-pw 3558  df-sn 3579  df-pr 3580  df-op 3582  df-uni 3787  df-int 3822  df-iun 3865  df-br 3980  df-opab 4041  df-mpt 4042  df-tr 4078  df-id 4268  df-po 4271  df-iso 4272  df-iord 4341  df-on 4343  df-ilim 4344  df-suc 4346  df-iom 4565  df-xp 4607  df-rel 4608  df-cnv 4609  df-co 4610  df-dm 4611  df-rn 4612  df-res 4613  df-ima 4614  df-iota 5150  df-fun 5187  df-fn 5188  df-f 5189  df-f1 5190  df-fo 5191  df-f1o 5192  df-fv 5193  df-isom 5194  df-riota 5795  df-ov 5842  df-oprab 5843  df-mpo 5844  df-1st 6103  df-2nd 6104  df-recs 6267  df-irdg 6332  df-frec 6353  df-1o 6378  df-2o 6379  df-oadd 6382  df-er 6495  df-en 6701  df-dom 6702  df-fin 6703  df-sup 6943  df-pnf 7929  df-mnf 7930  df-xr 7931  df-ltxr 7932  df-le 7933  df-sub 8065  df-neg 8066  df-reap 8467  df-ap 8474  df-div 8563  df-inn 8852  df-2 8910  df-3 8911  df-4 8912  df-n0 9109  df-z 9186  df-uz 9461  df-q 9552  df-rp 9584  df-fz 9939  df-fzo 10072  df-fl 10199  df-mod 10252  df-seqfrec 10375  df-exp 10449  df-ihash 10683  df-cj 10778  df-re 10779  df-im 10780  df-rsqrt 10934  df-abs 10935  df-clim 11214  df-proddc 11486  df-dvds 11722  df-gcd 11870  df-prm 12034  df-phi 12137
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator