Metamath Proof Explorer


Theorem cshweqdif2

Description: If cyclically shifting two words (of the same length) results in the same word, cyclically shifting one of the words by the difference of the numbers of shifts results in the other word. (Contributed by AV, 21-Apr-2018) (Revised by AV, 6-Jun-2018) (Revised by AV, 1-Nov-2018)

Ref Expression
Assertion cshweqdif2 W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M N = W

Proof

Step Hyp Ref Expression
1 simpr W Word V U Word V U Word V
2 1 adantr W Word V U Word V N M U Word V
3 zsubcl M N M N
4 3 ancoms N M M N
5 4 adantl W Word V U Word V N M M N
6 simpr N M M
7 6 adantl W Word V U Word V N M M
8 2 5 7 3jca W Word V U Word V N M U Word V M N M
9 8 adantr W Word V U Word V N M W cyclShift N = U cyclShift M U Word V M N M
10 3cshw U Word V M N M U cyclShift M N = U cyclShift M cyclShift M N cyclShift U M
11 9 10 syl W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M N = U cyclShift M cyclShift M N cyclShift U M
12 simpl W Word V U Word V N M W Word V U Word V
13 12 ancomd W Word V U Word V N M U Word V W Word V
14 13 adantr W Word V U Word V N M W cyclShift N = U cyclShift M U Word V W Word V
15 simpr W Word V U Word V N M N M
16 15 ancomd W Word V U Word V N M M N
17 16 adantr W Word V U Word V N M W cyclShift N = U cyclShift M M N
18 simpr W Word V U Word V N M W cyclShift N = U cyclShift M W cyclShift N = U cyclShift M
19 18 eqcomd W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M = W cyclShift N
20 cshwleneq U Word V W Word V M N U cyclShift M = W cyclShift N U = W
21 14 17 19 20 syl3anc W Word V U Word V N M W cyclShift N = U cyclShift M U = W
22 21 oveq1d W Word V U Word V N M W cyclShift N = U cyclShift M U M = W M
23 22 oveq2d W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M cyclShift M N cyclShift U M = U cyclShift M cyclShift M N cyclShift W M
24 11 23 eqtrd W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M N = U cyclShift M cyclShift M N cyclShift W M
25 19 oveq1d W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M cyclShift M N = W cyclShift N cyclShift M N
26 simpl W Word V U Word V W Word V
27 26 adantr W Word V U Word V N M W Word V
28 simpl N M N
29 28 adantl W Word V U Word V N M N
30 27 29 5 3jca W Word V U Word V N M W Word V N M N
31 30 adantr W Word V U Word V N M W cyclShift N = U cyclShift M W Word V N M N
32 2cshw W Word V N M N W cyclShift N cyclShift M N = W cyclShift N + M - N
33 31 32 syl W Word V U Word V N M W cyclShift N = U cyclShift M W cyclShift N cyclShift M N = W cyclShift N + M - N
34 zcn N N
35 zcn M M
36 34 35 anim12i N M N M
37 36 adantl W Word V U Word V N M N M
38 37 adantr W Word V U Word V N M W cyclShift N = U cyclShift M N M
39 pncan3 N M N + M - N = M
40 38 39 syl W Word V U Word V N M W cyclShift N = U cyclShift M N + M - N = M
41 40 oveq2d W Word V U Word V N M W cyclShift N = U cyclShift M W cyclShift N + M - N = W cyclShift M
42 25 33 41 3eqtrd W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M cyclShift M N = W cyclShift M
43 42 oveq1d W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M cyclShift M N cyclShift W M = W cyclShift M cyclShift W M
44 lencl W Word V W 0
45 44 nn0zd W Word V W
46 45 adantr W Word V U Word V W
47 zsubcl W M W M
48 46 6 47 syl2an W Word V U Word V N M W M
49 27 7 48 3jca W Word V U Word V N M W Word V M W M
50 49 adantr W Word V U Word V N M W cyclShift N = U cyclShift M W Word V M W M
51 2cshw W Word V M W M W cyclShift M cyclShift W M = W cyclShift M + W - M
52 50 51 syl W Word V U Word V N M W cyclShift N = U cyclShift M W cyclShift M cyclShift W M = W cyclShift M + W - M
53 24 43 52 3eqtrd W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M N = W cyclShift M + W - M
54 44 nn0cnd W Word V W
55 54 adantr W Word V U Word V W
56 35 adantl N M M
57 55 56 anim12i W Word V U Word V N M W M
58 57 ancomd W Word V U Word V N M M W
59 58 adantr W Word V U Word V N M W cyclShift N = U cyclShift M M W
60 pncan3 M W M + W - M = W
61 59 60 syl W Word V U Word V N M W cyclShift N = U cyclShift M M + W - M = W
62 61 oveq2d W Word V U Word V N M W cyclShift N = U cyclShift M W cyclShift M + W - M = W cyclShift W
63 cshwn W Word V W cyclShift W = W
64 27 63 syl W Word V U Word V N M W cyclShift W = W
65 64 adantr W Word V U Word V N M W cyclShift N = U cyclShift M W cyclShift W = W
66 53 62 65 3eqtrd W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M N = W
67 66 ex W Word V U Word V N M W cyclShift N = U cyclShift M U cyclShift M N = W