Proof of Theorem eucalginv
Step | Hyp | Ref
| Expression |
1 | | eucalgval.1 |
. . . 4
⊢ 𝐸 = (𝑥 ∈ ℕ0, 𝑦 ∈ ℕ0
↦ if(𝑦 = 0,
〈𝑥, 𝑦〉, 〈𝑦, (𝑥 mod 𝑦)〉)) |
2 | 1 | eucalgval 16215 |
. . 3
⊢ (𝑋 ∈ (ℕ0
× ℕ0) → (𝐸‘𝑋) = if((2nd ‘𝑋) = 0, 𝑋, 〈(2nd ‘𝑋), ( mod ‘𝑋)〉)) |
3 | 2 | fveq2d 6760 |
. 2
⊢ (𝑋 ∈ (ℕ0
× ℕ0) → ( gcd ‘(𝐸‘𝑋)) = ( gcd ‘if((2nd
‘𝑋) = 0, 𝑋, 〈(2nd
‘𝑋), ( mod
‘𝑋)〉))) |
4 | | 1st2nd2 7843 |
. . . . . . . . 9
⊢ (𝑋 ∈ (ℕ0
× ℕ0) → 𝑋 = 〈(1st ‘𝑋), (2nd ‘𝑋)〉) |
5 | 4 | adantr 480 |
. . . . . . . 8
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → 𝑋 = 〈(1st ‘𝑋), (2nd ‘𝑋)〉) |
6 | 5 | fveq2d 6760 |
. . . . . . 7
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ( mod ‘𝑋) = ( mod
‘〈(1st ‘𝑋), (2nd ‘𝑋)〉)) |
7 | | df-ov 7258 |
. . . . . . 7
⊢
((1st ‘𝑋) mod (2nd ‘𝑋)) = ( mod
‘〈(1st ‘𝑋), (2nd ‘𝑋)〉) |
8 | 6, 7 | eqtr4di 2797 |
. . . . . 6
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ( mod ‘𝑋) = ((1st
‘𝑋) mod
(2nd ‘𝑋))) |
9 | 8 | oveq2d 7271 |
. . . . 5
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ((2nd
‘𝑋) gcd ( mod
‘𝑋)) =
((2nd ‘𝑋)
gcd ((1st ‘𝑋) mod (2nd ‘𝑋)))) |
10 | | nnz 12272 |
. . . . . 6
⊢
((2nd ‘𝑋) ∈ ℕ → (2nd
‘𝑋) ∈
ℤ) |
11 | | xp1st 7836 |
. . . . . . . . . 10
⊢ (𝑋 ∈ (ℕ0
× ℕ0) → (1st ‘𝑋) ∈
ℕ0) |
12 | 11 | adantr 480 |
. . . . . . . . 9
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → (1st
‘𝑋) ∈
ℕ0) |
13 | 12 | nn0zd 12353 |
. . . . . . . 8
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → (1st
‘𝑋) ∈
ℤ) |
14 | | zmodcl 13539 |
. . . . . . . 8
⊢
(((1st ‘𝑋) ∈ ℤ ∧ (2nd
‘𝑋) ∈ ℕ)
→ ((1st ‘𝑋) mod (2nd ‘𝑋)) ∈
ℕ0) |
15 | 13, 14 | sylancom 587 |
. . . . . . 7
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ((1st
‘𝑋) mod
(2nd ‘𝑋))
∈ ℕ0) |
16 | 15 | nn0zd 12353 |
. . . . . 6
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ((1st
‘𝑋) mod
(2nd ‘𝑋))
∈ ℤ) |
17 | | gcdcom 16148 |
. . . . . 6
⊢
(((2nd ‘𝑋) ∈ ℤ ∧ ((1st
‘𝑋) mod
(2nd ‘𝑋))
∈ ℤ) → ((2nd ‘𝑋) gcd ((1st ‘𝑋) mod (2nd
‘𝑋))) =
(((1st ‘𝑋)
mod (2nd ‘𝑋)) gcd (2nd ‘𝑋))) |
18 | 10, 16, 17 | syl2an2 682 |
. . . . 5
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ((2nd
‘𝑋) gcd
((1st ‘𝑋)
mod (2nd ‘𝑋))) = (((1st ‘𝑋) mod (2nd
‘𝑋)) gcd
(2nd ‘𝑋))) |
19 | | modgcd 16168 |
. . . . . 6
⊢
(((1st ‘𝑋) ∈ ℤ ∧ (2nd
‘𝑋) ∈ ℕ)
→ (((1st ‘𝑋) mod (2nd ‘𝑋)) gcd (2nd
‘𝑋)) =
((1st ‘𝑋)
gcd (2nd ‘𝑋))) |
20 | 13, 19 | sylancom 587 |
. . . . 5
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → (((1st
‘𝑋) mod
(2nd ‘𝑋))
gcd (2nd ‘𝑋)) = ((1st ‘𝑋) gcd (2nd
‘𝑋))) |
21 | 9, 18, 20 | 3eqtrd 2782 |
. . . 4
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ((2nd
‘𝑋) gcd ( mod
‘𝑋)) =
((1st ‘𝑋)
gcd (2nd ‘𝑋))) |
22 | | nnne0 11937 |
. . . . . . . . 9
⊢
((2nd ‘𝑋) ∈ ℕ → (2nd
‘𝑋) ≠
0) |
23 | 22 | adantl 481 |
. . . . . . . 8
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → (2nd
‘𝑋) ≠
0) |
24 | 23 | neneqd 2947 |
. . . . . . 7
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ¬
(2nd ‘𝑋) =
0) |
25 | 24 | iffalsed 4467 |
. . . . . 6
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → if((2nd
‘𝑋) = 0, 𝑋, 〈(2nd
‘𝑋), ( mod
‘𝑋)〉) =
〈(2nd ‘𝑋), ( mod ‘𝑋)〉) |
26 | 25 | fveq2d 6760 |
. . . . 5
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ( gcd
‘if((2nd ‘𝑋) = 0, 𝑋, 〈(2nd ‘𝑋), ( mod ‘𝑋)〉)) = ( gcd
‘〈(2nd ‘𝑋), ( mod ‘𝑋)〉)) |
27 | | df-ov 7258 |
. . . . 5
⊢
((2nd ‘𝑋) gcd ( mod ‘𝑋)) = ( gcd ‘〈(2nd
‘𝑋), ( mod
‘𝑋)〉) |
28 | 26, 27 | eqtr4di 2797 |
. . . 4
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ( gcd
‘if((2nd ‘𝑋) = 0, 𝑋, 〈(2nd ‘𝑋), ( mod ‘𝑋)〉)) = ((2nd
‘𝑋) gcd ( mod
‘𝑋))) |
29 | 5 | fveq2d 6760 |
. . . . 5
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ( gcd ‘𝑋) = ( gcd
‘〈(1st ‘𝑋), (2nd ‘𝑋)〉)) |
30 | | df-ov 7258 |
. . . . 5
⊢
((1st ‘𝑋) gcd (2nd ‘𝑋)) = ( gcd
‘〈(1st ‘𝑋), (2nd ‘𝑋)〉) |
31 | 29, 30 | eqtr4di 2797 |
. . . 4
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ( gcd ‘𝑋) = ((1st
‘𝑋) gcd
(2nd ‘𝑋))) |
32 | 21, 28, 31 | 3eqtr4d 2788 |
. . 3
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) ∈ ℕ) → ( gcd
‘if((2nd ‘𝑋) = 0, 𝑋, 〈(2nd ‘𝑋), ( mod ‘𝑋)〉)) = ( gcd ‘𝑋)) |
33 | | iftrue 4462 |
. . . . 5
⊢
((2nd ‘𝑋) = 0 → if((2nd ‘𝑋) = 0, 𝑋, 〈(2nd ‘𝑋), ( mod ‘𝑋)〉) = 𝑋) |
34 | 33 | fveq2d 6760 |
. . . 4
⊢
((2nd ‘𝑋) = 0 → ( gcd ‘if((2nd
‘𝑋) = 0, 𝑋, 〈(2nd
‘𝑋), ( mod
‘𝑋)〉)) = ( gcd
‘𝑋)) |
35 | 34 | adantl 481 |
. . 3
⊢ ((𝑋 ∈ (ℕ0
× ℕ0) ∧ (2nd ‘𝑋) = 0) → ( gcd
‘if((2nd ‘𝑋) = 0, 𝑋, 〈(2nd ‘𝑋), ( mod ‘𝑋)〉)) = ( gcd ‘𝑋)) |
36 | | xp2nd 7837 |
. . . 4
⊢ (𝑋 ∈ (ℕ0
× ℕ0) → (2nd ‘𝑋) ∈
ℕ0) |
37 | | elnn0 12165 |
. . . 4
⊢
((2nd ‘𝑋) ∈ ℕ0 ↔
((2nd ‘𝑋)
∈ ℕ ∨ (2nd ‘𝑋) = 0)) |
38 | 36, 37 | sylib 217 |
. . 3
⊢ (𝑋 ∈ (ℕ0
× ℕ0) → ((2nd ‘𝑋) ∈ ℕ ∨ (2nd
‘𝑋) =
0)) |
39 | 32, 35, 38 | mpjaodan 955 |
. 2
⊢ (𝑋 ∈ (ℕ0
× ℕ0) → ( gcd ‘if((2nd
‘𝑋) = 0, 𝑋, 〈(2nd
‘𝑋), ( mod
‘𝑋)〉)) = ( gcd
‘𝑋)) |
40 | 3, 39 | eqtrd 2778 |
1
⊢ (𝑋 ∈ (ℕ0
× ℕ0) → ( gcd ‘(𝐸‘𝑋)) = ( gcd ‘𝑋)) |