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

Theorem gcdval 11490
Description: The value of the  gcd operator.  ( M  gcd  N ) is the greatest common divisor of  M and  N. If  M and  N 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  |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  N
)  =  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  |  ( n 
||  M  /\  n  ||  N ) } ,  RR ,  <  ) ) )
Distinct variable groups:    n, M    n, N

Proof of Theorem gcdval
Dummy variables  x  y are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 simpr 109 . . . . 5  |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  ( M  =  0  /\  N  =  0 ) )  -> 
( M  =  0  /\  N  =  0 ) )
21iftrued 3445 . . . 4  |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  ( M  =  0  /\  N  =  0 ) )  ->  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  | 
( n  ||  M  /\  n  ||  N ) } ,  RR ,  <  ) )  =  0 )
3 0nn0 8890 . . . 4  |-  0  e.  NN0
42, 3syl6eqel 2203 . . 3  |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  ( M  =  0  /\  N  =  0 ) )  ->  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  | 
( n  ||  M  /\  n  ||  N ) } ,  RR ,  <  ) )  e.  NN0 )
5 simpr 109 . . . . . 6  |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  -.  ( M  =  0  /\  N  =  0 ) )  ->  -.  ( M  =  0  /\  N  =  0 ) )
65iffalsed 3448 . . . . 5  |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  -.  ( M  =  0  /\  N  =  0 ) )  ->  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  N
) } ,  RR ,  <  ) )  =  sup ( { n  e.  ZZ  |  ( n 
||  M  /\  n  ||  N ) } ,  RR ,  <  ) )
7 gcdsupcl 11489 . . . . 5  |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  -.  ( M  =  0  /\  N  =  0 ) )  ->  sup ( { n  e.  ZZ  |  ( n 
||  M  /\  n  ||  N ) } ,  RR ,  <  )  e.  NN )
86, 7eqeltrd 2189 . . . 4  |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  -.  ( M  =  0  /\  N  =  0 ) )  ->  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  N
) } ,  RR ,  <  ) )  e.  NN )
98nnnn0d 8928 . . 3  |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  -.  ( M  =  0  /\  N  =  0 ) )  ->  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  N
) } ,  RR ,  <  ) )  e. 
NN0 )
10 gcdmndc 11479 . . . 4  |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  -> DECID  ( M  =  0  /\  N  =  0 ) )
11 exmiddc 804 . . . 4  |-  (DECID  ( M  =  0  /\  N  =  0 )  -> 
( ( M  =  0  /\  N  =  0 )  \/  -.  ( M  =  0  /\  N  =  0
) ) )
1210, 11syl 14 . . 3  |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( ( M  =  0  /\  N  =  0 )  \/  -.  ( M  =  0  /\  N  =  0
) ) )
134, 9, 12mpjaodan 770 . 2  |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  N
) } ,  RR ,  <  ) )  e. 
NN0 )
14 eqeq1 2119 . . . . 5  |-  ( x  =  M  ->  (
x  =  0  <->  M  =  0 ) )
1514anbi1d 458 . . . 4  |-  ( x  =  M  ->  (
( x  =  0  /\  y  =  0 )  <->  ( M  =  0  /\  y  =  0 ) ) )
16 breq2 3897 . . . . . . 7  |-  ( x  =  M  ->  (
n  ||  x  <->  n  ||  M
) )
1716anbi1d 458 . . . . . 6  |-  ( x  =  M  ->  (
( n  ||  x  /\  n  ||  y )  <-> 
( n  ||  M  /\  n  ||  y ) ) )
1817rabbidv 2644 . . . . 5  |-  ( x  =  M  ->  { n  e.  ZZ  |  ( n 
||  x  /\  n  ||  y ) }  =  { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  y
) } )
1918supeq1d 6824 . . . 4  |-  ( x  =  M  ->  sup ( { n  e.  ZZ  |  ( n  ||  x  /\  n  ||  y
) } ,  RR ,  <  )  =  sup ( { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  y
) } ,  RR ,  <  ) )
2015, 19ifbieq2d 3460 . . 3  |-  ( x  =  M  ->  if ( ( x  =  0  /\  y  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  | 
( n  ||  x  /\  n  ||  y ) } ,  RR ,  <  ) )  =  if ( ( M  =  0  /\  y  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  | 
( n  ||  M  /\  n  ||  y ) } ,  RR ,  <  ) ) )
21 eqeq1 2119 . . . . 5  |-  ( y  =  N  ->  (
y  =  0  <->  N  =  0 ) )
2221anbi2d 457 . . . 4  |-  ( y  =  N  ->  (
( M  =  0  /\  y  =  0 )  <->  ( M  =  0  /\  N  =  0 ) ) )
23 breq2 3897 . . . . . . 7  |-  ( y  =  N  ->  (
n  ||  y  <->  n  ||  N
) )
2423anbi2d 457 . . . . . 6  |-  ( y  =  N  ->  (
( n  ||  M  /\  n  ||  y )  <-> 
( n  ||  M  /\  n  ||  N ) ) )
2524rabbidv 2644 . . . . 5  |-  ( y  =  N  ->  { n  e.  ZZ  |  ( n 
||  M  /\  n  ||  y ) }  =  { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  N
) } )
2625supeq1d 6824 . . . 4  |-  ( y  =  N  ->  sup ( { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  y
) } ,  RR ,  <  )  =  sup ( { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  N
) } ,  RR ,  <  ) )
2722, 26ifbieq2d 3460 . . 3  |-  ( y  =  N  ->  if ( ( M  =  0  /\  y  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  | 
( n  ||  M  /\  n  ||  y ) } ,  RR ,  <  ) )  =  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  | 
( n  ||  M  /\  n  ||  N ) } ,  RR ,  <  ) ) )
28 df-gcd 11478 . . 3  |-  gcd  =  ( x  e.  ZZ ,  y  e.  ZZ  |->  if ( ( x  =  0  /\  y  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  | 
( n  ||  x  /\  n  ||  y ) } ,  RR ,  <  ) ) )
2920, 27, 28ovmpog 5857 . 2  |-  ( ( M  e.  ZZ  /\  N  e.  ZZ  /\  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  | 
( n  ||  M  /\  n  ||  N ) } ,  RR ,  <  ) )  e.  NN0 )  ->  ( M  gcd  N )  =  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  |  ( n 
||  M  /\  n  ||  N ) } ,  RR ,  <  ) ) )
3013, 29mpd3an3 1297 1  |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  N
)  =  if ( ( M  =  0  /\  N  =  0 ) ,  0 ,  sup ( { n  e.  ZZ  |  ( n 
||  M  /\  n  ||  N ) } ,  RR ,  <  ) ) )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 103    \/ wo 680  DECID wdc 802    = wceq 1312    e. wcel 1461   {crab 2392   ifcif 3438   class class class wbr 3893  (class class class)co 5726   supcsup 6819   RRcr 7540   0cc0 7541    < clt 7718   NNcn 8624   NN0cn0 8875   ZZcz 8952    || cdvds 11335    gcd cgcd 11477
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-coll 4001  ax-sep 4004  ax-nul 4012  ax-pow 4056  ax-pr 4089  ax-un 4313  ax-setind 4410  ax-iinf 4460  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  ax-caucvg 7659
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-tr 3985  df-id 4173  df-po 4176  df-iso 4177  df-iord 4246  df-on 4248  df-ilim 4249  df-suc 4251  df-iom 4463  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-f1 5084  df-fo 5085  df-f1o 5086  df-fv 5087  df-riota 5682  df-ov 5729  df-oprab 5730  df-mpo 5731  df-1st 5990  df-2nd 5991  df-recs 6154  df-frec 6240  df-sup 6821  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-2 8683  df-3 8684  df-4 8685  df-n0 8876  df-z 8953  df-uz 9223  df-q 9308  df-rp 9338  df-fz 9678  df-fzo 9807  df-fl 9930  df-mod 9983  df-seqfrec 10106  df-exp 10180  df-cj 10501  df-re 10502  df-im 10503  df-rsqrt 10656  df-abs 10657  df-dvds 11336  df-gcd 11478
This theorem is referenced by:  gcd0val  11491  gcdn0val  11492  gcdf  11503  gcdcom  11504  dfgcd2  11542  gcdass  11543
  Copyright terms: Public domain W3C validator