reserve G, G1, G2 for _Graph, H for Subgraph of G;

theorem
  G.numComponents() = card G.allComponents()
proof
  defpred P[object, object] means ex H being plain Component of G st
    $1 = H & $2 = the_Vertices_of H;
  A1: for x,y1,y2 being object st x in G.allComponents() & P[x,y1] & P[x,y2]
    holds y1 = y2;
  A2: for x being object st x in G.allComponents() ex y being object st P[x,y]
  proof
    let x be object;
    assume x in G.allComponents();
    then reconsider H = x as plain Component of G by Th189;
    take the_Vertices_of H, H;
    thus thesis;
  end;
  consider f being Function such that
    A3: dom f = G.allComponents() and
    A4: for x being object st x in G.allComponents() holds P[x,f.x]
    from FUNCT_1:sch 2(A1,A2);
  now
    let y be object;
    thus y in G.componentSet() implies
      ex x being object st x in dom f & y = f.x
    proof
      assume y in G.componentSet();
      then consider v being Vertex of G such that
        A5: y = G.reachableFrom(v) by GLIB_002:def 8;
      set H = the plain inducedSubgraph of G, G.reachableFrom(v);
      take H;
      thus H in dom f by A3, Th189;
      then consider H9 being plain Component of G such that
        A6: H = H9 & f.H = the_Vertices_of H9 by A3, A4;
      thus y = f.H by A5, A6, GLIB_000:def 37;
    end;
    given x being object such that
      A7: x in dom f & y = f.x;
    consider H being plain Component of G such that
      A8: x = H & y = the_Vertices_of H by A3, A4, A7;
    set v = the Vertex of H;
    the_Vertices_of H c= the_Vertices_of G;
    then reconsider v as Vertex of G by TARSKI:def 3;
    the_Vertices_of H = G.reachableFrom(v) by GLIB_002:33;
    hence y in G.componentSet() by A8, GLIB_002:def 8;
  end;
  then A9: rng f = G.componentSet() by FUNCT_1:def 3;
  now
    let x1,x2 be object;
    assume A10: x1 in dom f & x2 in dom f & f.x1 = f.x2;
    then consider H1 being plain Component of G such that
      A11: x1 = H1 & f.x1 = the_Vertices_of H1 by A3, A4;
    consider H2 being plain Component of G such that
      A12: x2 = H2 & f.x2 = the_Vertices_of H2 by A3, A4, A10;
    thus x1 = x2 by A10, A11, A12, GLIB_002:32, GLIB_009:44;
  end;
  then card G.allComponents() = card G.componentSet()
    by A3, A9, FUNCT_1:def 4, CARD_1:70;
  hence thesis by GLIB_002:def 9;
end;
