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

Theorem eucalglt 11914
Description: The second member of the state decreases with each iteration of the step function  E for Euclid's Algorithm. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 29-May-2014.)
Hypothesis
Ref Expression
eucalgval.1  |-  E  =  ( x  e.  NN0 ,  y  e.  NN0  |->  if ( y  =  0 , 
<. x ,  y >. ,  <. y ,  ( x  mod  y )
>. ) )
Assertion
Ref Expression
eucalglt  |-  ( X  e.  ( NN0  X.  NN0 )  ->  ( ( 2nd `  ( E `
 X ) )  =/=  0  ->  ( 2nd `  ( E `  X ) )  < 
( 2nd `  X
) ) )
Distinct variable group:    x, y, X
Allowed substitution hints:    E( x, y)

Proof of Theorem eucalglt
StepHypRef Expression
1 eucalgval.1 . . . . . . . 8  |-  E  =  ( x  e.  NN0 ,  y  e.  NN0  |->  if ( y  =  0 , 
<. x ,  y >. ,  <. y ,  ( x  mod  y )
>. ) )
21eucalgval 11911 . . . . . . 7  |-  ( X  e.  ( NN0  X.  NN0 )  ->  ( E `
 X )  =  if ( ( 2nd `  X )  =  0 ,  X ,  <. ( 2nd `  X ) ,  (  mod  `  X
) >. ) )
32adantr 274 . . . . . 6  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( E `  X )  =  if ( ( 2nd `  X )  =  0 ,  X ,  <. ( 2nd `  X ) ,  (  mod  `  X
) >. ) )
4 simpr 109 . . . . . . . 8  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  ( E `  X ) )  =/=  0 )
5 iftrue 3510 . . . . . . . . . . . . 13  |-  ( ( 2nd `  X )  =  0  ->  if ( ( 2nd `  X
)  =  0 ,  X ,  <. ( 2nd `  X ) ,  (  mod  `  X
) >. )  =  X )
65eqeq2d 2169 . . . . . . . . . . . 12  |-  ( ( 2nd `  X )  =  0  ->  (
( E `  X
)  =  if ( ( 2nd `  X
)  =  0 ,  X ,  <. ( 2nd `  X ) ,  (  mod  `  X
) >. )  <->  ( E `  X )  =  X ) )
7 fveq2 5465 . . . . . . . . . . . 12  |-  ( ( E `  X )  =  X  ->  ( 2nd `  ( E `  X ) )  =  ( 2nd `  X
) )
86, 7syl6bi 162 . . . . . . . . . . 11  |-  ( ( 2nd `  X )  =  0  ->  (
( E `  X
)  =  if ( ( 2nd `  X
)  =  0 ,  X ,  <. ( 2nd `  X ) ,  (  mod  `  X
) >. )  ->  ( 2nd `  ( E `  X ) )  =  ( 2nd `  X
) ) )
9 eqeq2 2167 . . . . . . . . . . 11  |-  ( ( 2nd `  X )  =  0  ->  (
( 2nd `  ( E `  X )
)  =  ( 2nd `  X )  <->  ( 2nd `  ( E `  X
) )  =  0 ) )
108, 9sylibd 148 . . . . . . . . . 10  |-  ( ( 2nd `  X )  =  0  ->  (
( E `  X
)  =  if ( ( 2nd `  X
)  =  0 ,  X ,  <. ( 2nd `  X ) ,  (  mod  `  X
) >. )  ->  ( 2nd `  ( E `  X ) )  =  0 ) )
113, 10syl5com 29 . . . . . . . . 9  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  (
( 2nd `  X
)  =  0  -> 
( 2nd `  ( E `  X )
)  =  0 ) )
1211necon3ad 2369 . . . . . . . 8  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  (
( 2nd `  ( E `  X )
)  =/=  0  ->  -.  ( 2nd `  X
)  =  0 ) )
134, 12mpd 13 . . . . . . 7  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  -.  ( 2nd `  X )  =  0 )
1413iffalsed 3515 . . . . . 6  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  if ( ( 2nd `  X
)  =  0 ,  X ,  <. ( 2nd `  X ) ,  (  mod  `  X
) >. )  =  <. ( 2nd `  X ) ,  (  mod  `  X
) >. )
153, 14eqtrd 2190 . . . . 5  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( E `  X )  =  <. ( 2nd `  X
) ,  (  mod  `  X ) >. )
1615fveq2d 5469 . . . 4  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  ( E `  X ) )  =  ( 2nd `  <. ( 2nd `  X ) ,  (  mod  `  X
) >. ) )
17 xp2nd 6108 . . . . . 6  |-  ( X  e.  ( NN0  X.  NN0 )  ->  ( 2nd `  X )  e.  NN0 )
1817adantr 274 . . . . 5  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  X )  e. 
NN0 )
19 1st2nd2 6117 . . . . . . . . 9  |-  ( X  e.  ( NN0  X.  NN0 )  ->  X  = 
<. ( 1st `  X
) ,  ( 2nd `  X ) >. )
2019adantr 274 . . . . . . . 8  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  X  =  <. ( 1st `  X
) ,  ( 2nd `  X ) >. )
2120fveq2d 5469 . . . . . . 7  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  (  mod  `  X )  =  (  mod  `  <. ( 1st `  X ) ,  ( 2nd `  X
) >. ) )
22 df-ov 5821 . . . . . . 7  |-  ( ( 1st `  X )  mod  ( 2nd `  X
) )  =  (  mod  `  <. ( 1st `  X ) ,  ( 2nd `  X )
>. )
2321, 22eqtr4di 2208 . . . . . 6  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  (  mod  `  X )  =  ( ( 1st `  X
)  mod  ( 2nd `  X ) ) )
24 xp1st 6107 . . . . . . . . 9  |-  ( X  e.  ( NN0  X.  NN0 )  ->  ( 1st `  X )  e.  NN0 )
2524adantr 274 . . . . . . . 8  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 1st `  X )  e. 
NN0 )
2625nn0zd 9267 . . . . . . 7  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 1st `  X )  e.  ZZ )
2713neqned 2334 . . . . . . . 8  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  X )  =/=  0 )
28 elnnne0 9087 . . . . . . . 8  |-  ( ( 2nd `  X )  e.  NN  <->  ( ( 2nd `  X )  e. 
NN0  /\  ( 2nd `  X )  =/=  0
) )
2918, 27, 28sylanbrc 414 . . . . . . 7  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  X )  e.  NN )
3026, 29zmodcld 10226 . . . . . 6  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  (
( 1st `  X
)  mod  ( 2nd `  X ) )  e. 
NN0 )
3123, 30eqeltrd 2234 . . . . 5  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  (  mod  `  X )  e. 
NN0 )
32 op2ndg 6093 . . . . 5  |-  ( ( ( 2nd `  X
)  e.  NN0  /\  (  mod  `  X )  e.  NN0 )  ->  ( 2nd `  <. ( 2nd `  X
) ,  (  mod  `  X ) >. )  =  (  mod  `  X
) )
3318, 31, 32syl2anc 409 . . . 4  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  <. ( 2nd `  X
) ,  (  mod  `  X ) >. )  =  (  mod  `  X
) )
3416, 33, 233eqtrd 2194 . . 3  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  ( E `  X ) )  =  ( ( 1st `  X
)  mod  ( 2nd `  X ) ) )
35 zq 9517 . . . . 5  |-  ( ( 1st `  X )  e.  ZZ  ->  ( 1st `  X )  e.  QQ )
3626, 35syl 14 . . . 4  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 1st `  X )  e.  QQ )
3718nn0zd 9267 . . . . 5  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  X )  e.  ZZ )
38 zq 9517 . . . . 5  |-  ( ( 2nd `  X )  e.  ZZ  ->  ( 2nd `  X )  e.  QQ )
3937, 38syl 14 . . . 4  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  X )  e.  QQ )
4029nngt0d 8860 . . . 4  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  0  <  ( 2nd `  X
) )
41 modqlt 10214 . . . 4  |-  ( ( ( 1st `  X
)  e.  QQ  /\  ( 2nd `  X )  e.  QQ  /\  0  <  ( 2nd `  X
) )  ->  (
( 1st `  X
)  mod  ( 2nd `  X ) )  < 
( 2nd `  X
) )
4236, 39, 40, 41syl3anc 1220 . . 3  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  (
( 1st `  X
)  mod  ( 2nd `  X ) )  < 
( 2nd `  X
) )
4334, 42eqbrtrd 3986 . 2  |-  ( ( X  e.  ( NN0 
X.  NN0 )  /\  ( 2nd `  ( E `  X ) )  =/=  0 )  ->  ( 2nd `  ( E `  X ) )  < 
( 2nd `  X
) )
4443ex 114 1  |-  ( X  e.  ( NN0  X.  NN0 )  ->  ( ( 2nd `  ( E `
 X ) )  =/=  0  ->  ( 2nd `  ( E `  X ) )  < 
( 2nd `  X
) ) )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 103    = wceq 1335    e. wcel 2128    =/= wne 2327   ifcif 3505   <.cop 3563   class class class wbr 3965    X. cxp 4581   ` cfv 5167  (class class class)co 5818    e. cmpo 5820   1stc1st 6080   2ndc2nd 6081   0cc0 7715    < clt 7895   NNcn 8816   NN0cn0 9073   ZZcz 9150   QQcq 9510    mod cmo 10203
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 604  ax-in2 605  ax-io 699  ax-5 1427  ax-7 1428  ax-gen 1429  ax-ie1 1473  ax-ie2 1474  ax-8 1484  ax-10 1485  ax-11 1486  ax-i12 1487  ax-bndl 1489  ax-4 1490  ax-17 1506  ax-i9 1510  ax-ial 1514  ax-i5r 1515  ax-13 2130  ax-14 2131  ax-ext 2139  ax-sep 4082  ax-pow 4134  ax-pr 4168  ax-un 4392  ax-setind 4494  ax-cnex 7806  ax-resscn 7807  ax-1cn 7808  ax-1re 7809  ax-icn 7810  ax-addcl 7811  ax-addrcl 7812  ax-mulcl 7813  ax-mulrcl 7814  ax-addcom 7815  ax-mulcom 7816  ax-addass 7817  ax-mulass 7818  ax-distr 7819  ax-i2m1 7820  ax-0lt1 7821  ax-1rid 7822  ax-0id 7823  ax-rnegex 7824  ax-precex 7825  ax-cnre 7826  ax-pre-ltirr 7827  ax-pre-ltwlin 7828  ax-pre-lttrn 7829  ax-pre-apti 7830  ax-pre-ltadd 7831  ax-pre-mulgt0 7832  ax-pre-mulext 7833  ax-arch 7834
This theorem depends on definitions:  df-bi 116  df-dc 821  df-3or 964  df-3an 965  df-tru 1338  df-fal 1341  df-nf 1441  df-sb 1743  df-eu 2009  df-mo 2010  df-clab 2144  df-cleq 2150  df-clel 2153  df-nfc 2288  df-ne 2328  df-nel 2423  df-ral 2440  df-rex 2441  df-reu 2442  df-rmo 2443  df-rab 2444  df-v 2714  df-sbc 2938  df-csb 3032  df-dif 3104  df-un 3106  df-in 3108  df-ss 3115  df-nul 3395  df-if 3506  df-pw 3545  df-sn 3566  df-pr 3567  df-op 3569  df-uni 3773  df-int 3808  df-iun 3851  df-br 3966  df-opab 4026  df-mpt 4027  df-id 4252  df-po 4255  df-iso 4256  df-xp 4589  df-rel 4590  df-cnv 4591  df-co 4592  df-dm 4593  df-rn 4594  df-res 4595  df-ima 4596  df-iota 5132  df-fun 5169  df-fn 5170  df-f 5171  df-fv 5175  df-riota 5774  df-ov 5821  df-oprab 5822  df-mpo 5823  df-1st 6082  df-2nd 6083  df-pnf 7897  df-mnf 7898  df-xr 7899  df-ltxr 7900  df-le 7901  df-sub 8031  df-neg 8032  df-reap 8433  df-ap 8440  df-div 8529  df-inn 8817  df-n0 9074  df-z 9151  df-q 9511  df-rp 9543  df-fl 10151  df-mod 10204
This theorem is referenced by:  eucalgcvga  11915
  Copyright terms: Public domain W3C validator