Metamath Proof Explorer


Theorem swrds2

Description: Extract two adjacent symbols from a word. (Contributed by Stefan O'Rear, 23-Aug-2015) (Revised by Mario Carneiro, 26-Feb-2016)

Ref Expression
Assertion swrds2
|- ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( W substr <. I , ( I + 2 ) >. ) = <" ( W ` I ) ( W ` ( I + 1 ) ) "> )

Proof

Step Hyp Ref Expression
1 df-s2
 |-  <" ( W ` I ) ( W ` ( I + 1 ) ) "> = ( <" ( W ` I ) "> ++ <" ( W ` ( I + 1 ) ) "> )
2 simp1
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> W e. Word A )
3 simp2
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> I e. NN0 )
4 elfzo0
 |-  ( ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) <-> ( ( I + 1 ) e. NN0 /\ ( # ` W ) e. NN /\ ( I + 1 ) < ( # ` W ) ) )
5 4 simp2bi
 |-  ( ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) -> ( # ` W ) e. NN )
6 5 3ad2ant3
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( # ` W ) e. NN )
7 3 nn0red
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> I e. RR )
8 peano2nn0
 |-  ( I e. NN0 -> ( I + 1 ) e. NN0 )
9 3 8 syl
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 1 ) e. NN0 )
10 9 nn0red
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 1 ) e. RR )
11 6 nnred
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( # ` W ) e. RR )
12 7 lep1d
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> I <_ ( I + 1 ) )
13 elfzolt2
 |-  ( ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) -> ( I + 1 ) < ( # ` W ) )
14 13 3ad2ant3
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 1 ) < ( # ` W ) )
15 7 10 11 12 14 lelttrd
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> I < ( # ` W ) )
16 elfzo0
 |-  ( I e. ( 0 ..^ ( # ` W ) ) <-> ( I e. NN0 /\ ( # ` W ) e. NN /\ I < ( # ` W ) ) )
17 3 6 15 16 syl3anbrc
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> I e. ( 0 ..^ ( # ` W ) ) )
18 swrds1
 |-  ( ( W e. Word A /\ I e. ( 0 ..^ ( # ` W ) ) ) -> ( W substr <. I , ( I + 1 ) >. ) = <" ( W ` I ) "> )
19 2 17 18 syl2anc
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( W substr <. I , ( I + 1 ) >. ) = <" ( W ` I ) "> )
20 nn0cn
 |-  ( I e. NN0 -> I e. CC )
21 20 3ad2ant2
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> I e. CC )
22 df-2
 |-  2 = ( 1 + 1 )
23 22 oveq2i
 |-  ( I + 2 ) = ( I + ( 1 + 1 ) )
24 ax-1cn
 |-  1 e. CC
25 addass
 |-  ( ( I e. CC /\ 1 e. CC /\ 1 e. CC ) -> ( ( I + 1 ) + 1 ) = ( I + ( 1 + 1 ) ) )
26 24 24 25 mp3an23
 |-  ( I e. CC -> ( ( I + 1 ) + 1 ) = ( I + ( 1 + 1 ) ) )
27 23 26 eqtr4id
 |-  ( I e. CC -> ( I + 2 ) = ( ( I + 1 ) + 1 ) )
28 21 27 syl
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 2 ) = ( ( I + 1 ) + 1 ) )
29 28 opeq2d
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> <. ( I + 1 ) , ( I + 2 ) >. = <. ( I + 1 ) , ( ( I + 1 ) + 1 ) >. )
30 29 oveq2d
 |-  ( ( 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 ) >. ) )
31 swrds1
 |-  ( ( W e. Word A /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( W substr <. ( I + 1 ) , ( ( I + 1 ) + 1 ) >. ) = <" ( W ` ( I + 1 ) ) "> )
32 31 3adant2
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( W substr <. ( I + 1 ) , ( ( I + 1 ) + 1 ) >. ) = <" ( W ` ( I + 1 ) ) "> )
33 30 32 eqtrd
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( W substr <. ( I + 1 ) , ( I + 2 ) >. ) = <" ( W ` ( I + 1 ) ) "> )
34 19 33 oveq12d
 |-  ( ( 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 ) ) "> ) )
35 1 34 eqtr4id
 |-  ( ( 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
 |-  ( I e. ( 0 ... ( I + 1 ) ) <-> ( I e. NN0 /\ ( I + 1 ) e. NN0 /\ I <_ ( I + 1 ) ) )
37 3 9 12 36 syl3anbrc
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> I e. ( 0 ... ( I + 1 ) ) )
38 peano2nn0
 |-  ( ( I + 1 ) e. NN0 -> ( ( I + 1 ) + 1 ) e. NN0 )
39 9 38 syl
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( ( I + 1 ) + 1 ) e. NN0 )
40 28 39 eqeltrd
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 2 ) e. NN0 )
41 10 lep1d
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 1 ) <_ ( ( I + 1 ) + 1 ) )
42 41 28 breqtrrd
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 1 ) <_ ( I + 2 ) )
43 elfz2nn0
 |-  ( ( I + 1 ) e. ( 0 ... ( I + 2 ) ) <-> ( ( I + 1 ) e. NN0 /\ ( I + 2 ) e. NN0 /\ ( I + 1 ) <_ ( I + 2 ) ) )
44 9 40 42 43 syl3anbrc
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 1 ) e. ( 0 ... ( I + 2 ) ) )
45 fzofzp1
 |-  ( ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) -> ( ( I + 1 ) + 1 ) e. ( 0 ... ( # ` W ) ) )
46 45 3ad2ant3
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( ( I + 1 ) + 1 ) e. ( 0 ... ( # ` W ) ) )
47 28 46 eqeltrd
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( I + 2 ) e. ( 0 ... ( # ` W ) ) )
48 ccatswrd
 |-  ( ( 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 ) >. ) )
49 2 37 44 47 48 syl13anc
 |-  ( ( 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 ) >. ) )
50 35 49 eqtr2d
 |-  ( ( W e. Word A /\ I e. NN0 /\ ( I + 1 ) e. ( 0 ..^ ( # ` W ) ) ) -> ( W substr <. I , ( I + 2 ) >. ) = <" ( W ` I ) ( W ` ( I + 1 ) ) "> )