Metamath Proof Explorer


Theorem lgsdir

Description: The Legendre symbol is completely multiplicative in its left argument. Generalization of theorem 9.9(a) in ApostolNT p. 188 (which assumes that A and B are odd positive integers). Together with lgsqr this implies that the product of two quadratic residues or nonresidues is a residue, and the product of a residue and a nonresidue is a nonresidue. (Contributed by Mario Carneiro, 4-Feb-2015)

Ref Expression
Assertion lgsdir A B N A 0 B 0 A B / L N = A / L N B / L N

Proof

Step Hyp Ref Expression
1 ax-1cn 1
2 0cn 0
3 1 2 ifcli if B 2 = 1 1 0
4 3 mulid2i 1 if B 2 = 1 1 0 = if B 2 = 1 1 0
5 iftrue A 2 = 1 if A 2 = 1 1 0 = 1
6 5 adantl A B N A 0 B 0 N = 0 A 2 = 1 if A 2 = 1 1 0 = 1
7 6 oveq1d A B N A 0 B 0 N = 0 A 2 = 1 if A 2 = 1 1 0 if B 2 = 1 1 0 = 1 if B 2 = 1 1 0
8 simpl1 A B N A 0 B 0 A
9 8 zcnd A B N A 0 B 0 A
10 9 ad2antrr A B N A 0 B 0 N = 0 A 2 = 1 A
11 simpl2 A B N A 0 B 0 B
12 11 zcnd A B N A 0 B 0 B
13 12 ad2antrr A B N A 0 B 0 N = 0 A 2 = 1 B
14 10 13 sqmuld A B N A 0 B 0 N = 0 A 2 = 1 A B 2 = A 2 B 2
15 simpr A B N A 0 B 0 N = 0 A 2 = 1 A 2 = 1
16 15 oveq1d A B N A 0 B 0 N = 0 A 2 = 1 A 2 B 2 = 1 B 2
17 12 sqcld A B N A 0 B 0 B 2
18 17 ad2antrr A B N A 0 B 0 N = 0 A 2 = 1 B 2
19 18 mulid2d A B N A 0 B 0 N = 0 A 2 = 1 1 B 2 = B 2
20 14 16 19 3eqtrd A B N A 0 B 0 N = 0 A 2 = 1 A B 2 = B 2
21 20 eqeq1d A B N A 0 B 0 N = 0 A 2 = 1 A B 2 = 1 B 2 = 1
22 21 ifbid A B N A 0 B 0 N = 0 A 2 = 1 if A B 2 = 1 1 0 = if B 2 = 1 1 0
23 4 7 22 3eqtr4a A B N A 0 B 0 N = 0 A 2 = 1 if A 2 = 1 1 0 if B 2 = 1 1 0 = if A B 2 = 1 1 0
24 3 mul02i 0 if B 2 = 1 1 0 = 0
25 iffalse ¬ A 2 = 1 if A 2 = 1 1 0 = 0
26 25 adantl A B N A 0 B 0 N = 0 ¬ A 2 = 1 if A 2 = 1 1 0 = 0
27 26 oveq1d A B N A 0 B 0 N = 0 ¬ A 2 = 1 if A 2 = 1 1 0 if B 2 = 1 1 0 = 0 if B 2 = 1 1 0
28 dvdsmul1 A B A A B
29 8 11 28 syl2anc A B N A 0 B 0 A A B
30 8 11 zmulcld A B N A 0 B 0 A B
31 dvdssq A A B A A B A 2 A B 2
32 8 30 31 syl2anc A B N A 0 B 0 A A B A 2 A B 2
33 29 32 mpbid A B N A 0 B 0 A 2 A B 2
34 33 adantr A B N A 0 B 0 N = 0 A 2 A B 2
35 breq2 A B 2 = 1 A 2 A B 2 A 2 1
36 34 35 syl5ibcom A B N A 0 B 0 N = 0 A B 2 = 1 A 2 1
37 simprl A B N A 0 B 0 A 0
38 37 neneqd A B N A 0 B 0 ¬ A = 0
39 sqeq0 A A 2 = 0 A = 0
40 9 39 syl A B N A 0 B 0 A 2 = 0 A = 0
41 38 40 mtbird A B N A 0 B 0 ¬ A 2 = 0
42 zsqcl2 A A 2 0
43 8 42 syl A B N A 0 B 0 A 2 0
44 elnn0 A 2 0 A 2 A 2 = 0
45 43 44 sylib A B N A 0 B 0 A 2 A 2 = 0
46 45 ord A B N A 0 B 0 ¬ A 2 A 2 = 0
47 41 46 mt3d A B N A 0 B 0 A 2
48 47 adantr A B N A 0 B 0 N = 0 A 2
49 48 nnzd A B N A 0 B 0 N = 0 A 2
50 1nn 1
51 dvdsle A 2 1 A 2 1 A 2 1
52 49 50 51 sylancl A B N A 0 B 0 N = 0 A 2 1 A 2 1
53 48 nnge1d A B N A 0 B 0 N = 0 1 A 2
54 52 53 jctird A B N A 0 B 0 N = 0 A 2 1 A 2 1 1 A 2
55 48 nnred A B N A 0 B 0 N = 0 A 2
56 1re 1
57 letri3 A 2 1 A 2 = 1 A 2 1 1 A 2
58 55 56 57 sylancl A B N A 0 B 0 N = 0 A 2 = 1 A 2 1 1 A 2
59 54 58 sylibrd A B N A 0 B 0 N = 0 A 2 1 A 2 = 1
60 36 59 syld A B N A 0 B 0 N = 0 A B 2 = 1 A 2 = 1
61 60 con3dimp A B N A 0 B 0 N = 0 ¬ A 2 = 1 ¬ A B 2 = 1
62 61 iffalsed A B N A 0 B 0 N = 0 ¬ A 2 = 1 if A B 2 = 1 1 0 = 0
63 24 27 62 3eqtr4a A B N A 0 B 0 N = 0 ¬ A 2 = 1 if A 2 = 1 1 0 if B 2 = 1 1 0 = if A B 2 = 1 1 0
64 23 63 pm2.61dan A B N A 0 B 0 N = 0 if A 2 = 1 1 0 if B 2 = 1 1 0 = if A B 2 = 1 1 0
65 oveq2 N = 0 A / L N = A / L 0
66 lgs0 A A / L 0 = if A 2 = 1 1 0
67 8 66 syl A B N A 0 B 0 A / L 0 = if A 2 = 1 1 0
68 65 67 sylan9eqr A B N A 0 B 0 N = 0 A / L N = if A 2 = 1 1 0
69 oveq2 N = 0 B / L N = B / L 0
70 lgs0 B B / L 0 = if B 2 = 1 1 0
71 11 70 syl A B N A 0 B 0 B / L 0 = if B 2 = 1 1 0
72 69 71 sylan9eqr A B N A 0 B 0 N = 0 B / L N = if B 2 = 1 1 0
73 68 72 oveq12d A B N A 0 B 0 N = 0 A / L N B / L N = if A 2 = 1 1 0 if B 2 = 1 1 0
74 oveq2 N = 0 A B / L N = A B / L 0
75 lgs0 A B A B / L 0 = if A B 2 = 1 1 0
76 30 75 syl A B N A 0 B 0 A B / L 0 = if A B 2 = 1 1 0
77 74 76 sylan9eqr A B N A 0 B 0 N = 0 A B / L N = if A B 2 = 1 1 0
78 64 73 77 3eqtr4rd A B N A 0 B 0 N = 0 A B / L N = A / L N B / L N
79 lgsdilem A B N A 0 B 0 if N < 0 A B < 0 1 1 = if N < 0 A < 0 1 1 if N < 0 B < 0 1 1
80 79 adantr A B N A 0 B 0 N 0 if N < 0 A B < 0 1 1 = if N < 0 A < 0 1 1 if N < 0 B < 0 1 1
81 simpl3 A B N A 0 B 0 N
82 nnabscl N N 0 N
83 81 82 sylan A B N A 0 B 0 N 0 N
84 nnuz = 1
85 83 84 eleqtrdi A B N A 0 B 0 N 0 N 1
86 simpll1 A B N A 0 B 0 N 0 A
87 simpll3 A B N A 0 B 0 N 0 N
88 simpr A B N A 0 B 0 N 0 N 0
89 eqid n if n A / L n n pCnt N 1 = n if n A / L n n pCnt N 1
90 89 lgsfcl3 A N N 0 n if n A / L n n pCnt N 1 :
91 86 87 88 90 syl3anc A B N A 0 B 0 N 0 n if n A / L n n pCnt N 1 :
92 elfznn k 1 N k
93 ffvelrn n if n A / L n n pCnt N 1 : k n if n A / L n n pCnt N 1 k
94 91 92 93 syl2an A B N A 0 B 0 N 0 k 1 N n if n A / L n n pCnt N 1 k
95 94 zcnd A B N A 0 B 0 N 0 k 1 N n if n A / L n n pCnt N 1 k
96 simpll2 A B N A 0 B 0 N 0 B
97 eqid n if n B / L n n pCnt N 1 = n if n B / L n n pCnt N 1
98 97 lgsfcl3 B N N 0 n if n B / L n n pCnt N 1 :
99 96 87 88 98 syl3anc A B N A 0 B 0 N 0 n if n B / L n n pCnt N 1 :
100 ffvelrn n if n B / L n n pCnt N 1 : k n if n B / L n n pCnt N 1 k
101 99 92 100 syl2an A B N A 0 B 0 N 0 k 1 N n if n B / L n n pCnt N 1 k
102 101 zcnd A B N A 0 B 0 N 0 k 1 N n if n B / L n n pCnt N 1 k
103 86 adantr A B N A 0 B 0 N 0 k A
104 96 adantr A B N A 0 B 0 N 0 k B
105 simpr A B N A 0 B 0 N 0 k k
106 lgsdirprm A B k A B / L k = A / L k B / L k
107 103 104 105 106 syl3anc A B N A 0 B 0 N 0 k A B / L k = A / L k B / L k
108 107 oveq1d A B N A 0 B 0 N 0 k A B / L k k pCnt N = A / L k B / L k k pCnt N
109 prmz k k
110 lgscl A k A / L k
111 86 109 110 syl2an A B N A 0 B 0 N 0 k A / L k
112 111 zcnd A B N A 0 B 0 N 0 k A / L k
113 lgscl B k B / L k
114 96 109 113 syl2an A B N A 0 B 0 N 0 k B / L k
115 114 zcnd A B N A 0 B 0 N 0 k B / L k
116 87 adantr A B N A 0 B 0 N 0 k N
117 88 adantr A B N A 0 B 0 N 0 k N 0
118 pczcl k N N 0 k pCnt N 0
119 105 116 117 118 syl12anc A B N A 0 B 0 N 0 k k pCnt N 0
120 112 115 119 mulexpd A B N A 0 B 0 N 0 k A / L k B / L k k pCnt N = A / L k k pCnt N B / L k k pCnt N
121 108 120 eqtrd A B N A 0 B 0 N 0 k A B / L k k pCnt N = A / L k k pCnt N B / L k k pCnt N
122 iftrue k if k A B / L k k pCnt N 1 = A B / L k k pCnt N
123 122 adantl A B N A 0 B 0 N 0 k if k A B / L k k pCnt N 1 = A B / L k k pCnt N
124 iftrue k if k A / L k k pCnt N 1 = A / L k k pCnt N
125 iftrue k if k B / L k k pCnt N 1 = B / L k k pCnt N
126 124 125 oveq12d k if k A / L k k pCnt N 1 if k B / L k k pCnt N 1 = A / L k k pCnt N B / L k k pCnt N
127 126 adantl A B N A 0 B 0 N 0 k if k A / L k k pCnt N 1 if k B / L k k pCnt N 1 = A / L k k pCnt N B / L k k pCnt N
128 121 123 127 3eqtr4d A B N A 0 B 0 N 0 k if k A B / L k k pCnt N 1 = if k A / L k k pCnt N 1 if k B / L k k pCnt N 1
129 1t1e1 1 1 = 1
130 129 eqcomi 1 = 1 1
131 iffalse ¬ k if k A B / L k k pCnt N 1 = 1
132 iffalse ¬ k if k A / L k k pCnt N 1 = 1
133 iffalse ¬ k if k B / L k k pCnt N 1 = 1
134 132 133 oveq12d ¬ k if k A / L k k pCnt N 1 if k B / L k k pCnt N 1 = 1 1
135 130 131 134 3eqtr4a ¬ k if k A B / L k k pCnt N 1 = if k A / L k k pCnt N 1 if k B / L k k pCnt N 1
136 135 adantl A B N A 0 B 0 N 0 ¬ k if k A B / L k k pCnt N 1 = if k A / L k k pCnt N 1 if k B / L k k pCnt N 1
137 128 136 pm2.61dan A B N A 0 B 0 N 0 if k A B / L k k pCnt N 1 = if k A / L k k pCnt N 1 if k B / L k k pCnt N 1
138 137 adantr A B N A 0 B 0 N 0 k 1 N if k A B / L k k pCnt N 1 = if k A / L k k pCnt N 1 if k B / L k k pCnt N 1
139 92 adantl A B N A 0 B 0 N 0 k 1 N k
140 eleq1w n = k n k
141 oveq2 n = k A B / L n = A B / L k
142 oveq1 n = k n pCnt N = k pCnt N
143 141 142 oveq12d n = k A B / L n n pCnt N = A B / L k k pCnt N
144 140 143 ifbieq1d n = k if n A B / L n n pCnt N 1 = if k A B / L k k pCnt N 1
145 eqid n if n A B / L n n pCnt N 1 = n if n A B / L n n pCnt N 1
146 ovex A B / L k k pCnt N V
147 1ex 1 V
148 146 147 ifex if k A B / L k k pCnt N 1 V
149 144 145 148 fvmpt k n if n A B / L n n pCnt N 1 k = if k A B / L k k pCnt N 1
150 139 149 syl A B N A 0 B 0 N 0 k 1 N n if n A B / L n n pCnt N 1 k = if k A B / L k k pCnt N 1
151 oveq2 n = k A / L n = A / L k
152 151 142 oveq12d n = k A / L n n pCnt N = A / L k k pCnt N
153 140 152 ifbieq1d n = k if n A / L n n pCnt N 1 = if k A / L k k pCnt N 1
154 ovex A / L k k pCnt N V
155 154 147 ifex if k A / L k k pCnt N 1 V
156 153 89 155 fvmpt k n if n A / L n n pCnt N 1 k = if k A / L k k pCnt N 1
157 139 156 syl A B N A 0 B 0 N 0 k 1 N n if n A / L n n pCnt N 1 k = if k A / L k k pCnt N 1
158 oveq2 n = k B / L n = B / L k
159 158 142 oveq12d n = k B / L n n pCnt N = B / L k k pCnt N
160 140 159 ifbieq1d n = k if n B / L n n pCnt N 1 = if k B / L k k pCnt N 1
161 ovex B / L k k pCnt N V
162 161 147 ifex if k B / L k k pCnt N 1 V
163 160 97 162 fvmpt k n if n B / L n n pCnt N 1 k = if k B / L k k pCnt N 1
164 139 163 syl A B N A 0 B 0 N 0 k 1 N n if n B / L n n pCnt N 1 k = if k B / L k k pCnt N 1
165 157 164 oveq12d A B N A 0 B 0 N 0 k 1 N n if n A / L n n pCnt N 1 k n if n B / L n n pCnt N 1 k = if k A / L k k pCnt N 1 if k B / L k k pCnt N 1
166 138 150 165 3eqtr4d A B N A 0 B 0 N 0 k 1 N n if n A B / L n n pCnt N 1 k = n if n A / L n n pCnt N 1 k n if n B / L n n pCnt N 1 k
167 85 95 102 166 prodfmul A B N A 0 B 0 N 0 seq 1 × n if n A B / L n n pCnt N 1 N = seq 1 × n if n A / L n n pCnt N 1 N seq 1 × n if n B / L n n pCnt N 1 N
168 80 167 oveq12d A B N A 0 B 0 N 0 if N < 0 A B < 0 1 1 seq 1 × n if n A B / L n n pCnt N 1 N = if N < 0 A < 0 1 1 if N < 0 B < 0 1 1 seq 1 × n if n A / L n n pCnt N 1 N seq 1 × n if n B / L n n pCnt N 1 N
169 30 adantr A B N A 0 B 0 N 0 A B
170 145 lgsval4 A B N N 0 A B / L N = if N < 0 A B < 0 1 1 seq 1 × n if n A B / L n n pCnt N 1 N
171 169 87 88 170 syl3anc A B N A 0 B 0 N 0 A B / L N = if N < 0 A B < 0 1 1 seq 1 × n if n A B / L n n pCnt N 1 N
172 89 lgsval4 A N N 0 A / L N = if N < 0 A < 0 1 1 seq 1 × n if n A / L n n pCnt N 1 N
173 86 87 88 172 syl3anc A B N A 0 B 0 N 0 A / L N = if N < 0 A < 0 1 1 seq 1 × n if n A / L n n pCnt N 1 N
174 97 lgsval4 B N N 0 B / L N = if N < 0 B < 0 1 1 seq 1 × n if n B / L n n pCnt N 1 N
175 96 87 88 174 syl3anc A B N A 0 B 0 N 0 B / L N = if N < 0 B < 0 1 1 seq 1 × n if n B / L n n pCnt N 1 N
176 173 175 oveq12d A B N A 0 B 0 N 0 A / L N B / L N = if N < 0 A < 0 1 1 seq 1 × n if n A / L n n pCnt N 1 N if N < 0 B < 0 1 1 seq 1 × n if n B / L n n pCnt N 1 N
177 neg1cn 1
178 177 1 ifcli if N < 0 A < 0 1 1
179 178 a1i A B N A 0 B 0 N 0 if N < 0 A < 0 1 1
180 mulcl k x k x
181 180 adantl A B N A 0 B 0 N 0 k x k x
182 85 95 181 seqcl A B N A 0 B 0 N 0 seq 1 × n if n A / L n n pCnt N 1 N
183 177 1 ifcli if N < 0 B < 0 1 1
184 183 a1i A B N A 0 B 0 N 0 if N < 0 B < 0 1 1
185 85 102 181 seqcl A B N A 0 B 0 N 0 seq 1 × n if n B / L n n pCnt N 1 N
186 179 182 184 185 mul4d A B N A 0 B 0 N 0 if N < 0 A < 0 1 1 seq 1 × n if n A / L n n pCnt N 1 N if N < 0 B < 0 1 1 seq 1 × n if n B / L n n pCnt N 1 N = if N < 0 A < 0 1 1 if N < 0 B < 0 1 1 seq 1 × n if n A / L n n pCnt N 1 N seq 1 × n if n B / L n n pCnt N 1 N
187 176 186 eqtrd A B N A 0 B 0 N 0 A / L N B / L N = if N < 0 A < 0 1 1 if N < 0 B < 0 1 1 seq 1 × n if n A / L n n pCnt N 1 N seq 1 × n if n B / L n n pCnt N 1 N
188 168 171 187 3eqtr4d A B N A 0 B 0 N 0 A B / L N = A / L N B / L N
189 78 188 pm2.61dane A B N A 0 B 0 A B / L N = A / L N B / L N