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

Theorem swrd2lsw 12865
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 12538 . . . . 5  |-  ( W  e. Word  V  ->  ( # `
 W )  e. 
NN0 )
3 1z 10904 . . . . . . . . 9  |-  1  e.  ZZ
4 nn0z 10897 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  ZZ )
5 zltp1le 10922 . . . . . . . . 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 10659 . . . . . . . . . . 11  |-  ( 1  +  1 )  =  2
87a1i 11 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( 1  +  1 )  =  2 )
98breq1d 4462 . . . . . . . . 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 10822 . . . . . . . . 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 10856 . . . . . . 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 9607 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  0  e.  RR )
21 1red 9621 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  1  e.  RR )
22 zre 10878 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  ( # `  W
)  e.  RR )
2320, 21, 223jca 1176 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  ZZ  ->  ( 0  e.  RR  /\  1  e.  RR  /\  ( # `  W )  e.  RR ) )
24 0lt1 10085 . . . . . . . . . . 11  |-  0  <  1
25 lttr 9671 . . . . . . . . . . . 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 10884 . . . . . . . . . . 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 11882 . . . . . . 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 10815 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  CC )
36 2cn 10616 . . . . . . . . . . . 12  |-  2  e.  CC
3736a1i 11 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  2  e.  CC )
38 ax-1cn 9560 . . . . . . . . . . . 12  |-  1  e.  CC
3938a1i 11 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  1  e.  CC )
4035, 37, 393jca 1176 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  e.  CC  /\  2  e.  CC  /\  1  e.  CC ) )
41 1e2m1 10661 . . . . . . . . . . . . 13  |-  1  =  ( 2  -  1 )
4241a1i 11 . . . . . . . . . . . 12  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  1  =  ( 2  -  1 ) )
4342oveq2d 6310 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  1 )  =  ( ( # `  W
)  -  ( 2  -  1 ) ) )
44 subsub 9859 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  ( 2  -  1 ) )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
4543, 44eqtrd 2508 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  1 )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
4640, 45syl 16 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  - 
1 )  =  ( ( ( # `  W
)  -  2 )  +  1 ) )
4746eqcomd 2475 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
4847eleq1d 2536 . . . . . . 7  |-  ( (
# `  W )  e.  NN0  ->  ( (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) )  <->  ( ( # `
 W )  - 
1 )  e.  ( 0..^ ( # `  W
) ) ) )
4948adantr 465 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( ( ( # `  W )  -  2 )  +  1 )  e.  ( 0..^ (
# `  W )
)  <->  ( ( # `  W )  -  1 )  e.  ( 0..^ ( # `  W
) ) ) )
5034, 49mpbird 232 . . . . 5  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) ) )
512, 50sylan 471 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) ) )
521, 19, 513jca 1176 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W  e. Word  V  /\  (
( # `  W )  -  2 )  e. 
NN0  /\  ( (
( # `  W )  -  2 )  +  1 )  e.  ( 0..^ ( # `  W
) ) ) )
53 swrds2 12858 . . 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 ) ) "> )
5452, 53syl 16 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W substr  <. ( ( # `  W )  -  2 ) ,  ( ( ( # `  W
)  -  2 )  +  2 ) >.
)  =  <" ( W `  ( ( # `
 W )  - 
2 ) ) ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) "> )
5535, 36jctir 538 . . . . . 6  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  e.  CC  /\  2  e.  CC ) )
56 npcan 9839 . . . . . . 7  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC )  ->  ( ( ( # `  W )  -  2 )  +  2 )  =  ( # `  W
) )
5756eqcomd 2475 . . . . . 6  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC )  ->  ( # `  W
)  =  ( ( ( # `  W
)  -  2 )  +  2 ) )
582, 55, 573syl 20 . . . . 5  |-  ( W  e. Word  V  ->  ( # `
 W )  =  ( ( ( # `  W )  -  2 )  +  2 ) )
5958adantr 465 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( # `
 W )  =  ( ( ( # `  W )  -  2 )  +  2 ) )
6059opeq2d 4225 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  <. (
( # `  W )  -  2 ) ,  ( # `  W
) >.  =  <. (
( # `  W )  -  2 ) ,  ( ( ( # `  W )  -  2 )  +  2 )
>. )
6160oveq2d 6310 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W substr  <. ( ( # `  W )  -  2 ) ,  ( # `  W ) >. )  =  ( W substr  <. (
( # `  W )  -  2 ) ,  ( ( ( # `  W )  -  2 )  +  2 )
>. ) )
62 eqidd 2468 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W `  ( ( # `
 W )  - 
2 ) )  =  ( W `  (
( # `  W )  -  2 ) ) )
63 lsw 12560 . . . . 5  |-  ( W  e. Word  V  ->  ( lastS  `  W )  =  ( W `  ( (
# `  W )  -  1 ) ) )
6440, 44syl 16 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  -  ( 2  -  1 ) )  =  ( ( ( # `  W
)  -  2 )  +  1 ) )
6564eqcomd 2475 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  ( 2  -  1 ) ) )
66 2m1e1 10660 . . . . . . . . . . 11  |-  ( 2  -  1 )  =  1
6766a1i 11 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( 2  -  1 )  =  1 )
6867oveq2d 6310 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  -  ( 2  -  1 ) )  =  ( ( # `  W
)  -  1 ) )
6965, 68eqtrd 2508 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
702, 69syl 16 . . . . . . 7  |-  ( W  e. Word  V  ->  (
( ( # `  W
)  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
7170eqcomd 2475 . . . . . 6  |-  ( W  e. Word  V  ->  (
( # `  W )  -  1 )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
7271fveq2d 5875 . . . . 5  |-  ( W  e. Word  V  ->  ( W `  ( ( # `
 W )  - 
1 ) )  =  ( W `  (
( ( # `  W
)  -  2 )  +  1 ) ) )
7363, 72eqtrd 2508 . . . 4  |-  ( W  e. Word  V  ->  ( lastS  `  W )  =  ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) )
7473adantr 465 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( lastS  `  W )  =  ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) )
7562, 74s2eqd 12802 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  <" ( W `  ( ( # `
 W )  - 
2 ) ) ( lastS  `  W ) ">  =  <" ( W `
 ( ( # `  W )  -  2 ) ) ( W `
 ( ( (
# `  W )  -  2 )  +  1 ) ) "> )
7654, 61, 753eqtr4d 2518 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 973    = wceq 1379    e. wcel 1767   <.cop 4038   class class class wbr 4452   ` cfv 5593  (class class class)co 6294   CCcc 9500   RRcr 9501   0cc0 9502   1c1 9503    + caddc 9505    < clt 9638    <_ cle 9639    - cmin 9815   NNcn 10546   2c2 10595   NN0cn0 10805   ZZcz 10874  ..^cfzo 11802   #chash 12383  Word cword 12510   lastS clsw 12511   substr csubstr 12514   <"cs2 12781
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1601  ax-4 1612  ax-5 1680  ax-6 1719  ax-7 1739  ax-8 1769  ax-9 1771  ax-10 1786  ax-11 1791  ax-12 1803  ax-13 1968  ax-ext 2445  ax-rep 4563  ax-sep 4573  ax-nul 4581  ax-pow 4630  ax-pr 4691  ax-un 6586  ax-cnex 9558  ax-resscn 9559  ax-1cn 9560  ax-icn 9561  ax-addcl 9562  ax-addrcl 9563  ax-mulcl 9564  ax-mulrcl 9565  ax-mulcom 9566  ax-addass 9567  ax-mulass 9568  ax-distr 9569  ax-i2m1 9570  ax-1ne0 9571  ax-1rid 9572  ax-rnegex 9573  ax-rrecex 9574  ax-cnre 9575  ax-pre-lttri 9576  ax-pre-lttrn 9577  ax-pre-ltadd 9578  ax-pre-mulgt0 9579
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 974  df-3an 975  df-tru 1382  df-ex 1597  df-nf 1600  df-sb 1712  df-eu 2279  df-mo 2280  df-clab 2453  df-cleq 2459  df-clel 2462  df-nfc 2617  df-ne 2664  df-nel 2665  df-ral 2822  df-rex 2823  df-reu 2824  df-rab 2826  df-v 3120  df-sbc 3337  df-csb 3441  df-dif 3484  df-un 3486  df-in 3488  df-ss 3495  df-pss 3497  df-nul 3791  df-if 3945  df-pw 4017  df-sn 4033  df-pr 4035  df-tp 4037  df-op 4039  df-uni 4251  df-int 4288  df-iun 4332  df-br 4453  df-opab 4511  df-mpt 4512  df-tr 4546  df-eprel 4796  df-id 4800  df-po 4805  df-so 4806  df-fr 4843  df-we 4845  df-ord 4886  df-on 4887  df-lim 4888  df-suc 4889  df-xp 5010  df-rel 5011  df-cnv 5012  df-co 5013  df-dm 5014  df-rn 5015  df-res 5016  df-ima 5017  df-iota 5556  df-fun 5595  df-fn 5596  df-f 5597  df-f1 5598  df-fo 5599  df-f1o 5600  df-fv 5601  df-riota 6255  df-ov 6297  df-oprab 6298  df-mpt2 6299  df-om 6695  df-1st 6794  df-2nd 6795  df-recs 7052  df-rdg 7086  df-1o 7140  df-oadd 7144  df-er 7321  df-en 7527  df-dom 7528  df-sdom 7529  df-fin 7530  df-card 8330  df-pnf 9640  df-mnf 9641  df-xr 9642  df-ltxr 9643  df-le 9644  df-sub 9817  df-neg 9818  df-nn 10547  df-2 10604  df-n0 10806  df-z 10875  df-uz 11093  df-fz 11683  df-fzo 11803  df-hash 12384  df-word 12518  df-lsw 12519  df-concat 12520  df-s1 12521  df-substr 12522  df-s2 12788
This theorem is referenced by:  2swrd2eqwrdeq  12866
  Copyright terms: Public domain W3C validator