Metamath Proof Explorer


Theorem clwwlkinwwlk

Description: If the initial vertex of a walk occurs another time in the walk, the walk starts with a closed walk. Since the walk is expressed as a word over vertices, the closed walk can be expressed as a subword of this word. (Contributed by Alexander van der Vekens, 15-Sep-2018) (Revised by AV, 23-Jan-2022) (Revised by AV, 30-Oct-2022)

Ref Expression
Assertion clwwlkinwwlk N M N W M WWalksN G W N = W 0 W prefix N N ClWWalksN G

Proof

Step Hyp Ref Expression
1 eqid Vtx G = Vtx G
2 eqid Edg G = Edg G
3 1 2 wwlknp W M WWalksN G W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G
4 pfxcl W Word Vtx G W prefix N Word Vtx G
5 4 adantr W Word Vtx G W = M + 1 W prefix N Word Vtx G
6 5 adantr W Word Vtx G W = M + 1 N M N W prefix N Word Vtx G
7 simpll W Word Vtx G W = M + 1 N M N W Word Vtx G
8 simprl W Word Vtx G W = M + 1 N M N N
9 eluz2 M N N M N M
10 zre N N
11 zre M M
12 id N M N M
13 10 11 12 3anim123i N M N M N M N M
14 9 13 sylbi M N N M N M
15 letrp1 N M N M N M + 1
16 14 15 syl M N N M + 1
17 16 adantl N M N N M + 1
18 17 adantl W Word Vtx G W = M + 1 N M N N M + 1
19 breq2 W = M + 1 N W N M + 1
20 19 ad2antlr W Word Vtx G W = M + 1 N M N N W N M + 1
21 18 20 mpbird W Word Vtx G W = M + 1 N M N N W
22 pfxn0 W Word Vtx G N N W W prefix N
23 7 8 21 22 syl3anc W Word Vtx G W = M + 1 N M N W prefix N
24 6 23 jca W Word Vtx G W = M + 1 N M N W prefix N Word Vtx G W prefix N
25 24 3adantl3 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W prefix N Word Vtx G W prefix N
26 25 adantr W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 W prefix N Word Vtx G W prefix N
27 nnz N N
28 1nn0 1 0
29 eluzmn N 1 0 N N 1
30 27 28 29 sylancl N N N 1
31 uzss N N 1 N N 1
32 30 31 syl N N N 1
33 32 sselda N M N M N 1
34 fzoss2 M N 1 0 ..^ N 1 0 ..^ M
35 33 34 syl N M N 0 ..^ N 1 0 ..^ M
36 35 3ad2ant3 W Word Vtx G W = M + 1 N M N 0 ..^ N 1 0 ..^ M
37 ssralv 0 ..^ N 1 0 ..^ M i 0 ..^ M W i W i + 1 Edg G i 0 ..^ N 1 W i W i + 1 Edg G
38 36 37 syl W Word Vtx G W = M + 1 N M N i 0 ..^ M W i W i + 1 Edg G i 0 ..^ N 1 W i W i + 1 Edg G
39 38 3exp W Word Vtx G W = M + 1 N M N i 0 ..^ M W i W i + 1 Edg G i 0 ..^ N 1 W i W i + 1 Edg G
40 39 com34 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N i 0 ..^ N 1 W i W i + 1 Edg G
41 40 3imp1 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N i 0 ..^ N 1 W i W i + 1 Edg G
42 41 adantr W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 i 0 ..^ N 1 W i W i + 1 Edg G
43 nnnn0 N N 0
44 elnn0uz N 0 N 0
45 43 44 sylib N N 0
46 eluzfz N 0 M N N 0 M
47 45 46 sylan N M N N 0 M
48 fzelp1 N 0 M N 0 M + 1
49 47 48 syl N M N N 0 M + 1
50 49 adantl W Word Vtx G W = M + 1 N M N N 0 M + 1
51 oveq2 W = M + 1 0 W = 0 M + 1
52 51 eleq2d W = M + 1 N 0 W N 0 M + 1
53 52 ad2antlr W Word Vtx G W = M + 1 N M N N 0 W N 0 M + 1
54 50 53 mpbird W Word Vtx G W = M + 1 N M N N 0 W
55 pfxlen W Word Vtx G N 0 W W prefix N = N
56 7 54 55 syl2anc W Word Vtx G W = M + 1 N M N W prefix N = N
57 56 oveq1d W Word Vtx G W = M + 1 N M N W prefix N 1 = N 1
58 57 oveq2d W Word Vtx G W = M + 1 N M N 0 ..^ W prefix N 1 = 0 ..^ N 1
59 58 raleqdv W Word Vtx G W = M + 1 N M N i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G i 0 ..^ N 1 W prefix N i W prefix N i + 1 Edg G
60 7 adantr W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 W Word Vtx G
61 54 adantr W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 N 0 W
62 30 ad2antrl W Word Vtx G W = M + 1 N M N N N 1
63 fzoss2 N N 1 0 ..^ N 1 0 ..^ N
64 62 63 syl W Word Vtx G W = M + 1 N M N 0 ..^ N 1 0 ..^ N
65 64 sselda W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 i 0 ..^ N
66 pfxfv W Word Vtx G N 0 W i 0 ..^ N W prefix N i = W i
67 60 61 65 66 syl3anc W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 W prefix N i = W i
68 27 ad2antrl W Word Vtx G W = M + 1 N M N N
69 elfzom1elp1fzo N i 0 ..^ N 1 i + 1 0 ..^ N
70 68 69 sylan W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 i + 1 0 ..^ N
71 pfxfv W Word Vtx G N 0 W i + 1 0 ..^ N W prefix N i + 1 = W i + 1
72 60 61 70 71 syl3anc W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 W prefix N i + 1 = W i + 1
73 67 72 preq12d W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 W prefix N i W prefix N i + 1 = W i W i + 1
74 73 eleq1d W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 W prefix N i W prefix N i + 1 Edg G W i W i + 1 Edg G
75 74 ralbidva W Word Vtx G W = M + 1 N M N i 0 ..^ N 1 W prefix N i W prefix N i + 1 Edg G i 0 ..^ N 1 W i W i + 1 Edg G
76 59 75 bitrd W Word Vtx G W = M + 1 N M N i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G i 0 ..^ N 1 W i W i + 1 Edg G
77 76 3adantl3 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G i 0 ..^ N 1 W i W i + 1 Edg G
78 77 adantr W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G i 0 ..^ N 1 W i W i + 1 Edg G
79 42 78 mpbird W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G
80 elfz1uz N M N N 1 M
81 fzelp1 N 1 M N 1 M + 1
82 80 81 syl N M N N 1 M + 1
83 82 adantl W Word Vtx G W = M + 1 N M N N 1 M + 1
84 oveq2 W = M + 1 1 W = 1 M + 1
85 84 eleq2d W = M + 1 N 1 W N 1 M + 1
86 85 ad2antlr W Word Vtx G W = M + 1 N M N N 1 W N 1 M + 1
87 83 86 mpbird W Word Vtx G W = M + 1 N M N N 1 W
88 pfxfvlsw W Word Vtx G N 1 W lastS W prefix N = W N 1
89 pfxfv0 W Word Vtx G N 1 W W prefix N 0 = W 0
90 88 89 preq12d W Word Vtx G N 1 W lastS W prefix N W prefix N 0 = W N 1 W 0
91 7 87 90 syl2anc W Word Vtx G W = M + 1 N M N lastS W prefix N W prefix N 0 = W N 1 W 0
92 91 3adantl3 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N lastS W prefix N W prefix N 0 = W N 1 W 0
93 92 adantr W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 lastS W prefix N W prefix N 0 = W N 1 W 0
94 fz1fzo0m1 N 1 M N 1 0 ..^ M
95 80 94 syl N M N N 1 0 ..^ M
96 95 3ad2ant3 W Word Vtx G W = M + 1 N M N N 1 0 ..^ M
97 simpr N i = N 1 i = N 1
98 97 fveq2d N i = N 1 W i = W N 1
99 oveq1 i = N 1 i + 1 = N - 1 + 1
100 nncn N N
101 npcan1 N N - 1 + 1 = N
102 100 101 syl N N - 1 + 1 = N
103 99 102 sylan9eqr N i = N 1 i + 1 = N
104 103 fveq2d N i = N 1 W i + 1 = W N
105 98 104 preq12d N i = N 1 W i W i + 1 = W N 1 W N
106 105 eleq1d N i = N 1 W i W i + 1 Edg G W N 1 W N Edg G
107 106 ex N i = N 1 W i W i + 1 Edg G W N 1 W N Edg G
108 107 adantr N M N i = N 1 W i W i + 1 Edg G W N 1 W N Edg G
109 108 3ad2ant3 W Word Vtx G W = M + 1 N M N i = N 1 W i W i + 1 Edg G W N 1 W N Edg G
110 109 imp W Word Vtx G W = M + 1 N M N i = N 1 W i W i + 1 Edg G W N 1 W N Edg G
111 96 110 rspcdv W Word Vtx G W = M + 1 N M N i 0 ..^ M W i W i + 1 Edg G W N 1 W N Edg G
112 111 3exp W Word Vtx G W = M + 1 N M N i 0 ..^ M W i W i + 1 Edg G W N 1 W N Edg G
113 112 com34 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N 1 W N Edg G
114 113 3imp1 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N 1 W N Edg G
115 114 adantr W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 W N 1 W N Edg G
116 preq2 W N = W 0 W N 1 W N = W N 1 W 0
117 116 eleq1d W N = W 0 W N 1 W N Edg G W N 1 W 0 Edg G
118 117 adantl W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 W N 1 W N Edg G W N 1 W 0 Edg G
119 115 118 mpbid W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 W N 1 W 0 Edg G
120 93 119 eqeltrd W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 lastS W prefix N W prefix N 0 Edg G
121 26 79 120 3jca W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 W prefix N Word Vtx G W prefix N i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G lastS W prefix N W prefix N 0 Edg G
122 121 exp31 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W N = W 0 W prefix N Word Vtx G W prefix N i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G lastS W prefix N W prefix N 0 Edg G
123 122 3imp21 N M N W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G W N = W 0 W prefix N Word Vtx G W prefix N i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G lastS W prefix N W prefix N 0 Edg G
124 1 2 isclwwlk W prefix N ClWWalks G W prefix N Word Vtx G W prefix N i 0 ..^ W prefix N 1 W prefix N i W prefix N i + 1 Edg G lastS W prefix N W prefix N 0 Edg G
125 123 124 sylibr N M N W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G W N = W 0 W prefix N ClWWalks G
126 47 adantl W Word Vtx G W = M + 1 N M N N 0 M
127 126 48 syl W Word Vtx G W = M + 1 N M N N 0 M + 1
128 127 53 mpbird W Word Vtx G W = M + 1 N M N N 0 W
129 7 128 jca W Word Vtx G W = M + 1 N M N W Word Vtx G N 0 W
130 129 ex W Word Vtx G W = M + 1 N M N W Word Vtx G N 0 W
131 130 3adant3 W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G N M N W Word Vtx G N 0 W
132 131 impcom N M N W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G W Word Vtx G N 0 W
133 132 3adant3 N M N W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G W N = W 0 W Word Vtx G N 0 W
134 133 55 syl N M N W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G W N = W 0 W prefix N = N
135 isclwwlkn W prefix N N ClWWalksN G W prefix N ClWWalks G W prefix N = N
136 125 134 135 sylanbrc N M N W Word Vtx G W = M + 1 i 0 ..^ M W i W i + 1 Edg G W N = W 0 W prefix N N ClWWalksN G
137 3 136 syl3an2 N M N W M WWalksN G W N = W 0 W prefix N N ClWWalksN G