Metamath Proof Explorer


Theorem numclwlk2lem2f

Description: R is a function mapping the "closed (n+2)-walks v(0) ... v(n-2) v(n-1) v(n) v(n+1) v(n+2) starting at X = v(0) = v(n+2) with v(n) =/= X" to the words representing the prefix v(0) ... v(n-2) v(n-1) v(n) of the walk. (Contributed by Alexander van der Vekens, 5-Oct-2018) (Revised by AV, 31-May-2021) (Proof shortened by AV, 23-Mar-2022) (Revised by AV, 1-Nov-2022)

Ref Expression
Hypotheses numclwwlk.v V = Vtx G
numclwwlk.q Q = v V , n w n WWalksN G | w 0 = v lastS w v
numclwwlk.h H = v V , n 2 w v ClWWalksNOn G n | w n 2 v
numclwwlk.r R = x X H N + 2 x prefix N + 1
Assertion numclwlk2lem2f G FriendGraph X V N R : X H N + 2 X Q N

Proof

Step Hyp Ref Expression
1 numclwwlk.v V = Vtx G
2 numclwwlk.q Q = v V , n w n WWalksN G | w 0 = v lastS w v
3 numclwwlk.h H = v V , n 2 w v ClWWalksNOn G n | w n 2 v
4 numclwwlk.r R = x X H N + 2 x prefix N + 1
5 nnnn0 N N 0
6 2z 2
7 6 a1i N 2
8 nn0pzuz N 0 2 N + 2 2
9 5 7 8 syl2anc N N + 2 2
10 9 anim2i X V N X V N + 2 2
11 10 3adant1 G FriendGraph X V N X V N + 2 2
12 3 numclwwlkovh X V N + 2 2 X H N + 2 = w N + 2 ClWWalksN G | w 0 = X w N + 2 - 2 w 0
13 12 eleq2d X V N + 2 2 x X H N + 2 x w N + 2 ClWWalksN G | w 0 = X w N + 2 - 2 w 0
14 11 13 syl G FriendGraph X V N x X H N + 2 x w N + 2 ClWWalksN G | w 0 = X w N + 2 - 2 w 0
15 fveq1 w = x w 0 = x 0
16 15 eqeq1d w = x w 0 = X x 0 = X
17 fveq1 w = x w N + 2 - 2 = x N + 2 - 2
18 17 15 neeq12d w = x w N + 2 - 2 w 0 x N + 2 - 2 x 0
19 16 18 anbi12d w = x w 0 = X w N + 2 - 2 w 0 x 0 = X x N + 2 - 2 x 0
20 19 elrab x w N + 2 ClWWalksN G | w 0 = X w N + 2 - 2 w 0 x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0
21 14 20 bitrdi G FriendGraph X V N x X H N + 2 x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0
22 peano2nn N N + 1
23 nnz N N
24 23 7 zaddcld N N + 2
25 uzid N + 2 N + 2 N + 2
26 24 25 syl N N + 2 N + 2
27 nncn N N
28 1cnd N 1
29 27 28 28 addassd N N + 1 + 1 = N + 1 + 1
30 1p1e2 1 + 1 = 2
31 30 a1i N 1 + 1 = 2
32 31 oveq2d N N + 1 + 1 = N + 2
33 29 32 eqtrd N N + 1 + 1 = N + 2
34 33 fveq2d N N + 1 + 1 = N + 2
35 26 34 eleqtrrd N N + 2 N + 1 + 1
36 22 35 jca N N + 1 N + 2 N + 1 + 1
37 36 3ad2ant3 G FriendGraph X V N N + 1 N + 2 N + 1 + 1
38 37 adantr G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 N + 1 N + 2 N + 1 + 1
39 simprl G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x N + 2 ClWWalksN G
40 wwlksubclwwlk N + 1 N + 2 N + 1 + 1 x N + 2 ClWWalksN G x prefix N + 1 N + 1 - 1 WWalksN G
41 38 39 40 sylc G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x prefix N + 1 N + 1 - 1 WWalksN G
42 pncan1 N N + 1 - 1 = N
43 42 eqcomd N N = N + 1 - 1
44 27 43 syl N N = N + 1 - 1
45 44 oveq1d N N WWalksN G = N + 1 - 1 WWalksN G
46 45 eleq2d N x prefix N + 1 N WWalksN G x prefix N + 1 N + 1 - 1 WWalksN G
47 46 3ad2ant3 G FriendGraph X V N x prefix N + 1 N WWalksN G x prefix N + 1 N + 1 - 1 WWalksN G
48 47 adantr G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x prefix N + 1 N WWalksN G x prefix N + 1 N + 1 - 1 WWalksN G
49 41 48 mpbird G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x prefix N + 1 N WWalksN G
50 1 clwwlknbp x N + 2 ClWWalksN G x Word V x = N + 2
51 simprl x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 x 0 = X
52 simprr N x = N + 2 x Word V x Word V
53 peano2nn0 N 0 N + 1 0
54 5 53 syl N N + 1 0
55 nnre N N
56 55 lep1d N N N + 1
57 elfz2nn0 N 0 N + 1 N 0 N + 1 0 N N + 1
58 5 54 56 57 syl3anbrc N N 0 N + 1
59 2cnd N 2
60 addsubass N 2 1 N + 2 - 1 = N + 2 - 1
61 2m1e1 2 1 = 1
62 61 oveq2i N + 2 - 1 = N + 1
63 60 62 eqtrdi N 2 1 N + 2 - 1 = N + 1
64 27 59 28 63 syl3anc N N + 2 - 1 = N + 1
65 64 oveq2d N 0 N + 2 - 1 = 0 N + 1
66 58 65 eleqtrrd N N 0 N + 2 - 1
67 elfzp1b N N + 2 N 0 N + 2 - 1 N + 1 1 N + 2
68 23 24 67 syl2anc N N 0 N + 2 - 1 N + 1 1 N + 2
69 66 68 mpbid N N + 1 1 N + 2
70 69 adantr N x = N + 2 x Word V N + 1 1 N + 2
71 oveq2 x = N + 2 1 x = 1 N + 2
72 71 eleq2d x = N + 2 N + 1 1 x N + 1 1 N + 2
73 72 ad2antrl N x = N + 2 x Word V N + 1 1 x N + 1 1 N + 2
74 70 73 mpbird N x = N + 2 x Word V N + 1 1 x
75 pfxfv0 x Word V N + 1 1 x x prefix N + 1 0 = x 0
76 52 74 75 syl2anc N x = N + 2 x Word V x prefix N + 1 0 = x 0
77 76 ex N x = N + 2 x Word V x prefix N + 1 0 = x 0
78 77 adantl X V N x = N + 2 x Word V x prefix N + 1 0 = x 0
79 78 impcom x = N + 2 x Word V X V N x prefix N + 1 0 = x 0
80 79 ad2antrl x 0 = X x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 x prefix N + 1 0 = x 0
81 simpl x 0 = X x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 x 0 = X
82 80 81 eqtrd x 0 = X x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 x prefix N + 1 0 = X
83 pfxfvlsw x Word V N + 1 1 x lastS x prefix N + 1 = x N + 1 - 1
84 52 74 83 syl2anc N x = N + 2 x Word V lastS x prefix N + 1 = x N + 1 - 1
85 27 42 syl N N + 1 - 1 = N
86 27 59 pncand N N + 2 - 2 = N
87 85 86 eqtr4d N N + 1 - 1 = N + 2 - 2
88 87 fveq2d N x N + 1 - 1 = x N + 2 - 2
89 88 adantr N x = N + 2 x Word V x N + 1 - 1 = x N + 2 - 2
90 84 89 eqtr2d N x = N + 2 x Word V x N + 2 - 2 = lastS x prefix N + 1
91 90 ex N x = N + 2 x Word V x N + 2 - 2 = lastS x prefix N + 1
92 91 adantl X V N x = N + 2 x Word V x N + 2 - 2 = lastS x prefix N + 1
93 92 impcom x = N + 2 x Word V X V N x N + 2 - 2 = lastS x prefix N + 1
94 93 neeq1d x = N + 2 x Word V X V N x N + 2 - 2 x 0 lastS x prefix N + 1 x 0
95 94 biimpcd x N + 2 - 2 x 0 x = N + 2 x Word V X V N lastS x prefix N + 1 x 0
96 95 adantl x 0 = X x N + 2 - 2 x 0 x = N + 2 x Word V X V N lastS x prefix N + 1 x 0
97 96 impcom x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 lastS x prefix N + 1 x 0
98 97 adantl x 0 = X x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 lastS x prefix N + 1 x 0
99 neeq2 X = x 0 lastS x prefix N + 1 X lastS x prefix N + 1 x 0
100 99 eqcoms x 0 = X lastS x prefix N + 1 X lastS x prefix N + 1 x 0
101 100 adantr x 0 = X x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 lastS x prefix N + 1 X lastS x prefix N + 1 x 0
102 98 101 mpbird x 0 = X x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 lastS x prefix N + 1 X
103 82 102 jca x 0 = X x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 x prefix N + 1 0 = X lastS x prefix N + 1 X
104 51 103 mpancom x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 x prefix N + 1 0 = X lastS x prefix N + 1 X
105 104 exp31 x = N + 2 x Word V X V N x 0 = X x N + 2 - 2 x 0 x prefix N + 1 0 = X lastS x prefix N + 1 X
106 105 com23 x = N + 2 x Word V x 0 = X x N + 2 - 2 x 0 X V N x prefix N + 1 0 = X lastS x prefix N + 1 X
107 106 ancoms x Word V x = N + 2 x 0 = X x N + 2 - 2 x 0 X V N x prefix N + 1 0 = X lastS x prefix N + 1 X
108 50 107 syl x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 X V N x prefix N + 1 0 = X lastS x prefix N + 1 X
109 108 imp x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 X V N x prefix N + 1 0 = X lastS x prefix N + 1 X
110 109 com12 X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x prefix N + 1 0 = X lastS x prefix N + 1 X
111 110 3adant1 G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x prefix N + 1 0 = X lastS x prefix N + 1 X
112 111 imp G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x prefix N + 1 0 = X lastS x prefix N + 1 X
113 49 112 jca G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x prefix N + 1 N WWalksN G x prefix N + 1 0 = X lastS x prefix N + 1 X
114 113 ex G FriendGraph X V N x N + 2 ClWWalksN G x 0 = X x N + 2 - 2 x 0 x prefix N + 1 N WWalksN G x prefix N + 1 0 = X lastS x prefix N + 1 X
115 21 114 sylbid G FriendGraph X V N x X H N + 2 x prefix N + 1 N WWalksN G x prefix N + 1 0 = X lastS x prefix N + 1 X
116 115 imp G FriendGraph X V N x X H N + 2 x prefix N + 1 N WWalksN G x prefix N + 1 0 = X lastS x prefix N + 1 X
117 3simpc G FriendGraph X V N X V N
118 117 adantr G FriendGraph X V N x X H N + 2 X V N
119 1 2 numclwwlkovq X V N X Q N = w N WWalksN G | w 0 = X lastS w X
120 118 119 syl G FriendGraph X V N x X H N + 2 X Q N = w N WWalksN G | w 0 = X lastS w X
121 120 eleq2d G FriendGraph X V N x X H N + 2 x prefix N + 1 X Q N x prefix N + 1 w N WWalksN G | w 0 = X lastS w X
122 fveq1 w = x prefix N + 1 w 0 = x prefix N + 1 0
123 122 eqeq1d w = x prefix N + 1 w 0 = X x prefix N + 1 0 = X
124 fveq2 w = x prefix N + 1 lastS w = lastS x prefix N + 1
125 124 neeq1d w = x prefix N + 1 lastS w X lastS x prefix N + 1 X
126 123 125 anbi12d w = x prefix N + 1 w 0 = X lastS w X x prefix N + 1 0 = X lastS x prefix N + 1 X
127 126 elrab x prefix N + 1 w N WWalksN G | w 0 = X lastS w X x prefix N + 1 N WWalksN G x prefix N + 1 0 = X lastS x prefix N + 1 X
128 121 127 bitrdi G FriendGraph X V N x X H N + 2 x prefix N + 1 X Q N x prefix N + 1 N WWalksN G x prefix N + 1 0 = X lastS x prefix N + 1 X
129 116 128 mpbird G FriendGraph X V N x X H N + 2 x prefix N + 1 X Q N
130 129 4 fmptd G FriendGraph X V N R : X H N + 2 X Q N