Metamath Proof Explorer


Theorem dfphi2

Description: Alternate definition of the Euler phi function. (Contributed by Mario Carneiro, 23-Feb-2014) (Revised by Mario Carneiro, 2-May-2016)

Ref Expression
Assertion dfphi2 N ϕ N = x 0 ..^ N | x gcd N = 1

Proof

Step Hyp Ref Expression
1 elnn1uz2 N N = 1 N 2
2 phi1 ϕ 1 = 1
3 0z 0
4 hashsng 0 0 = 1
5 3 4 ax-mp 0 = 1
6 rabid2 0 = x 0 | x gcd 1 = 1 x 0 x gcd 1 = 1
7 elsni x 0 x = 0
8 7 oveq1d x 0 x gcd 1 = 0 gcd 1
9 gcd1 0 0 gcd 1 = 1
10 3 9 ax-mp 0 gcd 1 = 1
11 8 10 eqtrdi x 0 x gcd 1 = 1
12 6 11 mprgbir 0 = x 0 | x gcd 1 = 1
13 12 fveq2i 0 = x 0 | x gcd 1 = 1
14 2 5 13 3eqtr2i ϕ 1 = x 0 | x gcd 1 = 1
15 fveq2 N = 1 ϕ N = ϕ 1
16 oveq2 N = 1 0 ..^ N = 0 ..^ 1
17 fzo01 0 ..^ 1 = 0
18 16 17 eqtrdi N = 1 0 ..^ N = 0
19 oveq2 N = 1 x gcd N = x gcd 1
20 19 eqeq1d N = 1 x gcd N = 1 x gcd 1 = 1
21 18 20 rabeqbidv N = 1 x 0 ..^ N | x gcd N = 1 = x 0 | x gcd 1 = 1
22 21 fveq2d N = 1 x 0 ..^ N | x gcd N = 1 = x 0 | x gcd 1 = 1
23 14 15 22 3eqtr4a N = 1 ϕ N = x 0 ..^ N | x gcd N = 1
24 eluz2nn N 2 N
25 phival N ϕ N = x 1 N | x gcd N = 1
26 24 25 syl N 2 ϕ N = x 1 N | x gcd N = 1
27 fzossfz 1 ..^ N 1 N
28 27 a1i N 2 1 ..^ N 1 N
29 sseqin2 1 ..^ N 1 N 1 N 1 ..^ N = 1 ..^ N
30 28 29 sylib N 2 1 N 1 ..^ N = 1 ..^ N
31 fzo0ss1 1 ..^ N 0 ..^ N
32 sseqin2 1 ..^ N 0 ..^ N 0 ..^ N 1 ..^ N = 1 ..^ N
33 31 32 mpbi 0 ..^ N 1 ..^ N = 1 ..^ N
34 30 33 eqtr4di N 2 1 N 1 ..^ N = 0 ..^ N 1 ..^ N
35 34 rabeqdv N 2 x 1 N 1 ..^ N | x gcd N = 1 = x 0 ..^ N 1 ..^ N | x gcd N = 1
36 inrab2 x 1 N | x gcd N = 1 1 ..^ N = x 1 N 1 ..^ N | x gcd N = 1
37 inrab2 x 0 ..^ N | x gcd N = 1 1 ..^ N = x 0 ..^ N 1 ..^ N | x gcd N = 1
38 35 36 37 3eqtr4g N 2 x 1 N | x gcd N = 1 1 ..^ N = x 0 ..^ N | x gcd N = 1 1 ..^ N
39 phibndlem N 2 x 1 N | x gcd N = 1 1 N 1
40 eluzelz N 2 N
41 fzoval N 1 ..^ N = 1 N 1
42 40 41 syl N 2 1 ..^ N = 1 N 1
43 39 42 sseqtrrd N 2 x 1 N | x gcd N = 1 1 ..^ N
44 df-ss x 1 N | x gcd N = 1 1 ..^ N x 1 N | x gcd N = 1 1 ..^ N = x 1 N | x gcd N = 1
45 43 44 sylib N 2 x 1 N | x gcd N = 1 1 ..^ N = x 1 N | x gcd N = 1
46 gcd0id N 0 gcd N = N
47 40 46 syl N 2 0 gcd N = N
48 eluzelre N 2 N
49 eluzge2nn0 N 2 N 0
50 49 nn0ge0d N 2 0 N
51 48 50 absidd N 2 N = N
52 47 51 eqtrd N 2 0 gcd N = N
53 eluz2b3 N 2 N N 1
54 53 simprbi N 2 N 1
55 52 54 eqnetrd N 2 0 gcd N 1
56 55 adantr N 2 x 0 ..^ N 0 gcd N 1
57 7 oveq1d x 0 x gcd N = 0 gcd N
58 57 17 eleq2s x 0 ..^ 1 x gcd N = 0 gcd N
59 58 neeq1d x 0 ..^ 1 x gcd N 1 0 gcd N 1
60 56 59 syl5ibrcom N 2 x 0 ..^ N x 0 ..^ 1 x gcd N 1
61 60 necon2bd N 2 x 0 ..^ N x gcd N = 1 ¬ x 0 ..^ 1
62 simpr N 2 x 0 ..^ N x 0 ..^ N
63 1z 1
64 fzospliti x 0 ..^ N 1 x 0 ..^ 1 x 1 ..^ N
65 62 63 64 sylancl N 2 x 0 ..^ N x 0 ..^ 1 x 1 ..^ N
66 65 ord N 2 x 0 ..^ N ¬ x 0 ..^ 1 x 1 ..^ N
67 61 66 syld N 2 x 0 ..^ N x gcd N = 1 x 1 ..^ N
68 67 ralrimiva N 2 x 0 ..^ N x gcd N = 1 x 1 ..^ N
69 rabss x 0 ..^ N | x gcd N = 1 1 ..^ N x 0 ..^ N x gcd N = 1 x 1 ..^ N
70 68 69 sylibr N 2 x 0 ..^ N | x gcd N = 1 1 ..^ N
71 df-ss x 0 ..^ N | x gcd N = 1 1 ..^ N x 0 ..^ N | x gcd N = 1 1 ..^ N = x 0 ..^ N | x gcd N = 1
72 70 71 sylib N 2 x 0 ..^ N | x gcd N = 1 1 ..^ N = x 0 ..^ N | x gcd N = 1
73 38 45 72 3eqtr3d N 2 x 1 N | x gcd N = 1 = x 0 ..^ N | x gcd N = 1
74 73 fveq2d N 2 x 1 N | x gcd N = 1 = x 0 ..^ N | x gcd N = 1
75 26 74 eqtrd N 2 ϕ N = x 0 ..^ N | x gcd N = 1
76 23 75 jaoi N = 1 N 2 ϕ N = x 0 ..^ N | x gcd N = 1
77 1 76 sylbi N ϕ N = x 0 ..^ N | x gcd N = 1