Metamath Proof Explorer


Theorem gcdcom

Description: The gcd operator is commutative. Theorem 1.4(a) in ApostolNT p. 16. (Contributed by Paul Chapman, 21-Mar-2011)

Ref Expression
Assertion gcdcom M N M gcd N = N gcd M

Proof

Step Hyp Ref Expression
1 ancom M = 0 N = 0 N = 0 M = 0
2 ancom n M n N n N n M
3 2 rabbii n | n M n N = n | n N n M
4 3 supeq1i sup n | n M n N < = sup n | n N n M <
5 1 4 ifbieq2i if M = 0 N = 0 0 sup n | n M n N < = if N = 0 M = 0 0 sup n | n N n M <
6 gcdval M N M gcd N = if M = 0 N = 0 0 sup n | n M n N <
7 gcdval N M N gcd M = if N = 0 M = 0 0 sup n | n N n M <
8 7 ancoms M N N gcd M = if N = 0 M = 0 0 sup n | n N n M <
9 5 6 8 3eqtr4a M N M gcd N = N gcd M