Metamath Proof Explorer


Theorem scshwfzeqfzo

Description: For a nonempty word the sets of shifted words, expressd by a finite interval of integers or by a half-open integer range are identical. (Contributed by Alexander van der Vekens, 15-Jun-2018)

Ref Expression
Assertion scshwfzeqfzo
|- ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> { y e. Word V | E. n e. ( 0 ... N ) y = ( X cyclShift n ) } = { y e. Word V | E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) } )

Proof

Step Hyp Ref Expression
1 lencl
 |-  ( X e. Word V -> ( # ` X ) e. NN0 )
2 elnn0uz
 |-  ( ( # ` X ) e. NN0 <-> ( # ` X ) e. ( ZZ>= ` 0 ) )
3 1 2 sylib
 |-  ( X e. Word V -> ( # ` X ) e. ( ZZ>= ` 0 ) )
4 3 adantr
 |-  ( ( X e. Word V /\ N = ( # ` X ) ) -> ( # ` X ) e. ( ZZ>= ` 0 ) )
5 eleq1
 |-  ( N = ( # ` X ) -> ( N e. ( ZZ>= ` 0 ) <-> ( # ` X ) e. ( ZZ>= ` 0 ) ) )
6 5 adantl
 |-  ( ( X e. Word V /\ N = ( # ` X ) ) -> ( N e. ( ZZ>= ` 0 ) <-> ( # ` X ) e. ( ZZ>= ` 0 ) ) )
7 4 6 mpbird
 |-  ( ( X e. Word V /\ N = ( # ` X ) ) -> N e. ( ZZ>= ` 0 ) )
8 7 3adant2
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> N e. ( ZZ>= ` 0 ) )
9 8 adantr
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> N e. ( ZZ>= ` 0 ) )
10 fzisfzounsn
 |-  ( N e. ( ZZ>= ` 0 ) -> ( 0 ... N ) = ( ( 0 ..^ N ) u. { N } ) )
11 9 10 syl
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( 0 ... N ) = ( ( 0 ..^ N ) u. { N } ) )
12 11 rexeqdv
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( E. n e. ( 0 ... N ) y = ( X cyclShift n ) <-> E. n e. ( ( 0 ..^ N ) u. { N } ) y = ( X cyclShift n ) ) )
13 rexun
 |-  ( E. n e. ( ( 0 ..^ N ) u. { N } ) y = ( X cyclShift n ) <-> ( E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) \/ E. n e. { N } y = ( X cyclShift n ) ) )
14 12 13 bitrdi
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( E. n e. ( 0 ... N ) y = ( X cyclShift n ) <-> ( E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) \/ E. n e. { N } y = ( X cyclShift n ) ) ) )
15 fvex
 |-  ( # ` X ) e. _V
16 eleq1
 |-  ( N = ( # ` X ) -> ( N e. _V <-> ( # ` X ) e. _V ) )
17 15 16 mpbiri
 |-  ( N = ( # ` X ) -> N e. _V )
18 oveq2
 |-  ( n = N -> ( X cyclShift n ) = ( X cyclShift N ) )
19 18 eqeq2d
 |-  ( n = N -> ( y = ( X cyclShift n ) <-> y = ( X cyclShift N ) ) )
20 19 rexsng
 |-  ( N e. _V -> ( E. n e. { N } y = ( X cyclShift n ) <-> y = ( X cyclShift N ) ) )
21 17 20 syl
 |-  ( N = ( # ` X ) -> ( E. n e. { N } y = ( X cyclShift n ) <-> y = ( X cyclShift N ) ) )
22 21 3ad2ant3
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( E. n e. { N } y = ( X cyclShift n ) <-> y = ( X cyclShift N ) ) )
23 22 adantr
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( E. n e. { N } y = ( X cyclShift n ) <-> y = ( X cyclShift N ) ) )
24 oveq2
 |-  ( N = ( # ` X ) -> ( X cyclShift N ) = ( X cyclShift ( # ` X ) ) )
25 24 3ad2ant3
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( X cyclShift N ) = ( X cyclShift ( # ` X ) ) )
26 cshwn
 |-  ( X e. Word V -> ( X cyclShift ( # ` X ) ) = X )
27 26 3ad2ant1
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( X cyclShift ( # ` X ) ) = X )
28 25 27 eqtrd
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( X cyclShift N ) = X )
29 28 eqeq2d
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( y = ( X cyclShift N ) <-> y = X ) )
30 29 adantr
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( y = ( X cyclShift N ) <-> y = X ) )
31 cshw0
 |-  ( X e. Word V -> ( X cyclShift 0 ) = X )
32 31 3ad2ant1
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( X cyclShift 0 ) = X )
33 lennncl
 |-  ( ( X e. Word V /\ X =/= (/) ) -> ( # ` X ) e. NN )
34 33 3adant3
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( # ` X ) e. NN )
35 eleq1
 |-  ( N = ( # ` X ) -> ( N e. NN <-> ( # ` X ) e. NN ) )
36 35 3ad2ant3
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( N e. NN <-> ( # ` X ) e. NN ) )
37 34 36 mpbird
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> N e. NN )
38 lbfzo0
 |-  ( 0 e. ( 0 ..^ N ) <-> N e. NN )
39 37 38 sylibr
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> 0 e. ( 0 ..^ N ) )
40 oveq2
 |-  ( 0 = n -> ( X cyclShift 0 ) = ( X cyclShift n ) )
41 40 eqeq1d
 |-  ( 0 = n -> ( ( X cyclShift 0 ) = X <-> ( X cyclShift n ) = X ) )
42 41 eqcoms
 |-  ( n = 0 -> ( ( X cyclShift 0 ) = X <-> ( X cyclShift n ) = X ) )
43 eqcom
 |-  ( ( X cyclShift n ) = X <-> X = ( X cyclShift n ) )
44 42 43 bitrdi
 |-  ( n = 0 -> ( ( X cyclShift 0 ) = X <-> X = ( X cyclShift n ) ) )
45 44 adantl
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ n = 0 ) -> ( ( X cyclShift 0 ) = X <-> X = ( X cyclShift n ) ) )
46 45 biimpd
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ n = 0 ) -> ( ( X cyclShift 0 ) = X -> X = ( X cyclShift n ) ) )
47 39 46 rspcimedv
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> ( ( X cyclShift 0 ) = X -> E. n e. ( 0 ..^ N ) X = ( X cyclShift n ) ) )
48 32 47 mpd
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> E. n e. ( 0 ..^ N ) X = ( X cyclShift n ) )
49 48 adantr
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> E. n e. ( 0 ..^ N ) X = ( X cyclShift n ) )
50 49 adantr
 |-  ( ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) /\ y = X ) -> E. n e. ( 0 ..^ N ) X = ( X cyclShift n ) )
51 eqeq1
 |-  ( y = X -> ( y = ( X cyclShift n ) <-> X = ( X cyclShift n ) ) )
52 51 adantl
 |-  ( ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) /\ y = X ) -> ( y = ( X cyclShift n ) <-> X = ( X cyclShift n ) ) )
53 52 rexbidv
 |-  ( ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) /\ y = X ) -> ( E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) <-> E. n e. ( 0 ..^ N ) X = ( X cyclShift n ) ) )
54 50 53 mpbird
 |-  ( ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) /\ y = X ) -> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) )
55 54 ex
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( y = X -> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) ) )
56 30 55 sylbid
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( y = ( X cyclShift N ) -> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) ) )
57 23 56 sylbid
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( E. n e. { N } y = ( X cyclShift n ) -> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) ) )
58 57 com12
 |-  ( E. n e. { N } y = ( X cyclShift n ) -> ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) ) )
59 58 jao1i
 |-  ( ( E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) \/ E. n e. { N } y = ( X cyclShift n ) ) -> ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) ) )
60 59 com12
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( ( E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) \/ E. n e. { N } y = ( X cyclShift n ) ) -> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) ) )
61 14 60 sylbid
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( E. n e. ( 0 ... N ) y = ( X cyclShift n ) -> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) ) )
62 fzossfz
 |-  ( 0 ..^ N ) C_ ( 0 ... N )
63 ssrexv
 |-  ( ( 0 ..^ N ) C_ ( 0 ... N ) -> ( E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) -> E. n e. ( 0 ... N ) y = ( X cyclShift n ) ) )
64 62 63 mp1i
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) -> E. n e. ( 0 ... N ) y = ( X cyclShift n ) ) )
65 61 64 impbid
 |-  ( ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) /\ y e. Word V ) -> ( E. n e. ( 0 ... N ) y = ( X cyclShift n ) <-> E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) ) )
66 65 rabbidva
 |-  ( ( X e. Word V /\ X =/= (/) /\ N = ( # ` X ) ) -> { y e. Word V | E. n e. ( 0 ... N ) y = ( X cyclShift n ) } = { y e. Word V | E. n e. ( 0 ..^ N ) y = ( X cyclShift n ) } )