Metamath Proof Explorer


Theorem 4sqlem11

Description: Lemma for 4sq . Use the pigeonhole principle to show that the sets { m ^ 2 | m e. ( 0 ... N ) } and { -u 1 - n ^ 2 | n e. ( 0 ... N ) } have a common element, mod P . (Contributed by Mario Carneiro, 15-Jul-2014)

Ref Expression
Hypotheses 4sq.1 S=n|xyzwn=x2+y2+z2+w2
4sq.2 φN
4sq.3 φP=2 N+1
4sq.4 φP
4sqlem11.5 A=u|m0Nu=m2modP
4sqlem11.6 F=vAP-1-v
Assertion 4sqlem11 φAranF

Proof

Step Hyp Ref Expression
1 4sq.1 S=n|xyzwn=x2+y2+z2+w2
2 4sq.2 φN
3 4sq.3 φP=2 N+1
4 4sq.4 φP
5 4sqlem11.5 A=u|m0Nu=m2modP
6 4sqlem11.6 F=vAP-1-v
7 fzfid φ0P1Fin
8 elfzelz m0Nm
9 zsqcl mm2
10 8 9 syl m0Nm2
11 prmnn PP
12 4 11 syl φP
13 zmodfz m2Pm2modP0P1
14 10 12 13 syl2anr φm0Nm2modP0P1
15 eleq1a m2modP0P1u=m2modPu0P1
16 14 15 syl φm0Nu=m2modPu0P1
17 16 rexlimdva φm0Nu=m2modPu0P1
18 17 abssdv φu|m0Nu=m2modP0P1
19 5 18 eqsstrid φA0P1
20 prmz PP
21 4 20 syl φP
22 peano2zm PP1
23 21 22 syl φP1
24 23 zcnd φP1
25 24 addlidd φ0+P-1=P1
26 25 oveq1d φ0+P1-v=P-1-v
27 26 adantr φvA0+P1-v=P-1-v
28 19 sselda φvAv0P1
29 fzrev3i v0P10+P1-v0P1
30 28 29 syl φvA0+P1-v0P1
31 27 30 eqeltrrd φvAP-1-v0P1
32 31 6 fmptd φF:A0P1
33 32 frnd φranF0P1
34 19 33 unssd φAranF0P1
35 7 34 ssfid φAranFFin
36 hashcl AranFFinAranF0
37 35 36 syl φAranF0
38 37 nn0red φAranF
39 21 zred φP
40 ssdomg 0P1FinAranF0P1AranF0P1
41 7 34 40 sylc φAranF0P1
42 hashdom AranFFin0P1FinAranF0P1AranF0P1
43 35 7 42 syl2anc φAranF0P1AranF0P1
44 41 43 mpbird φAranF0P1
45 fz01en P0P11P
46 21 45 syl φ0P11P
47 fzfid φ1PFin
48 hashen 0P1Fin1PFin0P1=1P0P11P
49 7 47 48 syl2anc φ0P1=1P0P11P
50 46 49 mpbird φ0P1=1P
51 12 nnnn0d φP0
52 hashfz1 P01P=P
53 51 52 syl φ1P=P
54 50 53 eqtrd φ0P1=P
55 44 54 breqtrd φAranFP
56 38 39 55 lensymd φ¬P<AranF
57 39 adantr φAranF=P
58 57 ltp1d φAranF=P<P+1
59 2 nncnd φN
60 1cnd φ1
61 59 59 60 60 add4d φN+N+1+1=N+1+N+1
62 3 oveq1d φP+1=2 N+1+1
63 2cn 2
64 mulcl 2N2 N
65 63 59 64 sylancr φ2 N
66 65 60 60 addassd φ2 N+1+1=2 N+1+1
67 59 2timesd φ2 N=N+N
68 67 oveq1d φ2 N+1+1=N+N+1+1
69 62 66 68 3eqtrd φP+1=N+N+1+1
70 14 ex φm0Nm2modP0P1
71 12 adantr φm0Nu0NP
72 8 ad2antrl φm0Nu0Nm
73 72 9 syl φm0Nu0Nm2
74 elfzelz u0Nu
75 74 ad2antll φm0Nu0Nu
76 zsqcl uu2
77 75 76 syl φm0Nu0Nu2
78 moddvds Pm2u2m2modP=u2modPPm2u2
79 71 73 77 78 syl3anc φm0Nu0Nm2modP=u2modPPm2u2
80 72 zcnd φm0Nu0Nm
81 75 zcnd φm0Nu0Nu
82 subsq mum2u2=m+umu
83 80 81 82 syl2anc φm0Nu0Nm2u2=m+umu
84 83 breq2d φm0Nu0NPm2u2Pm+umu
85 4 adantr φm0Nu0NP
86 72 75 zaddcld φm0Nu0Nm+u
87 72 75 zsubcld φm0Nu0Nmu
88 euclemma Pm+umuPm+umuPm+uPmu
89 85 86 87 88 syl3anc φm0Nu0NPm+umuPm+uPmu
90 79 84 89 3bitrd φm0Nu0Nm2modP=u2modPPm+uPmu
91 86 zred φm0Nu0Nm+u
92 2re 2
93 2 nnred φN
94 remulcl 2N2 N
95 92 93 94 sylancr φ2 N
96 95 adantr φm0Nu0N2 N
97 85 20 syl φm0Nu0NP
98 97 zred φm0Nu0NP
99 72 zred φm0Nu0Nm
100 75 zred φm0Nu0Nu
101 93 adantr φm0Nu0NN
102 elfzle2 m0NmN
103 102 ad2antrl φm0Nu0NmN
104 elfzle2 u0NuN
105 104 ad2antll φm0Nu0NuN
106 99 100 101 101 103 105 le2addd φm0Nu0Nm+uN+N
107 59 adantr φm0Nu0NN
108 107 2timesd φm0Nu0N2 N=N+N
109 106 108 breqtrrd φm0Nu0Nm+u2 N
110 95 ltp1d φ2 N<2 N+1
111 110 3 breqtrrd φ2 N<P
112 111 adantr φm0Nu0N2 N<P
113 91 96 98 109 112 lelttrd φm0Nu0Nm+u<P
114 91 98 ltnled φm0Nu0Nm+u<P¬Pm+u
115 113 114 mpbid φm0Nu0N¬Pm+u
116 115 adantr φm0Nu0Nmu¬Pm+u
117 21 ad2antrr φm0Nu0NmuP
118 86 adantr φm0Nu0Nmum+u
119 1red φm0Nu0Nmu1
120 nn0abscl mumu0
121 87 120 syl φm0Nu0Nmu0
122 121 nn0red φm0Nu0Nmu
123 122 adantr φm0Nu0Nmumu
124 118 zred φm0Nu0Nmum+u
125 121 adantr φm0Nu0Nmumu0
126 125 nn0zd φm0Nu0Nmumu
127 87 zcnd φm0Nu0Nmu
128 127 adantr φm0Nu0Nmumu
129 80 81 subeq0ad φm0Nu0Nmu=0m=u
130 129 necon3bid φm0Nu0Nmu0mu
131 130 biimpar φm0Nu0Nmumu0
132 128 131 absrpcld φm0Nu0Nmumu+
133 132 rpgt0d φm0Nu0Nmu0<mu
134 elnnz mumu0<mu
135 126 133 134 sylanbrc φm0Nu0Nmumu
136 135 nnge1d φm0Nu0Nmu1mu
137 0cnd φm0Nu0N0
138 80 81 137 abs3difd φm0Nu0Nmum0+0u
139 80 subid1d φm0Nu0Nm0=m
140 139 fveq2d φm0Nu0Nm0=m
141 elfzle1 m0N0m
142 141 ad2antrl φm0Nu0N0m
143 99 142 absidd φm0Nu0Nm=m
144 140 143 eqtrd φm0Nu0Nm0=m
145 0cn 0
146 abssub 0u0u=u0
147 145 81 146 sylancr φm0Nu0N0u=u0
148 81 subid1d φm0Nu0Nu0=u
149 148 fveq2d φm0Nu0Nu0=u
150 elfzle1 u0N0u
151 150 ad2antll φm0Nu0N0u
152 100 151 absidd φm0Nu0Nu=u
153 147 149 152 3eqtrd φm0Nu0N0u=u
154 144 153 oveq12d φm0Nu0Nm0+0u=m+u
155 138 154 breqtrd φm0Nu0Nmum+u
156 155 adantr φm0Nu0Nmumum+u
157 119 123 124 136 156 letrd φm0Nu0Nmu1m+u
158 elnnz1 m+um+u1m+u
159 118 157 158 sylanbrc φm0Nu0Nmum+u
160 dvdsle Pm+uPm+uPm+u
161 117 159 160 syl2anc φm0Nu0NmuPm+uPm+u
162 116 161 mtod φm0Nu0Nmu¬Pm+u
163 162 ex φm0Nu0Nmu¬Pm+u
164 163 necon4ad φm0Nu0NPm+um=u
165 dvdsabsb PmuPmuPmu
166 97 87 165 syl2anc φm0Nu0NPmuPmu
167 letr Pmum+uPmumum+uPm+u
168 98 122 91 167 syl3anc φm0Nu0NPmumum+uPm+u
169 155 168 mpan2d φm0Nu0NPmuPm+u
170 115 169 mtod φm0Nu0N¬Pmu
171 170 adantr φm0Nu0Nmu¬Pmu
172 97 adantr φm0Nu0NmuP
173 dvdsle PmuPmuPmu
174 172 135 173 syl2anc φm0Nu0NmuPmuPmu
175 171 174 mtod φm0Nu0Nmu¬Pmu
176 175 ex φm0Nu0Nmu¬Pmu
177 176 necon4ad φm0Nu0NPmum=u
178 166 177 sylbid φm0Nu0NPmum=u
179 164 178 jaod φm0Nu0NPm+uPmum=u
180 90 179 sylbid φm0Nu0Nm2modP=u2modPm=u
181 oveq1 m=um2=u2
182 181 oveq1d m=um2modP=u2modP
183 180 182 impbid1 φm0Nu0Nm2modP=u2modPm=u
184 183 ex φm0Nu0Nm2modP=u2modPm=u
185 70 184 dom2lem φm0Nm2modP:0N1-10P1
186 f1f1orn m0Nm2modP:0N1-10P1m0Nm2modP:0N1-1 ontoranm0Nm2modP
187 185 186 syl φm0Nm2modP:0N1-1 ontoranm0Nm2modP
188 eqid m0Nm2modP=m0Nm2modP
189 188 rnmpt ranm0Nm2modP=u|m0Nu=m2modP
190 5 189 eqtr4i A=ranm0Nm2modP
191 f1oeq3 A=ranm0Nm2modPm0Nm2modP:0N1-1 ontoAm0Nm2modP:0N1-1 ontoranm0Nm2modP
192 190 191 ax-mp m0Nm2modP:0N1-1 ontoAm0Nm2modP:0N1-1 ontoranm0Nm2modP
193 187 192 sylibr φm0Nm2modP:0N1-1 ontoA
194 ovex 0NV
195 194 f1oen m0Nm2modP:0N1-1 ontoA0NA
196 193 195 syl φ0NA
197 196 ensymd φA0N
198 ax-1cn 1
199 pncan N1N+1-1=N
200 59 198 199 sylancl φN+1-1=N
201 200 oveq2d φ0N+1-1=0N
202 2 nnnn0d φN0
203 peano2nn0 N0N+10
204 202 203 syl φN+10
205 204 nn0zd φN+1
206 fz01en N+10N+1-11N+1
207 205 206 syl φ0N+1-11N+1
208 201 207 eqbrtrrd φ0N1N+1
209 entr A0N0N1N+1A1N+1
210 197 208 209 syl2anc φA1N+1
211 7 19 ssfid φAFin
212 fzfid φ1N+1Fin
213 hashen AFin1N+1FinA=1N+1A1N+1
214 211 212 213 syl2anc φA=1N+1A1N+1
215 210 214 mpbird φA=1N+1
216 hashfz1 N+101N+1=N+1
217 204 216 syl φ1N+1=N+1
218 215 217 eqtrd φA=N+1
219 31 ex φvAP-1-v0P1
220 24 adantr φvAkAP1
221 fzssuz 0P10
222 uzssz 0
223 zsscn
224 222 223 sstri 0
225 221 224 sstri 0P1
226 19 225 sstrdi φA
227 226 sselda φvAv
228 227 adantrr φvAkAv
229 226 sselda φkAk
230 229 adantrl φvAkAk
231 220 228 230 subcanad φvAkAP-1-v=P-1-kv=k
232 231 ex φvAkAP-1-v=P-1-kv=k
233 219 232 dom2lem φvAP-1-v:A1-10P1
234 f1eq1 F=vAP-1-vF:A1-10P1vAP-1-v:A1-10P1
235 6 234 ax-mp F:A1-10P1vAP-1-v:A1-10P1
236 233 235 sylibr φF:A1-10P1
237 f1f1orn F:A1-10P1F:A1-1 ontoranF
238 236 237 syl φF:A1-1 ontoranF
239 211 238 hasheqf1od φA=ranF
240 239 218 eqtr3d φranF=N+1
241 218 240 oveq12d φA+ranF=N+1+N+1
242 61 69 241 3eqtr4d φP+1=A+ranF
243 242 adantr φAranF=P+1=A+ranF
244 211 adantr φAranF=AFin
245 7 33 ssfid φranFFin
246 245 adantr φAranF=ranFFin
247 simpr φAranF=AranF=
248 hashun AFinranFFinAranF=AranF=A+ranF
249 244 246 247 248 syl3anc φAranF=AranF=A+ranF
250 243 249 eqtr4d φAranF=P+1=AranF
251 58 250 breqtrd φAranF=P<AranF
252 251 ex φAranF=P<AranF
253 252 necon3bd φ¬P<AranFAranF
254 56 253 mpd φAranF