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

Theorem prmdiv 13166
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 13103 . . . . . 6  |-  ( P  e.  Prime  ->  -.  P  ||  1 )
213ad2ant1 978 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  -.  P  ||  1 )
3 prmnn 13074 . . . . . . . . . . . 12  |-  ( P  e.  Prime  ->  P  e.  NN )
433ad2ant1 978 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  NN )
5 simp2 958 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  A  e.  ZZ )
6 prmz 13075 . . . . . . . . . . . . . 14  |-  ( P  e.  Prime  ->  P  e.  ZZ )
763ad2ant1 978 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  ZZ )
8 gcdcom 13012 . . . . . . . . . . . . 13  |-  ( ( A  e.  ZZ  /\  P  e.  ZZ )  ->  ( A  gcd  P
)  =  ( P  gcd  A ) )
95, 7, 8syl2anc 643 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  ( P  gcd  A
) )
10 coprm 13092 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( -.  P  ||  A  <->  ( P  gcd  A )  =  1 ) )
1110biimp3a 1283 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  gcd  A )  =  1 )
129, 11eqtrd 2467 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  1 )
13 eulerth 13164 . . . . . . . . . . 11  |-  ( ( P  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
144, 5, 12, 13syl3anc 1184 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
15 phiprm 13158 . . . . . . . . . . . . . 14  |-  ( P  e.  Prime  ->  ( phi `  P )  =  ( P  -  1 ) )
16153ad2ant1 978 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( P  -  1 ) )
17 nnm1nn0 10253 . . . . . . . . . . . . . 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 2509 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  e. 
NN0 )
20 zexpcl 11388 . . . . . . . . . . . 12  |-  ( ( A  e.  ZZ  /\  ( phi `  P )  e.  NN0 )  -> 
( A ^ ( phi `  P ) )  e.  ZZ )
215, 19, 20syl2anc 643 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  e.  ZZ )
22 1z 10303 . . . . . . . . . . . 12  |-  1  e.  ZZ
2322a1i 11 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  e.  ZZ )
24 moddvds 12851 . . . . . . . . . . 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 1184 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( ( A ^
( phi `  P
) )  mod  P
)  =  ( 1  mod  P )  <->  P  ||  (
( A ^ ( phi `  P ) )  -  1 ) ) )
2614, 25mpbid 202 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( A ^
( phi `  P
) )  -  1 ) )
27 prmuz2 13089 . . . . . . . . . . . . . . . . 17  |-  ( P  e.  Prime  ->  P  e.  ( ZZ>= `  2 )
)
28273ad2ant1 978 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  ( ZZ>= `  2 )
)
29 uznn0sub 10509 . . . . . . . . . . . . . . . 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 11388 . . . . . . . . . . . . . . 15  |-  ( ( A  e.  ZZ  /\  ( P  -  2
)  e.  NN0 )  ->  ( A ^ ( P  -  2 ) )  e.  ZZ )
325, 30, 31syl2anc 643 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  ZZ )
3332zred 10367 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  RR )
3433, 4nndivred 10040 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  /  P )  e.  RR )
3534flcld 11199 . . . . . . . . . . 11  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) )  e.  ZZ )
365, 35zmulcld 10373 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  ZZ )
37 dvdsmul1 12863 . . . . . . . . . 10  |-  ( ( P  e.  ZZ  /\  ( A  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) )  e.  ZZ )  ->  P  ||  ( P  x.  ( A  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )
387, 36, 37syl2anc 643 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) )
39 zsubcl 10311 . . . . . . . . . . 11  |-  ( ( ( A ^ ( phi `  P ) )  e.  ZZ  /\  1  e.  ZZ )  ->  (
( A ^ ( phi `  P ) )  -  1 )  e.  ZZ )
4021, 22, 39sylancl 644 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  -  1 )  e.  ZZ )
417, 36zmulcld 10373 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  e.  ZZ )
42 dvds2sub 12874 . . . . . . . . . 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 1184 . . . . . . . . 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 661 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( ( A ^ ( phi `  P ) )  - 
1 )  -  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) ) ) )
455zcnd 10368 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  A  e.  CC )
4632zcnd 10368 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( P  - 
2 ) )  e.  CC )
477, 35zmulcld 10373 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  ZZ )
4847zcnd 10368 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) )  e.  CC )
4945, 46, 48subdid 9481 . . . . . . . . . . 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 10639 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  RR+ )
52 modval 11244 . . . . . . . . . . . . . 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 643 . . . . . . . . . . . . 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 2479 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  =  ( ( A ^ ( P  - 
2 ) )  -  ( P  x.  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) ) ) ) )
5554oveq2d 6089 . . . . . . . . . . 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 10087 . . . . . . . . . . . . . . . . 17  |-  ( 2  -  1 )  =  1
5756oveq2i 6084 . . . . . . . . . . . . . . . 16  |-  ( P  -  ( 2  -  1 ) )  =  ( P  -  1 )
5816, 57syl6eqr 2485 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( P  -  (
2  -  1 ) ) )
594nncnd 10008 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  e.  CC )
60 2cn 10062 . . . . . . . . . . . . . . . . 17  |-  2  e.  CC
6160a1i 11 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  2  e.  CC )
62 ax-1cn 9040 . . . . . . . . . . . . . . . . 17  |-  1  e.  CC
6362a1i 11 . . . . . . . . . . . . . . . 16  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  1  e.  CC )
6459, 61, 63subsubd 9431 . . . . . . . . . . . . . . 15  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  ( 2  -  1 ) )  =  ( ( P  -  2 )  +  1 ) )
6558, 64eqtrd 2467 . . . . . . . . . . . . . 14  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( ( P  - 
2 )  +  1 ) )
6665oveq2d 6089 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A ^ (
( P  -  2 )  +  1 ) ) )
6745, 30expp1d 11516 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( ( P  -  2 )  +  1 ) )  =  ( ( A ^
( P  -  2 ) )  x.  A
) )
6846, 45mulcomd 9101 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  x.  A )  =  ( A  x.  ( A ^ ( P  -  2 ) ) ) )
6966, 67, 683eqtrd 2471 . . . . . . . . . . . 12  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A  x.  ( A ^ ( P  - 
2 ) ) ) )
7035zcnd 10368 . . . . . . . . . . . . 13  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( |_ `  ( ( A ^ ( P  - 
2 ) )  /  P ) )  e.  CC )
7159, 45, 70mul12d 9267 . . . . . . . . . . . 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
) ) ) ) )
7269, 71oveq12d 6091 . . . . . . . . . . 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 ) ) ) ) ) )
7349, 55, 723eqtr4d 2477 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  R )  =  ( ( A ^ ( phi `  P ) )  -  ( P  x.  ( A  x.  ( |_ `  ( ( A ^
( P  -  2 ) )  /  P
) ) ) ) ) )
7473oveq1d 6088 . . . . . . . . 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 ) )
7521zcnd 10368 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  e.  CC )
7641zcnd 10368 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  x.  ( A  x.  ( |_ `  (
( A ^ ( P  -  2 ) )  /  P ) ) ) )  e.  CC )
7775, 76, 63sub32d 9435 . . . . . . . . 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 ) ) ) ) ) )
7874, 77eqtrd 2467 . . . . . . . 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 ) ) ) ) ) )
7944, 78breqtrrd 4230 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  P  ||  ( ( A  x.  R )  -  1 ) )
80 oveq2 6081 . . . . . . . . 9  |-  ( R  =  0  ->  ( A  x.  R )  =  ( A  x.  0 ) )
8180oveq1d 6088 . . . . . . . 8  |-  ( R  =  0  ->  (
( A  x.  R
)  -  1 )  =  ( ( A  x.  0 )  - 
1 ) )
8281breq2d 4216 . . . . . . 7  |-  ( R  =  0  ->  ( P  ||  ( ( A  x.  R )  - 
1 )  <->  P  ||  (
( A  x.  0 )  -  1 ) ) )
8379, 82syl5ibcom 212 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  ->  P 
||  ( ( A  x.  0 )  - 
1 ) ) )
8445mul01d 9257 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( A  x.  0 )  =  0 )
8584oveq1d 6088 . . . . . . . . 9  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  0 )  -  1 )  =  ( 0  -  1 ) )
86 df-neg 9286 . . . . . . . . 9  |-  -u 1  =  ( 0  -  1 )
8785, 86syl6eqr 2485 . . . . . . . 8  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A  x.  0 )  -  1 )  =  -u 1 )
8887breq2d 4216 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A  x.  0 )  - 
1 )  <->  P  ||  -u 1
) )
89 dvdsnegb 12859 . . . . . . . 8  |-  ( ( P  e.  ZZ  /\  1  e.  ZZ )  ->  ( P  ||  1  <->  P 
||  -u 1 ) )
907, 22, 89sylancl 644 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  1  <->  P  ||  -u 1
) )
9188, 90bitr4d 248 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A  x.  0 )  - 
1 )  <->  P  ||  1
) )
9283, 91sylibd 206 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  ->  P 
||  1 ) )
932, 92mtod 170 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  -.  R  =  0 )
94 zmodfz 11260 . . . . . . . 8  |-  ( ( ( A ^ ( P  -  2 ) )  e.  ZZ  /\  P  e.  NN )  ->  ( ( A ^
( P  -  2 ) )  mod  P
)  e.  ( 0 ... ( P  - 
1 ) ) )
9532, 4, 94syl2anc 643 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  (
( A ^ ( P  -  2 ) )  mod  P )  e.  ( 0 ... ( P  -  1 ) ) )
9650, 95syl5eqel 2519 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( 0 ... ( P  -  1 ) ) )
97 nn0uz 10512 . . . . . . . 8  |-  NN0  =  ( ZZ>= `  0 )
9818, 97syl6eleq 2525 . . . . . . 7  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( P  -  1 )  e.  ( ZZ>= `  0
) )
99 elfzp12 11118 . . . . . . 7  |-  ( ( P  -  1 )  e.  ( ZZ>= `  0
)  ->  ( R  e.  ( 0 ... ( P  -  1 ) )  <->  ( R  =  0  \/  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) ) ) )
10098, 99syl 16 . . . . . 6  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  e.  ( 0 ... ( P  - 
1 ) )  <->  ( R  =  0  \/  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) ) ) )
10196, 100mpbid 202 . . . . 5  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( R  =  0  \/  R  e.  ( (
0  +  1 ) ... ( P  - 
1 ) ) ) )
102101ord 367 . . . 4  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  ( -.  R  =  0  ->  R  e.  ( ( 0  +  1 ) ... ( P  - 
1 ) ) ) )
10393, 102mpd 15 . . 3  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( ( 0  +  1 ) ... ( P  -  1 ) ) )
104 1e0p1 10402 . . . 4  |-  1  =  ( 0  +  1 )
105104oveq1i 6083 . . 3  |-  ( 1 ... ( P  - 
1 ) )  =  ( ( 0  +  1 ) ... ( P  -  1 ) )
106103, 105syl6eleqr 2526 . 2  |-  ( ( P  e.  Prime  /\  A  e.  ZZ  /\  -.  P  ||  A )  ->  R  e.  ( 1 ... ( P  -  1 ) ) )
107106, 79jca 519 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 177    \/ wo 358    /\ wa 359    /\ w3a 936    = wceq 1652    e. wcel 1725   class class class wbr 4204   ` cfv 5446  (class class class)co 6073   CCcc 8980   RRcr 8981   0cc0 8982   1c1 8983    + caddc 8985    x. cmul 8987    - cmin 9283   -ucneg 9284    / cdiv 9669   NNcn 9992   2c2 10041   NN0cn0 10213   ZZcz 10274   ZZ>=cuz 10480   RR+crp 10604   ...cfz 11035   |_cfl 11193    mod cmo 11242   ^cexp 11374    || cdivides 12844    gcd cgcd 12998   Primecprime 13071   phicphi 13145
This theorem is referenced by:  prmdiveq  13167  prmdivdiv  13168  wilthlem2  20844  wilthlem3  20845  modprminv  28181
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1555  ax-5 1566  ax-17 1626  ax-9 1666  ax-8 1687  ax-13 1727  ax-14 1729  ax-6 1744  ax-7 1749  ax-11 1761  ax-12 1950  ax-ext 2416  ax-rep 4312  ax-sep 4322  ax-nul 4330  ax-pow 4369  ax-pr 4395  ax-un 4693  ax-cnex 9038  ax-resscn 9039  ax-1cn 9040  ax-icn 9041  ax-addcl 9042  ax-addrcl 9043  ax-mulcl 9044  ax-mulrcl 9045  ax-mulcom 9046  ax-addass 9047  ax-mulass 9048  ax-distr 9049  ax-i2m1 9050  ax-1ne0 9051  ax-1rid 9052  ax-rnegex 9053  ax-rrecex 9054  ax-cnre 9055  ax-pre-lttri 9056  ax-pre-lttrn 9057  ax-pre-ltadd 9058  ax-pre-mulgt0 9059  ax-pre-sup 9060
This theorem depends on definitions:  df-bi 178  df-or 360  df-an 361  df-3or 937  df-3an 938  df-tru 1328  df-ex 1551  df-nf 1554  df-sb 1659  df-eu 2284  df-mo 2285  df-clab 2422  df-cleq 2428  df-clel 2431  df-nfc 2560  df-ne 2600  df-nel 2601  df-ral 2702  df-rex 2703  df-reu 2704  df-rmo 2705  df-rab 2706  df-v 2950  df-sbc 3154  df-csb 3244  df-dif 3315  df-un 3317  df-in 3319  df-ss 3326  df-pss 3328  df-nul 3621  df-if 3732  df-pw 3793  df-sn 3812  df-pr 3813  df-tp 3814  df-op 3815  df-uni 4008  df-int 4043  df-iun 4087  df-br 4205  df-opab 4259  df-mpt 4260  df-tr 4295  df-eprel 4486  df-id 4490  df-po 4495  df-so 4496  df-fr 4533  df-we 4535  df-ord 4576  df-on 4577  df-lim 4578  df-suc 4579  df-om 4838  df-xp 4876  df-rel 4877  df-cnv 4878  df-co 4879  df-dm 4880  df-rn 4881  df-res 4882  df-ima 4883  df-iota 5410  df-fun 5448  df-fn 5449  df-f 5450  df-f1 5451  df-fo 5452  df-f1o 5453  df-fv 5454  df-ov 6076  df-oprab 6077  df-mpt2 6078  df-1st 6341  df-2nd 6342  df-riota 6541  df-recs 6625  df-rdg 6660  df-1o 6716  df-2o 6717  df-oadd 6720  df-er 6897  df-map 7012  df-en 7102  df-dom 7103  df-sdom 7104  df-fin 7105  df-sup 7438  df-card 7818  df-cda 8040  df-pnf 9114  df-mnf 9115  df-xr 9116  df-ltxr 9117  df-le 9118  df-sub 9285  df-neg 9286  df-div 9670  df-nn 9993  df-2 10050  df-3 10051  df-n0 10214  df-z 10275  df-uz 10481  df-rp 10605  df-fz 11036  df-fzo 11128  df-fl 11194  df-mod 11243  df-seq 11316  df-exp 11375  df-hash 11611  df-cj 11896  df-re 11897  df-im 11898  df-sqr 12032  df-abs 12033  df-dvds 12845  df-gcd 12999  df-prm 13072  df-phi 13147
  Copyright terms: Public domain W3C validator