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

Theorem lgsfval 20556
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 2356 . . 3  |-  ( n  =  M  ->  (
n  e.  Prime  <->  M  e.  Prime ) )
2 eqeq1 2302 . . . . 5  |-  ( n  =  M  ->  (
n  =  2  <->  M  =  2 ) )
3 oveq1 5881 . . . . . . . . . 10  |-  ( n  =  M  ->  (
n  -  1 )  =  ( M  - 
1 ) )
43oveq1d 5889 . . . . . . . . 9  |-  ( n  =  M  ->  (
( n  -  1 )  /  2 )  =  ( ( M  -  1 )  / 
2 ) )
54oveq2d 5890 . . . . . . . 8  |-  ( n  =  M  ->  ( A ^ ( ( n  -  1 )  / 
2 ) )  =  ( A ^ (
( M  -  1 )  /  2 ) ) )
65oveq1d 5889 . . . . . . 7  |-  ( n  =  M  ->  (
( A ^ (
( n  -  1 )  /  2 ) )  +  1 )  =  ( ( A ^ ( ( M  -  1 )  / 
2 ) )  +  1 ) )
7 id 19 . . . . . . 7  |-  ( n  =  M  ->  n  =  M )
86, 7oveq12d 5892 . . . . . 6  |-  ( n  =  M  ->  (
( ( A ^
( ( n  - 
1 )  /  2
) )  +  1 )  mod  n )  =  ( ( ( A ^ ( ( M  -  1 )  /  2 ) )  +  1 )  mod 
M ) )
98oveq1d 5889 . . . . 5  |-  ( n  =  M  ->  (
( ( ( A ^ ( ( n  -  1 )  / 
2 ) )  +  1 )  mod  n
)  -  1 )  =  ( ( ( ( A ^ (
( M  -  1 )  /  2 ) )  +  1 )  mod  M )  - 
1 ) )
102, 9ifbieq2d 3598 . . . 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 5881 . . . 4  |-  ( n  =  M  ->  (
n  pCnt  N )  =  ( M  pCnt  N ) )
1210, 11oveq12d 5892 . . 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 2297 . . 3  |-  ( n  =  M  ->  1  =  1 )
141, 12, 13ifbieq12d 3600 . 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 5899 . . 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 8849 . . 3  |-  1  e.  _V
1816, 17ifex 3636 . 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 5618 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 1632    e. wcel 1696   ifcif 3578   {cpr 3654   class class class wbr 4039    e. cmpt 4093   ` cfv 5271  (class class class)co 5874   0cc0 8753   1c1 8754    + caddc 8756    - cmin 9053   -ucneg 9054    / cdiv 9439   NNcn 9762   2c2 9811   7c7 9816   8c8 9817    mod cmo 10989   ^cexp 11120    || cdivides 12547   Primecprime 12774    pCnt cpc 12905
This theorem is referenced by:  lgsval2lem  20561
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1536  ax-5 1547  ax-17 1606  ax-9 1644  ax-8 1661  ax-14 1700  ax-6 1715  ax-7 1720  ax-11 1727  ax-12 1878  ax-ext 2277  ax-sep 4157  ax-nul 4165  ax-pr 4230  ax-1cn 8811
This theorem depends on definitions:  df-bi 177  df-or 359  df-an 360  df-3an 936  df-tru 1310  df-ex 1532  df-nf 1535  df-sb 1639  df-eu 2160  df-mo 2161  df-clab 2283  df-cleq 2289  df-clel 2292  df-nfc 2421  df-ne 2461  df-ral 2561  df-rex 2562  df-rab 2565  df-v 2803  df-sbc 3005  df-dif 3168  df-un 3170  df-in 3172  df-ss 3179  df-nul 3469  df-if 3579  df-sn 3659  df-pr 3660  df-op 3662  df-uni 3844  df-br 4040  df-opab 4094  df-mpt 4095  df-id 4325  df-xp 4711  df-rel 4712  df-cnv 4713  df-co 4714  df-dm 4715  df-iota 5235  df-fun 5273  df-fv 5279  df-ov 5877
  Copyright terms: Public domain W3C validator