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

Theorem swrdccat3b 12491
Description: A suffix of a concatenation is either a suffix of the second concatenated word or a concatenation of a suffix of the first word with the second word. (Contributed by Alexander van der Vekens, 31-Mar-2018.) (Revised by Alexander van der Vekens, 30-May-2018.)
Hypothesis
Ref Expression
swrdccatin12.l  |-  L  =  ( # `  A
)
Assertion
Ref Expression
swrdccat3b  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( M  e.  ( 0 ... ( L  +  ( # `  B
) ) )  -> 
( ( A concat  B
) substr  <. M ,  ( L  +  ( # `  B ) ) >.
)  =  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B )
) ) )

Proof of Theorem swrdccat3b
StepHypRef Expression
1 simpl 457 . . . 4  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( A  e. Word  V  /\  B  e. Word  V
) )
2 simpr 461 . . . 4  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )
3 elfz2nn0 11583 . . . . . 6  |-  ( M  e.  ( 0 ... ( L  +  (
# `  B )
) )  <->  ( M  e.  NN0  /\  ( L  +  ( # `  B
) )  e.  NN0  /\  M  <_  ( L  +  ( # `  B
) ) ) )
4 elnn0uz 11001 . . . . . . . 8  |-  ( ( L  +  ( # `  B ) )  e. 
NN0 
<->  ( L  +  (
# `  B )
)  e.  ( ZZ>= ` 
0 ) )
5 eluzfz2 11562 . . . . . . . 8  |-  ( ( L  +  ( # `  B ) )  e.  ( ZZ>= `  0 )  ->  ( L  +  (
# `  B )
)  e.  ( 0 ... ( L  +  ( # `  B ) ) ) )
64, 5sylbi 195 . . . . . . 7  |-  ( ( L  +  ( # `  B ) )  e. 
NN0  ->  ( L  +  ( # `  B ) )  e.  ( 0 ... ( L  +  ( # `  B ) ) ) )
763ad2ant2 1010 . . . . . 6  |-  ( ( M  e.  NN0  /\  ( L  +  ( # `
 B ) )  e.  NN0  /\  M  <_ 
( L  +  (
# `  B )
) )  ->  ( L  +  ( # `  B
) )  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )
83, 7sylbi 195 . . . . 5  |-  ( M  e.  ( 0 ... ( L  +  (
# `  B )
) )  ->  ( L  +  ( # `  B
) )  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )
98adantl 466 . . . 4  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( L  +  ( # `  B ) )  e.  ( 0 ... ( L  +  ( # `  B ) ) ) )
10 swrdccatin12.l . . . . . 6  |-  L  =  ( # `  A
)
1110swrdccat3 12487 . . . . 5  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( ( M  e.  ( 0 ... ( L  +  ( # `  B
) ) )  /\  ( L  +  ( # `
 B ) )  e.  ( 0 ... ( L  +  (
# `  B )
) ) )  -> 
( ( A concat  B
) substr  <. M ,  ( L  +  ( # `  B ) ) >.
)  =  if ( ( L  +  (
# `  B )
)  <_  L , 
( A substr  <. M , 
( L  +  (
# `  B )
) >. ) ,  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( ( L  +  ( # `  B ) )  -  L )
>. ) ,  ( ( A substr  <. M ,  L >. ) concat  ( B substr  <. 0 ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) ) ) ) ) )
1211imp 429 . . . 4  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  ( M  e.  ( 0 ... ( L  +  ( # `  B
) ) )  /\  ( L  +  ( # `
 B ) )  e.  ( 0 ... ( L  +  (
# `  B )
) ) ) )  ->  ( ( A concat  B ) substr  <. M , 
( L  +  (
# `  B )
) >. )  =  if ( ( L  +  ( # `  B ) )  <_  L , 
( A substr  <. M , 
( L  +  (
# `  B )
) >. ) ,  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( ( L  +  ( # `  B ) )  -  L )
>. ) ,  ( ( A substr  <. M ,  L >. ) concat  ( B substr  <. 0 ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) ) ) ) )
131, 2, 9, 12syl12anc 1217 . . 3  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( ( A concat  B ) substr  <. M , 
( L  +  (
# `  B )
) >. )  =  if ( ( L  +  ( # `  B ) )  <_  L , 
( A substr  <. M , 
( L  +  (
# `  B )
) >. ) ,  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( ( L  +  ( # `  B ) )  -  L )
>. ) ,  ( ( A substr  <. M ,  L >. ) concat  ( B substr  <. 0 ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) ) ) ) )
1410swrdccat3blem 12490 . . . 4  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  ( L  +  ( # `  B ) )  <_  L )  ->  if ( L  <_  M ,  ( B substr  <.
( M  -  L
) ,  ( # `  B ) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B ) )  =  ( A substr  <. M , 
( L  +  (
# `  B )
) >. ) )
15 iftrue 3897 . . . . . 6  |-  ( L  <_  M  ->  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B )
)  =  ( B substr  <. ( M  -  L
) ,  ( # `  B ) >. )
)
16153ad2ant3 1011 . . . . 5  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  L  <_  M )  ->  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  (
# `  B ) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B ) )  =  ( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) )
17 lencl 12353 . . . . . . . . . . . 12  |-  ( A  e. Word  V  ->  ( # `
 A )  e. 
NN0 )
1817nn0cnd 10741 . . . . . . . . . . 11  |-  ( A  e. Word  V  ->  ( # `
 A )  e.  CC )
19 lencl 12353 . . . . . . . . . . . 12  |-  ( B  e. Word  V  ->  ( # `
 B )  e. 
NN0 )
2019nn0cnd 10741 . . . . . . . . . . 11  |-  ( B  e. Word  V  ->  ( # `
 B )  e.  CC )
2110eqcomi 2464 . . . . . . . . . . . . 13  |-  ( # `  A )  =  L
2221eleq1i 2528 . . . . . . . . . . . 12  |-  ( (
# `  A )  e.  CC  <->  L  e.  CC )
23 pncan2 9720 . . . . . . . . . . . 12  |-  ( ( L  e.  CC  /\  ( # `  B )  e.  CC )  -> 
( ( L  +  ( # `  B ) )  -  L )  =  ( # `  B
) )
2422, 23sylanb 472 . . . . . . . . . . 11  |-  ( ( ( # `  A
)  e.  CC  /\  ( # `  B )  e.  CC )  -> 
( ( L  +  ( # `  B ) )  -  L )  =  ( # `  B
) )
2518, 20, 24syl2an 477 . . . . . . . . . 10  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( ( L  +  ( # `  B ) )  -  L )  =  ( # `  B
) )
2625eqcomd 2459 . . . . . . . . 9  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( # `  B
)  =  ( ( L  +  ( # `  B ) )  -  L ) )
2726adantr 465 . . . . . . . 8  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( # `  B
)  =  ( ( L  +  ( # `  B ) )  -  L ) )
28273ad2ant1 1009 . . . . . . 7  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  L  <_  M )  ->  ( # `  B
)  =  ( ( L  +  ( # `  B ) )  -  L ) )
2928opeq2d 4166 . . . . . 6  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  L  <_  M )  ->  <. ( M  -  L ) ,  (
# `  B ) >.  =  <. ( M  -  L ) ,  ( ( L  +  (
# `  B )
)  -  L )
>. )
3029oveq2d 6208 . . . . 5  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  L  <_  M )  ->  ( B substr  <. ( M  -  L ) ,  ( # `  B
) >. )  =  ( B substr  <. ( M  -  L ) ,  ( ( L  +  (
# `  B )
)  -  L )
>. ) )
3116, 30eqtrd 2492 . . . 4  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  L  <_  M )  ->  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  (
# `  B ) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B ) )  =  ( B substr  <. ( M  -  L ) ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) )
32 iffalse 3899 . . . . . 6  |-  ( -.  L  <_  M  ->  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B )
)  =  ( ( A substr  <. M ,  L >. ) concat  B ) )
33323ad2ant3 1011 . . . . 5  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  (
# `  B ) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B ) )  =  ( ( A substr  <. M ,  L >. ) concat  B ) )
3425adantr 465 . . . . . . . . . 10  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( ( L  +  ( # `  B
) )  -  L
)  =  ( # `  B ) )
35343ad2ant1 1009 . . . . . . . . 9  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  ( ( L  +  ( # `  B
) )  -  L
)  =  ( # `  B ) )
3635opeq2d 4166 . . . . . . . 8  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  <. 0 ,  ( ( L  +  ( # `  B ) )  -  L )
>.  =  <. 0 ,  ( # `  B
) >. )
3736oveq2d 6208 . . . . . . 7  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  ( B substr  <.
0 ,  ( ( L  +  ( # `  B ) )  -  L ) >. )  =  ( B substr  <. 0 ,  ( # `  B
) >. ) )
38 swrdid 12425 . . . . . . . . . 10  |-  ( B  e. Word  V  ->  ( B substr  <. 0 ,  (
# `  B ) >. )  =  B )
3938adantl 466 . . . . . . . . 9  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( B substr  <. 0 ,  ( # `  B
) >. )  =  B )
4039adantr 465 . . . . . . . 8  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( B substr  <. 0 ,  ( # `  B
) >. )  =  B )
41403ad2ant1 1009 . . . . . . 7  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  ( B substr  <.
0 ,  ( # `  B ) >. )  =  B )
4237, 41eqtr2d 2493 . . . . . 6  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  B  =  ( B substr  <. 0 ,  ( ( L  +  ( # `  B ) )  -  L )
>. ) )
4342oveq2d 6208 . . . . 5  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  ( ( A substr  <. M ,  L >. ) concat  B )  =  ( ( A substr  <. M ,  L >. ) concat  ( B substr  <.
0 ,  ( ( L  +  ( # `  B ) )  -  L ) >. )
) )
4433, 43eqtrd 2492 . . . 4  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  (
# `  B ) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B ) )  =  ( ( A substr  <. M ,  L >. ) concat 
( B substr  <. 0 ,  ( ( L  +  ( # `  B ) )  -  L )
>. ) ) )
4514, 31, 442if2 3937 . . 3  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  (
# `  B ) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B ) )  =  if ( ( L  +  ( # `  B ) )  <_  L ,  ( A substr  <. M ,  ( L  +  ( # `  B
) ) >. ) ,  if ( L  <_  M ,  ( B substr  <.
( M  -  L
) ,  ( ( L  +  ( # `  B ) )  -  L ) >. ) ,  ( ( A substr  <. M ,  L >. ) concat 
( B substr  <. 0 ,  ( ( L  +  ( # `  B ) )  -  L )
>. ) ) ) ) )
4613, 45eqtr4d 2495 . 2  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( ( A concat  B ) substr  <. M , 
( L  +  (
# `  B )
) >. )  =  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B )
) )
4746ex 434 1  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( M  e.  ( 0 ... ( L  +  ( # `  B
) ) )  -> 
( ( A concat  B
) substr  <. M ,  ( L  +  ( # `  B ) ) >.
)  =  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) concat  B )
) ) )
Colors of variables: wff setvar class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 369    /\ w3a 965    = wceq 1370    e. wcel 1758   ifcif 3891   <.cop 3983   class class class wbr 4392   ` cfv 5518  (class class class)co 6192   CCcc 9383   0cc0 9385    + caddc 9388    <_ cle 9522    - cmin 9698   NN0cn0 10682   ZZ>=cuz 10964   ...cfz 11540   #chash 12206  Word cword 12325   concat cconcat 12327   substr csubstr 12329
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 4503  ax-sep 4513  ax-nul 4521  ax-pow 4570  ax-pr 4631  ax-un 6474  ax-cnex 9441  ax-resscn 9442  ax-1cn 9443  ax-icn 9444  ax-addcl 9445  ax-addrcl 9446  ax-mulcl 9447  ax-mulrcl 9448  ax-mulcom 9449  ax-addass 9450  ax-mulass 9451  ax-distr 9452  ax-i2m1 9453  ax-1ne0 9454  ax-1rid 9455  ax-rnegex 9456  ax-rrecex 9457  ax-cnre 9458  ax-pre-lttri 9459  ax-pre-lttrn 9460  ax-pre-ltadd 9461  ax-pre-mulgt0 9462
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 3072  df-sbc 3287  df-csb 3389  df-dif 3431  df-un 3433  df-in 3435  df-ss 3442  df-pss 3444  df-nul 3738  df-if 3892  df-pw 3962  df-sn 3978  df-pr 3980  df-tp 3982  df-op 3984  df-uni 4192  df-int 4229  df-iun 4273  df-br 4393  df-opab 4451  df-mpt 4452  df-tr 4486  df-eprel 4732  df-id 4736  df-po 4741  df-so 4742  df-fr 4779  df-we 4781  df-ord 4822  df-on 4823  df-lim 4824  df-suc 4825  df-xp 4946  df-rel 4947  df-cnv 4948  df-co 4949  df-dm 4950  df-rn 4951  df-res 4952  df-ima 4953  df-iota 5481  df-fun 5520  df-fn 5521  df-f 5522  df-f1 5523  df-fo 5524  df-f1o 5525  df-fv 5526  df-riota 6153  df-ov 6195  df-oprab 6196  df-mpt2 6197  df-om 6579  df-1st 6679  df-2nd 6680  df-recs 6934  df-rdg 6968  df-1o 7022  df-oadd 7026  df-er 7203  df-en 7413  df-dom 7414  df-sdom 7415  df-fin 7416  df-card 8212  df-pnf 9523  df-mnf 9524  df-xr 9525  df-ltxr 9526  df-le 9527  df-sub 9700  df-neg 9701  df-nn 10426  df-n0 10683  df-z 10750  df-uz 10965  df-fz 11541  df-fzo 11652  df-hash 12207  df-word 12333  df-concat 12335  df-substr 12337
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator