Metamath Proof Explorer


Theorem swrdrn3

Description: Express the range of a subword. Stronger version of swrdrn2 . (Contributed by Thierry Arnoux, 13-Dec-2023)

Ref Expression
Assertion swrdrn3
|- ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ran ( W substr <. M , N >. ) = ( W " ( M ..^ N ) ) )

Proof

Step Hyp Ref Expression
1 simpr
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ i e. ( 0 ..^ ( N - M ) ) ) -> i e. ( 0 ..^ ( N - M ) ) )
2 simpl3
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ i e. ( 0 ..^ ( N - M ) ) ) -> N e. ( 0 ... ( # ` W ) ) )
3 2 elfzelzd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ i e. ( 0 ..^ ( N - M ) ) ) -> N e. ZZ )
4 simpl2
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ i e. ( 0 ..^ ( N - M ) ) ) -> M e. ( 0 ... N ) )
5 4 elfzelzd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ i e. ( 0 ..^ ( N - M ) ) ) -> M e. ZZ )
6 fzoaddel2
 |-  ( ( i e. ( 0 ..^ ( N - M ) ) /\ N e. ZZ /\ M e. ZZ ) -> ( i + M ) e. ( M ..^ N ) )
7 1 3 5 6 syl3anc
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ i e. ( 0 ..^ ( N - M ) ) ) -> ( i + M ) e. ( M ..^ N ) )
8 simpr
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> j e. ( M ..^ N ) )
9 simpl2
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> M e. ( 0 ... N ) )
10 9 elfzelzd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> M e. ZZ )
11 10 zcnd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> M e. CC )
12 simpl3
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> N e. ( 0 ... ( # ` W ) ) )
13 12 elfzelzd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> N e. ZZ )
14 13 zcnd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> N e. CC )
15 11 14 pncan3d
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> ( M + ( N - M ) ) = N )
16 15 oveq2d
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> ( M ..^ ( M + ( N - M ) ) ) = ( M ..^ N ) )
17 8 16 eleqtrrd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> j e. ( M ..^ ( M + ( N - M ) ) ) )
18 13 10 zsubcld
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> ( N - M ) e. ZZ )
19 fzosubel3
 |-  ( ( j e. ( M ..^ ( M + ( N - M ) ) ) /\ ( N - M ) e. ZZ ) -> ( j - M ) e. ( 0 ..^ ( N - M ) ) )
20 17 18 19 syl2anc
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> ( j - M ) e. ( 0 ..^ ( N - M ) ) )
21 simpr
 |-  ( ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) /\ i = ( j - M ) ) -> i = ( j - M ) )
22 21 oveq1d
 |-  ( ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) /\ i = ( j - M ) ) -> ( i + M ) = ( ( j - M ) + M ) )
23 22 eqeq2d
 |-  ( ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) /\ i = ( j - M ) ) -> ( j = ( i + M ) <-> j = ( ( j - M ) + M ) ) )
24 fzossz
 |-  ( M ..^ N ) C_ ZZ
25 24 8 sselid
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> j e. ZZ )
26 25 zcnd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> j e. CC )
27 26 11 npcand
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> ( ( j - M ) + M ) = j )
28 27 eqcomd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> j = ( ( j - M ) + M ) )
29 20 23 28 rspcedvd
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j e. ( M ..^ N ) ) -> E. i e. ( 0 ..^ ( N - M ) ) j = ( i + M ) )
30 eqcom
 |-  ( y = ( W ` j ) <-> ( W ` j ) = y )
31 simpr
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j = ( i + M ) ) -> j = ( i + M ) )
32 31 fveq2d
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j = ( i + M ) ) -> ( W ` j ) = ( W ` ( i + M ) ) )
33 32 eqeq2d
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j = ( i + M ) ) -> ( y = ( W ` j ) <-> y = ( W ` ( i + M ) ) ) )
34 30 33 bitr3id
 |-  ( ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) /\ j = ( i + M ) ) -> ( ( W ` j ) = y <-> y = ( W ` ( i + M ) ) ) )
35 7 29 34 rexxfrd
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( E. j e. ( M ..^ N ) ( W ` j ) = y <-> E. i e. ( 0 ..^ ( N - M ) ) y = ( W ` ( i + M ) ) ) )
36 eqid
 |-  ( i e. ( 0 ..^ ( N - M ) ) |-> ( W ` ( i + M ) ) ) = ( i e. ( 0 ..^ ( N - M ) ) |-> ( W ` ( i + M ) ) )
37 fvex
 |-  ( W ` ( i + M ) ) e. _V
38 36 37 elrnmpti
 |-  ( y e. ran ( i e. ( 0 ..^ ( N - M ) ) |-> ( W ` ( i + M ) ) ) <-> E. i e. ( 0 ..^ ( N - M ) ) y = ( W ` ( i + M ) ) )
39 35 38 bitr4di
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( E. j e. ( M ..^ N ) ( W ` j ) = y <-> y e. ran ( i e. ( 0 ..^ ( N - M ) ) |-> ( W ` ( i + M ) ) ) ) )
40 wrdf
 |-  ( W e. Word V -> W : ( 0 ..^ ( # ` W ) ) --> V )
41 40 3ad2ant1
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> W : ( 0 ..^ ( # ` W ) ) --> V )
42 41 ffnd
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> W Fn ( 0 ..^ ( # ` W ) ) )
43 elfzuz
 |-  ( M e. ( 0 ... N ) -> M e. ( ZZ>= ` 0 ) )
44 43 3ad2ant2
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> M e. ( ZZ>= ` 0 ) )
45 fzoss1
 |-  ( M e. ( ZZ>= ` 0 ) -> ( M ..^ N ) C_ ( 0 ..^ N ) )
46 44 45 syl
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( M ..^ N ) C_ ( 0 ..^ N ) )
47 elfzuz3
 |-  ( N e. ( 0 ... ( # ` W ) ) -> ( # ` W ) e. ( ZZ>= ` N ) )
48 47 3ad2ant3
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( # ` W ) e. ( ZZ>= ` N ) )
49 fzoss2
 |-  ( ( # ` W ) e. ( ZZ>= ` N ) -> ( 0 ..^ N ) C_ ( 0 ..^ ( # ` W ) ) )
50 48 49 syl
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( 0 ..^ N ) C_ ( 0 ..^ ( # ` W ) ) )
51 46 50 sstrd
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( M ..^ N ) C_ ( 0 ..^ ( # ` W ) ) )
52 42 51 fvelimabd
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( y e. ( W " ( M ..^ N ) ) <-> E. j e. ( M ..^ N ) ( W ` j ) = y ) )
53 swrdval2
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( W substr <. M , N >. ) = ( i e. ( 0 ..^ ( N - M ) ) |-> ( W ` ( i + M ) ) ) )
54 53 rneqd
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ran ( W substr <. M , N >. ) = ran ( i e. ( 0 ..^ ( N - M ) ) |-> ( W ` ( i + M ) ) ) )
55 54 eleq2d
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( y e. ran ( W substr <. M , N >. ) <-> y e. ran ( i e. ( 0 ..^ ( N - M ) ) |-> ( W ` ( i + M ) ) ) ) )
56 39 52 55 3bitr4rd
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ( y e. ran ( W substr <. M , N >. ) <-> y e. ( W " ( M ..^ N ) ) ) )
57 56 eqrdv
 |-  ( ( W e. Word V /\ M e. ( 0 ... N ) /\ N e. ( 0 ... ( # ` W ) ) ) -> ran ( W substr <. M , N >. ) = ( W " ( M ..^ N ) ) )