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

Theorem lgsfval 21077
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 2495 . . 3  |-  ( n  =  M  ->  (
n  e.  Prime  <->  M  e.  Prime ) )
2 eqeq1 2441 . . . . 5  |-  ( n  =  M  ->  (
n  =  2  <->  M  =  2 ) )
3 oveq1 6080 . . . . . . . . . 10  |-  ( n  =  M  ->  (
n  -  1 )  =  ( M  - 
1 ) )
43oveq1d 6088 . . . . . . . . 9  |-  ( n  =  M  ->  (
( n  -  1 )  /  2 )  =  ( ( M  -  1 )  / 
2 ) )
54oveq2d 6089 . . . . . . . 8  |-  ( n  =  M  ->  ( A ^ ( ( n  -  1 )  / 
2 ) )  =  ( A ^ (
( M  -  1 )  /  2 ) ) )
65oveq1d 6088 . . . . . . 7  |-  ( n  =  M  ->  (
( A ^ (
( n  -  1 )  /  2 ) )  +  1 )  =  ( ( A ^ ( ( M  -  1 )  / 
2 ) )  +  1 ) )
7 id 20 . . . . . . 7  |-  ( n  =  M  ->  n  =  M )
86, 7oveq12d 6091 . . . . . 6  |-  ( n  =  M  ->  (
( ( A ^
( ( n  - 
1 )  /  2
) )  +  1 )  mod  n )  =  ( ( ( A ^ ( ( M  -  1 )  /  2 ) )  +  1 )  mod 
M ) )
98oveq1d 6088 . . . . 5  |-  ( n  =  M  ->  (
( ( ( A ^ ( ( n  -  1 )  / 
2 ) )  +  1 )  mod  n
)  -  1 )  =  ( ( ( ( A ^ (
( M  -  1 )  /  2 ) )  +  1 )  mod  M )  - 
1 ) )
102, 9ifbieq2d 3751 . . . 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 6080 . . . 4  |-  ( n  =  M  ->  (
n  pCnt  N )  =  ( M  pCnt  N ) )
1210, 11oveq12d 6091 . . 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 2436 . . 3  |-  ( n  =  M  ->  1  =  1 )
141, 12, 13ifbieq12d 3753 . 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 6098 . . 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 9078 . . 3  |-  1  e.  _V
1816, 17ifex 3789 . 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 5798 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 1652    e. wcel 1725   ifcif 3731   {cpr 3807   class class class wbr 4204    e. cmpt 4258   ` cfv 5446  (class class class)co 6073   0cc0 8982   1c1 8983    + caddc 8985    - cmin 9283   -ucneg 9284    / cdiv 9669   NNcn 9992   2c2 10041   7c7 10046   8c8 10047    mod cmo 11242   ^cexp 11374    || cdivides 12844   Primecprime 13071    pCnt cpc 13202
This theorem is referenced by:  lgsval2lem  21082
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1555  ax-5 1566  ax-17 1626  ax-9 1666  ax-8 1687  ax-14 1729  ax-6 1744  ax-7 1749  ax-11 1761  ax-12 1950  ax-ext 2416  ax-sep 4322  ax-nul 4330  ax-pr 4395  ax-1cn 9040
This theorem depends on definitions:  df-bi 178  df-or 360  df-an 361  df-3an 938  df-tru 1328  df-ex 1551  df-nf 1554  df-sb 1659  df-eu 2284  df-mo 2285  df-clab 2422  df-cleq 2428  df-clel 2431  df-nfc 2560  df-ne 2600  df-ral 2702  df-rex 2703  df-rab 2706  df-v 2950  df-sbc 3154  df-dif 3315  df-un 3317  df-in 3319  df-ss 3326  df-nul 3621  df-if 3732  df-sn 3812  df-pr 3813  df-op 3815  df-uni 4008  df-br 4205  df-opab 4259  df-mpt 4260  df-id 4490  df-xp 4876  df-rel 4877  df-cnv 4878  df-co 4879  df-dm 4880  df-iota 5410  df-fun 5448  df-fv 5454  df-ov 6076
  Copyright terms: Public domain W3C validator