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

Theorem swrdccatwrd 12473
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 12361 . . . . . 6  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( # `
 W )  e.  NN )
2 fzo0end 11729 . . . . . 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 12456 . . . . 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 10434 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  CC )
7 ax-1cn 9444 . . . . . . . . . 10  |-  1  e.  CC
87a1i 11 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN  ->  1  e.  CC )
96, 8npcand 9827 . . . . . . . 8  |-  ( (
# `  W )  e.  NN  ->  ( (
( # `  W )  -  1 )  +  1 )  =  (
# `  W )
)
109eqcomd 2459 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  =  ( ( ( # `  W
)  -  1 )  +  1 ) )
111, 10syl 16 . . . . . 6  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( # `
 W )  =  ( ( ( # `  W )  -  1 )  +  1 ) )
1211opeq2d 4167 . . . . 5  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  <. (
( # `  W )  -  1 ) ,  ( # `  W
) >.  =  <. (
( # `  W )  -  1 ) ,  ( ( ( # `  W )  -  1 )  +  1 )
>. )
1312oveq2d 6209 . . . 4  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( W substr  <. ( ( # `  W )  -  1 ) ,  ( # `  W ) >. )  =  ( W substr  <. (
( # `  W )  -  1 ) ,  ( ( ( # `  W )  -  1 )  +  1 )
>. ) )
14 lsw 12377 . . . . . 6  |-  ( W  e. Word  V  ->  ( lastS  `  W )  =  ( W `  ( (
# `  W )  -  1 ) ) )
1514adantr 465 . . . . 5  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( lastS  `  W )  =  ( W `  ( (
# `  W )  -  1 ) ) )
1615s1eqd 12403 . . . 4  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  <" ( lastS  `  W ) ">  =  <" ( W `
 ( ( # `  W )  -  1 ) ) "> )
175, 13, 163eqtr4rd 2503 . . 3  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  <" ( lastS  `  W ) ">  =  ( W substr  <. (
( # `  W )  -  1 ) ,  ( # `  W
) >. ) )
1817oveq2d 6209 . 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
) >. ) ) )
19 nnm1nn0 10725 . . . . . 6  |-  ( (
# `  W )  e.  NN  ->  ( ( # `
 W )  - 
1 )  e.  NN0 )
20 0elfz 11593 . . . . . 6  |-  ( ( ( # `  W
)  -  1 )  e.  NN0  ->  0  e.  ( 0 ... (
( # `  W )  -  1 ) ) )
2119, 20syl 16 . . . . 5  |-  ( (
# `  W )  e.  NN  ->  0  e.  ( 0 ... (
( # `  W )  -  1 ) ) )
22 1nn0 10699 . . . . . . . 8  |-  1  e.  NN0
2322a1i 11 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  1  e.  NN0 )
24 nnnn0 10690 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  NN0 )
25 nnge1 10452 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  1  <_  (
# `  W )
)
26 elfz2nn0 11590 . . . . . . 7  |-  ( 1  e.  ( 0 ... ( # `  W
) )  <->  ( 1  e.  NN0  /\  ( # `
 W )  e. 
NN0  /\  1  <_  (
# `  W )
) )
2723, 24, 25, 26syl3anbrc 1172 . . . . . 6  |-  ( (
# `  W )  e.  NN  ->  1  e.  ( 0 ... ( # `
 W ) ) )
28 elfz1end 11589 . . . . . . 7  |-  ( (
# `  W )  e.  NN  <->  ( # `  W
)  e.  ( 1 ... ( # `  W
) ) )
2928biimpi 194 . . . . . 6  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  ( 1 ... ( # `  W
) ) )
30 fz0fzdiffz0 11599 . . . . . 6  |-  ( ( 1  e.  ( 0 ... ( # `  W
) )  /\  ( # `
 W )  e.  ( 1 ... ( # `
 W ) ) )  ->  ( ( # `
 W )  - 
1 )  e.  ( 0 ... ( # `  W ) ) )
3127, 29, 30syl2anc 661 . . . . 5  |-  ( (
# `  W )  e.  NN  ->  ( ( # `
 W )  - 
1 )  e.  ( 0 ... ( # `  W ) ) )
32 nn0fz0 11635 . . . . . . 7  |-  ( (
# `  W )  e.  NN0  <->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3332biimpi 194 . . . . . 6  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3424, 33syl 16 . . . . 5  |-  ( (
# `  W )  e.  NN  ->  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) )
3521, 31, 343jca 1168 . . . 4  |-  ( (
# `  W )  e.  NN  ->  ( 0  e.  ( 0 ... ( ( # `  W
)  -  1 ) )  /\  ( (
# `  W )  -  1 )  e.  ( 0 ... ( # `
 W ) )  /\  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) ) )
361, 35syl 16 . . 3  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  (
0  e.  ( 0 ... ( ( # `  W )  -  1 ) )  /\  (
( # `  W )  -  1 )  e.  ( 0 ... ( # `
 W ) )  /\  ( # `  W
)  e.  ( 0 ... ( # `  W
) ) ) )
37 ccatswrd 12461 . . 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
) >. ) )
3836, 37syldan 470 . 2  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  (
( W substr  <. 0 ,  ( ( # `  W
)  -  1 )
>. ) concat  ( W substr  <. (
( # `  W )  -  1 ) ,  ( # `  W
) >. ) )  =  ( W substr  <. 0 ,  ( # `  W
) >. ) )
39 swrdid 12432 . . 3  |-  ( W  e. Word  V  ->  ( W substr  <. 0 ,  (
# `  W ) >. )  =  W )
4039adantr 465 . 2  |-  ( ( W  e. Word  V  /\  W  =/=  (/) )  ->  ( W substr  <. 0 ,  (
# `  W ) >. )  =  W )
4118, 38, 403eqtrd 2496 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 965    = wceq 1370    e. wcel 1758    =/= wne 2644   (/)c0 3738   <.cop 3984   class class class wbr 4393   ` cfv 5519  (class class class)co 6193   CCcc 9384   0cc0 9386   1c1 9387    + caddc 9389    <_ cle 9523    - cmin 9699   NNcn 10426   NN0cn0 10683   ...cfz 11547  ..^cfzo 11658   #chash 12213  Word cword 12332   lastS clsw 12333   concat cconcat 12334   <"cs1 12335   substr csubstr 12336
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1592  ax-4 1603  ax-5 1671  ax-6 1710  ax-7 1730  ax-8 1760  ax-9 1762  ax-10 1777  ax-11 1782  ax-12 1794  ax-13 1952  ax-ext 2430  ax-rep 4504  ax-sep 4514  ax-nul 4522  ax-pow 4571  ax-pr 4632  ax-un 6475  ax-cnex 9442  ax-resscn 9443  ax-1cn 9444  ax-icn 9445  ax-addcl 9446  ax-addrcl 9447  ax-mulcl 9448  ax-mulrcl 9449  ax-mulcom 9450  ax-addass 9451  ax-mulass 9452  ax-distr 9453  ax-i2m1 9454  ax-1ne0 9455  ax-1rid 9456  ax-rnegex 9457  ax-rrecex 9458  ax-cnre 9459  ax-pre-lttri 9460  ax-pre-lttrn 9461  ax-pre-ltadd 9462  ax-pre-mulgt0 9463
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 966  df-3an 967  df-tru 1373  df-ex 1588  df-nf 1591  df-sb 1703  df-eu 2264  df-mo 2265  df-clab 2437  df-cleq 2443  df-clel 2446  df-nfc 2601  df-ne 2646  df-nel 2647  df-ral 2800  df-rex 2801  df-reu 2802  df-rab 2804  df-v 3073  df-sbc 3288  df-csb 3390  df-dif 3432  df-un 3434  df-in 3436  df-ss 3443  df-pss 3445  df-nul 3739  df-if 3893  df-pw 3963  df-sn 3979  df-pr 3981  df-tp 3983  df-op 3985  df-uni 4193  df-int 4230  df-iun 4274  df-br 4394  df-opab 4452  df-mpt 4453  df-tr 4487  df-eprel 4733  df-id 4737  df-po 4742  df-so 4743  df-fr 4780  df-we 4782  df-ord 4823  df-on 4824  df-lim 4825  df-suc 4826  df-xp 4947  df-rel 4948  df-cnv 4949  df-co 4950  df-dm 4951  df-rn 4952  df-res 4953  df-ima 4954  df-iota 5482  df-fun 5521  df-fn 5522  df-f 5523  df-f1 5524  df-fo 5525  df-f1o 5526  df-fv 5527  df-riota 6154  df-ov 6196  df-oprab 6197  df-mpt2 6198  df-om 6580  df-1st 6680  df-2nd 6681  df-recs 6935  df-rdg 6969  df-1o 7023  df-oadd 7027  df-er 7204  df-en 7414  df-dom 7415  df-sdom 7416  df-fin 7417  df-card 8213  df-pnf 9524  df-mnf 9525  df-xr 9526  df-ltxr 9527  df-le 9528  df-sub 9701  df-neg 9702  df-nn 10427  df-n0 10684  df-z 10751  df-uz 10966  df-fz 11548  df-fzo 11659  df-hash 12214  df-word 12340  df-lsw 12341  df-concat 12342  df-s1 12343  df-substr 12344
This theorem is referenced by:  ccats1swrdeq  12474  iwrdsplit  26907  wwlkextwrd  30501
  Copyright terms: Public domain W3C validator