Metamath Proof Explorer


Theorem lsw

Description: Extract the last symbol of a word. May be not meaningful for other sets which are not words. (Contributed by Alexander van der Vekens, 18-Mar-2018)

Ref Expression
Assertion lsw ( 𝑊𝑋 → ( lastS ‘ 𝑊 ) = ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) )

Proof

Step Hyp Ref Expression
1 elex ( 𝑊𝑋𝑊 ∈ V )
2 fvex ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) ∈ V
3 id ( 𝑤 = 𝑊𝑤 = 𝑊 )
4 fveq2 ( 𝑤 = 𝑊 → ( ♯ ‘ 𝑤 ) = ( ♯ ‘ 𝑊 ) )
5 4 oveq1d ( 𝑤 = 𝑊 → ( ( ♯ ‘ 𝑤 ) − 1 ) = ( ( ♯ ‘ 𝑊 ) − 1 ) )
6 3 5 fveq12d ( 𝑤 = 𝑊 → ( 𝑤 ‘ ( ( ♯ ‘ 𝑤 ) − 1 ) ) = ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) )
7 df-lsw lastS = ( 𝑤 ∈ V ↦ ( 𝑤 ‘ ( ( ♯ ‘ 𝑤 ) − 1 ) ) )
8 6 7 fvmptg ( ( 𝑊 ∈ V ∧ ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) ∈ V ) → ( lastS ‘ 𝑊 ) = ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) )
9 1 2 8 sylancl ( 𝑊𝑋 → ( lastS ‘ 𝑊 ) = ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) )