Metamath Proof Explorer


Theorem swrdlsw

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

Ref Expression
Assertion swrdlsw WWordVWWsubstrW1W=⟨“lastSW”⟩

Proof

Step Hyp Ref Expression
1 hashneq0 WWordV0<WW
2 lencl WWordVW0
3 nn0z W0W
4 elnnz WW0<W
5 fzo0end WW10..^W
6 4 5 sylbir W0<WW10..^W
7 6 ex W0<WW10..^W
8 2 3 7 3syl WWordV0<WW10..^W
9 1 8 sylbird WWordVWW10..^W
10 9 imp WWordVWW10..^W
11 swrds1 WWordVW10..^WWsubstrW1W-1+1=⟨“WW1”⟩
12 10 11 syldan WWordVWWsubstrW1W-1+1=⟨“WW1”⟩
13 nn0cn W0W
14 ax-1cn 1
15 13 14 jctir W0W1
16 npcan W1W-1+1=W
17 16 eqcomd W1W=W-1+1
18 2 15 17 3syl WWordVW=W-1+1
19 18 adantr WWordVWW=W-1+1
20 19 opeq2d WWordVWW1W=W1W-1+1
21 20 oveq2d WWordVWWsubstrW1W=WsubstrW1W-1+1
22 lsw WWordVlastSW=WW1
23 22 adantr WWordVWlastSW=WW1
24 23 s1eqd WWordVW⟨“lastSW”⟩=⟨“WW1”⟩
25 12 21 24 3eqtr4d WWordVWWsubstrW1W=⟨“lastSW”⟩