Metamath Proof Explorer


Theorem znrrg

Description: The regular elements of Z/nZ are exactly the units. (This theorem fails for N = 0 , where all nonzero integers are regular, but only +- 1 are units.) (Contributed by Mario Carneiro, 18-Apr-2016)

Ref Expression
Hypotheses znchr.y Y=/N
znunit.u U=UnitY
znrrg.e E=RLRegY
Assertion znrrg NE=U

Proof

Step Hyp Ref Expression
1 znchr.y Y=/N
2 znunit.u U=UnitY
3 znrrg.e E=RLRegY
4 nnnn0 NN0
5 eqid BaseY=BaseY
6 eqid ℤRHomY=ℤRHomY
7 1 5 6 znzrhfo N0ℤRHomY:ontoBaseY
8 4 7 syl NℤRHomY:ontoBaseY
9 3 5 rrgss EBaseY
10 9 sseli xExBaseY
11 foelrn ℤRHomY:ontoBaseYxBaseYnx=ℤRHomYn
12 8 10 11 syl2an NxEnx=ℤRHomYn
13 12 ex NxEnx=ℤRHomYn
14 nncn NN
15 14 ad2antrr NnℤRHomYnEN
16 simplr NnℤRHomYnEn
17 nnz NN
18 17 ad2antrr NnℤRHomYnEN
19 nnne0 NN0
20 19 ad2antrr NnℤRHomYnEN0
21 simpr n=0N=0N=0
22 21 necon3ai N0¬n=0N=0
23 20 22 syl NnℤRHomYnE¬n=0N=0
24 gcdn0cl nN¬n=0N=0ngcdN
25 16 18 23 24 syl21anc NnℤRHomYnEngcdN
26 25 nncnd NnℤRHomYnEngcdN
27 25 nnne0d NnℤRHomYnEngcdN0
28 15 26 27 divcan2d NnℤRHomYnEngcdNNngcdN=N
29 gcddvds nNngcdNnngcdNN
30 16 18 29 syl2anc NnℤRHomYnEngcdNnngcdNN
31 30 simpld NnℤRHomYnEngcdNn
32 25 nnzd NnℤRHomYnEngcdN
33 30 simprd NnℤRHomYnEngcdNN
34 simpll NnℤRHomYnEN
35 nndivdvds NngcdNngcdNNNngcdN
36 34 25 35 syl2anc NnℤRHomYnEngcdNNNngcdN
37 33 36 mpbid NnℤRHomYnENngcdN
38 37 nnzd NnℤRHomYnENngcdN
39 dvdsmulc ngcdNnNngcdNngcdNnngcdNNngcdNnNngcdN
40 32 16 38 39 syl3anc NnℤRHomYnEngcdNnngcdNNngcdNnNngcdN
41 31 40 mpd NnℤRHomYnEngcdNNngcdNnNngcdN
42 28 41 eqbrtrrd NnℤRHomYnENnNngcdN
43 simpr NnℤRHomYnEℤRHomYnE
44 4 ad2antrr NnℤRHomYnEN0
45 44 7 syl NnℤRHomYnEℤRHomY:ontoBaseY
46 fof ℤRHomY:ontoBaseYℤRHomY:BaseY
47 45 46 syl NnℤRHomYnEℤRHomY:BaseY
48 47 38 ffvelcdmd NnℤRHomYnEℤRHomYNngcdNBaseY
49 eqid Y=Y
50 eqid 0Y=0Y
51 3 5 49 50 rrgeq0i ℤRHomYnEℤRHomYNngcdNBaseYℤRHomYnYℤRHomYNngcdN=0YℤRHomYNngcdN=0Y
52 43 48 51 syl2anc NnℤRHomYnEℤRHomYnYℤRHomYNngcdN=0YℤRHomYNngcdN=0Y
53 1 zncrng N0YCRing
54 4 53 syl NYCRing
55 crngring YCRingYRing
56 54 55 syl NYRing
57 56 ad2antrr NnℤRHomYnEYRing
58 6 zrhrhm YRingℤRHomYringRingHomY
59 57 58 syl NnℤRHomYnEℤRHomYringRingHomY
60 zringbas =Basering
61 zringmulr ×=ring
62 60 61 49 rhmmul ℤRHomYringRingHomYnNngcdNℤRHomYnNngcdN=ℤRHomYnYℤRHomYNngcdN
63 59 16 38 62 syl3anc NnℤRHomYnEℤRHomYnNngcdN=ℤRHomYnYℤRHomYNngcdN
64 63 eqeq1d NnℤRHomYnEℤRHomYnNngcdN=0YℤRHomYnYℤRHomYNngcdN=0Y
65 16 38 zmulcld NnℤRHomYnEnNngcdN
66 1 6 50 zndvds0 N0nNngcdNℤRHomYnNngcdN=0YNnNngcdN
67 44 65 66 syl2anc NnℤRHomYnEℤRHomYnNngcdN=0YNnNngcdN
68 64 67 bitr3d NnℤRHomYnEℤRHomYnYℤRHomYNngcdN=0YNnNngcdN
69 1 6 50 zndvds0 N0NngcdNℤRHomYNngcdN=0YNNngcdN
70 44 38 69 syl2anc NnℤRHomYnEℤRHomYNngcdN=0YNNngcdN
71 52 68 70 3imtr3d NnℤRHomYnENnNngcdNNNngcdN
72 42 71 mpd NnℤRHomYnENNngcdN
73 15 26 27 divcan1d NnℤRHomYnENngcdNngcdN=N
74 37 nncnd NnℤRHomYnENngcdN
75 74 mulridd NnℤRHomYnENngcdN1=NngcdN
76 72 73 75 3brtr4d NnℤRHomYnENngcdNngcdNNngcdN1
77 1zzd NnℤRHomYnE1
78 37 nnne0d NnℤRHomYnENngcdN0
79 dvdscmulr ngcdN1NngcdNNngcdN0NngcdNngcdNNngcdN1ngcdN1
80 32 77 38 78 79 syl112anc NnℤRHomYnENngcdNngcdNNngcdN1ngcdN1
81 76 80 mpbid NnℤRHomYnEngcdN1
82 16 18 gcdcld NnℤRHomYnEngcdN0
83 dvds1 ngcdN0ngcdN1ngcdN=1
84 82 83 syl NnℤRHomYnEngcdN1ngcdN=1
85 81 84 mpbid NnℤRHomYnEngcdN=1
86 1 2 6 znunit N0nℤRHomYnUngcdN=1
87 44 16 86 syl2anc NnℤRHomYnEℤRHomYnUngcdN=1
88 85 87 mpbird NnℤRHomYnEℤRHomYnU
89 88 ex NnℤRHomYnEℤRHomYnU
90 eleq1 x=ℤRHomYnxEℤRHomYnE
91 eleq1 x=ℤRHomYnxUℤRHomYnU
92 90 91 imbi12d x=ℤRHomYnxExUℤRHomYnEℤRHomYnU
93 89 92 syl5ibrcom Nnx=ℤRHomYnxExU
94 93 rexlimdva Nnx=ℤRHomYnxExU
95 94 com23 NxEnx=ℤRHomYnxU
96 13 95 mpdd NxExU
97 96 ssrdv NEU
98 3 2 unitrrg YRingUE
99 56 98 syl NUE
100 97 99 eqssd NE=U