MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  prmdiv Structured version   Unicode version

Theorem prmdiv 13881
Description: Show an explicit expression for the modular inverse of  A  mod  P. (Contributed by Mario Carneiro, 24-Jan-2015.)
Hypothesis
Ref Expression
prmdiv.1  |-  R  =  ( ( A ^
( P  -  2 ) )  mod  P
)
Assertion
Ref Expression
prmdiv  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  e.  ( 1 ... ( P  - 
1 ) )  /\  P  ||  ( ( A  x.  R )  - 
1 ) ) )

Proof of Theorem prmdiv
StepHypRef Expression
1 nprmdvds1 13818 . . . . . 6  |-  ( P  e.  Prime  ->  -.  P  ||  1 )
213ad2ant1 1009 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  -.  P  ||  1 )
3 prmnn 13787 . . . . . . . . . . . 12  |-  ( P  e.  Prime  ->  P  e.  NN )
433ad2ant1 1009 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  NN )
5 simp2 989 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  A  e.  ZZ )
6 prmz 13788 . . . . . . . . . . . . . 14  |-  ( P  e.  Prime  ->  P  e.  ZZ )
763ad2ant1 1009 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  ZZ )
8 gcdcom 13725 . . . . . . . . . . . . 13  |-  ( ( A  e.  ZZ  /\  P  e.  ZZ )  ->  ( A  gcd  P
)  =  ( P  gcd  A ) )
95, 7, 8syl2anc 661 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  ( P  gcd  A
) )
10 coprm 13807 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( -.  P  ||  A  <->  ( P  gcd  A )  =  1 ) )
1110biimp3a 1318 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  gcd  A )  =  1 )
129, 11eqtrd 2475 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  1 )
13 eulerth 13879 . . . . . . . . . . 11  |-  ( ( P  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
144, 5, 12, 13syl3anc 1218 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
15 phiprm 13873 . . . . . . . . . . . . . 14  |-  ( P  e.  Prime  ->  ( phi `  P )  =  ( P  -  1 ) )
16153ad2ant1 1009 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( P  -  1 ) )
17 nnm1nn0 10642 . . . . . . . . . . . . . 14  |-  ( P  e.  NN  ->  ( P  -  1 )  e.  NN0 )
184, 17syl 16 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  1 )  e.  NN0 )
1916, 18eqeltrd 2517 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  e. 
NN0 )
20 zexpcl 11901 . . . . . . . . . . . 12  |-  ( ( A  e.  ZZ  /\  ( phi `  P )  e.  NN0 )  -> 
( A ^ ( phi `  P ) )  e.  ZZ )
215, 19, 20syl2anc 661 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  e.  ZZ )
22 1z 10697 . . . . . . . . . . . 12  |-  1  e.  ZZ
2322a1i 11 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  e.  ZZ )
24 moddvds 13563 . . . . . . . . . . 11  |-  ( ( P  e.  NN  /\  ( A ^ ( phi `  P ) )  e.  ZZ  /\  1  e.  ZZ )  ->  (
( ( A ^
( phi `  P
) )  mod  P
)  =  ( 1  mod  P )  <->  P  ||  (
( A ^ ( phi `  P ) )  -  1 ) ) )
254, 21, 23, 24syl3anc 1218 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( ( A ^
( phi `  P
) )  mod  P
)  =  ( 1  mod  P )  <->  P  ||  (
( A ^ ( phi `  P ) )  -  1 ) ) )
2614, 25mpbid 210 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( A ^
( phi `  P
) )  -  1 ) )
27 prmuz2 13802 . . . . . . . . . . . . . . . . 17  |-  ( P  e.  Prime  ->  P  e.  ( ZZ>= `  2 )
)
28273ad2ant1 1009 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  ( ZZ>= `  2 )
)
29 uznn0sub 10913 . . . . . . . . . . . . . . . 16  |-  ( P  e.  ( ZZ>= `  2
)  ->  ( P  -  2 )  e. 
NN0 )
3028, 29syl 16 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  2 )  e.  NN0 )
31 zexpcl 11901 . . . . . . . . . . . . . . 15  |-  ( ( A  e.  ZZ  /\  ( P  -  2
)  e.  NN0 )  ->  ( A ^ ( P  -  2 ) )  e.  ZZ )
325, 30, 31syl2anc 661 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  ZZ )
3332zred 10768 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  RR )
3433, 4nndivred 10391 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  /  P )  e.  RR )
3534flcld 11669 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) )  e.  ZZ )
365, 35zmulcld 10774 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  ZZ )
37 dvdsmul1 13575 . . . . . . . . . 10  |-  ( ( P  e.  ZZ  /\  ( A  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) )  e.  ZZ )  ->  P  ||  ( P  x.  ( A  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )
387, 36, 37syl2anc 661 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) )
39 zsubcl 10708 . . . . . . . . . . 11  |-  ( ( ( A ^ ( phi `  P ) )  e.  ZZ  /\  1  e.  ZZ )  ->  (
( A ^ ( phi `  P ) )  -  1 )  e.  ZZ )
4021, 22, 39sylancl 662 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  -  1 )  e.  ZZ )
417, 36zmulcld 10774 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  e.  ZZ )
42 dvds2sub 13586 . . . . . . . . . 10  |-  ( ( P  e.  ZZ  /\  ( ( A ^
( phi `  P
) )  -  1 )  e.  ZZ  /\  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) )  e.  ZZ )  -> 
( ( P  ||  ( ( A ^
( phi `  P
) )  -  1 )  /\  P  ||  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) )  ->  P  ||  (
( ( A ^
( phi `  P
) )  -  1 )  -  ( P  x.  ( A  x.  ( |_ `  ( ( A ^ ( P  -  2 ) )  /  P ) ) ) ) ) ) )
437, 40, 41, 42syl3anc 1218 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( P  ||  (
( A ^ ( phi `  P ) )  -  1 )  /\  P  ||  ( P  x.  ( A  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )  ->  P  ||  ( ( ( A ^ ( phi `  P ) )  - 
1 )  -  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) ) ) ) )
4426, 38, 43mp2and 679 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( ( A ^ ( phi `  P ) )  - 
1 )  -  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) ) ) )
455zcnd 10769 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  A  e.  CC )
4632zcnd 10769 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  CC )
477, 35zmulcld 10774 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  ZZ )
4847zcnd 10769 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  CC )
4945, 46, 48subdid 9821 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  ( ( A ^ ( P  - 
2 ) )  -  ( P  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )  =  ( ( A  x.  ( A ^ ( P  - 
2 ) ) )  -  ( A  x.  ( P  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) ) )
50 prmdiv.1 . . . . . . . . . . . . 13  |-  R  =  ( ( A ^
( P  -  2 ) )  mod  P
)
514nnrpd 11047 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  RR+ )
52 modval 11731 . . . . . . . . . . . . . 14  |-  ( ( ( A ^ ( P  -  2 ) )  e.  RR  /\  P  e.  RR+ )  -> 
( ( A ^
( P  -  2 ) )  mod  P
)  =  ( ( A ^ ( P  -  2 ) )  -  ( P  x.  ( |_ `  ( ( A ^ ( P  -  2 ) )  /  P ) ) ) ) )
5333, 51, 52syl2anc 661 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  =  ( ( A ^ ( P  - 
2 ) )  -  ( P  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )
5450, 53syl5eq 2487 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  =  ( ( A ^ ( P  - 
2 ) )  -  ( P  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )
5554oveq2d 6128 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  R )  =  ( A  x.  ( ( A ^
( P  -  2 ) )  -  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) ) )
56 2m1e1 10457 . . . . . . . . . . . . . . . . 17  |-  ( 2  -  1 )  =  1
5756oveq2i 6123 . . . . . . . . . . . . . . . 16  |-  ( P  -  ( 2  -  1 ) )  =  ( P  -  1 )
5816, 57syl6eqr 2493 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( P  -  (
2  -  1 ) ) )
594nncnd 10359 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  CC )
60 2cnd 10415 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  2  e.  CC )
61 ax-1cn 9361 . . . . . . . . . . . . . . . . 17  |-  1  e.  CC
6261a1i 11 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  e.  CC )
6359, 60, 62subsubd 9768 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  ( 2  -  1 ) )  =  ( ( P  -  2 )  +  1 ) )
6458, 63eqtrd 2475 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( ( P  - 
2 )  +  1 ) )
6564oveq2d 6128 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A ^ (
( P  -  2 )  +  1 ) ) )
6645, 30expp1d 12030 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( ( P  -  2 )  +  1 ) )  =  ( ( A ^
( P  -  2 ) )  x.  A
) )
6746, 45mulcomd 9428 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  x.  A )  =  ( A  x.  ( A ^ ( P  -  2 ) ) ) )
6865, 66, 673eqtrd 2479 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A  x.  ( A ^ ( P  - 
2 ) ) ) )
6935zcnd 10769 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) )  e.  CC )
7059, 45, 69mul12d 9599 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  =  ( A  x.  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) )
7168, 70oveq12d 6130 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  -  ( P  x.  ( A  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )  =  ( ( A  x.  ( A ^ ( P  - 
2 ) ) )  -  ( A  x.  ( P  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) ) )
7249, 55, 713eqtr4d 2485 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  R )  =  ( ( A ^ ( phi `  P ) )  -  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) ) )
7372oveq1d 6127 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  R
)  -  1 )  =  ( ( ( A ^ ( phi `  P ) )  -  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) )  -  1 ) )
7421zcnd 10769 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  e.  CC )
7541zcnd 10769 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  e.  CC )
7674, 75, 62sub32d 9772 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( ( A ^
( phi `  P
) )  -  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) ) )  -  1 )  =  ( ( ( A ^ ( phi `  P ) )  - 
1 )  -  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) ) ) )
7773, 76eqtrd 2475 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  R
)  -  1 )  =  ( ( ( A ^ ( phi `  P ) )  - 
1 )  -  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) ) ) )
7844, 77breqtrrd 4339 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( A  x.  R )  -  1 ) )
79 oveq2 6120 . . . . . . . . 9  |-  ( R  =  0  ->  ( A  x.  R )  =  ( A  x.  0 ) )
8079oveq1d 6127 . . . . . . . 8  |-  ( R  =  0  ->  (
( A  x.  R
)  -  1 )  =  ( ( A  x.  0 )  - 
1 ) )
8180breq2d 4325 . . . . . . 7  |-  ( R  =  0  ->  ( P  ||  ( ( A  x.  R )  - 
1 )  <->  P  ||  (
( A  x.  0 )  -  1 ) ) )
8278, 81syl5ibcom 220 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  ->  P 
||  ( ( A  x.  0 )  - 
1 ) ) )
8345mul01d 9589 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  0 )  =  0 )
8483oveq1d 6127 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  0 )  -  1 )  =  ( 0  -  1 ) )
85 df-neg 9619 . . . . . . . . 9  |-  -u 1  =  ( 0  -  1 )
8684, 85syl6eqr 2493 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  0 )  -  1 )  =  -u 1 )
8786breq2d 4325 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A  x.  0 )  - 
1 )  <->  P  ||  -u 1
) )
88 dvdsnegb 13571 . . . . . . . 8  |-  ( ( P  e.  ZZ  /\  1  e.  ZZ )  ->  ( P  ||  1  <->  P 
||  -u 1 ) )
897, 22, 88sylancl 662 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  1  <->  P  ||  -u 1
) )
9087, 89bitr4d 256 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A  x.  0 )  - 
1 )  <->  P  ||  1
) )
9182, 90sylibd 214 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  ->  P 
||  1 ) )
922, 91mtod 177 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  -.  R  =  0 )
93 zmodfz 11750 . . . . . . . 8  |-  ( ( ( A ^ ( P  -  2 ) )  e.  ZZ  /\  P  e.  NN )  ->  ( ( A ^
( P  -  2 ) )  mod  P
)  e.  ( 0 ... ( P  - 
1 ) ) )
9432, 4, 93syl2anc 661 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  e.  ( 0 ... ( P  -  1 ) ) )
9550, 94syl5eqel 2527 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( 0 ... ( P  -  1 ) ) )
96 nn0uz 10916 . . . . . . . 8  |-  NN0  =  ( ZZ>= `  0 )
9718, 96syl6eleq 2533 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  1 )  e.  ( ZZ>= `  0
) )
98 elfzp12 11560 . . . . . . 7  |-  ( ( P  -  1 )  e.  ( ZZ>= `  0
)  ->  ( R  e.  ( 0 ... ( P  -  1 ) )  <->  ( R  =  0  \/  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) ) ) )
9997, 98syl 16 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  e.  ( 0 ... ( P  - 
1 ) )  <->  ( R  =  0  \/  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) ) ) )
10095, 99mpbid 210 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  \/  R  e.  ( (
0  +  1 ) ... ( P  - 
1 ) ) ) )
101100ord 377 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( -.  R  =  0  ->  R  e.  ( ( 0  +  1 ) ... ( P  - 
1 ) ) ) )
10292, 101mpd 15 . . 3  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) )
103 1e0p1 10804 . . . 4  |-  1  =  ( 0  +  1 )
104103oveq1i 6122 . . 3  |-  ( 1 ... ( P  - 
1 ) )  =  ( ( 0  +  1 ) ... ( P  -  1 ) )
105102, 104syl6eleqr 2534 . 2  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( 1 ... ( P  -  1 ) ) )
106105, 78jca 532 1  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  e.  ( 1 ... ( P  - 
1 ) )  /\  P  ||  ( ( A  x.  R )  - 
1 ) ) )
Colors of variables: wff setvar class
Syntax hints:   -. wn 3    -> wi 4    <-> wb 184    \/ wo 368    /\ wa 369    /\ w3a 965    = wceq 1369    e. wcel 1756   class class class wbr 4313   ` cfv 5439  (class class class)co 6112   CCcc 9301   RRcr 9302   0cc0 9303   1c1 9304    + caddc 9306    x. cmul 9308    - cmin 9616   -ucneg 9617    / cdiv 10014   NNcn 10343   2c2 10392   NN0cn0 10600   ZZcz 10667   ZZ>=cuz 10882   RR+crp 11012   ...cfz 11458   |_cfl 11661    mod cmo 11729   ^cexp 11886    || cdivides 13556    gcd cgcd 13711   Primecprime 13784   phicphi 13860
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 4424  ax-sep 4434  ax-nul 4442  ax-pow 4491  ax-pr 4552  ax-un 6393  ax-cnex 9359  ax-resscn 9360  ax-1cn 9361  ax-icn 9362  ax-addcl 9363  ax-addrcl 9364  ax-mulcl 9365  ax-mulrcl 9366  ax-mulcom 9367  ax-addass 9368  ax-mulass 9369  ax-distr 9370  ax-i2m1 9371  ax-1ne0 9372  ax-1rid 9373  ax-rnegex 9374  ax-rrecex 9375  ax-cnre 9376  ax-pre-lttri 9377  ax-pre-lttrn 9378  ax-pre-ltadd 9379  ax-pre-mulgt0 9380  ax-pre-sup 9381
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 2741  df-rex 2742  df-reu 2743  df-rmo 2744  df-rab 2745  df-v 2995  df-sbc 3208  df-csb 3310  df-dif 3352  df-un 3354  df-in 3356  df-ss 3363  df-pss 3365  df-nul 3659  df-if 3813  df-pw 3883  df-sn 3899  df-pr 3901  df-tp 3903  df-op 3905  df-uni 4113  df-int 4150  df-iun 4194  df-br 4314  df-opab 4372  df-mpt 4373  df-tr 4407  df-eprel 4653  df-id 4657  df-po 4662  df-so 4663  df-fr 4700  df-we 4702  df-ord 4743  df-on 4744  df-lim 4745  df-suc 4746  df-xp 4867  df-rel 4868  df-cnv 4869  df-co 4870  df-dm 4871  df-rn 4872  df-res 4873  df-ima 4874  df-iota 5402  df-fun 5441  df-fn 5442  df-f 5443  df-f1 5444  df-fo 5445  df-f1o 5446  df-fv 5447  df-riota 6073  df-ov 6115  df-oprab 6116  df-mpt2 6117  df-om 6498  df-1st 6598  df-2nd 6599  df-recs 6853  df-rdg 6887  df-1o 6941  df-2o 6942  df-oadd 6945  df-er 7122  df-map 7237  df-en 7332  df-dom 7333  df-sdom 7334  df-fin 7335  df-sup 7712  df-card 8130  df-cda 8358  df-pnf 9441  df-mnf 9442  df-xr 9443  df-ltxr 9444  df-le 9445  df-sub 9618  df-neg 9619  df-div 10015  df-nn 10344  df-2 10401  df-3 10402  df-n0 10601  df-z 10668  df-uz 10883  df-rp 11013  df-fz 11459  df-fzo 11570  df-fl 11663  df-mod 11730  df-seq 11828  df-exp 11887  df-hash 12125  df-cj 12609  df-re 12610  df-im 12611  df-sqr 12745  df-abs 12746  df-dvds 13557  df-gcd 13712  df-prm 13785  df-phi 13862
This theorem is referenced by:  prmdiveq  13882  prmdivdiv  13883  modprminv  13891  wilthlem2  22429  wilthlem3  22430
  Copyright terms: Public domain W3C validator