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

Theorem swrdccat3b 12777
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 ++  B
) substr  <. M ,  ( L  +  ( # `  B ) ) >.
)  =  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) ++  B ) ) ) )

Proof of Theorem swrdccat3b
StepHypRef Expression
1 simpl 455 . . . 4  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( A  e. Word  V  /\  B  e. Word  V
) )
2 simpr 459 . . . 4  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )
3 elfzubelfz 11752 . . . . 5  |-  ( M  e.  ( 0 ... ( L  +  (
# `  B )
) )  ->  ( L  +  ( # `  B
) )  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )
43adantl 464 . . . 4  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( L  +  ( # `  B ) )  e.  ( 0 ... ( L  +  ( # `  B ) ) ) )
5 swrdccatin12.l . . . . . 6  |-  L  =  ( # `  A
)
65swrdccat3 12773 . . . . 5  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( ( M  e.  ( 0 ... ( L  +  ( # `  B
) ) )  /\  ( L  +  ( # `
 B ) )  e.  ( 0 ... ( L  +  (
# `  B )
) ) )  -> 
( ( A ++  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 >. ) ++  ( B substr  <. 0 ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) ) ) ) ) )
76imp 427 . . . 4  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  ( M  e.  ( 0 ... ( L  +  ( # `  B
) ) )  /\  ( L  +  ( # `
 B ) )  e.  ( 0 ... ( L  +  (
# `  B )
) ) ) )  ->  ( ( A ++  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 >. ) ++  ( B substr  <. 0 ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) ) ) ) )
81, 2, 4, 7syl12anc 1228 . . 3  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( ( A ++  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 >. ) ++  ( B substr  <. 0 ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) ) ) ) )
95swrdccat3blem 12776 . . . 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 >. ) ++  B ) )  =  ( A substr  <. M , 
( L  +  (
# `  B )
) >. ) )
10 iftrue 3891 . . . . . 6  |-  ( L  <_  M  ->  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) ++  B ) )  =  ( B substr  <. ( M  -  L
) ,  ( # `  B ) >. )
)
11103ad2ant3 1020 . . . . 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 >. ) ++  B ) )  =  ( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) )
12 lencl 12614 . . . . . . . . . . . 12  |-  ( A  e. Word  V  ->  ( # `
 A )  e. 
NN0 )
1312nn0cnd 10895 . . . . . . . . . . 11  |-  ( A  e. Word  V  ->  ( # `
 A )  e.  CC )
14 lencl 12614 . . . . . . . . . . . 12  |-  ( B  e. Word  V  ->  ( # `
 B )  e. 
NN0 )
1514nn0cnd 10895 . . . . . . . . . . 11  |-  ( B  e. Word  V  ->  ( # `
 B )  e.  CC )
165eqcomi 2415 . . . . . . . . . . . . 13  |-  ( # `  A )  =  L
1716eleq1i 2479 . . . . . . . . . . . 12  |-  ( (
# `  A )  e.  CC  <->  L  e.  CC )
18 pncan2 9863 . . . . . . . . . . . 12  |-  ( ( L  e.  CC  /\  ( # `  B )  e.  CC )  -> 
( ( L  +  ( # `  B ) )  -  L )  =  ( # `  B
) )
1917, 18sylanb 470 . . . . . . . . . . 11  |-  ( ( ( # `  A
)  e.  CC  /\  ( # `  B )  e.  CC )  -> 
( ( L  +  ( # `  B ) )  -  L )  =  ( # `  B
) )
2013, 15, 19syl2an 475 . . . . . . . . . 10  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( ( L  +  ( # `  B ) )  -  L )  =  ( # `  B
) )
2120eqcomd 2410 . . . . . . . . 9  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( # `  B
)  =  ( ( L  +  ( # `  B ) )  -  L ) )
2221adantr 463 . . . . . . . 8  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( # `  B
)  =  ( ( L  +  ( # `  B ) )  -  L ) )
23223ad2ant1 1018 . . . . . . 7  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  L  <_  M )  ->  ( # `  B
)  =  ( ( L  +  ( # `  B ) )  -  L ) )
2423opeq2d 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 )
>. )
2524oveq2d 6294 . . . . 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 )
>. ) )
2611, 25eqtrd 2443 . . . 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 >. ) ++  B ) )  =  ( B substr  <. ( M  -  L ) ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) )
27 iffalse 3894 . . . . . 6  |-  ( -.  L  <_  M  ->  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) ++  B ) )  =  ( ( A substr  <. M ,  L >. ) ++  B ) )
28273ad2ant3 1020 . . . . 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 >. ) ++  B ) )  =  ( ( A substr  <. M ,  L >. ) ++  B ) )
2920adantr 463 . . . . . . . . . 10  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( ( L  +  ( # `  B
) )  -  L
)  =  ( # `  B ) )
30293ad2ant1 1018 . . . . . . . . 9  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  ( ( L  +  ( # `  B
) )  -  L
)  =  ( # `  B ) )
3130opeq2d 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
) >. )
3231oveq2d 6294 . . . . . . 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
) >. ) )
33 swrdid 12709 . . . . . . . . . 10  |-  ( B  e. Word  V  ->  ( B substr  <. 0 ,  (
# `  B ) >. )  =  B )
3433adantl 464 . . . . . . . . 9  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( B substr  <. 0 ,  ( # `  B
) >. )  =  B )
3534adantr 463 . . . . . . . 8  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( B substr  <. 0 ,  ( # `  B
) >. )  =  B )
36353ad2ant1 1018 . . . . . . 7  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  ( B substr  <.
0 ,  ( # `  B ) >. )  =  B )
3732, 36eqtr2d 2444 . . . . . 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 )
>. ) )
3837oveq2d 6294 . . . . 5  |-  ( ( ( ( A  e. Word  V  /\  B  e. Word  V
)  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  /\  -.  ( L  +  ( # `  B
) )  <_  L  /\  -.  L  <_  M
)  ->  ( ( A substr  <. M ,  L >. ) ++  B )  =  ( ( A substr  <. M ,  L >. ) ++  ( B substr  <. 0 ,  ( ( L  +  ( # `  B ) )  -  L ) >. )
) )
3928, 38eqtrd 2443 . . . 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 >. ) ++  B ) )  =  ( ( A substr  <. M ,  L >. ) ++  ( B substr  <. 0 ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) ) )
409, 26, 392if2 3933 . . 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 >. ) ++  B ) )  =  if ( ( L  +  ( # `  B ) )  <_  L ,  ( A substr  <. M ,  ( L  +  ( # `  B
) ) >. ) ,  if ( L  <_  M ,  ( B substr  <.
( M  -  L
) ,  ( ( L  +  ( # `  B ) )  -  L ) >. ) ,  ( ( A substr  <. M ,  L >. ) ++  ( B substr  <. 0 ,  ( ( L  +  ( # `  B
) )  -  L
) >. ) ) ) ) )
418, 40eqtr4d 2446 . 2  |-  ( ( ( A  e. Word  V  /\  B  e. Word  V )  /\  M  e.  ( 0 ... ( L  +  ( # `  B
) ) ) )  ->  ( ( A ++  B ) substr  <. M , 
( L  +  (
# `  B )
) >. )  =  if ( L  <_  M ,  ( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) ++  B ) ) )
4241ex 432 1  |-  ( ( A  e. Word  V  /\  B  e. Word  V )  ->  ( M  e.  ( 0 ... ( L  +  ( # `  B
) ) )  -> 
( ( A ++  B
) substr  <. M ,  ( L  +  ( # `  B ) ) >.
)  =  if ( L  <_  M , 
( B substr  <. ( M  -  L ) ,  ( # `  B
) >. ) ,  ( ( A substr  <. M ,  L >. ) ++  B ) ) ) )
Colors of variables: wff setvar class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 367    /\ w3a 974    = wceq 1405    e. wcel 1842   ifcif 3885   <.cop 3978   class class class wbr 4395   ` cfv 5569  (class class class)co 6278   CCcc 9520   0cc0 9522    + caddc 9525    <_ cle 9659    - cmin 9841   ...cfz 11726   #chash 12452  Word cword 12583   ++ cconcat 12585   substr csubstr 12587
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1639  ax-4 1652  ax-5 1725  ax-6 1771  ax-7 1814  ax-8 1844  ax-9 1846  ax-10 1861  ax-11 1866  ax-12 1878  ax-13 2026  ax-ext 2380  ax-rep 4507  ax-sep 4517  ax-nul 4525  ax-pow 4572  ax-pr 4630  ax-un 6574  ax-cnex 9578  ax-resscn 9579  ax-1cn 9580  ax-icn 9581  ax-addcl 9582  ax-addrcl 9583  ax-mulcl 9584  ax-mulrcl 9585  ax-mulcom 9586  ax-addass 9587  ax-mulass 9588  ax-distr 9589  ax-i2m1 9590  ax-1ne0 9591  ax-1rid 9592  ax-rnegex 9593  ax-rrecex 9594  ax-cnre 9595  ax-pre-lttri 9596  ax-pre-lttrn 9597  ax-pre-ltadd 9598  ax-pre-mulgt0 9599
This theorem depends on definitions:  df-bi 185  df-or 368  df-an 369  df-3or 975  df-3an 976  df-tru 1408  df-ex 1634  df-nf 1638  df-sb 1764  df-eu 2242  df-mo 2243  df-clab 2388  df-cleq 2394  df-clel 2397  df-nfc 2552  df-ne 2600  df-nel 2601  df-ral 2759  df-rex 2760  df-reu 2761  df-rmo 2762  df-rab 2763  df-v 3061  df-sbc 3278  df-csb 3374  df-dif 3417  df-un 3419  df-in 3421  df-ss 3428  df-pss 3430  df-nul 3739  df-if 3886  df-pw 3957  df-sn 3973  df-pr 3975  df-tp 3977  df-op 3979  df-uni 4192  df-int 4228  df-iun 4273  df-br 4396  df-opab 4454  df-mpt 4455  df-tr 4490  df-eprel 4734  df-id 4738  df-po 4744  df-so 4745  df-fr 4782  df-we 4784  df-xp 4829  df-rel 4830  df-cnv 4831  df-co 4832  df-dm 4833  df-rn 4834  df-res 4835  df-ima 4836  df-pred 5367  df-ord 5413  df-on 5414  df-lim 5415  df-suc 5416  df-iota 5533  df-fun 5571  df-fn 5572  df-f 5573  df-f1 5574  df-fo 5575  df-f1o 5576  df-fv 5577  df-riota 6240  df-ov 6281  df-oprab 6282  df-mpt2 6283  df-om 6684  df-1st 6784  df-2nd 6785  df-wrecs 7013  df-recs 7075  df-rdg 7113  df-1o 7167  df-oadd 7171  df-er 7348  df-en 7555  df-dom 7556  df-sdom 7557  df-fin 7558  df-card 8352  df-cda 8580  df-pnf 9660  df-mnf 9661  df-xr 9662  df-ltxr 9663  df-le 9664  df-sub 9843  df-neg 9844  df-nn 10577  df-2 10635  df-n0 10837  df-z 10906  df-uz 11128  df-fz 11727  df-fzo 11855  df-hash 12453  df-word 12591  df-concat 12593  df-substr 12595
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator