Metamath Proof Explorer


Theorem pfxswrd

Description: A prefix of a subword is a subword. (Contributed by AV, 2-Apr-2018) (Revised by AV, 8-May-2020)

Ref Expression
Assertion pfxswrd W Word V N 0 W M 0 N L 0 N M W substr M N prefix L = W substr M M + L

Proof

Step Hyp Ref Expression
1 ovexd W Word V N 0 W M 0 N W substr M N V
2 elfznn0 L 0 N M L 0
3 pfxval W substr M N V L 0 W substr M N prefix L = W substr M N substr 0 L
4 1 2 3 syl2an W Word V N 0 W M 0 N L 0 N M W substr M N prefix L = W substr M N substr 0 L
5 fznn0sub M 0 N N M 0
6 5 3ad2ant3 W Word V N 0 W M 0 N N M 0
7 0elfz N M 0 0 0 N M
8 6 7 syl W Word V N 0 W M 0 N 0 0 N M
9 8 anim1i W Word V N 0 W M 0 N L 0 N M 0 0 N M L 0 N M
10 swrdswrd W Word V N 0 W M 0 N 0 0 N M L 0 N M W substr M N substr 0 L = W substr M + 0 M + L
11 10 imp W Word V N 0 W M 0 N 0 0 N M L 0 N M W substr M N substr 0 L = W substr M + 0 M + L
12 9 11 syldan W Word V N 0 W M 0 N L 0 N M W substr M N substr 0 L = W substr M + 0 M + L
13 elfznn0 M 0 N M 0
14 nn0cn M 0 M
15 14 addid1d M 0 M + 0 = M
16 13 15 syl M 0 N M + 0 = M
17 16 3ad2ant3 W Word V N 0 W M 0 N M + 0 = M
18 17 adantr W Word V N 0 W M 0 N L 0 N M M + 0 = M
19 18 opeq1d W Word V N 0 W M 0 N L 0 N M M + 0 M + L = M M + L
20 19 oveq2d W Word V N 0 W M 0 N L 0 N M W substr M + 0 M + L = W substr M M + L
21 4 12 20 3eqtrd W Word V N 0 W M 0 N L 0 N M W substr M N prefix L = W substr M M + L
22 21 ex W Word V N 0 W M 0 N L 0 N M W substr M N prefix L = W substr M M + L