Metamath Proof Explorer


Theorem cshwsublen

Description: Cyclically shifting a word is invariant regarding subtraction of the word's length. (Contributed by AV, 3-Nov-2018)

Ref Expression
Assertion cshwsublen W Word V N W cyclShift N = W cyclShift N W

Proof

Step Hyp Ref Expression
1 oveq2 W = 0 N W = N 0
2 zcn N N
3 2 subid1d N N 0 = N
4 3 adantl W Word V N N 0 = N
5 1 4 sylan9eq W = 0 W Word V N N W = N
6 5 eqcomd W = 0 W Word V N N = N W
7 6 oveq2d W = 0 W Word V N W cyclShift N = W cyclShift N W
8 7 ex W = 0 W Word V N W cyclShift N = W cyclShift N W
9 zre N N
10 9 adantl W Word V N N
11 lencl W Word V W 0
12 elnnne0 W W 0 W 0
13 nnrp W W +
14 12 13 sylbir W 0 W 0 W +
15 14 ex W 0 W 0 W +
16 11 15 syl W Word V W 0 W +
17 16 adantr W Word V N W 0 W +
18 17 impcom W 0 W Word V N W +
19 modeqmodmin N W + N mod W = N W mod W
20 10 18 19 syl2an2 W 0 W Word V N N mod W = N W mod W
21 20 oveq2d W 0 W Word V N W cyclShift N mod W = W cyclShift N W mod W
22 cshwmodn W Word V N W cyclShift N = W cyclShift N mod W
23 22 adantl W 0 W Word V N W cyclShift N = W cyclShift N mod W
24 simpl W Word V N W Word V
25 11 nn0zd W Word V W
26 zsubcl N W N W
27 25 26 sylan2 N W Word V N W
28 27 ancoms W Word V N N W
29 24 28 jca W Word V N W Word V N W
30 29 adantl W 0 W Word V N W Word V N W
31 cshwmodn W Word V N W W cyclShift N W = W cyclShift N W mod W
32 30 31 syl W 0 W Word V N W cyclShift N W = W cyclShift N W mod W
33 21 23 32 3eqtr4d W 0 W Word V N W cyclShift N = W cyclShift N W
34 33 ex W 0 W Word V N W cyclShift N = W cyclShift N W
35 8 34 pm2.61ine W Word V N W cyclShift N = W cyclShift N W