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

Theorem lgsfval 20945
Description: Value of the function  F which defines the Legendre symbol at the primes. (Contributed by Mario Carneiro, 4-Feb-2015.)
Hypothesis
Ref Expression
lgsval.1  |-  F  =  ( n  e.  NN  |->  if ( n  e.  Prime ,  ( if ( n  =  2 ,  if ( 2  ||  A ,  0 ,  if ( ( A  mod  8 )  e.  {
1 ,  7 } ,  1 ,  -u
1 ) ) ,  ( ( ( ( A ^ ( ( n  -  1 )  /  2 ) )  +  1 )  mod  n )  -  1 ) ) ^ (
n  pCnt  N )
) ,  1 ) )
Assertion
Ref Expression
lgsfval  |-  ( M  e.  NN  ->  ( F `  M )  =  if ( M  e. 
Prime ,  ( if ( M  =  2 ,  if ( 2  ||  A ,  0 ,  if ( ( A  mod  8 )  e.  {
1 ,  7 } ,  1 ,  -u
1 ) ) ,  ( ( ( ( A ^ ( ( M  -  1 )  /  2 ) )  +  1 )  mod 
M )  -  1 ) ) ^ ( M  pCnt  N ) ) ,  1 ) )
Distinct variable groups:    A, n    n, M    n, N
Allowed substitution hint:    F( n)

Proof of Theorem lgsfval
StepHypRef Expression
1 eleq1 2440 . . 3  |-  ( n  =  M  ->  (
n  e.  Prime  <->  M  e.  Prime ) )
2 eqeq1 2386 . . . . 5  |-  ( n  =  M  ->  (
n  =  2  <->  M  =  2 ) )
3 oveq1 6020 . . . . . . . . . 10  |-  ( n  =  M  ->  (
n  -  1 )  =  ( M  - 
1 ) )
43oveq1d 6028 . . . . . . . . 9  |-  ( n  =  M  ->  (
( n  -  1 )  /  2 )  =  ( ( M  -  1 )  / 
2 ) )
54oveq2d 6029 . . . . . . . 8  |-  ( n  =  M  ->  ( A ^ ( ( n  -  1 )  / 
2 ) )  =  ( A ^ (
( M  -  1 )  /  2 ) ) )
65oveq1d 6028 . . . . . . 7  |-  ( n  =  M  ->  (
( A ^ (
( n  -  1 )  /  2 ) )  +  1 )  =  ( ( A ^ ( ( M  -  1 )  / 
2 ) )  +  1 ) )
7 id 20 . . . . . . 7  |-  ( n  =  M  ->  n  =  M )
86, 7oveq12d 6031 . . . . . 6  |-  ( n  =  M  ->  (
( ( A ^
( ( n  - 
1 )  /  2
) )  +  1 )  mod  n )  =  ( ( ( A ^ ( ( M  -  1 )  /  2 ) )  +  1 )  mod 
M ) )
98oveq1d 6028 . . . . 5  |-  ( n  =  M  ->  (
( ( ( A ^ ( ( n  -  1 )  / 
2 ) )  +  1 )  mod  n
)  -  1 )  =  ( ( ( ( A ^ (
( M  -  1 )  /  2 ) )  +  1 )  mod  M )  - 
1 ) )
102, 9ifbieq2d 3695 . . . 4  |-  ( n  =  M  ->  if ( n  =  2 ,  if ( 2  ||  A ,  0 ,  if ( ( A  mod  8 )  e.  {
1 ,  7 } ,  1 ,  -u
1 ) ) ,  ( ( ( ( A ^ ( ( n  -  1 )  /  2 ) )  +  1 )  mod  n )  -  1 ) )  =  if ( M  =  2 ,  if ( 2 
||  A ,  0 ,  if ( ( A  mod  8 )  e.  { 1 ,  7 } ,  1 ,  -u 1 ) ) ,  ( ( ( ( A ^ (
( M  -  1 )  /  2 ) )  +  1 )  mod  M )  - 
1 ) ) )
11 oveq1 6020 . . . 4  |-  ( n  =  M  ->  (
n  pCnt  N )  =  ( M  pCnt  N ) )
1210, 11oveq12d 6031 . . 3  |-  ( n  =  M  ->  ( if ( n  =  2 ,  if ( 2 
||  A ,  0 ,  if ( ( A  mod  8 )  e.  { 1 ,  7 } ,  1 ,  -u 1 ) ) ,  ( ( ( ( A ^ (
( n  -  1 )  /  2 ) )  +  1 )  mod  n )  - 
1 ) ) ^
( n  pCnt  N
) )  =  ( if ( M  =  2 ,  if ( 2  ||  A , 
0 ,  if ( ( A  mod  8
)  e.  { 1 ,  7 } , 
1 ,  -u 1
) ) ,  ( ( ( ( A ^ ( ( M  -  1 )  / 
2 ) )  +  1 )  mod  M
)  -  1 ) ) ^ ( M 
pCnt  N ) ) )
13 eqidd 2381 . . 3  |-  ( n  =  M  ->  1  =  1 )
141, 12, 13ifbieq12d 3697 . 2  |-  ( n  =  M  ->  if ( n  e.  Prime ,  ( if ( n  =  2 ,  if ( 2  ||  A ,  0 ,  if ( ( A  mod  8 )  e.  {
1 ,  7 } ,  1 ,  -u
1 ) ) ,  ( ( ( ( A ^ ( ( n  -  1 )  /  2 ) )  +  1 )  mod  n )  -  1 ) ) ^ (
n  pCnt  N )
) ,  1 )  =  if ( M  e.  Prime ,  ( if ( M  =  2 ,  if ( 2 
||  A ,  0 ,  if ( ( A  mod  8 )  e.  { 1 ,  7 } ,  1 ,  -u 1 ) ) ,  ( ( ( ( A ^ (
( M  -  1 )  /  2 ) )  +  1 )  mod  M )  - 
1 ) ) ^
( M  pCnt  N
) ) ,  1 ) )
15 lgsval.1 . 2  |-  F  =  ( n  e.  NN  |->  if ( n  e.  Prime ,  ( if ( n  =  2 ,  if ( 2  ||  A ,  0 ,  if ( ( A  mod  8 )  e.  {
1 ,  7 } ,  1 ,  -u
1 ) ) ,  ( ( ( ( A ^ ( ( n  -  1 )  /  2 ) )  +  1 )  mod  n )  -  1 ) ) ^ (
n  pCnt  N )
) ,  1 ) )
16 ovex 6038 . . 3  |-  ( if ( M  =  2 ,  if ( 2 
||  A ,  0 ,  if ( ( A  mod  8 )  e.  { 1 ,  7 } ,  1 ,  -u 1 ) ) ,  ( ( ( ( A ^ (
( M  -  1 )  /  2 ) )  +  1 )  mod  M )  - 
1 ) ) ^
( M  pCnt  N
) )  e.  _V
17 1ex 9012 . . 3  |-  1  e.  _V
1816, 17ifex 3733 . 2  |-  if ( M  e.  Prime ,  ( if ( M  =  2 ,  if ( 2  ||  A , 
0 ,  if ( ( A  mod  8
)  e.  { 1 ,  7 } , 
1 ,  -u 1
) ) ,  ( ( ( ( A ^ ( ( M  -  1 )  / 
2 ) )  +  1 )  mod  M
)  -  1 ) ) ^ ( M 
pCnt  N ) ) ,  1 )  e.  _V
1914, 15, 18fvmpt 5738 1  |-  ( M  e.  NN  ->  ( F `  M )  =  if ( M  e. 
Prime ,  ( if ( M  =  2 ,  if ( 2  ||  A ,  0 ,  if ( ( A  mod  8 )  e.  {
1 ,  7 } ,  1 ,  -u
1 ) ) ,  ( ( ( ( A ^ ( ( M  -  1 )  /  2 ) )  +  1 )  mod 
M )  -  1 ) ) ^ ( M  pCnt  N ) ) ,  1 ) )
Colors of variables: wff set class
Syntax hints:    -> wi 4    = wceq 1649    e. wcel 1717   ifcif 3675   {cpr 3751   class class class wbr 4146    e. cmpt 4200   ` cfv 5387  (class class class)co 6013   0cc0 8916   1c1 8917    + caddc 8919    - cmin 9216   -ucneg 9217    / cdiv 9602   NNcn 9925   2c2 9974   7c7 9979   8c8 9980    mod cmo 11170   ^cexp 11302    || cdivides 12772   Primecprime 12999    pCnt cpc 13130
This theorem is referenced by:  lgsval2lem  20950
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1552  ax-5 1563  ax-17 1623  ax-9 1661  ax-8 1682  ax-14 1721  ax-6 1736  ax-7 1741  ax-11 1753  ax-12 1939  ax-ext 2361  ax-sep 4264  ax-nul 4272  ax-pr 4337  ax-1cn 8974
This theorem depends on definitions:  df-bi 178  df-or 360  df-an 361  df-3an 938  df-tru 1325  df-ex 1548  df-nf 1551  df-sb 1656  df-eu 2235  df-mo 2236  df-clab 2367  df-cleq 2373  df-clel 2376  df-nfc 2505  df-ne 2545  df-ral 2647  df-rex 2648  df-rab 2651  df-v 2894  df-sbc 3098  df-dif 3259  df-un 3261  df-in 3263  df-ss 3270  df-nul 3565  df-if 3676  df-sn 3756  df-pr 3757  df-op 3759  df-uni 3951  df-br 4147  df-opab 4201  df-mpt 4202  df-id 4432  df-xp 4817  df-rel 4818  df-cnv 4819  df-co 4820  df-dm 4821  df-iota 5351  df-fun 5389  df-fv 5395  df-ov 6016
  Copyright terms: Public domain W3C validator