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 c= the_Edges_of G1 ;
then A2: (PRIM:MST G1) `2 c= G1 .edgesBetween ((PRIM:MST G1) `1) by A1, GLIB_000:34;
A3: the_Vertices_of G2 = the_Vertices_of G1 by A1, A2, GLIB_000:def 37;
A4: the_Edges_of G2 = (PRIM:MST G1) `2 by A1, A2, GLIB_000:def 37;
A5: G2 is Tree-like by Th38;
now :: thesis: G2 is minimumSpanningTree of G1
set X = { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } ;
now :: thesis: for x being object st x in { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } holds
x in G1 .allWSubgraphs()
let x be object ; :: 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 ) ) );
A6: G1 .edgesBetween (the_Vertices_of G1) = the_Edges_of G1 by GLIB_000:34;
now :: thesis: X <> {} end;
then reconsider X = X as non empty finite Subset of (G1 .allWSubgraphs()) ;
assume A7: G2 is not minimumSpanningTree of G1 ; :: thesis: contradiction
A8: now :: thesis: for G being Element of X ex k1 being Nat st S1[G,k1]
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;
A9: the_Vertices_of G2 = the_Vertices_of G9 by A3, GLIB_000:def 33;
then A13: ex n being Nat st S3[n] by A4;
consider k3 being Nat such that
A14: ( S3[k3] & ( for n being Nat st S3[n] holds
k3 <= n ) ) from NAT_1:sch 5(A13);
then consider k2 being Nat such that
A16: k2 + 1 = k3 by NAT_1:6;
(k2 + 1) - 1 < k3 - 0 by A16, XREAL_1:15;
then A17: ((PRIM:CompSeq G1) . k2) `2 c= the_Edges_of G9 by A14;
now :: thesis: for n being Nat st n <= k2 holds
((PRIM:CompSeq G1) . n) `2 c= the_Edges_of G9
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 A17; :: thesis: verum
end;
hence ex k1 being Nat st S1[G,k1] by A14, A16; :: thesis: verum
end;
now :: thesis: for x, y, z being Element of X st S2[x,y] & S2[y,z] holds
S2[x,z]
let x, y, z be Element of X; :: thesis: ( S2[x,y] & S2[y,z] implies S2[x,z] )
assume that
A18: S2[x,y] and
A19: S2[y,z] ; :: thesis: S2[x,z]
y in X ;
then consider y9 being WSubgraph of G1 such that
A20: 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
A21: x9 = x and
dom x9 = WGraphSelectors by Def5;
z in X ;
then consider z9 being WSubgraph of G1 such that
A22: 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 :: thesis: S2[x,z]
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 A18, A21, A20;
suppose A23: card ((the_Edges_of x9) /\ (the_Edges_of G2)) > card ((the_Edges_of y9) /\ (the_Edges_of G2)) ; :: thesis: S2[x,z]
now :: thesis: S2[x,z]
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 A19, A20, A22;
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 A24: ( 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 :: thesis: S2[x,z]
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 A19, A20, A22;
suppose A25: ( 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
A26: S1[y,zy] by A8;
now :: thesis: for kx, kz being Nat st S1[x9,kx] & S1[z9,kz] holds
kx >= kz
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 A20, A24, A25, A26;
hence kx >= kz by XXREAL_0:2; :: thesis: verum
end;
hence S2[x,z] by A21, A22, A24, A25; :: thesis: verum
end;
end;
end;
hence S2[x,z] ; :: thesis: verum
end;
end;
end;
hence S2[x,z] ; :: thesis: verum
end;
then A27: for x, y, z being Element of X st S2[x,y] & S2[y,z] holds
S2[x,z] ;
A28: now :: thesis: for G being Element of X
for k1, k2 being Nat st S1[G,k1] & S1[G,k2] holds
k1 = k2
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 A29: ( S1[G,k1] & S1[G,k2] ) ; :: thesis: k1 = k2
then k2 + 1 > k1 ;
then A30: k2 >= k1 by NAT_1:13;
k1 + 1 > k2 by A29;
then k1 >= k2 by NAT_1:13;
hence k1 = k2 by A30, XXREAL_0:1; :: thesis: verum
end;
now :: thesis: for x, y being Element of X holds
( S2[x,y] or S2[y,x] )
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
A31: 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
A32: y9 = y and
dom y9 = WGraphSelectors by Def5;
set CY = card ((the_Edges_of y9) /\ (the_Edges_of G2));
now :: thesis: ( S2[x,y] or S2[y,x] )
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 A33: 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
A34: S1[x,k1] by A8;
consider k2 being Nat such that
A35: S1[y,k2] by A8;
now :: thesis: ( S2[x,y] or S2[y,x] )
per cases ( k1 >= k2 or k1 < k2 ) ;
suppose A36: k1 >= k2 ; :: thesis: ( S2[x,y] or S2[y,x] )
now :: thesis: for z1, z2 being Nat st S1[x,z1] & S1[y,z2] holds
z1 >= z2
let z1, z2 be Nat; :: thesis: ( S1[x,z1] & S1[y,z2] implies z1 >= z2 )
assume that
A37: S1[x,z1] and
A38: S1[y,z2] ; :: thesis: z1 >= z2
z1 = k1 by A28, A34, A37;
hence z1 >= z2 by A28, A35, A36, A38; :: thesis: verum
end;
hence ( S2[x,y] or S2[y,x] ) by A31, A32, A33; :: thesis: verum
end;
suppose A39: k1 < k2 ; :: thesis: ( S2[x,y] or S2[y,x] )
now :: thesis: for z1, z2 being Nat st S1[x,z1] & S1[y,z2] holds
z1 <= z2
let z1, z2 be Nat; :: thesis: ( S1[x,z1] & S1[y,z2] implies z1 <= z2 )
assume that
A40: S1[x,z1] and
A41: S1[y,z2] ; :: thesis: z1 <= z2
z1 = k1 by A28, A34, A40;
hence z1 <= z2 by A28, A35, A39, A41; :: thesis: verum
end;
hence ( S2[x,y] or S2[y,x] ) by A31, A32, A33; :: 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 A42: for x, y being Element of X holds
( S2[x,y] or S2[y,x] ) ;
A43: ( X is finite & X <> {} & X c= X ) ;
consider M being Element of X such that
A44: ( M in X & ( for y being Element of X st y in X holds
S2[M,y] ) ) from CQC_SIM1:sch 4(A43, A42, A27);
ex x being Element of G1 .allWSubgraphs() st
( M = x & x is minimumSpanningTree of G1 ) by A44;
then reconsider M = M as minimumSpanningTree of G1 ;
defpred S3[ Nat] means not ((PRIM:CompSeq G1) . $1) `2 c= the_Edges_of M;
A45: the_Vertices_of G2 = the_Vertices_of M by A3, GLIB_000:def 33;
A46: now :: thesis: not the_Edges_of G2 = the_Edges_of Mend;
now :: thesis: not the_Edges_of G2 c= the_Edges_of Mend;
then A49: ex k being Nat st S3[k] by A4;
consider k being Nat such that
A50: ( S3[k] & ( for n being Nat st S3[n] holds
k <= n ) ) from NAT_1:sch 5(A49);
now :: thesis: not k = 0 end;
then consider k1o being Nat such that
A52: 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 A52, XREAL_1:15;
then A53: ((PRIM:CompSeq G1) . k1o) `2 c= the_Edges_of M by A50;
set Next = PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o);
set ep = the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o);
A54: (PRIM:CompSeq G1) . k = PRIM:Step ((PRIM:CompSeq G1) . k1o) by A52, Def17;
then A55: PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) <> {} by A50, A53, Def15;
then A56: the Element of 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)})] ) by A54, A55, Th28;
then A57: ((PRIM:CompSeq G1) . k) `2 = (((PRIM:CompSeq G1) . k1o) `2) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} ;
then A58: not { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} c= the_Edges_of M by A50, A53, XBOOLE_1:8;
then A59: not the Element of 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)};
A60: the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) in PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) by A55;
then { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} c= the_Edges_of G1 by ZFMISC_1:31;
then (the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} c= the_Edges_of G1 by XBOOLE_1:8;
then A61: ( the_Vertices_of G1 c= the_Vertices_of G1 & (the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} c= G1 .edgesBetween (the_Vertices_of G1) ) by GLIB_000:34;
then A62: the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of 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 A6, GLIB_000:def 37;
then A63: the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} .cost() = (M .cost()) + ((the_Weight_of G1) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by A60, A59, A6, Th11;
set MG2 = (the_Edges_of M) /\ (the_Edges_of G2);
A64: ((PRIM:CompSeq G1) . k) `2 c= (PRIM:MST G1) `2 by Th42;
the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) in { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by TARSKI:def 1;
then A65: the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) in ((PRIM:CompSeq G1) . k) `2 by A57, XBOOLE_0:def 3;
then A66: { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} /\ (the_Edges_of G2) = { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A4, A64, ZFMISC_1:46;
now :: thesis: not ((the_Edges_of M) /\ (the_Edges_of G2)) /\ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} <> {} end;
then A69: (the_Edges_of M) /\ (the_Edges_of G2) misses { the Element of 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o);
set v2 = (the_Target_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o);
set V = ((PRIM:CompSeq G1) . k1o) `1 ;
A70: the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) by GLIB_003:def 10;
A71: 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;
A72: the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} = (the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A61, GLIB_000:def 37;
the_Vertices_of M c= the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A62;
then reconsider M9 = M as connected Subgraph of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A72, GLIB_000:44, XBOOLE_1:7;
the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) in { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by TARSKI:def 1;
then A73: the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) in the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A72, XBOOLE_0:def 3;
the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} = the_Vertices_of M by A62, GLIB_000:def 33;
then reconsider v1 = (the_Source_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o), v2 = (the_Target_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) as Vertex of M by A73, FUNCT_2:5;
consider W being Walk of M9 such that
A74: 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by GLIB_001:175;
A75: the Path of W is_Walk_from v2,v1 by A74, GLIB_001:160;
then A76: P is_Walk_from v2,v1 by GLIB_001:19;
A77: now :: thesis: for n being odd Element of NAT st 1 < n & n <= len P holds
not P . n = v2
reconsider PM = P as Walk of M ;
let n be odd Element of NAT ; :: thesis: ( 1 < n & n <= len P implies not P . n = v2 )
assume that
A78: ( 1 < n & n <= len P ) and
A79: P . n = v2 ; :: thesis: contradiction
v2 = P .first() by A76, GLIB_001:def 23
.= P . ((2 * 0) + 1) by GLIB_001:def 6 ;
then n = len P by A78, A79, GLIB_001:def 28;
then P .last() = v2 by A79, GLIB_001:def 7
.= P .first() by A76, GLIB_001:def 23 ;
then P is closed by GLIB_001:def 24;
then A80: PM is closed by GLIB_001:176;
PM is trivial by A78, GLIB_001:126;
then PM is Cycle-like by A80, GLIB_001:def 31;
hence contradiction by GLIB_002:def 2; :: thesis: verum
end;
A81: the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) Joins v1,v2, the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A73;
then A82: the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) Joins P .last() ,v2, the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A76, GLIB_001:def 23;
the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) Joins v1,v2,G1 by A81, GLIB_000:72;
then A83: the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) Joins v1,v2,G29 by A4, A65, A64, GLIB_000:73;
v1 <> v2 by A83, GLIB_000:def 18;
then v1 <> P .first() by A76, GLIB_001:def 23;
then P .last() <> P .first() by A76, GLIB_001:def 23;
then A84: P is open 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 the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) in P .edges() by A58, ZFMISC_1:31;
then A85: P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) is Path-like by A84, A82, A77, GLIB_001:150;
P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) is_Walk_from v2,v2 by A76, A81, GLIB_001:66;
then A86: P .addEdge the Element of 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A62;
then reconsider M9 = M as connected Subgraph of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A72, 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A62, GLIB_000:def 33;
then M9 is spanning ;
then A87: the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} is connected by GLIB_002:23;
A88: v2 = P . 1 by A75, GLIB_001:17;
set C = P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o);
A89: v1 = P . (len P) by A75, GLIB_001:17;
A90: ( (the_Source_of G1) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) = v1 & (the_Target_of G1) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) = v2 ) by A73, GLIB_000:def 32;
now :: thesis: ex em being set st
( em in (P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) .edges() & em <> the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) & em SJoins V,(the_Vertices_of M) \ V,M )
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 A56, A90;
suppose A91: ( 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 the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) .edges() & em <> the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) & em SJoins V,(the_Vertices_of M) \ V,M )

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

A106: ( len (P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) = (len P) + 2 & (P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) . ((len P) + 1) = the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) ) by A82, GLIB_001:64, GLIB_001:65;
defpred S4[ Nat] means ( $1 is odd & $1 <= len P & P . $1 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) );
A107: ex n being Nat st S4[n] by A89, A105;
consider m being Nat such that
A108: ( S4[m] & ( for n being Nat st S4[n] holds
m <= n ) ) from NAT_1:sch 5(A107);
reconsider m = m as odd Element of NAT by A108, ORDINAL1:def 12;
( 1 <= m & m <> 1 ) by A88, A105, A108, 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;
A109: m2k < m - 0 by XREAL_1:15;
then A110: m2k < len P by A108, XXREAL_0:2;
A111: now :: thesis: P . m2k in ((PRIM:CompSeq G1) . k1o) `1 end;
set em = P . (m2k + 1);
A113: P . (m2k + 1) in P .edges() by A110, GLIB_001:100;
then consider i being even Element of NAT such that
A114: 1 <= i and
A115: i <= len P and
A116: P . i = P . (m2k + 1) by GLIB_001:99;
i in dom P by A114, A115, FINSEQ_3:25;
then A117: (P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) . i = P . (m2k + 1) by A82, A116, GLIB_001:65;
take em = P . (m2k + 1); :: thesis: ( em in (P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) .edges() & em <> the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) & em SJoins V,(the_Vertices_of M) \ V,M )
(P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) .edges() = (P .edges()) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A82, GLIB_001:111;
hence em in (P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) .edges() by A113, XBOOLE_0:def 3; :: thesis: ( em <> the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) & em SJoins V,(the_Vertices_of M) \ V,M )
A118: (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 A115, XXREAL_0:2;
hence em <> the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) by A85, A114, A117, A106, A118, 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 A110, GLIB_001:def 3;
hence em SJoins V,(the_Vertices_of M) \ V,M by A71, A108, A111; :: thesis: verum
end;
end;
end;
then consider em being set such that
A119: em in (P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) .edges() and
A120: em <> the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) and
A121: 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) \/ { the Element of 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)},em as WSubgraph of G1 by GLIB_003:9;
A122: M2 .order() = card (the_Vertices_of G1) by A62, GLIB_000:53
.= M .order() by GLIB_000:def 33 ;
A123: em SJoins V,(the_Vertices_of G1) \ V,G1 by A71, A121, GLIB_000:72;
then A124: (the_Weight_of G1) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) <= (the_Weight_of G1) . em by A55, Def13;
set M29 = M2 | WGraphSelectors;
A125: M2 | WGraphSelectors == M2 by Lm4;
A126: the_Edges_of M2 = ((the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) \ {em} by A72, GLIB_000:51;
then A127: the_Edges_of (M2 | WGraphSelectors) = ((the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) \ {em} by A125;
{em} c= (the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} by A72, A119, ZFMISC_1:31;
then M2 .size() = (card ((the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)})) - (card {em}) by A126, CARD_2:44
.= (card ((the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)})) - 1 by CARD_1:30
.= ((card (the_Edges_of M)) + 1) - 1 by A59, CARD_2:41
.= M .size() ;
then A128: M2 .order() = (M2 .size()) + 1 by A122, GLIB_002:46;
A129: the_Weight_of (M2 | WGraphSelectors) = the_Weight_of M2 by Lm4;
then reconsider M29 = M2 | WGraphSelectors as WSubgraph of G1 by A125, GLIB_003:8;
A130: the_Vertices_of M29 = the_Vertices_of M2 by A125
.= the_Vertices_of G1 by A62, GLIB_000:53 ;
P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) is trivial by A82, GLIB_001:132;
then P .addEdge the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) is Cycle-like by A85, A86, GLIB_001:def 31;
then M2 is connected by A119, A87, GLIB_002:5;
then M2 is Tree-like by A128, 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 A130, GLIB_000:def 33;
(M2 .cost()) + ((the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) . em) = the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} .cost() by A119, Th10;
then M2 .cost() = ( the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} .cost()) - ((the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) . em) ;
then M2 .cost() = ((M .cost()) + ((the_Weight_of G1) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) - ((the_Weight_of G1) . em) by A119, A63, A70, FUNCT_1:49;
then M29 .cost() = ((M .cost()) + ((the_Weight_of G1) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) - ((the_Weight_of G1) . em) by A125, A129;
then A131: ((M29 .cost()) + ((the_Weight_of G1) . em)) - ((the_Weight_of G1) . em) <= ((M .cost()) + ((the_Weight_of G1) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) - ((the_Weight_of G1) . the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by A124, XREAL_1:13;
now :: thesis: for G3 being spanning Tree-like WSubgraph of G1 holds M29 .cost() <= G3 .cost() end;
then reconsider M29 = M29 as minimumSpanningTree of G1 by Def19;
set MG29 = (the_Edges_of M29) /\ (the_Edges_of G2);
A132: (the_Edges_of M29) /\ (the_Edges_of G2) = (((the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) /\ (the_Edges_of G2)) \ ({em} /\ (the_Edges_of G2)) by A127, XBOOLE_1:50;
dom M29 = WGraphSelectors by Lm5;
then M29 in G1 .allWSubgraphs() by Def5;
then A133: M29 in X ;
A134: now :: thesis: ( not ((PRIM:CompSeq G1) . (k1o + 1)) `2 c= the_Edges_of M & ( for n being Nat st n <= k1o holds
((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M ) )
thus not ((PRIM:CompSeq G1) . (k1o + 1)) `2 c= the_Edges_of M by A50, A52; :: 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 A53; :: thesis: verum
end;
A135: now :: thesis: not em in the_Edges_of G2
consider k2 being Nat such that
A136: S1[M29,k2] by A8, A133;
now :: thesis: for x being object st x in ((PRIM:CompSeq G1) . k) `2 holds
x in the_Edges_of M29
end;
then A144: ((PRIM:CompSeq G1) . k) `2 c= the_Edges_of M29 ;
A145: now :: thesis: not k2 < kend;
assume A146: em in the_Edges_of G2 ; :: thesis: contradiction
then A147: {em} c= ((the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) /\ (the_Edges_of G2) ;
(the_Edges_of M29) /\ (the_Edges_of G2) = (((the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) /\ (the_Edges_of G2)) \ {em} by A132, A146, 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) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) /\ (the_Edges_of G2))) - (card {em}) by A72, A147, CARD_2:44
.= (card ((the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) /\ (the_Edges_of G2))) - 1 by CARD_1:30
.= (card (((the_Edges_of M) /\ (the_Edges_of G2)) \/ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)})) - 1 by A72, A66, XBOOLE_1:23
.= ((card ((the_Edges_of M) /\ (the_Edges_of G2))) + (card { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)})) - 1 by A69, 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 A148: k1o >= k2 by A44, A133, A134, A136;
(k1o + 1) - 1 < k - 0 by A52, XREAL_1:15;
hence contradiction by A145, A148, XXREAL_0:2; :: thesis: verum
end;
now :: thesis: not {em} /\ (the_Edges_of G2) <> {}
assume {em} /\ (the_Edges_of G2) <> {} ; :: thesis: contradiction
then consider x being object such that
A149: x in {em} /\ (the_Edges_of G2) by XBOOLE_0:def 1;
( x in {em} & x in the_Edges_of G2 ) by A149, XBOOLE_0:def 4;
hence contradiction by A135, TARSKI:def 1; :: thesis: verum
end;
then A150: (the_Edges_of M29) /\ (the_Edges_of G2) = ((the_Edges_of M) /\ (the_Edges_of G2)) \/ ({ the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} /\ (the_Edges_of G2)) by A132, XBOOLE_1:23;
now :: thesis: not ((the_Edges_of M) /\ (the_Edges_of G2)) /\ { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)} <> {} end;
then (the_Edges_of M) /\ (the_Edges_of G2) misses { the Element of 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 { the Element of PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)}) by A66, A150, 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 A44, A133;
hence contradiction by XREAL_1:6; :: thesis: verum
end;
hence G2 is minimumSpanningTree of G1 ; :: thesis: verum