 Intuitionistic Logic Explorer < Previous   Next > Nearby theorems Mirrors  >  Home  >  ILE Home  >  Th. List  >  eucalglt GIF version

Theorem eucalglt 11578
 Description: The second member of the state decreases with each iteration of the step function 𝐸 for Euclid's Algorithm. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 29-May-2014.)
Hypothesis
Ref Expression
eucalgval.1 𝐸 = (𝑥 ∈ ℕ0, 𝑦 ∈ ℕ0 ↦ if(𝑦 = 0, ⟨𝑥, 𝑦⟩, ⟨𝑦, (𝑥 mod 𝑦)⟩))
Assertion
Ref Expression
eucalglt (𝑋 ∈ (ℕ0 × ℕ0) → ((2nd ‘(𝐸𝑋)) ≠ 0 → (2nd ‘(𝐸𝑋)) < (2nd𝑋)))
Distinct variable group:   𝑥,𝑦,𝑋
Allowed substitution hints:   𝐸(𝑥,𝑦)

Proof of Theorem eucalglt
StepHypRef Expression
1 eucalgval.1 . . . . . . . 8 𝐸 = (𝑥 ∈ ℕ0, 𝑦 ∈ ℕ0 ↦ if(𝑦 = 0, ⟨𝑥, 𝑦⟩, ⟨𝑦, (𝑥 mod 𝑦)⟩))
21eucalgval 11575 . . . . . . 7 (𝑋 ∈ (ℕ0 × ℕ0) → (𝐸𝑋) = if((2nd𝑋) = 0, 𝑋, ⟨(2nd𝑋), ( mod ‘𝑋)⟩))
32adantr 272 . . . . . 6 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (𝐸𝑋) = if((2nd𝑋) = 0, 𝑋, ⟨(2nd𝑋), ( mod ‘𝑋)⟩))
4 simpr 109 . . . . . . . 8 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd ‘(𝐸𝑋)) ≠ 0)
5 iftrue 3443 . . . . . . . . . . . . 13 ((2nd𝑋) = 0 → if((2nd𝑋) = 0, 𝑋, ⟨(2nd𝑋), ( mod ‘𝑋)⟩) = 𝑋)
65eqeq2d 2124 . . . . . . . . . . . 12 ((2nd𝑋) = 0 → ((𝐸𝑋) = if((2nd𝑋) = 0, 𝑋, ⟨(2nd𝑋), ( mod ‘𝑋)⟩) ↔ (𝐸𝑋) = 𝑋))
7 fveq2 5373 . . . . . . . . . . . 12 ((𝐸𝑋) = 𝑋 → (2nd ‘(𝐸𝑋)) = (2nd𝑋))
86, 7syl6bi 162 . . . . . . . . . . 11 ((2nd𝑋) = 0 → ((𝐸𝑋) = if((2nd𝑋) = 0, 𝑋, ⟨(2nd𝑋), ( mod ‘𝑋)⟩) → (2nd ‘(𝐸𝑋)) = (2nd𝑋)))
9 eqeq2 2122 . . . . . . . . . . 11 ((2nd𝑋) = 0 → ((2nd ‘(𝐸𝑋)) = (2nd𝑋) ↔ (2nd ‘(𝐸𝑋)) = 0))
108, 9sylibd 148 . . . . . . . . . 10 ((2nd𝑋) = 0 → ((𝐸𝑋) = if((2nd𝑋) = 0, 𝑋, ⟨(2nd𝑋), ( mod ‘𝑋)⟩) → (2nd ‘(𝐸𝑋)) = 0))
113, 10syl5com 29 . . . . . . . . 9 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → ((2nd𝑋) = 0 → (2nd ‘(𝐸𝑋)) = 0))
1211necon3ad 2322 . . . . . . . 8 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → ((2nd ‘(𝐸𝑋)) ≠ 0 → ¬ (2nd𝑋) = 0))
134, 12mpd 13 . . . . . . 7 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → ¬ (2nd𝑋) = 0)
1413iffalsed 3448 . . . . . 6 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → if((2nd𝑋) = 0, 𝑋, ⟨(2nd𝑋), ( mod ‘𝑋)⟩) = ⟨(2nd𝑋), ( mod ‘𝑋)⟩)
153, 14eqtrd 2145 . . . . 5 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (𝐸𝑋) = ⟨(2nd𝑋), ( mod ‘𝑋)⟩)
1615fveq2d 5377 . . . 4 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd ‘(𝐸𝑋)) = (2nd ‘⟨(2nd𝑋), ( mod ‘𝑋)⟩))
17 xp2nd 6016 . . . . . 6 (𝑋 ∈ (ℕ0 × ℕ0) → (2nd𝑋) ∈ ℕ0)
1817adantr 272 . . . . 5 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd𝑋) ∈ ℕ0)
19 1st2nd2 6025 . . . . . . . . 9 (𝑋 ∈ (ℕ0 × ℕ0) → 𝑋 = ⟨(1st𝑋), (2nd𝑋)⟩)
2019adantr 272 . . . . . . . 8 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → 𝑋 = ⟨(1st𝑋), (2nd𝑋)⟩)
2120fveq2d 5377 . . . . . . 7 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → ( mod ‘𝑋) = ( mod ‘⟨(1st𝑋), (2nd𝑋)⟩))
22 df-ov 5729 . . . . . . 7 ((1st𝑋) mod (2nd𝑋)) = ( mod ‘⟨(1st𝑋), (2nd𝑋)⟩)
2321, 22syl6eqr 2163 . . . . . 6 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → ( mod ‘𝑋) = ((1st𝑋) mod (2nd𝑋)))
24 xp1st 6015 . . . . . . . . 9 (𝑋 ∈ (ℕ0 × ℕ0) → (1st𝑋) ∈ ℕ0)
2524adantr 272 . . . . . . . 8 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (1st𝑋) ∈ ℕ0)
2625nn0zd 9069 . . . . . . 7 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (1st𝑋) ∈ ℤ)
2713neqned 2287 . . . . . . . 8 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd𝑋) ≠ 0)
28 elnnne0 8889 . . . . . . . 8 ((2nd𝑋) ∈ ℕ ↔ ((2nd𝑋) ∈ ℕ0 ∧ (2nd𝑋) ≠ 0))
2918, 27, 28sylanbrc 411 . . . . . . 7 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd𝑋) ∈ ℕ)
3026, 29zmodcld 10005 . . . . . 6 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → ((1st𝑋) mod (2nd𝑋)) ∈ ℕ0)
3123, 30eqeltrd 2189 . . . . 5 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → ( mod ‘𝑋) ∈ ℕ0)
32 op2ndg 6001 . . . . 5 (((2nd𝑋) ∈ ℕ0 ∧ ( mod ‘𝑋) ∈ ℕ0) → (2nd ‘⟨(2nd𝑋), ( mod ‘𝑋)⟩) = ( mod ‘𝑋))
3318, 31, 32syl2anc 406 . . . 4 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd ‘⟨(2nd𝑋), ( mod ‘𝑋)⟩) = ( mod ‘𝑋))
3416, 33, 233eqtrd 2149 . . 3 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd ‘(𝐸𝑋)) = ((1st𝑋) mod (2nd𝑋)))
35 zq 9314 . . . . 5 ((1st𝑋) ∈ ℤ → (1st𝑋) ∈ ℚ)
3626, 35syl 14 . . . 4 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (1st𝑋) ∈ ℚ)
3718nn0zd 9069 . . . . 5 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd𝑋) ∈ ℤ)
38 zq 9314 . . . . 5 ((2nd𝑋) ∈ ℤ → (2nd𝑋) ∈ ℚ)
3937, 38syl 14 . . . 4 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd𝑋) ∈ ℚ)
4029nngt0d 8668 . . . 4 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → 0 < (2nd𝑋))
41 modqlt 9993 . . . 4 (((1st𝑋) ∈ ℚ ∧ (2nd𝑋) ∈ ℚ ∧ 0 < (2nd𝑋)) → ((1st𝑋) mod (2nd𝑋)) < (2nd𝑋))
4236, 39, 40, 41syl3anc 1197 . . 3 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → ((1st𝑋) mod (2nd𝑋)) < (2nd𝑋))
4334, 42eqbrtrd 3913 . 2 ((𝑋 ∈ (ℕ0 × ℕ0) ∧ (2nd ‘(𝐸𝑋)) ≠ 0) → (2nd ‘(𝐸𝑋)) < (2nd𝑋))
4443ex 114 1 (𝑋 ∈ (ℕ0 × ℕ0) → ((2nd ‘(𝐸𝑋)) ≠ 0 → (2nd ‘(𝐸𝑋)) < (2nd𝑋)))
 Colors of variables: wff set class Syntax hints:  ¬ wn 3   → wi 4   ∧ wa 103   = wceq 1312   ∈ wcel 1461   ≠ wne 2280  ifcif 3438  ⟨cop 3494   class class class wbr 3893   × cxp 4495  ‘cfv 5079  (class class class)co 5726   ∈ cmpo 5728  1st c1st 5988  2nd c2nd 5989  0cc0 7541   < clt 7718  ℕcn 8624  ℕ0cn0 8875  ℤcz 8952  ℚcq 9307   mod cmo 9982 This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-mp 7  ax-ia1 105  ax-ia2 106  ax-ia3 107  ax-in1 586  ax-in2 587  ax-io 681  ax-5 1404  ax-7 1405  ax-gen 1406  ax-ie1 1450  ax-ie2 1451  ax-8 1463  ax-10 1464  ax-11 1465  ax-i12 1466  ax-bndl 1467  ax-4 1468  ax-13 1472  ax-14 1473  ax-17 1487  ax-i9 1491  ax-ial 1495  ax-i5r 1496  ax-ext 2095  ax-sep 4004  ax-pow 4056  ax-pr 4089  ax-un 4313  ax-setind 4410  ax-cnex 7630  ax-resscn 7631  ax-1cn 7632  ax-1re 7633  ax-icn 7634  ax-addcl 7635  ax-addrcl 7636  ax-mulcl 7637  ax-mulrcl 7638  ax-addcom 7639  ax-mulcom 7640  ax-addass 7641  ax-mulass 7642  ax-distr 7643  ax-i2m1 7644  ax-0lt1 7645  ax-1rid 7646  ax-0id 7647  ax-rnegex 7648  ax-precex 7649  ax-cnre 7650  ax-pre-ltirr 7651  ax-pre-ltwlin 7652  ax-pre-lttrn 7653  ax-pre-apti 7654  ax-pre-ltadd 7655  ax-pre-mulgt0 7656  ax-pre-mulext 7657  ax-arch 7658 This theorem depends on definitions:  df-bi 116  df-dc 803  df-3or 944  df-3an 945  df-tru 1315  df-fal 1318  df-nf 1418  df-sb 1717  df-eu 1976  df-mo 1977  df-clab 2100  df-cleq 2106  df-clel 2109  df-nfc 2242  df-ne 2281  df-nel 2376  df-ral 2393  df-rex 2394  df-reu 2395  df-rmo 2396  df-rab 2397  df-v 2657  df-sbc 2877  df-csb 2970  df-dif 3037  df-un 3039  df-in 3041  df-ss 3048  df-nul 3328  df-if 3439  df-pw 3476  df-sn 3497  df-pr 3498  df-op 3500  df-uni 3701  df-int 3736  df-iun 3779  df-br 3894  df-opab 3948  df-mpt 3949  df-id 4173  df-po 4176  df-iso 4177  df-xp 4503  df-rel 4504  df-cnv 4505  df-co 4506  df-dm 4507  df-rn 4508  df-res 4509  df-ima 4510  df-iota 5044  df-fun 5081  df-fn 5082  df-f 5083  df-fv 5087  df-riota 5682  df-ov 5729  df-oprab 5730  df-mpo 5731  df-1st 5990  df-2nd 5991  df-pnf 7720  df-mnf 7721  df-xr 7722  df-ltxr 7723  df-le 7724  df-sub 7852  df-neg 7853  df-reap 8249  df-ap 8256  df-div 8340  df-inn 8625  df-n0 8876  df-z 8953  df-q 9308  df-rp 9338  df-fl 9930  df-mod 9983 This theorem is referenced by:  eucalgcvga  11579
 Copyright terms: Public domain W3C validator