MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  swrdccatid Structured version   Unicode version

Theorem swrdccatid 12633
Description: A prefix of a concatenation of length of the first concatenated word is the first word itself. (Contributed by Alexander van der Vekens, 20-Sep-2018.)
Assertion
Ref Expression
swrdccatid  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  (
( A ++  B ) substr  <. 0 ,  N >. )  =  A )

Proof of Theorem swrdccatid
StepHypRef Expression
1 3simpa 991 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( A  e. Word  V  /\  B  e. Word  V ) )
2 lencl 12469 . . . . 5  |-  ( A  e. Word  V  ->  ( # `
 A )  e. 
NN0 )
3 lencl 12469 . . . . . 6  |-  ( B  e. Word  V  ->  ( # `
 B )  e. 
NN0 )
4 simplr 753 . . . . . . . . 9  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  ( # `
 A )  e. 
NN0 )
5 eleq1 2454 . . . . . . . . . 10  |-  ( N  =  ( # `  A
)  ->  ( N  e.  NN0  <->  ( # `  A
)  e.  NN0 )
)
65adantl 464 . . . . . . . . 9  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  ( N  e.  NN0  <->  ( # `  A
)  e.  NN0 )
)
74, 6mpbird 232 . . . . . . . 8  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  N  e.  NN0 )
8 nn0addcl 10748 . . . . . . . . . 10  |-  ( ( ( # `  A
)  e.  NN0  /\  ( # `  B )  e.  NN0 )  -> 
( ( # `  A
)  +  ( # `  B ) )  e. 
NN0 )
98ancoms 451 . . . . . . . . 9  |-  ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  -> 
( ( # `  A
)  +  ( # `  B ) )  e. 
NN0 )
109adantr 463 . . . . . . . 8  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  (
( # `  A )  +  ( # `  B
) )  e.  NN0 )
11 nn0re 10721 . . . . . . . . . . . . 13  |-  ( (
# `  A )  e.  NN0  ->  ( # `  A
)  e.  RR )
1211anim1i 566 . . . . . . . . . . . 12  |-  ( ( ( # `  A
)  e.  NN0  /\  ( # `  B )  e.  NN0 )  -> 
( ( # `  A
)  e.  RR  /\  ( # `  B )  e.  NN0 ) )
1312ancoms 451 . . . . . . . . . . 11  |-  ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  -> 
( ( # `  A
)  e.  RR  /\  ( # `  B )  e.  NN0 ) )
14 nn0addge1 10759 . . . . . . . . . . 11  |-  ( ( ( # `  A
)  e.  RR  /\  ( # `  B )  e.  NN0 )  -> 
( # `  A )  <_  ( ( # `  A )  +  (
# `  B )
) )
1513, 14syl 16 . . . . . . . . . 10  |-  ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  -> 
( # `  A )  <_  ( ( # `  A )  +  (
# `  B )
) )
1615adantr 463 . . . . . . . . 9  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  ( # `
 A )  <_ 
( ( # `  A
)  +  ( # `  B ) ) )
17 breq1 4370 . . . . . . . . . 10  |-  ( N  =  ( # `  A
)  ->  ( N  <_  ( ( # `  A
)  +  ( # `  B ) )  <->  ( # `  A
)  <_  ( ( # `
 A )  +  ( # `  B
) ) ) )
1817adantl 464 . . . . . . . . 9  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  ( N  <_  ( ( # `  A )  +  (
# `  B )
)  <->  ( # `  A
)  <_  ( ( # `
 A )  +  ( # `  B
) ) ) )
1916, 18mpbird 232 . . . . . . . 8  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  N  <_  ( ( # `  A
)  +  ( # `  B ) ) )
20 elfz2nn0 11691 . . . . . . . 8  |-  ( N  e.  ( 0 ... ( ( # `  A
)  +  ( # `  B ) ) )  <-> 
( N  e.  NN0  /\  ( ( # `  A
)  +  ( # `  B ) )  e. 
NN0  /\  N  <_  ( ( # `  A
)  +  ( # `  B ) ) ) )
217, 10, 19, 20syl3anbrc 1178 . . . . . . 7  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) )
2221exp31 602 . . . . . 6  |-  ( (
# `  B )  e.  NN0  ->  ( ( # `
 A )  e. 
NN0  ->  ( N  =  ( # `  A
)  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) ) ) )
233, 22syl 16 . . . . 5  |-  ( B  e. Word  V  ->  (
( # `  A )  e.  NN0  ->  ( N  =  ( # `  A
)  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) ) ) )
242, 23syl5com 30 . . . 4  |-  ( A  e. Word  V  ->  ( B  e. Word  V  ->  ( N  =  ( # `  A
)  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) ) ) )
25243imp 1188 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) )
26 eqid 2382 . . . 4  |-  ( # `  A )  =  (
# `  A )
2726swrdccat3a 12630 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( N  e.  ( 0 ... ( (
# `  A )  +  ( # `  B
) ) )  -> 
( ( A ++  B
) substr  <. 0 ,  N >. )  =  if ( N  <_  ( # `  A
) ,  ( A substr  <. 0 ,  N >. ) ,  ( A ++  ( B substr  <. 0 ,  ( N  -  ( # `  A ) ) >.
) ) ) ) )
281, 25, 27sylc 60 . 2  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  (
( A ++  B ) substr  <. 0 ,  N >. )  =  if ( N  <_  ( # `  A
) ,  ( A substr  <. 0 ,  N >. ) ,  ( A ++  ( B substr  <. 0 ,  ( N  -  ( # `  A ) ) >.
) ) ) )
292, 11syl 16 . . . . . 6  |-  ( A  e. Word  V  ->  ( # `
 A )  e.  RR )
3029leidd 10036 . . . . 5  |-  ( A  e. Word  V  ->  ( # `
 A )  <_ 
( # `  A ) )
31303ad2ant1 1015 . . . 4  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( # `
 A )  <_ 
( # `  A ) )
32 breq1 4370 . . . . 5  |-  ( N  =  ( # `  A
)  ->  ( N  <_  ( # `  A
)  <->  ( # `  A
)  <_  ( # `  A
) ) )
33323ad2ant3 1017 . . . 4  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( N  <_  ( # `  A
)  <->  ( # `  A
)  <_  ( # `  A
) ) )
3431, 33mpbird 232 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  N  <_  ( # `  A
) )
3534iftrued 3865 . 2  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  if ( N  <_  ( # `  A ) ,  ( A substr  <. 0 ,  N >. ) ,  ( A ++  ( B substr  <. 0 ,  ( N  -  ( # `  A ) ) >. ) ) )  =  ( A substr  <. 0 ,  N >. ) )
36 swrdid 12564 . . . 4  |-  ( A  e. Word  V  ->  ( A substr  <. 0 ,  (
# `  A ) >. )  =  A )
37363ad2ant1 1015 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( A substr  <. 0 ,  (
# `  A ) >. )  =  A )
38 opeq2 4132 . . . . . 6  |-  ( N  =  ( # `  A
)  ->  <. 0 ,  N >.  =  <. 0 ,  ( # `  A
) >. )
3938oveq2d 6212 . . . . 5  |-  ( N  =  ( # `  A
)  ->  ( A substr  <.
0 ,  N >. )  =  ( A substr  <. 0 ,  ( # `  A
) >. ) )
4039eqeq1d 2384 . . . 4  |-  ( N  =  ( # `  A
)  ->  ( ( A substr  <. 0 ,  N >. )  =  A  <->  ( A substr  <.
0 ,  ( # `  A ) >. )  =  A ) )
41403ad2ant3 1017 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  (
( A substr  <. 0 ,  N >. )  =  A  <-> 
( A substr  <. 0 ,  ( # `  A
) >. )  =  A ) )
4237, 41mpbird 232 . 2  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( A substr  <. 0 ,  N >. )  =  A )
4328, 35, 423eqtrd 2427 1  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  (
( A ++  B ) substr  <. 0 ,  N >. )  =  A )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    <-> wb 184    /\ wa 367    /\ w3a 971    = wceq 1399    e. wcel 1826   ifcif 3857   <.cop 3950   class class class wbr 4367   ` cfv 5496  (class class class)co 6196   RRcr 9402   0cc0 9403    + caddc 9406    <_ cle 9540    - cmin 9718   NN0cn0 10712   ...cfz 11593   #chash 12307  Word cword 12438   ++ cconcat 12440   substr csubstr 12442
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1626  ax-4 1639  ax-5 1712  ax-6 1755  ax-7 1798  ax-8 1828  ax-9 1830  ax-10 1845  ax-11 1850  ax-12 1862  ax-13 2006  ax-ext 2360  ax-rep 4478  ax-sep 4488  ax-nul 4496  ax-pow 4543  ax-pr 4601  ax-un 6491  ax-cnex 9459  ax-resscn 9460  ax-1cn 9461  ax-icn 9462  ax-addcl 9463  ax-addrcl 9464  ax-mulcl 9465  ax-mulrcl 9466  ax-mulcom 9467  ax-addass 9468  ax-mulass 9469  ax-distr 9470  ax-i2m1 9471  ax-1ne0 9472  ax-1rid 9473  ax-rnegex 9474  ax-rrecex 9475  ax-cnre 9476  ax-pre-lttri 9477  ax-pre-lttrn 9478  ax-pre-ltadd 9479  ax-pre-mulgt0 9480
This theorem depends on definitions:  df-bi 185  df-or 368  df-an 369  df-3or 972  df-3an 973  df-tru 1402  df-ex 1621  df-nf 1625  df-sb 1748  df-eu 2222  df-mo 2223  df-clab 2368  df-cleq 2374  df-clel 2377  df-nfc 2532  df-ne 2579  df-nel 2580  df-ral 2737  df-rex 2738  df-reu 2739  df-rmo 2740  df-rab 2741  df-v 3036  df-sbc 3253  df-csb 3349  df-dif 3392  df-un 3394  df-in 3396  df-ss 3403  df-pss 3405  df-nul 3712  df-if 3858  df-pw 3929  df-sn 3945  df-pr 3947  df-tp 3949  df-op 3951  df-uni 4164  df-int 4200  df-iun 4245  df-br 4368  df-opab 4426  df-mpt 4427  df-tr 4461  df-eprel 4705  df-id 4709  df-po 4714  df-so 4715  df-fr 4752  df-we 4754  df-ord 4795  df-on 4796  df-lim 4797  df-suc 4798  df-xp 4919  df-rel 4920  df-cnv 4921  df-co 4922  df-dm 4923  df-rn 4924  df-res 4925  df-ima 4926  df-iota 5460  df-fun 5498  df-fn 5499  df-f 5500  df-f1 5501  df-fo 5502  df-f1o 5503  df-fv 5504  df-riota 6158  df-ov 6199  df-oprab 6200  df-mpt2 6201  df-om 6600  df-1st 6699  df-2nd 6700  df-recs 6960  df-rdg 6994  df-1o 7048  df-oadd 7052  df-er 7229  df-en 7436  df-dom 7437  df-sdom 7438  df-fin 7439  df-card 8233  df-cda 8461  df-pnf 9541  df-mnf 9542  df-xr 9543  df-ltxr 9544  df-le 9545  df-sub 9720  df-neg 9721  df-nn 10453  df-2 10511  df-n0 10713  df-z 10782  df-uz 11002  df-fz 11594  df-fzo 11718  df-hash 12308  df-word 12446  df-concat 12448  df-substr 12450
This theorem is referenced by:  ccats1swrdeqbi  12634  clwlkisclwwlk2  24911  clwlkfoclwwlk  24966  numclwlk1lem2foa  25212  numclwlk1lem2fo  25216
  Copyright terms: Public domain W3C validator