Metamath Proof Explorer


Theorem cshwrnid

Description: Cyclically shifting a word preserves its range. (Contributed by Thierry Arnoux, 19-Sep-2023)

Ref Expression
Assertion cshwrnid W Word V N ran W cyclShift N = ran W

Proof

Step Hyp Ref Expression
1 elfzoelz i 0 ..^ W i
2 1 3ad2ant3 W Word V N i 0 ..^ W i
3 simp2 W Word V N i 0 ..^ W N
4 2 3 zsubcld W Word V N i 0 ..^ W i N
5 elfzo0 i 0 ..^ W i 0 W i < W
6 5 simp2bi i 0 ..^ W W
7 6 3ad2ant3 W Word V N i 0 ..^ W W
8 zmodfzo i N W i N mod W 0 ..^ W
9 4 7 8 syl2anc W Word V N i 0 ..^ W i N mod W 0 ..^ W
10 9 3expa W Word V N i 0 ..^ W i N mod W 0 ..^ W
11 elfzoelz j 0 ..^ W j
12 11 adantl W Word V N j 0 ..^ W j
13 simplr W Word V N j 0 ..^ W N
14 12 13 zaddcld W Word V N j 0 ..^ W j + N
15 elfzo0 j 0 ..^ W j 0 W j < W
16 15 simp2bi j 0 ..^ W W
17 16 adantl W Word V N j 0 ..^ W W
18 zmodfzo j + N W j + N mod W 0 ..^ W
19 14 17 18 syl2anc W Word V N j 0 ..^ W j + N mod W 0 ..^ W
20 simpr W Word V N j 0 ..^ W i = j + N mod W i = j + N mod W
21 20 oveq1d W Word V N j 0 ..^ W i = j + N mod W i N = j + N mod W N
22 21 oveq1d W Word V N j 0 ..^ W i = j + N mod W i N mod W = j + N mod W N mod W
23 22 eqeq2d W Word V N j 0 ..^ W i = j + N mod W j = i N mod W j = j + N mod W N mod W
24 12 zred W Word V N j 0 ..^ W j
25 13 zred W Word V N j 0 ..^ W N
26 24 25 readdcld W Word V N j 0 ..^ W j + N
27 17 nnrpd W Word V N j 0 ..^ W W +
28 modsubmod j + N N W + j + N mod W N mod W = j + N - N mod W
29 26 25 27 28 syl3anc W Word V N j 0 ..^ W j + N mod W N mod W = j + N - N mod W
30 12 zcnd W Word V N j 0 ..^ W j
31 13 zcnd W Word V N j 0 ..^ W N
32 30 31 pncand W Word V N j 0 ..^ W j + N - N = j
33 32 oveq1d W Word V N j 0 ..^ W j + N - N mod W = j mod W
34 zmodidfzoimp j 0 ..^ W j mod W = j
35 34 adantl W Word V N j 0 ..^ W j mod W = j
36 29 33 35 3eqtrrd W Word V N j 0 ..^ W j = j + N mod W N mod W
37 19 23 36 rspcedvd W Word V N j 0 ..^ W i 0 ..^ W j = i N mod W
38 simp3 W Word V N i 0 ..^ W j = i N mod W j = i N mod W
39 38 fveq2d W Word V N i 0 ..^ W j = i N mod W W cyclShift N j = W cyclShift N i N mod W
40 simp1l W Word V N i 0 ..^ W j = i N mod W W Word V
41 simp1r W Word V N i 0 ..^ W j = i N mod W N
42 simp2 W Word V N i 0 ..^ W j = i N mod W i 0 ..^ W
43 cshwidxmodr W Word V N i 0 ..^ W W cyclShift N i N mod W = W i
44 40 41 42 43 syl3anc W Word V N i 0 ..^ W j = i N mod W W cyclShift N i N mod W = W i
45 39 44 eqtrd W Word V N i 0 ..^ W j = i N mod W W cyclShift N j = W i
46 45 eqeq2d W Word V N i 0 ..^ W j = i N mod W c = W cyclShift N j c = W i
47 10 37 46 rexxfrd2 W Word V N j 0 ..^ W c = W cyclShift N j i 0 ..^ W c = W i
48 47 abbidv W Word V N c | j 0 ..^ W c = W cyclShift N j = c | i 0 ..^ W c = W i
49 cshwfn W Word V N W cyclShift N Fn 0 ..^ W
50 fnrnfv W cyclShift N Fn 0 ..^ W ran W cyclShift N = c | j 0 ..^ W c = W cyclShift N j
51 49 50 syl W Word V N ran W cyclShift N = c | j 0 ..^ W c = W cyclShift N j
52 wrdfn W Word V W Fn 0 ..^ W
53 52 adantr W Word V N W Fn 0 ..^ W
54 fnrnfv W Fn 0 ..^ W ran W = c | i 0 ..^ W c = W i
55 53 54 syl W Word V N ran W = c | i 0 ..^ W c = W i
56 48 51 55 3eqtr4d W Word V N ran W cyclShift N = ran W