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

Theorem gcdval 11671
Description: The value of the gcd operator. (𝑀 gcd 𝑁) is the greatest common divisor of 𝑀 and 𝑁. If 𝑀 and 𝑁 are both 0, the result is defined conventionally as 0. (Contributed by Paul Chapman, 21-Mar-2011.) (Revised by Mario Carneiro, 10-Nov-2013.)
Assertion
Ref Expression
gcdval ((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) → (𝑀 gcd 𝑁) = if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )))
Distinct variable groups:   𝑛,𝑀   𝑛,𝑁

Proof of Theorem gcdval
Dummy variables 𝑥 𝑦 are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 simpr 109 . . . . 5 (((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) ∧ (𝑀 = 0 ∧ 𝑁 = 0)) → (𝑀 = 0 ∧ 𝑁 = 0))
21iftrued 3481 . . . 4 (((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) ∧ (𝑀 = 0 ∧ 𝑁 = 0)) → if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )) = 0)
3 0nn0 9011 . . . 4 0 ∈ ℕ0
42, 3eqeltrdi 2230 . . 3 (((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) ∧ (𝑀 = 0 ∧ 𝑁 = 0)) → if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )) ∈ ℕ0)
5 simpr 109 . . . . . 6 (((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) ∧ ¬ (𝑀 = 0 ∧ 𝑁 = 0)) → ¬ (𝑀 = 0 ∧ 𝑁 = 0))
65iffalsed 3484 . . . . 5 (((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) ∧ ¬ (𝑀 = 0 ∧ 𝑁 = 0)) → if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )) = sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < ))
7 gcdsupcl 11670 . . . . 5 (((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) ∧ ¬ (𝑀 = 0 ∧ 𝑁 = 0)) → sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < ) ∈ ℕ)
86, 7eqeltrd 2216 . . . 4 (((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) ∧ ¬ (𝑀 = 0 ∧ 𝑁 = 0)) → if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )) ∈ ℕ)
98nnnn0d 9049 . . 3 (((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) ∧ ¬ (𝑀 = 0 ∧ 𝑁 = 0)) → if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )) ∈ ℕ0)
10 gcdmndc 11660 . . . 4 ((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) → DECID (𝑀 = 0 ∧ 𝑁 = 0))
11 exmiddc 821 . . . 4 (DECID (𝑀 = 0 ∧ 𝑁 = 0) → ((𝑀 = 0 ∧ 𝑁 = 0) ∨ ¬ (𝑀 = 0 ∧ 𝑁 = 0)))
1210, 11syl 14 . . 3 ((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) → ((𝑀 = 0 ∧ 𝑁 = 0) ∨ ¬ (𝑀 = 0 ∧ 𝑁 = 0)))
134, 9, 12mpjaodan 787 . 2 ((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) → if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )) ∈ ℕ0)
14 eqeq1 2146 . . . . 5 (𝑥 = 𝑀 → (𝑥 = 0 ↔ 𝑀 = 0))
1514anbi1d 460 . . . 4 (𝑥 = 𝑀 → ((𝑥 = 0 ∧ 𝑦 = 0) ↔ (𝑀 = 0 ∧ 𝑦 = 0)))
16 breq2 3936 . . . . . . 7 (𝑥 = 𝑀 → (𝑛𝑥𝑛𝑀))
1716anbi1d 460 . . . . . 6 (𝑥 = 𝑀 → ((𝑛𝑥𝑛𝑦) ↔ (𝑛𝑀𝑛𝑦)))
1817rabbidv 2675 . . . . 5 (𝑥 = 𝑀 → {𝑛 ∈ ℤ ∣ (𝑛𝑥𝑛𝑦)} = {𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑦)})
1918supeq1d 6877 . . . 4 (𝑥 = 𝑀 → sup({𝑛 ∈ ℤ ∣ (𝑛𝑥𝑛𝑦)}, ℝ, < ) = sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑦)}, ℝ, < ))
2015, 19ifbieq2d 3496 . . 3 (𝑥 = 𝑀 → if((𝑥 = 0 ∧ 𝑦 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑥𝑛𝑦)}, ℝ, < )) = if((𝑀 = 0 ∧ 𝑦 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑦)}, ℝ, < )))
21 eqeq1 2146 . . . . 5 (𝑦 = 𝑁 → (𝑦 = 0 ↔ 𝑁 = 0))
2221anbi2d 459 . . . 4 (𝑦 = 𝑁 → ((𝑀 = 0 ∧ 𝑦 = 0) ↔ (𝑀 = 0 ∧ 𝑁 = 0)))
23 breq2 3936 . . . . . . 7 (𝑦 = 𝑁 → (𝑛𝑦𝑛𝑁))
2423anbi2d 459 . . . . . 6 (𝑦 = 𝑁 → ((𝑛𝑀𝑛𝑦) ↔ (𝑛𝑀𝑛𝑁)))
2524rabbidv 2675 . . . . 5 (𝑦 = 𝑁 → {𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑦)} = {𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)})
2625supeq1d 6877 . . . 4 (𝑦 = 𝑁 → sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑦)}, ℝ, < ) = sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < ))
2722, 26ifbieq2d 3496 . . 3 (𝑦 = 𝑁 → if((𝑀 = 0 ∧ 𝑦 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑦)}, ℝ, < )) = if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )))
28 df-gcd 11659 . . 3 gcd = (𝑥 ∈ ℤ, 𝑦 ∈ ℤ ↦ if((𝑥 = 0 ∧ 𝑦 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑥𝑛𝑦)}, ℝ, < )))
2920, 27, 28ovmpog 5908 . 2 ((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ ∧ if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )) ∈ ℕ0) → (𝑀 gcd 𝑁) = if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )))
3013, 29mpd3an3 1316 1 ((𝑀 ∈ ℤ ∧ 𝑁 ∈ ℤ) → (𝑀 gcd 𝑁) = if((𝑀 = 0 ∧ 𝑁 = 0), 0, sup({𝑛 ∈ ℤ ∣ (𝑛𝑀𝑛𝑁)}, ℝ, < )))
Colors of variables: wff set class
Syntax hints:  ¬ wn 3  wi 4  wa 103  wo 697  DECID wdc 819   = wceq 1331  wcel 1480  {crab 2420  ifcif 3474   class class class wbr 3932  (class class class)co 5777  supcsup 6872  cr 7638  0cc0 7639   < clt 7819  cn 8739  0cn0 8996  cz 9073  cdvds 11516   gcd cgcd 11658
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-ia1 105  ax-ia2 106  ax-ia3 107  ax-in1 603  ax-in2 604  ax-io 698  ax-5 1423  ax-7 1424  ax-gen 1425  ax-ie1 1469  ax-ie2 1470  ax-8 1482  ax-10 1483  ax-11 1484  ax-i12 1485  ax-bndl 1486  ax-4 1487  ax-13 1491  ax-14 1492  ax-17 1506  ax-i9 1510  ax-ial 1514  ax-i5r 1515  ax-ext 2121  ax-coll 4046  ax-sep 4049  ax-nul 4057  ax-pow 4101  ax-pr 4134  ax-un 4358  ax-setind 4455  ax-iinf 4505  ax-cnex 7730  ax-resscn 7731  ax-1cn 7732  ax-1re 7733  ax-icn 7734  ax-addcl 7735  ax-addrcl 7736  ax-mulcl 7737  ax-mulrcl 7738  ax-addcom 7739  ax-mulcom 7740  ax-addass 7741  ax-mulass 7742  ax-distr 7743  ax-i2m1 7744  ax-0lt1 7745  ax-1rid 7746  ax-0id 7747  ax-rnegex 7748  ax-precex 7749  ax-cnre 7750  ax-pre-ltirr 7751  ax-pre-ltwlin 7752  ax-pre-lttrn 7753  ax-pre-apti 7754  ax-pre-ltadd 7755  ax-pre-mulgt0 7756  ax-pre-mulext 7757  ax-arch 7758  ax-caucvg 7759
This theorem depends on definitions:  df-bi 116  df-dc 820  df-3or 963  df-3an 964  df-tru 1334  df-fal 1337  df-nf 1437  df-sb 1736  df-eu 2002  df-mo 2003  df-clab 2126  df-cleq 2132  df-clel 2135  df-nfc 2270  df-ne 2309  df-nel 2404  df-ral 2421  df-rex 2422  df-reu 2423  df-rmo 2424  df-rab 2425  df-v 2688  df-sbc 2910  df-csb 3004  df-dif 3073  df-un 3075  df-in 3077  df-ss 3084  df-nul 3364  df-if 3475  df-pw 3512  df-sn 3533  df-pr 3534  df-op 3536  df-uni 3740  df-int 3775  df-iun 3818  df-br 3933  df-opab 3993  df-mpt 3994  df-tr 4030  df-id 4218  df-po 4221  df-iso 4222  df-iord 4291  df-on 4293  df-ilim 4294  df-suc 4296  df-iom 4508  df-xp 4548  df-rel 4549  df-cnv 4550  df-co 4551  df-dm 4552  df-rn 4553  df-res 4554  df-ima 4555  df-iota 5091  df-fun 5128  df-fn 5129  df-f 5130  df-f1 5131  df-fo 5132  df-f1o 5133  df-fv 5134  df-riota 5733  df-ov 5780  df-oprab 5781  df-mpo 5782  df-1st 6041  df-2nd 6042  df-recs 6205  df-frec 6291  df-sup 6874  df-pnf 7821  df-mnf 7822  df-xr 7823  df-ltxr 7824  df-le 7825  df-sub 7954  df-neg 7955  df-reap 8356  df-ap 8363  df-div 8452  df-inn 8740  df-2 8798  df-3 8799  df-4 8800  df-n0 8997  df-z 9074  df-uz 9346  df-q 9434  df-rp 9464  df-fz 9815  df-fzo 9944  df-fl 10067  df-mod 10120  df-seqfrec 10243  df-exp 10317  df-cj 10638  df-re 10639  df-im 10640  df-rsqrt 10794  df-abs 10795  df-dvds 11517  df-gcd 11659
This theorem is referenced by:  gcd0val  11672  gcdn0val  11673  gcdf  11684  gcdcom  11685  dfgcd2  11725  gcdass  11726
  Copyright terms: Public domain W3C validator