Metamath Proof Explorer


Theorem swrd2lsw

Description: Extract the last two symbols from a word. (Contributed by Alexander van der Vekens, 23-Sep-2018)

Ref Expression
Assertion swrd2lsw W Word V 1 < W W substr W 2 W = ⟨“ W W 2 lastS W ”⟩

Proof

Step Hyp Ref Expression
1 simpl W Word V 1 < W W Word V
2 lencl W Word V W 0
3 1z 1
4 nn0z W 0 W
5 zltp1le 1 W 1 < W 1 + 1 W
6 3 4 5 sylancr W 0 1 < W 1 + 1 W
7 1p1e2 1 + 1 = 2
8 7 a1i W 0 1 + 1 = 2
9 8 breq1d W 0 1 + 1 W 2 W
10 9 biimpd W 0 1 + 1 W 2 W
11 6 10 sylbid W 0 1 < W 2 W
12 11 imp W 0 1 < W 2 W
13 2nn0 2 0
14 13 jctl W 0 2 0 W 0
15 14 adantr W 0 1 < W 2 0 W 0
16 nn0sub 2 0 W 0 2 W W 2 0
17 15 16 syl W 0 1 < W 2 W W 2 0
18 12 17 mpbid W 0 1 < W W 2 0
19 2 18 sylan W Word V 1 < W W 2 0
20 0red W 0
21 1red W 1
22 zre W W
23 20 21 22 3jca W 0 1 W
24 0lt1 0 < 1
25 lttr 0 1 W 0 < 1 1 < W 0 < W
26 25 expd 0 1 W 0 < 1 1 < W 0 < W
27 23 24 26 mpisyl W 1 < W 0 < W
28 elnnz W W 0 < W
29 28 simplbi2 W 0 < W W
30 27 29 syld W 1 < W W
31 4 30 syl W 0 1 < W W
32 31 imp W 0 1 < W W
33 fzo0end W W 1 0 ..^ W
34 32 33 syl W 0 1 < W W 1 0 ..^ W
35 nn0cn W 0 W
36 2cn 2
37 36 a1i W 0 2
38 1cnd W 0 1
39 35 37 38 3jca W 0 W 2 1
40 1e2m1 1 = 2 1
41 40 a1i W 2 1 1 = 2 1
42 41 oveq2d W 2 1 W 1 = W 2 1
43 subsub W 2 1 W 2 1 = W - 2 + 1
44 42 43 eqtrd W 2 1 W 1 = W - 2 + 1
45 39 44 syl W 0 W 1 = W - 2 + 1
46 45 eqcomd W 0 W - 2 + 1 = W 1
47 46 eleq1d W 0 W - 2 + 1 0 ..^ W W 1 0 ..^ W
48 47 adantr W 0 1 < W W - 2 + 1 0 ..^ W W 1 0 ..^ W
49 34 48 mpbird W 0 1 < W W - 2 + 1 0 ..^ W
50 2 49 sylan W Word V 1 < W W - 2 + 1 0 ..^ W
51 1 19 50 3jca W Word V 1 < W W Word V W 2 0 W - 2 + 1 0 ..^ W
52 swrds2 W Word V W 2 0 W - 2 + 1 0 ..^ W W substr W 2 W - 2 + 2 = ⟨“ W W 2 W W - 2 + 1 ”⟩
53 51 52 syl W Word V 1 < W W substr W 2 W - 2 + 2 = ⟨“ W W 2 W W - 2 + 1 ”⟩
54 35 36 jctir W 0 W 2
55 npcan W 2 W - 2 + 2 = W
56 55 eqcomd W 2 W = W - 2 + 2
57 2 54 56 3syl W Word V W = W - 2 + 2
58 57 adantr W Word V 1 < W W = W - 2 + 2
59 58 opeq2d W Word V 1 < W W 2 W = W 2 W - 2 + 2
60 59 oveq2d W Word V 1 < W W substr W 2 W = W substr W 2 W - 2 + 2
61 eqidd W Word V 1 < W W W 2 = W W 2
62 lsw W Word V lastS W = W W 1
63 39 43 syl W 0 W 2 1 = W - 2 + 1
64 63 eqcomd W 0 W - 2 + 1 = W 2 1
65 2m1e1 2 1 = 1
66 65 a1i W 0 2 1 = 1
67 66 oveq2d W 0 W 2 1 = W 1
68 64 67 eqtrd W 0 W - 2 + 1 = W 1
69 2 68 syl W Word V W - 2 + 1 = W 1
70 69 eqcomd W Word V W 1 = W - 2 + 1
71 70 fveq2d W Word V W W 1 = W W - 2 + 1
72 62 71 eqtrd W Word V lastS W = W W - 2 + 1
73 72 adantr W Word V 1 < W lastS W = W W - 2 + 1
74 61 73 s2eqd W Word V 1 < W ⟨“ W W 2 lastS W ”⟩ = ⟨“ W W 2 W W - 2 + 1 ”⟩
75 53 60 74 3eqtr4d W Word V 1 < W W substr W 2 W = ⟨“ W W 2 lastS W ”⟩