Metamath Proof Explorer


Theorem wlklenvclwlk

Description: The number of vertices in a walk equals the length of the walk after it is "closed" (i.e. enhanced by an edge from its last vertex to its first vertex). (Contributed by Alexander van der Vekens, 29-Jun-2018) (Revised by AV, 2-May-2021) (Revised by JJ, 14-Jan-2024)

Ref Expression
Assertion wlklenvclwlk
|- ( W e. Word ( Vtx ` G ) -> ( <. F , ( W ++ <" ( W ` 0 ) "> ) >. e. ( Walks ` G ) -> ( # ` F ) = ( # ` W ) ) )

Proof

Step Hyp Ref Expression
1 df-br
 |-  ( F ( Walks ` G ) ( W ++ <" ( W ` 0 ) "> ) <-> <. F , ( W ++ <" ( W ` 0 ) "> ) >. e. ( Walks ` G ) )
2 wlkcl
 |-  ( F ( Walks ` G ) ( W ++ <" ( W ` 0 ) "> ) -> ( # ` F ) e. NN0 )
3 wlklenvp1
 |-  ( F ( Walks ` G ) ( W ++ <" ( W ` 0 ) "> ) -> ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` F ) + 1 ) )
4 2 3 jca
 |-  ( F ( Walks ` G ) ( W ++ <" ( W ` 0 ) "> ) -> ( ( # ` F ) e. NN0 /\ ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` F ) + 1 ) ) )
5 1 4 sylbir
 |-  ( <. F , ( W ++ <" ( W ` 0 ) "> ) >. e. ( Walks ` G ) -> ( ( # ` F ) e. NN0 /\ ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` F ) + 1 ) ) )
6 ccatws1len
 |-  ( W e. Word ( Vtx ` G ) -> ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` W ) + 1 ) )
7 6 eqeq1d
 |-  ( W e. Word ( Vtx ` G ) -> ( ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` F ) + 1 ) <-> ( ( # ` W ) + 1 ) = ( ( # ` F ) + 1 ) ) )
8 eqcom
 |-  ( ( ( # ` W ) + 1 ) = ( ( # ` F ) + 1 ) <-> ( ( # ` F ) + 1 ) = ( ( # ` W ) + 1 ) )
9 7 8 bitrdi
 |-  ( W e. Word ( Vtx ` G ) -> ( ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` F ) + 1 ) <-> ( ( # ` F ) + 1 ) = ( ( # ` W ) + 1 ) ) )
10 9 adantr
 |-  ( ( W e. Word ( Vtx ` G ) /\ ( # ` F ) e. NN0 ) -> ( ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` F ) + 1 ) <-> ( ( # ` F ) + 1 ) = ( ( # ` W ) + 1 ) ) )
11 nn0cn
 |-  ( ( # ` F ) e. NN0 -> ( # ` F ) e. CC )
12 11 adantl
 |-  ( ( W e. Word ( Vtx ` G ) /\ ( # ` F ) e. NN0 ) -> ( # ` F ) e. CC )
13 lencl
 |-  ( W e. Word ( Vtx ` G ) -> ( # ` W ) e. NN0 )
14 13 nn0cnd
 |-  ( W e. Word ( Vtx ` G ) -> ( # ` W ) e. CC )
15 14 adantr
 |-  ( ( W e. Word ( Vtx ` G ) /\ ( # ` F ) e. NN0 ) -> ( # ` W ) e. CC )
16 1cnd
 |-  ( ( W e. Word ( Vtx ` G ) /\ ( # ` F ) e. NN0 ) -> 1 e. CC )
17 12 15 16 addcan2d
 |-  ( ( W e. Word ( Vtx ` G ) /\ ( # ` F ) e. NN0 ) -> ( ( ( # ` F ) + 1 ) = ( ( # ` W ) + 1 ) <-> ( # ` F ) = ( # ` W ) ) )
18 17 biimpd
 |-  ( ( W e. Word ( Vtx ` G ) /\ ( # ` F ) e. NN0 ) -> ( ( ( # ` F ) + 1 ) = ( ( # ` W ) + 1 ) -> ( # ` F ) = ( # ` W ) ) )
19 10 18 sylbid
 |-  ( ( W e. Word ( Vtx ` G ) /\ ( # ` F ) e. NN0 ) -> ( ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` F ) + 1 ) -> ( # ` F ) = ( # ` W ) ) )
20 19 expimpd
 |-  ( W e. Word ( Vtx ` G ) -> ( ( ( # ` F ) e. NN0 /\ ( # ` ( W ++ <" ( W ` 0 ) "> ) ) = ( ( # ` F ) + 1 ) ) -> ( # ` F ) = ( # ` W ) ) )
21 5 20 syl5
 |-  ( W e. Word ( Vtx ` G ) -> ( <. F , ( W ++ <" ( W ` 0 ) "> ) >. e. ( Walks ` G ) -> ( # ` F ) = ( # ` W ) ) )