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 Th59: :: Cyclic Euler paths
  for G being finite connected Graph holds (ex p being cyclic Path
  of G st p is Eulerian) iff for v being Vertex of G holds Degree v is even
proof
  let G be finite connected Graph;
  set E = the carrier' of G;
  hereby
    given c being cyclic Path of G such that
A1: c is Eulerian;
    let v be Vertex of G;
    consider vs being FinSequence of the carrier of G such that
A2: vs is_vertex_seq_of c and
    vs.1 = vs.(len vs) by MSSCYC_1:def 2;
    rng vs = the carrier of G by A1,A2,Th58;
    then
A3: Degree(v, rng c) is even by A2,Lm4;
    rng c = the carrier' of G by A1;
    hence Degree v is even by A3,Th24;
  end;
  assume
A4: for v being Vertex of G holds Degree v is even;
  per cases;
  suppose
A5: G is void;
    {} is Element of G-CycleSet by Th51;
    then reconsider ec = {} as cyclic Path of G by Def8;
    take ec;
    the carrier' of G is empty by A5;
    hence rng ec = the carrier' of G;
  end;
  suppose
    G is non void;
    then reconsider G9 = G as non void finite connected Graph;
    reconsider V = the Element of the carrier of G as Vertex of G9;
    defpred P[Nat,set,set] means
    ex E being Element of G9-CycleSet st E = $2 & $3 = ExtendCycle E;
    the Element of E-CycleSet V in E-CycleSet V;
    then reconsider ec = the Element of E-CycleSet V
    as Element of G9-CycleSet;
A6: for n being Nat for x being Element of G9-CycleSet
    ex y being Element of G9-CycleSet st P[n,x,y]
    proof
      let n;
      let x be Element of G9-CycleSet;
      take ExtendCycle x;
      thus thesis;
    end;
    consider f being sequence of G9-CycleSet such that
A7: f.0 = ec & for n being Nat holds P[n,f.n,f.(n+1)]
    from RECDEF_1:sch 2(A6);
A8: now
      let v be Vertex of G;
      Degree v = Degree(v, E) by Th24;
      hence Degree(v, E) is even by A4;
    end;
    Degree V = Degree(V, E) by Th24;
    then
A9: Degree(V, E) <> 0 by Th33;
    now
      defpred P[Nat] means ex c being Element of G9-CycleSet st c
      is non empty & c = f.$1 & $1 <= card rng c;
      reconsider E as finite set by GRAPH_1:def 11;
      assume
A10:   not ex n being Nat, c being Element of G9-CycleSet
      st c = f.n & rng c = the carrier' of G;
A11:  for n st P[n] holds P[n+1]
      proof
        let n be Nat;
        given c being Element of G9-CycleSet such that
A12:    c is non empty and
A13:    c = f.n and
A14:    n <= card rng c;
        reconsider r = ExtendCycle c as Element of G9-CycleSet;
        take r;
        rng c <> E by A10,A13;
        hence r is non empty by A4,A12,Th57;
        P[n,f.n,f.(n+1)] by A7;
        hence r = f.(n+1) by A13;
        rng c <> E by A10,A13;
        then n < card rng r by A4,A12,A14,Th57,XXREAL_0:2;
        hence thesis by NAT_1:13;
      end;
A15:  P[0]
      proof
        take ec;
        thus ec is non empty by A8,A9,Th55;
        thus ec = f.0 by A7;
        thus thesis;
      end;
      for n being Nat holds P[n] from NAT_1:sch 2(A15, A11);
      then consider c being Element of G-CycleSet such that
      c is non empty and
      c = f.(card E + 1) and
A16:  card E + 1 <= card rng c;
      rng c c= E by FINSEQ_1:def 4;
      then card rng c <= card E by NAT_1:43;
      then card E + 1 <= card E + 0 by A16,XXREAL_0:2;
      hence contradiction by XREAL_1:6;
    end;
    then consider n being Nat, c being Element of G-CycleSet such that
    c = f.n and
A17: rng c = the carrier' of G;
    reconsider c as cyclic Path of G by Def8;
    take c;
    thus rng c = the carrier' of G by A17;
  end;
end;
