Metamath Proof Explorer


Theorem dchrhash

Description: There are exactly phi ( N ) Dirichlet characters modulo N . Part of Theorem 6.5.1 of Shapiro p. 230. (Contributed by Mario Carneiro, 28-Apr-2016)

Ref Expression
Hypotheses sumdchr.g G = DChr N
sumdchr.d D = Base G
Assertion dchrhash N D = ϕ N

Proof

Step Hyp Ref Expression
1 sumdchr.g G = DChr N
2 sumdchr.d D = Base G
3 eqid /N = /N
4 eqid Base /N = Base /N
5 3 4 znfi N Base /N Fin
6 1 2 dchrfi N D Fin
7 simprr N a Base /N x D x D
8 1 3 2 4 7 dchrf N a Base /N x D x : Base /N
9 simprl N a Base /N x D a Base /N
10 8 9 ffvelrnd N a Base /N x D x a
11 5 6 10 fsumcom N a Base /N x D x a = x D a Base /N x a
12 eqid 1 /N = 1 /N
13 simpl N a Base /N N
14 simpr N a Base /N a Base /N
15 1 2 3 12 4 13 14 sumdchr2 N a Base /N x D x a = if a = 1 /N D 0
16 velsn a 1 /N a = 1 /N
17 ifbi a 1 /N a = 1 /N if a 1 /N D 0 = if a = 1 /N D 0
18 16 17 mp1i N a Base /N if a 1 /N D 0 = if a = 1 /N D 0
19 15 18 eqtr4d N a Base /N x D x a = if a 1 /N D 0
20 19 sumeq2dv N a Base /N x D x a = a Base /N if a 1 /N D 0
21 eqid 0 G = 0 G
22 simpr N x D x D
23 1 3 2 21 22 4 dchrsum N x D a Base /N x a = if x = 0 G ϕ N 0
24 velsn x 0 G x = 0 G
25 ifbi x 0 G x = 0 G if x 0 G ϕ N 0 = if x = 0 G ϕ N 0
26 24 25 mp1i N x D if x 0 G ϕ N 0 = if x = 0 G ϕ N 0
27 23 26 eqtr4d N x D a Base /N x a = if x 0 G ϕ N 0
28 27 sumeq2dv N x D a Base /N x a = x D if x 0 G ϕ N 0
29 11 20 28 3eqtr3d N a Base /N if a 1 /N D 0 = x D if x 0 G ϕ N 0
30 nnnn0 N N 0
31 3 zncrng N 0 /N CRing
32 crngring /N CRing /N Ring
33 4 12 ringidcl /N Ring 1 /N Base /N
34 30 31 32 33 4syl N 1 /N Base /N
35 34 snssd N 1 /N Base /N
36 hashcl D Fin D 0
37 nn0cn D 0 D
38 6 36 37 3syl N D
39 38 ralrimivw N a 1 /N D
40 5 olcd N Base /N 0 Base /N Fin
41 sumss2 1 /N Base /N a 1 /N D Base /N 0 Base /N Fin a 1 /N D = a Base /N if a 1 /N D 0
42 35 39 40 41 syl21anc N a 1 /N D = a Base /N if a 1 /N D 0
43 1 dchrabl N G Abel
44 ablgrp G Abel G Grp
45 2 21 grpidcl G Grp 0 G D
46 43 44 45 3syl N 0 G D
47 46 snssd N 0 G D
48 phicl N ϕ N
49 48 nncnd N ϕ N
50 49 ralrimivw N x 0 G ϕ N
51 6 olcd N D 0 D Fin
52 sumss2 0 G D x 0 G ϕ N D 0 D Fin x 0 G ϕ N = x D if x 0 G ϕ N 0
53 47 50 51 52 syl21anc N x 0 G ϕ N = x D if x 0 G ϕ N 0
54 29 42 53 3eqtr4d N a 1 /N D = x 0 G ϕ N
55 eqidd a = 1 /N D = D
56 55 sumsn 1 /N Base /N D a 1 /N D = D
57 34 38 56 syl2anc N a 1 /N D = D
58 eqidd x = 0 G ϕ N = ϕ N
59 58 sumsn 0 G D ϕ N x 0 G ϕ N = ϕ N
60 46 49 59 syl2anc N x 0 G ϕ N = ϕ N
61 54 57 60 3eqtr3d N D = ϕ N