Metamath Proof Explorer


Theorem gcdzeq

Description: A positive integer A is equal to its gcd with an integer B if and only if A divides B . Generalization of gcdeq . (Contributed by AV, 1-Jul-2020)

Ref Expression
Assertion gcdzeq A B A gcd B = A A B

Proof

Step Hyp Ref Expression
1 nnz A A
2 gcddvds A B A gcd B A A gcd B B
3 1 2 sylan A B A gcd B A A gcd B B
4 3 simprd A B A gcd B B
5 breq1 A gcd B = A A gcd B B A B
6 4 5 syl5ibcom A B A gcd B = A A B
7 1 adantr A B A
8 iddvds A A A
9 7 8 syl A B A A
10 simpr A B B
11 nnne0 A A 0
12 simpl A = 0 B = 0 A = 0
13 12 necon3ai A 0 ¬ A = 0 B = 0
14 11 13 syl A ¬ A = 0 B = 0
15 14 adantr A B ¬ A = 0 B = 0
16 dvdslegcd A A B ¬ A = 0 B = 0 A A A B A A gcd B
17 7 7 10 15 16 syl31anc A B A A A B A A gcd B
18 9 17 mpand A B A B A A gcd B
19 3 simpld A B A gcd B A
20 gcdcl A B A gcd B 0
21 1 20 sylan A B A gcd B 0
22 21 nn0zd A B A gcd B
23 simpl A B A
24 dvdsle A gcd B A A gcd B A A gcd B A
25 22 23 24 syl2anc A B A gcd B A A gcd B A
26 19 25 mpd A B A gcd B A
27 18 26 jctild A B A B A gcd B A A A gcd B
28 21 nn0red A B A gcd B
29 nnre A A
30 29 adantr A B A
31 28 30 letri3d A B A gcd B = A A gcd B A A A gcd B
32 27 31 sylibrd A B A B A gcd B = A
33 6 32 impbid A B A gcd B = A A B