Metamath Proof Explorer


Theorem eulerthlem2

Description: Lemma for eulerth . (Contributed by Mario Carneiro, 28-Feb-2014)

Ref Expression
Hypotheses eulerth.1 φ N A A gcd N = 1
eulerth.2 S = y 0 ..^ N | y gcd N = 1
eulerth.3 T = 1 ϕ N
eulerth.4 φ F : T 1-1 onto S
eulerth.5 G = x T A F x mod N
Assertion eulerthlem2 φ A ϕ N mod N = 1 mod N

Proof

Step Hyp Ref Expression
1 eulerth.1 φ N A A gcd N = 1
2 eulerth.2 S = y 0 ..^ N | y gcd N = 1
3 eulerth.3 T = 1 ϕ N
4 eulerth.4 φ F : T 1-1 onto S
5 eulerth.5 G = x T A F x mod N
6 1 simp1d φ N
7 6 phicld φ ϕ N
8 7 nnred φ ϕ N
9 8 leidd φ ϕ N ϕ N
10 7 adantr φ ϕ N ϕ N ϕ N
11 breq1 x = 1 x ϕ N 1 ϕ N
12 11 anbi2d x = 1 φ x ϕ N φ 1 ϕ N
13 oveq2 x = 1 A x = A 1
14 fveq2 x = 1 seq 1 × F x = seq 1 × F 1
15 13 14 oveq12d x = 1 A x seq 1 × F x = A 1 seq 1 × F 1
16 15 oveq1d x = 1 A x seq 1 × F x mod N = A 1 seq 1 × F 1 mod N
17 fveq2 x = 1 seq 1 × G x = seq 1 × G 1
18 17 oveq1d x = 1 seq 1 × G x mod N = seq 1 × G 1 mod N
19 16 18 eqeq12d x = 1 A x seq 1 × F x mod N = seq 1 × G x mod N A 1 seq 1 × F 1 mod N = seq 1 × G 1 mod N
20 14 oveq2d x = 1 N gcd seq 1 × F x = N gcd seq 1 × F 1
21 20 eqeq1d x = 1 N gcd seq 1 × F x = 1 N gcd seq 1 × F 1 = 1
22 19 21 anbi12d x = 1 A x seq 1 × F x mod N = seq 1 × G x mod N N gcd seq 1 × F x = 1 A 1 seq 1 × F 1 mod N = seq 1 × G 1 mod N N gcd seq 1 × F 1 = 1
23 12 22 imbi12d x = 1 φ x ϕ N A x seq 1 × F x mod N = seq 1 × G x mod N N gcd seq 1 × F x = 1 φ 1 ϕ N A 1 seq 1 × F 1 mod N = seq 1 × G 1 mod N N gcd seq 1 × F 1 = 1
24 breq1 x = z x ϕ N z ϕ N
25 24 anbi2d x = z φ x ϕ N φ z ϕ N
26 oveq2 x = z A x = A z
27 fveq2 x = z seq 1 × F x = seq 1 × F z
28 26 27 oveq12d x = z A x seq 1 × F x = A z seq 1 × F z
29 28 oveq1d x = z A x seq 1 × F x mod N = A z seq 1 × F z mod N
30 fveq2 x = z seq 1 × G x = seq 1 × G z
31 30 oveq1d x = z seq 1 × G x mod N = seq 1 × G z mod N
32 29 31 eqeq12d x = z A x seq 1 × F x mod N = seq 1 × G x mod N A z seq 1 × F z mod N = seq 1 × G z mod N
33 27 oveq2d x = z N gcd seq 1 × F x = N gcd seq 1 × F z
34 33 eqeq1d x = z N gcd seq 1 × F x = 1 N gcd seq 1 × F z = 1
35 32 34 anbi12d x = z A x seq 1 × F x mod N = seq 1 × G x mod N N gcd seq 1 × F x = 1 A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1
36 25 35 imbi12d x = z φ x ϕ N A x seq 1 × F x mod N = seq 1 × G x mod N N gcd seq 1 × F x = 1 φ z ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1
37 breq1 x = z + 1 x ϕ N z + 1 ϕ N
38 37 anbi2d x = z + 1 φ x ϕ N φ z + 1 ϕ N
39 oveq2 x = z + 1 A x = A z + 1
40 fveq2 x = z + 1 seq 1 × F x = seq 1 × F z + 1
41 39 40 oveq12d x = z + 1 A x seq 1 × F x = A z + 1 seq 1 × F z + 1
42 41 oveq1d x = z + 1 A x seq 1 × F x mod N = A z + 1 seq 1 × F z + 1 mod N
43 fveq2 x = z + 1 seq 1 × G x = seq 1 × G z + 1
44 43 oveq1d x = z + 1 seq 1 × G x mod N = seq 1 × G z + 1 mod N
45 42 44 eqeq12d x = z + 1 A x seq 1 × F x mod N = seq 1 × G x mod N A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N
46 40 oveq2d x = z + 1 N gcd seq 1 × F x = N gcd seq 1 × F z + 1
47 46 eqeq1d x = z + 1 N gcd seq 1 × F x = 1 N gcd seq 1 × F z + 1 = 1
48 45 47 anbi12d x = z + 1 A x seq 1 × F x mod N = seq 1 × G x mod N N gcd seq 1 × F x = 1 A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N N gcd seq 1 × F z + 1 = 1
49 38 48 imbi12d x = z + 1 φ x ϕ N A x seq 1 × F x mod N = seq 1 × G x mod N N gcd seq 1 × F x = 1 φ z + 1 ϕ N A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N N gcd seq 1 × F z + 1 = 1
50 breq1 x = ϕ N x ϕ N ϕ N ϕ N
51 50 anbi2d x = ϕ N φ x ϕ N φ ϕ N ϕ N
52 oveq2 x = ϕ N A x = A ϕ N
53 fveq2 x = ϕ N seq 1 × F x = seq 1 × F ϕ N
54 52 53 oveq12d x = ϕ N A x seq 1 × F x = A ϕ N seq 1 × F ϕ N
55 54 oveq1d x = ϕ N A x seq 1 × F x mod N = A ϕ N seq 1 × F ϕ N mod N
56 fveq2 x = ϕ N seq 1 × G x = seq 1 × G ϕ N
57 56 oveq1d x = ϕ N seq 1 × G x mod N = seq 1 × G ϕ N mod N
58 55 57 eqeq12d x = ϕ N A x seq 1 × F x mod N = seq 1 × G x mod N A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N
59 53 oveq2d x = ϕ N N gcd seq 1 × F x = N gcd seq 1 × F ϕ N
60 59 eqeq1d x = ϕ N N gcd seq 1 × F x = 1 N gcd seq 1 × F ϕ N = 1
61 58 60 anbi12d x = ϕ N A x seq 1 × F x mod N = seq 1 × G x mod N N gcd seq 1 × F x = 1 A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N N gcd seq 1 × F ϕ N = 1
62 51 61 imbi12d x = ϕ N φ x ϕ N A x seq 1 × F x mod N = seq 1 × G x mod N N gcd seq 1 × F x = 1 φ ϕ N ϕ N A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N N gcd seq 1 × F ϕ N = 1
63 1 simp2d φ A
64 f1of F : T 1-1 onto S F : T S
65 4 64 syl φ F : T S
66 nnuz = 1
67 7 66 eleqtrdi φ ϕ N 1
68 eluzfz1 ϕ N 1 1 1 ϕ N
69 67 68 syl φ 1 1 ϕ N
70 69 3 eleqtrrdi φ 1 T
71 65 70 ffvelrnd φ F 1 S
72 oveq1 y = F 1 y gcd N = F 1 gcd N
73 72 eqeq1d y = F 1 y gcd N = 1 F 1 gcd N = 1
74 73 2 elrab2 F 1 S F 1 0 ..^ N F 1 gcd N = 1
75 71 74 sylib φ F 1 0 ..^ N F 1 gcd N = 1
76 75 simpld φ F 1 0 ..^ N
77 elfzoelz F 1 0 ..^ N F 1
78 76 77 syl φ F 1
79 63 78 zmulcld φ A F 1
80 79 zred φ A F 1
81 6 nnrpd φ N +
82 modabs2 A F 1 N + A F 1 mod N mod N = A F 1 mod N
83 80 81 82 syl2anc φ A F 1 mod N mod N = A F 1 mod N
84 1z 1
85 fveq2 x = 1 F x = F 1
86 85 oveq2d x = 1 A F x = A F 1
87 86 oveq1d x = 1 A F x mod N = A F 1 mod N
88 ovex A F 1 mod N V
89 87 5 88 fvmpt 1 T G 1 = A F 1 mod N
90 70 89 syl φ G 1 = A F 1 mod N
91 84 90 seq1i φ seq 1 × G 1 = A F 1 mod N
92 91 oveq1d φ seq 1 × G 1 mod N = A F 1 mod N mod N
93 63 zcnd φ A
94 93 exp1d φ A 1 = A
95 seq1 1 seq 1 × F 1 = F 1
96 84 95 ax-mp seq 1 × F 1 = F 1
97 96 a1i φ seq 1 × F 1 = F 1
98 94 97 oveq12d φ A 1 seq 1 × F 1 = A F 1
99 98 oveq1d φ A 1 seq 1 × F 1 mod N = A F 1 mod N
100 83 92 99 3eqtr4rd φ A 1 seq 1 × F 1 mod N = seq 1 × G 1 mod N
101 96 oveq2i N gcd seq 1 × F 1 = N gcd F 1
102 6 nnzd φ N
103 102 78 gcdcomd φ N gcd F 1 = F 1 gcd N
104 75 simprd φ F 1 gcd N = 1
105 103 104 eqtrd φ N gcd F 1 = 1
106 101 105 eqtrid φ N gcd seq 1 × F 1 = 1
107 100 106 jca φ A 1 seq 1 × F 1 mod N = seq 1 × G 1 mod N N gcd seq 1 × F 1 = 1
108 107 adantr φ 1 ϕ N A 1 seq 1 × F 1 mod N = seq 1 × G 1 mod N N gcd seq 1 × F 1 = 1
109 nnre z z
110 109 adantr z φ z
111 110 lep1d z φ z z + 1
112 peano2re z z + 1
113 110 112 syl z φ z + 1
114 8 adantl z φ ϕ N
115 letr z z + 1 ϕ N z z + 1 z + 1 ϕ N z ϕ N
116 110 113 114 115 syl3anc z φ z z + 1 z + 1 ϕ N z ϕ N
117 111 116 mpand z φ z + 1 ϕ N z ϕ N
118 117 imdistanda z φ z + 1 ϕ N φ z ϕ N
119 118 imim1d z φ z ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1 φ z + 1 ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1
120 63 adantr φ z z + 1 ϕ N A
121 nnnn0 z z 0
122 121 ad2antrl φ z z + 1 ϕ N z 0
123 zexpcl A z 0 A z
124 120 122 123 syl2anc φ z z + 1 ϕ N A z
125 simprl φ z z + 1 ϕ N z
126 125 66 eleqtrdi φ z z + 1 ϕ N z 1
127 109 ad2antrl φ z z + 1 ϕ N z
128 127 112 syl φ z z + 1 ϕ N z + 1
129 8 adantr φ z z + 1 ϕ N ϕ N
130 127 lep1d φ z z + 1 ϕ N z z + 1
131 simprr φ z z + 1 ϕ N z + 1 ϕ N
132 127 128 129 130 131 letrd φ z z + 1 ϕ N z ϕ N
133 nnz z z
134 133 ad2antrl φ z z + 1 ϕ N z
135 7 nnzd φ ϕ N
136 135 adantr φ z z + 1 ϕ N ϕ N
137 eluz z ϕ N ϕ N z z ϕ N
138 134 136 137 syl2anc φ z z + 1 ϕ N ϕ N z z ϕ N
139 132 138 mpbird φ z z + 1 ϕ N ϕ N z
140 fzss2 ϕ N z 1 z 1 ϕ N
141 139 140 syl φ z z + 1 ϕ N 1 z 1 ϕ N
142 141 3 sseqtrrdi φ z z + 1 ϕ N 1 z T
143 142 sselda φ z z + 1 ϕ N x 1 z x T
144 65 ffvelrnda φ x T F x S
145 oveq1 y = F x y gcd N = F x gcd N
146 145 eqeq1d y = F x y gcd N = 1 F x gcd N = 1
147 146 2 elrab2 F x S F x 0 ..^ N F x gcd N = 1
148 144 147 sylib φ x T F x 0 ..^ N F x gcd N = 1
149 148 simpld φ x T F x 0 ..^ N
150 elfzoelz F x 0 ..^ N F x
151 149 150 syl φ x T F x
152 151 adantlr φ z z + 1 ϕ N x T F x
153 143 152 syldan φ z z + 1 ϕ N x 1 z F x
154 zmulcl x y x y
155 154 adantl φ z z + 1 ϕ N x y x y
156 126 153 155 seqcl φ z z + 1 ϕ N seq 1 × F z
157 124 156 zmulcld φ z z + 1 ϕ N A z seq 1 × F z
158 157 zred φ z z + 1 ϕ N A z seq 1 × F z
159 2 ssrab3 S 0 ..^ N
160 1 2 3 4 5 eulerthlem1 φ G : T S
161 160 ffvelrnda φ x T G x S
162 159 161 sselid φ x T G x 0 ..^ N
163 elfzoelz G x 0 ..^ N G x
164 162 163 syl φ x T G x
165 164 adantlr φ z z + 1 ϕ N x T G x
166 143 165 syldan φ z z + 1 ϕ N x 1 z G x
167 126 166 155 seqcl φ z z + 1 ϕ N seq 1 × G z
168 167 zred φ z z + 1 ϕ N seq 1 × G z
169 65 adantr φ z z + 1 ϕ N F : T S
170 peano2nn z z + 1
171 170 ad2antrl φ z z + 1 ϕ N z + 1
172 171 nnge1d φ z z + 1 ϕ N 1 z + 1
173 171 nnzd φ z z + 1 ϕ N z + 1
174 elfz z + 1 1 ϕ N z + 1 1 ϕ N 1 z + 1 z + 1 ϕ N
175 84 174 mp3an2 z + 1 ϕ N z + 1 1 ϕ N 1 z + 1 z + 1 ϕ N
176 173 136 175 syl2anc φ z z + 1 ϕ N z + 1 1 ϕ N 1 z + 1 z + 1 ϕ N
177 172 131 176 mpbir2and φ z z + 1 ϕ N z + 1 1 ϕ N
178 177 3 eleqtrrdi φ z z + 1 ϕ N z + 1 T
179 169 178 ffvelrnd φ z z + 1 ϕ N F z + 1 S
180 oveq1 y = F z + 1 y gcd N = F z + 1 gcd N
181 180 eqeq1d y = F z + 1 y gcd N = 1 F z + 1 gcd N = 1
182 181 2 elrab2 F z + 1 S F z + 1 0 ..^ N F z + 1 gcd N = 1
183 179 182 sylib φ z z + 1 ϕ N F z + 1 0 ..^ N F z + 1 gcd N = 1
184 183 simpld φ z z + 1 ϕ N F z + 1 0 ..^ N
185 elfzoelz F z + 1 0 ..^ N F z + 1
186 184 185 syl φ z z + 1 ϕ N F z + 1
187 120 186 zmulcld φ z z + 1 ϕ N A F z + 1
188 81 adantr φ z z + 1 ϕ N N +
189 modmul1 A z seq 1 × F z seq 1 × G z A F z + 1 N + A z seq 1 × F z mod N = seq 1 × G z mod N A z seq 1 × F z A F z + 1 mod N = seq 1 × G z A F z + 1 mod N
190 189 3expia A z seq 1 × F z seq 1 × G z A F z + 1 N + A z seq 1 × F z mod N = seq 1 × G z mod N A z seq 1 × F z A F z + 1 mod N = seq 1 × G z A F z + 1 mod N
191 158 168 187 188 190 syl22anc φ z z + 1 ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N A z seq 1 × F z A F z + 1 mod N = seq 1 × G z A F z + 1 mod N
192 124 zcnd φ z z + 1 ϕ N A z
193 156 zcnd φ z z + 1 ϕ N seq 1 × F z
194 93 adantr φ z z + 1 ϕ N A
195 186 zcnd φ z z + 1 ϕ N F z + 1
196 192 193 194 195 mul4d φ z z + 1 ϕ N A z seq 1 × F z A F z + 1 = A z A seq 1 × F z F z + 1
197 194 122 expp1d φ z z + 1 ϕ N A z + 1 = A z A
198 seqp1 z 1 seq 1 × F z + 1 = seq 1 × F z F z + 1
199 126 198 syl φ z z + 1 ϕ N seq 1 × F z + 1 = seq 1 × F z F z + 1
200 197 199 oveq12d φ z z + 1 ϕ N A z + 1 seq 1 × F z + 1 = A z A seq 1 × F z F z + 1
201 196 200 eqtr4d φ z z + 1 ϕ N A z seq 1 × F z A F z + 1 = A z + 1 seq 1 × F z + 1
202 201 oveq1d φ z z + 1 ϕ N A z seq 1 × F z A F z + 1 mod N = A z + 1 seq 1 × F z + 1 mod N
203 187 zred φ z z + 1 ϕ N A F z + 1
204 203 188 modcld φ z z + 1 ϕ N A F z + 1 mod N
205 modabs2 A F z + 1 N + A F z + 1 mod N mod N = A F z + 1 mod N
206 203 188 205 syl2anc φ z z + 1 ϕ N A F z + 1 mod N mod N = A F z + 1 mod N
207 modmul1 A F z + 1 mod N A F z + 1 seq 1 × G z N + A F z + 1 mod N mod N = A F z + 1 mod N A F z + 1 mod N seq 1 × G z mod N = A F z + 1 seq 1 × G z mod N
208 204 203 167 188 206 207 syl221anc φ z z + 1 ϕ N A F z + 1 mod N seq 1 × G z mod N = A F z + 1 seq 1 × G z mod N
209 fveq2 x = z + 1 F x = F z + 1
210 209 oveq2d x = z + 1 A F x = A F z + 1
211 210 oveq1d x = z + 1 A F x mod N = A F z + 1 mod N
212 ovex A F z + 1 mod N V
213 211 5 212 fvmpt z + 1 T G z + 1 = A F z + 1 mod N
214 178 213 syl φ z z + 1 ϕ N G z + 1 = A F z + 1 mod N
215 214 oveq2d φ z z + 1 ϕ N seq 1 × G z G z + 1 = seq 1 × G z A F z + 1 mod N
216 seqp1 z 1 seq 1 × G z + 1 = seq 1 × G z G z + 1
217 126 216 syl φ z z + 1 ϕ N seq 1 × G z + 1 = seq 1 × G z G z + 1
218 204 recnd φ z z + 1 ϕ N A F z + 1 mod N
219 167 zcnd φ z z + 1 ϕ N seq 1 × G z
220 218 219 mulcomd φ z z + 1 ϕ N A F z + 1 mod N seq 1 × G z = seq 1 × G z A F z + 1 mod N
221 215 217 220 3eqtr4d φ z z + 1 ϕ N seq 1 × G z + 1 = A F z + 1 mod N seq 1 × G z
222 221 oveq1d φ z z + 1 ϕ N seq 1 × G z + 1 mod N = A F z + 1 mod N seq 1 × G z mod N
223 187 zcnd φ z z + 1 ϕ N A F z + 1
224 219 223 mulcomd φ z z + 1 ϕ N seq 1 × G z A F z + 1 = A F z + 1 seq 1 × G z
225 224 oveq1d φ z z + 1 ϕ N seq 1 × G z A F z + 1 mod N = A F z + 1 seq 1 × G z mod N
226 208 222 225 3eqtr4rd φ z z + 1 ϕ N seq 1 × G z A F z + 1 mod N = seq 1 × G z + 1 mod N
227 202 226 eqeq12d φ z z + 1 ϕ N A z seq 1 × F z A F z + 1 mod N = seq 1 × G z A F z + 1 mod N A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N
228 191 227 sylibd φ z z + 1 ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N
229 102 adantr φ z z + 1 ϕ N N
230 229 186 gcdcomd φ z z + 1 ϕ N N gcd F z + 1 = F z + 1 gcd N
231 183 simprd φ z z + 1 ϕ N F z + 1 gcd N = 1
232 230 231 eqtrd φ z z + 1 ϕ N N gcd F z + 1 = 1
233 rpmul N seq 1 × F z F z + 1 N gcd seq 1 × F z = 1 N gcd F z + 1 = 1 N gcd seq 1 × F z F z + 1 = 1
234 229 156 186 233 syl3anc φ z z + 1 ϕ N N gcd seq 1 × F z = 1 N gcd F z + 1 = 1 N gcd seq 1 × F z F z + 1 = 1
235 232 234 mpan2d φ z z + 1 ϕ N N gcd seq 1 × F z = 1 N gcd seq 1 × F z F z + 1 = 1
236 199 oveq2d φ z z + 1 ϕ N N gcd seq 1 × F z + 1 = N gcd seq 1 × F z F z + 1
237 236 eqeq1d φ z z + 1 ϕ N N gcd seq 1 × F z + 1 = 1 N gcd seq 1 × F z F z + 1 = 1
238 235 237 sylibrd φ z z + 1 ϕ N N gcd seq 1 × F z = 1 N gcd seq 1 × F z + 1 = 1
239 228 238 anim12d φ z z + 1 ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1 A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N N gcd seq 1 × F z + 1 = 1
240 239 an12s z φ z + 1 ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1 A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N N gcd seq 1 × F z + 1 = 1
241 240 ex z φ z + 1 ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1 A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N N gcd seq 1 × F z + 1 = 1
242 241 a2d z φ z + 1 ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1 φ z + 1 ϕ N A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N N gcd seq 1 × F z + 1 = 1
243 119 242 syld z φ z ϕ N A z seq 1 × F z mod N = seq 1 × G z mod N N gcd seq 1 × F z = 1 φ z + 1 ϕ N A z + 1 seq 1 × F z + 1 mod N = seq 1 × G z + 1 mod N N gcd seq 1 × F z + 1 = 1
244 23 36 49 62 108 243 nnind ϕ N φ ϕ N ϕ N A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N N gcd seq 1 × F ϕ N = 1
245 10 244 mpcom φ ϕ N ϕ N A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N N gcd seq 1 × F ϕ N = 1
246 9 245 mpdan φ A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N N gcd seq 1 × F ϕ N = 1
247 246 simpld φ A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N
248 7 nnnn0d φ ϕ N 0
249 zexpcl A ϕ N 0 A ϕ N
250 63 248 249 syl2anc φ A ϕ N
251 3 eleq2i x T x 1 ϕ N
252 251 151 sylan2br φ x 1 ϕ N F x
253 154 adantl φ x y x y
254 67 252 253 seqcl φ seq 1 × F ϕ N
255 250 254 zmulcld φ A ϕ N seq 1 × F ϕ N
256 mulcl x y x y
257 256 adantl φ x y x y
258 mulcom x y x y = y x
259 258 adantl φ x y x y = y x
260 mulass x y z x y z = x y z
261 260 adantl φ x y z x y z = x y z
262 ssidd φ
263 f1ocnv F : T 1-1 onto S F -1 : S 1-1 onto T
264 4 263 syl φ F -1 : S 1-1 onto T
265 6 adantr φ y T z T N
266 63 adantr φ y T z T A
267 65 ffvelrnda φ y T F y S
268 267 adantrr φ y T z T F y S
269 159 268 sselid φ y T z T F y 0 ..^ N
270 elfzoelz F y 0 ..^ N F y
271 269 270 syl φ y T z T F y
272 266 271 zmulcld φ y T z T A F y
273 65 ffvelrnda φ z T F z S
274 273 adantrl φ y T z T F z S
275 159 274 sselid φ y T z T F z 0 ..^ N
276 elfzoelz F z 0 ..^ N F z
277 275 276 syl φ y T z T F z
278 266 277 zmulcld φ y T z T A F z
279 moddvds N A F y A F z A F y mod N = A F z mod N N A F y A F z
280 265 272 278 279 syl3anc φ y T z T A F y mod N = A F z mod N N A F y A F z
281 fveq2 x = y F x = F y
282 281 oveq2d x = y A F x = A F y
283 282 oveq1d x = y A F x mod N = A F y mod N
284 ovex A F y mod N V
285 283 5 284 fvmpt y T G y = A F y mod N
286 fveq2 x = z F x = F z
287 286 oveq2d x = z A F x = A F z
288 287 oveq1d x = z A F x mod N = A F z mod N
289 ovex A F z mod N V
290 288 5 289 fvmpt z T G z = A F z mod N
291 285 290 eqeqan12d y T z T G y = G z A F y mod N = A F z mod N
292 291 adantl φ y T z T G y = G z A F y mod N = A F z mod N
293 93 adantr φ y T z T A
294 271 zcnd φ y T z T F y
295 277 zcnd φ y T z T F z
296 293 294 295 subdid φ y T z T A F y F z = A F y A F z
297 296 breq2d φ y T z T N A F y F z N A F y A F z
298 280 292 297 3bitr4d φ y T z T G y = G z N A F y F z
299 102 63 gcdcomd φ N gcd A = A gcd N
300 1 simp3d φ A gcd N = 1
301 299 300 eqtrd φ N gcd A = 1
302 301 adantr φ y T z T N gcd A = 1
303 102 adantr φ y T z T N
304 271 277 zsubcld φ y T z T F y F z
305 coprmdvds N A F y F z N A F y F z N gcd A = 1 N F y F z
306 303 266 304 305 syl3anc φ y T z T N A F y F z N gcd A = 1 N F y F z
307 271 zred φ y T z T F y
308 81 adantr φ y T z T N +
309 elfzole1 F y 0 ..^ N 0 F y
310 269 309 syl φ y T z T 0 F y
311 elfzolt2 F y 0 ..^ N F y < N
312 269 311 syl φ y T z T F y < N
313 modid F y N + 0 F y F y < N F y mod N = F y
314 307 308 310 312 313 syl22anc φ y T z T F y mod N = F y
315 277 zred φ y T z T F z
316 elfzole1 F z 0 ..^ N 0 F z
317 275 316 syl φ y T z T 0 F z
318 elfzolt2 F z 0 ..^ N F z < N
319 275 318 syl φ y T z T F z < N
320 modid F z N + 0 F z F z < N F z mod N = F z
321 315 308 317 319 320 syl22anc φ y T z T F z mod N = F z
322 314 321 eqeq12d φ y T z T F y mod N = F z mod N F y = F z
323 moddvds N F y F z F y mod N = F z mod N N F y F z
324 265 271 277 323 syl3anc φ y T z T F y mod N = F z mod N N F y F z
325 f1of1 F : T 1-1 onto S F : T 1-1 S
326 4 325 syl φ F : T 1-1 S
327 f1fveq F : T 1-1 S y T z T F y = F z y = z
328 326 327 sylan φ y T z T F y = F z y = z
329 322 324 328 3bitr3d φ y T z T N F y F z y = z
330 306 329 sylibd φ y T z T N A F y F z N gcd A = 1 y = z
331 302 330 mpan2d φ y T z T N A F y F z y = z
332 298 331 sylbid φ y T z T G y = G z y = z
333 332 ralrimivva φ y T z T G y = G z y = z
334 dff13 G : T 1-1 S G : T S y T z T G y = G z y = z
335 160 333 334 sylanbrc φ G : T 1-1 S
336 3 ovexi T V
337 336 f1oen F : T 1-1 onto S T S
338 4 337 syl φ T S
339 fzofi 0 ..^ N Fin
340 ssfi 0 ..^ N Fin S 0 ..^ N S Fin
341 339 159 340 mp2an S Fin
342 f1finf1o T S S Fin G : T 1-1 S G : T 1-1 onto S
343 338 341 342 sylancl φ G : T 1-1 S G : T 1-1 onto S
344 335 343 mpbid φ G : T 1-1 onto S
345 f1oco F -1 : S 1-1 onto T G : T 1-1 onto S F -1 G : T 1-1 onto T
346 264 344 345 syl2anc φ F -1 G : T 1-1 onto T
347 f1oeq23 T = 1 ϕ N T = 1 ϕ N F -1 G : T 1-1 onto T F -1 G : 1 ϕ N 1-1 onto 1 ϕ N
348 3 3 347 mp2an F -1 G : T 1-1 onto T F -1 G : 1 ϕ N 1-1 onto 1 ϕ N
349 346 348 sylib φ F -1 G : 1 ϕ N 1-1 onto 1 ϕ N
350 252 zcnd φ x 1 ϕ N F x
351 3 eleq2i w T w 1 ϕ N
352 fvco3 G : T S w T F -1 G w = F -1 G w
353 160 352 sylan φ w T F -1 G w = F -1 G w
354 353 fveq2d φ w T F F -1 G w = F F -1 G w
355 4 adantr φ w T F : T 1-1 onto S
356 160 ffvelrnda φ w T G w S
357 f1ocnvfv2 F : T 1-1 onto S G w S F F -1 G w = G w
358 355 356 357 syl2anc φ w T F F -1 G w = G w
359 354 358 eqtr2d φ w T G w = F F -1 G w
360 351 359 sylan2br φ w 1 ϕ N G w = F F -1 G w
361 257 259 261 67 262 349 350 360 seqf1o φ seq 1 × G ϕ N = seq 1 × F ϕ N
362 361 254 eqeltrd φ seq 1 × G ϕ N
363 moddvds N A ϕ N seq 1 × F ϕ N seq 1 × G ϕ N A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N N A ϕ N seq 1 × F ϕ N seq 1 × G ϕ N
364 6 255 362 363 syl3anc φ A ϕ N seq 1 × F ϕ N mod N = seq 1 × G ϕ N mod N N A ϕ N seq 1 × F ϕ N seq 1 × G ϕ N
365 247 364 mpbid φ N A ϕ N seq 1 × F ϕ N seq 1 × G ϕ N
366 254 zcnd φ seq 1 × F ϕ N
367 366 mulid2d φ 1 seq 1 × F ϕ N = seq 1 × F ϕ N
368 361 367 eqtr4d φ seq 1 × G ϕ N = 1 seq 1 × F ϕ N
369 368 oveq2d φ A ϕ N seq 1 × F ϕ N seq 1 × G ϕ N = A ϕ N seq 1 × F ϕ N 1 seq 1 × F ϕ N
370 250 zcnd φ A ϕ N
371 ax-1cn 1
372 subdir A ϕ N 1 seq 1 × F ϕ N A ϕ N 1 seq 1 × F ϕ N = A ϕ N seq 1 × F ϕ N 1 seq 1 × F ϕ N
373 371 372 mp3an2 A ϕ N seq 1 × F ϕ N A ϕ N 1 seq 1 × F ϕ N = A ϕ N seq 1 × F ϕ N 1 seq 1 × F ϕ N
374 370 366 373 syl2anc φ A ϕ N 1 seq 1 × F ϕ N = A ϕ N seq 1 × F ϕ N 1 seq 1 × F ϕ N
375 zsubcl A ϕ N 1 A ϕ N 1
376 250 84 375 sylancl φ A ϕ N 1
377 376 zcnd φ A ϕ N 1
378 377 366 mulcomd φ A ϕ N 1 seq 1 × F ϕ N = seq 1 × F ϕ N A ϕ N 1
379 369 374 378 3eqtr2d φ A ϕ N seq 1 × F ϕ N seq 1 × G ϕ N = seq 1 × F ϕ N A ϕ N 1
380 365 379 breqtrd φ N seq 1 × F ϕ N A ϕ N 1
381 246 simprd φ N gcd seq 1 × F ϕ N = 1
382 coprmdvds N seq 1 × F ϕ N A ϕ N 1 N seq 1 × F ϕ N A ϕ N 1 N gcd seq 1 × F ϕ N = 1 N A ϕ N 1
383 102 254 376 382 syl3anc φ N seq 1 × F ϕ N A ϕ N 1 N gcd seq 1 × F ϕ N = 1 N A ϕ N 1
384 380 381 383 mp2and φ N A ϕ N 1
385 moddvds N A ϕ N 1 A ϕ N mod N = 1 mod N N A ϕ N 1
386 84 385 mp3an3 N A ϕ N A ϕ N mod N = 1 mod N N A ϕ N 1
387 6 250 386 syl2anc φ A ϕ N mod N = 1 mod N N A ϕ N 1
388 384 387 mpbird φ A ϕ N mod N = 1 mod N