Metamath Proof Explorer


Theorem crctcshwlkn0lem6

Description: Lemma for crctcshwlkn0 . (Contributed by AV, 12-Mar-2021)

Ref Expression
Hypotheses crctcshwlkn0lem.s φ S 1 ..^ N
crctcshwlkn0lem.q Q = x 0 N if x N S P x + S P x + S - N
crctcshwlkn0lem.h H = F cyclShift S
crctcshwlkn0lem.n N = F
crctcshwlkn0lem.f φ F Word A
crctcshwlkn0lem.p φ i 0 ..^ N if- P i = P i + 1 I F i = P i P i P i + 1 I F i
crctcshwlkn0lem.e φ P N = P 0
Assertion crctcshwlkn0lem6 φ J = N S if- Q J = Q J + 1 I H J = Q J Q J Q J + 1 I H J

Proof

Step Hyp Ref Expression
1 crctcshwlkn0lem.s φ S 1 ..^ N
2 crctcshwlkn0lem.q Q = x 0 N if x N S P x + S P x + S - N
3 crctcshwlkn0lem.h H = F cyclShift S
4 crctcshwlkn0lem.n N = F
5 crctcshwlkn0lem.f φ F Word A
6 crctcshwlkn0lem.p φ i 0 ..^ N if- P i = P i + 1 I F i = P i P i P i + 1 I F i
7 crctcshwlkn0lem.e φ P N = P 0
8 oveq1 i = 0 i + 1 = 0 + 1
9 0p1e1 0 + 1 = 1
10 8 9 eqtrdi i = 0 i + 1 = 1
11 wkslem2 i = 0 i + 1 = 1 if- P i = P i + 1 I F i = P i P i P i + 1 I F i if- P 0 = P 1 I F 0 = P 0 P 0 P 1 I F 0
12 10 11 mpdan i = 0 if- P i = P i + 1 I F i = P i P i P i + 1 I F i if- P 0 = P 1 I F 0 = P 0 P 0 P 1 I F 0
13 elfzo1 S 1 ..^ N S N S < N
14 simp2 S N S < N N
15 13 14 sylbi S 1 ..^ N N
16 1 15 syl φ N
17 lbfzo0 0 0 ..^ N N
18 16 17 sylibr φ 0 0 ..^ N
19 12 6 18 rspcdva φ if- P 0 = P 1 I F 0 = P 0 P 0 P 1 I F 0
20 eqeq1 P N = P 0 P N = P 1 P 0 = P 1
21 sneq P N = P 0 P N = P 0
22 21 eqeq2d P N = P 0 I F 0 = P N I F 0 = P 0
23 preq1 P N = P 0 P N P 1 = P 0 P 1
24 23 sseq1d P N = P 0 P N P 1 I F 0 P 0 P 1 I F 0
25 20 22 24 ifpbi123d P N = P 0 if- P N = P 1 I F 0 = P N P N P 1 I F 0 if- P 0 = P 1 I F 0 = P 0 P 0 P 1 I F 0
26 7 25 syl φ if- P N = P 1 I F 0 = P N P N P 1 I F 0 if- P 0 = P 1 I F 0 = P 0 P 0 P 1 I F 0
27 19 26 mpbird φ if- P N = P 1 I F 0 = P N P N P 1 I F 0
28 nncn N N
29 nncn S S
30 npcan N S N - S + S = N
31 28 29 30 syl2anr S N N - S + S = N
32 simpr S N N - S + S = N N - S + S = N
33 oveq1 N - S + S = N N - S + S mod F = N mod F
34 4 eqcomi F = N
35 34 a1i S N F = N
36 35 oveq2d S N N mod F = N mod N
37 nnrp N N +
38 modid0 N + N mod N = 0
39 37 38 syl N N mod N = 0
40 39 adantl S N N mod N = 0
41 36 40 eqtrd S N N mod F = 0
42 33 41 sylan9eqr S N N - S + S = N N - S + S mod F = 0
43 simpl S N N - S + S = N S N
44 32 42 43 3jca S N N - S + S = N N - S + S = N N - S + S mod F = 0 S N
45 31 44 mpdan S N N - S + S = N N - S + S mod F = 0 S N
46 45 3adant3 S N S < N N - S + S = N N - S + S mod F = 0 S N
47 13 46 sylbi S 1 ..^ N N - S + S = N N - S + S mod F = 0 S N
48 simp1 N - S + S = N N - S + S mod F = 0 S N N - S + S = N
49 48 fveq2d N - S + S = N N - S + S mod F = 0 S N P N - S + S = P N
50 49 eqeq1d N - S + S = N N - S + S mod F = 0 S N P N - S + S = P 1 P N = P 1
51 simp2 N - S + S = N N - S + S mod F = 0 S N N - S + S mod F = 0
52 51 fveq2d N - S + S = N N - S + S mod F = 0 S N F N - S + S mod F = F 0
53 52 fveq2d N - S + S = N N - S + S mod F = 0 S N I F N - S + S mod F = I F 0
54 49 sneqd N - S + S = N N - S + S mod F = 0 S N P N - S + S = P N
55 53 54 eqeq12d N - S + S = N N - S + S mod F = 0 S N I F N - S + S mod F = P N - S + S I F 0 = P N
56 49 preq1d N - S + S = N N - S + S mod F = 0 S N P N - S + S P 1 = P N P 1
57 56 53 sseq12d N - S + S = N N - S + S mod F = 0 S N P N - S + S P 1 I F N - S + S mod F P N P 1 I F 0
58 50 55 57 ifpbi123d N - S + S = N N - S + S mod F = 0 S N if- P N - S + S = P 1 I F N - S + S mod F = P N - S + S P N - S + S P 1 I F N - S + S mod F if- P N = P 1 I F 0 = P N P N P 1 I F 0
59 1 47 58 3syl φ if- P N - S + S = P 1 I F N - S + S mod F = P N - S + S P N - S + S P 1 I F N - S + S mod F if- P N = P 1 I F 0 = P N P N P 1 I F 0
60 27 59 mpbird φ if- P N - S + S = P 1 I F N - S + S mod F = P N - S + S P N - S + S P 1 I F N - S + S mod F
61 nnsub S N S < N N S
62 61 biimp3a S N S < N N S
63 62 nnnn0d S N S < N N S 0
64 13 63 sylbi S 1 ..^ N N S 0
65 1 64 syl φ N S 0
66 nn0fz0 N S 0 N S 0 N S
67 65 66 sylib φ N S 0 N S
68 1 2 crctcshwlkn0lem2 φ N S 0 N S Q N S = P N - S + S
69 67 68 mpdan φ Q N S = P N - S + S
70 elfzoel2 S 1 ..^ N N
71 elfzoelz S 1 ..^ N S
72 70 71 zsubcld S 1 ..^ N N S
73 72 peano2zd S 1 ..^ N N - S + 1
74 nnre N N
75 74 anim1i N S N S
76 75 ancoms S N N S
77 crctcshwlkn0lem1 N S N - S + 1 N
78 76 77 syl S N N - S + 1 N
79 78 3adant3 S N S < N N - S + 1 N
80 13 79 sylbi S 1 ..^ N N - S + 1 N
81 73 70 80 3jca S 1 ..^ N N - S + 1 N N - S + 1 N
82 1 81 syl φ N - S + 1 N N - S + 1 N
83 eluz2 N N - S + 1 N - S + 1 N N - S + 1 N
84 82 83 sylibr φ N N - S + 1
85 eluzfz1 N N - S + 1 N - S + 1 N - S + 1 N
86 84 85 syl φ N - S + 1 N - S + 1 N
87 1 2 crctcshwlkn0lem3 φ N - S + 1 N - S + 1 N Q N - S + 1 = P N - S + 1 + S - N
88 86 87 mpdan φ Q N - S + 1 = P N - S + 1 + S - N
89 subcl N S N S
90 89 ancoms S N N S
91 ax-1cn 1
92 pncan2 N S 1 N S + 1 - N S = 1
93 92 eqcomd N S 1 1 = N S + 1 - N S
94 90 91 93 sylancl S N 1 = N S + 1 - N S
95 peano2cn N S N - S + 1
96 90 95 syl S N N - S + 1
97 simpr S N N
98 simpl S N S
99 96 97 98 subsub3d S N N S + 1 - N S = N - S + 1 + S - N
100 94 99 eqtr2d S N N - S + 1 + S - N = 1
101 29 28 100 syl2an S N N - S + 1 + S - N = 1
102 101 3adant3 S N S < N N - S + 1 + S - N = 1
103 13 102 sylbi S 1 ..^ N N - S + 1 + S - N = 1
104 1 103 syl φ N - S + 1 + S - N = 1
105 104 fveq2d φ P N - S + 1 + S - N = P 1
106 88 105 eqtrd φ Q N - S + 1 = P 1
107 3 fveq1i H N S = F cyclShift S N S
108 5 adantr φ S 1 ..^ N F Word A
109 71 adantl φ S 1 ..^ N S
110 elfzofz S 1 ..^ N S 1 N
111 ubmelfzo S 1 N N S 0 ..^ N
112 110 111 syl S 1 ..^ N N S 0 ..^ N
113 112 adantl φ S 1 ..^ N N S 0 ..^ N
114 34 oveq2i 0 ..^ F = 0 ..^ N
115 113 114 eleqtrrdi φ S 1 ..^ N N S 0 ..^ F
116 cshwidxmod F Word A S N S 0 ..^ F F cyclShift S N S = F N - S + S mod F
117 108 109 115 116 syl3anc φ S 1 ..^ N F cyclShift S N S = F N - S + S mod F
118 1 117 mpdan φ F cyclShift S N S = F N - S + S mod F
119 107 118 eqtrid φ H N S = F N - S + S mod F
120 simp1 Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F Q N S = P N - S + S
121 simp2 Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F Q N - S + 1 = P 1
122 120 121 eqeq12d Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F Q N S = Q N - S + 1 P N - S + S = P 1
123 simp3 Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F H N S = F N - S + S mod F
124 123 fveq2d Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F I H N S = I F N - S + S mod F
125 120 sneqd Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F Q N S = P N - S + S
126 124 125 eqeq12d Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F I H N S = Q N S I F N - S + S mod F = P N - S + S
127 120 121 preq12d Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F Q N S Q N - S + 1 = P N - S + S P 1
128 127 124 sseq12d Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F Q N S Q N - S + 1 I H N S P N - S + S P 1 I F N - S + S mod F
129 122 126 128 ifpbi123d Q N S = P N - S + S Q N - S + 1 = P 1 H N S = F N - S + S mod F if- Q N S = Q N - S + 1 I H N S = Q N S Q N S Q N - S + 1 I H N S if- P N - S + S = P 1 I F N - S + S mod F = P N - S + S P N - S + S P 1 I F N - S + S mod F
130 69 106 119 129 syl3anc φ if- Q N S = Q N - S + 1 I H N S = Q N S Q N S Q N - S + 1 I H N S if- P N - S + S = P 1 I F N - S + S mod F = P N - S + S P N - S + S P 1 I F N - S + S mod F
131 60 130 mpbird φ if- Q N S = Q N - S + 1 I H N S = Q N S Q N S Q N - S + 1 I H N S
132 131 adantr φ J = N S if- Q N S = Q N - S + 1 I H N S = Q N S Q N S Q N - S + 1 I H N S
133 wkslem1 J = N S if- Q J = Q J + 1 I H J = Q J Q J Q J + 1 I H J if- Q N S = Q N - S + 1 I H N S = Q N S Q N S Q N - S + 1 I H N S
134 133 adantl φ J = N S if- Q J = Q J + 1 I H J = Q J Q J Q J + 1 I H J if- Q N S = Q N - S + 1 I H N S = Q N S Q N S Q N - S + 1 I H N S
135 132 134 mpbird φ J = N S if- Q J = Q J + 1 I H J = Q J Q J Q J + 1 I H J