reserve G for Graph,
  v, v1, v2 for Vertex of G,
  c for Chain of G,
  p, p1, p2 for Path of G,
  vs, vs1, vs2 for FinSequence of the carrier of G,
  e, X for set,
  n, m for Nat;
reserve G for finite Graph,
  v for Vertex of G,
  c for Chain of G,
  vs for FinSequence of the carrier of G,
  X1, X2 for set;
reserve G for Graph,
  v, v1, v2 for Vertex of G,
  c for Chain of G,
  p for Path of G,
  vs for FinSequence of the carrier of G,
  v9 for Vertex of AddNewEdge(v1, v2),
  p9 for Path of AddNewEdge(v1, v2),
  vs9 for FinSequence of the carrier of AddNewEdge(v1, v2);
reserve G for finite Graph,
  v, v1, v2 for Vertex of G,
  vs for FinSequence of the carrier of G,
  v9 for Vertex of AddNewEdge(v1, v2);

theorem Th50: :: CycVerDeg2
  for c being Path of G st c is non cyclic & vs is_vertex_seq_of c
  holds Degree(v, rng c) is even iff v <> vs.1 & v <> vs.len vs
proof
  let c be Path of G such that
A1: c is non cyclic and
A2: vs is_vertex_seq_of c;
  len vs = len c +1 by A2;
  then
A3: 1 <= len vs by NAT_1:11;
  then 1 in dom vs & len vs in dom vs by FINSEQ_3:25;
  then reconsider v1 = vs.1, v2 = vs.len vs as Vertex of G by FINSEQ_2:11;
A4: v1 <> v2 by A1,A2;
  set G9 = AddNewEdge(v1, v2);
  reconsider vs9 = vs as FinSequence of the carrier of G9 by Def7;
  reconsider c9 = c as Path of G9 by Th37;
A5: vs9 is_vertex_seq_of c9 by A2,Th36;
  reconsider v9 = v, v19 = v1, v29 = v2 as Vertex of G9 by Def7;
  set v219 = <*v29, v19*>;
  set vs9e = vs9^'<*v29, v19*>;
  len v219 = 2 by FINSEQ_1:44;
  then
A6: vs9e.len vs9e = v219.2 by FINSEQ_6:142;
  set E = the carrier' of G;
  set e = E;
A7: e in {E} by TARSKI:def 1;
  the carrier' of G9 = (the carrier' of G) \/ {E} by Def7;
  then e in the carrier' of G9 by A7,XBOOLE_0:def 3;
  then reconsider ep = <*e*> as Path of G9 by Th4;
A8: rng ep = {e} by FINSEQ_1:39;
A9: not e in e;
  then rng ep misses E by A8,ZFMISC_1:50;
  then
A10: rng ep /\ E = {};
  (the Source of G9).e = v19 & (the Target of G9).e = v29 by Th34;
  then
A11: vs9.len vs9 = <*v29,v19*>.1 & <*v29,v19*> is_vertex_seq_of ep by Th11;
A12: rng c c= the carrier' of G by FINSEQ_1:def 4;
  then
A13: not e in rng c by A9;
  rng c9 misses rng ep
  proof
    assume not thesis;
    then ex x being object st x in rng c9 & x in rng ep by XBOOLE_0:3;
    hence contradiction by A13,A8,TARSKI:def 1;
  end;
  then reconsider c9e = c9^ep as Path of G9 by A5,A11,Th6;
A14: vs9e is_vertex_seq_of c9e by A5,A11,GRAPH_2:44;
  vs9e.1 = vs.1 by A3,FINSEQ_6:140;
  then vs9e.1 = vs9e.len vs9e by A6;
  then reconsider c9e as cyclic Path of G9 by A14,MSSCYC_1:def 2;
  rng c9e = rng c \/ rng ep by FINSEQ_1:31;
  then
A15: e in rng c9e by A7,A8,XBOOLE_0:def 3;
A16: rng c9e /\ E = (rng c \/ rng ep) /\ E by FINSEQ_1:31
    .= (rng c /\ E) \/ {} by A10,XBOOLE_1:23
    .= rng c by A12,XBOOLE_1:28;
  then
A17: Degree(v, rng c9e) = Degree(v, rng c) by Th31;
  reconsider dv9 = Degree(v9, rng c9e) as even Element of NAT by Th49;
A18: Degree(v9, rng c9e) is even by Th49;
  per cases;
  suppose
    v <> v1 & v <> v2;
    hence thesis by A18,A17,Th48;
  end;
  suppose
A19: v = v1 or v = v2;
    then Degree(v9, rng c9e) = Degree(v, rng c9e) +1 by A4,A15,Th47;
    then Degree(v, rng c9e) = dv9 -1;
    hence thesis by A16,A19,Th31;
  end;
end;
