Metamath Proof Explorer


Theorem wilthlem2

Description: Lemma for wilth : induction step. The "hand proof" version of this theorem works by writing out the list of all numbers from 1 to P - 1 in pairs such that a number is paired with its inverse. Every number has a unique inverse different from itself except 1 and P - 1 , and so each pair multiplies to 1 , and 1 and P - 1 == -u 1 multiply to -u 1 , so the full product is equal to -u 1 . Here we make this precise by doing the product pair by pair.

The induction hypothesis says that every subset S of 1 ... ( P - 1 ) that is closed under inverse (i.e. all pairs are matched up) and contains P - 1 multiplies to -u 1 mod P . Given such a set, we take out one element z =/= P - 1 . If there are no such elements, then S = { P - 1 } which forms the base case. Otherwise, S \ { z , z ^ -u 1 } is also closed under inverse and contains P - 1 , so the induction hypothesis says that this equals -u 1 ; and the remaining two elements are either equal to each other, in which case wilthlem1 gives that z = 1 or P - 1 , and we've already excluded the second case, so the product gives 1 ; or z =/= z ^ -u 1 and their product is 1 . In either case the accumulated product is unaffected. (Contributed by Mario Carneiro, 24-Jan-2015) (Proof shortened by AV, 27-Jul-2019)

Ref Expression
Hypotheses wilthlem.t T = mulGrp fld
wilthlem.a A = x 𝒫 1 P 1 | P 1 x y x y P 2 mod P x
wilthlem2.p φ P
wilthlem2.s φ S A
wilthlem2.r φ s A s S T I s mod P = -1 mod P
Assertion wilthlem2 φ T I S mod P = -1 mod P

Proof

Step Hyp Ref Expression
1 wilthlem.t T = mulGrp fld
2 wilthlem.a A = x 𝒫 1 P 1 | P 1 x y x y P 2 mod P x
3 wilthlem2.p φ P
4 wilthlem2.s φ S A
5 wilthlem2.r φ s A s S T I s mod P = -1 mod P
6 simpr φ S P 1 S P 1
7 eleq2 x = S P 1 x P 1 S
8 eleq2 x = S y P 2 mod P x y P 2 mod P S
9 8 raleqbi1dv x = S y x y P 2 mod P x y S y P 2 mod P S
10 7 9 anbi12d x = S P 1 x y x y P 2 mod P x P 1 S y S y P 2 mod P S
11 10 2 elrab2 S A S 𝒫 1 P 1 P 1 S y S y P 2 mod P S
12 4 11 sylib φ S 𝒫 1 P 1 P 1 S y S y P 2 mod P S
13 12 simprd φ P 1 S y S y P 2 mod P S
14 13 simpld φ P 1 S
15 14 snssd φ P 1 S
16 15 adantr φ S P 1 P 1 S
17 6 16 eqssd φ S P 1 S = P 1
18 17 reseq2d φ S P 1 I S = I P 1
19 mptresid I P 1 = z P 1 z
20 18 19 eqtrdi φ S P 1 I S = z P 1 z
21 20 oveq2d φ S P 1 T I S = T z P 1 z
22 21 oveq1d φ S P 1 T I S mod P = T z P 1 z mod P
23 prmnn P P
24 3 23 syl φ P
25 24 nncnd φ P
26 ax-1cn 1
27 negsub P 1 P + -1 = P 1
28 25 26 27 sylancl φ P + -1 = P 1
29 neg1cn 1
30 addcom P 1 P + -1 = - 1 + P
31 25 29 30 sylancl φ P + -1 = - 1 + P
32 28 31 eqtr3d φ P 1 = - 1 + P
33 cnring fld Ring
34 1 ringmgp fld Ring T Mnd
35 33 34 mp1i φ T Mnd
36 nnm1nn0 P P 1 0
37 24 36 syl φ P 1 0
38 37 nn0cnd φ P 1
39 cnfldbas = Base fld
40 1 39 mgpbas = Base T
41 id z = P 1 z = P 1
42 40 41 gsumsn T Mnd P 1 P 1 T z P 1 z = P 1
43 35 38 38 42 syl3anc φ T z P 1 z = P 1
44 25 mulid2d φ 1 P = P
45 44 oveq2d φ - 1 + 1 P = - 1 + P
46 32 43 45 3eqtr4d φ T z P 1 z = - 1 + 1 P
47 46 oveq1d φ T z P 1 z mod P = - 1 + 1 P mod P
48 neg1rr 1
49 48 a1i φ 1
50 24 nnrpd φ P +
51 1zzd φ 1
52 modcyc 1 P + 1 - 1 + 1 P mod P = -1 mod P
53 49 50 51 52 syl3anc φ - 1 + 1 P mod P = -1 mod P
54 47 53 eqtrd φ T z P 1 z mod P = -1 mod P
55 54 adantr φ S P 1 T z P 1 z mod P = -1 mod P
56 22 55 eqtrd φ S P 1 T I S mod P = -1 mod P
57 56 ex φ S P 1 T I S mod P = -1 mod P
58 nss ¬ S P 1 z z S ¬ z P 1
59 cnfld1 1 = 1 fld
60 1 59 ringidval 1 = 0 T
61 cnfldmul × = fld
62 1 61 mgpplusg × = + T
63 cncrng fld CRing
64 1 crngmgp fld CRing T CMnd
65 63 64 ax-mp T CMnd
66 65 a1i φ z S ¬ z P 1 T CMnd
67 4 adantr φ z S ¬ z P 1 S A
68 f1oi I S : S 1-1 onto S
69 f1of I S : S 1-1 onto S I S : S S
70 68 69 ax-mp I S : S S
71 12 simpld φ S 𝒫 1 P 1
72 71 elpwid φ S 1 P 1
73 fzssz 1 P 1
74 72 73 sstrdi φ S
75 zsscn
76 74 75 sstrdi φ S
77 fss I S : S S S I S : S
78 70 76 77 sylancr φ I S : S
79 78 adantr φ z S ¬ z P 1 I S : S
80 fzfi 1 P 1 Fin
81 ssfi 1 P 1 Fin S 1 P 1 S Fin
82 80 72 81 sylancr φ S Fin
83 1ex 1 V
84 83 a1i φ 1 V
85 78 82 84 fdmfifsupp φ finSupp 1 I S
86 85 adantr φ z S ¬ z P 1 finSupp 1 I S
87 disjdif z z P 2 mod P S z z P 2 mod P =
88 87 a1i φ z S ¬ z P 1 z z P 2 mod P S z z P 2 mod P =
89 undif2 z z P 2 mod P S z z P 2 mod P = z z P 2 mod P S
90 simprl φ z S ¬ z P 1 z S
91 oveq1 y = z y P 2 = z P 2
92 91 oveq1d y = z y P 2 mod P = z P 2 mod P
93 92 eleq1d y = z y P 2 mod P S z P 2 mod P S
94 13 simprd φ y S y P 2 mod P S
95 94 adantr φ z S ¬ z P 1 y S y P 2 mod P S
96 93 95 90 rspcdva φ z S ¬ z P 1 z P 2 mod P S
97 90 96 prssd φ z S ¬ z P 1 z z P 2 mod P S
98 ssequn1 z z P 2 mod P S z z P 2 mod P S = S
99 97 98 sylib φ z S ¬ z P 1 z z P 2 mod P S = S
100 89 99 eqtr2id φ z S ¬ z P 1 S = z z P 2 mod P S z z P 2 mod P
101 40 60 62 66 67 79 86 88 100 gsumsplit φ z S ¬ z P 1 T I S = T I S z z P 2 mod P T I S S z z P 2 mod P
102 97 resabs1d φ z S ¬ z P 1 I S z z P 2 mod P = I z z P 2 mod P
103 102 oveq2d φ z S ¬ z P 1 T I S z z P 2 mod P = T I z z P 2 mod P
104 difss S z z P 2 mod P S
105 resabs1 S z z P 2 mod P S I S S z z P 2 mod P = I S z z P 2 mod P
106 104 105 ax-mp I S S z z P 2 mod P = I S z z P 2 mod P
107 106 oveq2i T I S S z z P 2 mod P = T I S z z P 2 mod P
108 107 a1i φ z S ¬ z P 1 T I S S z z P 2 mod P = T I S z z P 2 mod P
109 103 108 oveq12d φ z S ¬ z P 1 T I S z z P 2 mod P T I S S z z P 2 mod P = T I z z P 2 mod P T I S z z P 2 mod P
110 101 109 eqtrd φ z S ¬ z P 1 T I S = T I z z P 2 mod P T I S z z P 2 mod P
111 110 oveq1d φ z S ¬ z P 1 T I S mod P = T I z z P 2 mod P T I S z z P 2 mod P mod P
112 prfi z z P 2 mod P Fin
113 112 a1i φ z S ¬ z P 1 z z P 2 mod P Fin
114 zsubrg SubRing fld
115 1 subrgsubm SubRing fld SubMnd T
116 114 115 mp1i φ z S ¬ z P 1 SubMnd T
117 f1oi I z z P 2 mod P : z z P 2 mod P 1-1 onto z z P 2 mod P
118 f1of I z z P 2 mod P : z z P 2 mod P 1-1 onto z z P 2 mod P I z z P 2 mod P : z z P 2 mod P z z P 2 mod P
119 117 118 ax-mp I z z P 2 mod P : z z P 2 mod P z z P 2 mod P
120 74 adantr φ z S ¬ z P 1 S
121 97 120 sstrd φ z S ¬ z P 1 z z P 2 mod P
122 fss I z z P 2 mod P : z z P 2 mod P z z P 2 mod P z z P 2 mod P I z z P 2 mod P : z z P 2 mod P
123 119 121 122 sylancr φ z S ¬ z P 1 I z z P 2 mod P : z z P 2 mod P
124 83 a1i φ z S ¬ z P 1 1 V
125 123 113 124 fdmfifsupp φ z S ¬ z P 1 finSupp 1 I z z P 2 mod P
126 60 66 113 116 123 125 gsumsubmcl φ z S ¬ z P 1 T I z z P 2 mod P
127 126 zred φ z S ¬ z P 1 T I z z P 2 mod P
128 1red φ z S ¬ z P 1 1
129 72 adantr φ z S ¬ z P 1 S 1 P 1
130 129 ssdifssd φ z S ¬ z P 1 S z z P 2 mod P 1 P 1
131 ssfi 1 P 1 Fin S z z P 2 mod P 1 P 1 S z z P 2 mod P Fin
132 80 130 131 sylancr φ z S ¬ z P 1 S z z P 2 mod P Fin
133 f1oi I S z z P 2 mod P : S z z P 2 mod P 1-1 onto S z z P 2 mod P
134 f1of I S z z P 2 mod P : S z z P 2 mod P 1-1 onto S z z P 2 mod P I S z z P 2 mod P : S z z P 2 mod P S z z P 2 mod P
135 133 134 ax-mp I S z z P 2 mod P : S z z P 2 mod P S z z P 2 mod P
136 120 ssdifssd φ z S ¬ z P 1 S z z P 2 mod P
137 fss I S z z P 2 mod P : S z z P 2 mod P S z z P 2 mod P S z z P 2 mod P I S z z P 2 mod P : S z z P 2 mod P
138 135 136 137 sylancr φ z S ¬ z P 1 I S z z P 2 mod P : S z z P 2 mod P
139 138 132 124 fdmfifsupp φ z S ¬ z P 1 finSupp 1 I S z z P 2 mod P
140 60 66 132 116 138 139 gsumsubmcl φ z S ¬ z P 1 T I S z z P 2 mod P
141 50 adantr φ z S ¬ z P 1 P +
142 35 adantr φ z S ¬ z P 1 T Mnd
143 76 adantr φ z S ¬ z P 1 S
144 143 90 sseldd φ z S ¬ z P 1 z
145 id w = z w = z
146 40 145 gsumsn T Mnd z z T w z w = z
147 142 144 144 146 syl3anc φ z S ¬ z P 1 T w z w = z
148 147 adantr φ z S ¬ z P 1 z = 1 T w z w = z
149 mptresid I z = w z w
150 dfsn2 z = z z
151 animorrl φ z S ¬ z P 1 z = 1 z = 1 z = P 1
152 3 adantr φ z S ¬ z P 1 P
153 129 90 sseldd φ z S ¬ z P 1 z 1 P 1
154 wilthlem1 P z 1 P 1 z = z P 2 mod P z = 1 z = P 1
155 152 153 154 syl2anc φ z S ¬ z P 1 z = z P 2 mod P z = 1 z = P 1
156 155 biimpar φ z S ¬ z P 1 z = 1 z = P 1 z = z P 2 mod P
157 151 156 syldan φ z S ¬ z P 1 z = 1 z = z P 2 mod P
158 157 preq2d φ z S ¬ z P 1 z = 1 z z = z z P 2 mod P
159 150 158 eqtrid φ z S ¬ z P 1 z = 1 z = z z P 2 mod P
160 159 reseq2d φ z S ¬ z P 1 z = 1 I z = I z z P 2 mod P
161 149 160 eqtr3id φ z S ¬ z P 1 z = 1 w z w = I z z P 2 mod P
162 161 oveq2d φ z S ¬ z P 1 z = 1 T w z w = T I z z P 2 mod P
163 simpr φ z S ¬ z P 1 z = 1 z = 1
164 148 162 163 3eqtr3d φ z S ¬ z P 1 z = 1 T I z z P 2 mod P = 1
165 164 oveq1d φ z S ¬ z P 1 z = 1 T I z z P 2 mod P mod P = 1 mod P
166 df-pr z z P 2 mod P = z z P 2 mod P
167 166 reseq2i I z z P 2 mod P = I z z P 2 mod P
168 mptresid I z z P 2 mod P = w z z P 2 mod P w
169 167 168 eqtri I z z P 2 mod P = w z z P 2 mod P w
170 169 oveq2i T I z z P 2 mod P = T w z z P 2 mod P w
171 65 a1i φ z S ¬ z P 1 z 1 T CMnd
172 snfi z Fin
173 172 a1i φ z S ¬ z P 1 z 1 z Fin
174 elsni w z w = z
175 174 adantl φ z S ¬ z P 1 w z w = z
176 144 adantr φ z S ¬ z P 1 w z z
177 175 176 eqeltrd φ z S ¬ z P 1 w z w
178 177 adantlr φ z S ¬ z P 1 z 1 w z w
179 143 96 sseldd φ z S ¬ z P 1 z P 2 mod P
180 179 adantr φ z S ¬ z P 1 z 1 z P 2 mod P
181 simprr φ z S ¬ z P 1 ¬ z P 1
182 velsn z P 1 z = P 1
183 181 182 sylnib φ z S ¬ z P 1 ¬ z = P 1
184 biorf ¬ z = P 1 z = 1 z = P 1 z = 1
185 183 184 syl φ z S ¬ z P 1 z = 1 z = P 1 z = 1
186 ovex z P 2 mod P V
187 186 elsn z P 2 mod P z z P 2 mod P = z
188 eqcom z P 2 mod P = z z = z P 2 mod P
189 187 188 bitri z P 2 mod P z z = z P 2 mod P
190 orcom z = P 1 z = 1 z = 1 z = P 1
191 155 189 190 3bitr4g φ z S ¬ z P 1 z P 2 mod P z z = P 1 z = 1
192 185 191 bitr4d φ z S ¬ z P 1 z = 1 z P 2 mod P z
193 192 necon3abid φ z S ¬ z P 1 z 1 ¬ z P 2 mod P z
194 193 biimpa φ z S ¬ z P 1 z 1 ¬ z P 2 mod P z
195 id w = z P 2 mod P w = z P 2 mod P
196 40 62 171 173 178 180 194 180 195 gsumunsn φ z S ¬ z P 1 z 1 T w z z P 2 mod P w = T w z w z P 2 mod P
197 170 196 eqtrid φ z S ¬ z P 1 z 1 T I z z P 2 mod P = T w z w z P 2 mod P
198 147 adantr φ z S ¬ z P 1 z 1 T w z w = z
199 198 oveq1d φ z S ¬ z P 1 z 1 T w z w z P 2 mod P = z z P 2 mod P
200 197 199 eqtrd φ z S ¬ z P 1 z 1 T I z z P 2 mod P = z z P 2 mod P
201 200 oveq1d φ z S ¬ z P 1 z 1 T I z z P 2 mod P mod P = z z P 2 mod P mod P
202 153 elfzelzd φ z S ¬ z P 1 z
203 24 adantr φ z S ¬ z P 1 P
204 fzm1ndvds P z 1 P 1 ¬ P z
205 203 153 204 syl2anc φ z S ¬ z P 1 ¬ P z
206 eqid z P 2 mod P = z P 2 mod P
207 206 prmdiv P z ¬ P z z P 2 mod P 1 P 1 P z z P 2 mod P 1
208 152 202 205 207 syl3anc φ z S ¬ z P 1 z P 2 mod P 1 P 1 P z z P 2 mod P 1
209 208 simprd φ z S ¬ z P 1 P z z P 2 mod P 1
210 elfznn z 1 P 1 z
211 153 210 syl φ z S ¬ z P 1 z
212 129 96 sseldd φ z S ¬ z P 1 z P 2 mod P 1 P 1
213 elfznn z P 2 mod P 1 P 1 z P 2 mod P
214 212 213 syl φ z S ¬ z P 1 z P 2 mod P
215 211 214 nnmulcld φ z S ¬ z P 1 z z P 2 mod P
216 215 nnzd φ z S ¬ z P 1 z z P 2 mod P
217 1zzd φ z S ¬ z P 1 1
218 moddvds P z z P 2 mod P 1 z z P 2 mod P mod P = 1 mod P P z z P 2 mod P 1
219 203 216 217 218 syl3anc φ z S ¬ z P 1 z z P 2 mod P mod P = 1 mod P P z z P 2 mod P 1
220 209 219 mpbird φ z S ¬ z P 1 z z P 2 mod P mod P = 1 mod P
221 220 adantr φ z S ¬ z P 1 z 1 z z P 2 mod P mod P = 1 mod P
222 201 221 eqtrd φ z S ¬ z P 1 z 1 T I z z P 2 mod P mod P = 1 mod P
223 165 222 pm2.61dane φ z S ¬ z P 1 T I z z P 2 mod P mod P = 1 mod P
224 modmul1 T I z z P 2 mod P 1 T I S z z P 2 mod P P + T I z z P 2 mod P mod P = 1 mod P T I z z P 2 mod P T I S z z P 2 mod P mod P = 1 T I S z z P 2 mod P mod P
225 127 128 140 141 223 224 syl221anc φ z S ¬ z P 1 T I z z P 2 mod P T I S z z P 2 mod P mod P = 1 T I S z z P 2 mod P mod P
226 140 zcnd φ z S ¬ z P 1 T I S z z P 2 mod P
227 226 mulid2d φ z S ¬ z P 1 1 T I S z z P 2 mod P = T I S z z P 2 mod P
228 227 oveq1d φ z S ¬ z P 1 1 T I S z z P 2 mod P mod P = T I S z z P 2 mod P mod P
229 sseqin2 z z P 2 mod P S S z z P 2 mod P = z z P 2 mod P
230 97 229 sylib φ z S ¬ z P 1 S z z P 2 mod P = z z P 2 mod P
231 vex z V
232 231 prnz z z P 2 mod P
233 232 a1i φ z S ¬ z P 1 z z P 2 mod P
234 230 233 eqnetrd φ z S ¬ z P 1 S z z P 2 mod P
235 disj4 S z z P 2 mod P = ¬ S z z P 2 mod P S
236 235 necon2abii S z z P 2 mod P S S z z P 2 mod P
237 234 236 sylibr φ z S ¬ z P 1 S z z P 2 mod P S
238 psseq1 s = S z z P 2 mod P s S S z z P 2 mod P S
239 reseq2 s = S z z P 2 mod P I s = I S z z P 2 mod P
240 239 oveq2d s = S z z P 2 mod P T I s = T I S z z P 2 mod P
241 240 oveq1d s = S z z P 2 mod P T I s mod P = T I S z z P 2 mod P mod P
242 241 eqeq1d s = S z z P 2 mod P T I s mod P = -1 mod P T I S z z P 2 mod P mod P = -1 mod P
243 238 242 imbi12d s = S z z P 2 mod P s S T I s mod P = -1 mod P S z z P 2 mod P S T I S z z P 2 mod P mod P = -1 mod P
244 5 adantr φ z S ¬ z P 1 s A s S T I s mod P = -1 mod P
245 ovex 1 P 1 V
246 245 elpw2 S z z P 2 mod P 𝒫 1 P 1 S z z P 2 mod P 1 P 1
247 130 246 sylibr φ z S ¬ z P 1 S z z P 2 mod P 𝒫 1 P 1
248 14 adantr φ z S ¬ z P 1 P 1 S
249 eqcom z = P 1 P 1 = z
250 182 249 bitri z P 1 P 1 = z
251 181 250 sylnib φ z S ¬ z P 1 ¬ P 1 = z
252 oveq1 P 1 = z P 2 mod P P 1 P 2 = z P 2 mod P P 2
253 252 oveq1d P 1 = z P 2 mod P P 1 P 2 mod P = z P 2 mod P P 2 mod P
254 203 36 syl φ z S ¬ z P 1 P 1 0
255 nn0uz 0 = 0
256 254 255 eleqtrdi φ z S ¬ z P 1 P 1 0
257 eluzfz2 P 1 0 P 1 0 P 1
258 256 257 syl φ z S ¬ z P 1 P 1 0 P 1
259 prmz P P
260 152 259 syl φ z S ¬ z P 1 P
261 120 248 sseldd φ z S ¬ z P 1 P 1
262 1z 1
263 zsubcl P 1 1 P - 1 - 1
264 261 262 263 sylancl φ z S ¬ z P 1 P - 1 - 1
265 dvdsmul1 P P - 1 - 1 P P P - 1 - 1
266 260 264 265 syl2anc φ z S ¬ z P 1 P P P - 1 - 1
267 203 nncnd φ z S ¬ z P 1 P
268 264 zcnd φ z S ¬ z P 1 P - 1 - 1
269 267 268 mulcld φ z S ¬ z P 1 P P - 1 - 1
270 1cnd φ z S ¬ z P 1 1
271 254 nn0cnd φ z S ¬ z P 1 P 1
272 267 270 271 subdird φ z S ¬ z P 1 P 1 P 1 = P P 1 1 P 1
273 267 271 mulcld φ z S ¬ z P 1 P P 1
274 273 267 270 subsubd φ z S ¬ z P 1 P P 1 P 1 = P P 1 - P + 1
275 271 mulid2d φ z S ¬ z P 1 1 P 1 = P 1
276 275 oveq2d φ z S ¬ z P 1 P P 1 1 P 1 = P P 1 P 1
277 267 271 muls1d φ z S ¬ z P 1 P P - 1 - 1 = P P 1 P
278 277 oveq1d φ z S ¬ z P 1 P P - 1 - 1 + 1 = P P 1 - P + 1
279 274 276 278 3eqtr4d φ z S ¬ z P 1 P P 1 1 P 1 = P P - 1 - 1 + 1
280 272 279 eqtrd φ z S ¬ z P 1 P 1 P 1 = P P - 1 - 1 + 1
281 269 270 280 mvrraddd φ z S ¬ z P 1 P 1 P 1 1 = P P - 1 - 1
282 266 281 breqtrrd φ z S ¬ z P 1 P P 1 P 1 1
283 129 248 sseldd φ z S ¬ z P 1 P 1 1 P 1
284 fzm1ndvds P P 1 1 P 1 ¬ P P 1
285 203 283 284 syl2anc φ z S ¬ z P 1 ¬ P P 1
286 eqid P 1 P 2 mod P = P 1 P 2 mod P
287 286 prmdiveq P P 1 ¬ P P 1 P 1 0 P 1 P P 1 P 1 1 P 1 = P 1 P 2 mod P
288 152 261 285 287 syl3anc φ z S ¬ z P 1 P 1 0 P 1 P P 1 P 1 1 P 1 = P 1 P 2 mod P
289 258 282 288 mpbi2and φ z S ¬ z P 1 P 1 = P 1 P 2 mod P
290 206 prmdivdiv P z 1 P 1 z = z P 2 mod P P 2 mod P
291 152 153 290 syl2anc φ z S ¬ z P 1 z = z P 2 mod P P 2 mod P
292 289 291 eqeq12d φ z S ¬ z P 1 P 1 = z P 1 P 2 mod P = z P 2 mod P P 2 mod P
293 253 292 syl5ibr φ z S ¬ z P 1 P 1 = z P 2 mod P P 1 = z
294 251 293 mtod φ z S ¬ z P 1 ¬ P 1 = z P 2 mod P
295 ioran ¬ P 1 = z P 1 = z P 2 mod P ¬ P 1 = z ¬ P 1 = z P 2 mod P
296 251 294 295 sylanbrc φ z S ¬ z P 1 ¬ P 1 = z P 1 = z P 2 mod P
297 ovex P 1 V
298 297 elpr P 1 z z P 2 mod P P 1 = z P 1 = z P 2 mod P
299 296 298 sylnibr φ z S ¬ z P 1 ¬ P 1 z z P 2 mod P
300 248 299 eldifd φ z S ¬ z P 1 P 1 S z z P 2 mod P
301 eldifi y S z z P 2 mod P y S
302 95 r19.21bi φ z S ¬ z P 1 y S y P 2 mod P S
303 301 302 sylan2 φ z S ¬ z P 1 y S z z P 2 mod P y P 2 mod P S
304 eldif y S z z P 2 mod P y S ¬ y z z P 2 mod P
305 152 adantr φ z S ¬ z P 1 y S P
306 129 sselda φ z S ¬ z P 1 y S y 1 P 1
307 eqid y P 2 mod P = y P 2 mod P
308 307 prmdivdiv P y 1 P 1 y = y P 2 mod P P 2 mod P
309 305 306 308 syl2anc φ z S ¬ z P 1 y S y = y P 2 mod P P 2 mod P
310 oveq1 y P 2 mod P = z y P 2 mod P P 2 = z P 2
311 310 oveq1d y P 2 mod P = z y P 2 mod P P 2 mod P = z P 2 mod P
312 311 eqeq2d y P 2 mod P = z y = y P 2 mod P P 2 mod P y = z P 2 mod P
313 309 312 syl5ibcom φ z S ¬ z P 1 y S y P 2 mod P = z y = z P 2 mod P
314 oveq1 y P 2 mod P = z P 2 mod P y P 2 mod P P 2 = z P 2 mod P P 2
315 314 oveq1d y P 2 mod P = z P 2 mod P y P 2 mod P P 2 mod P = z P 2 mod P P 2 mod P
316 291 adantr φ z S ¬ z P 1 y S z = z P 2 mod P P 2 mod P
317 309 316 eqeq12d φ z S ¬ z P 1 y S y = z y P 2 mod P P 2 mod P = z P 2 mod P P 2 mod P
318 315 317 syl5ibr φ z S ¬ z P 1 y S y P 2 mod P = z P 2 mod P y = z
319 313 318 orim12d φ z S ¬ z P 1 y S y P 2 mod P = z y P 2 mod P = z P 2 mod P y = z P 2 mod P y = z
320 ovex y P 2 mod P V
321 320 elpr y P 2 mod P z z P 2 mod P y P 2 mod P = z y P 2 mod P = z P 2 mod P
322 vex y V
323 322 elpr y z z P 2 mod P y = z y = z P 2 mod P
324 orcom y = z y = z P 2 mod P y = z P 2 mod P y = z
325 323 324 bitri y z z P 2 mod P y = z P 2 mod P y = z
326 319 321 325 3imtr4g φ z S ¬ z P 1 y S y P 2 mod P z z P 2 mod P y z z P 2 mod P
327 326 con3d φ z S ¬ z P 1 y S ¬ y z z P 2 mod P ¬ y P 2 mod P z z P 2 mod P
328 327 impr φ z S ¬ z P 1 y S ¬ y z z P 2 mod P ¬ y P 2 mod P z z P 2 mod P
329 304 328 sylan2b φ z S ¬ z P 1 y S z z P 2 mod P ¬ y P 2 mod P z z P 2 mod P
330 303 329 eldifd φ z S ¬ z P 1 y S z z P 2 mod P y P 2 mod P S z z P 2 mod P
331 330 ralrimiva φ z S ¬ z P 1 y S z z P 2 mod P y P 2 mod P S z z P 2 mod P
332 300 331 jca φ z S ¬ z P 1 P 1 S z z P 2 mod P y S z z P 2 mod P y P 2 mod P S z z P 2 mod P
333 eleq2 x = S z z P 2 mod P P 1 x P 1 S z z P 2 mod P
334 eleq2 x = S z z P 2 mod P y P 2 mod P x y P 2 mod P S z z P 2 mod P
335 334 raleqbi1dv x = S z z P 2 mod P y x y P 2 mod P x y S z z P 2 mod P y P 2 mod P S z z P 2 mod P
336 333 335 anbi12d x = S z z P 2 mod P P 1 x y x y P 2 mod P x P 1 S z z P 2 mod P y S z z P 2 mod P y P 2 mod P S z z P 2 mod P
337 336 2 elrab2 S z z P 2 mod P A S z z P 2 mod P 𝒫 1 P 1 P 1 S z z P 2 mod P y S z z P 2 mod P y P 2 mod P S z z P 2 mod P
338 247 332 337 sylanbrc φ z S ¬ z P 1 S z z P 2 mod P A
339 243 244 338 rspcdva φ z S ¬ z P 1 S z z P 2 mod P S T I S z z P 2 mod P mod P = -1 mod P
340 237 339 mpd φ z S ¬ z P 1 T I S z z P 2 mod P mod P = -1 mod P
341 228 340 eqtrd φ z S ¬ z P 1 1 T I S z z P 2 mod P mod P = -1 mod P
342 111 225 341 3eqtrd φ z S ¬ z P 1 T I S mod P = -1 mod P
343 342 ex φ z S ¬ z P 1 T I S mod P = -1 mod P
344 343 exlimdv φ z z S ¬ z P 1 T I S mod P = -1 mod P
345 58 344 syl5bi φ ¬ S P 1 T I S mod P = -1 mod P
346 57 345 pm2.61d φ T I S mod P = -1 mod P