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

Theorem lgsfval 24827
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 2676 . . 3 (𝑛 = 𝑀 → (𝑛 ∈ ℙ ↔ 𝑀 ∈ ℙ))
2 eqeq1 2614 . . . . 5 (𝑛 = 𝑀 → (𝑛 = 2 ↔ 𝑀 = 2))
3 oveq1 6556 . . . . . . . . . 10 (𝑛 = 𝑀 → (𝑛 − 1) = (𝑀 − 1))
43oveq1d 6564 . . . . . . . . 9 (𝑛 = 𝑀 → ((𝑛 − 1) / 2) = ((𝑀 − 1) / 2))
54oveq2d 6565 . . . . . . . 8 (𝑛 = 𝑀 → (𝐴↑((𝑛 − 1) / 2)) = (𝐴↑((𝑀 − 1) / 2)))
65oveq1d 6564 . . . . . . 7 (𝑛 = 𝑀 → ((𝐴↑((𝑛 − 1) / 2)) + 1) = ((𝐴↑((𝑀 − 1) / 2)) + 1))
7 id 22 . . . . . . 7 (𝑛 = 𝑀𝑛 = 𝑀)
86, 7oveq12d 6567 . . . . . 6 (𝑛 = 𝑀 → (((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) = (((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀))
98oveq1d 6564 . . . . 5 (𝑛 = 𝑀 → ((((𝐴↑((𝑛 − 1) / 2)) + 1) mod 𝑛) − 1) = ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))
102, 9ifbieq2d 4061 . . . 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 6556 . . . 4 (𝑛 = 𝑀 → (𝑛 pCnt 𝑁) = (𝑀 pCnt 𝑁))
1210, 11oveq12d 6567 . . 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 4059 . 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 6577 . . 3 (if(𝑀 = 2, if(2 ∥ 𝐴, 0, if((𝐴 mod 8) ∈ {1, 7}, 1, -1)), ((((𝐴↑((𝑀 − 1) / 2)) + 1) mod 𝑀) − 1))↑(𝑀 pCnt 𝑁)) ∈ V
16 1ex 9914 . . 3 1 ∈ V
1715, 16ifex 4106 . 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 6191 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 1475  wcel 1977  ifcif 4036  {cpr 4127   class class class wbr 4583  cmpt 4643  cfv 5804  (class class class)co 6549  0cc0 9815  1c1 9816   + caddc 9818  cmin 10145  -cneg 10146   / cdiv 10563  cn 10897  2c2 10947  7c7 10952  8c8 10953   mod cmo 12530  cexp 12722  cdvds 14821  cprime 15223   pCnt cpc 15379
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1713  ax-4 1728  ax-5 1827  ax-6 1875  ax-7 1922  ax-9 1986  ax-10 2006  ax-11 2021  ax-12 2034  ax-13 2234  ax-ext 2590  ax-sep 4709  ax-nul 4717  ax-pr 4833  ax-1cn 9873
This theorem depends on definitions:  df-bi 196  df-or 384  df-an 385  df-3an 1033  df-tru 1478  df-ex 1696  df-nf 1701  df-sb 1868  df-eu 2462  df-mo 2463  df-clab 2597  df-cleq 2603  df-clel 2606  df-nfc 2740  df-ral 2901  df-rex 2902  df-rab 2905  df-v 3175  df-sbc 3403  df-dif 3543  df-un 3545  df-in 3547  df-ss 3554  df-nul 3875  df-if 4037  df-sn 4126  df-pr 4128  df-op 4132  df-uni 4373  df-br 4584  df-opab 4644  df-mpt 4645  df-id 4953  df-xp 5044  df-rel 5045  df-cnv 5046  df-co 5047  df-dm 5048  df-iota 5768  df-fun 5806  df-fv 5812  df-ov 6552
This theorem is referenced by:  lgsval2lem  24832
  Copyright terms: Public domain W3C validator