Metamath Proof Explorer


Theorem phiprmpw

Description: Value of the Euler phi function at a prime power. Theorem 2.5(a) in ApostolNT p. 28. (Contributed by Mario Carneiro, 24-Feb-2014)

Ref Expression
Assertion phiprmpw P K ϕ P K = P K 1 P 1

Proof

Step Hyp Ref Expression
1 prmnn P P
2 nnnn0 K K 0
3 nnexpcl P K 0 P K
4 1 2 3 syl2an P K P K
5 phival P K ϕ P K = x 1 P K | x gcd P K = 1
6 4 5 syl P K ϕ P K = x 1 P K | x gcd P K = 1
7 nnm1nn0 K K 1 0
8 nnexpcl P K 1 0 P K 1
9 1 7 8 syl2an P K P K 1
10 9 nncnd P K P K 1
11 1 nncnd P P
12 11 adantr P K P
13 ax-1cn 1
14 subdi P K 1 P 1 P K 1 P 1 = P K 1 P P K 1 1
15 13 14 mp3an3 P K 1 P P K 1 P 1 = P K 1 P P K 1 1
16 10 12 15 syl2anc P K P K 1 P 1 = P K 1 P P K 1 1
17 10 mulid1d P K P K 1 1 = P K 1
18 17 oveq2d P K P K 1 P P K 1 1 = P K 1 P P K 1
19 fzfi 1 P K Fin
20 ssrab2 x 1 P K | x gcd P K = 1 1 P K
21 ssfi 1 P K Fin x 1 P K | x gcd P K = 1 1 P K x 1 P K | x gcd P K = 1 Fin
22 19 20 21 mp2an x 1 P K | x gcd P K = 1 Fin
23 ssrab2 x 1 P K | P x 0 1 P K
24 ssfi 1 P K Fin x 1 P K | P x 0 1 P K x 1 P K | P x 0 Fin
25 19 23 24 mp2an x 1 P K | P x 0 Fin
26 inrab x 1 P K | x gcd P K = 1 x 1 P K | P x 0 = x 1 P K | x gcd P K = 1 P x 0
27 elfzelz x 1 P K x
28 prmz P P
29 rpexp P x K P K gcd x = 1 P gcd x = 1
30 28 29 syl3an1 P x K P K gcd x = 1 P gcd x = 1
31 30 3expa P x K P K gcd x = 1 P gcd x = 1
32 31 an32s P K x P K gcd x = 1 P gcd x = 1
33 simpr P K x x
34 zexpcl P K 0 P K
35 28 2 34 syl2an P K P K
36 35 adantr P K x P K
37 33 36 gcdcomd P K x x gcd P K = P K gcd x
38 37 eqeq1d P K x x gcd P K = 1 P K gcd x = 1
39 coprm P x ¬ P x P gcd x = 1
40 39 adantlr P K x ¬ P x P gcd x = 1
41 32 38 40 3bitr4d P K x x gcd P K = 1 ¬ P x
42 zcn x x
43 42 adantl P K x x
44 43 subid1d P K x x 0 = x
45 44 breq2d P K x P x 0 P x
46 45 notbid P K x ¬ P x 0 ¬ P x
47 41 46 bitr4d P K x x gcd P K = 1 ¬ P x 0
48 27 47 sylan2 P K x 1 P K x gcd P K = 1 ¬ P x 0
49 48 biimpd P K x 1 P K x gcd P K = 1 ¬ P x 0
50 imnan x gcd P K = 1 ¬ P x 0 ¬ x gcd P K = 1 P x 0
51 49 50 sylib P K x 1 P K ¬ x gcd P K = 1 P x 0
52 51 ralrimiva P K x 1 P K ¬ x gcd P K = 1 P x 0
53 rabeq0 x 1 P K | x gcd P K = 1 P x 0 = x 1 P K ¬ x gcd P K = 1 P x 0
54 52 53 sylibr P K x 1 P K | x gcd P K = 1 P x 0 =
55 26 54 eqtrid P K x 1 P K | x gcd P K = 1 x 1 P K | P x 0 =
56 hashun x 1 P K | x gcd P K = 1 Fin x 1 P K | P x 0 Fin x 1 P K | x gcd P K = 1 x 1 P K | P x 0 = x 1 P K | x gcd P K = 1 x 1 P K | P x 0 = x 1 P K | x gcd P K = 1 + x 1 P K | P x 0
57 22 25 55 56 mp3an12i P K x 1 P K | x gcd P K = 1 x 1 P K | P x 0 = x 1 P K | x gcd P K = 1 + x 1 P K | P x 0
58 unrab x 1 P K | x gcd P K = 1 x 1 P K | P x 0 = x 1 P K | x gcd P K = 1 P x 0
59 48 biimprd P K x 1 P K ¬ P x 0 x gcd P K = 1
60 59 con1d P K x 1 P K ¬ x gcd P K = 1 P x 0
61 60 orrd P K x 1 P K x gcd P K = 1 P x 0
62 61 ralrimiva P K x 1 P K x gcd P K = 1 P x 0
63 rabid2 1 P K = x 1 P K | x gcd P K = 1 P x 0 x 1 P K x gcd P K = 1 P x 0
64 62 63 sylibr P K 1 P K = x 1 P K | x gcd P K = 1 P x 0
65 58 64 eqtr4id P K x 1 P K | x gcd P K = 1 x 1 P K | P x 0 = 1 P K
66 65 fveq2d P K x 1 P K | x gcd P K = 1 x 1 P K | P x 0 = 1 P K
67 4 nnnn0d P K P K 0
68 hashfz1 P K 0 1 P K = P K
69 67 68 syl P K 1 P K = P K
70 expm1t P K P K = P K 1 P
71 11 70 sylan P K P K = P K 1 P
72 66 69 71 3eqtrd P K x 1 P K | x gcd P K = 1 x 1 P K | P x 0 = P K 1 P
73 1 adantr P K P
74 1zzd P K 1
75 nn0uz 0 = 0
76 1m1e0 1 1 = 0
77 76 fveq2i 1 1 = 0
78 75 77 eqtr4i 0 = 1 1
79 67 78 eleqtrdi P K P K 1 1
80 0zd P K 0
81 73 74 79 80 hashdvds P K x 1 P K | P x 0 = P K 0 P 1 - 1 - 0 P
82 4 nncnd P K P K
83 82 subid1d P K P K 0 = P K
84 83 oveq1d P K P K 0 P = P K P
85 73 nnne0d P K P 0
86 nnz K K
87 86 adantl P K K
88 12 85 87 expm1d P K P K 1 = P K P
89 84 88 eqtr4d P K P K 0 P = P K 1
90 89 fveq2d P K P K 0 P = P K 1
91 9 nnzd P K P K 1
92 flid P K 1 P K 1 = P K 1
93 91 92 syl P K P K 1 = P K 1
94 90 93 eqtrd P K P K 0 P = P K 1
95 76 oveq1i 1 - 1 - 0 = 0 0
96 0m0e0 0 0 = 0
97 95 96 eqtri 1 - 1 - 0 = 0
98 97 oveq1i 1 - 1 - 0 P = 0 P
99 12 85 div0d P K 0 P = 0
100 98 99 eqtrid P K 1 - 1 - 0 P = 0
101 100 fveq2d P K 1 - 1 - 0 P = 0
102 0z 0
103 flid 0 0 = 0
104 102 103 ax-mp 0 = 0
105 101 104 eqtrdi P K 1 - 1 - 0 P = 0
106 94 105 oveq12d P K P K 0 P 1 - 1 - 0 P = P K 1 0
107 10 subid1d P K P K 1 0 = P K 1
108 81 106 107 3eqtrd P K x 1 P K | P x 0 = P K 1
109 108 oveq2d P K x 1 P K | x gcd P K = 1 + x 1 P K | P x 0 = x 1 P K | x gcd P K = 1 + P K 1
110 hashcl x 1 P K | x gcd P K = 1 Fin x 1 P K | x gcd P K = 1 0
111 22 110 ax-mp x 1 P K | x gcd P K = 1 0
112 111 nn0cni x 1 P K | x gcd P K = 1
113 addcom x 1 P K | x gcd P K = 1 P K 1 x 1 P K | x gcd P K = 1 + P K 1 = P K 1 + x 1 P K | x gcd P K = 1
114 112 10 113 sylancr P K x 1 P K | x gcd P K = 1 + P K 1 = P K 1 + x 1 P K | x gcd P K = 1
115 109 114 eqtrd P K x 1 P K | x gcd P K = 1 + x 1 P K | P x 0 = P K 1 + x 1 P K | x gcd P K = 1
116 57 72 115 3eqtr3rd P K P K 1 + x 1 P K | x gcd P K = 1 = P K 1 P
117 10 12 mulcld P K P K 1 P
118 112 a1i P K x 1 P K | x gcd P K = 1
119 117 10 118 subaddd P K P K 1 P P K 1 = x 1 P K | x gcd P K = 1 P K 1 + x 1 P K | x gcd P K = 1 = P K 1 P
120 116 119 mpbird P K P K 1 P P K 1 = x 1 P K | x gcd P K = 1
121 16 18 120 3eqtrrd P K x 1 P K | x gcd P K = 1 = P K 1 P 1
122 6 121 eqtrd P K ϕ P K = P K 1 P 1