Metamath Proof Explorer


Theorem wrdt2ind

Description: Perform an induction over the structure of a word of even length. (Contributed by Thierry Arnoux, 26-Sep-2023)

Ref Expression
Hypotheses wrdt2ind.1 x = φ ψ
wrdt2ind.2 x = y φ χ
wrdt2ind.3 x = y ++ ⟨“ ij ”⟩ φ θ
wrdt2ind.4 x = A φ τ
wrdt2ind.5 ψ
wrdt2ind.6 y Word B i B j B χ θ
Assertion wrdt2ind A Word B 2 A τ

Proof

Step Hyp Ref Expression
1 wrdt2ind.1 x = φ ψ
2 wrdt2ind.2 x = y φ χ
3 wrdt2ind.3 x = y ++ ⟨“ ij ”⟩ φ θ
4 wrdt2ind.4 x = A φ τ
5 wrdt2ind.5 ψ
6 wrdt2ind.6 y Word B i B j B χ θ
7 oveq2 n = 0 2 n = 2 0
8 7 eqeq1d n = 0 2 n = x 2 0 = x
9 8 imbi1d n = 0 2 n = x φ 2 0 = x φ
10 9 ralbidv n = 0 x Word B 2 n = x φ x Word B 2 0 = x φ
11 oveq2 n = k 2 n = 2 k
12 11 eqeq1d n = k 2 n = x 2 k = x
13 12 imbi1d n = k 2 n = x φ 2 k = x φ
14 13 ralbidv n = k x Word B 2 n = x φ x Word B 2 k = x φ
15 oveq2 n = k + 1 2 n = 2 k + 1
16 15 eqeq1d n = k + 1 2 n = x 2 k + 1 = x
17 16 imbi1d n = k + 1 2 n = x φ 2 k + 1 = x φ
18 17 ralbidv n = k + 1 x Word B 2 n = x φ x Word B 2 k + 1 = x φ
19 oveq2 n = m 2 n = 2 m
20 19 eqeq1d n = m 2 n = x 2 m = x
21 20 imbi1d n = m 2 n = x φ 2 m = x φ
22 21 ralbidv n = m x Word B 2 n = x φ x Word B 2 m = x φ
23 2t0e0 2 0 = 0
24 23 eqeq1i 2 0 = x 0 = x
25 eqcom 0 = x x = 0
26 24 25 bitri 2 0 = x x = 0
27 hasheq0 x Word B x = 0 x =
28 26 27 syl5bb x Word B 2 0 = x x =
29 5 1 mpbiri x = φ
30 28 29 syl6bi x Word B 2 0 = x φ
31 30 rgen x Word B 2 0 = x φ
32 fveq2 x = y x = y
33 32 eqeq2d x = y 2 k = x 2 k = y
34 33 2 imbi12d x = y 2 k = x φ 2 k = y χ
35 34 cbvralvw x Word B 2 k = x φ y Word B 2 k = y χ
36 simprl k 0 x Word B 2 k + 1 = x x Word B
37 0zd k 0 x Word B 2 k + 1 = x 0
38 lencl x Word B x 0
39 36 38 syl k 0 x Word B 2 k + 1 = x x 0
40 39 nn0zd k 0 x Word B 2 k + 1 = x x
41 2z 2
42 41 a1i k 0 x Word B 2 k + 1 = x 2
43 40 42 zsubcld k 0 x Word B 2 k + 1 = x x 2
44 2re 2
45 44 a1i k 0 2
46 nn0re k 0 k
47 0le2 0 2
48 47 a1i k 0 0 2
49 nn0ge0 k 0 0 k
50 45 46 48 49 mulge0d k 0 0 2 k
51 50 adantr k 0 x Word B 2 k + 1 = x 0 2 k
52 2cnd k 0 x Word B 2 k + 1 = x 2
53 simpl k 0 x Word B 2 k + 1 = x k 0
54 53 nn0cnd k 0 x Word B 2 k + 1 = x k
55 1cnd k 0 x Word B 2 k + 1 = x 1
56 52 54 55 adddid k 0 x Word B 2 k + 1 = x 2 k + 1 = 2 k + 2 1
57 simprr k 0 x Word B 2 k + 1 = x 2 k + 1 = x
58 2t1e2 2 1 = 2
59 58 a1i k 0 x Word B 2 k + 1 = x 2 1 = 2
60 59 oveq2d k 0 x Word B 2 k + 1 = x 2 k + 2 1 = 2 k + 2
61 56 57 60 3eqtr3d k 0 x Word B 2 k + 1 = x x = 2 k + 2
62 61 oveq1d k 0 x Word B 2 k + 1 = x x 2 = 2 k + 2 - 2
63 52 54 mulcld k 0 x Word B 2 k + 1 = x 2 k
64 63 52 pncand k 0 x Word B 2 k + 1 = x 2 k + 2 - 2 = 2 k
65 62 64 eqtrd k 0 x Word B 2 k + 1 = x x 2 = 2 k
66 51 65 breqtrrd k 0 x Word B 2 k + 1 = x 0 x 2
67 43 zred k 0 x Word B 2 k + 1 = x x 2
68 39 nn0red k 0 x Word B 2 k + 1 = x x
69 2pos 0 < 2
70 44 a1i k 0 x Word B 2 k + 1 = x 2
71 70 68 ltsubposd k 0 x Word B 2 k + 1 = x 0 < 2 x 2 < x
72 69 71 mpbii k 0 x Word B 2 k + 1 = x x 2 < x
73 67 68 72 ltled k 0 x Word B 2 k + 1 = x x 2 x
74 37 40 43 66 73 elfzd k 0 x Word B 2 k + 1 = x x 2 0 x
75 pfxlen x Word B x 2 0 x x prefix x 2 = x 2
76 36 74 75 syl2anc k 0 x Word B 2 k + 1 = x x prefix x 2 = x 2
77 76 65 eqtr2d k 0 x Word B 2 k + 1 = x 2 k = x prefix x 2
78 77 adantlr k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 2 k = x prefix x 2
79 fveq2 y = x prefix x 2 y = x prefix x 2
80 79 eqeq2d y = x prefix x 2 2 k = y 2 k = x prefix x 2
81 vex y V
82 81 2 sbcie [˙y / x]˙ φ χ
83 dfsbcq y = x prefix x 2 [˙y / x]˙ φ [˙x prefix x 2 / x]˙ φ
84 82 83 bitr3id y = x prefix x 2 χ [˙x prefix x 2 / x]˙ φ
85 80 84 imbi12d y = x prefix x 2 2 k = y χ 2 k = x prefix x 2 [˙x prefix x 2 / x]˙ φ
86 simplr k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x y Word B 2 k = y χ
87 pfxcl x Word B x prefix x 2 Word B
88 87 ad2antrl k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x x prefix x 2 Word B
89 85 86 88 rspcdva k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 2 k = x prefix x 2 [˙x prefix x 2 / x]˙ φ
90 78 89 mpd k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x [˙x prefix x 2 / x]˙ φ
91 2nn0 2 0
92 91 a1i k 0 x Word B 2 k + 1 = x 2 0
93 52 addid2d k 0 x Word B 2 k + 1 = x 0 + 2 = 2
94 0red k 0 x Word B 2 k + 1 = x 0
95 65 67 eqeltrrd k 0 x Word B 2 k + 1 = x 2 k
96 94 95 70 51 leadd1dd k 0 x Word B 2 k + 1 = x 0 + 2 2 k + 2
97 93 96 eqbrtrrd k 0 x Word B 2 k + 1 = x 2 2 k + 2
98 97 61 breqtrrd k 0 x Word B 2 k + 1 = x 2 x
99 nn0sub 2 0 x 0 2 x x 2 0
100 99 biimpa 2 0 x 0 2 x x 2 0
101 92 39 98 100 syl21anc k 0 x Word B 2 k + 1 = x x 2 0
102 68 recnd k 0 x Word B 2 k + 1 = x x
103 102 52 55 subsubd k 0 x Word B 2 k + 1 = x x 2 1 = x - 2 + 1
104 2m1e1 2 1 = 1
105 104 a1i k 0 x Word B 2 k + 1 = x 2 1 = 1
106 105 oveq2d k 0 x Word B 2 k + 1 = x x 2 1 = x 1
107 103 106 eqtr3d k 0 x Word B 2 k + 1 = x x - 2 + 1 = x 1
108 68 lem1d k 0 x Word B 2 k + 1 = x x 1 x
109 107 108 eqbrtrd k 0 x Word B 2 k + 1 = x x - 2 + 1 x
110 nn0p1elfzo x 2 0 x 0 x - 2 + 1 x x 2 0 ..^ x
111 101 39 109 110 syl3anc k 0 x Word B 2 k + 1 = x x 2 0 ..^ x
112 wrdsymbcl x Word B x 2 0 ..^ x x x 2 B
113 36 111 112 syl2anc k 0 x Word B 2 k + 1 = x x x 2 B
114 113 adantlr k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x x x 2 B
115 nn0ge2m1nn0 x 0 2 x x 1 0
116 39 98 115 syl2anc k 0 x Word B 2 k + 1 = x x 1 0
117 102 55 npcand k 0 x Word B 2 k + 1 = x x - 1 + 1 = x
118 68 leidd k 0 x Word B 2 k + 1 = x x x
119 117 118 eqbrtrd k 0 x Word B 2 k + 1 = x x - 1 + 1 x
120 nn0p1elfzo x 1 0 x 0 x - 1 + 1 x x 1 0 ..^ x
121 116 39 119 120 syl3anc k 0 x Word B 2 k + 1 = x x 1 0 ..^ x
122 wrdsymbcl x Word B x 1 0 ..^ x x x 1 B
123 36 121 122 syl2anc k 0 x Word B 2 k + 1 = x x x 1 B
124 123 adantlr k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x x x 1 B
125 oveq1 y = x prefix x 2 y ++ ⟨“ ij ”⟩ = x prefix x 2 ++ ⟨“ ij ”⟩
126 125 sbceq1d y = x prefix x 2 [˙y ++ ⟨“ ij ”⟩ / x]˙ φ [˙x prefix x 2 ++ ⟨“ ij ”⟩ / x]˙ φ
127 83 126 imbi12d y = x prefix x 2 [˙y / x]˙ φ [˙y ++ ⟨“ ij ”⟩ / x]˙ φ [˙x prefix x 2 / x]˙ φ [˙x prefix x 2 ++ ⟨“ ij ”⟩ / x]˙ φ
128 id i = x x 2 i = x x 2
129 eqidd i = x x 2 j = j
130 128 129 s2eqd i = x x 2 ⟨“ ij ”⟩ = ⟨“ x x 2 j ”⟩
131 130 oveq2d i = x x 2 x prefix x 2 ++ ⟨“ ij ”⟩ = x prefix x 2 ++ ⟨“ x x 2 j ”⟩
132 131 sbceq1d i = x x 2 [˙x prefix x 2 ++ ⟨“ ij ”⟩ / x]˙ φ [˙x prefix x 2 ++ ⟨“ x x 2 j ”⟩ / x]˙ φ
133 132 imbi2d i = x x 2 [˙x prefix x 2 / x]˙ φ [˙x prefix x 2 ++ ⟨“ ij ”⟩ / x]˙ φ [˙x prefix x 2 / x]˙ φ [˙x prefix x 2 ++ ⟨“ x x 2 j ”⟩ / x]˙ φ
134 eqidd j = x x 1 x x 2 = x x 2
135 id j = x x 1 j = x x 1
136 134 135 s2eqd j = x x 1 ⟨“ x x 2 j ”⟩ = ⟨“ x x 2 x x 1 ”⟩
137 136 oveq2d j = x x 1 x prefix x 2 ++ ⟨“ x x 2 j ”⟩ = x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩
138 137 sbceq1d j = x x 1 [˙x prefix x 2 ++ ⟨“ x x 2 j ”⟩ / x]˙ φ [˙x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ / x]˙ φ
139 138 imbi2d j = x x 1 [˙x prefix x 2 / x]˙ φ [˙x prefix x 2 ++ ⟨“ x x 2 j ”⟩ / x]˙ φ [˙x prefix x 2 / x]˙ φ [˙x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ / x]˙ φ
140 ovex y ++ ⟨“ ij ”⟩ V
141 140 3 sbcie [˙y ++ ⟨“ ij ”⟩ / x]˙ φ θ
142 6 82 141 3imtr4g y Word B i B j B [˙y / x]˙ φ [˙y ++ ⟨“ ij ”⟩ / x]˙ φ
143 127 133 139 142 vtocl3ga x prefix x 2 Word B x x 2 B x x 1 B [˙x prefix x 2 / x]˙ φ [˙x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ / x]˙ φ
144 88 114 124 143 syl3anc k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x [˙x prefix x 2 / x]˙ φ [˙x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ / x]˙ φ
145 90 144 mpd k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x [˙x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ / x]˙ φ
146 simprl k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x x Word B
147 1red k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 1
148 simpll k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x k 0
149 148 nn0red k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x k
150 149 147 readdcld k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x k + 1
151 44 a1i k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 2
152 47 a1i k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 0 2
153 0p1e1 0 + 1 = 1
154 0red k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 0
155 148 nn0ge0d k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 0 k
156 147 leidd k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 1 1
157 154 147 149 147 155 156 le2addd k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 0 + 1 k + 1
158 153 157 eqbrtrrid k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 1 k + 1
159 147 150 151 152 158 lemul2ad k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 2 1 2 k + 1
160 58 159 eqbrtrrid k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 2 2 k + 1
161 simprr k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 2 k + 1 = x
162 160 161 breqtrd k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x 2 x
163 eqid x = x
164 163 pfxlsw2ccat x Word B 2 x x = x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩
165 164 eqcomd x Word B 2 x x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ = x
166 165 eqcomd x Word B 2 x x = x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩
167 146 162 166 syl2anc k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x x = x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩
168 sbceq1a x = x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ φ [˙x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ / x]˙ φ
169 167 168 syl k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x φ [˙x prefix x 2 ++ ⟨“ x x 2 x x 1 ”⟩ / x]˙ φ
170 145 169 mpbird k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x φ
171 170 expr k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x φ
172 171 ralrimiva k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x φ
173 172 ex k 0 y Word B 2 k = y χ x Word B 2 k + 1 = x φ
174 35 173 syl5bi k 0 x Word B 2 k = x φ x Word B 2 k + 1 = x φ
175 10 14 18 22 31 174 nn0ind m 0 x Word B 2 m = x φ
176 175 adantl A Word B m 0 x Word B 2 m = x φ
177 simpl A Word B m 0 A Word B
178 fveq2 x = A x = A
179 178 eqeq2d x = A 2 m = x 2 m = A
180 179 4 imbi12d x = A 2 m = x φ 2 m = A τ
181 180 adantl A Word B m 0 x = A 2 m = x φ 2 m = A τ
182 177 181 rspcdv A Word B m 0 x Word B 2 m = x φ 2 m = A τ
183 176 182 mpd A Word B m 0 2 m = A τ
184 183 imp A Word B m 0 2 m = A τ
185 184 adantllr A Word B 2 A m 0 2 m = A τ
186 lencl A Word B A 0
187 evennn02n A 0 2 A m 0 2 m = A
188 187 biimpa A 0 2 A m 0 2 m = A
189 186 188 sylan A Word B 2 A m 0 2 m = A
190 185 189 r19.29a A Word B 2 A τ