Metamath Proof Explorer


Theorem dfgcd2

Description: Alternate definition of the gcd operator, see definition in ApostolNT p. 15. (Contributed by AV, 8-Aug-2021)

Ref Expression
Assertion dfgcd2 M N D = M gcd N 0 D D M D N e e M e N e D

Proof

Step Hyp Ref Expression
1 gcdcl M N M gcd N 0
2 1 nn0ge0d M N 0 M gcd N
3 gcddvds M N M gcd N M M gcd N N
4 3anass e M N e M N
5 4 biancomi e M N M N e
6 dvdsgcd e M N e M e N e M gcd N
7 5 6 sylbir M N e e M e N e M gcd N
8 7 ralrimiva M N e e M e N e M gcd N
9 2 3 8 3jca M N 0 M gcd N M gcd N M M gcd N N e e M e N e M gcd N
10 9 adantr M N D = M gcd N 0 M gcd N M gcd N M M gcd N N e e M e N e M gcd N
11 breq2 D = M gcd N 0 D 0 M gcd N
12 breq1 D = M gcd N D M M gcd N M
13 breq1 D = M gcd N D N M gcd N N
14 12 13 anbi12d D = M gcd N D M D N M gcd N M M gcd N N
15 breq2 D = M gcd N e D e M gcd N
16 15 imbi2d D = M gcd N e M e N e D e M e N e M gcd N
17 16 ralbidv D = M gcd N e e M e N e D e e M e N e M gcd N
18 11 14 17 3anbi123d D = M gcd N 0 D D M D N e e M e N e D 0 M gcd N M gcd N M M gcd N N e e M e N e M gcd N
19 18 adantl M N D = M gcd N 0 D D M D N e e M e N e D 0 M gcd N M gcd N M M gcd N N e e M e N e M gcd N
20 10 19 mpbird M N D = M gcd N 0 D D M D N e e M e N e D
21 gcdval M N M gcd N = if M = 0 N = 0 0 sup n | n M n N <
22 21 adantr M N 0 D D M D N e e M e N e D M gcd N = if M = 0 N = 0 0 sup n | n M n N <
23 iftrue M = 0 N = 0 if M = 0 N = 0 0 sup n | n M n N < = 0
24 23 adantr M = 0 N = 0 M N 0 D D M D N e e M e N e D if M = 0 N = 0 0 sup n | n M n N < = 0
25 breq2 M = 0 D M D 0
26 breq2 N = 0 D N D 0
27 25 26 bi2anan9 M = 0 N = 0 D M D N D 0 D 0
28 breq2 M = 0 e M e 0
29 breq2 N = 0 e N e 0
30 28 29 bi2anan9 M = 0 N = 0 e M e N e 0 e 0
31 30 imbi1d M = 0 N = 0 e M e N e D e 0 e 0 e D
32 31 ralbidv M = 0 N = 0 e e M e N e D e e 0 e 0 e D
33 27 32 3anbi23d M = 0 N = 0 0 D D M D N e e M e N e D 0 D D 0 D 0 e e 0 e 0 e D
34 dvdszrcl D 0 D 0
35 dvds0 e e 0
36 35 35 jca e e 0 e 0
37 36 adantl D 0 D e e 0 e 0
38 pm5.5 e 0 e 0 e 0 e 0 e D e D
39 37 38 syl D 0 D e e 0 e 0 e D e D
40 39 ralbidva D 0 D e e 0 e 0 e D e e D
41 0z 0
42 breq1 e = 0 e D 0 D
43 42 rspcv 0 e e D 0 D
44 41 43 ax-mp e e D 0 D
45 0dvds D 0 D D = 0
46 45 biimpd D 0 D D = 0
47 eqcom 0 = D D = 0
48 46 47 syl6ibr D 0 D 0 = D
49 44 48 syl5 D e e D 0 = D
50 49 adantr D 0 D e e D 0 = D
51 40 50 sylbid D 0 D e e 0 e 0 e D 0 = D
52 51 ex D 0 D e e 0 e 0 e D 0 = D
53 52 adantr D 0 0 D e e 0 e 0 e D 0 = D
54 34 53 syl D 0 0 D e e 0 e 0 e D 0 = D
55 54 adantr D 0 D 0 0 D e e 0 e 0 e D 0 = D
56 55 3imp21 0 D D 0 D 0 e e 0 e 0 e D 0 = D
57 33 56 syl6bi M = 0 N = 0 0 D D M D N e e M e N e D 0 = D
58 57 adantld M = 0 N = 0 M N 0 D D M D N e e M e N e D 0 = D
59 58 imp M = 0 N = 0 M N 0 D D M D N e e M e N e D 0 = D
60 24 59 eqtrd M = 0 N = 0 M N 0 D D M D N e e M e N e D if M = 0 N = 0 0 sup n | n M n N < = D
61 iffalse ¬ M = 0 N = 0 if M = 0 N = 0 0 sup n | n M n N < = sup n | n M n N <
62 61 adantr ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D if M = 0 N = 0 0 sup n | n M n N < = sup n | n M n N <
63 ltso < Or
64 63 a1i ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D < Or
65 dvdszrcl D M D M
66 65 simpld D M D
67 66 zred D M D
68 67 adantr D M D N D
69 68 3ad2ant2 0 D D M D N e e M e N e D D
70 69 ad2antll ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D D
71 breq1 n = y n M y M
72 breq1 n = y n N y N
73 71 72 anbi12d n = y n M n N y M y N
74 73 elrab y n | n M n N y y M y N
75 breq1 e = y e M y M
76 breq1 e = y e N y N
77 75 76 anbi12d e = y e M e N y M y N
78 breq1 e = y e D y D
79 77 78 imbi12d e = y e M e N e D y M y N y D
80 79 rspcv y e e M e N e D y M y N y D
81 80 com23 y y M y N e e M e N e D y D
82 81 imp y y M y N e e M e N e D y D
83 82 ad2antrr y y M y N ¬ M = 0 N = 0 M N e e M e N e D y D
84 elnn0z D 0 D 0 D
85 84 simplbi2 D 0 D D 0
86 85 adantr D M 0 D D 0
87 65 86 syl D M 0 D D 0
88 87 adantr D M D N 0 D D 0
89 88 impcom 0 D D M D N D 0
90 simp-4l y y M y N ¬ M = 0 N = 0 D 0 0 D D M D N y
91 elnn0 D 0 D D = 0
92 2a1 D y y M y N ¬ M = 0 N = 0 0 D D M D N D
93 breq1 D = 0 D M 0 M
94 breq1 D = 0 D N 0 N
95 93 94 anbi12d D = 0 D M D N 0 M 0 N
96 95 anbi2d D = 0 0 D D M D N 0 D 0 M 0 N
97 96 adantr D = 0 y y M y N ¬ M = 0 N = 0 0 D D M D N 0 D 0 M 0 N
98 ianor ¬ M = 0 N = 0 ¬ M = 0 ¬ N = 0
99 dvdszrcl 0 M 0 M
100 0dvds M 0 M M = 0
101 pm2.24 M = 0 ¬ M = 0 D
102 100 101 syl6bi M 0 M ¬ M = 0 D
103 102 adantl 0 M 0 M ¬ M = 0 D
104 99 103 mpcom 0 M ¬ M = 0 D
105 104 adantr 0 M 0 N ¬ M = 0 D
106 105 com12 ¬ M = 0 0 M 0 N D
107 dvdszrcl 0 N 0 N
108 0dvds N 0 N N = 0
109 pm2.24 N = 0 ¬ N = 0 D
110 108 109 syl6bi N 0 N ¬ N = 0 D
111 110 adantl 0 N 0 N ¬ N = 0 D
112 107 111 mpcom 0 N ¬ N = 0 D
113 112 adantl 0 M 0 N ¬ N = 0 D
114 113 com12 ¬ N = 0 0 M 0 N D
115 106 114 jaoi ¬ M = 0 ¬ N = 0 0 M 0 N D
116 98 115 sylbi ¬ M = 0 N = 0 0 M 0 N D
117 116 adantld ¬ M = 0 N = 0 0 D 0 M 0 N D
118 117 ad2antll D = 0 y y M y N ¬ M = 0 N = 0 0 D 0 M 0 N D
119 97 118 sylbid D = 0 y y M y N ¬ M = 0 N = 0 0 D D M D N D
120 119 ex D = 0 y y M y N ¬ M = 0 N = 0 0 D D M D N D
121 92 120 jaoi D D = 0 y y M y N ¬ M = 0 N = 0 0 D D M D N D
122 91 121 sylbi D 0 y y M y N ¬ M = 0 N = 0 0 D D M D N D
123 122 impcom y y M y N ¬ M = 0 N = 0 D 0 0 D D M D N D
124 123 imp y y M y N ¬ M = 0 N = 0 D 0 0 D D M D N D
125 dvdsle y D y D y D
126 90 124 125 syl2anc y y M y N ¬ M = 0 N = 0 D 0 0 D D M D N y D y D
127 126 exp31 y y M y N ¬ M = 0 N = 0 D 0 0 D D M D N y D y D
128 127 com14 y D D 0 0 D D M D N y y M y N ¬ M = 0 N = 0 y D
129 128 imp y D D 0 0 D D M D N y y M y N ¬ M = 0 N = 0 y D
130 129 impcom 0 D D M D N y D D 0 y y M y N ¬ M = 0 N = 0 y D
131 130 imp 0 D D M D N y D D 0 y y M y N ¬ M = 0 N = 0 y D
132 zre y y
133 132 ad2antrr y y M y N ¬ M = 0 N = 0 y
134 68 ad2antlr 0 D D M D N y D D 0 D
135 lenlt y D y D ¬ D < y
136 133 134 135 syl2anr 0 D D M D N y D D 0 y y M y N ¬ M = 0 N = 0 y D ¬ D < y
137 131 136 mpbid 0 D D M D N y D D 0 y y M y N ¬ M = 0 N = 0 ¬ D < y
138 137 exp31 0 D D M D N y D D 0 y y M y N ¬ M = 0 N = 0 ¬ D < y
139 89 138 mpan2d 0 D D M D N y D y y M y N ¬ M = 0 N = 0 ¬ D < y
140 139 com13 y y M y N ¬ M = 0 N = 0 y D 0 D D M D N ¬ D < y
141 140 adantr y y M y N ¬ M = 0 N = 0 M N y D 0 D D M D N ¬ D < y
142 83 141 syld y y M y N ¬ M = 0 N = 0 M N e e M e N e D 0 D D M D N ¬ D < y
143 142 com13 0 D D M D N e e M e N e D y y M y N ¬ M = 0 N = 0 M N ¬ D < y
144 143 3impia 0 D D M D N e e M e N e D y y M y N ¬ M = 0 N = 0 M N ¬ D < y
145 144 com12 y y M y N ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D ¬ D < y
146 145 expimpd y y M y N ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D ¬ D < y
147 146 expimpd y y M y N ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D ¬ D < y
148 74 147 sylbi y n | n M n N ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D ¬ D < y
149 148 impcom ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D y n | n M n N ¬ D < y
150 66 adantr D M D N D
151 150 ancri D M D N D D M D N
152 151 3ad2ant2 0 D D M D N e e M e N e D D D M D N
153 152 ad2antll ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D D D M D N
154 153 adantr ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D y y < D D D M D N
155 breq1 n = D n M D M
156 breq1 n = D n N D N
157 155 156 anbi12d n = D n M n N D M D N
158 157 elrab D n | n M n N D D M D N
159 154 158 sylibr ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D y y < D D n | n M n N
160 breq2 z = D y < z y < D
161 160 adantl ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D y y < D z = D y < z y < D
162 simprr ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D y y < D y < D
163 159 161 162 rspcedvd ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D y y < D z n | n M n N y < z
164 64 70 149 163 eqsupd ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D sup n | n M n N < = D
165 62 164 eqtrd ¬ M = 0 N = 0 M N 0 D D M D N e e M e N e D if M = 0 N = 0 0 sup n | n M n N < = D
166 60 165 pm2.61ian M N 0 D D M D N e e M e N e D if M = 0 N = 0 0 sup n | n M n N < = D
167 22 166 eqtr2d M N 0 D D M D N e e M e N e D D = M gcd N
168 20 167 impbida M N D = M gcd N 0 D D M D N e e M e N e D