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

Theorem swrds2 12895
Description: Extract two adjacent symbols from a word. (Contributed by Stefan O'Rear, 23-Aug-2015.) (Revised by Mario Carneiro, 26-Feb-2016.)
Assertion
Ref Expression
swrds2  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( W substr  <. I ,  ( I  +  2 )
>. )  =  <" ( W `  I
) ( W `  ( I  +  1
) ) "> )

Proof of Theorem swrds2
StepHypRef Expression
1 simp1 996 . . . . 5  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  W  e. Word  A )
2 simp2 997 . . . . . 6  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  I  e.  NN0 )
3 elfzo0 11862 . . . . . . . 8  |-  ( ( I  +  1 )  e.  ( 0..^ (
# `  W )
)  <->  ( ( I  +  1 )  e. 
NN0  /\  ( # `  W
)  e.  NN  /\  ( I  +  1
)  <  ( # `  W
) ) )
43simp2bi 1012 . . . . . . 7  |-  ( ( I  +  1 )  e.  ( 0..^ (
# `  W )
)  ->  ( # `  W
)  e.  NN )
543ad2ant3 1019 . . . . . 6  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( # `
 W )  e.  NN )
62nn0red 10874 . . . . . . 7  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  I  e.  RR )
7 peano2nn0 10857 . . . . . . . . 9  |-  ( I  e.  NN0  ->  ( I  +  1 )  e. 
NN0 )
82, 7syl 16 . . . . . . . 8  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  1 )  e.  NN0 )
98nn0red 10874 . . . . . . 7  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  1 )  e.  RR )
105nnred 10571 . . . . . . 7  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( # `
 W )  e.  RR )
116lep1d 10497 . . . . . . 7  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  I  <_  ( I  +  1 ) )
12 elfzolt2 11835 . . . . . . . 8  |-  ( ( I  +  1 )  e.  ( 0..^ (
# `  W )
)  ->  ( I  +  1 )  < 
( # `  W ) )
13123ad2ant3 1019 . . . . . . 7  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  1 )  <  ( # `  W
) )
146, 9, 10, 11, 13lelttrd 9757 . . . . . 6  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  I  <  ( # `  W
) )
15 elfzo0 11862 . . . . . 6  |-  ( I  e.  ( 0..^ (
# `  W )
)  <->  ( I  e. 
NN0  /\  ( # `  W
)  e.  NN  /\  I  <  ( # `  W
) ) )
162, 5, 14, 15syl3anbrc 1180 . . . . 5  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  I  e.  ( 0..^ ( # `  W ) ) )
17 swrds1 12688 . . . . 5  |-  ( ( W  e. Word  A  /\  I  e.  ( 0..^ ( # `  W
) ) )  -> 
( W substr  <. I ,  ( I  +  1 ) >. )  =  <" ( W `  I
) "> )
181, 16, 17syl2anc 661 . . . 4  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( W substr  <. I ,  ( I  +  1 )
>. )  =  <" ( W `  I
) "> )
19 nn0cn 10826 . . . . . . . . 9  |-  ( I  e.  NN0  ->  I  e.  CC )
20193ad2ant2 1018 . . . . . . . 8  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  I  e.  CC )
21 ax-1cn 9567 . . . . . . . . . 10  |-  1  e.  CC
22 addass 9596 . . . . . . . . . 10  |-  ( ( I  e.  CC  /\  1  e.  CC  /\  1  e.  CC )  ->  (
( I  +  1 )  +  1 )  =  ( I  +  ( 1  +  1 ) ) )
2321, 21, 22mp3an23 1316 . . . . . . . . 9  |-  ( I  e.  CC  ->  (
( I  +  1 )  +  1 )  =  ( I  +  ( 1  +  1 ) ) )
24 df-2 10615 . . . . . . . . . 10  |-  2  =  ( 1  +  1 )
2524oveq2i 6307 . . . . . . . . 9  |-  ( I  +  2 )  =  ( I  +  ( 1  +  1 ) )
2623, 25syl6reqr 2517 . . . . . . . 8  |-  ( I  e.  CC  ->  (
I  +  2 )  =  ( ( I  +  1 )  +  1 ) )
2720, 26syl 16 . . . . . . 7  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  2 )  =  ( ( I  +  1 )  +  1 ) )
2827opeq2d 4226 . . . . . 6  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  <. (
I  +  1 ) ,  ( I  + 
2 ) >.  =  <. ( I  +  1 ) ,  ( ( I  +  1 )  +  1 ) >. )
2928oveq2d 6312 . . . . 5  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( W substr  <. ( I  + 
1 ) ,  ( I  +  2 )
>. )  =  ( W substr  <. ( I  + 
1 ) ,  ( ( I  +  1 )  +  1 )
>. ) )
30 swrds1 12688 . . . . . 6  |-  ( ( W  e. Word  A  /\  ( I  +  1
)  e.  ( 0..^ ( # `  W
) ) )  -> 
( W substr  <. ( I  +  1 ) ,  ( ( I  + 
1 )  +  1 ) >. )  =  <" ( W `  (
I  +  1 ) ) "> )
31303adant2 1015 . . . . 5  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( W substr  <. ( I  + 
1 ) ,  ( ( I  +  1 )  +  1 )
>. )  =  <" ( W `  (
I  +  1 ) ) "> )
3229, 31eqtrd 2498 . . . 4  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( W substr  <. ( I  + 
1 ) ,  ( I  +  2 )
>. )  =  <" ( W `  (
I  +  1 ) ) "> )
3318, 32oveq12d 6314 . . 3  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
( W substr  <. I ,  ( I  +  1 ) >. ) ++  ( W substr  <. ( I  +  1 ) ,  ( I  +  2 ) >.
) )  =  (
<" ( W `  I ) "> ++  <" ( W `  ( I  +  1
) ) "> ) )
34 df-s2 12825 . . 3  |-  <" ( W `  I )
( W `  (
I  +  1 ) ) ">  =  ( <" ( W `
 I ) "> ++  <" ( W `
 ( I  + 
1 ) ) "> )
3533, 34syl6reqr 2517 . 2  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  <" ( W `  I )
( W `  (
I  +  1 ) ) ">  =  ( ( W substr  <. I ,  ( I  +  1 ) >. ) ++  ( W substr  <. ( I  +  1 ) ,  ( I  +  2 ) >.
) ) )
36 elfz2nn0 11795 . . . 4  |-  ( I  e.  ( 0 ... ( I  +  1 ) )  <->  ( I  e.  NN0  /\  ( I  +  1 )  e. 
NN0  /\  I  <_  ( I  +  1 ) ) )
372, 8, 11, 36syl3anbrc 1180 . . 3  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  I  e.  ( 0 ... (
I  +  1 ) ) )
38 peano2nn0 10857 . . . . . 6  |-  ( ( I  +  1 )  e.  NN0  ->  ( ( I  +  1 )  +  1 )  e. 
NN0 )
398, 38syl 16 . . . . 5  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
( I  +  1 )  +  1 )  e.  NN0 )
4027, 39eqeltrd 2545 . . . 4  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  2 )  e.  NN0 )
419lep1d 10497 . . . . 5  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  1 )  <_  ( ( I  +  1 )  +  1 ) )
4241, 27breqtrrd 4482 . . . 4  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  1 )  <_  ( I  + 
2 ) )
43 elfz2nn0 11795 . . . 4  |-  ( ( I  +  1 )  e.  ( 0 ... ( I  +  2 ) )  <->  ( (
I  +  1 )  e.  NN0  /\  (
I  +  2 )  e.  NN0  /\  (
I  +  1 )  <_  ( I  + 
2 ) ) )
448, 40, 42, 43syl3anbrc 1180 . . 3  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  1 )  e.  ( 0 ... ( I  +  2 ) ) )
45 fzofzp1 11912 . . . . 5  |-  ( ( I  +  1 )  e.  ( 0..^ (
# `  W )
)  ->  ( (
I  +  1 )  +  1 )  e.  ( 0 ... ( # `
 W ) ) )
46453ad2ant3 1019 . . . 4  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
( I  +  1 )  +  1 )  e.  ( 0 ... ( # `  W
) ) )
4727, 46eqeltrd 2545 . . 3  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
I  +  2 )  e.  ( 0 ... ( # `  W
) ) )
48 ccatswrd 12693 . . 3  |-  ( ( W  e. Word  A  /\  ( I  e.  (
0 ... ( I  + 
1 ) )  /\  ( I  +  1
)  e.  ( 0 ... ( I  + 
2 ) )  /\  ( I  +  2
)  e.  ( 0 ... ( # `  W
) ) ) )  ->  ( ( W substr  <. I ,  ( I  +  1 ) >.
) ++  ( W substr  <. (
I  +  1 ) ,  ( I  + 
2 ) >. )
)  =  ( W substr  <. I ,  ( I  +  2 ) >.
) )
491, 37, 44, 47, 48syl13anc 1230 . 2  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  (
( W substr  <. I ,  ( I  +  1 ) >. ) ++  ( W substr  <. ( I  +  1 ) ,  ( I  +  2 ) >.
) )  =  ( W substr  <. I ,  ( I  +  2 )
>. ) )
5035, 49eqtr2d 2499 1  |-  ( ( W  e. Word  A  /\  I  e.  NN0  /\  (
I  +  1 )  e.  ( 0..^ (
# `  W )
) )  ->  ( W substr  <. I ,  ( I  +  2 )
>. )  =  <" ( W `  I
) ( W `  ( I  +  1
) ) "> )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ w3a 973    = wceq 1395    e. wcel 1819   <.cop 4038   class class class wbr 4456   ` cfv 5594  (class class class)co 6296   CCcc 9507   0cc0 9509   1c1 9510    + caddc 9512    < clt 9645    <_ cle 9646   NNcn 10556   2c2 10606   NN0cn0 10816   ...cfz 11697  ..^cfzo 11821   #chash 12408  Word cword 12538   ++ cconcat 12540   <"cs1 12541   substr csubstr 12542   <"cs2 12818
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1619  ax-4 1632  ax-5 1705  ax-6 1748  ax-7 1791  ax-8 1821  ax-9 1823  ax-10 1838  ax-11 1843  ax-12 1855  ax-13 2000  ax-ext 2435  ax-rep 4568  ax-sep 4578  ax-nul 4586  ax-pow 4634  ax-pr 4695  ax-un 6591  ax-cnex 9565  ax-resscn 9566  ax-1cn 9567  ax-icn 9568  ax-addcl 9569  ax-addrcl 9570  ax-mulcl 9571  ax-mulrcl 9572  ax-mulcom 9573  ax-addass 9574  ax-mulass 9575  ax-distr 9576  ax-i2m1 9577  ax-1ne0 9578  ax-1rid 9579  ax-rnegex 9580  ax-rrecex 9581  ax-cnre 9582  ax-pre-lttri 9583  ax-pre-lttrn 9584  ax-pre-ltadd 9585  ax-pre-mulgt0 9586
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 974  df-3an 975  df-tru 1398  df-ex 1614  df-nf 1618  df-sb 1741  df-eu 2287  df-mo 2288  df-clab 2443  df-cleq 2449  df-clel 2452  df-nfc 2607  df-ne 2654  df-nel 2655  df-ral 2812  df-rex 2813  df-reu 2814  df-rmo 2815  df-rab 2816  df-v 3111  df-sbc 3328  df-csb 3431  df-dif 3474  df-un 3476  df-in 3478  df-ss 3485  df-pss 3487  df-nul 3794  df-if 3945  df-pw 4017  df-sn 4033  df-pr 4035  df-tp 4037  df-op 4039  df-uni 4252  df-int 4289  df-iun 4334  df-br 4457  df-opab 4516  df-mpt 4517  df-tr 4551  df-eprel 4800  df-id 4804  df-po 4809  df-so 4810  df-fr 4847  df-we 4849  df-ord 4890  df-on 4891  df-lim 4892  df-suc 4893  df-xp 5014  df-rel 5015  df-cnv 5016  df-co 5017  df-dm 5018  df-rn 5019  df-res 5020  df-ima 5021  df-iota 5557  df-fun 5596  df-fn 5597  df-f 5598  df-f1 5599  df-fo 5600  df-f1o 5601  df-fv 5602  df-riota 6258  df-ov 6299  df-oprab 6300  df-mpt2 6301  df-om 6700  df-1st 6799  df-2nd 6800  df-recs 7060  df-rdg 7094  df-1o 7148  df-oadd 7152  df-er 7329  df-en 7536  df-dom 7537  df-sdom 7538  df-fin 7539  df-card 8337  df-cda 8565  df-pnf 9647  df-mnf 9648  df-xr 9649  df-ltxr 9650  df-le 9651  df-sub 9826  df-neg 9827  df-nn 10557  df-2 10615  df-n0 10817  df-z 10886  df-uz 11107  df-fz 11698  df-fzo 11822  df-hash 12409  df-word 12546  df-concat 12548  df-s1 12549  df-substr 12550  df-s2 12825
This theorem is referenced by:  swrd2lsw  12902  psgnunilem2  16647
  Copyright terms: Public domain W3C validator