Metamath Proof Explorer


Theorem lgscllem

Description: The Legendre symbol is an element of Z . (Contributed by Mario Carneiro, 4-Feb-2015)

Ref Expression
Hypotheses lgsval.1 F = n if n if n = 2 if 2 A 0 if A mod 8 1 7 1 1 A n 1 2 + 1 mod n 1 n pCnt N 1
lgsfcl2.z Z = x | x 1
Assertion lgscllem A N A / L N Z

Proof

Step Hyp Ref Expression
1 lgsval.1 F = n if n if n = 2 if 2 A 0 if A mod 8 1 7 1 1 A n 1 2 + 1 mod n 1 n pCnt N 1
2 lgsfcl2.z Z = x | x 1
3 1 lgsval A N A / L N = if N = 0 if A 2 = 1 1 0 if N < 0 A < 0 1 1 seq 1 × F N
4 2 lgslem2 1 Z 0 Z 1 Z
5 4 simp3i 1 Z
6 4 simp2i 0 Z
7 5 6 ifcli if A 2 = 1 1 0 Z
8 7 a1i A N N = 0 if A 2 = 1 1 0 Z
9 4 simp1i 1 Z
10 9 5 ifcli if N < 0 A < 0 1 1 Z
11 simplr A N ¬ N = 0 N
12 simpr A N ¬ N = 0 ¬ N = 0
13 12 neqned A N ¬ N = 0 N 0
14 nnabscl N N 0 N
15 11 13 14 syl2anc A N ¬ N = 0 N
16 nnuz = 1
17 15 16 eleqtrdi A N ¬ N = 0 N 1
18 df-ne N 0 ¬ N = 0
19 1 2 lgsfcl2 A N N 0 F : Z
20 19 3expa A N N 0 F : Z
21 18 20 sylan2br A N ¬ N = 0 F : Z
22 elfznn y 1 N y
23 ffvelrn F : Z y F y Z
24 21 22 23 syl2an A N ¬ N = 0 y 1 N F y Z
25 2 lgslem3 y Z z Z y z Z
26 25 adantl A N ¬ N = 0 y Z z Z y z Z
27 17 24 26 seqcl A N ¬ N = 0 seq 1 × F N Z
28 2 lgslem3 if N < 0 A < 0 1 1 Z seq 1 × F N Z if N < 0 A < 0 1 1 seq 1 × F N Z
29 10 27 28 sylancr A N ¬ N = 0 if N < 0 A < 0 1 1 seq 1 × F N Z
30 8 29 ifclda A N if N = 0 if A 2 = 1 1 0 if N < 0 A < 0 1 1 seq 1 × F N Z
31 3 30 eqeltrd A N A / L N Z