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

Theorem swrdccatid 12799
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 1002 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( A  e. Word  V  /\  B  e. Word  V ) )
2 lencl 12635 . . . . 5  |-  ( A  e. Word  V  ->  ( # `
 A )  e. 
NN0 )
3 lencl 12635 . . . . . 6  |-  ( B  e. Word  V  ->  ( # `
 B )  e. 
NN0 )
4 simplr 760 . . . . . . . . 9  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  ( # `
 A )  e. 
NN0 )
5 eleq1 2494 . . . . . . . . . 10  |-  ( N  =  ( # `  A
)  ->  ( N  e.  NN0  <->  ( # `  A
)  e.  NN0 )
)
65adantl 467 . . . . . . . . 9  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  ( N  e.  NN0  <->  ( # `  A
)  e.  NN0 )
)
74, 6mpbird 235 . . . . . . . 8  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  N  e.  NN0 )
8 nn0addcl 10856 . . . . . . . . . 10  |-  ( ( ( # `  A
)  e.  NN0  /\  ( # `  B )  e.  NN0 )  -> 
( ( # `  A
)  +  ( # `  B ) )  e. 
NN0 )
98ancoms 454 . . . . . . . . 9  |-  ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  -> 
( ( # `  A
)  +  ( # `  B ) )  e. 
NN0 )
109adantr 466 . . . . . . . 8  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  (
( # `  A )  +  ( # `  B
) )  e.  NN0 )
11 nn0re 10829 . . . . . . . . . . . . 13  |-  ( (
# `  A )  e.  NN0  ->  ( # `  A
)  e.  RR )
1211anim1i 570 . . . . . . . . . . . 12  |-  ( ( ( # `  A
)  e.  NN0  /\  ( # `  B )  e.  NN0 )  -> 
( ( # `  A
)  e.  RR  /\  ( # `  B )  e.  NN0 ) )
1312ancoms 454 . . . . . . . . . . 11  |-  ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  -> 
( ( # `  A
)  e.  RR  /\  ( # `  B )  e.  NN0 ) )
14 nn0addge1 10867 . . . . . . . . . . 11  |-  ( ( ( # `  A
)  e.  RR  /\  ( # `  B )  e.  NN0 )  -> 
( # `  A )  <_  ( ( # `  A )  +  (
# `  B )
) )
1513, 14syl 17 . . . . . . . . . 10  |-  ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  -> 
( # `  A )  <_  ( ( # `  A )  +  (
# `  B )
) )
1615adantr 466 . . . . . . . . 9  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  ( # `
 A )  <_ 
( ( # `  A
)  +  ( # `  B ) ) )
17 breq1 4369 . . . . . . . . . 10  |-  ( N  =  ( # `  A
)  ->  ( N  <_  ( ( # `  A
)  +  ( # `  B ) )  <->  ( # `  A
)  <_  ( ( # `
 A )  +  ( # `  B
) ) ) )
1817adantl 467 . . . . . . . . 9  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  ( N  <_  ( ( # `  A )  +  (
# `  B )
)  <->  ( # `  A
)  <_  ( ( # `
 A )  +  ( # `  B
) ) ) )
1916, 18mpbird 235 . . . . . . . 8  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  N  <_  ( ( # `  A
)  +  ( # `  B ) ) )
20 elfz2nn0 11836 . . . . . . . 8  |-  ( N  e.  ( 0 ... ( ( # `  A
)  +  ( # `  B ) ) )  <-> 
( N  e.  NN0  /\  ( ( # `  A
)  +  ( # `  B ) )  e. 
NN0  /\  N  <_  ( ( # `  A
)  +  ( # `  B ) ) ) )
217, 10, 19, 20syl3anbrc 1189 . . . . . . 7  |-  ( ( ( ( # `  B
)  e.  NN0  /\  ( # `  A )  e.  NN0 )  /\  N  =  ( # `  A
) )  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) )
2221exp31 607 . . . . . 6  |-  ( (
# `  B )  e.  NN0  ->  ( ( # `
 A )  e. 
NN0  ->  ( N  =  ( # `  A
)  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) ) ) )
233, 22syl 17 . . . . 5  |-  ( B  e. Word  V  ->  (
( # `  A )  e.  NN0  ->  ( N  =  ( # `  A
)  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) ) ) )
242, 23syl5com 31 . . . 4  |-  ( A  e. Word  V  ->  ( B  e. Word  V  ->  ( N  =  ( # `  A
)  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) ) ) )
25243imp 1199 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  N  e.  ( 0 ... (
( # `  A )  +  ( # `  B
) ) ) )
26 eqid 2428 . . . 4  |-  ( # `  A )  =  (
# `  A )
2726swrdccat3a 12796 . . 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 62 . 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 17 . . . . . 6  |-  ( A  e. Word  V  ->  ( # `
 A )  e.  RR )
3029leidd 10131 . . . . 5  |-  ( A  e. Word  V  ->  ( # `
 A )  <_ 
( # `  A ) )
31303ad2ant1 1026 . . . 4  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( # `
 A )  <_ 
( # `  A ) )
32 breq1 4369 . . . . 5  |-  ( N  =  ( # `  A
)  ->  ( N  <_  ( # `  A
)  <->  ( # `  A
)  <_  ( # `  A
) ) )
33323ad2ant3 1028 . . . 4  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( N  <_  ( # `  A
)  <->  ( # `  A
)  <_  ( # `  A
) ) )
3431, 33mpbird 235 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  N  <_  ( # `  A
) )
3534iftrued 3862 . 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 12730 . . . 4  |-  ( A  e. Word  V  ->  ( A substr  <. 0 ,  (
# `  A ) >. )  =  A )
37363ad2ant1 1026 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( A substr  <. 0 ,  (
# `  A ) >. )  =  A )
38 opeq2 4131 . . . . . 6  |-  ( N  =  ( # `  A
)  ->  <. 0 ,  N >.  =  <. 0 ,  ( # `  A
) >. )
3938oveq2d 6265 . . . . 5  |-  ( N  =  ( # `  A
)  ->  ( A substr  <.
0 ,  N >. )  =  ( A substr  <. 0 ,  ( # `  A
) >. ) )
4039eqeq1d 2430 . . . 4  |-  ( N  =  ( # `  A
)  ->  ( ( A substr  <. 0 ,  N >. )  =  A  <->  ( A substr  <.
0 ,  ( # `  A ) >. )  =  A ) )
41403ad2ant3 1028 . . 3  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  (
( A substr  <. 0 ,  N >. )  =  A  <-> 
( A substr  <. 0 ,  ( # `  A
) >. )  =  A ) )
4237, 41mpbird 235 . 2  |-  ( ( A  e. Word  V  /\  B  e. Word  V  /\  N  =  ( # `  A
) )  ->  ( A substr  <. 0 ,  N >. )  =  A )
4328, 35, 423eqtrd 2466 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 187    /\ wa 370    /\ w3a 982    = wceq 1437    e. wcel 1872   ifcif 3854   <.cop 3947   class class class wbr 4366   ` cfv 5544  (class class class)co 6249   RRcr 9489   0cc0 9490    + caddc 9493    <_ cle 9627    - cmin 9811   NN0cn0 10820   ...cfz 11735   #chash 12465  Word cword 12604   ++ cconcat 12606   substr csubstr 12608
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1663  ax-4 1676  ax-5 1752  ax-6 1798  ax-7 1843  ax-8 1874  ax-9 1876  ax-10 1891  ax-11 1896  ax-12 1909  ax-13 2063  ax-ext 2408  ax-rep 4479  ax-sep 4489  ax-nul 4498  ax-pow 4545  ax-pr 4603  ax-un 6541  ax-cnex 9546  ax-resscn 9547  ax-1cn 9548  ax-icn 9549  ax-addcl 9550  ax-addrcl 9551  ax-mulcl 9552  ax-mulrcl 9553  ax-mulcom 9554  ax-addass 9555  ax-mulass 9556  ax-distr 9557  ax-i2m1 9558  ax-1ne0 9559  ax-1rid 9560  ax-rnegex 9561  ax-rrecex 9562  ax-cnre 9563  ax-pre-lttri 9564  ax-pre-lttrn 9565  ax-pre-ltadd 9566  ax-pre-mulgt0 9567
This theorem depends on definitions:  df-bi 188  df-or 371  df-an 372  df-3or 983  df-3an 984  df-tru 1440  df-ex 1658  df-nf 1662  df-sb 1791  df-eu 2280  df-mo 2281  df-clab 2415  df-cleq 2421  df-clel 2424  df-nfc 2558  df-ne 2601  df-nel 2602  df-ral 2719  df-rex 2720  df-reu 2721  df-rmo 2722  df-rab 2723  df-v 3024  df-sbc 3243  df-csb 3339  df-dif 3382  df-un 3384  df-in 3386  df-ss 3393  df-pss 3395  df-nul 3705  df-if 3855  df-pw 3926  df-sn 3942  df-pr 3944  df-tp 3946  df-op 3948  df-uni 4163  df-int 4199  df-iun 4244  df-br 4367  df-opab 4426  df-mpt 4427  df-tr 4462  df-eprel 4707  df-id 4711  df-po 4717  df-so 4718  df-fr 4755  df-we 4757  df-xp 4802  df-rel 4803  df-cnv 4804  df-co 4805  df-dm 4806  df-rn 4807  df-res 4808  df-ima 4809  df-pred 5342  df-ord 5388  df-on 5389  df-lim 5390  df-suc 5391  df-iota 5508  df-fun 5546  df-fn 5547  df-f 5548  df-f1 5549  df-fo 5550  df-f1o 5551  df-fv 5552  df-riota 6211  df-ov 6252  df-oprab 6253  df-mpt2 6254  df-om 6651  df-1st 6751  df-2nd 6752  df-wrecs 6983  df-recs 7045  df-rdg 7083  df-1o 7137  df-oadd 7141  df-er 7318  df-en 7525  df-dom 7526  df-sdom 7527  df-fin 7528  df-card 8325  df-cda 8549  df-pnf 9628  df-mnf 9629  df-xr 9630  df-ltxr 9631  df-le 9632  df-sub 9813  df-neg 9814  df-nn 10561  df-2 10619  df-n0 10821  df-z 10889  df-uz 11111  df-fz 11736  df-fzo 11867  df-hash 12466  df-word 12612  df-concat 12614  df-substr 12616
This theorem is referenced by:  ccats1swrdeqbi  12800  clwlkisclwwlk2  25460  clwlkfoclwwlk  25515  numclwlk1lem2foa  25761  numclwlk1lem2fo  25765
  Copyright terms: Public domain W3C validator