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

Theorem swrd2lsw 12869
Description: Extract the last two single symbol from a word. (Contributed by Alexander van der Vekens, 23-Sep-2018.)
Assertion
Ref Expression
swrd2lsw  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W substr  <. ( ( # `  W )  -  2 ) ,  ( # `  W ) >. )  =  <" ( W `
 ( ( # `  W )  -  2 ) ) ( lastS  `  W
) "> )

Proof of Theorem swrd2lsw
StepHypRef Expression
1 simpl 457 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  W  e. Word  V )
2 lencl 12541 . . . . 5  |-  ( W  e. Word  V  ->  ( # `
 W )  e. 
NN0 )
3 1z 10900 . . . . . . . . 9  |-  1  e.  ZZ
4 nn0z 10893 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  ZZ )
5 zltp1le 10919 . . . . . . . . 9  |-  ( ( 1  e.  ZZ  /\  ( # `  W )  e.  ZZ )  -> 
( 1  <  ( # `
 W )  <->  ( 1  +  1 )  <_ 
( # `  W ) ) )
63, 4, 5sylancr 663 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( 1  <  ( # `  W
)  <->  ( 1  +  1 )  <_  ( # `
 W ) ) )
7 1p1e2 10655 . . . . . . . . . . 11  |-  ( 1  +  1 )  =  2
87a1i 11 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( 1  +  1 )  =  2 )
98breq1d 4447 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( (
1  +  1 )  <_  ( # `  W
)  <->  2  <_  ( # `
 W ) ) )
109biimpd 207 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( (
1  +  1 )  <_  ( # `  W
)  ->  2  <_  (
# `  W )
) )
116, 10sylbid 215 . . . . . . 7  |-  ( (
# `  W )  e.  NN0  ->  ( 1  <  ( # `  W
)  ->  2  <_  (
# `  W )
) )
1211imp 429 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  2  <_  ( # `  W
) )
13 2nn0 10818 . . . . . . . . 9  |-  2  e.  NN0
1413jctl 541 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( 2  e.  NN0  /\  ( # `
 W )  e. 
NN0 ) )
1514adantr 465 . . . . . . 7  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
2  e.  NN0  /\  ( # `  W )  e.  NN0 ) )
16 nn0sub 10852 . . . . . . 7  |-  ( ( 2  e.  NN0  /\  ( # `  W )  e.  NN0 )  -> 
( 2  <_  ( # `
 W )  <->  ( ( # `
 W )  - 
2 )  e.  NN0 ) )
1715, 16syl 16 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
2  <_  ( # `  W
)  <->  ( ( # `  W )  -  2 )  e.  NN0 )
)
1812, 17mpbid 210 . . . . 5  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( # `  W )  -  2 )  e. 
NN0 )
192, 18sylan 471 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  (
( # `  W )  -  2 )  e. 
NN0 )
20 0red 9600 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  0  e.  RR )
21 1red 9614 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  1  e.  RR )
22 zre 10874 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  ( # `  W
)  e.  RR )
2320, 21, 223jca 1177 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  ZZ  ->  ( 0  e.  RR  /\  1  e.  RR  /\  ( # `  W )  e.  RR ) )
24 0lt1 10081 . . . . . . . . . . 11  |-  0  <  1
25 lttr 9664 . . . . . . . . . . . 12  |-  ( ( 0  e.  RR  /\  1  e.  RR  /\  ( # `
 W )  e.  RR )  ->  (
( 0  <  1  /\  1  <  ( # `  W ) )  -> 
0  <  ( # `  W
) ) )
2625expd 436 . . . . . . . . . . 11  |-  ( ( 0  e.  RR  /\  1  e.  RR  /\  ( # `
 W )  e.  RR )  ->  (
0  <  1  ->  ( 1  <  ( # `  W )  ->  0  <  ( # `  W
) ) ) )
2723, 24, 26mpisyl 18 . . . . . . . . . 10  |-  ( (
# `  W )  e.  ZZ  ->  ( 1  <  ( # `  W
)  ->  0  <  (
# `  W )
) )
28 elnnz 10880 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN  <->  ( ( # `  W )  e.  ZZ  /\  0  <  ( # `  W ) ) )
2928simplbi2 625 . . . . . . . . . 10  |-  ( (
# `  W )  e.  ZZ  ->  ( 0  <  ( # `  W
)  ->  ( # `  W
)  e.  NN ) )
3027, 29syld 44 . . . . . . . . 9  |-  ( (
# `  W )  e.  ZZ  ->  ( 1  <  ( # `  W
)  ->  ( # `  W
)  e.  NN ) )
314, 30syl 16 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( 1  <  ( # `  W
)  ->  ( # `  W
)  e.  NN ) )
3231imp 429 . . . . . . 7  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  ( # `
 W )  e.  NN )
33 fzo0end 11883 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  ( ( # `
 W )  - 
1 )  e.  ( 0..^ ( # `  W
) ) )
3432, 33syl 16 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( # `  W )  -  1 )  e.  ( 0..^ ( # `  W ) ) )
35 nn0cn 10811 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  CC )
36 2cn 10612 . . . . . . . . . . . 12  |-  2  e.  CC
3736a1i 11 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  2  e.  CC )
38 1cnd 9615 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  1  e.  CC )
3935, 37, 383jca 1177 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  e.  CC  /\  2  e.  CC  /\  1  e.  CC ) )
40 1e2m1 10657 . . . . . . . . . . . . 13  |-  1  =  ( 2  -  1 )
4140a1i 11 . . . . . . . . . . . 12  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  1  =  ( 2  -  1 ) )
4241oveq2d 6297 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  1 )  =  ( ( # `  W
)  -  ( 2  -  1 ) ) )
43 subsub 9854 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  ( 2  -  1 ) )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
4442, 43eqtrd 2484 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  1 )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
4539, 44syl 16 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  - 
1 )  =  ( ( ( # `  W
)  -  2 )  +  1 ) )
4645eqcomd 2451 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
4746eleq1d 2512 . . . . . . 7  |-  ( (
# `  W )  e.  NN0  ->  ( (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) )  <->  ( ( # `
 W )  - 
1 )  e.  ( 0..^ ( # `  W
) ) ) )
4847adantr 465 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( ( ( # `  W )  -  2 )  +  1 )  e.  ( 0..^ (
# `  W )
)  <->  ( ( # `  W )  -  1 )  e.  ( 0..^ ( # `  W
) ) ) )
4934, 48mpbird 232 . . . . 5  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) ) )
502, 49sylan 471 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) ) )
511, 19, 503jca 1177 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W  e. Word  V  /\  (
( # `  W )  -  2 )  e. 
NN0  /\  ( (
( # `  W )  -  2 )  +  1 )  e.  ( 0..^ ( # `  W
) ) ) )
52 swrds2 12862 . . 3  |-  ( ( W  e. Word  V  /\  ( ( # `  W
)  -  2 )  e.  NN0  /\  (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) ) )  ->  ( W substr  <. (
( # `  W )  -  2 ) ,  ( ( ( # `  W )  -  2 )  +  2 )
>. )  =  <" ( W `  (
( # `  W )  -  2 ) ) ( W `  (
( ( # `  W
)  -  2 )  +  1 ) ) "> )
5351, 52syl 16 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W substr  <. ( ( # `  W )  -  2 ) ,  ( ( ( # `  W
)  -  2 )  +  2 ) >.
)  =  <" ( W `  ( ( # `
 W )  - 
2 ) ) ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) "> )
5435, 36jctir 538 . . . . . 6  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  e.  CC  /\  2  e.  CC ) )
55 npcan 9834 . . . . . . 7  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC )  ->  ( ( ( # `  W )  -  2 )  +  2 )  =  ( # `  W
) )
5655eqcomd 2451 . . . . . 6  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC )  ->  ( # `  W
)  =  ( ( ( # `  W
)  -  2 )  +  2 ) )
572, 54, 563syl 20 . . . . 5  |-  ( W  e. Word  V  ->  ( # `
 W )  =  ( ( ( # `  W )  -  2 )  +  2 ) )
5857adantr 465 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( # `
 W )  =  ( ( ( # `  W )  -  2 )  +  2 ) )
5958opeq2d 4209 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  <. (
( # `  W )  -  2 ) ,  ( # `  W
) >.  =  <. (
( # `  W )  -  2 ) ,  ( ( ( # `  W )  -  2 )  +  2 )
>. )
6059oveq2d 6297 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W substr  <. ( ( # `  W )  -  2 ) ,  ( # `  W ) >. )  =  ( W substr  <. (
( # `  W )  -  2 ) ,  ( ( ( # `  W )  -  2 )  +  2 )
>. ) )
61 eqidd 2444 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W `  ( ( # `
 W )  - 
2 ) )  =  ( W `  (
( # `  W )  -  2 ) ) )
62 lsw 12564 . . . . 5  |-  ( W  e. Word  V  ->  ( lastS  `  W )  =  ( W `  ( (
# `  W )  -  1 ) ) )
6339, 43syl 16 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  -  ( 2  -  1 ) )  =  ( ( ( # `  W
)  -  2 )  +  1 ) )
6463eqcomd 2451 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  ( 2  -  1 ) ) )
65 2m1e1 10656 . . . . . . . . . . 11  |-  ( 2  -  1 )  =  1
6665a1i 11 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( 2  -  1 )  =  1 )
6766oveq2d 6297 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  -  ( 2  -  1 ) )  =  ( ( # `  W
)  -  1 ) )
6864, 67eqtrd 2484 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
692, 68syl 16 . . . . . . 7  |-  ( W  e. Word  V  ->  (
( ( # `  W
)  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
7069eqcomd 2451 . . . . . 6  |-  ( W  e. Word  V  ->  (
( # `  W )  -  1 )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
7170fveq2d 5860 . . . . 5  |-  ( W  e. Word  V  ->  ( W `  ( ( # `
 W )  - 
1 ) )  =  ( W `  (
( ( # `  W
)  -  2 )  +  1 ) ) )
7262, 71eqtrd 2484 . . . 4  |-  ( W  e. Word  V  ->  ( lastS  `  W )  =  ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) )
7372adantr 465 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( lastS  `  W )  =  ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) )
7461, 73s2eqd 12806 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  <" ( W `  ( ( # `
 W )  - 
2 ) ) ( lastS  `  W ) ">  =  <" ( W `
 ( ( # `  W )  -  2 ) ) ( W `
 ( ( (
# `  W )  -  2 )  +  1 ) ) "> )
7553, 60, 743eqtr4d 2494 1  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W substr  <. ( ( # `  W )  -  2 ) ,  ( # `  W ) >. )  =  <" ( W `
 ( ( # `  W )  -  2 ) ) ( lastS  `  W
) "> )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    <-> wb 184    /\ wa 369    /\ w3a 974    = wceq 1383    e. wcel 1804   <.cop 4020   class class class wbr 4437   ` cfv 5578  (class class class)co 6281   CCcc 9493   RRcr 9494   0cc0 9495   1c1 9496    + caddc 9498    < clt 9631    <_ cle 9632    - cmin 9810   NNcn 10542   2c2 10591   NN0cn0 10801   ZZcz 10870  ..^cfzo 11803   #chash 12384  Word cword 12513   lastS clsw 12514   substr csubstr 12517   <"cs2 12785
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1605  ax-4 1618  ax-5 1691  ax-6 1734  ax-7 1776  ax-8 1806  ax-9 1808  ax-10 1823  ax-11 1828  ax-12 1840  ax-13 1985  ax-ext 2421  ax-rep 4548  ax-sep 4558  ax-nul 4566  ax-pow 4615  ax-pr 4676  ax-un 6577  ax-cnex 9551  ax-resscn 9552  ax-1cn 9553  ax-icn 9554  ax-addcl 9555  ax-addrcl 9556  ax-mulcl 9557  ax-mulrcl 9558  ax-mulcom 9559  ax-addass 9560  ax-mulass 9561  ax-distr 9562  ax-i2m1 9563  ax-1ne0 9564  ax-1rid 9565  ax-rnegex 9566  ax-rrecex 9567  ax-cnre 9568  ax-pre-lttri 9569  ax-pre-lttrn 9570  ax-pre-ltadd 9571  ax-pre-mulgt0 9572
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 975  df-3an 976  df-tru 1386  df-ex 1600  df-nf 1604  df-sb 1727  df-eu 2272  df-mo 2273  df-clab 2429  df-cleq 2435  df-clel 2438  df-nfc 2593  df-ne 2640  df-nel 2641  df-ral 2798  df-rex 2799  df-reu 2800  df-rmo 2801  df-rab 2802  df-v 3097  df-sbc 3314  df-csb 3421  df-dif 3464  df-un 3466  df-in 3468  df-ss 3475  df-pss 3477  df-nul 3771  df-if 3927  df-pw 3999  df-sn 4015  df-pr 4017  df-tp 4019  df-op 4021  df-uni 4235  df-int 4272  df-iun 4317  df-br 4438  df-opab 4496  df-mpt 4497  df-tr 4531  df-eprel 4781  df-id 4785  df-po 4790  df-so 4791  df-fr 4828  df-we 4830  df-ord 4871  df-on 4872  df-lim 4873  df-suc 4874  df-xp 4995  df-rel 4996  df-cnv 4997  df-co 4998  df-dm 4999  df-rn 5000  df-res 5001  df-ima 5002  df-iota 5541  df-fun 5580  df-fn 5581  df-f 5582  df-f1 5583  df-fo 5584  df-f1o 5585  df-fv 5586  df-riota 6242  df-ov 6284  df-oprab 6285  df-mpt2 6286  df-om 6686  df-1st 6785  df-2nd 6786  df-recs 7044  df-rdg 7078  df-1o 7132  df-oadd 7136  df-er 7313  df-en 7519  df-dom 7520  df-sdom 7521  df-fin 7522  df-card 8323  df-cda 8551  df-pnf 9633  df-mnf 9634  df-xr 9635  df-ltxr 9636  df-le 9637  df-sub 9812  df-neg 9813  df-nn 10543  df-2 10600  df-n0 10802  df-z 10871  df-uz 11091  df-fz 11682  df-fzo 11804  df-hash 12385  df-word 12521  df-lsw 12522  df-concat 12523  df-s1 12524  df-substr 12525  df-s2 12792
This theorem is referenced by:  2swrd2eqwrdeq  12870
  Copyright terms: Public domain W3C validator