Metamath Proof Explorer


Theorem lswcl

Description: Closure of the last symbol: the last symbol of a not empty word belongs to the alphabet for the word. (Contributed by AV, 2-Aug-2018) (Proof shortened by AV, 29-Apr-2020)

Ref Expression
Assertion lswcl ( ( 𝑊 ∈ Word 𝑉𝑊 ≠ ∅ ) → ( lastS ‘ 𝑊 ) ∈ 𝑉 )

Proof

Step Hyp Ref Expression
1 lsw ( 𝑊 ∈ Word 𝑉 → ( lastS ‘ 𝑊 ) = ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) )
2 1 adantr ( ( 𝑊 ∈ Word 𝑉𝑊 ≠ ∅ ) → ( lastS ‘ 𝑊 ) = ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) )
3 lennncl ( ( 𝑊 ∈ Word 𝑉𝑊 ≠ ∅ ) → ( ♯ ‘ 𝑊 ) ∈ ℕ )
4 fzo0end ( ( ♯ ‘ 𝑊 ) ∈ ℕ → ( ( ♯ ‘ 𝑊 ) − 1 ) ∈ ( 0 ..^ ( ♯ ‘ 𝑊 ) ) )
5 3 4 syl ( ( 𝑊 ∈ Word 𝑉𝑊 ≠ ∅ ) → ( ( ♯ ‘ 𝑊 ) − 1 ) ∈ ( 0 ..^ ( ♯ ‘ 𝑊 ) ) )
6 wrdsymbcl ( ( 𝑊 ∈ Word 𝑉 ∧ ( ( ♯ ‘ 𝑊 ) − 1 ) ∈ ( 0 ..^ ( ♯ ‘ 𝑊 ) ) ) → ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) ∈ 𝑉 )
7 5 6 syldan ( ( 𝑊 ∈ Word 𝑉𝑊 ≠ ∅ ) → ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) ∈ 𝑉 )
8 2 7 eqeltrd ( ( 𝑊 ∈ Word 𝑉𝑊 ≠ ∅ ) → ( lastS ‘ 𝑊 ) ∈ 𝑉 )