Metamath Proof Explorer


Theorem hashgcdlem

Description: A correspondence between elements of specific GCD and relative primes in a smaller ring. (Contributed by Stefan O'Rear, 12-Sep-2015)

Ref Expression
Hypotheses hashgcdlem.a A = y 0 ..^ M N | y gcd M N = 1
hashgcdlem.b B = z 0 ..^ M | z gcd M = N
hashgcdlem.f F = x A x N
Assertion hashgcdlem M N N M F : A 1-1 onto B

Proof

Step Hyp Ref Expression
1 hashgcdlem.a A = y 0 ..^ M N | y gcd M N = 1
2 hashgcdlem.b B = z 0 ..^ M | z gcd M = N
3 hashgcdlem.f F = x A x N
4 oveq1 y = x y gcd M N = x gcd M N
5 4 eqeq1d y = x y gcd M N = 1 x gcd M N = 1
6 5 1 elrab2 x A x 0 ..^ M N x gcd M N = 1
7 elfzonn0 x 0 ..^ M N x 0
8 7 ad2antrl M N N M x 0 ..^ M N x gcd M N = 1 x 0
9 nnnn0 N N 0
10 9 3ad2ant2 M N N M N 0
11 10 adantr M N N M x 0 ..^ M N x gcd M N = 1 N 0
12 8 11 nn0mulcld M N N M x 0 ..^ M N x gcd M N = 1 x N 0
13 simpl1 M N N M x 0 ..^ M N x gcd M N = 1 M
14 elfzolt2 x 0 ..^ M N x < M N
15 14 ad2antrl M N N M x 0 ..^ M N x gcd M N = 1 x < M N
16 elfzoelz x 0 ..^ M N x
17 16 ad2antrl M N N M x 0 ..^ M N x gcd M N = 1 x
18 17 zred M N N M x 0 ..^ M N x gcd M N = 1 x
19 nnre M M
20 19 3ad2ant1 M N N M M
21 20 adantr M N N M x 0 ..^ M N x gcd M N = 1 M
22 nnre N N
23 nngt0 N 0 < N
24 22 23 jca N N 0 < N
25 24 3ad2ant2 M N N M N 0 < N
26 25 adantr M N N M x 0 ..^ M N x gcd M N = 1 N 0 < N
27 ltmuldiv x M N 0 < N x N < M x < M N
28 18 21 26 27 syl3anc M N N M x 0 ..^ M N x gcd M N = 1 x N < M x < M N
29 15 28 mpbird M N N M x 0 ..^ M N x gcd M N = 1 x N < M
30 elfzo0 x N 0 ..^ M x N 0 M x N < M
31 12 13 29 30 syl3anbrc M N N M x 0 ..^ M N x gcd M N = 1 x N 0 ..^ M
32 nncn M M
33 32 3ad2ant1 M N N M M
34 nncn N N
35 34 3ad2ant2 M N N M N
36 nnne0 N N 0
37 36 3ad2ant2 M N N M N 0
38 33 35 37 divcan1d M N N M M N N = M
39 38 adantr M N N M x 0 ..^ M N x gcd M N = 1 M N N = M
40 39 eqcomd M N N M x 0 ..^ M N x gcd M N = 1 M = M N N
41 40 oveq2d M N N M x 0 ..^ M N x gcd M N = 1 x N gcd M = x N gcd M N N
42 nndivdvds M N N M M N
43 42 biimp3a M N N M M N
44 43 nnzd M N N M M N
45 44 adantr M N N M x 0 ..^ M N x gcd M N = 1 M N
46 mulgcdr x M N N 0 x N gcd M N N = x gcd M N N
47 17 45 11 46 syl3anc M N N M x 0 ..^ M N x gcd M N = 1 x N gcd M N N = x gcd M N N
48 simprr M N N M x 0 ..^ M N x gcd M N = 1 x gcd M N = 1
49 48 oveq1d M N N M x 0 ..^ M N x gcd M N = 1 x gcd M N N = 1 N
50 35 mulid2d M N N M 1 N = N
51 50 adantr M N N M x 0 ..^ M N x gcd M N = 1 1 N = N
52 49 51 eqtrd M N N M x 0 ..^ M N x gcd M N = 1 x gcd M N N = N
53 41 47 52 3eqtrd M N N M x 0 ..^ M N x gcd M N = 1 x N gcd M = N
54 oveq1 z = x N z gcd M = x N gcd M
55 54 eqeq1d z = x N z gcd M = N x N gcd M = N
56 55 2 elrab2 x N B x N 0 ..^ M x N gcd M = N
57 31 53 56 sylanbrc M N N M x 0 ..^ M N x gcd M N = 1 x N B
58 6 57 sylan2b M N N M x A x N B
59 oveq1 z = w z gcd M = w gcd M
60 59 eqeq1d z = w z gcd M = N w gcd M = N
61 60 2 elrab2 w B w 0 ..^ M w gcd M = N
62 simprr M N N M w 0 ..^ M w gcd M = N w gcd M = N
63 elfzoelz w 0 ..^ M w
64 63 ad2antrl M N N M w 0 ..^ M w gcd M = N w
65 simpl1 M N N M w 0 ..^ M w gcd M = N M
66 65 nnzd M N N M w 0 ..^ M w gcd M = N M
67 gcddvds w M w gcd M w w gcd M M
68 64 66 67 syl2anc M N N M w 0 ..^ M w gcd M = N w gcd M w w gcd M M
69 68 simpld M N N M w 0 ..^ M w gcd M = N w gcd M w
70 62 69 eqbrtrrd M N N M w 0 ..^ M w gcd M = N N w
71 nnz N N
72 71 3ad2ant2 M N N M N
73 72 adantr M N N M w 0 ..^ M w gcd M = N N
74 37 adantr M N N M w 0 ..^ M w gcd M = N N 0
75 dvdsval2 N N 0 w N w w N
76 73 74 64 75 syl3anc M N N M w 0 ..^ M w gcd M = N N w w N
77 70 76 mpbid M N N M w 0 ..^ M w gcd M = N w N
78 elfzofz w 0 ..^ M w 0 M
79 78 ad2antrl M N N M w 0 ..^ M w gcd M = N w 0 M
80 elfznn0 w 0 M w 0
81 nn0re w 0 w
82 nn0ge0 w 0 0 w
83 81 82 jca w 0 w 0 w
84 79 80 83 3syl M N N M w 0 ..^ M w gcd M = N w 0 w
85 25 adantr M N N M w 0 ..^ M w gcd M = N N 0 < N
86 divge0 w 0 w N 0 < N 0 w N
87 84 85 86 syl2anc M N N M w 0 ..^ M w gcd M = N 0 w N
88 elnn0z w N 0 w N 0 w N
89 77 87 88 sylanbrc M N N M w 0 ..^ M w gcd M = N w N 0
90 43 adantr M N N M w 0 ..^ M w gcd M = N M N
91 elfzolt2 w 0 ..^ M w < M
92 91 ad2antrl M N N M w 0 ..^ M w gcd M = N w < M
93 64 zred M N N M w 0 ..^ M w gcd M = N w
94 20 adantr M N N M w 0 ..^ M w gcd M = N M
95 ltdiv1 w M N 0 < N w < M w N < M N
96 93 94 85 95 syl3anc M N N M w 0 ..^ M w gcd M = N w < M w N < M N
97 92 96 mpbid M N N M w 0 ..^ M w gcd M = N w N < M N
98 elfzo0 w N 0 ..^ M N w N 0 M N w N < M N
99 89 90 97 98 syl3anbrc M N N M w 0 ..^ M w gcd M = N w N 0 ..^ M N
100 62 oveq1d M N N M w 0 ..^ M w gcd M = N w gcd M N = N N
101 simpl2 M N N M w 0 ..^ M w gcd M = N N
102 simpl3 M N N M w 0 ..^ M w gcd M = N N M
103 gcddiv w M N N w N M w gcd M N = w N gcd M N
104 64 66 101 70 102 103 syl32anc M N N M w 0 ..^ M w gcd M = N w gcd M N = w N gcd M N
105 35 37 dividd M N N M N N = 1
106 105 adantr M N N M w 0 ..^ M w gcd M = N N N = 1
107 100 104 106 3eqtr3d M N N M w 0 ..^ M w gcd M = N w N gcd M N = 1
108 oveq1 y = w N y gcd M N = w N gcd M N
109 108 eqeq1d y = w N y gcd M N = 1 w N gcd M N = 1
110 109 1 elrab2 w N A w N 0 ..^ M N w N gcd M N = 1
111 99 107 110 sylanbrc M N N M w 0 ..^ M w gcd M = N w N A
112 61 111 sylan2b M N N M w B w N A
113 6 simplbi x A x 0 ..^ M N
114 61 simplbi w B w 0 ..^ M
115 113 114 anim12i x A w B x 0 ..^ M N w 0 ..^ M
116 63 ad2antll M N N M x 0 ..^ M N w 0 ..^ M w
117 116 zcnd M N N M x 0 ..^ M N w 0 ..^ M w
118 35 adantr M N N M x 0 ..^ M N w 0 ..^ M N
119 37 adantr M N N M x 0 ..^ M N w 0 ..^ M N 0
120 117 118 119 divcan1d M N N M x 0 ..^ M N w 0 ..^ M w N N = w
121 120 eqcomd M N N M x 0 ..^ M N w 0 ..^ M w = w N N
122 oveq1 x = w N x N = w N N
123 122 eqeq2d x = w N w = x N w = w N N
124 121 123 syl5ibrcom M N N M x 0 ..^ M N w 0 ..^ M x = w N w = x N
125 16 ad2antrl M N N M x 0 ..^ M N w 0 ..^ M x
126 125 zcnd M N N M x 0 ..^ M N w 0 ..^ M x
127 126 118 119 divcan4d M N N M x 0 ..^ M N w 0 ..^ M x N N = x
128 127 eqcomd M N N M x 0 ..^ M N w 0 ..^ M x = x N N
129 oveq1 w = x N w N = x N N
130 129 eqeq2d w = x N x = w N x = x N N
131 128 130 syl5ibrcom M N N M x 0 ..^ M N w 0 ..^ M w = x N x = w N
132 124 131 impbid M N N M x 0 ..^ M N w 0 ..^ M x = w N w = x N
133 115 132 sylan2 M N N M x A w B x = w N w = x N
134 3 58 112 133 f1o2d M N N M F : A 1-1 onto B