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

Theorem lgsvalmod 23707
Description: The Legendre symbol is equivalent to  a ^ (
( p  -  1 )  /  2 ),  mod  p. (Contributed by Mario Carneiro, 4-Feb-2015.)
Assertion
Ref Expression
lgsvalmod  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  /L P )  mod  P )  =  ( ( A ^
( ( P  - 
1 )  /  2
) )  mod  P
) )

Proof of Theorem lgsvalmod
StepHypRef Expression
1 eldifi 3540 . . . . . . . 8  |-  ( P  e.  ( Prime  \  {
2 } )  ->  P  e.  Prime )
21adantl 464 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  Prime )
3 prmz 14223 . . . . . . 7  |-  ( P  e.  Prime  ->  P  e.  ZZ )
42, 3syl 16 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  ZZ )
5 lgscl 23702 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ZZ )  ->  ( A  /L
P )  e.  ZZ )
64, 5syldan 468 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  /L P )  e.  ZZ )
76zred 10884 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  /L P )  e.  RR )
8 peano2re 9664 . . . 4  |-  ( ( A  /L P )  e.  RR  ->  ( ( A  /L
P )  +  1 )  e.  RR )
97, 8syl 16 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  /L P )  +  1 )  e.  RR )
10 oddprm 14341 . . . . . . . 8  |-  ( P  e.  ( Prime  \  {
2 } )  -> 
( ( P  - 
1 )  /  2
)  e.  NN )
1110adantl 464 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( P  -  1 )  /  2 )  e.  NN )
1211nnnn0d 10769 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( P  -  1 )  /  2 )  e. 
NN0 )
13 zexpcl 12084 . . . . . 6  |-  ( ( A  e.  ZZ  /\  ( ( P  - 
1 )  /  2
)  e.  NN0 )  ->  ( A ^ (
( P  -  1 )  /  2 ) )  e.  ZZ )
1412, 13syldan 468 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  ZZ )
1514zred 10884 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  RR )
16 peano2re 9664 . . . 4  |-  ( ( A ^ ( ( P  -  1 )  /  2 ) )  e.  RR  ->  (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  e.  RR )
1715, 16syl 16 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  e.  RR )
18 neg1rr 10557 . . . 4  |-  -u 1  e.  RR
1918a1i 11 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  -u 1  e.  RR )
20 prmnn 14222 . . . . 5  |-  ( P  e.  Prime  ->  P  e.  NN )
212, 20syl 16 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  NN )
2221nnrpd 11175 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  RR+ )
23 lgsval3 23706 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  /L P )  =  ( ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P )  -  1 ) )
2423eqcomd 2390 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  -  1 )  =  ( A  /L
P ) )
2517, 22modcld 11902 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  e.  RR )
2625recnd 9533 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  e.  CC )
27 ax-1cn 9461 . . . . . . . 8  |-  1  e.  CC
2827a1i 11 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  1  e.  CC )
297recnd 9533 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  /L P )  e.  CC )
3026, 28, 29subadd2d 9863 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
)  -  1 )  =  ( A  /L P )  <->  ( ( A  /L P )  +  1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
) ) )
3124, 30mpbid 210 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  /L P )  +  1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
) )
3231oveq1d 6211 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  mod  P )  =  ( ( ( ( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  mod 
P ) )
33 modabs2 11931 . . . . 5  |-  ( ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  e.  RR  /\  P  e.  RR+ )  -> 
( ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P )  mod  P
)  =  ( ( ( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P ) )
3417, 22, 33syl2anc 659 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  mod  P )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
) )
3532, 34eqtrd 2423 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  mod  P )  =  ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P ) )
36 modadd1 11934 . . 3  |-  ( ( ( ( ( A  /L P )  +  1 )  e.  RR  /\  ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  e.  RR )  /\  ( -u 1  e.  RR  /\  P  e.  RR+ )  /\  ( ( ( A  /L P )  +  1 )  mod 
P )  =  ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P ) )  ->  ( (
( ( A  /L P )  +  1 )  +  -u
1 )  mod  P
)  =  ( ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  +  -u 1
)  mod  P )
)
379, 17, 19, 22, 35, 36syl221anc 1237 . 2  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A  /L P )  +  1 )  +  -u
1 )  mod  P
)  =  ( ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  +  -u 1
)  mod  P )
)
389recnd 9533 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  /L P )  +  1 )  e.  CC )
39 negsub 9780 . . . . 5  |-  ( ( ( ( A  /L P )  +  1 )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A  /L P )  +  1 )  +  -u 1 )  =  ( ( ( A  /L P )  +  1 )  - 
1 ) )
4038, 27, 39sylancl 660 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  +  -u 1
)  =  ( ( ( A  /L
P )  +  1 )  -  1 ) )
41 pncan 9739 . . . . 5  |-  ( ( ( A  /L
P )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A  /L P )  +  1 )  -  1 )  =  ( A  /L
P ) )
4229, 27, 41sylancl 660 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  -  1 )  =  ( A  /L P ) )
4340, 42eqtrd 2423 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  +  -u 1
)  =  ( A  /L P ) )
4443oveq1d 6211 . 2  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A  /L P )  +  1 )  +  -u
1 )  mod  P
)  =  ( ( A  /L P )  mod  P ) )
4517recnd 9533 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  e.  CC )
46 negsub 9780 . . . . 5  |-  ( ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  +  -u
1 )  =  ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  -  1 ) )
4745, 27, 46sylancl 660 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  +  -u 1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  -  1 ) )
4815recnd 9533 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  CC )
49 pncan 9739 . . . . 5  |-  ( ( ( A ^ (
( P  -  1 )  /  2 ) )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  -  1 )  =  ( A ^ ( ( P  -  1 )  / 
2 ) ) )
5048, 27, 49sylancl 660 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  -  1 )  =  ( A ^ (
( P  -  1 )  /  2 ) ) )
5147, 50eqtrd 2423 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  +  -u 1 )  =  ( A ^ (
( P  -  1 )  /  2 ) ) )
5251oveq1d 6211 . 2  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  +  -u 1
)  mod  P )  =  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  mod 
P ) )
5337, 44, 523eqtr3d 2431 1  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  /L P )  mod  P )  =  ( ( A ^
( ( P  - 
1 )  /  2
) )  mod  P
) )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 367    = wceq 1399    e. wcel 1826    \ cdif 3386   {csn 3944  (class class class)co 6196   CCcc 9401   RRcr 9402   1c1 9404    + caddc 9406    - cmin 9718   -ucneg 9719    / cdiv 10123   NNcn 10452   2c2 10502   NN0cn0 10712   ZZcz 10781   RR+crp 11139    mod cmo 11896   ^cexp 12069   Primecprime 14219    /Lclgs 23686
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1626  ax-4 1639  ax-5 1712  ax-6 1755  ax-7 1798  ax-8 1828  ax-9 1830  ax-10 1845  ax-11 1850  ax-12 1862  ax-13 2006  ax-ext 2360  ax-rep 4478  ax-sep 4488  ax-nul 4496  ax-pow 4543  ax-pr 4601  ax-un 6491  ax-cnex 9459  ax-resscn 9460  ax-1cn 9461  ax-icn 9462  ax-addcl 9463  ax-addrcl 9464  ax-mulcl 9465  ax-mulrcl 9466  ax-mulcom 9467  ax-addass 9468  ax-mulass 9469  ax-distr 9470  ax-i2m1 9471  ax-1ne0 9472  ax-1rid 9473  ax-rnegex 9474  ax-rrecex 9475  ax-cnre 9476  ax-pre-lttri 9477  ax-pre-lttrn 9478  ax-pre-ltadd 9479  ax-pre-mulgt0 9480  ax-pre-sup 9481
This theorem depends on definitions:  df-bi 185  df-or 368  df-an 369  df-3or 972  df-3an 973  df-tru 1402  df-ex 1621  df-nf 1625  df-sb 1748  df-eu 2222  df-mo 2223  df-clab 2368  df-cleq 2374  df-clel 2377  df-nfc 2532  df-ne 2579  df-nel 2580  df-ral 2737  df-rex 2738  df-reu 2739  df-rmo 2740  df-rab 2741  df-v 3036  df-sbc 3253  df-csb 3349  df-dif 3392  df-un 3394  df-in 3396  df-ss 3403  df-pss 3405  df-nul 3712  df-if 3858  df-pw 3929  df-sn 3945  df-pr 3947  df-tp 3949  df-op 3951  df-uni 4164  df-int 4200  df-iun 4245  df-br 4368  df-opab 4426  df-mpt 4427  df-tr 4461  df-eprel 4705  df-id 4709  df-po 4714  df-so 4715  df-fr 4752  df-we 4754  df-ord 4795  df-on 4796  df-lim 4797  df-suc 4798  df-xp 4919  df-rel 4920  df-cnv 4921  df-co 4922  df-dm 4923  df-rn 4924  df-res 4925  df-ima 4926  df-iota 5460  df-fun 5498  df-fn 5499  df-f 5500  df-f1 5501  df-fo 5502  df-f1o 5503  df-fv 5504  df-riota 6158  df-ov 6199  df-oprab 6200  df-mpt2 6201  df-om 6600  df-1st 6699  df-2nd 6700  df-recs 6960  df-rdg 6994  df-1o 7048  df-2o 7049  df-oadd 7052  df-er 7229  df-map 7340  df-en 7436  df-dom 7437  df-sdom 7438  df-fin 7439  df-sup 7816  df-card 8233  df-cda 8461  df-pnf 9541  df-mnf 9542  df-xr 9543  df-ltxr 9544  df-le 9545  df-sub 9720  df-neg 9721  df-div 10124  df-nn 10453  df-2 10511  df-3 10512  df-n0 10713  df-z 10782  df-uz 11002  df-q 11102  df-rp 11140  df-fz 11594  df-fzo 11718  df-fl 11828  df-mod 11897  df-seq 12011  df-exp 12070  df-hash 12308  df-cj 12934  df-re 12935  df-im 12936  df-sqrt 13070  df-abs 13071  df-dvds 13989  df-gcd 14147  df-prm 14220  df-phi 14298  df-pc 14363  df-lgs 23687
This theorem is referenced by:  lgsdirprm  23721  lgsne0  23725  lgsqrlem3  23735
  Copyright terms: Public domain W3C validator