Metamath Proof Explorer


Theorem 2cshw

Description: Cyclically shifting a word two times. (Contributed by AV, 7-Apr-2018) (Revised by AV, 4-Jun-2018) (Revised by AV, 31-Oct-2018)

Ref Expression
Assertion 2cshw W Word V M N W cyclShift M cyclShift N = W cyclShift M + N

Proof

Step Hyp Ref Expression
1 cshwlen W Word V M W cyclShift M = W
2 1 3adant3 W Word V M N W cyclShift M = W
3 cshwcl W Word V W cyclShift M Word V
4 cshwlen W cyclShift M Word V N W cyclShift M cyclShift N = W cyclShift M
5 3 4 sylan W Word V N W cyclShift M cyclShift N = W cyclShift M
6 5 3adant2 W Word V M N W cyclShift M cyclShift N = W cyclShift M
7 simp1 W Word V M N W Word V
8 zaddcl M N M + N
9 8 3adant1 W Word V M N M + N
10 cshwlen W Word V M + N W cyclShift M + N = W
11 7 9 10 syl2anc W Word V M N W cyclShift M + N = W
12 2 6 11 3eqtr4d W Word V M N W cyclShift M cyclShift N = W cyclShift M + N
13 6 2 eqtrd W Word V M N W cyclShift M cyclShift N = W
14 13 oveq2d W Word V M N 0 ..^ W cyclShift M cyclShift N = 0 ..^ W
15 14 eleq2d W Word V M N i 0 ..^ W cyclShift M cyclShift N i 0 ..^ W
16 3 3ad2ant1 W Word V M N W cyclShift M Word V
17 16 adantr W Word V M N i 0 ..^ W W cyclShift M Word V
18 simpl3 W Word V M N i 0 ..^ W N
19 2 oveq2d W Word V M N 0 ..^ W cyclShift M = 0 ..^ W
20 19 eleq2d W Word V M N i 0 ..^ W cyclShift M i 0 ..^ W
21 20 biimpar W Word V M N i 0 ..^ W i 0 ..^ W cyclShift M
22 cshwidxmod W cyclShift M Word V N i 0 ..^ W cyclShift M W cyclShift M cyclShift N i = W cyclShift M i + N mod W cyclShift M
23 17 18 21 22 syl3anc W Word V M N i 0 ..^ W W cyclShift M cyclShift N i = W cyclShift M i + N mod W cyclShift M
24 simpl1 W Word V M N i 0 ..^ W W Word V
25 simpl2 W Word V M N i 0 ..^ W M
26 elfzo0 i 0 ..^ W i 0 W i < W
27 nn0z i 0 i
28 27 ad2antrr i 0 W W Word V M N i
29 simpr3 i 0 W W Word V M N N
30 28 29 zaddcld i 0 W W Word V M N i + N
31 simplr i 0 W W Word V M N W
32 30 31 jca i 0 W W Word V M N i + N W
33 32 ex i 0 W W Word V M N i + N W
34 33 3adant3 i 0 W i < W W Word V M N i + N W
35 26 34 sylbi i 0 ..^ W W Word V M N i + N W
36 35 impcom W Word V M N i 0 ..^ W i + N W
37 zmodfzo i + N W i + N mod W 0 ..^ W
38 36 37 syl W Word V M N i 0 ..^ W i + N mod W 0 ..^ W
39 1 oveq2d W Word V M i + N mod W cyclShift M = i + N mod W
40 39 eleq1d W Word V M i + N mod W cyclShift M 0 ..^ W i + N mod W 0 ..^ W
41 40 3adant3 W Word V M N i + N mod W cyclShift M 0 ..^ W i + N mod W 0 ..^ W
42 41 adantr W Word V M N i 0 ..^ W i + N mod W cyclShift M 0 ..^ W i + N mod W 0 ..^ W
43 38 42 mpbird W Word V M N i 0 ..^ W i + N mod W cyclShift M 0 ..^ W
44 cshwidxmod W Word V M i + N mod W cyclShift M 0 ..^ W W cyclShift M i + N mod W cyclShift M = W i + N mod W cyclShift M + M mod W
45 24 25 43 44 syl3anc W Word V M N i 0 ..^ W W cyclShift M i + N mod W cyclShift M = W i + N mod W cyclShift M + M mod W
46 nn0re i 0 i
47 46 ad2antrr i 0 W M N i
48 zre N N
49 48 ad2antll i 0 W M N N
50 47 49 readdcld i 0 W M N i + N
51 zre M M
52 51 ad2antrl i 0 W M N M
53 nnrp W W +
54 53 ad2antlr i 0 W M N W +
55 modaddmod i + N M W + i + N mod W + M mod W = i + N + M mod W
56 50 52 54 55 syl3anc i 0 W M N i + N mod W + M mod W = i + N + M mod W
57 nn0cn i 0 i
58 57 ad2antrr i 0 W M N i
59 zcn M M
60 59 ad2antrl i 0 W M N M
61 zcn N N
62 61 ad2antll i 0 W M N N
63 add32r i M N i + M + N = i + N + M
64 58 60 62 63 syl3anc i 0 W M N i + M + N = i + N + M
65 64 oveq1d i 0 W M N i + M + N mod W = i + N + M mod W
66 56 65 eqtr4d i 0 W M N i + N mod W + M mod W = i + M + N mod W
67 66 ex i 0 W M N i + N mod W + M mod W = i + M + N mod W
68 67 3adant3 i 0 W i < W M N i + N mod W + M mod W = i + M + N mod W
69 26 68 sylbi i 0 ..^ W M N i + N mod W + M mod W = i + M + N mod W
70 69 impcom M N i 0 ..^ W i + N mod W + M mod W = i + M + N mod W
71 70 3adantl1 W Word V M N i 0 ..^ W i + N mod W + M mod W = i + M + N mod W
72 71 fveq2d W Word V M N i 0 ..^ W W i + N mod W + M mod W = W i + M + N mod W
73 2 adantr W Word V M N i 0 ..^ W W cyclShift M = W
74 73 oveq2d W Word V M N i 0 ..^ W i + N mod W cyclShift M = i + N mod W
75 74 oveq1d W Word V M N i 0 ..^ W i + N mod W cyclShift M + M = i + N mod W + M
76 75 fvoveq1d W Word V M N i 0 ..^ W W i + N mod W cyclShift M + M mod W = W i + N mod W + M mod W
77 9 adantr W Word V M N i 0 ..^ W M + N
78 simpr W Word V M N i 0 ..^ W i 0 ..^ W
79 cshwidxmod W Word V M + N i 0 ..^ W W cyclShift M + N i = W i + M + N mod W
80 24 77 78 79 syl3anc W Word V M N i 0 ..^ W W cyclShift M + N i = W i + M + N mod W
81 72 76 80 3eqtr4d W Word V M N i 0 ..^ W W i + N mod W cyclShift M + M mod W = W cyclShift M + N i
82 23 45 81 3eqtrd W Word V M N i 0 ..^ W W cyclShift M cyclShift N i = W cyclShift M + N i
83 82 ex W Word V M N i 0 ..^ W W cyclShift M cyclShift N i = W cyclShift M + N i
84 15 83 sylbid W Word V M N i 0 ..^ W cyclShift M cyclShift N W cyclShift M cyclShift N i = W cyclShift M + N i
85 84 ralrimiv W Word V M N i 0 ..^ W cyclShift M cyclShift N W cyclShift M cyclShift N i = W cyclShift M + N i
86 cshwcl W cyclShift M Word V W cyclShift M cyclShift N Word V
87 3 86 syl W Word V W cyclShift M cyclShift N Word V
88 cshwcl W Word V W cyclShift M + N Word V
89 eqwrd W cyclShift M cyclShift N Word V W cyclShift M + N Word V W cyclShift M cyclShift N = W cyclShift M + N W cyclShift M cyclShift N = W cyclShift M + N i 0 ..^ W cyclShift M cyclShift N W cyclShift M cyclShift N i = W cyclShift M + N i
90 87 88 89 syl2anc W Word V W cyclShift M cyclShift N = W cyclShift M + N W cyclShift M cyclShift N = W cyclShift M + N i 0 ..^ W cyclShift M cyclShift N W cyclShift M cyclShift N i = W cyclShift M + N i
91 90 3ad2ant1 W Word V M N W cyclShift M cyclShift N = W cyclShift M + N W cyclShift M cyclShift N = W cyclShift M + N i 0 ..^ W cyclShift M cyclShift N W cyclShift M cyclShift N i = W cyclShift M + N i
92 12 85 91 mpbir2and W Word V M N W cyclShift M cyclShift N = W cyclShift M + N