reserve c,c1,c2 for Cardinal, G,G1,G2 for _Graph, v for Vertex of G;

theorem
  for G being _finite _Graph, k being Nat
  st k = card {w where w is Vertex of G : w.degree() is non even}
  holds k is even
proof
  let G be _finite _Graph, k be Nat;
  set W = {w where w is Vertex of G : w.degree() is non even};
  assume A1: k = card W;
  now
    let x be object;
    assume x in W;
    then consider w being Vertex of G such that
      A2: x = w & w.degree() is non even;
    thus x in the_Vertices_of G by A2;
  end;
  then A3: W c= the_Vertices_of G by TARSKI:def 3;
  set v = the Denumeration of the_Vertices_of G;
  reconsider v9 = W|`v as one-to-one Function by FUNCT_1:58;
  set f = v9";
  deffunc M(Nat) = (G.degreeMap()*v).$1 mod 2;
  consider m being XFinSequence of NAT such that
    A4: len m = len(G.degreeMap()*v) and
    A5: for k being Nat st k in len(G.degreeMap()*v) holds m.k = M(k)
    from AFINSQ_2:sch 1;
  A6: dom(G.degreeMap()*v) = dom m &
    for i being Nat st i in dom(G.degreeMap()*v)
    holds m.i = (G.degreeMap()*v).i mod 2 by A4, A5;
  A7: dom f = rng(v9) by FUNCT_1:33
    .= rng v /\ W by RELAT_1:88
    .= the_Vertices_of G /\ W by FUNCT_2:def 3
    .= W by A3, XBOOLE_1:28;
  now
    let y be object;
    hereby
      assume y in m"{1};
      then A8: y in dom m & m.y in {1} by FUNCT_1:def 7;
      reconsider x = v.y as object;
      take x;
      A9: y in dom v by A4, A8, FUNCT_1:11;
      1 = m.y by A8, TARSKI:def 1
        .= (G.degreeMap()*v).y mod 2 by A8, A4, A5
        .= G.degreeMap().(v.y) mod 2 by A9, FUNCT_1:13
        .= G.degreeMap().(v/.y) mod 2 by A9, PARTFUN1:def 6
        .= (v/.y).degree() mod 2 by Def11;
      then (v/.y).degree() is non even by NAT_2:21;
      then (v/.y) in W;
      then A10: x in W by A9, PARTFUN1:def 6;
      x in rng v by A9, FUNCT_1:3;
      then x in rng v9 by A10, RELAT_1:84;
      hence x in dom f by FUNCT_1:33;
      thus y = v".x by A9, FUNCT_1:34
        .= (v"|W).x by A10, FUNCT_1:49
        .= f.x by GLIB_009:5;
    end;
    given x being object such that
      A11: x in dom f & y = f.x;
    x in rng v9 by A11, FUNCT_1:33;
    then A12: x in rng v & x in W by RELAT_1:84;
    then consider w being Vertex of G such that
      A13: x = w & w.degree() is non even;
    A14: x in dom(v") by A12, FUNCT_1:33;
    A15: y = (v"|W).x by A11, GLIB_009:5
      .= v".x by A12, FUNCT_1:49;
    then y in rng(v") by A14, FUNCT_1:3;
    then A16: y in dom v by FUNCT_1:33;
    A17: v.y = x by A12, A15, FUNCT_1:35;
    x in the_Vertices_of G by A13;
    then x in dom G.degreeMap() by PARTFUN1:def 2;
    then A18: y in dom m by A4, A16, A17, FUNCT_1:11;
    then m.y = (G.degreeMap()*v).y mod 2 by A4, A5
      .= G.degreeMap().x mod 2 by A16, A17, FUNCT_1:13
      .= w.degree() mod 2 by A13, Def11
      .= 1 by A13, NAT_2:22;
    then m.y in {1} by TARSKI:def 1;
    hence y in m"{1} by A18, FUNCT_1:def 7;
  end;
  then A19: rng f = m"{1} by FUNCT_1:def 3;
  now
    let y be object;
    assume y in rng m;
    then consider x being object such that
      A20: x in dom m & y = m.x by FUNCT_1:def 3;
    A21: x in len(G.degreeMap()*v) by A4, A20;
    then reconsider x as Ordinal;
    x c= len(G.degreeMap()*v) by A21, ORDINAL1:def 2;
    then reconsider x as Nat;
    y = (G.degreeMap()*v).x mod 2 by A5, A20, A21;
    then y = 0 or y = 1 by NAT_D:12;
    hence y in {0,1} by TARSKI:def 2;
  end;
  then A22: rng m c= {0,1} by TARSKI:def 3;
  k = 1*card(m"{1}) by A1, A7, A19, CARD_1:70
    .= Sum m by A22, AFINSQ_2:68;
  then k mod 2 = Sum((G.degreeMap()*v)) mod 2 by A6, NUMERAL1:3
    .= (2*G.size()) mod 2 by Th66
    .= 0 by NAT_D:13;
  hence thesis by NAT_2:21;
end;
