let G1 be finite connected real-weighted WGraph; :: thesis: for G2 being inducedWSubgraph of G1,(PRIM:MST G1) `1 ,(PRIM:MST G1) `2 holds G2 is minimumSpanningTree of G1
set PMST = PRIM:MST G1;
let G2 be inducedWSubgraph of G1,(PRIM:MST G1) `1 ,(PRIM:MST G1) `2 ; :: thesis: G2 is minimumSpanningTree of G1
reconsider G29 = G2 as Tree-like _Graph by Th38;
set VG1 = the_Vertices_of G1;
set EG1 = the_Edges_of G1;
set WG1 = the_Weight_of G1;
set PCS = PRIM:CompSeq G1;
A1: (PRIM:MST G1) `1 = the_Vertices_of G1 by Th39;
(PRIM:MST G1) `2 in bool (the_Edges_of G1) by MCART_1:10;
then (PRIM:MST G1) `2 c= the_Edges_of G1 ;
then A2: (PRIM:MST G1) `2 c= G1 .edgesBetween ((PRIM:MST G1) `1) by A1, GLIB_000:34;
A3: (PRIM:MST G1) `1 c= the_Vertices_of G1 by Th39;
then A4: the_Vertices_of G2 = the_Vertices_of G1 by A1, A2, GLIB_000:def 37;
A5: the_Edges_of G2 = (PRIM:MST G1) `2 by A1, A2, A3, GLIB_000:def 37;
A6: G2 is Tree-like by Th38;
now
set X = { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } ;
now
let x be set ; :: thesis: ( x in { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } implies x in G1 .allWSubgraphs() )
assume x in { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } ; :: thesis: x in G1 .allWSubgraphs()
then ex G2 being Element of G1 .allWSubgraphs() st
( x = G2 & G2 is minimumSpanningTree of G1 ) ;
hence x in G1 .allWSubgraphs() ; :: thesis: verum
end;
then reconsider X = { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } as finite Subset of (G1 .allWSubgraphs()) by TARSKI:def 3;
defpred S1[ finite _Graph, Nat] means ( not ((PRIM:CompSeq G1) . ($2 + 1)) `2 c= the_Edges_of $1 & ( for n being Nat st n <= $2 holds
((PRIM:CompSeq G1) . n) `2 c= the_Edges_of $1 ) );
defpred S2[ finite _Graph, finite _Graph] means ( card ((the_Edges_of $1) /\ (the_Edges_of G2)) > card ((the_Edges_of $2) /\ (the_Edges_of G2)) or ( card ((the_Edges_of $1) /\ (the_Edges_of G2)) = card ((the_Edges_of $2) /\ (the_Edges_of G2)) & ( for k1, k2 being Nat st S1[$1,k1] & S1[$2,k2] holds
k1 >= k2 ) ) );
A7: G1 .edgesBetween (the_Vertices_of G1) = the_Edges_of G1 by GLIB_000:34;
now end;
then reconsider X = X as non empty finite Subset of (G1 .allWSubgraphs()) ;
assume A8: G2 is not minimumSpanningTree of G1 ; :: thesis: contradiction
A9: now
let G be Element of X; :: thesis: ex k1 being Nat st S1[G,k1]
G in X ;
then ex G9 being Element of G1 .allWSubgraphs() st
( G = G9 & G9 is minimumSpanningTree of G1 ) ;
then reconsider G9 = G as minimumSpanningTree of G1 ;
defpred S3[ Nat] means not ((PRIM:CompSeq G1) . $1) `2 c= the_Edges_of G9;
A10: the_Vertices_of G2 = the_Vertices_of G9 by A4, GLIB_000:def 33;
then A14: ex n being Nat st S3[n] by A5;
consider k3 being Nat such that
A15: ( S3[k3] & ( for n being Nat st S3[n] holds
k3 <= n ) ) from NAT_1:sch 5(A14);
then consider k2 being Nat such that
A17: k2 + 1 = k3 by NAT_1:6;
(k2 + 1) - 1 < k3 - 0 by A17, XREAL_1:15;
then A18: ((PRIM:CompSeq G1) . k2) `2 c= the_Edges_of G9 by A15;
now
let n be Nat; :: thesis: ( n <= k2 implies ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of G9 )
assume n <= k2 ; :: thesis: ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of G9
then ((PRIM:CompSeq G1) . n) `2 c= ((PRIM:CompSeq G1) . k2) `2 by Th34;
hence ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of G9 by A18, XBOOLE_1:1; :: thesis: verum
end;
hence ex k1 being Nat st S1[G,k1] by A15, A17; :: thesis: verum
end;
now
let x, y, z be Element of X; :: thesis: ( S2[x,y] & S2[y,z] implies S2[x,z] )
assume that
A19: S2[x,y] and
A20: S2[y,z] ; :: thesis: S2[x,z]
y in X ;
then consider y9 being WSubgraph of G1 such that
A21: y9 = y and
dom y9 = WGraphSelectors by Def5;
set CY = card ((the_Edges_of y9) /\ (the_Edges_of G2));
x in X ;
then consider x9 being WSubgraph of G1 such that
A22: x9 = x and
dom x9 = WGraphSelectors by Def5;
z in X ;
then consider z9 being WSubgraph of G1 such that
A23: z9 = z and
dom z9 = WGraphSelectors by Def5;
set CZ = card ((the_Edges_of z9) /\ (the_Edges_of G2));
set CX = card ((the_Edges_of x9) /\ (the_Edges_of G2));
now
per cases ( card ((the_Edges_of x9) /\ (the_Edges_of G2)) > card ((the_Edges_of y9) /\ (the_Edges_of G2)) or ( card ((the_Edges_of x9) /\ (the_Edges_of G2)) = card ((the_Edges_of y9) /\ (the_Edges_of G2)) & ( for kx, ky being Nat st S1[x9,kx] & S1[y9,ky] holds
kx >= ky ) ) )
by A19, A22, A21;
suppose A24: card ((the_Edges_of x9) /\ (the_Edges_of G2)) > card ((the_Edges_of y9) /\ (the_Edges_of G2)) ; :: thesis: S2[x,z]
now
per cases ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) > card ((the_Edges_of z9) /\ (the_Edges_of G2)) or ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of z9) /\ (the_Edges_of G2)) & ( for ky, kz being Nat st S1[y9,ky] & S1[z9,kz] holds
ky >= kz ) ) )
by A20, A21, A23;
suppose ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of z9) /\ (the_Edges_of G2)) & ( for ky, kz being Nat st S1[y9,ky] & S1[z9,kz] holds
ky >= kz ) ) ; :: thesis: S2[x,z]
end;
end;
end;
hence S2[x,z] ; :: thesis: verum
end;
suppose A25: ( card ((the_Edges_of x9) /\ (the_Edges_of G2)) = card ((the_Edges_of y9) /\ (the_Edges_of G2)) & ( for kx, ky being Nat st S1[x9,kx] & S1[y9,ky] holds
kx >= ky ) ) ; :: thesis: S2[x,z]
now
per cases ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) > card ((the_Edges_of z9) /\ (the_Edges_of G2)) or ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of z9) /\ (the_Edges_of G2)) & ( for ky, kz being Nat st S1[y9,ky] & S1[z9,kz] holds
ky >= kz ) ) )
by A20, A21, A23;
suppose A26: ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of z9) /\ (the_Edges_of G2)) & ( for ky, kz being Nat st S1[y9,ky] & S1[z9,kz] holds
ky >= kz ) ) ; :: thesis: S2[x,z]
consider zy being Nat such that
A27: S1[y,zy] by A9;
now
let kx, kz be Nat; :: thesis: ( S1[x9,kx] & S1[z9,kz] implies kx >= kz )
assume ( S1[x9,kx] & S1[z9,kz] ) ; :: thesis: kx >= kz
then ( kx >= zy & zy >= kz ) by A21, A25, A26, A27;
hence kx >= kz by XXREAL_0:2; :: thesis: verum
end;
hence S2[x,z] by A22, A23, A25, A26; :: thesis: verum
end;
end;
end;
hence S2[x,z] ; :: thesis: verum
end;
end;
end;
hence S2[x,z] ; :: thesis: verum
end;
then A28: for x, y, z being Element of X st S2[x,y] & S2[y,z] holds
S2[x,z] ;
A29: now
let G be Element of X; :: thesis: for k1, k2 being Nat st S1[G,k1] & S1[G,k2] holds
k1 = k2

let k1, k2 be Nat; :: thesis: ( S1[G,k1] & S1[G,k2] implies k1 = k2 )
assume A30: ( S1[G,k1] & S1[G,k2] ) ; :: thesis: k1 = k2
then k2 + 1 > k1 ;
then A31: k2 >= k1 by NAT_1:13;
k1 + 1 > k2 by A30;
then k1 >= k2 by NAT_1:13;
hence k1 = k2 by A31, XXREAL_0:1; :: thesis: verum
end;
now
let x, y be Element of X; :: thesis: ( S2[x,y] or S2[y,x] )
x in X ;
then consider x9 being WSubgraph of G1 such that
A32: x9 = x and
dom x9 = WGraphSelectors by Def5;
set CX = card ((the_Edges_of x9) /\ (the_Edges_of G2));
y in X ;
then consider y9 being WSubgraph of G1 such that
A33: y9 = y and
dom y9 = WGraphSelectors by Def5;
set CY = card ((the_Edges_of y9) /\ (the_Edges_of G2));
now
per cases ( card ((the_Edges_of x9) /\ (the_Edges_of G2)) < card ((the_Edges_of y9) /\ (the_Edges_of G2)) or card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of x9) /\ (the_Edges_of G2)) or card ((the_Edges_of x9) /\ (the_Edges_of G2)) > card ((the_Edges_of y9) /\ (the_Edges_of G2)) ) by XXREAL_0:1;
suppose A34: card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of x9) /\ (the_Edges_of G2)) ; :: thesis: ( S2[x,y] or S2[y,x] )
consider k1 being Nat such that
A35: S1[x,k1] by A9;
consider k2 being Nat such that
A36: S1[y,k2] by A9;
now
per cases ( k1 >= k2 or k1 < k2 ) ;
suppose A37: k1 >= k2 ; :: thesis: ( S2[x,y] or S2[y,x] )
now
let z1, z2 be Nat; :: thesis: ( S1[x,z1] & S1[y,z2] implies z1 >= z2 )
assume that
A38: S1[x,z1] and
A39: S1[y,z2] ; :: thesis: z1 >= z2
z1 = k1 by A29, A35, A38;
hence z1 >= z2 by A29, A36, A37, A39; :: thesis: verum
end;
hence ( S2[x,y] or S2[y,x] ) by A32, A33, A34; :: thesis: verum
end;
suppose A40: k1 < k2 ; :: thesis: ( S2[x,y] or S2[y,x] )
now
let z1, z2 be Nat; :: thesis: ( S1[x,z1] & S1[y,z2] implies z1 <= z2 )
assume that
A41: S1[x,z1] and
A42: S1[y,z2] ; :: thesis: z1 <= z2
z1 = k1 by A29, A35, A41;
hence z1 <= z2 by A29, A36, A40, A42; :: thesis: verum
end;
hence ( S2[x,y] or S2[y,x] ) by A32, A33, A34; :: thesis: verum
end;
end;
end;
hence ( S2[x,y] or S2[y,x] ) ; :: thesis: verum
end;
end;
end;
hence ( S2[x,y] or S2[y,x] ) ; :: thesis: verum
end;
then A43: for x, y being Element of X holds
( S2[x,y] or S2[y,x] ) ;
A44: ( X is finite & X <> {} & X c= X ) ;
consider M being Element of X such that
A45: ( M in X & ( for y being Element of X st y in X holds
S2[M,y] ) ) from CQC_SIM1:sch 4(A44, A43, A28);
ex x being Element of G1 .allWSubgraphs() st
( M = x & x is minimumSpanningTree of G1 ) by A45;
then reconsider M = M as minimumSpanningTree of G1 ;
defpred S3[ Nat] means not ((PRIM:CompSeq G1) . $1) `2 c= the_Edges_of M;
A46: the_Vertices_of G2 = the_Vertices_of M by A4, GLIB_000:def 33;
A47: now end;
now end;
then A50: ex k being Nat st S3[k] by A5;
consider k being Nat such that
A51: ( S3[k] & ( for n being Nat st S3[n] holds
k <= n ) ) from NAT_1:sch 5(A50);
now end;
then consider k1o being Nat such that
A53: k = k1o + 1 by NAT_1:6;
set Gk1b = (PRIM:CompSeq G1) . k1o;
set Gk = (PRIM:CompSeq G1) . k;
(k1o + 1) - 1 < k - 0 by A53, XREAL_1:15;
then A54: ((PRIM:CompSeq G1) . k1o) `2 c= the_Edges_of M by A51;
set Next = PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o);
set ep = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o));
A55: (PRIM:CompSeq G1) . k = PRIM:Step ((PRIM:CompSeq G1) . k1o) by A53, Def17;
then A56: PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) <> {} by A51, A54, Def15;
then A57: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) SJoins ((PRIM:CompSeq G1) . k1o) `1 ,(the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1),G1 by Def13;
ex v being Vertex of G1 st
( not v in ((PRIM:CompSeq G1) . k1o) `1 & (PRIM:CompSeq G1) . k = [((((PRIM:CompSeq G1) . k1o) `1) \/ {v}),((((PRIM:CompSeq G1) . k1o) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})] ) by A55, A56, Th28;
then A58: ((PRIM:CompSeq G1) . k) `2 = (((PRIM:CompSeq G1) . k1o) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by MCART_1:7;
then A59: not {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} c= the_Edges_of M by A51, A54, XBOOLE_1:8;
then A60: not choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in the_Edges_of M by ZFMISC_1:31;
set Mep = the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))};
A61: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) by A56;
then {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} c= the_Edges_of G1 by ZFMISC_1:31;
then (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} c= the_Edges_of G1 by XBOOLE_1:8;
then A62: ( the_Vertices_of G1 c= the_Vertices_of G1 & (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} c= G1 .edgesBetween (the_Vertices_of G1) ) by GLIB_000:34;
then A63: the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} = the_Vertices_of G1 by GLIB_000:def 37;
the_Vertices_of G1 = the_Vertices_of M by GLIB_000:def 33;
then ( the_Vertices_of G1 c= the_Vertices_of G1 & M is inducedWSubgraph of G1, the_Vertices_of G1, the_Edges_of M ) by A7, GLIB_000:def 37;
then A64: the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} .cost() = (M .cost()) + ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) by A61, A60, A7, Th11;
set MG2 = (the_Edges_of M) /\ (the_Edges_of G2);
A65: ((PRIM:CompSeq G1) . k) `2 c= (PRIM:MST G1) `2 by Th42;
choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by TARSKI:def 1;
then A66: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in ((PRIM:CompSeq G1) . k) `2 by A58, XBOOLE_0:def 3;
then A67: {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} /\ (the_Edges_of G2) = {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A5, A65, ZFMISC_1:46;
now end;
then A70: (the_Edges_of M) /\ (the_Edges_of G2) misses {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by XBOOLE_0:def 7;
set v1 = (the_Source_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)));
set v2 = (the_Target_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)));
set V = ((PRIM:CompSeq G1) . k1o) `1 ;
A71: the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} = (the_Weight_of G1) | (the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) by GLIB_003:def 10;
A72: the_Vertices_of G1 = the_Vertices_of M by GLIB_000:def 33;
then reconsider V = ((PRIM:CompSeq G1) . k1o) `1 as non empty Subset of (the_Vertices_of M) by Th30;
A73: the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} = (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A62, GLIB_000:def 37;
the_Vertices_of M c= the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A63;
then reconsider M9 = M as connected Subgraph of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A73, GLIB_000:44, XBOOLE_1:7;
choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by TARSKI:def 1;
then A74: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A73, XBOOLE_0:def 3;
the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} = the_Vertices_of M by A63, GLIB_000:def 33;
then reconsider v1 = (the_Source_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))), v2 = (the_Target_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) as Vertex of M by A74, FUNCT_2:5;
consider W being Walk of M9 such that
A75: W is_Walk_from v2,v1 by GLIB_002:def 1;
set PW = the Path of W;
reconsider P = the Path of W as Path of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by GLIB_001:175;
A76: the Path of W is_Walk_from v2,v1 by A75, GLIB_001:160;
then A77: P is_Walk_from v2,v1 by GLIB_001:19;
A78: now end;
A82: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) Joins v1,v2, the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A74, GLIB_000:def 13;
then A83: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) Joins P .last() ,v2, the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A77, GLIB_001:def 23;
choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) Joins v1,v2,G1 by A82, GLIB_000:72;
then A84: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) Joins v1,v2,G29 by A5, A66, A65, GLIB_000:73;
then ( ( (the_Source_of G2) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v1 & (the_Target_of G2) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v2 ) or ( (the_Target_of G2) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v1 & (the_Source_of G2) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v2 ) ) by GLIB_000:def 13;
then v1 <> v2 by A5, A66, A65, A84, GLIB_000:def 18;
then v1 <> P .first() by A77, GLIB_001:def 23;
then P .last() <> P .first() by A77, GLIB_001:def 23;
then A85: not P is closed by GLIB_001:def 24;
the Path of W .edges() c= the_Edges_of M ;
then P .edges() c= the_Edges_of M by GLIB_001:110;
then not choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in P .edges() by A59, ZFMISC_1:31;
then A86: P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is Path-like by A85, A83, A78, GLIB_001:150;
P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is_Walk_from v2,v2 by A77, A82, GLIB_001:66;
then A87: P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is closed by GLIB_001:119;
the_Vertices_of M c= the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A63;
then reconsider M9 = M as connected Subgraph of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A73, GLIB_000:44, XBOOLE_1:7;
the_Vertices_of M9 = the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A63, GLIB_000:def 33;
then M9 is spanning by GLIB_000:def 33;
then A88: the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} is connected by GLIB_002:23;
A89: v2 = P . 1 by A76, GLIB_001:17;
set C = P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)));
A90: v1 = P . (len P) by A76, GLIB_001:17;
A91: ( (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v1 & (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v2 ) by A74, GLIB_000:def 32;
now
per cases ( ( v1 in ((PRIM:CompSeq G1) . k1o) `1 & v2 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ) or ( v2 in ((PRIM:CompSeq G1) . k1o) `1 & v1 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ) ) by A57, A91, GLIB_000:def 15;
suppose A92: ( v1 in ((PRIM:CompSeq G1) . k1o) `1 & v2 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ) ; :: thesis: ex em being set st
( em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() & em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M )

A93: ( len (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) = (len P) + 2 & (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) . ((len P) + 1) = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) ) by A83, GLIB_001:64, GLIB_001:65;
defpred S4[ Nat] means ( not $1 is even & $1 <= len P & P . $1 in ((PRIM:CompSeq G1) . k1o) `1 );
A94: ex n being Nat st S4[n] by A90, A92;
consider m being Nat such that
A95: ( S4[m] & ( for n being Nat st S4[n] holds
m <= n ) ) from NAT_1:sch 5(A94);
reconsider m = m as odd Element of NAT by A95, ORDINAL1:def 12;
( 1 <= m & m <> 1 ) by A89, A92, A95, ABIAN:12, XBOOLE_0:def 5;
then 1 < m by XXREAL_0:1;
then 1 + 1 <= m by NAT_1:13;
then reconsider m2k = m - (2 * 1) as odd Element of NAT by INT_1:5;
A96: m2k < m - 0 by XREAL_1:15;
then A97: m2k < len P by A95, XXREAL_0:2;
then A98: not P . m2k in ((PRIM:CompSeq G1) . k1o) `1 by A95, A96;
set em = P . (m2k + 1);
A99: P . (m2k + 1) in P .edges() by A97, GLIB_001:100;
then consider i being even Element of NAT such that
A100: 1 <= i and
A101: i <= len P and
A102: P . i = P . (m2k + 1) by GLIB_001:99;
i in dom P by A100, A101, FINSEQ_3:25;
then A103: (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) . i = P . (m2k + 1) by A83, A102, GLIB_001:65;
take em = P . (m2k + 1); :: thesis: ( em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() & em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M )
(P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() = (P .edges()) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A83, GLIB_001:111;
hence em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() by A99, XBOOLE_0:def 3; :: thesis: ( em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M )
A104: (len P) + 1 <= (len P) + 2 by XREAL_1:7;
(len P) + 0 < (len P) + 1 by XREAL_1:8;
then i < (len P) + 1 by A101, XXREAL_0:2;
hence em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by A86, A100, A103, A93, A104, GLIB_001:138; :: thesis: em SJoins V,(the_Vertices_of M) \ V,M
m2k + 2 = m ;
then A105: em Joins the Path of W . m2k, the Path of W . m,M by A97, GLIB_001:def 3;
then the Path of W . m2k in the_Vertices_of M by GLIB_000:13;
then the Path of W . m2k in (the_Vertices_of M) \ (((PRIM:CompSeq G1) . k1o) `1) by A98, XBOOLE_0:def 5;
hence em SJoins V,(the_Vertices_of M) \ V,M by A95, A105, GLIB_000:17; :: thesis: verum
end;
suppose A106: ( v2 in ((PRIM:CompSeq G1) . k1o) `1 & v1 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ) ; :: thesis: ex em being set st
( em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() & em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M )

A107: ( len (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) = (len P) + 2 & (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) . ((len P) + 1) = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) ) by A83, GLIB_001:64, GLIB_001:65;
defpred S4[ Nat] means ( not $1 is even & $1 <= len P & P . $1 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) );
A108: ex n being Nat st S4[n] by A90, A106;
consider m being Nat such that
A109: ( S4[m] & ( for n being Nat st S4[n] holds
m <= n ) ) from NAT_1:sch 5(A108);
reconsider m = m as odd Element of NAT by A109, ORDINAL1:def 12;
( 1 <= m & m <> 1 ) by A89, A106, A109, ABIAN:12, XBOOLE_0:def 5;
then 1 < m by XXREAL_0:1;
then 1 + 1 <= m by NAT_1:13;
then reconsider m2k = m - (2 * 1) as odd Element of NAT by INT_1:5;
A110: m2k < m - 0 by XREAL_1:15;
then A111: m2k < len P by A109, XXREAL_0:2;
set em = P . (m2k + 1);
A114: P . (m2k + 1) in P .edges() by A111, GLIB_001:100;
then consider i being even Element of NAT such that
A115: 1 <= i and
A116: i <= len P and
A117: P . i = P . (m2k + 1) by GLIB_001:99;
i in dom P by A115, A116, FINSEQ_3:25;
then A118: (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) . i = P . (m2k + 1) by A83, A117, GLIB_001:65;
take em = P . (m2k + 1); :: thesis: ( em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() & em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M )
(P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() = (P .edges()) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A83, GLIB_001:111;
hence em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() by A114, XBOOLE_0:def 3; :: thesis: ( em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M )
A119: (len P) + 1 <= (len P) + 2 by XREAL_1:7;
(len P) + 0 < (len P) + 1 by XREAL_1:8;
then i < (len P) + 1 by A116, XXREAL_0:2;
hence em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by A86, A115, A118, A107, A119, GLIB_001:138; :: thesis: em SJoins V,(the_Vertices_of M) \ V,M
m2k + 2 = m ;
then em Joins the Path of W . m2k, the Path of W . m,M by A111, GLIB_001:def 3;
hence em SJoins V,(the_Vertices_of M) \ V,M by A72, A109, A112, GLIB_000:17; :: thesis: verum
end;
end;
end;
then consider em being set such that
A120: em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() and
A121: em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) and
A122: em SJoins V,(the_Vertices_of M) \ V,M ;
set M2 = the [Weighted] weight-inheriting removeEdge of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))},em;
reconsider M2 = the [Weighted] weight-inheriting removeEdge of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))},em as WSubgraph of G1 by GLIB_003:9;
A123: M2 .order() = card (the_Vertices_of G1) by A63, GLIB_000:53
.= M .order() by GLIB_000:def 33 ;
A124: em SJoins V,(the_Vertices_of G1) \ V,G1 by A72, A122, GLIB_000:72;
then A125: (the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) <= (the_Weight_of G1) . em by A56, Def13;
set M29 = M2 | WGraphSelectors;
A126: M2 | WGraphSelectors == M2 by Lm4;
A127: the_Edges_of M2 = ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) \ {em} by A73, GLIB_000:51;
then A128: the_Edges_of (M2 | WGraphSelectors) = ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) \ {em} by A126, GLIB_000:def 34;
{em} c= (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A73, A120, ZFMISC_1:31;
then M2 .size() = (card ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})) - (card {em}) by A127, CARD_2:44
.= (card ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})) - 1 by CARD_1:30
.= ((card (the_Edges_of M)) + 1) - 1 by A60, CARD_2:41
.= M .size() ;
then A129: M2 .order() = (M2 .size()) + 1 by A123, GLIB_002:46;
A130: the_Weight_of (M2 | WGraphSelectors) = the_Weight_of M2 by Lm4;
then reconsider M29 = M2 | WGraphSelectors as WSubgraph of G1 by A126, GLIB_003:8;
A131: the_Vertices_of M29 = the_Vertices_of M2 by A126, GLIB_000:def 34
.= the_Vertices_of G1 by A63, GLIB_000:53 ;
not P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is trivial by A83, GLIB_001:132;
then P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is Cycle-like by A86, A87, GLIB_001:def 31;
then M2 is connected by A120, A88, GLIB_002:5;
then M2 is Tree-like by A129, GLIB_002:47;
then M29 is Tree-like by Lm4, GLIB_002:48;
then reconsider M29 = M29 as spanning Tree-like WSubgraph of G1 by A131, GLIB_000:def 33;
(M2 .cost()) + ((the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . em) = the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} .cost() by A120, Th10;
then M2 .cost() = ( the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} .cost()) - ((the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . em) ;
then M2 .cost() = ((M .cost()) + ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))))) - ((the_Weight_of G1) . em) by A120, A64, A71, FUNCT_1:49;
then M29 .cost() = ((M .cost()) + ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))))) - ((the_Weight_of G1) . em) by A126, A130, GLIB_000:def 34;
then A132: ((M29 .cost()) + ((the_Weight_of G1) . em)) - ((the_Weight_of G1) . em) <= ((M .cost()) + ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))))) - ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) by A125, XREAL_1:13;
now end;
then reconsider M29 = M29 as minimumSpanningTree of G1 by Def19;
set MG29 = (the_Edges_of M29) /\ (the_Edges_of G2);
A133: (the_Edges_of M29) /\ (the_Edges_of G2) = (((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2)) \ ({em} /\ (the_Edges_of G2)) by A128, XBOOLE_1:50;
dom M29 = WGraphSelectors by Lm5;
then M29 in G1 .allWSubgraphs() by Def5;
then A134: M29 in X ;
A135: now
thus not ((PRIM:CompSeq G1) . (k1o + 1)) `2 c= the_Edges_of M by A51, A53; :: thesis: for n being Nat st n <= k1o holds
((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M

let n be Nat; :: thesis: ( n <= k1o implies ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M )
assume n <= k1o ; :: thesis: ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M
then ((PRIM:CompSeq G1) . n) `2 c= ((PRIM:CompSeq G1) . k1o) `2 by Th34;
hence ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M by A54, XBOOLE_1:1; :: thesis: verum
end;
A136: now
consider k2 being Nat such that
A137: S1[M29,k2] by A9, A134;
now end;
then A145: ((PRIM:CompSeq G1) . k) `2 c= the_Edges_of M29 by TARSKI:def 3;
A146: now end;
assume A147: em in the_Edges_of G2 ; :: thesis: contradiction
then A148: {em} c= ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2) by TARSKI:def 3;
(the_Edges_of M29) /\ (the_Edges_of G2) = (((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2)) \ {em} by A133, A147, ZFMISC_1:46;
then card ((the_Edges_of M29) /\ (the_Edges_of G2)) = (card ((the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2))) - (card {em}) by A73, A148, CARD_2:44
.= (card ((the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2))) - 1 by CARD_1:30
.= (card (((the_Edges_of M) /\ (the_Edges_of G2)) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})) - 1 by A73, A67, XBOOLE_1:23
.= ((card ((the_Edges_of M) /\ (the_Edges_of G2))) + (card {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})) - 1 by A70, CARD_2:40
.= ((card ((the_Edges_of M) /\ (the_Edges_of G2))) + 1) - 1 by CARD_1:30
.= card ((the_Edges_of M) /\ (the_Edges_of G2)) ;
then A149: k1o >= k2 by A45, A134, A135, A137;
(k1o + 1) - 1 < k - 0 by A53, XREAL_1:15;
hence contradiction by A146, A149, XXREAL_0:2; :: thesis: verum
end;
now
assume {em} /\ (the_Edges_of G2) <> {} ; :: thesis: contradiction
then consider x being set such that
A150: x in {em} /\ (the_Edges_of G2) by XBOOLE_0:def 1;
( x in {em} & x in the_Edges_of G2 ) by A150, XBOOLE_0:def 4;
hence contradiction by A136, TARSKI:def 1; :: thesis: verum
end;
then A151: (the_Edges_of M29) /\ (the_Edges_of G2) = ((the_Edges_of M) /\ (the_Edges_of G2)) \/ ({(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} /\ (the_Edges_of G2)) by A133, XBOOLE_1:23;
now end;
then (the_Edges_of M) /\ (the_Edges_of G2) misses {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by XBOOLE_0:def 7;
then card ((the_Edges_of M29) /\ (the_Edges_of G2)) = (card ((the_Edges_of M) /\ (the_Edges_of G2))) + (card {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) by A67, A151, CARD_2:40
.= (card ((the_Edges_of M) /\ (the_Edges_of G2))) + 1 by CARD_1:30 ;
then (card ((the_Edges_of M) /\ (the_Edges_of G2))) + 0 >= (card ((the_Edges_of M) /\ (the_Edges_of G2))) + 1 by A45, A134;
hence contradiction by XREAL_1:6; :: thesis: verum
end;
hence G2 is minimumSpanningTree of G1 ; :: thesis: verum