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

Theorem ialgcvg 10574
Description: One way to prove that an algorithm halts is to construct a countdown function  C : S --> NN0 whose value is guaranteed to decrease for each iteration of  F until it reaches  0. That is, if  X  e.  S is not a fixed point of  F, then  ( C `  ( F `  X ) )  <  ( C `
 X ).

If  C is a countdown function for algorithm  F, the sequence  ( C `  ( R `  k ) ) reaches  0 after at most  N steps, where  N is the value of  C for the initial state  A. (Contributed by Paul Chapman, 22-Jun-2011.)

Hypotheses
Ref Expression
algcvg.1  |-  F : S
--> S
algcvg.2  |-  R  =  seq 0 ( ( F  o.  1st ) ,  ( NN0  X.  { A } ) ,  S )
algcvg.3  |-  C : S
--> NN0
algcvg.4  |-  ( z  e.  S  ->  (
( C `  ( F `  z )
)  =/=  0  -> 
( C `  ( F `  z )
)  <  ( C `  z ) ) )
algcvg.5  |-  N  =  ( C `  A
)
ialgcvg.s  |-  S  e.  V
Assertion
Ref Expression
ialgcvg  |-  ( A  e.  S  ->  ( C `  ( R `  N ) )  =  0 )
Distinct variable groups:    z, C    z, F    z, R    z, S
Allowed substitution hints:    A( z)    N( z)    V( z)

Proof of Theorem ialgcvg
Dummy variable  k is distinct from all other variables.
StepHypRef Expression
1 nn0uz 8734 . . . 4  |-  NN0  =  ( ZZ>= `  0 )
2 algcvg.2 . . . 4  |-  R  =  seq 0 ( ( F  o.  1st ) ,  ( NN0  X.  { A } ) ,  S )
3 0zd 8444 . . . 4  |-  ( A  e.  S  ->  0  e.  ZZ )
4 id 19 . . . 4  |-  ( A  e.  S  ->  A  e.  S )
5 algcvg.1 . . . . 5  |-  F : S
--> S
65a1i 9 . . . 4  |-  ( A  e.  S  ->  F : S --> S )
7 ialgcvg.s . . . . 5  |-  S  e.  V
87a1i 9 . . . 4  |-  ( A  e.  S  ->  S  e.  V )
91, 2, 3, 4, 6, 8ialgrf 10571 . . 3  |-  ( A  e.  S  ->  R : NN0 --> S )
10 algcvg.5 . . . 4  |-  N  =  ( C `  A
)
11 algcvg.3 . . . . 5  |-  C : S
--> NN0
1211ffvelrni 5333 . . . 4  |-  ( A  e.  S  ->  ( C `  A )  e.  NN0 )
1310, 12syl5eqel 2166 . . 3  |-  ( A  e.  S  ->  N  e.  NN0 )
14 fvco3 5276 . . 3  |-  ( ( R : NN0 --> S  /\  N  e.  NN0 )  -> 
( ( C  o.  R ) `  N
)  =  ( C `
 ( R `  N ) ) )
159, 13, 14syl2anc 403 . 2  |-  ( A  e.  S  ->  (
( C  o.  R
) `  N )  =  ( C `  ( R `  N ) ) )
16 fco 5087 . . . 4  |-  ( ( C : S --> NN0  /\  R : NN0 --> S )  ->  ( C  o.  R ) : NN0 --> NN0 )
1711, 9, 16sylancr 405 . . 3  |-  ( A  e.  S  ->  ( C  o.  R ) : NN0 --> NN0 )
18 0nn0 8370 . . . . . 6  |-  0  e.  NN0
19 fvco3 5276 . . . . . 6  |-  ( ( R : NN0 --> S  /\  0  e.  NN0 )  -> 
( ( C  o.  R ) `  0
)  =  ( C `
 ( R ` 
0 ) ) )
209, 18, 19sylancl 404 . . . . 5  |-  ( A  e.  S  ->  (
( C  o.  R
) `  0 )  =  ( C `  ( R `  0 ) ) )
211, 2, 3, 4, 6, 8ialgr0 10570 . . . . . 6  |-  ( A  e.  S  ->  ( R `  0 )  =  A )
2221fveq2d 5213 . . . . 5  |-  ( A  e.  S  ->  ( C `  ( R `  0 ) )  =  ( C `  A ) )
2320, 22eqtrd 2114 . . . 4  |-  ( A  e.  S  ->  (
( C  o.  R
) `  0 )  =  ( C `  A ) )
2423, 10syl6reqr 2133 . . 3  |-  ( A  e.  S  ->  N  =  ( ( C  o.  R ) ` 
0 ) )
259ffvelrnda 5334 . . . . 5  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( R `  k
)  e.  S )
26 fveq2 5209 . . . . . . . . 9  |-  ( z  =  ( R `  k )  ->  ( F `  z )  =  ( F `  ( R `  k ) ) )
2726fveq2d 5213 . . . . . . . 8  |-  ( z  =  ( R `  k )  ->  ( C `  ( F `  z ) )  =  ( C `  ( F `  ( R `  k ) ) ) )
2827neeq1d 2264 . . . . . . 7  |-  ( z  =  ( R `  k )  ->  (
( C `  ( F `  z )
)  =/=  0  <->  ( C `  ( F `  ( R `  k
) ) )  =/=  0 ) )
29 fveq2 5209 . . . . . . . 8  |-  ( z  =  ( R `  k )  ->  ( C `  z )  =  ( C `  ( R `  k ) ) )
3027, 29breq12d 3806 . . . . . . 7  |-  ( z  =  ( R `  k )  ->  (
( C `  ( F `  z )
)  <  ( C `  z )  <->  ( C `  ( F `  ( R `  k )
) )  <  ( C `  ( R `  k ) ) ) )
3128, 30imbi12d 232 . . . . . 6  |-  ( z  =  ( R `  k )  ->  (
( ( C `  ( F `  z ) )  =/=  0  -> 
( C `  ( F `  z )
)  <  ( C `  z ) )  <->  ( ( C `  ( F `  ( R `  k
) ) )  =/=  0  ->  ( C `  ( F `  ( R `  k )
) )  <  ( C `  ( R `  k ) ) ) ) )
32 algcvg.4 . . . . . 6  |-  ( z  e.  S  ->  (
( C `  ( F `  z )
)  =/=  0  -> 
( C `  ( F `  z )
)  <  ( C `  z ) ) )
3331, 32vtoclga 2665 . . . . 5  |-  ( ( R `  k )  e.  S  ->  (
( C `  ( F `  ( R `  k ) ) )  =/=  0  ->  ( C `  ( F `  ( R `  k
) ) )  < 
( C `  ( R `  k )
) ) )
3425, 33syl 14 . . . 4  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( ( C `  ( F `  ( R `
 k ) ) )  =/=  0  -> 
( C `  ( F `  ( R `  k ) ) )  <  ( C `  ( R `  k ) ) ) )
35 peano2nn0 8395 . . . . . . 7  |-  ( k  e.  NN0  ->  ( k  +  1 )  e. 
NN0 )
36 fvco3 5276 . . . . . . 7  |-  ( ( R : NN0 --> S  /\  ( k  +  1 )  e.  NN0 )  ->  ( ( C  o.  R ) `  (
k  +  1 ) )  =  ( C `
 ( R `  ( k  +  1 ) ) ) )
379, 35, 36syl2an 283 . . . . . 6  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( ( C  o.  R ) `  (
k  +  1 ) )  =  ( C `
 ( R `  ( k  +  1 ) ) ) )
381, 2, 3, 4, 6, 8ialgrp1 10572 . . . . . . 7  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( R `  (
k  +  1 ) )  =  ( F `
 ( R `  k ) ) )
3938fveq2d 5213 . . . . . 6  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( C `  ( R `  ( k  +  1 ) ) )  =  ( C `
 ( F `  ( R `  k ) ) ) )
4037, 39eqtrd 2114 . . . . 5  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( ( C  o.  R ) `  (
k  +  1 ) )  =  ( C `
 ( F `  ( R `  k ) ) ) )
4140neeq1d 2264 . . . 4  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( ( ( C  o.  R ) `  ( k  +  1 ) )  =/=  0  <->  ( C `  ( F `
 ( R `  k ) ) )  =/=  0 ) )
42 fvco3 5276 . . . . . 6  |-  ( ( R : NN0 --> S  /\  k  e.  NN0 )  -> 
( ( C  o.  R ) `  k
)  =  ( C `
 ( R `  k ) ) )
439, 42sylan 277 . . . . 5  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( ( C  o.  R ) `  k
)  =  ( C `
 ( R `  k ) ) )
4440, 43breq12d 3806 . . . 4  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( ( ( C  o.  R ) `  ( k  +  1 ) )  <  (
( C  o.  R
) `  k )  <->  ( C `  ( F `
 ( R `  k ) ) )  <  ( C `  ( R `  k ) ) ) )
4534, 41, 443imtr4d 201 . . 3  |-  ( ( A  e.  S  /\  k  e.  NN0 )  -> 
( ( ( C  o.  R ) `  ( k  +  1 ) )  =/=  0  ->  ( ( C  o.  R ) `  (
k  +  1 ) )  <  ( ( C  o.  R ) `
 k ) ) )
4617, 24, 45nn0seqcvgd 10567 . 2  |-  ( A  e.  S  ->  (
( C  o.  R
) `  N )  =  0 )
4715, 46eqtr3d 2116 1  |-  ( A  e.  S  ->  ( C `  ( R `  N ) )  =  0 )
Colors of variables: wff set class
Syntax hints:    -> wi 4    /\ wa 102    = wceq 1285    e. wcel 1434    =/= wne 2246   {csn 3406   class class class wbr 3793    X. cxp 4369    o. ccom 4375   -->wf 4928   ` cfv 4932  (class class class)co 5543   1stc1st 5796   0cc0 7043   1c1 7044    + caddc 7046    < clt 7215   NN0cn0 8355    seqcseq 9521
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-mp 7  ax-ia1 104  ax-ia2 105  ax-ia3 106  ax-in1 577  ax-in2 578  ax-io 663  ax-5 1377  ax-7 1378  ax-gen 1379  ax-ie1 1423  ax-ie2 1424  ax-8 1436  ax-10 1437  ax-11 1438  ax-i12 1439  ax-bndl 1440  ax-4 1441  ax-13 1445  ax-14 1446  ax-17 1460  ax-i9 1464  ax-ial 1468  ax-i5r 1469  ax-ext 2064  ax-coll 3901  ax-sep 3904  ax-nul 3912  ax-pow 3956  ax-pr 3972  ax-un 4196  ax-setind 4288  ax-iinf 4337  ax-cnex 7129  ax-resscn 7130  ax-1cn 7131  ax-1re 7132  ax-icn 7133  ax-addcl 7134  ax-addrcl 7135  ax-mulcl 7136  ax-addcom 7138  ax-addass 7140  ax-distr 7142  ax-i2m1 7143  ax-0lt1 7144  ax-0id 7146  ax-rnegex 7147  ax-cnre 7149  ax-pre-ltirr 7150  ax-pre-ltwlin 7151  ax-pre-lttrn 7152  ax-pre-apti 7153  ax-pre-ltadd 7154
This theorem depends on definitions:  df-bi 115  df-dc 777  df-3or 921  df-3an 922  df-tru 1288  df-fal 1291  df-nf 1391  df-sb 1687  df-eu 1945  df-mo 1946  df-clab 2069  df-cleq 2075  df-clel 2078  df-nfc 2209  df-ne 2247  df-nel 2341  df-ral 2354  df-rex 2355  df-reu 2356  df-rab 2358  df-v 2604  df-sbc 2817  df-csb 2910  df-dif 2976  df-un 2978  df-in 2980  df-ss 2987  df-nul 3259  df-pw 3392  df-sn 3412  df-pr 3413  df-op 3415  df-uni 3610  df-int 3645  df-iun 3688  df-br 3794  df-opab 3848  df-mpt 3849  df-tr 3884  df-id 4056  df-iord 4129  df-on 4131  df-ilim 4132  df-suc 4134  df-iom 4340  df-xp 4377  df-rel 4378  df-cnv 4379  df-co 4380  df-dm 4381  df-rn 4382  df-res 4383  df-ima 4384  df-iota 4897  df-fun 4934  df-fn 4935  df-f 4936  df-f1 4937  df-fo 4938  df-f1o 4939  df-fv 4940  df-riota 5499  df-ov 5546  df-oprab 5547  df-mpt2 5548  df-1st 5798  df-2nd 5799  df-recs 5954  df-frec 6040  df-pnf 7217  df-mnf 7218  df-xr 7219  df-ltxr 7220  df-le 7221  df-sub 7348  df-neg 7349  df-inn 8107  df-n0 8356  df-z 8433  df-uz 8701  df-iseq 9522
This theorem is referenced by:  ialgcvga  10577
  Copyright terms: Public domain W3C validator