Metamath Proof Explorer


Theorem nn0expgcd

Description: Exponentiation distributes over GCD. nn0gcdsq extended to nonnegative exponents. expgcd extended to nonnegative bases. (Contributed by Steven Nguyen, 5-Apr-2023)

Ref Expression
Assertion nn0expgcd A 0 B 0 N 0 A gcd B N = A N gcd B N

Proof

Step Hyp Ref Expression
1 elnn0 A 0 A A = 0
2 elnn0 B 0 B B = 0
3 expgcd A B N 0 A gcd B N = A N gcd B N
4 3 3expia A B N 0 A gcd B N = A N gcd B N
5 elnn0 N 0 N N = 0
6 0exp N 0 N = 0
7 6 3ad2ant3 A = 0 B N 0 N = 0
8 7 oveq1d A = 0 B N 0 N gcd B N = 0 gcd B N
9 simp2 A = 0 B N B
10 nnnn0 N N 0
11 10 3ad2ant3 A = 0 B N N 0
12 9 11 nnexpcld A = 0 B N B N
13 12 nnzd A = 0 B N B N
14 gcd0id B N 0 gcd B N = B N
15 13 14 syl A = 0 B N 0 gcd B N = B N
16 12 nnred A = 0 B N B N
17 0red A = 0 B N 0
18 12 nngt0d A = 0 B N 0 < B N
19 17 16 18 ltled A = 0 B N 0 B N
20 16 19 absidd A = 0 B N B N = B N
21 8 15 20 3eqtrrd A = 0 B N B N = 0 N gcd B N
22 oveq1 A = 0 A gcd B = 0 gcd B
23 22 3ad2ant1 A = 0 B N A gcd B = 0 gcd B
24 nnz B B
25 24 3ad2ant2 A = 0 B N B
26 gcd0id B 0 gcd B = B
27 25 26 syl A = 0 B N 0 gcd B = B
28 nnre B B
29 0red B 0
30 nngt0 B 0 < B
31 29 28 30 ltled B 0 B
32 28 31 absidd B B = B
33 32 3ad2ant2 A = 0 B N B = B
34 23 27 33 3eqtrd A = 0 B N A gcd B = B
35 34 oveq1d A = 0 B N A gcd B N = B N
36 oveq1 A = 0 A N = 0 N
37 36 3ad2ant1 A = 0 B N A N = 0 N
38 37 oveq1d A = 0 B N A N gcd B N = 0 N gcd B N
39 21 35 38 3eqtr4d A = 0 B N A gcd B N = A N gcd B N
40 39 3expia A = 0 B N A gcd B N = A N gcd B N
41 1z 1
42 gcd1 1 1 gcd 1 = 1
43 41 42 ax-mp 1 gcd 1 = 1
44 43 eqcomi 1 = 1 gcd 1
45 simp1 A = 0 B N = 0 A = 0
46 45 oveq1d A = 0 B N = 0 A gcd B = 0 gcd B
47 simp2 A = 0 B N = 0 B
48 47 nnzd A = 0 B N = 0 B
49 48 26 syl A = 0 B N = 0 0 gcd B = B
50 32 3ad2ant2 A = 0 B N = 0 B = B
51 46 49 50 3eqtrd A = 0 B N = 0 A gcd B = B
52 simp3 A = 0 B N = 0 N = 0
53 51 52 oveq12d A = 0 B N = 0 A gcd B N = B 0
54 47 nncnd A = 0 B N = 0 B
55 54 exp0d A = 0 B N = 0 B 0 = 1
56 53 55 eqtrd A = 0 B N = 0 A gcd B N = 1
57 45 52 oveq12d A = 0 B N = 0 A N = 0 0
58 0exp0e1 0 0 = 1
59 58 a1i A = 0 B N = 0 0 0 = 1
60 57 59 eqtrd A = 0 B N = 0 A N = 1
61 52 oveq2d A = 0 B N = 0 B N = B 0
62 61 55 eqtrd A = 0 B N = 0 B N = 1
63 60 62 oveq12d A = 0 B N = 0 A N gcd B N = 1 gcd 1
64 44 56 63 3eqtr4a A = 0 B N = 0 A gcd B N = A N gcd B N
65 64 3expia A = 0 B N = 0 A gcd B N = A N gcd B N
66 40 65 jaod A = 0 B N N = 0 A gcd B N = A N gcd B N
67 5 66 syl5bi A = 0 B N 0 A gcd B N = A N gcd B N
68 nnnn0 A A 0
69 68 3ad2ant1 A B = 0 N A 0
70 10 3ad2ant3 A B = 0 N N 0
71 69 70 nn0expcld A B = 0 N A N 0
72 nn0gcdid0 A N 0 A N gcd 0 = A N
73 71 72 syl A B = 0 N A N gcd 0 = A N
74 simp2 A B = 0 N B = 0
75 74 oveq1d A B = 0 N B N = 0 N
76 6 3ad2ant3 A B = 0 N 0 N = 0
77 75 76 eqtrd A B = 0 N B N = 0
78 77 oveq2d A B = 0 N A N gcd B N = A N gcd 0
79 74 oveq2d A B = 0 N A gcd B = A gcd 0
80 nn0gcdid0 A 0 A gcd 0 = A
81 68 80 syl A A gcd 0 = A
82 81 3ad2ant1 A B = 0 N A gcd 0 = A
83 79 82 eqtrd A B = 0 N A gcd B = A
84 83 oveq1d A B = 0 N A gcd B N = A N
85 73 78 84 3eqtr4rd A B = 0 N A gcd B N = A N gcd B N
86 85 3expia A B = 0 N A gcd B N = A N gcd B N
87 nncn A A
88 87 exp0d A A 0 = 1
89 88 43 eqtr4di A A 0 = 1 gcd 1
90 81 oveq1d A A gcd 0 0 = A 0
91 58 a1i A 0 0 = 1
92 88 91 oveq12d A A 0 gcd 0 0 = 1 gcd 1
93 89 90 92 3eqtr4d A A gcd 0 0 = A 0 gcd 0 0
94 93 3ad2ant1 A B = 0 N = 0 A gcd 0 0 = A 0 gcd 0 0
95 simp2 A B = 0 N = 0 B = 0
96 95 oveq2d A B = 0 N = 0 A gcd B = A gcd 0
97 simp3 A B = 0 N = 0 N = 0
98 96 97 oveq12d A B = 0 N = 0 A gcd B N = A gcd 0 0
99 97 oveq2d A B = 0 N = 0 A N = A 0
100 95 97 oveq12d A B = 0 N = 0 B N = 0 0
101 99 100 oveq12d A B = 0 N = 0 A N gcd B N = A 0 gcd 0 0
102 94 98 101 3eqtr4d A B = 0 N = 0 A gcd B N = A N gcd B N
103 102 3expia A B = 0 N = 0 A gcd B N = A N gcd B N
104 86 103 jaod A B = 0 N N = 0 A gcd B N = A N gcd B N
105 5 104 syl5bi A B = 0 N 0 A gcd B N = A N gcd B N
106 gcd0val 0 gcd 0 = 0
107 6 106 eqtr4di N 0 N = 0 gcd 0
108 106 a1i N 0 gcd 0 = 0
109 108 oveq1d N 0 gcd 0 N = 0 N
110 6 6 oveq12d N 0 N gcd 0 N = 0 gcd 0
111 107 109 110 3eqtr4d N 0 gcd 0 N = 0 N gcd 0 N
112 111 3ad2ant3 A = 0 B = 0 N 0 gcd 0 N = 0 N gcd 0 N
113 simp1 A = 0 B = 0 N A = 0
114 simp2 A = 0 B = 0 N B = 0
115 113 114 oveq12d A = 0 B = 0 N A gcd B = 0 gcd 0
116 115 oveq1d A = 0 B = 0 N A gcd B N = 0 gcd 0 N
117 113 oveq1d A = 0 B = 0 N A N = 0 N
118 114 oveq1d A = 0 B = 0 N B N = 0 N
119 117 118 oveq12d A = 0 B = 0 N A N gcd B N = 0 N gcd 0 N
120 112 116 119 3eqtr4d A = 0 B = 0 N A gcd B N = A N gcd B N
121 120 3expia A = 0 B = 0 N A gcd B N = A N gcd B N
122 58 43 eqtr4i 0 0 = 1 gcd 1
123 106 oveq1i 0 gcd 0 0 = 0 0
124 58 58 oveq12i 0 0 gcd 0 0 = 1 gcd 1
125 122 123 124 3eqtr4i 0 gcd 0 0 = 0 0 gcd 0 0
126 simp1 A = 0 B = 0 N = 0 A = 0
127 simp2 A = 0 B = 0 N = 0 B = 0
128 126 127 oveq12d A = 0 B = 0 N = 0 A gcd B = 0 gcd 0
129 simp3 A = 0 B = 0 N = 0 N = 0
130 128 129 oveq12d A = 0 B = 0 N = 0 A gcd B N = 0 gcd 0 0
131 126 129 oveq12d A = 0 B = 0 N = 0 A N = 0 0
132 127 129 oveq12d A = 0 B = 0 N = 0 B N = 0 0
133 131 132 oveq12d A = 0 B = 0 N = 0 A N gcd B N = 0 0 gcd 0 0
134 125 130 133 3eqtr4a A = 0 B = 0 N = 0 A gcd B N = A N gcd B N
135 134 3expia A = 0 B = 0 N = 0 A gcd B N = A N gcd B N
136 121 135 jaod A = 0 B = 0 N N = 0 A gcd B N = A N gcd B N
137 5 136 syl5bi A = 0 B = 0 N 0 A gcd B N = A N gcd B N
138 4 67 105 137 ccase A A = 0 B B = 0 N 0 A gcd B N = A N gcd B N
139 1 2 138 syl2anb A 0 B 0 N 0 A gcd B N = A N gcd B N
140 139 3impia A 0 B 0 N 0 A gcd B N = A N gcd B N