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

Theorem lgsvalmod 22770
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 3576 . . . . . . . 8  |-  ( P  e.  ( Prime  \  {
2 } )  ->  P  e.  Prime )
21adantl 466 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  Prime )
3 prmz 13869 . . . . . . 7  |-  ( P  e.  Prime  ->  P  e.  ZZ )
42, 3syl 16 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  ZZ )
5 lgscl 22765 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ZZ )  ->  ( A  /L
P )  e.  ZZ )
64, 5syldan 470 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  /L P )  e.  ZZ )
76zred 10848 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  /L P )  e.  RR )
8 peano2re 9643 . . . 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 13984 . . . . . . . 8  |-  ( P  e.  ( Prime  \  {
2 } )  -> 
( ( P  - 
1 )  /  2
)  e.  NN )
1110adantl 466 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( P  -  1 )  /  2 )  e.  NN )
1211nnnn0d 10737 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( P  -  1 )  /  2 )  e. 
NN0 )
13 zexpcl 11981 . . . . . 6  |-  ( ( A  e.  ZZ  /\  ( ( P  - 
1 )  /  2
)  e.  NN0 )  ->  ( A ^ (
( P  -  1 )  /  2 ) )  e.  ZZ )
1412, 13syldan 470 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  ZZ )
1514zred 10848 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  RR )
16 peano2re 9643 . . . 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 10527 . . . 4  |-  -u 1  e.  RR
1918a1i 11 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  -u 1  e.  RR )
20 prmnn 13868 . . . . 5  |-  ( P  e.  Prime  ->  P  e.  NN )
212, 20syl 16 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  NN )
2221nnrpd 11127 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  RR+ )
23 lgsval3 22769 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  /L P )  =  ( ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P )  -  1 ) )
2423eqcomd 2459 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  -  1 )  =  ( A  /L
P ) )
2517, 22modcld 11815 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  e.  RR )
2625recnd 9513 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  e.  CC )
27 ax-1cn 9441 . . . . . . . 8  |-  1  e.  CC
2827a1i 11 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  1  e.  CC )
297recnd 9513 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  /L P )  e.  CC )
3026, 28, 29subadd2d 9839 . . . . . 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 6205 . . . 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 11843 . . . . 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 661 . . . 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 2492 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  mod  P )  =  ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P ) )
36 modadd1 11846 . . 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 1230 . 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 9513 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  /L P )  +  1 )  e.  CC )
39 negsub 9758 . . . . 5  |-  ( ( ( ( A  /L P )  +  1 )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A  /L P )  +  1 )  +  -u 1 )  =  ( ( ( A  /L P )  +  1 )  - 
1 ) )
4038, 27, 39sylancl 662 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  +  -u 1
)  =  ( ( ( A  /L
P )  +  1 )  -  1 ) )
41 pncan 9717 . . . . 5  |-  ( ( ( A  /L
P )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A  /L P )  +  1 )  -  1 )  =  ( A  /L
P ) )
4229, 27, 41sylancl 662 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  -  1 )  =  ( A  /L P ) )
4340, 42eqtrd 2492 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  /L
P )  +  1 )  +  -u 1
)  =  ( A  /L P ) )
4443oveq1d 6205 . 2  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A  /L P )  +  1 )  +  -u
1 )  mod  P
)  =  ( ( A  /L P )  mod  P ) )
4517recnd 9513 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  e.  CC )
46 negsub 9758 . . . . 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 662 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  +  -u 1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  -  1 ) )
4815recnd 9513 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  CC )
49 pncan 9717 . . . . 5  |-  ( ( ( A ^ (
( P  -  1 )  /  2 ) )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  -  1 )  =  ( A ^ ( ( P  -  1 )  / 
2 ) ) )
5048, 27, 49sylancl 662 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  -  1 )  =  ( A ^ (
( P  -  1 )  /  2 ) ) )
5147, 50eqtrd 2492 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  +  -u 1 )  =  ( A ^ (
( P  -  1 )  /  2 ) ) )
5251oveq1d 6205 . 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 2500 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 369    = wceq 1370    e. wcel 1758    \ cdif 3423   {csn 3975  (class class class)co 6190   CCcc 9381   RRcr 9382   1c1 9384    + caddc 9386    - cmin 9696   -ucneg 9697    / cdiv 10094   NNcn 10423   2c2 10472   NN0cn0 10680   ZZcz 10747   RR+crp 11092    mod cmo 11809   ^cexp 11966   Primecprime 13865    /Lclgs 22749
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1592  ax-4 1603  ax-5 1671  ax-6 1710  ax-7 1730  ax-8 1760  ax-9 1762  ax-10 1777  ax-11 1782  ax-12 1794  ax-13 1952  ax-ext 2430  ax-rep 4501  ax-sep 4511  ax-nul 4519  ax-pow 4568  ax-pr 4629  ax-un 6472  ax-cnex 9439  ax-resscn 9440  ax-1cn 9441  ax-icn 9442  ax-addcl 9443  ax-addrcl 9444  ax-mulcl 9445  ax-mulrcl 9446  ax-mulcom 9447  ax-addass 9448  ax-mulass 9449  ax-distr 9450  ax-i2m1 9451  ax-1ne0 9452  ax-1rid 9453  ax-rnegex 9454  ax-rrecex 9455  ax-cnre 9456  ax-pre-lttri 9457  ax-pre-lttrn 9458  ax-pre-ltadd 9459  ax-pre-mulgt0 9460  ax-pre-sup 9461
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 966  df-3an 967  df-tru 1373  df-ex 1588  df-nf 1591  df-sb 1703  df-eu 2264  df-mo 2265  df-clab 2437  df-cleq 2443  df-clel 2446  df-nfc 2601  df-ne 2646  df-nel 2647  df-ral 2800  df-rex 2801  df-reu 2802  df-rmo 2803  df-rab 2804  df-v 3070  df-sbc 3285  df-csb 3387  df-dif 3429  df-un 3431  df-in 3433  df-ss 3440  df-pss 3442  df-nul 3736  df-if 3890  df-pw 3960  df-sn 3976  df-pr 3978  df-tp 3980  df-op 3982  df-uni 4190  df-int 4227  df-iun 4271  df-br 4391  df-opab 4449  df-mpt 4450  df-tr 4484  df-eprel 4730  df-id 4734  df-po 4739  df-so 4740  df-fr 4777  df-we 4779  df-ord 4820  df-on 4821  df-lim 4822  df-suc 4823  df-xp 4944  df-rel 4945  df-cnv 4946  df-co 4947  df-dm 4948  df-rn 4949  df-res 4950  df-ima 4951  df-iota 5479  df-fun 5518  df-fn 5519  df-f 5520  df-f1 5521  df-fo 5522  df-f1o 5523  df-fv 5524  df-riota 6151  df-ov 6193  df-oprab 6194  df-mpt2 6195  df-om 6577  df-1st 6677  df-2nd 6678  df-recs 6932  df-rdg 6966  df-1o 7020  df-2o 7021  df-oadd 7024  df-er 7201  df-map 7316  df-en 7411  df-dom 7412  df-sdom 7413  df-fin 7414  df-sup 7792  df-card 8210  df-cda 8438  df-pnf 9521  df-mnf 9522  df-xr 9523  df-ltxr 9524  df-le 9525  df-sub 9698  df-neg 9699  df-div 10095  df-nn 10424  df-2 10481  df-3 10482  df-n0 10681  df-z 10748  df-uz 10963  df-q 11055  df-rp 11093  df-fz 11539  df-fzo 11650  df-fl 11743  df-mod 11810  df-seq 11908  df-exp 11967  df-hash 12205  df-cj 12690  df-re 12691  df-im 12692  df-sqr 12826  df-abs 12827  df-dvds 13638  df-gcd 13793  df-prm 13866  df-phi 13943  df-pc 14006  df-lgs 22750
This theorem is referenced by:  lgsdirprm  22784  lgsne0  22788  lgsqrlem3  22798
  Copyright terms: Public domain W3C validator