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 WWordVN1WWcyclShiftNW1=WN1

Proof

Step Hyp Ref Expression
1 simpl WWordVN1WWWordV
2 elfzelz N1WN
3 2 adantl WWordVN1WN
4 elfz1b N1WNWNW
5 simp2 NWNWW
6 4 5 sylbi N1WW
7 6 adantl WWordVN1WW
8 fzo0end WW10..^W
9 7 8 syl WWordVN1WW10..^W
10 cshwidxmod WWordVNW10..^WWcyclShiftNW1=WW-1+NmodW
11 1 3 9 10 syl3anc WWordVN1WWcyclShiftNW1=WW-1+NmodW
12 nncn WW
13 12 adantl NWW
14 1cnd NW1
15 nncn NN
16 15 adantr NWN
17 13 14 16 3jca NWW1N
18 17 3adant3 NWNWW1N
19 4 18 sylbi N1WW1N
20 subadd23 W1NW-1+N=W+N-1
21 19 20 syl N1WW-1+N=W+N-1
22 21 oveq1d N1WW-1+NmodW=W+N-1modW
23 nnm1nn0 NN10
24 23 3ad2ant1 NWNWN10
25 simp3 NWNWNW
26 nnz NN
27 nnz WW
28 26 27 anim12i NWNW
29 28 3adant3 NWNWNW
30 zlem1lt NWNWN1<W
31 29 30 syl NWNWNWN1<W
32 25 31 mpbid NWNWN1<W
33 24 5 32 3jca NWNWN10WN1<W
34 4 33 sylbi N1WN10WN1<W
35 addmodid N10WN1<WW+N-1modW=N1
36 34 35 syl N1WW+N-1modW=N1
37 22 36 eqtrd N1WW-1+NmodW=N1
38 37 fveq2d N1WWW-1+NmodW=WN1
39 38 adantl WWordVN1WWW-1+NmodW=WN1
40 11 39 eqtrd WWordVN1WWcyclShiftNW1=WN1