Metamath Proof Explorer


Theorem cshwidxn

Description: The symbol at index (n-1) of a word of length n (not 0) cyclically shifted by N positions (not 0) is the symbol at index (N-1) of the original word. (Contributed by AV, 18-May-2018) (Revised by AV, 21-May-2018) (Revised by AV, 30-Oct-2018)

Ref Expression
Assertion cshwidxn W Word V N 1 W W cyclShift N W 1 = W N 1

Proof

Step Hyp Ref Expression
1 simpl W Word V N 1 W W Word V
2 elfzelz N 1 W N
3 2 adantl W Word V N 1 W N
4 elfz1b N 1 W N W N W
5 simp2 N W N W W
6 4 5 sylbi N 1 W W
7 6 adantl W Word V N 1 W W
8 fzo0end W W 1 0 ..^ W
9 7 8 syl W Word V N 1 W W 1 0 ..^ W
10 cshwidxmod W Word V N W 1 0 ..^ W W cyclShift N W 1 = W W - 1 + N mod W
11 1 3 9 10 syl3anc W Word V N 1 W W cyclShift N W 1 = W W - 1 + N mod W
12 nncn W W
13 12 adantl N W W
14 1cnd N W 1
15 nncn N N
16 15 adantr N W N
17 13 14 16 3jca N W W 1 N
18 17 3adant3 N W N W W 1 N
19 4 18 sylbi N 1 W W 1 N
20 subadd23 W 1 N W - 1 + N = W + N - 1
21 19 20 syl N 1 W W - 1 + N = W + N - 1
22 21 oveq1d N 1 W W - 1 + N mod W = W + N - 1 mod W
23 nnm1nn0 N N 1 0
24 23 3ad2ant1 N W N W N 1 0
25 simp3 N W N W N W
26 nnz N N
27 nnz W W
28 26 27 anim12i N W N W
29 28 3adant3 N W N W N W
30 zlem1lt N W N W N 1 < W
31 29 30 syl N W N W N W N 1 < W
32 25 31 mpbid N W N W N 1 < W
33 24 5 32 3jca N W N W N 1 0 W N 1 < W
34 4 33 sylbi N 1 W N 1 0 W N 1 < W
35 addmodid N 1 0 W N 1 < W W + N - 1 mod W = N 1
36 34 35 syl N 1 W W + N - 1 mod W = N 1
37 22 36 eqtrd N 1 W W - 1 + N mod W = N 1
38 37 fveq2d N 1 W W W - 1 + N mod W = W N 1
39 38 adantl W Word V N 1 W W W - 1 + N mod W = W N 1
40 11 39 eqtrd W Word V N 1 W W cyclShift N W 1 = W N 1