Users' Mathboxes Mathbox for Alexander van der Vekens < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >   Mathboxes  >  powm2modprm Structured version   Unicode version

Theorem powm2modprm 30267
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 753 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  P  e.  Prime )
2 simpr 461 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  A  e.  ZZ )
32adantr 465 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  A  e.  ZZ )
4 m1dvdsndvds 30266 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( P  ||  ( A  - 
1 )  ->  -.  P  ||  A ) )
54imp 429 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  -.  P  ||  A )
6 eqid 2443 . . . . . 6  |-  ( ( A ^ ( P  -  2 ) )  mod  P )  =  ( ( A ^
( P  -  2 ) )  mod  P
)
76modprminv 13885 . . . . 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 461 . . . . . 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 2448 . . . . 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 16 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  =  ( ( A  x.  ( ( A ^ ( P  - 
2 ) )  mod 
P ) )  mod 
P ) )
111, 3, 5, 10syl3anc 1218 . . 3  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  1  =  ( ( A  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
) )
12 modprm1div 13884 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A  mod  P
)  =  1  <->  P  ||  ( A  -  1 ) ) )
1312biimpar 485 . . . . . 6  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( A  mod  P )  =  1 )
1413oveq1d 6121 . . . . 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 6121 . . . 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 zre 10665 . . . . . 6  |-  ( A  e.  ZZ  ->  A  e.  RR )
1716ad2antlr 726 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  A  e.  RR )
18 prmm2nn0 13798 . . . . . . . . . . 11  |-  ( P  e.  Prime  ->  ( P  -  2 )  e. 
NN0 )
1918anim2i 569 . . . . . . . . . 10  |-  ( ( A  e.  ZZ  /\  P  e.  Prime )  -> 
( A  e.  ZZ  /\  ( P  -  2 )  e.  NN0 )
)
2019ancoms 453 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( A  e.  ZZ  /\  ( P  -  2 )  e.  NN0 ) )
2120adantr 465 . . . . . . . 8  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( A  e.  ZZ  /\  ( P  -  2 )  e. 
NN0 ) )
22 zexpcl 11895 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  ( P  -  2
)  e.  NN0 )  ->  ( A ^ ( P  -  2 ) )  e.  ZZ )
2321, 22syl 16 . . . . . . 7  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( A ^ ( P  - 
2 ) )  e.  ZZ )
24 prmnn 13781 . . . . . . . . 9  |-  ( P  e.  Prime  ->  P  e.  NN )
2524adantr 465 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  P  e.  NN )
2625adantr 465 . . . . . . 7  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  P  e.  NN )
2723, 26zmodcld 11743 . . . . . 6  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A ^ ( P  - 
2 ) )  mod 
P )  e.  NN0 )
2827nn0zd 10760 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A ^ ( P  - 
2 ) )  mod 
P )  e.  ZZ )
2924nnrpd 11041 . . . . . . 7  |-  ( P  e.  Prime  ->  P  e.  RR+ )
3029adantr 465 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  P  e.  RR+ )
3130adantr 465 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  P  e.  RR+ )
32 modmulmod 11779 . . . . 5  |-  ( ( A  e.  RR  /\  ( ( A ^
( P  -  2 ) )  mod  P
)  e.  ZZ  /\  P  e.  RR+ )  -> 
( ( ( A  mod  P )  x.  ( ( A ^
( P  -  2 ) )  mod  P
) )  mod  P
)  =  ( ( A  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  mod  P ) )
3317, 28, 31, 32syl3anc 1218 . . . 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
) )
3420, 22syl 16 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( A ^ ( P  - 
2 ) )  e.  ZZ )
3534, 25zmodcld 11743 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  e.  NN0 )
3635nn0cnd 10653 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  e.  CC )
3736mulid2d 9419 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
1  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  =  ( ( A ^ ( P  - 
2 ) )  mod 
P ) )
3837oveq1d 6121 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( 1  x.  (
( A ^ ( P  -  2 ) )  mod  P ) )  mod  P )  =  ( ( ( A ^ ( P  -  2 ) )  mod  P )  mod 
P ) )
3938adantr 465 . . . . 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 reexpcl 11897 . . . . . . . . 9  |-  ( ( A  e.  RR  /\  ( P  -  2
)  e.  NN0 )  ->  ( A ^ ( P  -  2 ) )  e.  RR )
4116, 18, 40syl2anr 478 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( A ^ ( P  - 
2 ) )  e.  RR )
4241, 30jca 532 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  (
( A ^ ( P  -  2 ) )  e.  RR  /\  P  e.  RR+ ) )
4342adantr 465 . . . . . 6  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A ^ ( P  - 
2 ) )  e.  RR  /\  P  e.  RR+ ) )
44 modabs2 11757 . . . . . 6  |-  ( ( ( A ^ ( P  -  2 ) )  e.  RR  /\  P  e.  RR+ )  -> 
( ( ( A ^ ( P  - 
2 ) )  mod 
P )  mod  P
)  =  ( ( A ^ ( P  -  2 ) )  mod  P ) )
4543, 44syl 16 . . . . 5  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( (
( A ^ ( P  -  2 ) )  mod  P )  mod  P )  =  ( ( A ^
( P  -  2 ) )  mod  P
) )
4639, 45eqtrd 2475 . . . 4  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( (
1  x.  ( ( A ^ ( P  -  2 ) )  mod  P ) )  mod  P )  =  ( ( A ^
( P  -  2 ) )  mod  P
) )
4715, 33, 463eqtr3d 2483 . . 3  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A  x.  ( ( A ^ ( P  - 
2 ) )  mod 
P ) )  mod 
P )  =  ( ( A ^ ( P  -  2 ) )  mod  P ) )
4811, 47eqtr2d 2476 . 2  |-  ( ( ( P  e.  Prime  /\  A  e.  ZZ )  /\  P  ||  ( A  -  1 ) )  ->  ( ( A ^ ( P  - 
2 ) )  mod 
P )  =  1 )
4948ex 434 1  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( P  ||  ( A  - 
1 )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  =  1 ) )
Colors of variables: wff setvar class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 369    /\ w3a 965    = wceq 1369    e. wcel 1756   class class class wbr 4307  (class class class)co 6106   RRcr 9296   1c1 9298    x. cmul 9302    - cmin 9610   NNcn 10337   2c2 10386   NN0cn0 10594   ZZcz 10661   RR+crp 11006   ...cfz 11452    mod cmo 11723   ^cexp 11880    || cdivides 13550   Primecprime 13778
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1591  ax-4 1602  ax-5 1670  ax-6 1708  ax-7 1728  ax-8 1758  ax-9 1760  ax-10 1775  ax-11 1780  ax-12 1792  ax-13 1943  ax-ext 2423  ax-rep 4418  ax-sep 4428  ax-nul 4436  ax-pow 4485  ax-pr 4546  ax-un 6387  ax-cnex 9353  ax-resscn 9354  ax-1cn 9355  ax-icn 9356  ax-addcl 9357  ax-addrcl 9358  ax-mulcl 9359  ax-mulrcl 9360  ax-mulcom 9361  ax-addass 9362  ax-mulass 9363  ax-distr 9364  ax-i2m1 9365  ax-1ne0 9366  ax-1rid 9367  ax-rnegex 9368  ax-rrecex 9369  ax-cnre 9370  ax-pre-lttri 9371  ax-pre-lttrn 9372  ax-pre-ltadd 9373  ax-pre-mulgt0 9374  ax-pre-sup 9375
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 966  df-3an 967  df-tru 1372  df-ex 1587  df-nf 1590  df-sb 1701  df-eu 2257  df-mo 2258  df-clab 2430  df-cleq 2436  df-clel 2439  df-nfc 2577  df-ne 2622  df-nel 2623  df-ral 2735  df-rex 2736  df-reu 2737  df-rmo 2738  df-rab 2739  df-v 2989  df-sbc 3202  df-csb 3304  df-dif 3346  df-un 3348  df-in 3350  df-ss 3357  df-pss 3359  df-nul 3653  df-if 3807  df-pw 3877  df-sn 3893  df-pr 3895  df-tp 3897  df-op 3899  df-uni 4107  df-int 4144  df-iun 4188  df-br 4308  df-opab 4366  df-mpt 4367  df-tr 4401  df-eprel 4647  df-id 4651  df-po 4656  df-so 4657  df-fr 4694  df-we 4696  df-ord 4737  df-on 4738  df-lim 4739  df-suc 4740  df-xp 4861  df-rel 4862  df-cnv 4863  df-co 4864  df-dm 4865  df-rn 4866  df-res 4867  df-ima 4868  df-iota 5396  df-fun 5435  df-fn 5436  df-f 5437  df-f1 5438  df-fo 5439  df-f1o 5440  df-fv 5441  df-riota 6067  df-ov 6109  df-oprab 6110  df-mpt2 6111  df-om 6492  df-1st 6592  df-2nd 6593  df-recs 6847  df-rdg 6881  df-1o 6935  df-2o 6936  df-oadd 6939  df-er 7116  df-map 7231  df-en 7326  df-dom 7327  df-sdom 7328  df-fin 7329  df-sup 7706  df-card 8124  df-cda 8352  df-pnf 9435  df-mnf 9436  df-xr 9437  df-ltxr 9438  df-le 9439  df-sub 9612  df-neg 9613  df-div 10009  df-nn 10338  df-2 10395  df-3 10396  df-n0 10595  df-z 10662  df-uz 10877  df-rp 11007  df-fz 11453  df-fzo 11564  df-fl 11657  df-mod 11724  df-seq 11822  df-exp 11881  df-hash 12119  df-cj 12603  df-re 12604  df-im 12605  df-sqr 12739  df-abs 12740  df-dvds 13551  df-gcd 13706  df-prm 13779  df-phi 13856
This theorem is referenced by:  numclwwlk5  30724
  Copyright terms: Public domain W3C validator