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

Theorem swrdccatwrd 12669
Description: Reconstruct a nonempty word from its prefix and last symbol. (Contributed by Alexander van der Vekens, 5-Aug-2018.)
Assertion
Ref Expression
swrdccatwrd  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  (
( W substr  <. 0 ,  ( ( # `  W
)  -  1 )
>. ) concat  <" ( lastS  `  W ) "> )  =  W )

Proof of Theorem swrdccatwrd
StepHypRef Expression
1 lennncl 12539 . . . . . 6  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( # `
 W )  e.  NN )
2 fzo0end 11880 . . . . . 6  |-  ( (
# `  W )  e.  NN  ->  ( ( # `
 W )  - 
1 )  e.  ( 0..^ ( # `  W
) ) )
31, 2syl 16 . . . . 5  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  (
( # `  W )  -  1 )  e.  ( 0..^ ( # `  W ) ) )
4 swrds1 12652 . . . . 5  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  -  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( W substr  <. ( ( # `  W )  -  1 ) ,  ( ( ( # `  W
)  -  1 )  +  1 ) >.
)  =  <" ( W `  ( ( # `
 W )  - 
1 ) ) "> )
53, 4syldan 470 . . . 4  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( W substr  <. ( ( # `  W )  -  1 ) ,  ( ( ( # `  W
)  -  1 )  +  1 ) >.
)  =  <" ( W `  ( ( # `
 W )  - 
1 ) ) "> )
6 nncn 10547 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  CC )
7 1cnd 9612 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN  ->  1  e.  CC )
86, 7npcand 9937 . . . . . . . 8  |-  ( (
# `  W )  e.  NN  ->  ( (
( # `  W )  -  1 )  +  1 )  =  (
# `  W )
)
98eqcomd 2449 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  =  ( ( ( # `  W
)  -  1 )  +  1 ) )
101, 9syl 16 . . . . . 6  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( # `
 W )  =  ( ( ( # `  W )  -  1 )  +  1 ) )
1110opeq2d 4206 . . . . 5  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  <. (
( # `  W )  -  1 ) ,  ( # `  W
) >.  =  <. (
( # `  W )  -  1 ) ,  ( ( ( # `  W )  -  1 )  +  1 )
>. )
1211oveq2d 6294 . . . 4  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( W substr  <. ( ( # `  W )  -  1 ) ,  ( # `  W ) >. )  =  ( W substr  <. (
( # `  W )  -  1 ) ,  ( ( ( # `  W )  -  1 )  +  1 )
>. ) )
13 lsw 12561 . . . . . 6  |-  ( W  e. Word  V  ->  ( lastS  `  W )  =  ( W `  ( (
# `  W )  -  1 ) ) )
1413adantr 465 . . . . 5  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( lastS  `  W )  =  ( W `  ( (
# `  W )  -  1 ) ) )
1514s1eqd 12589 . . . 4  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  <" ( lastS  `  W ) ">  =  <" ( W `
 ( ( # `  W )  -  1 ) ) "> )
165, 12, 153eqtr4rd 2493 . . 3  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  <" ( lastS  `  W ) ">  =  ( W substr  <. (
( # `  W )  -  1 ) ,  ( # `  W
) >. ) )
1716oveq2d 6294 . 2  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  (
( W substr  <. 0 ,  ( ( # `  W
)  -  1 )
>. ) concat  <" ( lastS  `  W ) "> )  =  ( ( W substr  <. 0 ,  ( ( # `  W
)  -  1 )
>. ) concat  ( W substr  <. (
( # `  W )  -  1 ) ,  ( # `  W
) >. ) ) )
18 nnm1nn0 10840 . . . . . 6  |-  ( (
# `  W )  e.  NN  ->  ( ( # `
 W )  - 
1 )  e.  NN0 )
19 0elfz 11778 . . . . . 6  |-  ( ( ( # `  W
)  -  1 )  e.  NN0  ->  0  e.  ( 0 ... (
( # `  W )  -  1 ) ) )
2018, 19syl 16 . . . . 5  |-  ( (
# `  W )  e.  NN  ->  0  e.  ( 0 ... (
( # `  W )  -  1 ) ) )
21 1nn0 10814 . . . . . . . 8  |-  1  e.  NN0
2221a1i 11 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  1  e.  NN0 )
23 nnnn0 10805 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  NN0 )
24 nnge1 10565 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  1  <_  (
# `  W )
)
25 elfz2nn0 11774 . . . . . . 7  |-  ( 1  e.  ( 0 ... ( # `  W
) )  <->  ( 1  e.  NN0  /\  ( # `
 W )  e. 
NN0  /\  1  <_  (
# `  W )
) )
2622, 23, 24, 25syl3anbrc 1179 . . . . . 6  |-  ( (
# `  W )  e.  NN  ->  1  e.  ( 0 ... ( # `
 W ) ) )
27 elfz1end 11721 . . . . . . 7  |-  ( (
# `  W )  e.  NN  <->  ( # `  W
)  e.  ( 1 ... ( # `  W
) ) )
2827biimpi 194 . . . . . 6  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  ( 1 ... ( # `  W
) ) )
29 fz0fzdiffz0 11788 . . . . . 6  |-  ( ( 1  e.  ( 0 ... ( # `  W
) )  /\  ( # `
 W )  e.  ( 1 ... ( # `
 W ) ) )  ->  ( ( # `
 W )  - 
1 )  e.  ( 0 ... ( # `  W ) ) )
3026, 28, 29syl2anc 661 . . . . 5  |-  ( (
# `  W )  e.  NN  ->  ( ( # `
 W )  - 
1 )  e.  ( 0 ... ( # `  W ) ) )
31 nn0fz0 11779 . . . . . . 7  |-  ( (
# `  W )  e.  NN0  <->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3231biimpi 194 . . . . . 6  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3323, 32syl 16 . . . . 5  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3420, 30, 333jca 1175 . . . 4  |-  ( (
# `  W )  e.  NN  ->  ( 0  e.  ( 0 ... ( ( # `  W
)  -  1 ) )  /\  ( (
# `  W )  -  1 )  e.  ( 0 ... ( # `
 W ) )  /\  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) ) )
351, 34syl 16 . . 3  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  (
0  e.  ( 0 ... ( ( # `  W )  -  1 ) )  /\  (
( # `  W )  -  1 )  e.  ( 0 ... ( # `
 W ) )  /\  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) ) )
36 ccatswrd 12657 . . 3  |-  ( ( W  e. Word  V  /\  ( 0  e.  ( 0 ... ( (
# `  W )  -  1 ) )  /\  ( ( # `  W )  -  1 )  e.  ( 0 ... ( # `  W
) )  /\  ( # `
 W )  e.  ( 0 ... ( # `
 W ) ) ) )  ->  (
( W substr  <. 0 ,  ( ( # `  W
)  -  1 )
>. ) concat  ( W substr  <. (
( # `  W )  -  1 ) ,  ( # `  W
) >. ) )  =  ( W substr  <. 0 ,  ( # `  W
) >. ) )
3735, 36syldan 470 . 2  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  (
( W substr  <. 0 ,  ( ( # `  W
)  -  1 )
>. ) concat  ( W substr  <. (
( # `  W )  -  1 ) ,  ( # `  W
) >. ) )  =  ( W substr  <. 0 ,  ( # `  W
) >. ) )
38 swrdid 12628 . . 3  |-  ( W  e. Word  V  ->  ( W substr  <. 0 ,  (
# `  W ) >. )  =  W )
3938adantr 465 . 2  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( W substr  <. 0 ,  (
# `  W ) >. )  =  W )
4017, 37, 393eqtrd 2486 1  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  (
( W substr  <. 0 ,  ( ( # `  W
)  -  1 )
>. ) concat  <" ( lastS  `  W ) "> )  =  W )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 369    /\ w3a 972    = wceq 1381    e. wcel 1802    =/= wne 2636   (/)c0 3768   <.cop 4017   class class class wbr 4434   ` cfv 5575  (class class class)co 6278   0cc0 9492   1c1 9493    + caddc 9495    <_ cle 9629    - cmin 9807   NNcn 10539   NN0cn0 10798   ...cfz 11678  ..^cfzo 11800   #chash 12381  Word cword 12510   lastS clsw 12511   concat cconcat 12512   <"cs1 12513   substr csubstr 12514
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1603  ax-4 1616  ax-5 1689  ax-6 1732  ax-7 1774  ax-8 1804  ax-9 1806  ax-10 1821  ax-11 1826  ax-12 1838  ax-13 1983  ax-ext 2419  ax-rep 4545  ax-sep 4555  ax-nul 4563  ax-pow 4612  ax-pr 4673  ax-un 6574  ax-cnex 9548  ax-resscn 9549  ax-1cn 9550  ax-icn 9551  ax-addcl 9552  ax-addrcl 9553  ax-mulcl 9554  ax-mulrcl 9555  ax-mulcom 9556  ax-addass 9557  ax-mulass 9558  ax-distr 9559  ax-i2m1 9560  ax-1ne0 9561  ax-1rid 9562  ax-rnegex 9563  ax-rrecex 9564  ax-cnre 9565  ax-pre-lttri 9566  ax-pre-lttrn 9567  ax-pre-ltadd 9568  ax-pre-mulgt0 9569
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 973  df-3an 974  df-tru 1384  df-ex 1598  df-nf 1602  df-sb 1725  df-eu 2270  df-mo 2271  df-clab 2427  df-cleq 2433  df-clel 2436  df-nfc 2591  df-ne 2638  df-nel 2639  df-ral 2796  df-rex 2797  df-reu 2798  df-rmo 2799  df-rab 2800  df-v 3095  df-sbc 3312  df-csb 3419  df-dif 3462  df-un 3464  df-in 3466  df-ss 3473  df-pss 3475  df-nul 3769  df-if 3924  df-pw 3996  df-sn 4012  df-pr 4014  df-tp 4016  df-op 4018  df-uni 4232  df-int 4269  df-iun 4314  df-br 4435  df-opab 4493  df-mpt 4494  df-tr 4528  df-eprel 4778  df-id 4782  df-po 4787  df-so 4788  df-fr 4825  df-we 4827  df-ord 4868  df-on 4869  df-lim 4870  df-suc 4871  df-xp 4992  df-rel 4993  df-cnv 4994  df-co 4995  df-dm 4996  df-rn 4997  df-res 4998  df-ima 4999  df-iota 5538  df-fun 5577  df-fn 5578  df-f 5579  df-f1 5580  df-fo 5581  df-f1o 5582  df-fv 5583  df-riota 6239  df-ov 6281  df-oprab 6282  df-mpt2 6283  df-om 6683  df-1st 6782  df-2nd 6783  df-recs 7041  df-rdg 7075  df-1o 7129  df-oadd 7133  df-er 7310  df-en 7516  df-dom 7517  df-sdom 7518  df-fin 7519  df-card 8320  df-cda 8548  df-pnf 9630  df-mnf 9631  df-xr 9632  df-ltxr 9633  df-le 9634  df-sub 9809  df-neg 9810  df-nn 10540  df-2 10597  df-n0 10799  df-z 10868  df-uz 11088  df-fz 11679  df-fzo 11801  df-hash 12382  df-word 12518  df-lsw 12519  df-concat 12520  df-s1 12521  df-substr 12522
This theorem is referenced by:  ccats1swrdeq  12670  wwlkextwrd  24597  iwrdsplit  28196
  Copyright terms: Public domain W3C validator