
theorem Th31:
  for G1 being _finite real-weighted WGraph, n being Nat, G2 being
  inducedSubgraph of G1,(PRIM:CompSeq(G1).n)`1, (PRIM:CompSeq(G1).n)`2 holds G2
  is connected
proof
  let G1 be _finite real-weighted WGraph;
  defpred P[Nat] means for G2 being inducedSubgraph of G1, (PRIM:CompSeq(G1).
  $1)`1, (PRIM:CompSeq(G1).$1)`2 holds G2 is connected;
  set G0 = PRIM:CompSeq(G1).0, v = the Element of the_Vertices_of G1;
  now
    let n be Nat;
    assume
A1: P[n];
    set Gn = PRIM:CompSeq(G1).n, Gn1 = PRIM:CompSeq(G1).(n+1);
    set e = the Element of PRIM:NextBestEdges(Gn);
    set v1 = (the_Target_of G1).e, v2 = (the_Source_of G1).e;
A2: Gn1 = PRIM:Step(Gn) by Def17;
    now
      let Gn1s be inducedSubgraph of G1, Gn1`1, Gn1`2;
A3:   Gn1`1 is non empty Subset of the_Vertices_of G1 & Gn1`2c=G1
      .edgesBetween(Gn1 `1) by Th30;
      then
A4:   the_Vertices_of Gn1s = Gn1`1 by GLIB_000:def 37;
A5:   the_Edges_of Gn1s = Gn1`2 by A3,GLIB_000:def 37;
      now
        per cases;
        suppose
          PRIM:NextBestEdges(Gn) = {};
          then Gn1 = Gn by A2,Def15;
          hence Gn1s is connected by A1;
        end;
        suppose
A6:       PRIM:NextBestEdges(Gn) <> {} & v2 in Gn`1;
          then
A7:       Gn1 = [Gn`1 \/ {v1}, Gn`2 \/ {e} ] by A2,Def15;
          then
A8:       Gn1`2 = Gn`2 \/ {e};
A9:       e in PRIM:NextBestEdges(Gn) by A6;
          then reconsider v1 as Vertex of G1 by FUNCT_2:5;
A10:      e Joins v2,v1,G1 by A9;
          set Gns = the inducedSubgraph of G1,Gn`1,Gn`2;
A11:      Gns is connected by A1;
A12:      Gn`1 is non empty Subset of the_Vertices_of G1 & Gn`2 c= G1
          .edgesBetween(Gn `1) by Th30;
          then
A13:      the_Vertices_of Gns = Gn`1 by GLIB_000:def 37;
A14:      Gn1`1 = Gn`1 \/ {v1} by A7;
          then
A15:      the_Vertices_of Gns c= the_Vertices_of Gn1s by A4,A13,XBOOLE_1:7;
          the_Edges_of Gns = Gn`2 by A12,GLIB_000:def 37;
          then reconsider Gns as Subgraph of Gn1s by A5,A8,A15,GLIB_000:44
,XBOOLE_1:7;
          set src = the Vertex of Gns;
          reconsider src9 = src as Vertex of Gn1s by GLIB_000:42;
          e in {e} by TARSKI:def 1;
          then e in the_Edges_of Gn1s by A5,A8,XBOOLE_0:def 3;
          then
A16:      e Joins v2,v1,Gn1s by A10,GLIB_000:73;
          now
            let x be Vertex of Gn1s;
            now
              per cases;
              suppose
A17:            x = v1;
                reconsider v29=v2 as Vertex of Gns by A6,A12,GLIB_000:def 37;
                consider W being Walk of Gns such that
A18:            W is_Walk_from src,v29 by A11,GLIB_002:def 1;
                reconsider W as Walk of Gn1s by GLIB_001:167;
                W is_Walk_from src9,v2 by A18,GLIB_001:19;
                then W.addEdge(e) is_Walk_from src9,x by A16,A17,GLIB_001:66;
                hence ex W being Walk of Gn1s st W is_Walk_from src9,x;
              end;
              suppose
                x <> v1;
                then not x in {v1} by TARSKI:def 1;
                then reconsider x9=x as Vertex of Gns by A4,A14,A13,
XBOOLE_0:def 3;
                consider W being Walk of Gns such that
A19:            W is_Walk_from src,x9 by A11,GLIB_002:def 1;
                reconsider W9=W as Walk of Gn1s by GLIB_001:167;
                W9 is_Walk_from src9,x by A19,GLIB_001:19;
                hence ex W being Walk of Gn1s st W is_Walk_from src9,x;
              end;
            end;
            hence ex W being Walk of Gn1s st W is_Walk_from src9,x;
          end;
          hence Gn1s is connected by GLIB_002:6;
        end;
        suppose
A20:      PRIM:NextBestEdges(Gn) <> {} & not v2 in Gn`1;
          then
A21:      Gn1 = [Gn`1 \/ {v2}, Gn`2 \/ {e}] by A2,Def15;
          then
A22:      Gn1`2 = Gn`2 \/ {e};
A23:      e SJoins Gn`1,the_Vertices_of G1\Gn`1,G1 by A20,Def13;
          then
A24:      e in the_Edges_of G1;
          then reconsider v2 as Vertex of G1 by FUNCT_2:5;
A25:      e Joins v1,v2,G1 by A24;
          e in {e} by TARSKI:def 1;
          then e in the_Edges_of Gn1s by A5,A22,XBOOLE_0:def 3;
          then
A26:      e Joins v1,v2,Gn1s by A25,GLIB_000:73;
          set Gns = the inducedSubgraph of G1,Gn`1,Gn`2;
A27:      Gns is connected by A1;
A28:      Gn`1 is non empty Subset of the_Vertices_of G1 & Gn`2c= G1
          .edgesBetween(Gn`1 ) by Th30;
          then
A29:      the_Vertices_of Gns = Gn`1 by GLIB_000:def 37;
A30:      Gn1`1 = Gn`1 \/ {v2} by A21;
          then
A31:      the_Vertices_of Gns c= the_Vertices_of Gn1s by A4,A29,XBOOLE_1:7;
          the_Edges_of Gns = Gn`2 by A28,GLIB_000:def 37;
          then reconsider Gns as Subgraph of Gn1s by A5,A22,A31,GLIB_000:44
,XBOOLE_1:7;
          set src = the Vertex of Gns;
          reconsider src9 = src as Vertex of Gn1s by GLIB_000:42;
A32:      v1 in Gn`1 by A20,A23;
          now
            let x be Vertex of Gn1s;
            now
              per cases;
              suppose
A33:            x = v2;
                reconsider v19=v1 as Vertex of Gns by A32,A28,GLIB_000:def 37;
                consider W being Walk of Gns such that
A34:            W is_Walk_from src,v19 by A27,GLIB_002:def 1;
                reconsider W as Walk of Gn1s by GLIB_001:167;
                W is_Walk_from src9,v1 by A34,GLIB_001:19;
                then W.addEdge(e) is_Walk_from src9,x by A26,A33,GLIB_001:66;
                hence ex W being Walk of Gn1s st W is_Walk_from src9,x;
              end;
              suppose
                x <> v2;
                then not x in {v2} by TARSKI:def 1;
                then reconsider x9=x as Vertex of Gns by A4,A30,A29,
XBOOLE_0:def 3;
                consider W being Walk of Gns such that
A35:            W is_Walk_from src,x9 by A27,GLIB_002:def 1;
                reconsider W9=W as Walk of Gn1s by GLIB_001:167;
                W9 is_Walk_from src9,x by A35,GLIB_001:19;
                hence ex W being Walk of Gn1s st W is_Walk_from src9,x;
              end;
            end;
            hence ex W being Walk of Gn1s st W is_Walk_from src9,x;
          end;
          hence Gn1s is connected by GLIB_002:6;
        end;
      end;
      hence Gn1s is connected;
    end;
    hence P[n+1];
  end;
  then
A36: for n being Nat st P[n] holds P[n+1];
  now
    let G be inducedSubgraph of G1, G0`1, G0`2;
    G0 = PRIM:Init(G1) by Def17;
    then reconsider G9 = G as inducedSubgraph of G1,{v},{};
    G9 is connected;
    hence G is connected;
  end;
  then
A38: P[ 0 ];
  for n being Nat holds P[n] from NAT_1:sch 2(A38,A36);
  hence thesis;
end;
