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

Theorem lgsfval 26137
Description: Value of the function 𝐹 which defines the Legendre symbol at the primes. (Contributed by Mario Carneiro, 4-Feb-2015.)
Hypothesis
Ref Expression
lgsval.1 𝐹 = (𝑛 ∈ ℕ ↦ if(𝑛 ∈ ℙ, (if(𝑛 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) − 1))↑(𝑛 pCnt 𝑁)), 1))
Assertion
Ref Expression
lgsfval (𝑀 ∈ ℕ → (𝐹𝑀) = if(𝑀 ∈ ℙ, (if(𝑀 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))↑(𝑀 pCnt 𝑁)), 1))
Distinct variable groups:   𝐴,𝑛   𝑛,𝑀   𝑛,𝑁
Allowed substitution hint:   𝐹(𝑛)

Proof of Theorem lgsfval
StepHypRef Expression
1 eleq1 2818 . . 3 (𝑛 = 𝑀 → (𝑛 ∈ ℙ ↔ 𝑀 ∈ ℙ))
2 eqeq1 2740 . . . . 5 (𝑛 = 𝑀 → (𝑛 = 2 ↔ 𝑀 = 2))
3 oveq1 7198 . . . . . . . . . 10 (𝑛 = 𝑀 → (𝑛 − 1) = (𝑀 − 1))
43oveq1d 7206 . . . . . . . . 9 (𝑛 = 𝑀 → ((𝑛 − 1) / 2) = ((𝑀 − 1) / 2))
54oveq2d 7207 . . . . . . . 8 (𝑛 = 𝑀 → (𝐴↑((𝑛 − 1) / 2)) = (𝐴↑((𝑀 − 1) / 2)))
65oveq1d 7206 . . . . . . 7 (𝑛 = 𝑀 → ((𝐴↑((𝑛 − 1) / 2)) + 1) = ((𝐴↑((𝑀 − 1) / 2)) + 1))
7 id 22 . . . . . . 7 (𝑛 = 𝑀𝑛 = 𝑀)
86, 7oveq12d 7209 . . . . . 6 (𝑛 = 𝑀 → (((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) = (((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀))
98oveq1d 7206 . . . . 5 (𝑛 = 𝑀 → ((((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) − 1) = ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))
102, 9ifbieq2d 4451 . . . 4 (𝑛 = 𝑀 → if(𝑛 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) − 1)) = if(𝑀 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1)))
11 oveq1 7198 . . . 4 (𝑛 = 𝑀 → (𝑛 pCnt 𝑁) = (𝑀 pCnt 𝑁))
1210, 11oveq12d 7209 . . 3 (𝑛 = 𝑀 → (if(𝑛 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) − 1))↑(𝑛 pCnt 𝑁)) = (if(𝑀 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))↑(𝑀 pCnt 𝑁)))
131, 12ifbieq1d 4449 . 2 (𝑛 = 𝑀 → if(𝑛 ∈ ℙ, (if(𝑛 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) − 1))↑(𝑛 pCnt 𝑁)), 1) = if(𝑀 ∈ ℙ, (if(𝑀 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))↑(𝑀 pCnt 𝑁)), 1))
14 lgsval.1 . 2 𝐹 = (𝑛 ∈ ℕ ↦ if(𝑛 ∈ ℙ, (if(𝑛 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) − 1))↑(𝑛 pCnt 𝑁)), 1))
15 ovex 7224 . . 3 (if(𝑀 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))↑(𝑀 pCnt 𝑁)) ∈ V
16 1ex 10794 . . 3 1 ∈ V
1715, 16ifex 4475 . 2 if(𝑀 ∈ ℙ, (if(𝑀 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))↑(𝑀 pCnt 𝑁)), 1) ∈ V
1813, 14, 17fvmpt 6796 1 (𝑀 ∈ ℕ → (𝐹𝑀) = if(𝑀 ∈ ℙ, (if(𝑀 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))↑(𝑀 pCnt 𝑁)), 1))
Colors of variables: wff setvar class
Syntax hints:  wi 4   = wceq 1543  wcel 2112  ifcif 4425  {cpr 4529   class class class wbr 5039  cmpt 5120  cfv 6358  (class class class)co 7191  0cc0 10694  1c1 10695   + caddc 10697  cmin 11027  -cneg 11028   / cdiv 11454  cn 11795  2c2 11850  7c7 11855  8c8 11856   mod cmo 13407  cexp 13600  cdvds 15778  cprime 16191   pCnt cpc 16352
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1803  ax-4 1817  ax-5 1918  ax-6 1976  ax-7 2018  ax-8 2114  ax-9 2122  ax-10 2143  ax-11 2160  ax-12 2177  ax-ext 2708  ax-sep 5177  ax-nul 5184  ax-pr 5307  ax-1cn 10752
This theorem depends on definitions:  df-bi 210  df-an 400  df-or 848  df-3an 1091  df-tru 1546  df-fal 1556  df-ex 1788  df-nf 1792  df-sb 2073  df-mo 2539  df-eu 2568  df-clab 2715  df-cleq 2728  df-clel 2809  df-nfc 2879  df-ral 3056  df-rex 3057  df-rab 3060  df-v 3400  df-sbc 3684  df-dif 3856  df-un 3858  df-in 3860  df-ss 3870  df-nul 4224  df-if 4426  df-sn 4528  df-pr 4530  df-op 4534  df-uni 4806  df-br 5040  df-opab 5102  df-mpt 5121  df-id 5440  df-xp 5542  df-rel 5543  df-cnv 5544  df-co 5545  df-dm 5546  df-iota 6316  df-fun 6360  df-fv 6366  df-ov 7194
This theorem is referenced by:  lgsval2lem  26142
  Copyright terms: Public domain W3C validator