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

Theorem prmdiv 12853
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 12790 . . . . . 6  |-  ( P  e.  Prime  ->  -.  P  ||  1 )
213ad2ant1 976 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  -.  P  ||  1 )
3 prmnn 12761 . . . . . . . . . . . 12  |-  ( P  e.  Prime  ->  P  e.  NN )
433ad2ant1 976 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  NN )
5 simp2 956 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  A  e.  ZZ )
6 prmz 12762 . . . . . . . . . . . . . 14  |-  ( P  e.  Prime  ->  P  e.  ZZ )
763ad2ant1 976 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  ZZ )
8 gcdcom 12699 . . . . . . . . . . . . 13  |-  ( ( A  e.  ZZ  /\  P  e.  ZZ )  ->  ( A  gcd  P
)  =  ( P  gcd  A ) )
95, 7, 8syl2anc 642 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  ( P  gcd  A
) )
10 coprm 12779 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( -.  P  ||  A  <->  ( P  gcd  A )  =  1 ) )
1110biimp3a 1281 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  gcd  A )  =  1 )
129, 11eqtrd 2315 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  1 )
13 eulerth 12851 . . . . . . . . . . 11  |-  ( ( P  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
144, 5, 12, 13syl3anc 1182 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
15 phiprm 12845 . . . . . . . . . . . . . 14  |-  ( P  e.  Prime  ->  ( phi `  P )  =  ( P  -  1 ) )
16153ad2ant1 976 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( P  -  1 ) )
17 nnm1nn0 10005 . . . . . . . . . . . . . 14  |-  ( P  e.  NN  ->  ( P  -  1 )  e.  NN0 )
184, 17syl 15 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  1 )  e.  NN0 )
1916, 18eqeltrd 2357 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  e. 
NN0 )
20 zexpcl 11118 . . . . . . . . . . . 12  |-  ( ( A  e.  ZZ  /\  ( phi `  P )  e.  NN0 )  -> 
( A ^ ( phi `  P ) )  e.  ZZ )
215, 19, 20syl2anc 642 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  e.  ZZ )
22 1z 10053 . . . . . . . . . . . 12  |-  1  e.  ZZ
2322a1i 10 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  e.  ZZ )
24 moddvds 12538 . . . . . . . . . . 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 1182 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( ( A ^
( phi `  P
) )  mod  P
)  =  ( 1  mod  P )  <->  P  ||  (
( A ^ ( phi `  P ) )  -  1 ) ) )
2614, 25mpbid 201 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( A ^
( phi `  P
) )  -  1 ) )
27 prmuz2 12776 . . . . . . . . . . . . . . . . 17  |-  ( P  e.  Prime  ->  P  e.  ( ZZ>= `  2 )
)
28273ad2ant1 976 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  ( ZZ>= `  2 )
)
29 uznn0sub 10259 . . . . . . . . . . . . . . . 16  |-  ( P  e.  ( ZZ>= `  2
)  ->  ( P  -  2 )  e. 
NN0 )
3028, 29syl 15 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  2 )  e.  NN0 )
31 zexpcl 11118 . . . . . . . . . . . . . . 15  |-  ( ( A  e.  ZZ  /\  ( P  -  2
)  e.  NN0 )  ->  ( A ^ ( P  -  2 ) )  e.  ZZ )
325, 30, 31syl2anc 642 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  ZZ )
3332zred 10117 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  RR )
3433, 4nndivred 9794 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  /  P )  e.  RR )
3534flcld 10930 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) )  e.  ZZ )
365, 35zmulcld 10123 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  ZZ )
37 dvdsmul1 12550 . . . . . . . . . 10  |-  ( ( P  e.  ZZ  /\  ( A  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) )  e.  ZZ )  ->  P  ||  ( P  x.  ( A  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )
387, 36, 37syl2anc 642 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) )
39 zsubcl 10061 . . . . . . . . . . 11  |-  ( ( ( A ^ ( phi `  P ) )  e.  ZZ  /\  1  e.  ZZ )  ->  (
( A ^ ( phi `  P ) )  -  1 )  e.  ZZ )
4021, 22, 39sylancl 643 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  -  1 )  e.  ZZ )
417, 36zmulcld 10123 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  e.  ZZ )
42 dvds2sub 12561 . . . . . . . . . 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 1182 . . . . . . . . 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 660 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( ( A ^ ( phi `  P ) )  - 
1 )  -  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) ) ) )
455zcnd 10118 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  A  e.  CC )
4632zcnd 10118 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  CC )
477, 35zmulcld 10123 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  ZZ )
4847zcnd 10118 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  CC )
4945, 46, 48subdid 9235 . . . . . . . . . . 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 10389 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  RR+ )
52 modval 10975 . . . . . . . . . . . . . 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 642 . . . . . . . . . . . . 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 2327 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  =  ( ( A ^ ( P  - 
2 ) )  -  ( P  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )
5554oveq2d 5874 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  R )  =  ( A  x.  ( ( A ^
( P  -  2 ) )  -  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) ) )
56 2cn 9816 . . . . . . . . . . . . . . . . . 18  |-  2  e.  CC
57 ax-1cn 8795 . . . . . . . . . . . . . . . . . 18  |-  1  e.  CC
58 1p1e2 9840 . . . . . . . . . . . . . . . . . 18  |-  ( 1  +  1 )  =  2
5956, 57, 57, 58subaddrii 9135 . . . . . . . . . . . . . . . . 17  |-  ( 2  -  1 )  =  1
6059oveq2i 5869 . . . . . . . . . . . . . . . 16  |-  ( P  -  ( 2  -  1 ) )  =  ( P  -  1 )
6116, 60syl6eqr 2333 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( P  -  (
2  -  1 ) ) )
624nncnd 9762 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  CC )
6356a1i 10 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  2  e.  CC )
6457a1i 10 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  e.  CC )
6562, 63, 64subsubd 9185 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  ( 2  -  1 ) )  =  ( ( P  -  2 )  +  1 ) )
6661, 65eqtrd 2315 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( ( P  - 
2 )  +  1 ) )
6766oveq2d 5874 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A ^ (
( P  -  2 )  +  1 ) ) )
6845, 30expp1d 11246 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( ( P  -  2 )  +  1 ) )  =  ( ( A ^
( P  -  2 ) )  x.  A
) )
6946, 45mulcomd 8856 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  x.  A )  =  ( A  x.  ( A ^ ( P  -  2 ) ) ) )
7067, 68, 693eqtrd 2319 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A  x.  ( A ^ ( P  - 
2 ) ) ) )
7135zcnd 10118 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) )  e.  CC )
7262, 45, 71mul12d 9021 . . . . . . . . . . . 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
) ) ) ) )
7370, 72oveq12d 5876 . . . . . . . . . . 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 ) ) ) ) ) )
7449, 55, 733eqtr4d 2325 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  R )  =  ( ( A ^ ( phi `  P ) )  -  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) ) )
7574oveq1d 5873 . . . . . . . . 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 ) )
7621zcnd 10118 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  e.  CC )
7741zcnd 10118 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  e.  CC )
7876, 77, 64sub32d 9189 . . . . . . . . 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 ) ) ) ) ) )
7975, 78eqtrd 2315 . . . . . . . 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 ) ) ) ) ) )
8044, 79breqtrrd 4049 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( A  x.  R )  -  1 ) )
81 oveq2 5866 . . . . . . . . 9  |-  ( R  =  0  ->  ( A  x.  R )  =  ( A  x.  0 ) )
8281oveq1d 5873 . . . . . . . 8  |-  ( R  =  0  ->  (
( A  x.  R
)  -  1 )  =  ( ( A  x.  0 )  - 
1 ) )
8382breq2d 4035 . . . . . . 7  |-  ( R  =  0  ->  ( P  ||  ( ( A  x.  R )  - 
1 )  <->  P  ||  (
( A  x.  0 )  -  1 ) ) )
8480, 83syl5ibcom 211 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  ->  P 
||  ( ( A  x.  0 )  - 
1 ) ) )
8545mul01d 9011 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  0 )  =  0 )
8685oveq1d 5873 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  0 )  -  1 )  =  ( 0  -  1 ) )
87 df-neg 9040 . . . . . . . . 9  |-  -u 1  =  ( 0  -  1 )
8886, 87syl6eqr 2333 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  0 )  -  1 )  =  -u 1 )
8988breq2d 4035 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A  x.  0 )  - 
1 )  <->  P  ||  -u 1
) )
90 dvdsnegb 12546 . . . . . . . 8  |-  ( ( P  e.  ZZ  /\  1  e.  ZZ )  ->  ( P  ||  1  <->  P 
||  -u 1 ) )
917, 22, 90sylancl 643 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  1  <->  P  ||  -u 1
) )
9289, 91bitr4d 247 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A  x.  0 )  - 
1 )  <->  P  ||  1
) )
9384, 92sylibd 205 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  ->  P 
||  1 ) )
942, 93mtod 168 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  -.  R  =  0 )
95 zmodfz 10991 . . . . . . . 8  |-  ( ( ( A ^ ( P  -  2 ) )  e.  ZZ  /\  P  e.  NN )  ->  ( ( A ^
( P  -  2 ) )  mod  P
)  e.  ( 0 ... ( P  - 
1 ) ) )
9632, 4, 95syl2anc 642 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  e.  ( 0 ... ( P  -  1 ) ) )
9750, 96syl5eqel 2367 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( 0 ... ( P  -  1 ) ) )
98 nn0uz 10262 . . . . . . . 8  |-  NN0  =  ( ZZ>= `  0 )
9918, 98syl6eleq 2373 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  1 )  e.  ( ZZ>= `  0
) )
100 elfzp12 10861 . . . . . . 7  |-  ( ( P  -  1 )  e.  ( ZZ>= `  0
)  ->  ( R  e.  ( 0 ... ( P  -  1 ) )  <->  ( R  =  0  \/  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) ) ) )
10199, 100syl 15 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  e.  ( 0 ... ( P  - 
1 ) )  <->  ( R  =  0  \/  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) ) ) )
10297, 101mpbid 201 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  \/  R  e.  ( (
0  +  1 ) ... ( P  - 
1 ) ) ) )
103102ord 366 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( -.  R  =  0  ->  R  e.  ( ( 0  +  1 ) ... ( P  - 
1 ) ) ) )
10494, 103mpd 14 . . 3  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) )
105 1e0p1 10152 . . . 4  |-  1  =  ( 0  +  1 )
106105oveq1i 5868 . . 3  |-  ( 1 ... ( P  - 
1 ) )  =  ( ( 0  +  1 ) ... ( P  -  1 ) )
107104, 106syl6eleqr 2374 . 2  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( 1 ... ( P  -  1 ) ) )
108107, 80jca 518 1  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  e.  ( 1 ... ( P  - 
1 ) )  /\  P  ||  ( ( A  x.  R )  - 
1 ) ) )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    <-> wb 176    \/ wo 357    /\ wa 358    /\ w3a 934    = wceq 1623    e. wcel 1684   class class class wbr 4023   ` cfv 5255  (class class class)co 5858   CCcc 8735   RRcr 8736   0cc0 8737   1c1 8738    + caddc 8740    x. cmul 8742    - cmin 9037   -ucneg 9038    / cdiv 9423   NNcn 9746   2c2 9795   NN0cn0 9965   ZZcz 10024   ZZ>=cuz 10230   RR+crp 10354   ...cfz 10782   |_cfl 10924    mod cmo 10973   ^cexp 11104    || cdivides 12531    gcd cgcd 12685   Primecprime 12758   phicphi 12832
This theorem is referenced by:  prmdiveq  12854  prmdivdiv  12855  wilthlem2  20307  wilthlem3  20308
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1533  ax-5 1544  ax-17 1603  ax-9 1635  ax-8 1643  ax-13 1686  ax-14 1688  ax-6 1703  ax-7 1708  ax-11 1715  ax-12 1866  ax-ext 2264  ax-rep 4131  ax-sep 4141  ax-nul 4149  ax-pow 4188  ax-pr 4214  ax-un 4512  ax-cnex 8793  ax-resscn 8794  ax-1cn 8795  ax-icn 8796  ax-addcl 8797  ax-addrcl 8798  ax-mulcl 8799  ax-mulrcl 8800  ax-mulcom 8801  ax-addass 8802  ax-mulass 8803  ax-distr 8804  ax-i2m1 8805  ax-1ne0 8806  ax-1rid 8807  ax-rnegex 8808  ax-rrecex 8809  ax-cnre 8810  ax-pre-lttri 8811  ax-pre-lttrn 8812  ax-pre-ltadd 8813  ax-pre-mulgt0 8814  ax-pre-sup 8815
This theorem depends on definitions:  df-bi 177  df-or 359  df-an 360  df-3or 935  df-3an 936  df-tru 1310  df-ex 1529  df-nf 1532  df-sb 1630  df-eu 2147  df-mo 2148  df-clab 2270  df-cleq 2276  df-clel 2279  df-nfc 2408  df-ne 2448  df-nel 2449  df-ral 2548  df-rex 2549  df-reu 2550  df-rmo 2551  df-rab 2552  df-v 2790  df-sbc 2992  df-csb 3082  df-dif 3155  df-un 3157  df-in 3159  df-ss 3166  df-pss 3168  df-nul 3456  df-if 3566  df-pw 3627  df-sn 3646  df-pr 3647  df-tp 3648  df-op 3649  df-uni 3828  df-int 3863  df-iun 3907  df-br 4024  df-opab 4078  df-mpt 4079  df-tr 4114  df-eprel 4305  df-id 4309  df-po 4314  df-so 4315  df-fr 4352  df-we 4354  df-ord 4395  df-on 4396  df-lim 4397  df-suc 4398  df-om 4657  df-xp 4695  df-rel 4696  df-cnv 4697  df-co 4698  df-dm 4699  df-rn 4700  df-res 4701  df-ima 4702  df-iota 5219  df-fun 5257  df-fn 5258  df-f 5259  df-f1 5260  df-fo 5261  df-f1o 5262  df-fv 5263  df-ov 5861  df-oprab 5862  df-mpt2 5863  df-1st 6122  df-2nd 6123  df-riota 6304  df-recs 6388  df-rdg 6423  df-1o 6479  df-2o 6480  df-oadd 6483  df-er 6660  df-map 6774  df-en 6864  df-dom 6865  df-sdom 6866  df-fin 6867  df-sup 7194  df-card 7572  df-cda 7794  df-pnf 8869  df-mnf 8870  df-xr 8871  df-ltxr 8872  df-le 8873  df-sub 9039  df-neg 9040  df-div 9424  df-nn 9747  df-2 9804  df-3 9805  df-n0 9966  df-z 10025  df-uz 10231  df-rp 10355  df-fz 10783  df-fzo 10871  df-fl 10925  df-mod 10974  df-seq 11047  df-exp 11105  df-hash 11338  df-cj 11584  df-re 11585  df-im 11586  df-sqr 11720  df-abs 11721  df-dvds 12532  df-gcd 12686  df-prm 12759  df-phi 12834
  Copyright terms: Public domain W3C validator