Metamath Proof Explorer


Theorem clwwlknlbonbgr1

Description: The last but one vertex in a closed walk is a neighbor of the first vertex of the closed walk. (Contributed by AV, 17-Feb-2022)

Ref Expression
Assertion clwwlknlbonbgr1 ( ( 𝐺 ∈ USGraph ∧ 𝑊 ∈ ( 𝑁 ClWWalksN 𝐺 ) ) → ( 𝑊 ‘ ( 𝑁 − 1 ) ) ∈ ( 𝐺 NeighbVtx ( 𝑊 ‘ 0 ) ) )

Proof

Step Hyp Ref Expression
1 eqid ( Vtx ‘ 𝐺 ) = ( Vtx ‘ 𝐺 )
2 eqid ( Edg ‘ 𝐺 ) = ( Edg ‘ 𝐺 )
3 1 2 clwwlknp ( 𝑊 ∈ ( 𝑁 ClWWalksN 𝐺 ) → ( ( 𝑊 ∈ Word ( Vtx ‘ 𝐺 ) ∧ ( ♯ ‘ 𝑊 ) = 𝑁 ) ∧ ∀ 𝑖 ∈ ( 0 ..^ ( 𝑁 − 1 ) ) { ( 𝑊𝑖 ) , ( 𝑊 ‘ ( 𝑖 + 1 ) ) } ∈ ( Edg ‘ 𝐺 ) ∧ { ( lastS ‘ 𝑊 ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) ) )
4 lsw ( 𝑊 ∈ Word ( Vtx ‘ 𝐺 ) → ( lastS ‘ 𝑊 ) = ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) )
5 fvoveq1 ( ( ♯ ‘ 𝑊 ) = 𝑁 → ( 𝑊 ‘ ( ( ♯ ‘ 𝑊 ) − 1 ) ) = ( 𝑊 ‘ ( 𝑁 − 1 ) ) )
6 4 5 sylan9eq ( ( 𝑊 ∈ Word ( Vtx ‘ 𝐺 ) ∧ ( ♯ ‘ 𝑊 ) = 𝑁 ) → ( lastS ‘ 𝑊 ) = ( 𝑊 ‘ ( 𝑁 − 1 ) ) )
7 6 preq1d ( ( 𝑊 ∈ Word ( Vtx ‘ 𝐺 ) ∧ ( ♯ ‘ 𝑊 ) = 𝑁 ) → { ( lastS ‘ 𝑊 ) , ( 𝑊 ‘ 0 ) } = { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } )
8 7 eleq1d ( ( 𝑊 ∈ Word ( Vtx ‘ 𝐺 ) ∧ ( ♯ ‘ 𝑊 ) = 𝑁 ) → ( { ( lastS ‘ 𝑊 ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) ↔ { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) ) )
9 8 biimpd ( ( 𝑊 ∈ Word ( Vtx ‘ 𝐺 ) ∧ ( ♯ ‘ 𝑊 ) = 𝑁 ) → ( { ( lastS ‘ 𝑊 ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) → { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) ) )
10 9 a1d ( ( 𝑊 ∈ Word ( Vtx ‘ 𝐺 ) ∧ ( ♯ ‘ 𝑊 ) = 𝑁 ) → ( ∀ 𝑖 ∈ ( 0 ..^ ( 𝑁 − 1 ) ) { ( 𝑊𝑖 ) , ( 𝑊 ‘ ( 𝑖 + 1 ) ) } ∈ ( Edg ‘ 𝐺 ) → ( { ( lastS ‘ 𝑊 ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) → { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) ) ) )
11 10 3imp ( ( ( 𝑊 ∈ Word ( Vtx ‘ 𝐺 ) ∧ ( ♯ ‘ 𝑊 ) = 𝑁 ) ∧ ∀ 𝑖 ∈ ( 0 ..^ ( 𝑁 − 1 ) ) { ( 𝑊𝑖 ) , ( 𝑊 ‘ ( 𝑖 + 1 ) ) } ∈ ( Edg ‘ 𝐺 ) ∧ { ( lastS ‘ 𝑊 ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) ) → { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) )
12 3 11 syl ( 𝑊 ∈ ( 𝑁 ClWWalksN 𝐺 ) → { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) )
13 12 adantl ( ( 𝐺 ∈ USGraph ∧ 𝑊 ∈ ( 𝑁 ClWWalksN 𝐺 ) ) → { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) )
14 2 nbusgreledg ( 𝐺 ∈ USGraph → ( ( 𝑊 ‘ ( 𝑁 − 1 ) ) ∈ ( 𝐺 NeighbVtx ( 𝑊 ‘ 0 ) ) ↔ { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) ) )
15 14 adantr ( ( 𝐺 ∈ USGraph ∧ 𝑊 ∈ ( 𝑁 ClWWalksN 𝐺 ) ) → ( ( 𝑊 ‘ ( 𝑁 − 1 ) ) ∈ ( 𝐺 NeighbVtx ( 𝑊 ‘ 0 ) ) ↔ { ( 𝑊 ‘ ( 𝑁 − 1 ) ) , ( 𝑊 ‘ 0 ) } ∈ ( Edg ‘ 𝐺 ) ) )
16 13 15 mpbird ( ( 𝐺 ∈ USGraph ∧ 𝑊 ∈ ( 𝑁 ClWWalksN 𝐺 ) ) → ( 𝑊 ‘ ( 𝑁 − 1 ) ) ∈ ( 𝐺 NeighbVtx ( 𝑊 ‘ 0 ) ) )