ILE Home Intuitionistic Logic Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  ILE Home  >  Th. List  >  lgslem1 Unicode version

Theorem lgslem1 13501
Description: When  a is coprime to the prime  p,  a ^ ( ( p  -  1 )  / 
2 ) is equivalent  mod  p to  1 or  -u 1, and so adding  1 makes it equivalent to  0 or  2. (Contributed by Mario Carneiro, 4-Feb-2015.)
Assertion
Ref Expression
lgslem1  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  e.  { 0 ,  2 } )

Proof of Theorem lgslem1
StepHypRef Expression
1 eldifi 3243 . . . . . . . . 9  |-  ( P  e.  ( Prime  \  {
2 } )  ->  P  e.  Prime )
213ad2ant2 1009 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  e.  Prime )
3 prmnn 12038 . . . . . . . 8  |-  ( P  e.  Prime  ->  P  e.  NN )
42, 3syl 14 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  e.  NN )
5 simp1 987 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  A  e.  ZZ )
6 prmz 12039 . . . . . . . . . 10  |-  ( P  e.  Prime  ->  P  e.  ZZ )
72, 6syl 14 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  e.  ZZ )
85, 7gcdcomd 11903 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  ( P  gcd  A
) )
9 simp3 989 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  -.  P  ||  A )
10 coprm 12072 . . . . . . . . . 10  |-  ( ( P  e.  Prime  /\  A  e.  ZZ )  ->  ( -.  P  ||  A  <->  ( P  gcd  A )  =  1 ) )
112, 5, 10syl2anc 409 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( -.  P  ||  A  <->  ( P  gcd  A )  =  1 ) )
129, 11mpbid 146 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P  gcd  A )  =  1 )
138, 12eqtrd 2198 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( A  gcd  P )  =  1 )
14 eulerth 12161 . . . . . . 7  |-  ( ( P  e.  NN  /\  A  e.  ZZ  /\  ( A  gcd  P )  =  1 )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
154, 5, 13, 14syl3anc 1228 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  mod  P )  =  ( 1  mod  P
) )
16 phiprm 12151 . . . . . . . . . 10  |-  ( P  e.  Prime  ->  ( phi `  P )  =  ( P  -  1 ) )
172, 16syl 14 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( P  -  1 ) )
18 nnm1nn0 9151 . . . . . . . . . 10  |-  ( P  e.  NN  ->  ( P  -  1 )  e.  NN0 )
194, 18syl 14 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P  -  1 )  e.  NN0 )
2017, 19eqeltrd 2242 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( phi `  P )  e. 
NN0 )
21 zexpcl 10466 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  ( phi `  P )  e.  NN0 )  -> 
( A ^ ( phi `  P ) )  e.  ZZ )
225, 20, 21syl2anc 409 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  e.  ZZ )
23 1zzd 9214 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  1  e.  ZZ )
24 moddvds 11735 . . . . . . 7  |-  ( ( 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, 22, 23, 24syl3anc 1228 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( A ^
( phi `  P
) )  mod  P
)  =  ( 1  mod  P )  <->  P  ||  (
( A ^ ( phi `  P ) )  -  1 ) ) )
2615, 25mpbid 146 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  ||  ( ( A ^
( phi `  P
) )  -  1 ) )
2719nn0cnd 9165 . . . . . . . . . . . 12  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P  -  1 )  e.  CC )
28 2cnd 8926 . . . . . . . . . . . 12  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  2  e.  CC )
29 2ap0 8946 . . . . . . . . . . . . 13  |-  2 #  0
3029a1i 9 . . . . . . . . . . . 12  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  2 #  0 )
3127, 28, 30divcanap1d 8683 . . . . . . . . . . 11  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( P  - 
1 )  /  2
)  x.  2 )  =  ( P  - 
1 ) )
3217, 31eqtr4d 2201 . . . . . . . . . 10  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( phi `  P )  =  ( ( ( P  -  1 )  / 
2 )  x.  2 ) )
3332oveq2d 5857 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( A ^ (
( ( P  - 
1 )  /  2
)  x.  2 ) ) )
345zcnd 9310 . . . . . . . . . 10  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  A  e.  CC )
35 2nn0 9127 . . . . . . . . . . 11  |-  2  e.  NN0
3635a1i 9 . . . . . . . . . 10  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  2  e.  NN0 )
37 oddprm 12187 . . . . . . . . . . . 12  |-  ( P  e.  ( Prime  \  {
2 } )  -> 
( ( P  - 
1 )  /  2
)  e.  NN )
38373ad2ant2 1009 . . . . . . . . . . 11  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( P  -  1 )  /  2 )  e.  NN )
3938nnnn0d 9163 . . . . . . . . . 10  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( P  -  1 )  /  2 )  e.  NN0 )
4034, 36, 39expmuld 10587 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( A ^ ( ( ( P  -  1 )  /  2 )  x.  2 ) )  =  ( ( A ^
( ( P  - 
1 )  /  2
) ) ^ 2 ) )
4133, 40eqtrd 2198 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( A ^ ( phi `  P ) )  =  ( ( A ^
( ( P  - 
1 )  /  2
) ) ^ 2 ) )
4241oveq1d 5856 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  -  1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) ) ^
2 )  -  1 ) )
43 sq1 10544 . . . . . . . 8  |-  ( 1 ^ 2 )  =  1
4443oveq2i 5852 . . . . . . 7  |-  ( ( ( A ^ (
( P  -  1 )  /  2 ) ) ^ 2 )  -  ( 1 ^ 2 ) )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) ) ^
2 )  -  1 )
4542, 44eqtr4di 2216 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  -  1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) ) ^
2 )  -  (
1 ^ 2 ) ) )
46 zexpcl 10466 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  ( ( P  - 
1 )  /  2
)  e.  NN0 )  ->  ( A ^ (
( P  -  1 )  /  2 ) )  e.  ZZ )
475, 39, 46syl2anc 409 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  ZZ )
4847zcnd 9310 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  CC )
49 ax-1cn 7842 . . . . . . 7  |-  1  e.  CC
50 subsq 10557 . . . . . . 7  |-  ( ( ( A ^ (
( P  -  1 )  /  2 ) )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) ) ^
2 )  -  (
1 ^ 2 ) )  =  ( ( ( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  x.  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  - 
1 ) ) )
5148, 49, 50sylancl 410 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( A ^
( ( P  - 
1 )  /  2
) ) ^ 2 )  -  ( 1 ^ 2 ) )  =  ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  x.  ( ( A ^
( ( P  - 
1 )  /  2
) )  -  1 ) ) )
5245, 51eqtrd 2198 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( A ^ ( phi `  P ) )  -  1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  x.  (
( A ^ (
( P  -  1 )  /  2 ) )  -  1 ) ) )
5326, 52breqtrd 4007 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  ||  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  x.  (
( A ^ (
( P  -  1 )  /  2 ) )  -  1 ) ) )
5447peano2zd 9312 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  e.  ZZ )
55 peano2zm 9225 . . . . . 6  |-  ( ( A ^ ( ( P  -  1 )  /  2 ) )  e.  ZZ  ->  (
( A ^ (
( P  -  1 )  /  2 ) )  -  1 )  e.  ZZ )
5647, 55syl 14 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( A ^ (
( P  -  1 )  /  2 ) )  -  1 )  e.  ZZ )
57 euclemma 12074 . . . . 5  |-  ( ( P  e.  Prime  /\  (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  e.  ZZ  /\  (
( A ^ (
( P  -  1 )  /  2 ) )  -  1 )  e.  ZZ )  -> 
( P  ||  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  x.  ( ( A ^ ( ( P  -  1 )  /  2 ) )  -  1 ) )  <-> 
( P  ||  (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  \/  P  ||  (
( A ^ (
( P  -  1 )  /  2 ) )  -  1 ) ) ) )
582, 54, 56, 57syl3anc 1228 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P  ||  ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  x.  ( ( A ^
( ( P  - 
1 )  /  2
) )  -  1 ) )  <->  ( P  ||  ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  \/  P  ||  ( ( A ^
( ( P  - 
1 )  /  2
) )  -  1 ) ) ) )
5953, 58mpbid 146 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  \/  P  ||  ( ( A ^
( ( P  - 
1 )  /  2
) )  -  1 ) ) )
60 dvdsval3 11727 . . . . 5  |-  ( ( P  e.  NN  /\  ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  e.  ZZ )  ->  ( P  ||  ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  <->  ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P )  =  0 ) )
614, 54, 60syl2anc 409 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  <->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  =  0 ) )
62 2z 9215 . . . . . . 7  |-  2  e.  ZZ
6362a1i 9 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  2  e.  ZZ )
64 moddvds 11735 . . . . . 6  |-  ( ( P  e.  NN  /\  ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  e.  ZZ  /\  2  e.  ZZ )  ->  ( ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P )  =  ( 2  mod  P )  <-> 
P  ||  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  -  2 ) ) )
654, 54, 63, 64syl3anc 1228 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
)  =  ( 2  mod  P )  <->  P  ||  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  -  2 ) ) )
66 zq 9560 . . . . . . . 8  |-  ( 2  e.  ZZ  ->  2  e.  QQ )
6762, 66mp1i 10 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  2  e.  QQ )
68 zq 9560 . . . . . . . 8  |-  ( P  e.  ZZ  ->  P  e.  QQ )
697, 68syl 14 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  e.  QQ )
70 0le2 8943 . . . . . . . 8  |-  0  <_  2
7170a1i 9 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  0  <_  2 )
72 eldifsni 3704 . . . . . . . . . 10  |-  ( P  e.  ( Prime  \  {
2 } )  ->  P  =/=  2 )
73723ad2ant2 1009 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  =/=  2 )
74 zapne 9261 . . . . . . . . . 10  |-  ( ( P  e.  ZZ  /\  2  e.  ZZ )  ->  ( P #  2  <->  P  =/=  2 ) )
757, 62, 74sylancl 410 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P #  2  <->  P  =/=  2
) )
7673, 75mpbird 166 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P #  2 )
77 2re 8923 . . . . . . . . . 10  |-  2  e.  RR
7877a1i 9 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  2  e.  RR )
794nnred 8866 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  e.  RR )
80 prmuz2 12059 . . . . . . . . . . 11  |-  ( P  e.  Prime  ->  P  e.  ( ZZ>= `  2 )
)
812, 80syl 14 . . . . . . . . . 10  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  P  e.  ( ZZ>= `  2 )
)
82 eluzle 9474 . . . . . . . . . 10  |-  ( P  e.  ( ZZ>= `  2
)  ->  2  <_  P )
8381, 82syl 14 . . . . . . . . 9  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  2  <_  P )
8478, 79, 83leltapd 8533 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
2  <  P  <->  P #  2
) )
8576, 84mpbird 166 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  2  <  P )
86 modqid 10280 . . . . . . 7  |-  ( ( ( 2  e.  QQ  /\  P  e.  QQ )  /\  ( 0  <_ 
2  /\  2  <  P ) )  ->  (
2  mod  P )  =  2 )
8767, 69, 71, 85, 86syl22anc 1229 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
2  mod  P )  =  2 )
8887eqeq2d 2177 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
)  =  ( 2  mod  P )  <->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  =  2 ) )
89 df-2 8912 . . . . . . . 8  |-  2  =  ( 1  +  1 )
9089oveq2i 5852 . . . . . . 7  |-  ( ( ( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  -  2 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  -  (
1  +  1 ) )
9149a1i 9 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  1  e.  CC )
9248, 91, 91pnpcan2d 8243 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  -  ( 1  +  1 ) )  =  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  - 
1 ) )
9390, 92syl5eq 2210 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  -  2 )  =  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  - 
1 ) )
9493breq2d 3993 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P  ||  ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  - 
2 )  <->  P  ||  (
( A ^ (
( P  -  1 )  /  2 ) )  -  1 ) ) )
9565, 88, 943bitr3rd 218 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  ( P  ||  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  - 
1 )  <->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  =  2 ) )
9661, 95orbi12d 783 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( P  ||  (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  \/  P  ||  (
( A ^ (
( P  -  1 )  /  2 ) )  -  1 ) )  <->  ( ( ( ( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  =  0  \/  ( ( ( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  =  2 ) ) )
9759, 96mpbid 146 . 2  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
)  =  0  \/  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
)  =  2 ) )
9854, 4zmodcld 10276 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  e.  NN0 )
99 elprg 3595 . . 3  |-  ( ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  e.  NN0  ->  ( ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  e.  { 0 ,  2 }  <->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  =  0  \/  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  =  2 ) ) )
10098, 99syl 14 . 2  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
)  e.  { 0 ,  2 }  <->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  =  0  \/  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  =  2 ) ) )
10197, 100mpbird 166 1  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } )  /\  -.  P  ||  A )  ->  (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  e.  { 0 ,  2 } )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    <-> wb 104    \/ wo 698    /\ w3a 968    = wceq 1343    e. wcel 2136    =/= wne 2335    \ cdif 3112   {csn 3575   {cpr 3576   class class class wbr 3981   ` cfv 5187  (class class class)co 5841   CCcc 7747   RRcr 7748   0cc0 7749   1c1 7750    + caddc 7752    x. cmul 7754    < clt 7929    <_ cle 7930    - cmin 8065   # cap 8475    / cdiv 8564   NNcn 8853   2c2 8904   NN0cn0 9110   ZZcz 9187   ZZ>=cuz 9462   QQcq 9553    mod cmo 10253   ^cexp 10450    || cdvds 11723    gcd cgcd 11871   Primecprime 12035   phicphi 12137
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-ia1 105  ax-ia2 106  ax-ia3 107  ax-in1 604  ax-in2 605  ax-io 699  ax-5 1435  ax-7 1436  ax-gen 1437  ax-ie1 1481  ax-ie2 1482  ax-8 1492  ax-10 1493  ax-11 1494  ax-i12 1495  ax-bndl 1497  ax-4 1498  ax-17 1514  ax-i9 1518  ax-ial 1522  ax-i5r 1523  ax-13 2138  ax-14 2139  ax-ext 2147  ax-coll 4096  ax-sep 4099  ax-nul 4107  ax-pow 4152  ax-pr 4186  ax-un 4410  ax-setind 4513  ax-iinf 4564  ax-cnex 7840  ax-resscn 7841  ax-1cn 7842  ax-1re 7843  ax-icn 7844  ax-addcl 7845  ax-addrcl 7846  ax-mulcl 7847  ax-mulrcl 7848  ax-addcom 7849  ax-mulcom 7850  ax-addass 7851  ax-mulass 7852  ax-distr 7853  ax-i2m1 7854  ax-0lt1 7855  ax-1rid 7856  ax-0id 7857  ax-rnegex 7858  ax-precex 7859  ax-cnre 7860  ax-pre-ltirr 7861  ax-pre-ltwlin 7862  ax-pre-lttrn 7863  ax-pre-apti 7864  ax-pre-ltadd 7865  ax-pre-mulgt0 7866  ax-pre-mulext 7867  ax-arch 7868  ax-caucvg 7869
This theorem depends on definitions:  df-bi 116  df-stab 821  df-dc 825  df-3or 969  df-3an 970  df-tru 1346  df-fal 1349  df-xor 1366  df-nf 1449  df-sb 1751  df-eu 2017  df-mo 2018  df-clab 2152  df-cleq 2158  df-clel 2161  df-nfc 2296  df-ne 2336  df-nel 2431  df-ral 2448  df-rex 2449  df-reu 2450  df-rmo 2451  df-rab 2452  df-v 2727  df-sbc 2951  df-csb 3045  df-dif 3117  df-un 3119  df-in 3121  df-ss 3128  df-nul 3409  df-if 3520  df-pw 3560  df-sn 3581  df-pr 3582  df-op 3584  df-uni 3789  df-int 3824  df-iun 3867  df-br 3982  df-opab 4043  df-mpt 4044  df-tr 4080  df-id 4270  df-po 4273  df-iso 4274  df-iord 4343  df-on 4345  df-ilim 4346  df-suc 4348  df-iom 4567  df-xp 4609  df-rel 4610  df-cnv 4611  df-co 4612  df-dm 4613  df-rn 4614  df-res 4615  df-ima 4616  df-iota 5152  df-fun 5189  df-fn 5190  df-f 5191  df-f1 5192  df-fo 5193  df-f1o 5194  df-fv 5195  df-isom 5196  df-riota 5797  df-ov 5844  df-oprab 5845  df-mpo 5846  df-1st 6105  df-2nd 6106  df-recs 6269  df-irdg 6334  df-frec 6355  df-1o 6380  df-2o 6381  df-oadd 6384  df-er 6497  df-en 6703  df-dom 6704  df-fin 6705  df-sup 6945  df-pnf 7931  df-mnf 7932  df-xr 7933  df-ltxr 7934  df-le 7935  df-sub 8067  df-neg 8068  df-reap 8469  df-ap 8476  df-div 8565  df-inn 8854  df-2 8912  df-3 8913  df-4 8914  df-n0 9111  df-z 9188  df-uz 9463  df-q 9554  df-rp 9586  df-fz 9941  df-fzo 10074  df-fl 10201  df-mod 10254  df-seqfrec 10377  df-exp 10451  df-ihash 10685  df-cj 10780  df-re 10781  df-im 10782  df-rsqrt 10936  df-abs 10937  df-clim 11216  df-proddc 11488  df-dvds 11724  df-gcd 11872  df-prm 12036  df-phi 12139
This theorem is referenced by:  lgslem4  13504
  Copyright terms: Public domain W3C validator