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

Theorem swrd2lsw 13075
Description: Extract the last two symbols 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 463 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  W  e. Word  V )
2 lencl 12721 . . . . 5  |-  ( W  e. Word  V  ->  ( # `
 W )  e. 
NN0 )
3 1z 10995 . . . . . . . . 9  |-  1  e.  ZZ
4 nn0z 10988 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  ZZ )
5 zltp1le 11014 . . . . . . . . 9  |-  ( ( 1  e.  ZZ  /\  ( # `  W )  e.  ZZ )  -> 
( 1  <  ( # `
 W )  <->  ( 1  +  1 )  <_ 
( # `  W ) ) )
63, 4, 5sylancr 674 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( 1  <  ( # `  W
)  <->  ( 1  +  1 )  <_  ( # `
 W ) ) )
7 1p1e2 10750 . . . . . . . . . . 11  |-  ( 1  +  1 )  =  2
87a1i 11 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( 1  +  1 )  =  2 )
98breq1d 4425 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( (
1  +  1 )  <_  ( # `  W
)  <->  2  <_  ( # `
 W ) ) )
109biimpd 212 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( (
1  +  1 )  <_  ( # `  W
)  ->  2  <_  (
# `  W )
) )
116, 10sylbid 223 . . . . . . 7  |-  ( (
# `  W )  e.  NN0  ->  ( 1  <  ( # `  W
)  ->  2  <_  (
# `  W )
) )
1211imp 435 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  2  <_  ( # `  W
) )
13 2nn0 10914 . . . . . . . . 9  |-  2  e.  NN0
1413jctl 548 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( 2  e.  NN0  /\  ( # `
 W )  e. 
NN0 ) )
1514adantr 471 . . . . . . 7  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
2  e.  NN0  /\  ( # `  W )  e.  NN0 ) )
16 nn0sub 10948 . . . . . . 7  |-  ( ( 2  e.  NN0  /\  ( # `  W )  e.  NN0 )  -> 
( 2  <_  ( # `
 W )  <->  ( ( # `
 W )  - 
2 )  e.  NN0 ) )
1715, 16syl 17 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
2  <_  ( # `  W
)  <->  ( ( # `  W )  -  2 )  e.  NN0 )
)
1812, 17mpbid 215 . . . . 5  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( # `  W )  -  2 )  e. 
NN0 )
192, 18sylan 478 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  (
( # `  W )  -  2 )  e. 
NN0 )
20 0red 9669 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  0  e.  RR )
21 1red 9683 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  1  e.  RR )
22 zre 10969 . . . . . . . . . . . 12  |-  ( (
# `  W )  e.  ZZ  ->  ( # `  W
)  e.  RR )
2320, 21, 223jca 1194 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  ZZ  ->  ( 0  e.  RR  /\  1  e.  RR  /\  ( # `  W )  e.  RR ) )
24 0lt1 10163 . . . . . . . . . . 11  |-  0  <  1
25 lttr 9735 . . . . . . . . . . . 12  |-  ( ( 0  e.  RR  /\  1  e.  RR  /\  ( # `
 W )  e.  RR )  ->  (
( 0  <  1  /\  1  <  ( # `  W ) )  -> 
0  <  ( # `  W
) ) )
2625expd 442 . . . . . . . . . . 11  |-  ( ( 0  e.  RR  /\  1  e.  RR  /\  ( # `
 W )  e.  RR )  ->  (
0  <  1  ->  ( 1  <  ( # `  W )  ->  0  <  ( # `  W
) ) ) )
2723, 24, 26mpisyl 21 . . . . . . . . . 10  |-  ( (
# `  W )  e.  ZZ  ->  ( 1  <  ( # `  W
)  ->  0  <  (
# `  W )
) )
28 elnnz 10975 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN  <->  ( ( # `  W )  e.  ZZ  /\  0  <  ( # `  W ) ) )
2928simplbi2 635 . . . . . . . . . 10  |-  ( (
# `  W )  e.  ZZ  ->  ( 0  <  ( # `  W
)  ->  ( # `  W
)  e.  NN ) )
3027, 29syld 45 . . . . . . . . 9  |-  ( (
# `  W )  e.  ZZ  ->  ( 1  <  ( # `  W
)  ->  ( # `  W
)  e.  NN ) )
314, 30syl 17 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( 1  <  ( # `  W
)  ->  ( # `  W
)  e.  NN ) )
3231imp 435 . . . . . . 7  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  ( # `
 W )  e.  NN )
33 fzo0end 12033 . . . . . . 7  |-  ( (
# `  W )  e.  NN  ->  ( ( # `
 W )  - 
1 )  e.  ( 0..^ ( # `  W
) ) )
3432, 33syl 17 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( # `  W )  -  1 )  e.  ( 0..^ ( # `  W ) ) )
35 nn0cn 10907 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  ( # `  W
)  e.  CC )
36 2cn 10707 . . . . . . . . . . . 12  |-  2  e.  CC
3736a1i 11 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  2  e.  CC )
38 1cnd 9684 . . . . . . . . . . 11  |-  ( (
# `  W )  e.  NN0  ->  1  e.  CC )
3935, 37, 383jca 1194 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  e.  CC  /\  2  e.  CC  /\  1  e.  CC ) )
40 1e2m1 10752 . . . . . . . . . . . . 13  |-  1  =  ( 2  -  1 )
4140a1i 11 . . . . . . . . . . . 12  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  1  =  ( 2  -  1 ) )
4241oveq2d 6330 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  1 )  =  ( ( # `  W
)  -  ( 2  -  1 ) ) )
43 subsub 9929 . . . . . . . . . . 11  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  ( 2  -  1 ) )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
4442, 43eqtrd 2495 . . . . . . . . . 10  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC  /\  1  e.  CC )  ->  (
( # `  W )  -  1 )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
4539, 44syl 17 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  - 
1 )  =  ( ( ( # `  W
)  -  2 )  +  1 ) )
4645eqcomd 2467 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
4746eleq1d 2523 . . . . . . 7  |-  ( (
# `  W )  e.  NN0  ->  ( (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) )  <->  ( ( # `
 W )  - 
1 )  e.  ( 0..^ ( # `  W
) ) ) )
4847adantr 471 . . . . . 6  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( ( ( # `  W )  -  2 )  +  1 )  e.  ( 0..^ (
# `  W )
)  <->  ( ( # `  W )  -  1 )  e.  ( 0..^ ( # `  W
) ) ) )
4934, 48mpbird 240 . . . . 5  |-  ( ( ( # `  W
)  e.  NN0  /\  1  <  ( # `  W
) )  ->  (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) ) )
502, 49sylan 478 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  (
( ( # `  W
)  -  2 )  +  1 )  e.  ( 0..^ ( # `  W ) ) )
511, 19, 503jca 1194 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W  e. Word  V  /\  (
( # `  W )  -  2 )  e. 
NN0  /\  ( (
( # `  W )  -  2 )  +  1 )  e.  ( 0..^ ( # `  W
) ) ) )
52 swrds2 13065 . . 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 17 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W substr  <. ( ( # `  W )  -  2 ) ,  ( ( ( # `  W
)  -  2 )  +  2 ) >.
)  =  <" ( W `  ( ( # `
 W )  - 
2 ) ) ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) "> )
5435, 36jctir 545 . . . . . 6  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  e.  CC  /\  2  e.  CC ) )
55 npcan 9909 . . . . . . 7  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC )  ->  ( ( ( # `  W )  -  2 )  +  2 )  =  ( # `  W
) )
5655eqcomd 2467 . . . . . 6  |-  ( ( ( # `  W
)  e.  CC  /\  2  e.  CC )  ->  ( # `  W
)  =  ( ( ( # `  W
)  -  2 )  +  2 ) )
572, 54, 563syl 18 . . . . 5  |-  ( W  e. Word  V  ->  ( # `
 W )  =  ( ( ( # `  W )  -  2 )  +  2 ) )
5857adantr 471 . . . 4  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( # `
 W )  =  ( ( ( # `  W )  -  2 )  +  2 ) )
5958opeq2d 4186 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  <. (
( # `  W )  -  2 ) ,  ( # `  W
) >.  =  <. (
( # `  W )  -  2 ) ,  ( ( ( # `  W )  -  2 )  +  2 )
>. )
6059oveq2d 6330 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W substr  <. ( ( # `  W )  -  2 ) ,  ( # `  W ) >. )  =  ( W substr  <. (
( # `  W )  -  2 ) ,  ( ( ( # `  W )  -  2 )  +  2 )
>. ) )
61 eqidd 2462 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( W `  ( ( # `
 W )  - 
2 ) )  =  ( W `  (
( # `  W )  -  2 ) ) )
62 lsw 12746 . . . . 5  |-  ( W  e. Word  V  ->  ( lastS  `  W )  =  ( W `  ( (
# `  W )  -  1 ) ) )
6339, 43syl 17 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  -  ( 2  -  1 ) )  =  ( ( ( # `  W
)  -  2 )  +  1 ) )
6463eqcomd 2467 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  ( 2  -  1 ) ) )
65 2m1e1 10751 . . . . . . . . . . 11  |-  ( 2  -  1 )  =  1
6665a1i 11 . . . . . . . . . 10  |-  ( (
# `  W )  e.  NN0  ->  ( 2  -  1 )  =  1 )
6766oveq2d 6330 . . . . . . . . 9  |-  ( (
# `  W )  e.  NN0  ->  ( ( # `
 W )  -  ( 2  -  1 ) )  =  ( ( # `  W
)  -  1 ) )
6864, 67eqtrd 2495 . . . . . . . 8  |-  ( (
# `  W )  e.  NN0  ->  ( (
( # `  W )  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
692, 68syl 17 . . . . . . 7  |-  ( W  e. Word  V  ->  (
( ( # `  W
)  -  2 )  +  1 )  =  ( ( # `  W
)  -  1 ) )
7069eqcomd 2467 . . . . . 6  |-  ( W  e. Word  V  ->  (
( # `  W )  -  1 )  =  ( ( ( # `  W )  -  2 )  +  1 ) )
7170fveq2d 5891 . . . . 5  |-  ( W  e. Word  V  ->  ( W `  ( ( # `
 W )  - 
1 ) )  =  ( W `  (
( ( # `  W
)  -  2 )  +  1 ) ) )
7262, 71eqtrd 2495 . . . 4  |-  ( W  e. Word  V  ->  ( lastS  `  W )  =  ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) )
7372adantr 471 . . 3  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  ( lastS  `  W )  =  ( W `  ( ( ( # `  W
)  -  2 )  +  1 ) ) )
7461, 73s2eqd 12994 . 2  |-  ( ( W  e. Word  V  /\  1  <  ( # `  W
) )  ->  <" ( W `  ( ( # `
 W )  - 
2 ) ) ( lastS  `  W ) ">  =  <" ( W `
 ( ( # `  W )  -  2 ) ) ( W `
 ( ( (
# `  W )  -  2 )  +  1 ) ) "> )
7553, 60, 743eqtr4d 2505 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 189    /\ wa 375    /\ w3a 991    = wceq 1454    e. wcel 1897   <.cop 3985   class class class wbr 4415   ` cfv 5600  (class class class)co 6314   CCcc 9562   RRcr 9563   0cc0 9564   1c1 9565    + caddc 9567    < clt 9700    <_ cle 9701    - cmin 9885   NNcn 10636   2c2 10686   NN0cn0 10897   ZZcz 10965  ..^cfzo 11945   #chash 12546  Word cword 12688   lastS clsw 12689   substr csubstr 12692   <"cs2 12973
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1679  ax-4 1692  ax-5 1768  ax-6 1815  ax-7 1861  ax-8 1899  ax-9 1906  ax-10 1925  ax-11 1930  ax-12 1943  ax-13 2101  ax-ext 2441  ax-rep 4528  ax-sep 4538  ax-nul 4547  ax-pow 4594  ax-pr 4652  ax-un 6609  ax-cnex 9620  ax-resscn 9621  ax-1cn 9622  ax-icn 9623  ax-addcl 9624  ax-addrcl 9625  ax-mulcl 9626  ax-mulrcl 9627  ax-mulcom 9628  ax-addass 9629  ax-mulass 9630  ax-distr 9631  ax-i2m1 9632  ax-1ne0 9633  ax-1rid 9634  ax-rnegex 9635  ax-rrecex 9636  ax-cnre 9637  ax-pre-lttri 9638  ax-pre-lttrn 9639  ax-pre-ltadd 9640  ax-pre-mulgt0 9641
This theorem depends on definitions:  df-bi 190  df-or 376  df-an 377  df-3or 992  df-3an 993  df-tru 1457  df-ex 1674  df-nf 1678  df-sb 1808  df-eu 2313  df-mo 2314  df-clab 2448  df-cleq 2454  df-clel 2457  df-nfc 2591  df-ne 2634  df-nel 2635  df-ral 2753  df-rex 2754  df-reu 2755  df-rmo 2756  df-rab 2757  df-v 3058  df-sbc 3279  df-csb 3375  df-dif 3418  df-un 3420  df-in 3422  df-ss 3429  df-pss 3431  df-nul 3743  df-if 3893  df-pw 3964  df-sn 3980  df-pr 3982  df-tp 3984  df-op 3986  df-uni 4212  df-int 4248  df-iun 4293  df-br 4416  df-opab 4475  df-mpt 4476  df-tr 4511  df-eprel 4763  df-id 4767  df-po 4773  df-so 4774  df-fr 4811  df-we 4813  df-xp 4858  df-rel 4859  df-cnv 4860  df-co 4861  df-dm 4862  df-rn 4863  df-res 4864  df-ima 4865  df-pred 5398  df-ord 5444  df-on 5445  df-lim 5446  df-suc 5447  df-iota 5564  df-fun 5602  df-fn 5603  df-f 5604  df-f1 5605  df-fo 5606  df-f1o 5607  df-fv 5608  df-riota 6276  df-ov 6317  df-oprab 6318  df-mpt2 6319  df-om 6719  df-1st 6819  df-2nd 6820  df-wrecs 7053  df-recs 7115  df-rdg 7153  df-1o 7207  df-oadd 7211  df-er 7388  df-en 7595  df-dom 7596  df-sdom 7597  df-fin 7598  df-card 8398  df-cda 8623  df-pnf 9702  df-mnf 9703  df-xr 9704  df-ltxr 9705  df-le 9706  df-sub 9887  df-neg 9888  df-nn 10637  df-2 10695  df-n0 10898  df-z 10966  df-uz 11188  df-fz 11813  df-fzo 11946  df-hash 12547  df-word 12696  df-lsw 12697  df-concat 12698  df-s1 12699  df-substr 12700  df-s2 12980
This theorem is referenced by:  2swrd2eqwrdeq  13076
  Copyright terms: Public domain W3C validator