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

Theorem lgsvalmod 21100
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 3470 . . . . . . . 8  |-  ( P  e.  ( Prime  \  {
2 } )  ->  P  e.  Prime )
21adantl 454 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  Prime )
3 prmz 13084 . . . . . . 7  |-  ( P  e.  Prime  ->  P  e.  ZZ )
42, 3syl 16 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  ZZ )
5 lgscl 21095 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ZZ )  ->  ( A  / L P )  e.  ZZ )
64, 5syldan 458 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  / L P )  e.  ZZ )
76zred 10376 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  / L P )  e.  RR )
8 peano2re 9240 . . . 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 13190 . . . . . . . 8  |-  ( P  e.  ( Prime  \  {
2 } )  -> 
( ( P  - 
1 )  /  2
)  e.  NN )
1110adantl 454 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( P  -  1 )  /  2 )  e.  NN )
1211nnnn0d 10275 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( P  -  1 )  /  2 )  e. 
NN0 )
13 zexpcl 11397 . . . . . 6  |-  ( ( A  e.  ZZ  /\  ( ( P  - 
1 )  /  2
)  e.  NN0 )  ->  ( A ^ (
( P  -  1 )  /  2 ) )  e.  ZZ )
1412, 13syldan 458 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  ZZ )
1514zred 10376 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  RR )
16 peano2re 9240 . . . 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 1re 9091 . . . . 5  |-  1  e.  RR
1918renegcli 9363 . . . 4  |-  -u 1  e.  RR
2019a1i 11 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  -u 1  e.  RR )
21 prmnn 13083 . . . . 5  |-  ( P  e.  Prime  ->  P  e.  NN )
222, 21syl 16 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  NN )
2322nnrpd 10648 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  P  e.  RR+ )
24 lgsval3 21099 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  / L P )  =  ( ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P )  -  1 ) )
2524eqcomd 2442 . . . . . 6  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  -  1 )  =  ( A  / L P ) )
2617, 23modcld 11255 . . . . . . . 8  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  e.  RR )
2726recnd 9115 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  e.  CC )
28 ax-1cn 9049 . . . . . . . 8  |-  1  e.  CC
2928a1i 11 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  1  e.  CC )
307recnd 9115 . . . . . . 7  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A  / L P )  e.  CC )
3127, 29, 30subadd2d 9431 . . . . . 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
) ) )
3225, 31mpbid 203 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  / L P )  +  1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
) )
3332oveq1d 6097 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  / L P )  +  1 )  mod  P )  =  ( ( ( ( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  mod  P )  mod 
P ) )
34 modabs2 11276 . . . . 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 ) )
3517, 23, 34syl2anc 644 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  mod  P )  mod  P )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  mod  P
) )
3633, 35eqtrd 2469 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  / L P )  +  1 )  mod  P )  =  ( ( ( A ^ ( ( P  -  1 )  /  2 ) )  +  1 )  mod 
P ) )
37 modadd1 11279 . . 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 ) )
389, 17, 20, 23, 36, 37syl221anc 1196 . 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 ) )
399recnd 9115 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  / L P )  +  1 )  e.  CC )
40 negsub 9350 . . . . 5  |-  ( ( ( ( A  / L P )  +  1 )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A  / L P )  +  1 )  + 
-u 1 )  =  ( ( ( A  / L P )  +  1 )  - 
1 ) )
4139, 28, 40sylancl 645 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  / L P )  +  1 )  +  -u 1
)  =  ( ( ( A  / L P )  +  1 )  -  1 ) )
42 pncan 9312 . . . . 5  |-  ( ( ( A  / L P )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A  / L P
)  +  1 )  -  1 )  =  ( A  / L P ) )
4330, 28, 42sylancl 645 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  / L P )  +  1 )  -  1 )  =  ( A  / L P ) )
4441, 43eqtrd 2469 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A  / L P )  +  1 )  +  -u 1
)  =  ( A  / L P ) )
4544oveq1d 6097 . 2  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A  / L P )  +  1 )  +  -u 1
)  mod  P )  =  ( ( A  / L P )  mod  P ) )
4617recnd 9115 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  e.  CC )
47 negsub 9350 . . . . 5  |-  ( ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  +  -u
1 )  =  ( ( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  -  1 ) )
4846, 28, 47sylancl 645 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  +  -u 1 )  =  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  -  1 ) )
4915recnd 9115 . . . . 5  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( A ^ ( ( P  -  1 )  / 
2 ) )  e.  CC )
50 pncan 9312 . . . . 5  |-  ( ( ( A ^ (
( P  -  1 )  /  2 ) )  e.  CC  /\  1  e.  CC )  ->  ( ( ( A ^ ( ( P  -  1 )  / 
2 ) )  +  1 )  -  1 )  =  ( A ^ ( ( P  -  1 )  / 
2 ) ) )
5149, 28, 50sylancl 645 . . . 4  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  -  1 )  =  ( A ^ (
( P  -  1 )  /  2 ) ) )
5248, 51eqtrd 2469 . . 3  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( A ^ (
( P  -  1 )  /  2 ) )  +  1 )  +  -u 1 )  =  ( A ^ (
( P  -  1 )  /  2 ) ) )
5352oveq1d 6097 . 2  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( (
( ( A ^
( ( P  - 
1 )  /  2
) )  +  1 )  +  -u 1
)  mod  P )  =  ( ( A ^ ( ( P  -  1 )  / 
2 ) )  mod 
P ) )
5438, 45, 533eqtr3d 2477 1  |-  ( ( A  e.  ZZ  /\  P  e.  ( Prime  \  { 2 } ) )  ->  ( ( A  / L P )  mod  P )  =  ( ( A ^
( ( P  - 
1 )  /  2
) )  mod  P
) )
Colors of variables: wff set class
Syntax hints:    -> wi 4    /\ wa 360    = wceq 1653    e. wcel 1726    \ cdif 3318   {csn 3815  (class class class)co 6082   CCcc 8989   RRcr 8990   1c1 8992    + caddc 8994    - cmin 9292   -ucneg 9293    / cdiv 9678   NNcn 10001   2c2 10050   NN0cn0 10222   ZZcz 10283   RR+crp 10613    mod cmo 11251   ^cexp 11383   Primecprime 13080    / Lclgs 21079
This theorem is referenced by:  lgsdirprm  21114  lgsne0  21118  lgsqrlem3  21128
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1556  ax-5 1567  ax-17 1627  ax-9 1667  ax-8 1688  ax-13 1728  ax-14 1730  ax-6 1745  ax-7 1750  ax-11 1762  ax-12 1951  ax-ext 2418  ax-rep 4321  ax-sep 4331  ax-nul 4339  ax-pow 4378  ax-pr 4404  ax-un 4702  ax-cnex 9047  ax-resscn 9048  ax-1cn 9049  ax-icn 9050  ax-addcl 9051  ax-addrcl 9052  ax-mulcl 9053  ax-mulrcl 9054  ax-mulcom 9055  ax-addass 9056  ax-mulass 9057  ax-distr 9058  ax-i2m1 9059  ax-1ne0 9060  ax-1rid 9061  ax-rnegex 9062  ax-rrecex 9063  ax-cnre 9064  ax-pre-lttri 9065  ax-pre-lttrn 9066  ax-pre-ltadd 9067  ax-pre-mulgt0 9068  ax-pre-sup 9069
This theorem depends on definitions:  df-bi 179  df-or 361  df-an 362  df-3or 938  df-3an 939  df-tru 1329  df-ex 1552  df-nf 1555  df-sb 1660  df-eu 2286  df-mo 2287  df-clab 2424  df-cleq 2430  df-clel 2433  df-nfc 2562  df-ne 2602  df-nel 2603  df-ral 2711  df-rex 2712  df-reu 2713  df-rmo 2714  df-rab 2715  df-v 2959  df-sbc 3163  df-csb 3253  df-dif 3324  df-un 3326  df-in 3328  df-ss 3335  df-pss 3337  df-nul 3630  df-if 3741  df-pw 3802  df-sn 3821  df-pr 3822  df-tp 3823  df-op 3824  df-uni 4017  df-int 4052  df-iun 4096  df-br 4214  df-opab 4268  df-mpt 4269  df-tr 4304  df-eprel 4495  df-id 4499  df-po 4504  df-so 4505  df-fr 4542  df-we 4544  df-ord 4585  df-on 4586  df-lim 4587  df-suc 4588  df-om 4847  df-xp 4885  df-rel 4886  df-cnv 4887  df-co 4888  df-dm 4889  df-rn 4890  df-res 4891  df-ima 4892  df-iota 5419  df-fun 5457  df-fn 5458  df-f 5459  df-f1 5460  df-fo 5461  df-f1o 5462  df-fv 5463  df-ov 6085  df-oprab 6086  df-mpt2 6087  df-1st 6350  df-2nd 6351  df-riota 6550  df-recs 6634  df-rdg 6669  df-1o 6725  df-2o 6726  df-oadd 6729  df-er 6906  df-map 7021  df-en 7111  df-dom 7112  df-sdom 7113  df-fin 7114  df-sup 7447  df-card 7827  df-cda 8049  df-pnf 9123  df-mnf 9124  df-xr 9125  df-ltxr 9126  df-le 9127  df-sub 9294  df-neg 9295  df-div 9679  df-nn 10002  df-2 10059  df-3 10060  df-n0 10223  df-z 10284  df-uz 10490  df-q 10576  df-rp 10614  df-fz 11045  df-fzo 11137  df-fl 11203  df-mod 11252  df-seq 11325  df-exp 11384  df-hash 11620  df-cj 11905  df-re 11906  df-im 11907  df-sqr 12041  df-abs 12042  df-dvds 12854  df-gcd 13008  df-prm 13081  df-phi 13156  df-pc 13212  df-lgs 21080
  Copyright terms: Public domain W3C validator