Metamath Proof Explorer


Theorem wrdind

Description: Perform induction over the structure of a word. (Contributed by Mario Carneiro, 27-Sep-2015) (Revised by Mario Carneiro, 26-Feb-2016) (Proof shortened by AV, 12-Oct-2022)

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

Proof

Step Hyp Ref Expression
1 wrdind.1 x = φ ψ
2 wrdind.2 x = y φ χ
3 wrdind.3 x = y ++ ⟨“ z ”⟩ φ θ
4 wrdind.4 x = A φ τ
5 wrdind.5 ψ
6 wrdind.6 y Word B z B χ θ
7 lencl A Word B A 0
8 eqeq2 n = 0 x = n x = 0
9 8 imbi1d n = 0 x = n φ x = 0 φ
10 9 ralbidv n = 0 x Word B x = n φ x Word B x = 0 φ
11 eqeq2 n = m x = n x = m
12 11 imbi1d n = m x = n φ x = m φ
13 12 ralbidv n = m x Word B x = n φ x Word B x = m φ
14 eqeq2 n = m + 1 x = n x = m + 1
15 14 imbi1d n = m + 1 x = n φ x = m + 1 φ
16 15 ralbidv n = m + 1 x Word B x = n φ x Word B x = m + 1 φ
17 eqeq2 n = A x = n x = A
18 17 imbi1d n = A x = n φ x = A φ
19 18 ralbidv n = A x Word B x = n φ x Word B x = A φ
20 hasheq0 x Word B x = 0 x =
21 5 1 mpbiri x = φ
22 20 21 syl6bi x Word B x = 0 φ
23 22 rgen x Word B x = 0 φ
24 fveqeq2 x = y x = m y = m
25 24 2 imbi12d x = y x = m φ y = m χ
26 25 cbvralvw x Word B x = m φ y Word B y = m χ
27 simprl m 0 y Word B y = m χ x Word B x = m + 1 x Word B
28 fzossfz 0 ..^ x 0 x
29 simprr m 0 y Word B y = m χ x Word B x = m + 1 x = m + 1
30 nn0p1nn m 0 m + 1
31 30 ad2antrr m 0 y Word B y = m χ x Word B x = m + 1 m + 1
32 29 31 eqeltrd m 0 y Word B y = m χ x Word B x = m + 1 x
33 fzo0end x x 1 0 ..^ x
34 32 33 syl m 0 y Word B y = m χ x Word B x = m + 1 x 1 0 ..^ x
35 28 34 sselid m 0 y Word B y = m χ x Word B x = m + 1 x 1 0 x
36 pfxlen x Word B x 1 0 x x prefix x 1 = x 1
37 27 35 36 syl2anc m 0 y Word B y = m χ x Word B x = m + 1 x prefix x 1 = x 1
38 29 oveq1d m 0 y Word B y = m χ x Word B x = m + 1 x 1 = m + 1 - 1
39 nn0cn m 0 m
40 39 ad2antrr m 0 y Word B y = m χ x Word B x = m + 1 m
41 ax-1cn 1
42 pncan m 1 m + 1 - 1 = m
43 40 41 42 sylancl m 0 y Word B y = m χ x Word B x = m + 1 m + 1 - 1 = m
44 37 38 43 3eqtrd m 0 y Word B y = m χ x Word B x = m + 1 x prefix x 1 = m
45 fveqeq2 y = x prefix x 1 y = m x prefix x 1 = m
46 vex y V
47 46 2 sbcie [˙y / x]˙ φ χ
48 dfsbcq y = x prefix x 1 [˙y / x]˙ φ [˙x prefix x 1 / x]˙ φ
49 47 48 bitr3id y = x prefix x 1 χ [˙x prefix x 1 / x]˙ φ
50 45 49 imbi12d y = x prefix x 1 y = m χ x prefix x 1 = m [˙x prefix x 1 / x]˙ φ
51 simplr m 0 y Word B y = m χ x Word B x = m + 1 y Word B y = m χ
52 pfxcl x Word B x prefix x 1 Word B
53 52 ad2antrl m 0 y Word B y = m χ x Word B x = m + 1 x prefix x 1 Word B
54 50 51 53 rspcdva m 0 y Word B y = m χ x Word B x = m + 1 x prefix x 1 = m [˙x prefix x 1 / x]˙ φ
55 44 54 mpd m 0 y Word B y = m χ x Word B x = m + 1 [˙x prefix x 1 / x]˙ φ
56 32 nnge1d m 0 y Word B y = m χ x Word B x = m + 1 1 x
57 wrdlenge1n0 x Word B x 1 x
58 57 ad2antrl m 0 y Word B y = m χ x Word B x = m + 1 x 1 x
59 56 58 mpbird m 0 y Word B y = m χ x Word B x = m + 1 x
60 lswcl x Word B x lastS x B
61 27 59 60 syl2anc m 0 y Word B y = m χ x Word B x = m + 1 lastS x B
62 oveq1 y = x prefix x 1 y ++ ⟨“ z ”⟩ = x prefix x 1 ++ ⟨“ z ”⟩
63 62 sbceq1d y = x prefix x 1 [˙y ++ ⟨“ z ”⟩ / x]˙ φ [˙x prefix x 1 ++ ⟨“ z ”⟩ / x]˙ φ
64 48 63 imbi12d y = x prefix x 1 [˙y / x]˙ φ [˙y ++ ⟨“ z ”⟩ / x]˙ φ [˙x prefix x 1 / x]˙ φ [˙x prefix x 1 ++ ⟨“ z ”⟩ / x]˙ φ
65 s1eq z = lastS x ⟨“ z ”⟩ = ⟨“ lastS x ”⟩
66 65 oveq2d z = lastS x x prefix x 1 ++ ⟨“ z ”⟩ = x prefix x 1 ++ ⟨“ lastS x ”⟩
67 66 sbceq1d z = lastS x [˙x prefix x 1 ++ ⟨“ z ”⟩ / x]˙ φ [˙x prefix x 1 ++ ⟨“ lastS x ”⟩ / x]˙ φ
68 67 imbi2d z = lastS x [˙x prefix x 1 / x]˙ φ [˙x prefix x 1 ++ ⟨“ z ”⟩ / x]˙ φ [˙x prefix x 1 / x]˙ φ [˙x prefix x 1 ++ ⟨“ lastS x ”⟩ / x]˙ φ
69 ovex y ++ ⟨“ z ”⟩ V
70 69 3 sbcie [˙y ++ ⟨“ z ”⟩ / x]˙ φ θ
71 6 47 70 3imtr4g y Word B z B [˙y / x]˙ φ [˙y ++ ⟨“ z ”⟩ / x]˙ φ
72 64 68 71 vtocl2ga x prefix x 1 Word B lastS x B [˙x prefix x 1 / x]˙ φ [˙x prefix x 1 ++ ⟨“ lastS x ”⟩ / x]˙ φ
73 53 61 72 syl2anc m 0 y Word B y = m χ x Word B x = m + 1 [˙x prefix x 1 / x]˙ φ [˙x prefix x 1 ++ ⟨“ lastS x ”⟩ / x]˙ φ
74 55 73 mpd m 0 y Word B y = m χ x Word B x = m + 1 [˙x prefix x 1 ++ ⟨“ lastS x ”⟩ / x]˙ φ
75 wrdfin x Word B x Fin
76 75 ad2antrl m 0 y Word B y = m χ x Word B x = m + 1 x Fin
77 hashnncl x Fin x x
78 76 77 syl m 0 y Word B y = m χ x Word B x = m + 1 x x
79 32 78 mpbid m 0 y Word B y = m χ x Word B x = m + 1 x
80 pfxlswccat x Word B x x prefix x 1 ++ ⟨“ lastS x ”⟩ = x
81 80 eqcomd x Word B x x = x prefix x 1 ++ ⟨“ lastS x ”⟩
82 27 79 81 syl2anc m 0 y Word B y = m χ x Word B x = m + 1 x = x prefix x 1 ++ ⟨“ lastS x ”⟩
83 sbceq1a x = x prefix x 1 ++ ⟨“ lastS x ”⟩ φ [˙x prefix x 1 ++ ⟨“ lastS x ”⟩ / x]˙ φ
84 82 83 syl m 0 y Word B y = m χ x Word B x = m + 1 φ [˙x prefix x 1 ++ ⟨“ lastS x ”⟩ / x]˙ φ
85 74 84 mpbird m 0 y Word B y = m χ x Word B x = m + 1 φ
86 85 expr m 0 y Word B y = m χ x Word B x = m + 1 φ
87 86 ralrimiva m 0 y Word B y = m χ x Word B x = m + 1 φ
88 87 ex m 0 y Word B y = m χ x Word B x = m + 1 φ
89 26 88 syl5bi m 0 x Word B x = m φ x Word B x = m + 1 φ
90 10 13 16 19 23 89 nn0ind A 0 x Word B x = A φ
91 7 90 syl A Word B x Word B x = A φ
92 eqidd A Word B A = A
93 fveqeq2 x = A x = A A = A
94 93 4 imbi12d x = A x = A φ A = A τ
95 94 rspcv A Word B x Word B x = A φ A = A τ
96 91 92 95 mp2d A Word B τ