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

Theorem prmdiv 12869
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 12806 . . . . . 6  |-  ( P  e.  Prime  ->  -.  P  ||  1 )
213ad2ant1 976 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  -.  P  ||  1 )
3 prmnn 12777 . . . . . . . . . . . 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 12778 . . . . . . . . . . . . . 14  |-  ( P  e.  Prime  ->  P  e.  ZZ )
763ad2ant1 976 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  ZZ )
8 gcdcom 12715 . . . . . . . . . . . . 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 12795 . . . . . . . . . . . . 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 2328 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  1 )
13 eulerth 12867 . . . . . . . . . . 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 12861 . . . . . . . . . . . . . 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 10021 . . . . . . . . . . . . . 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 2370 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  e. 
NN0 )
20 zexpcl 11134 . . . . . . . . . . . 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 10069 . . . . . . . . . . . 12  |-  1  e.  ZZ
2322a1i 10 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  e.  ZZ )
24 moddvds 12554 . . . . . . . . . . 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 12792 . . . . . . . . . . . . . . . . 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 10275 . . . . . . . . . . . . . . . 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 11134 . . . . . . . . . . . . . . 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 10133 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  RR )
3433, 4nndivred 9810 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  /  P )  e.  RR )
3534flcld 10946 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) )  e.  ZZ )
365, 35zmulcld 10139 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  ZZ )
37 dvdsmul1 12566 . . . . . . . . . 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 10077 . . . . . . . . . . 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 10139 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  e.  ZZ )
42 dvds2sub 12577 . . . . . . . . . 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 10134 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  A  e.  CC )
4632zcnd 10134 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  CC )
477, 35zmulcld 10139 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  ZZ )
4847zcnd 10134 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  CC )
4945, 46, 48subdid 9251 . . . . . . . . . . 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 10405 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  RR+ )
52 modval 10991 . . . . . . . . . . . . . 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 2340 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  =  ( ( A ^ ( P  - 
2 ) )  -  ( P  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )
5554oveq2d 5890 . . . . . . . . . . 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 9832 . . . . . . . . . . . . . . . . . 18  |-  2  e.  CC
57 ax-1cn 8811 . . . . . . . . . . . . . . . . . 18  |-  1  e.  CC
58 1p1e2 9856 . . . . . . . . . . . . . . . . . 18  |-  ( 1  +  1 )  =  2
5956, 57, 57, 58subaddrii 9151 . . . . . . . . . . . . . . . . 17  |-  ( 2  -  1 )  =  1
6059oveq2i 5885 . . . . . . . . . . . . . . . 16  |-  ( P  -  ( 2  -  1 ) )  =  ( P  -  1 )
6116, 60syl6eqr 2346 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( P  -  (
2  -  1 ) ) )
624nncnd 9778 . . . . . . . . . . . . . . . 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 9201 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  ( 2  -  1 ) )  =  ( ( P  -  2 )  +  1 ) )
6661, 65eqtrd 2328 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( ( P  - 
2 )  +  1 ) )
6766oveq2d 5890 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A ^ (
( P  -  2 )  +  1 ) ) )
6845, 30expp1d 11262 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( ( P  -  2 )  +  1 ) )  =  ( ( A ^
( P  -  2 ) )  x.  A
) )
6946, 45mulcomd 8872 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  x.  A )  =  ( A  x.  ( A ^ ( P  -  2 ) ) ) )
7067, 68, 693eqtrd 2332 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A  x.  ( A ^ ( P  - 
2 ) ) ) )
7135zcnd 10134 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) )  e.  CC )
7262, 45, 71mul12d 9037 . . . . . . . . . . . 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 5892 . . . . . . . . . . 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 2338 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  R )  =  ( ( A ^ ( phi `  P ) )  -  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) ) )
7574oveq1d 5889 . . . . . . . . 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 10134 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  e.  CC )
7741zcnd 10134 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  e.  CC )
7876, 77, 64sub32d 9205 . . . . . . . . 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 2328 . . . . . . . 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 4065 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( A  x.  R )  -  1 ) )
81 oveq2 5882 . . . . . . . . 9  |-  ( R  =  0  ->  ( A  x.  R )  =  ( A  x.  0 ) )
8281oveq1d 5889 . . . . . . . 8  |-  ( R  =  0  ->  (
( A  x.  R
)  -  1 )  =  ( ( A  x.  0 )  - 
1 ) )
8382breq2d 4051 . . . . . . 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 9027 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  0 )  =  0 )
8685oveq1d 5889 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  0 )  -  1 )  =  ( 0  -  1 ) )
87 df-neg 9056 . . . . . . . . 9  |-  -u 1  =  ( 0  -  1 )
8886, 87syl6eqr 2346 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  0 )  -  1 )  =  -u 1 )
8988breq2d 4051 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A  x.  0 )  - 
1 )  <->  P  ||  -u 1
) )
90 dvdsnegb 12562 . . . . . . . 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 11007 . . . . . . . 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 2380 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( 0 ... ( P  -  1 ) ) )
98 nn0uz 10278 . . . . . . . 8  |-  NN0  =  ( ZZ>= `  0 )
9918, 98syl6eleq 2386 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  1 )  e.  ( ZZ>= `  0
) )
100 elfzp12 10877 . . . . . . 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 10168 . . . 4  |-  1  =  ( 0  +  1 )
106105oveq1i 5884 . . 3  |-  ( 1 ... ( P  - 
1 ) )  =  ( ( 0  +  1 ) ... ( P  -  1 ) )
107104, 106syl6eleqr 2387 . 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 1632    e. wcel 1696   class class class wbr 4039   ` cfv 5271  (class class class)co 5874   CCcc 8751   RRcr 8752   0cc0 8753   1c1 8754    + caddc 8756    x. cmul 8758    - cmin 9053   -ucneg 9054    / cdiv 9439   NNcn 9762   2c2 9811   NN0cn0 9981   ZZcz 10040   ZZ>=cuz 10246   RR+crp 10370   ...cfz 10798   |_cfl 10940    mod cmo 10989   ^cexp 11120    || cdivides 12547    gcd cgcd 12701   Primecprime 12774   phicphi 12848
This theorem is referenced by:  prmdiveq  12870  prmdivdiv  12871  wilthlem2  20323  wilthlem3  20324
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1536  ax-5 1547  ax-17 1606  ax-9 1644  ax-8 1661  ax-13 1698  ax-14 1700  ax-6 1715  ax-7 1720  ax-11 1727  ax-12 1878  ax-ext 2277  ax-rep 4147  ax-sep 4157  ax-nul 4165  ax-pow 4204  ax-pr 4230  ax-un 4528  ax-cnex 8809  ax-resscn 8810  ax-1cn 8811  ax-icn 8812  ax-addcl 8813  ax-addrcl 8814  ax-mulcl 8815  ax-mulrcl 8816  ax-mulcom 8817  ax-addass 8818  ax-mulass 8819  ax-distr 8820  ax-i2m1 8821  ax-1ne0 8822  ax-1rid 8823  ax-rnegex 8824  ax-rrecex 8825  ax-cnre 8826  ax-pre-lttri 8827  ax-pre-lttrn 8828  ax-pre-ltadd 8829  ax-pre-mulgt0 8830  ax-pre-sup 8831
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 1532  df-nf 1535  df-sb 1639  df-eu 2160  df-mo 2161  df-clab 2283  df-cleq 2289  df-clel 2292  df-nfc 2421  df-ne 2461  df-nel 2462  df-ral 2561  df-rex 2562  df-reu 2563  df-rmo 2564  df-rab 2565  df-v 2803  df-sbc 3005  df-csb 3095  df-dif 3168  df-un 3170  df-in 3172  df-ss 3179  df-pss 3181  df-nul 3469  df-if 3579  df-pw 3640  df-sn 3659  df-pr 3660  df-tp 3661  df-op 3662  df-uni 3844  df-int 3879  df-iun 3923  df-br 4040  df-opab 4094  df-mpt 4095  df-tr 4130  df-eprel 4321  df-id 4325  df-po 4330  df-so 4331  df-fr 4368  df-we 4370  df-ord 4411  df-on 4412  df-lim 4413  df-suc 4414  df-om 4673  df-xp 4711  df-rel 4712  df-cnv 4713  df-co 4714  df-dm 4715  df-rn 4716  df-res 4717  df-ima 4718  df-iota 5235  df-fun 5273  df-fn 5274  df-f 5275  df-f1 5276  df-fo 5277  df-f1o 5278  df-fv 5279  df-ov 5877  df-oprab 5878  df-mpt2 5879  df-1st 6138  df-2nd 6139  df-riota 6320  df-recs 6404  df-rdg 6439  df-1o 6495  df-2o 6496  df-oadd 6499  df-er 6676  df-map 6790  df-en 6880  df-dom 6881  df-sdom 6882  df-fin 6883  df-sup 7210  df-card 7588  df-cda 7810  df-pnf 8885  df-mnf 8886  df-xr 8887  df-ltxr 8888  df-le 8889  df-sub 9055  df-neg 9056  df-div 9440  df-nn 9763  df-2 9820  df-3 9821  df-n0 9982  df-z 10041  df-uz 10247  df-rp 10371  df-fz 10799  df-fzo 10887  df-fl 10941  df-mod 10990  df-seq 11063  df-exp 11121  df-hash 11354  df-cj 11600  df-re 11601  df-im 11602  df-sqr 11736  df-abs 11737  df-dvds 12548  df-gcd 12702  df-prm 12775  df-phi 12850
  Copyright terms: Public domain W3C validator