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);
reserve G for Graph,
  v for Vertex of G,
  vs for FinSequence of the carrier of G;
reserve G for finite Graph,
  v for Vertex of G,
  vs for FinSequence of the carrier of G;

theorem :: Non-cyclic Euler paths
  for G being finite connected Graph holds (ex p being Path of G st p is
non cyclic & p is Eulerian) iff ex v1, v2 being Vertex of G st v1 <> v2 & for v
  being Vertex of G holds Degree v is even iff v<>v1 & v <> v2
proof
  let G be finite connected Graph;
  set V = the carrier of G, E = the carrier' of G;
A1: now
    assume {E} meets E;
    then consider x being object such that
A2: x in {E} and
A3: x in E by XBOOLE_0:3;
A:  x = E by A2,TARSKI:def 1;
    reconsider xx = x as set by TARSKI:1;
    not xx in xx;
    hence contradiction by A,A3;
  end;
  hereby
    given p being Path of G such that
A4: p is non cyclic and
A5: p is Eulerian;
    consider vs being FinSequence of the carrier of G such that
A6: vs is_vertex_seq_of p by GRAPH_2:33;
    len vs = len p +1 by A6;
    then 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;
    take v1, v2;
    thus v1 <> v2 by A4,A6;
    let v be Vertex of G;
    Degree v = Degree(v, the carrier' of G) by Th24
      .= Degree(v, rng p) by A5;
    hence Degree v is even iff v<>v1 & v <> v2 by A4,A6,Th50;
  end;
  given v1, v2 being Vertex of G such that
A7: v1 <> v2 and
A8: for v being Vertex of G holds Degree v is even iff v<>v1 & v <> v2;
  set G9 = AddNewEdge(v1, v2);
  set E9 = the carrier' of G9;
A9: the carrier' of G9 = (the carrier' of G) \/ {E} by Def7;
  E in {E} by TARSKI:def 1;
  then
A10: E in the carrier' of G9 by A9,XBOOLE_0:def 3;
A11: E = E9/\E by A9,XBOOLE_1:21;
  for v being Vertex of G9 holds Degree v is even
  proof
    let v9 be Vertex of G9;
    reconsider v = v9 as Vertex of G by Def7;
A12: Degree v9 = Degree(v9, E9) by Th24;
A13: Degree(v, E9) = Degree(v, E) by A11,Th31;
    per cases;
    suppose
A14:  v9 <> v1 & v9 <> v2;
      then Degree v9 = Degree(v, E9) by A12,Th48
        .= Degree v by A13,Th24;
      hence thesis by A8,A14;
    end;
    suppose
A15:  v = v1 or v = v2;
      then reconsider dv = Degree v as odd Element of NAT by A8;
A16:  dv +1 is even;
      Degree v9 = Degree(v, E9) +1 by A7,A10,A12,A15,Th47
        .= Degree v +1 by A13,Th24;
      hence thesis by A16;
    end;
  end;
  then consider P9 being cyclic Path of G9 such that
A17: P9 is Eulerian by Th59;
A18: rng P9 = the carrier' of G9 by A17;
  then consider n being Nat such that
A19: n in dom P9 and
A20: P9.n = E by A10,FINSEQ_2:10;
  consider p9 being cyclic Path of G9 such that
A21: p9.1 = P9.n and
A22: len p9 = len P9 and
A23: rng p9 = rng P9 by A19,Th10;
  reconsider p = (1+1, len p9)-cut p9 as Path of G9 by Th5;
  consider vs9 being FinSequence of the carrier of G9 such that
A24: vs9 is_vertex_seq_of p9 by GRAPH_2:33;
A25: now
    assume E in rng p;
    then consider a being Nat such that
A26: a in dom p and
A27: p.a = E by FINSEQ_2:10;
    consider k being Nat such that
A28: k in dom p9 and
A29: p9.k = p.a and
    k+1 = 1+1+a and
A30: 1+1 <= k and
    k <= len p9 by A26,Th2;
    1 in dom p9 by A28,FINSEQ_5:6,RELAT_1:38;
    then k = 1 by A20,A21,A27,A28,A29,FUNCT_1:def 4;
    hence contradiction by A30;
  end;
A31: 1 <= n & n <= len P9 by A19,FINSEQ_3:25;
  then
A32: 1 <= len P9 by XXREAL_0:2;
  then reconsider p1 = (1,1)-cut p9 as Chain of G9 by A22,GRAPH_2:41;
A33: p9 = p1 ^ (1+1, len p9)-cut p9 by A31,A22,FINSEQ_6:135,XXREAL_0:2;
  reconsider vs = (1+1, len vs9)-cut vs9 as FinSequence of the carrier of G9;
A34: len vs9 = len p9 +1 by A24;
  now
    consider c being Chain of G, vs being FinSequence of V such that
A35: c is non empty and
    vs is_vertex_seq_of c and
    vs.1 = v1 and
    vs.len vs = v2 by A7,Th18;
    reconsider c as FinSequence of the carrier' of G by MSSCYC_1:def 1;
    1 in dom c by A35,FINSEQ_5:6;
    then
A36: rng c c= E & c.1 in rng c by FINSEQ_1:def 4,FUNCT_1:def 3;
    then
A37: c.1 in E;
    c.1 in the carrier' of G9 by A9,A36,XBOOLE_0:def 3;
    then consider m being Nat such that
A38: m in dom P9 and
A39: P9.m = c.1 by A18,FINSEQ_2:10;
    assume
A40: len P9 = 1;
    1 <= m & m <= len P9 by A38,FINSEQ_3:25;
    then
A41: m =1 by A40,XXREAL_0:1;
    n = 1 by A31,A40,XXREAL_0:1;
    hence contradiction by A20,A37,A39,A41;
  end;
  then 1 < len P9 by A32,XXREAL_0:1;
  then
A42: 1+1 <= len P9 by NAT_1:13;
  then
A43: vs is_vertex_seq_of p by A22,A24,GRAPH_2:42;
  reconsider vs as FinSequence of the carrier of G by Def7;
  reconsider p as Path of G by A25,Th45;
  take p;
A44: (the Source of G9).E = v1 & (the Target of G9).E = v2 by Th34;
  now
    1+1<=len p9 +1 by A42,A22,NAT_1:12;
    then
A45: 1+1<=len vs9 +1 by A34,NAT_1:12;
    then
A46: len vs +(1+1) = len p9 +(1+1) by A34,Lm1;
    then 0+1 <= len vs by A31,A22,XXREAL_0:2;
    then consider i being Nat such that
    0<=i and
A47: i<len vs and
A48: len vs = i+1 by FINSEQ_6:127;
    (len vs +1)+1 = len vs +(1+1) .= len vs9 +1 by A45,Lm1;
    then
A49: len vs9 = i+(1+1) by A48;
A50: vs9.1 = vs9.len vs9 by A24,MSSCYC_1:6;
A51: vs9.1 = v1 & vs9.(1+1) = v2 or vs9.1 = v2 & vs9.(1+1) = v1 by A44,A20,A32
,A21,A22,A24,Lm3;
    assume
A52: vs.1 = vs.len vs;
    vs.(0+1) = vs9.(1+1+0) by A31,A22,A45,A46,Lm1;
    hence contradiction by A7,A52,A45,A47,A48,A49,A50,A51,Lm1;
  end;
  hence p is non cyclic by A43,A25,Th46,MSSCYC_1:6;
  rng <*E*> = {E} & p1 = <*E*> by 
    A20,A32,A21,A22,FINSEQ_1:39,FINSEQ_6:132;
  then rng p9 = {E} \/ rng p & {E} misses rng p by A33,FINSEQ_1:31,FINSEQ_3:91;
  hence rng p = E by A9,A18,A23,A1,XBOOLE_1:72;
end;
