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 KMNMgcdN=MgcdN+K M

Proof

Step Hyp Ref Expression
1 oveq1 K=ifKK0K M=ifKK0 M
2 1 oveq1d K=ifKK0K M+N=ifKK0 M+N
3 2 oveq2d K=ifKK0MgcdK M+N=MgcdifKK0 M+N
4 3 eqeq2d K=ifKK0MgcdN=MgcdK M+NMgcdN=MgcdifKK0 M+N
5 oveq1 M=ifMM0MgcdN=ifMM0gcdN
6 id M=ifMM0M=ifMM0
7 oveq2 M=ifMM0ifKK0 M=ifKK0ifMM0
8 7 oveq1d M=ifMM0ifKK0 M+N=ifKK0ifMM0+N
9 6 8 oveq12d M=ifMM0MgcdifKK0 M+N=ifMM0gcdifKK0ifMM0+N
10 5 9 eqeq12d M=ifMM0MgcdN=MgcdifKK0 M+NifMM0gcdN=ifMM0gcdifKK0ifMM0+N
11 oveq2 N=ifNN0ifMM0gcdN=ifMM0gcdifNN0
12 oveq2 N=ifNN0ifKK0ifMM0+N=ifKK0ifMM0+ifNN0
13 12 oveq2d N=ifNN0ifMM0gcdifKK0ifMM0+N=ifMM0gcdifKK0ifMM0+ifNN0
14 11 13 eqeq12d N=ifNN0ifMM0gcdN=ifMM0gcdifKK0ifMM0+NifMM0gcdifNN0=ifMM0gcdifKK0ifMM0+ifNN0
15 0z 0
16 15 elimel ifKK0
17 15 elimel ifMM0
18 15 elimel ifNN0
19 16 17 18 gcdaddmlem ifMM0gcdifNN0=ifMM0gcdifKK0ifMM0+ifNN0
20 4 10 14 19 dedth3h KMNMgcdN=MgcdK M+N
21 zcn KK
22 zcn MM
23 mulcl KMK M
24 21 22 23 syl2an KMK M
25 zcn NN
26 addcom K MNK M+N=N+K M
27 24 25 26 syl2an KMNK M+N=N+K M
28 27 3impa KMNK M+N=N+K M
29 28 oveq2d KMNMgcdK M+N=MgcdN+K M
30 20 29 eqtrd KMNMgcdN=MgcdN+K M