Metamath Proof Explorer


Theorem gcdaddm

Description: Adding a multiple of one operand of the gcd operator to the other does not alter the result. (Contributed by Paul Chapman, 31-Mar-2011)

Ref Expression
Assertion gcdaddm K M N M gcd N = M gcd N + K M

Proof

Step Hyp Ref Expression
1 oveq1 K = if K K 0 K M = if K K 0 M
2 1 oveq1d K = if K K 0 K M + N = if K K 0 M + N
3 2 oveq2d K = if K K 0 M gcd K M + N = M gcd if K K 0 M + N
4 3 eqeq2d K = if K K 0 M gcd N = M gcd K M + N M gcd N = M gcd if K K 0 M + N
5 oveq1 M = if M M 0 M gcd N = if M M 0 gcd N
6 id M = if M M 0 M = if M M 0
7 oveq2 M = if M M 0 if K K 0 M = if K K 0 if M M 0
8 7 oveq1d M = if M M 0 if K K 0 M + N = if K K 0 if M M 0 + N
9 6 8 oveq12d M = if M M 0 M gcd if K K 0 M + N = if M M 0 gcd if K K 0 if M M 0 + N
10 5 9 eqeq12d M = if M M 0 M gcd N = M gcd if K K 0 M + N if M M 0 gcd N = if M M 0 gcd if K K 0 if M M 0 + N
11 oveq2 N = if N N 0 if M M 0 gcd N = if M M 0 gcd if N N 0
12 oveq2 N = if N N 0 if K K 0 if M M 0 + N = if K K 0 if M M 0 + if N N 0
13 12 oveq2d N = if N N 0 if M M 0 gcd if K K 0 if M M 0 + N = if M M 0 gcd if K K 0 if M M 0 + if N N 0
14 11 13 eqeq12d N = if N N 0 if M M 0 gcd N = if M M 0 gcd if K K 0 if M M 0 + N if M M 0 gcd if N N 0 = if M M 0 gcd if K K 0 if M M 0 + if N N 0
15 0z 0
16 15 elimel if K K 0
17 15 elimel if M M 0
18 15 elimel if N N 0
19 16 17 18 gcdaddmlem if M M 0 gcd if N N 0 = if M M 0 gcd if K K 0 if M M 0 + if N N 0
20 4 10 14 19 dedth3h K M N M gcd N = M gcd K M + N
21 zcn K K
22 zcn M M
23 mulcl K M K M
24 21 22 23 syl2an K M K M
25 zcn N N
26 addcom K M N K M + N = N + K M
27 24 25 26 syl2an K M N K M + N = N + K M
28 27 3impa K M N K M + N = N + K M
29 28 oveq2d K M N M gcd K M + N = M gcd N + K M
30 20 29 eqtrd K M N M gcd N = M gcd N + K M