Article GLIB_004, MML version 4.99.1005
:: GLIB_004:th 1
theorem
for b1, b2 being Relation-like Function-like set holds
support (b1 +* b2) c= (support b1) \/ support b2;
:: GLIB_004:th 2
theorem
for b1 being Relation-like Function-like set
for b2, b3 being set holds
support (b1 +* (b2 .--> b3)) c= (support b1) \/ {b2};
:: GLIB_004:th 3
theorem
for b1, b2 being set
for b3 being real-valued finite-support ManySortedSet of b1
for b4 being real-valued finite-support ManySortedSet of b2
for b5 being real-valued finite-support ManySortedSet of b1 \ b2
st b3 = b4 +* b5
holds Sum b3 = (Sum b4) + Sum b5;
:: GLIB_004:th 4
theorem
for b1, b2 being set
for b3 being real-valued finite-support ManySortedSet of b1
st proj1 b3 = {b2}
holds Sum b3 = b3 . b2;
:: GLIB_004:th 5
theorem
for b1 being set
for b2, b3 being real-valued finite-support ManySortedSet of b1
st for b4 being set
st b4 in b1
holds b2 . b4 <= b3 . b4
holds Sum b2 <= Sum b3;
:: GLIB_004:th 6
theorem
for b1 being set
for b2, b3 being real-valued finite-support ManySortedSet of b1
st for b4 being set
st b4 in b1
holds b2 . b4 = b3 . b4
holds Sum b2 = Sum b3;
:: GLIB_004:th 7
theorem
for b1, b2 being set
for b3 being real-valued finite-support ManySortedSet of b1
for b4 being real-valued finite-support ManySortedSet of b2
st b3 = b4
holds Sum b3 = Sum b4;
:: GLIB_004:th 8
theorem
for b1, b2 being set
for b3 being real-valued finite-support ManySortedSet of b1
for b4 being real set
st b3 = (EmptyBag b1) +* (b2 .--> b4)
holds Sum b3 = b4;
:: GLIB_004:th 9
theorem
for b1, b2 being set
for b3, b4 being real-valued finite-support ManySortedSet of b1
for b5 being real set
st b4 = b3 +* (b2 .--> b5)
holds Sum b4 = ((Sum b3) + b5) - (b3 . b2);
:: GLIB_004:prednot 1 => GLIB_004:pred 1
definition
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
let a2 be [Weighted] weight-inheriting Subgraph of a1;
let a3 be set;
pred A2 is_mincost_DTree_rooted_at A3 means
a2 is Tree-like &
(for b1 being Element of the_Vertices_of a2 holds
ex b2 being directed Path-like Walk of a2 st
b2 is_Walk_from a3,b1 &
(for b3 being directed Path-like Walk of a1
st b3 is_Walk_from a3,b1
holds b2 .cost() <= b3 .cost()));
end;
:: GLIB_004:dfs 1
definiens
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
let a2 be [Weighted] weight-inheriting Subgraph of a1;
let a3 be set;
To prove
a2 is_mincost_DTree_rooted_at a3
it is sufficient to prove
thus a2 is Tree-like &
(for b1 being Element of the_Vertices_of a2 holds
ex b2 being directed Path-like Walk of a2 st
b2 is_Walk_from a3,b1 &
(for b3 being directed Path-like Walk of a1
st b3 is_Walk_from a3,b1
holds b2 .cost() <= b3 .cost()));
:: GLIB_004:def 1
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being [Weighted] weight-inheriting Subgraph of b1
for b3 being set holds
b2 is_mincost_DTree_rooted_at b3
iff
b2 is Tree-like &
(for b4 being Element of the_Vertices_of b2 holds
ex b5 being directed Path-like Walk of b2 st
b5 is_Walk_from b3,b4 &
(for b6 being directed Path-like Walk of b1
st b6 is_Walk_from b3,b4
holds b5 .cost() <= b6 .cost()));
:: GLIB_004:prednot 2 => GLIB_004:pred 2
definition
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
let a2 be directed Path-like Walk of a1;
let a3, a4 be set;
pred A2 is_mincost_DPath_from A3,A4 means
a2 is_Walk_from a3,a4 &
(for b1 being directed Path-like Walk of a1
st b1 is_Walk_from a3,a4
holds a2 .cost() <= b1 .cost());
end;
:: GLIB_004:dfs 2
definiens
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
let a2 be directed Path-like Walk of a1;
let a3, a4 be set;
To prove
a2 is_mincost_DPath_from a3,a4
it is sufficient to prove
thus a2 is_Walk_from a3,a4 &
(for b1 being directed Path-like Walk of a1
st b1 is_Walk_from a3,a4
holds a2 .cost() <= b1 .cost());
:: GLIB_004:def 2
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being directed Path-like Walk of b1
for b3, b4 being set holds
b2 is_mincost_DPath_from b3,b4
iff
b2 is_Walk_from b3,b4 &
(for b5 being directed Path-like Walk of b1
st b5 is_Walk_from b3,b4
holds b2 .cost() <= b5 .cost());
:: GLIB_004:funcnot 1 => GLIB_004:func 1
definition
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
let a2, a3 be set;
func A1 .min_DPath_cost(A2,A3) -> Element of REAL means
ex b1 being directed Path-like Walk of a1 st
b1 is_mincost_DPath_from a2,a3 & it = b1 .cost()
if ex b1 being directed Walk of a1 st
b1 is_Walk_from a2,a3
otherwise it = 0;
end;
:: GLIB_004:def 3
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2, b3 being set
for b4 being Element of REAL holds
(for b5 being directed Walk of b1 holds
not b5 is_Walk_from b2,b3 or (b4 = b1 .min_DPath_cost(b2,b3)
iff
ex b5 being directed Path-like Walk of b1 st
b5 is_mincost_DPath_from b2,b3 & b4 = b5 .cost())) &
(for b5 being directed Walk of b1 holds
not b5 is_Walk_from b2,b3 implies (b4 = b1 .min_DPath_cost(b2,b3)
iff
b4 = 0));
:: GLIB_004:funcnot 2 => GLIB_004:func 2
definition
let a1 be [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct;
func DIJK:NextBestEdges A1 -> Element of bool the_Edges_of a1 means
for b1 being set holds
b1 in it
iff
b1 DSJoins a1 .labeledV(),(the_Vertices_of a1) \ (a1 .labeledV()),a1 &
(for b2 being set
st b2 DSJoins a1 .labeledV(),(the_Vertices_of a1) \ (a1 .labeledV()),a1
holds ((the_VLabel_of a1) . ((the_Source_of a1) . b1)) + ((the_Weight_of a1) . b1) <= ((the_VLabel_of a1) . ((the_Source_of a1) . b2)) + ((the_Weight_of a1) . b2));
end;
:: GLIB_004:def 4
theorem
for b1 being [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct
for b2 being Element of bool the_Edges_of b1 holds
b2 = DIJK:NextBestEdges b1
iff
for b3 being set holds
b3 in b2
iff
b3 DSJoins b1 .labeledV(),(the_Vertices_of b1) \ (b1 .labeledV()),b1 &
(for b4 being set
st b4 DSJoins b1 .labeledV(),(the_Vertices_of b1) \ (b1 .labeledV()),b1
holds ((the_VLabel_of b1) . ((the_Source_of b1) . b3)) + ((the_Weight_of b1) . b3) <= ((the_VLabel_of b1) . ((the_Source_of b1) . b4)) + ((the_Weight_of b1) . b4));
:: GLIB_004:funcnot 3 => GLIB_004:func 3
definition
let a1 be [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct;
func DIJK:Step A1 -> [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct equals
a1
if DIJK:NextBestEdges a1 = {}
otherwise (a1 .labelEdge(choose DIJK:NextBestEdges a1,1)) .labelVertex((the_Target_of a1) . choose DIJK:NextBestEdges a1,((the_VLabel_of a1) . ((the_Source_of a1) . choose DIJK:NextBestEdges a1)) + ((the_Weight_of a1) . choose DIJK:NextBestEdges a1));
end;
:: GLIB_004:def 5
theorem
for b1 being [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct holds
(DIJK:NextBestEdges b1 = {} implies DIJK:Step b1 = b1) &
(DIJK:NextBestEdges b1 = {} or DIJK:Step b1 = (b1 .labelEdge(choose DIJK:NextBestEdges b1,1)) .labelVertex((the_Target_of b1) . choose DIJK:NextBestEdges b1,((the_VLabel_of b1) . ((the_Source_of b1) . choose DIJK:NextBestEdges b1)) + ((the_Weight_of b1) . choose DIJK:NextBestEdges b1)));
:: GLIB_004:funcreg 1
registration
let a1 be [Graph-like] finite [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct;
cluster DIJK:Step a1 -> [Graph-like] finite [Weighted] [ELabeled] [VLabeled] real-WEV;
end;
:: GLIB_004:funcreg 2
registration
let a1 be [Graph-like] [Weighted] [ELabeled] [VLabeled] nonnegative-weighted real-WEV GraphStruct;
cluster DIJK:Step a1 -> [Graph-like] [Weighted] [ELabeled] [VLabeled] nonnegative-weighted real-WEV;
end;
:: GLIB_004:funcnot 4 => GLIB_004:func 4
definition
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
let a2 be Element of the_Vertices_of a1;
func DIJK:Init(A1,A2) -> [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct equals
(a1 .set(ELabelSelector,{})) .set(VLabelSelector,a2 .--> 0);
end;
:: GLIB_004:def 6
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1 holds
DIJK:Init(b1,b2) = (b1 .set(ELabelSelector,{})) .set(VLabelSelector,b2 .--> 0);
:: GLIB_004:funcnot 5 => GLIB_004:func 5
definition
let a1 be Graph-yielding [Weighted] [ELabeled] [VLabeled] ManySortedSet of NAT;
let a2 be natural set;
redefine func a1 . a2 -> [Graph-like] [Weighted] [ELabeled] [VLabeled] GraphStruct;
end;
:: GLIB_004:funcreg 3
registration
let a1 be Graph-yielding [Weighted] [ELabeled] [VLabeled] real-WEV ManySortedSet of NAT;
let a2 be natural set;
cluster a1 . a2 -> [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV;
end;
:: GLIB_004:funcnot 6 => GLIB_004:func 6
definition
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
let a2 be Element of the_Vertices_of a1;
func DIJK:CompSeq(A1,A2) -> Graph-yielding [Weighted] [ELabeled] [VLabeled] real-WEV ManySortedSet of NAT means
it . 0 = DIJK:Init(a1,a2) &
(for b1 being Element of NAT holds
it . (b1 + 1) = DIJK:Step (it . b1));
end;
:: GLIB_004:def 7
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3 being Graph-yielding [Weighted] [ELabeled] [VLabeled] real-WEV ManySortedSet of NAT holds
b3 = DIJK:CompSeq(b1,b2)
iff
b3 . 0 = DIJK:Init(b1,b2) &
(for b4 being Element of NAT holds
b3 . (b4 + 1) = DIJK:Step (b3 . b4));
:: GLIB_004:funcreg 4
registration
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
let a2 be Element of the_Vertices_of a1;
cluster DIJK:CompSeq(a1,a2) -> Graph-yielding finite [Weighted] [ELabeled] [VLabeled] real-WEV;
end;
:: GLIB_004:funcreg 5
registration
let a1 be [Graph-like] [Weighted] nonnegative-weighted GraphStruct;
let a2 be Element of the_Vertices_of a1;
cluster DIJK:CompSeq(a1,a2) -> Graph-yielding [Weighted] [ELabeled] [VLabeled] nonnegative-weighted real-WEV;
end;
:: GLIB_004:funcnot 7 => GLIB_004:func 7
definition
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
let a2 be Element of the_Vertices_of a1;
func DIJK:SSSP(A1,A2) -> [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct equals
(DIJK:CompSeq(a1,a2)) .Result();
end;
:: GLIB_004:def 8
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1 holds
DIJK:SSSP(b1,b2) = (DIJK:CompSeq(b1,b2)) .Result();
:: GLIB_004:funcreg 6
registration
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
let a2 be Element of the_Vertices_of a1;
cluster DIJK:SSSP(a1,a2) -> [Graph-like] finite [Weighted] [ELabeled] [VLabeled] real-WEV;
end;
:: GLIB_004:th 10
theorem
for b1 being [Graph-like] finite [Weighted] nonnegative-weighted GraphStruct
for b2 being directed Path-like Walk of b1
for b3, b4 being set
for b5, b6 being Element of NAT
st b2 is_mincost_DPath_from b3,b4
holds b2 .cut(b5,b6) is_mincost_DPath_from (b2 .cut(b5,b6)) .first(),(b2 .cut(b5,b6)) .last();
:: GLIB_004:th 11
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2, b3 being directed Path-like Walk of b1
for b4, b5 being set
st b2 is_mincost_DPath_from b4,b5 & b3 is_mincost_DPath_from b4,b5
holds b2 .cost() = b3 .cost();
:: GLIB_004:th 12
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being directed Path-like Walk of b1
for b3, b4 being set
st b2 is_mincost_DPath_from b3,b4
holds b1 .min_DPath_cost(b3,b4) = b2 .cost();
:: GLIB_004:th 13
theorem
for b1 being [Graph-like] finite [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct holds
(card ((DIJK:Step b1) .labeledV()) = card (b1 .labeledV()) implies DIJK:NextBestEdges b1 = {}) &
(DIJK:NextBestEdges b1 = {} implies card ((DIJK:Step b1) .labeledV()) = card (b1 .labeledV())) &
(card ((DIJK:Step b1) .labeledV()) = (card (b1 .labeledV())) + 1 implies DIJK:NextBestEdges b1 <> {}) &
(DIJK:NextBestEdges b1 = {} or card ((DIJK:Step b1) .labeledV()) = (card (b1 .labeledV())) + 1);
:: GLIB_004:th 14
theorem
for b1 being [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct holds
b1 == DIJK:Step b1 & the_Weight_of b1 = the_Weight_of DIJK:Step b1 & b1 .labeledE() c= (DIJK:Step b1) .labeledE() & b1 .labeledV() c= (DIJK:Step b1) .labeledV();
:: GLIB_004:th 15
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1 holds
(DIJK:Init(b1,b2)) .labeledV() = {b2};
:: GLIB_004:th 16
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3, b4 being Element of NAT
st b3 <= b4
holds ((DIJK:CompSeq(b1,b2)) . b3) .labeledV() c= ((DIJK:CompSeq(b1,b2)) . b4) .labeledV() &
((DIJK:CompSeq(b1,b2)) . b3) .labeledE() c= ((DIJK:CompSeq(b1,b2)) . b4) .labeledE();
:: GLIB_004:th 17
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3 being Element of NAT holds
b1 == (DIJK:CompSeq(b1,b2)) . b3 &
the_Weight_of b1 = the_Weight_of ((DIJK:CompSeq(b1,b2)) . b3);
:: GLIB_004:th 18
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3 being Element of NAT holds
((DIJK:CompSeq(b1,b2)) . b3) .labeledV() c= b1 .reachableDFrom b2;
:: GLIB_004:funcreg 7
registration
let a1 be Graph-yielding finite [Weighted] [ELabeled] [VLabeled] ManySortedSet of NAT;
let a2 be natural set;
cluster a1 . a2 -> [Graph-like] finite [Weighted] [ELabeled] [VLabeled];
end;
:: GLIB_004:th 19
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3 being Element of NAT holds
DIJK:NextBestEdges ((DIJK:CompSeq(b1,b2)) . b3) = {}
iff
((DIJK:CompSeq(b1,b2)) . b3) .labeledV() = b1 .reachableDFrom b2;
:: GLIB_004:th 20
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3 being Element of NAT holds
Card (((DIJK:CompSeq(b1,b2)) . b3) .labeledV()) = min(b3 + 1,card (b1 .reachableDFrom b2));
:: GLIB_004:th 21
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3 being Element of NAT holds
((DIJK:CompSeq(b1,b2)) . b3) .labeledE() c= ((DIJK:CompSeq(b1,b2)) . b3) .edgesBetween (((DIJK:CompSeq(b1,b2)) . b3) .labeledV());
:: GLIB_004:th 22
theorem
for b1 being [Graph-like] finite [Weighted] nonnegative-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3 being Element of NAT
for b4 being [Weighted] weight-inheriting inducedSubgraph of b1,((DIJK:CompSeq(b1,b2)) . b3) .labeledV(),((DIJK:CompSeq(b1,b2)) . b3) .labeledE() holds
b4 is_mincost_DTree_rooted_at b2 &
(for b5 being Element of the_Vertices_of b1
st b5 in ((DIJK:CompSeq(b1,b2)) . b3) .labeledV()
holds b1 .min_DPath_cost(b2,b5) = (the_VLabel_of ((DIJK:CompSeq(b1,b2)) . b3)) . b5);
:: GLIB_004:th 23
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1 holds
DIJK:CompSeq(b1,b2) is halting;
:: GLIB_004:funcreg 8
registration
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
let a2 be Element of the_Vertices_of a1;
cluster DIJK:CompSeq(a1,a2) -> Graph-yielding halting [Weighted] [ELabeled] [VLabeled] real-WEV;
end;
:: GLIB_004:th 24
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1 holds
(DIJK:CompSeq(b1,b2)) .Lifespan() + 1 = card (b1 .reachableDFrom b2);
:: GLIB_004:th 25
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of the_Vertices_of b1 holds
(DIJK:SSSP(b1,b2)) .labeledV() = b1 .reachableDFrom b2;
:: GLIB_004:th 26
theorem
for b1 being [Graph-like] finite [Weighted] nonnegative-weighted GraphStruct
for b2 being Element of the_Vertices_of b1
for b3 being [Weighted] weight-inheriting inducedSubgraph of b1,(DIJK:SSSP(b1,b2)) .labeledV(),(DIJK:SSSP(b1,b2)) .labeledE() holds
b3 is_mincost_DTree_rooted_at b2 &
(for b4 being Element of the_Vertices_of b1
st b4 in b1 .reachableDFrom b2
holds b4 in the_Vertices_of b3 &
b1 .min_DPath_cost(b2,b4) = (the_VLabel_of DIJK:SSSP(b1,b2)) . b4);
:: GLIB_004:funcnot 8 => GLIB_004:func 8
definition
func WGraphSelectors -> non empty finite Element of bool NAT equals
{VertexSelector,EdgeSelector,SourceSelector,TargetSelector,WeightSelector};
end;
:: GLIB_004:def 9
theorem
WGraphSelectors = {VertexSelector,EdgeSelector,SourceSelector,TargetSelector,WeightSelector};
:: GLIB_004:funcreg 9
registration
let a1 be [Graph-like] [Weighted] GraphStruct;
cluster a1 .strict WGraphSelectors -> [Graph-like] [Weighted];
end;
:: GLIB_004:funcnot 9 => GLIB_004:func 9
definition
let a1 be [Graph-like] [Weighted] GraphStruct;
func A1 .allWSubgraphs() -> non empty set means
for b1 being set holds
b1 in it
iff
ex b2 being [Weighted] weight-inheriting Subgraph of a1 st
b1 = b2 & proj1 b2 = WGraphSelectors;
end;
:: GLIB_004:def 10
theorem
for b1 being [Graph-like] [Weighted] GraphStruct
for b2 being non empty set holds
b2 = b1 .allWSubgraphs()
iff
for b3 being set holds
b3 in b2
iff
ex b4 being [Weighted] weight-inheriting Subgraph of b1 st
b3 = b4 & proj1 b4 = WGraphSelectors;
:: GLIB_004:funcreg 10
registration
let a1 be [Graph-like] finite [Weighted] GraphStruct;
cluster a1 .allWSubgraphs() -> non empty finite;
end;
:: GLIB_004:modenot 1 => GLIB_004:mode 1
definition
let a1 be [Graph-like] [Weighted] GraphStruct;
let a2 be non empty Element of bool (a1 .allWSubgraphs());
redefine mode Element of a2 -> [Weighted] weight-inheriting Subgraph of a1;
end;
:: GLIB_004:funcnot 10 => GLIB_004:func 10
definition
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
func A1 .cost() -> Element of REAL equals
Sum the_Weight_of a1;
end;
:: GLIB_004:def 11
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct holds
b1 .cost() = Sum the_Weight_of b1;
:: GLIB_004:th 28
theorem
for b1 being [Graph-like] [Weighted] GraphStruct holds
WGraphSelectors c= proj1 b1;
:: GLIB_004:th 29
theorem
for b1 being [Graph-like] [Weighted] GraphStruct holds
b1 == b1 .strict WGraphSelectors & the_Weight_of b1 = the_Weight_of (b1 .strict WGraphSelectors);
:: GLIB_004:th 30
theorem
for b1 being [Graph-like] [Weighted] GraphStruct holds
proj1 (b1 .strict WGraphSelectors) = WGraphSelectors;
:: GLIB_004:th 31
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
st the_Edges_of b1 = {}
holds b1 .cost() = 0;
:: GLIB_004:th 32
theorem
for b1, b2 being [Graph-like] finite [Weighted] real-weighted GraphStruct
st the_Edges_of b1 = the_Edges_of b2 & the_Weight_of b1 = the_Weight_of b2
holds b1 .cost() = b2 .cost();
:: GLIB_004:th 33
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being set
for b3 being [Weighted] weight-inheriting inducedSubgraph of b1,the_Vertices_of b1,(the_Edges_of b1) \ {b2}
st b2 in the_Edges_of b1
holds b1 .cost() = b3 .cost() + ((the_Weight_of b1) . b2);
:: GLIB_004:th 34
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being non empty Element of bool the_Vertices_of b1
for b3 being Element of bool (b1 .edgesBetween b2)
for b4 being [Weighted] weight-inheriting inducedSubgraph of b1,b2,b3
for b5 being set
for b6 being [Weighted] weight-inheriting inducedSubgraph of b1,b2,b3 \/ {b5}
st not b5 in b3 & b5 in b1 .edgesBetween b2
holds b4 .cost() + ((the_Weight_of b1) . b5) = b6 .cost();
:: GLIB_004:funcnot 11 => GLIB_004:func 11
definition
let a1 be [Graph-like] [Weighted] [VLabeled] real-weighted GraphStruct;
func PRIM:NextBestEdges A1 -> Element of bool the_Edges_of a1 means
for b1 being set holds
b1 in it
iff
b1 SJoins a1 .labeledV(),(the_Vertices_of a1) \ (a1 .labeledV()),a1 &
(for b2 being set
st b2 SJoins a1 .labeledV(),(the_Vertices_of a1) \ (a1 .labeledV()),a1
holds (the_Weight_of a1) . b1 <= (the_Weight_of a1) . b2);
end;
:: GLIB_004:def 12
theorem
for b1 being [Graph-like] [Weighted] [VLabeled] real-weighted GraphStruct
for b2 being Element of bool the_Edges_of b1 holds
b2 = PRIM:NextBestEdges b1
iff
for b3 being set holds
b3 in b2
iff
b3 SJoins b1 .labeledV(),(the_Vertices_of b1) \ (b1 .labeledV()),b1 &
(for b4 being set
st b4 SJoins b1 .labeledV(),(the_Vertices_of b1) \ (b1 .labeledV()),b1
holds (the_Weight_of b1) . b3 <= (the_Weight_of b1) . b4);
:: GLIB_004:funcnot 12 => GLIB_004:func 12
definition
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
func PRIM:Init A1 -> [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct equals
(a1 .set(VLabelSelector,(choose the_Vertices_of a1) .--> 1)) .set(ELabelSelector,{});
end;
:: GLIB_004:def 13
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct holds
PRIM:Init b1 = (b1 .set(VLabelSelector,(choose the_Vertices_of b1) .--> 1)) .set(ELabelSelector,{});
:: GLIB_004:funcnot 13 => GLIB_004:func 13
definition
let a1 be [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct;
func PRIM:Step A1 -> [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct equals
a1
if PRIM:NextBestEdges a1 = {},
(a1 .labelEdge(choose PRIM:NextBestEdges a1,1)) .labelVertex((the_Target_of a1) . choose PRIM:NextBestEdges a1,1)
if PRIM:NextBestEdges a1 <> {} &
(the_Source_of a1) . choose PRIM:NextBestEdges a1 in a1 .labeledV()
otherwise (a1 .labelEdge(choose PRIM:NextBestEdges a1,1)) .labelVertex((the_Source_of a1) . choose PRIM:NextBestEdges a1,1);
end;
:: GLIB_004:def 14
theorem
for b1 being [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct holds
(PRIM:NextBestEdges b1 = {} implies PRIM:Step b1 = b1) &
(PRIM:NextBestEdges b1 <> {} &
(the_Source_of b1) . choose PRIM:NextBestEdges b1 in b1 .labeledV() implies PRIM:Step b1 = (b1 .labelEdge(choose PRIM:NextBestEdges b1,1)) .labelVertex((the_Target_of b1) . choose PRIM:NextBestEdges b1,1)) &
(PRIM:NextBestEdges b1 <> {} &
(PRIM:NextBestEdges b1 <> {} implies not (the_Source_of b1) . choose PRIM:NextBestEdges b1 in b1 .labeledV()) implies PRIM:Step b1 = (b1 .labelEdge(choose PRIM:NextBestEdges b1,1)) .labelVertex((the_Source_of b1) . choose PRIM:NextBestEdges b1,1));
:: GLIB_004:funcnot 14 => GLIB_004:func 14
definition
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
func PRIM:CompSeq A1 -> Graph-yielding [Weighted] [ELabeled] [VLabeled] real-WEV ManySortedSet of NAT means
it . 0 = PRIM:Init a1 &
(for b1 being Element of NAT holds
it . (b1 + 1) = PRIM:Step (it . b1));
end;
:: GLIB_004:def 15
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct
for b2 being Graph-yielding [Weighted] [ELabeled] [VLabeled] real-WEV ManySortedSet of NAT holds
b2 = PRIM:CompSeq b1
iff
b2 . 0 = PRIM:Init b1 &
(for b3 being Element of NAT holds
b2 . (b3 + 1) = PRIM:Step (b2 . b3));
:: GLIB_004:funcreg 11
registration
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
cluster PRIM:CompSeq a1 -> Graph-yielding finite [Weighted] [ELabeled] [VLabeled] real-WEV;
end;
:: GLIB_004:funcnot 15 => GLIB_004:func 15
definition
let a1 be [Graph-like] [Weighted] real-weighted GraphStruct;
func PRIM:MST A1 -> [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct equals
(PRIM:CompSeq a1) .Result();
end;
:: GLIB_004:def 16
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct holds
PRIM:MST b1 = (PRIM:CompSeq b1) .Result();
:: GLIB_004:funcreg 12
registration
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
cluster PRIM:MST a1 -> [Graph-like] finite [Weighted] [ELabeled] [VLabeled] real-WEV;
end;
:: GLIB_004:condreg 1
registration
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
let a2 be Element of NAT;
cluster -> connected (inducedSubgraph of a1,((PRIM:CompSeq a1) . a2) .labeledV(),a1 .edgesBetween (((PRIM:CompSeq a1) . a2) .labeledV()));
end;
:: GLIB_004:condreg 2
registration
let a1 be [Graph-like] finite [Weighted] real-weighted GraphStruct;
let a2 be Element of NAT;
cluster -> connected (inducedSubgraph of a1,((PRIM:CompSeq a1) . a2) .labeledV(),((PRIM:CompSeq a1) . a2) .labeledE());
end;
:: GLIB_004:exreg 1
registration
let a1 be [Graph-like] finite connected [Weighted] real-weighted GraphStruct;
cluster Relation-like Function-like finite finite-support [Graph-like] finite spanning Tree-like [Weighted] weight-inheriting real-weighted Subgraph of a1;
end;
:: GLIB_004:attrnot 1 => GLIB_004:attr 1
definition
let a1 be [Graph-like] finite connected [Weighted] real-weighted GraphStruct;
let a2 be spanning Tree-like [Weighted] weight-inheriting Subgraph of a1;
attr a2 is min-cost means
for b1 being spanning Tree-like [Weighted] weight-inheriting Subgraph of a1 holds
a2 .cost() <= b1 .cost();
end;
:: GLIB_004:dfs 17
definiens
let a1 be [Graph-like] finite connected [Weighted] real-weighted GraphStruct;
let a2 be spanning Tree-like [Weighted] weight-inheriting Subgraph of a1;
To prove
a2 is min-cost
it is sufficient to prove
thus for b1 being spanning Tree-like [Weighted] weight-inheriting Subgraph of a1 holds
a2 .cost() <= b1 .cost();
:: GLIB_004:def 17
theorem
for b1 being [Graph-like] finite connected [Weighted] real-weighted GraphStruct
for b2 being spanning Tree-like [Weighted] weight-inheriting Subgraph of b1 holds
b2 is min-cost(b1)
iff
for b3 being spanning Tree-like [Weighted] weight-inheriting Subgraph of b1 holds
b2 .cost() <= b3 .cost();
:: GLIB_004:exreg 2
registration
let a1 be [Graph-like] finite connected [Weighted] real-weighted GraphStruct;
cluster Relation-like Function-like finite finite-support [Graph-like] finite loopless non-multi non-Dmulti simple Dsimple spanning connected acyclic Tree-like [Weighted] weight-inheriting real-weighted min-cost Subgraph of a1;
end;
:: GLIB_004:modenot 2
definition
let a1 be [Graph-like] finite connected [Weighted] real-weighted GraphStruct;
mode minimumSpanningTree of a1 is spanning Tree-like [Weighted] weight-inheriting min-cost Subgraph of a1;
end;
:: GLIB_004:th 35
theorem
for b1, b2 being [Graph-like] finite connected [Weighted] real-weighted GraphStruct
for b3 being [Weighted] weight-inheriting Subgraph of b1
st b3 is spanning Tree-like [Weighted] weight-inheriting min-cost Subgraph of b1 &
b1 == b2 &
the_Weight_of b1 = the_Weight_of b2
holds b3 is spanning Tree-like [Weighted] weight-inheriting min-cost Subgraph of b2;
:: GLIB_004:th 36
theorem
for b1 being [Graph-like] finite connected [Weighted] real-weighted GraphStruct
for b2 being spanning Tree-like [Weighted] weight-inheriting min-cost Subgraph of b1
for b3 being [Graph-like] [Weighted] GraphStruct
st b2 == b3 & the_Weight_of b2 = the_Weight_of b3
holds b3 is spanning Tree-like [Weighted] weight-inheriting min-cost Subgraph of b1;
:: GLIB_004:th 37
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct holds
b1 == PRIM:Init b1 &
the_Weight_of b1 = the_Weight_of PRIM:Init b1 &
the_ELabel_of PRIM:Init b1 = {} &
the_VLabel_of PRIM:Init b1 = (choose the_Vertices_of b1) .--> 1;
:: GLIB_004:th 38
theorem
for b1 being [Graph-like] [Weighted] real-weighted GraphStruct holds
(PRIM:Init b1) .labeledV() = {choose the_Vertices_of b1} &
(PRIM:Init b1) .labeledE() = {};
:: GLIB_004:th 39
theorem
for b1 being [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct
st PRIM:NextBestEdges b1 <> {}
holds ex b2 being Element of the_Vertices_of b1 st
not b2 in b1 .labeledV() &
PRIM:Step b1 = (b1 .labelEdge(choose PRIM:NextBestEdges b1,1)) .labelVertex(b2,1);
:: GLIB_004:th 40
theorem
for b1 being [Graph-like] [Weighted] [ELabeled] [VLabeled] real-WEV GraphStruct holds
b1 == PRIM:Step b1 & the_Weight_of b1 = the_Weight_of PRIM:Step b1 & b1 .labeledE() c= (PRIM:Step b1) .labeledE() & b1 .labeledV() c= (PRIM:Step b1) .labeledV();
:: GLIB_004:th 41
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of NAT holds
b1 == (PRIM:CompSeq b1) . b2 &
the_Weight_of ((PRIM:CompSeq b1) . b2) = the_Weight_of b1;
:: GLIB_004:th 42
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of NAT holds
((PRIM:CompSeq b1) . b2) .labeledV() is non empty Element of bool the_Vertices_of b1 &
((PRIM:CompSeq b1) . b2) .labeledE() c= b1 .edgesBetween (((PRIM:CompSeq b1) . b2) .labeledV());
:: GLIB_004:th 43
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of NAT
for b3 being inducedSubgraph of b1,((PRIM:CompSeq b1) . b2) .labeledV(),((PRIM:CompSeq b1) . b2) .labeledE() holds
b3 is connected;
:: GLIB_004:th 44
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of NAT
for b3 being inducedSubgraph of b1,((PRIM:CompSeq b1) . b2) .labeledV(),b1 .edgesBetween (((PRIM:CompSeq b1) . b2) .labeledV()) holds
b3 is connected;
:: GLIB_004:th 45
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of NAT holds
((PRIM:CompSeq b1) . b2) .labeledV() c= b1 .reachableFrom choose the_Vertices_of b1;
:: GLIB_004:th 46
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2, b3 being Element of NAT
st b2 <= b3
holds ((PRIM:CompSeq b1) . b2) .labeledV() c= ((PRIM:CompSeq b1) . b3) .labeledV() &
((PRIM:CompSeq b1) . b2) .labeledE() c= ((PRIM:CompSeq b1) . b3) .labeledE();
:: GLIB_004:th 47
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of NAT holds
PRIM:NextBestEdges ((PRIM:CompSeq b1) . b2) = {}
iff
((PRIM:CompSeq b1) . b2) .labeledV() = b1 .reachableFrom choose the_Vertices_of b1;
:: GLIB_004:th 48
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of NAT holds
card (((PRIM:CompSeq b1) . b2) .labeledV()) = min(b2 + 1,card (b1 .reachableFrom choose the_Vertices_of b1));
:: GLIB_004:th 49
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct holds
PRIM:CompSeq b1 is halting &
(PRIM:CompSeq b1) .Lifespan() + 1 = card (b1 .reachableFrom choose the_Vertices_of b1);
:: GLIB_004:th 50
theorem
for b1 being [Graph-like] finite [Weighted] real-weighted GraphStruct
for b2 being Element of NAT
for b3 being inducedSubgraph of b1,((PRIM:CompSeq b1) . b2) .labeledV(),((PRIM:CompSeq b1) . b2) .labeledE() holds
b3 is Tree-like;
:: GLIB_004:th 51
theorem
for b1 being [Graph-like] finite connected [Weighted] real-weighted GraphStruct holds
(PRIM:MST b1) .labeledV() = the_Vertices_of b1;
:: GLIB_004:th 52
theorem
for b1 being [Graph-like] finite connected [Weighted] real-weighted GraphStruct
for b2 being natural set holds
((PRIM:CompSeq b1) . b2) .labeledE() c= (PRIM:MST b1) .labeledE();
:: GLIB_004:th 53
theorem
for b1 being [Graph-like] finite connected [Weighted] real-weighted GraphStruct
for b2 being [Weighted] weight-inheriting inducedSubgraph of b1,(PRIM:MST b1) .labeledV(),(PRIM:MST b1) .labeledE() holds
b2 is spanning Tree-like [Weighted] weight-inheriting min-cost Subgraph of b1;