:: GLIB_004 semantic presentation
theorem Th1: :: GLIB_004:1
theorem Th2: :: GLIB_004:2
theorem Th3: :: GLIB_004:3
for b
1, b
2 being
set for b
3 being
Rbag of b
1for b
4 being
Rbag of b
2for b
5 being
Rbag of b
1 \ b
2 holds
( b
3 = b
4 +* b
5 implies
Sum b
3 = (Sum b4) + (Sum b5) )
theorem Th4: :: GLIB_004:4
for b
1, b
2 being
set for b
3 being
Rbag of b
1 holds
(
dom b
3 = {b2} implies
Sum b
3 = b
3 . b
2 )
theorem Th5: :: GLIB_004:5
for b
1 being
set for b
2, b
3 being
Rbag of b
1 holds
( ( for b
4 being
set holds
( b
4 in b
1 implies b
2 . b
4 <= b
3 . b
4 ) ) implies
Sum b
2 <= Sum b
3 )
theorem Th6: :: GLIB_004:6
for b
1 being
set for b
2, b
3 being
Rbag of b
1 holds
( ( for b
4 being
set holds
( b
4 in b
1 implies b
2 . b
4 = b
3 . b
4 ) ) implies
Sum b
2 = Sum b
3 )
theorem Th7: :: GLIB_004:7
for b
1, b
2 being
set for b
3 being
Rbag of b
1for b
4 being
Rbag of b
2 holds
( b
3 = b
4 implies
Sum b
3 = Sum b
4 )
theorem Th8: :: GLIB_004:8
theorem Th9: :: GLIB_004:9
:: deftheorem Def1 defines is_mincost_DTree_rooted_at GLIB_004:def 1 :
:: deftheorem Def2 defines is_mincost_DPath_from GLIB_004:def 2 :
definition
let c
1 be
finite real-weighted WGraph;
let c
2, c
3 be
set ;
func c
1 .min_DPath_cost c
2,c
3 -> Real means :
Def3:
:: GLIB_004:def 3
ex b
1 being
DPath of a
1 st
( b
1 is_mincost_DPath_from a
2,a
3 & a
4 = b
1 .cost() )
if ex b
1 being
DWalk of a
1 st b
1 is_Walk_from a
2,a
3 otherwise a
4 = 0;
existence
( not ( ex b1 being DWalk of c1 st b1 is_Walk_from c2,c3 & ( for b1 being Real
for b2 being DPath of c1 holds
not ( b2 is_mincost_DPath_from c2,c3 & b1 = b2 .cost() ) ) ) & not ( ( for b1 being DWalk of c1 holds
not b1 is_Walk_from c2,c3 ) & ( for b1 being Real holds
not b1 = 0 ) ) )
uniqueness
for b1, b2 being Real holds
( ( ex b3 being DWalk of c1 st b3 is_Walk_from c2,c3 & ex b3 being DPath of c1 st
( b3 is_mincost_DPath_from c2,c3 & b1 = b3 .cost() ) & ex b3 being DPath of c1 st
( b3 is_mincost_DPath_from c2,c3 & b2 = b3 .cost() ) implies b1 = b2 ) & ( ( for b3 being DWalk of c1 holds
not b3 is_Walk_from c2,c3 ) & b1 = 0 & b2 = 0 implies b1 = b2 ) )
consistency
for b1 being Real holds
verum
;
end;
:: deftheorem Def3 defines .min_DPath_cost GLIB_004:def 3 :
definition
let c
1 be
real-WEV WEVGraph;
func DIJK:NextBestEdges c
1 -> Subset of
(the_Edges_of a1) means :
Def4:
:: GLIB_004:def 4
for b
1 being
set holds
( b
1 in a
2 iff ( b
1 DSJoins a
1 .labeledV() ,
(the_Vertices_of a1) \ (a1 .labeledV() ),a
1 & ( for b
2 being
set holds
( b
2 DSJoins a
1 .labeledV() ,
(the_Vertices_of a1) \ (a1 .labeledV() ),a
1 implies
((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) ) ) ) );
existence
ex b1 being Subset of (the_Edges_of c1) st
for b2 being set holds
( b2 in b1 iff ( b2 DSJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 & ( for b3 being set holds
( b3 DSJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 implies ((the_VLabel_of c1) . ((the_Source_of c1) . b2)) + ((the_Weight_of c1) . b2) <= ((the_VLabel_of c1) . ((the_Source_of c1) . b3)) + ((the_Weight_of c1) . b3) ) ) ) )
uniqueness
for b1, b2 being Subset of (the_Edges_of c1) holds
( ( for b3 being set holds
( b3 in b1 iff ( b3 DSJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 & ( for b4 being set holds
( b4 DSJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 implies ((the_VLabel_of c1) . ((the_Source_of c1) . b3)) + ((the_Weight_of c1) . b3) <= ((the_VLabel_of c1) . ((the_Source_of c1) . b4)) + ((the_Weight_of c1) . b4) ) ) ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 DSJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 & ( for b4 being set holds
( b4 DSJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 implies ((the_VLabel_of c1) . ((the_Source_of c1) . b3)) + ((the_Weight_of c1) . b3) <= ((the_VLabel_of c1) . ((the_Source_of c1) . b4)) + ((the_Weight_of c1) . b4) ) ) ) ) ) implies b1 = b2 )
end;
:: deftheorem Def4 defines DIJK:NextBestEdges GLIB_004:def 4 :
:: deftheorem Def5 defines DIJK:Step GLIB_004:def 5 :
:: deftheorem Def6 defines DIJK:Init GLIB_004:def 6 :
:: deftheorem Def7 defines DIJK:CompSeq GLIB_004:def 7 :
:: deftheorem Def8 defines DIJK:SSSP GLIB_004:def 8 :
theorem Th10: :: GLIB_004:10
theorem Th11: :: GLIB_004:11
theorem Th12: :: GLIB_004:12
theorem Th13: :: GLIB_004:13
theorem Th14: :: GLIB_004:14
theorem Th15: :: GLIB_004:15
theorem Th16: :: GLIB_004:16
theorem Th17: :: GLIB_004:17
theorem Th18: :: GLIB_004:18
theorem Th19: :: GLIB_004:19
theorem Th20: :: GLIB_004:20
theorem Th21: :: GLIB_004:21
theorem Th22: :: GLIB_004:22
theorem Th23: :: GLIB_004:23
theorem Th24: :: GLIB_004:24
theorem Th25: :: GLIB_004:25
theorem Th26: :: GLIB_004:26
:: deftheorem Def9 defines WGraphSelectors GLIB_004:def 9 :
Lemma29:
for b1 being WGraph holds WGraphSelectors c= dom b1
Lemma30:
for b1 being WGraph holds
( b1 == b1 .strict WGraphSelectors & the_Weight_of b1 = the_Weight_of (b1 .strict WGraphSelectors ) )
Lemma31:
for b1 being WGraph holds dom (b1 .strict WGraphSelectors ) = WGraphSelectors
:: deftheorem Def10 defines .allWSubgraphs() GLIB_004:def 10 :
:: deftheorem Def11 defines .cost() GLIB_004:def 11 :
theorem Th27: :: GLIB_004:27
theorem Th28: :: GLIB_004:28
theorem Th29: :: GLIB_004:29
theorem Th30: :: GLIB_004:30
theorem Th31: :: GLIB_004:31
theorem Th32: :: GLIB_004:32
theorem Th33: :: GLIB_004:33
theorem Th34: :: GLIB_004:34
definition
let c
1 be
real-weighted WVGraph;
func PRIM:NextBestEdges c
1 -> Subset of
(the_Edges_of a1) means :
Def12:
:: GLIB_004:def 12
for b
1 being
set holds
( b
1 in a
2 iff ( b
1 SJoins a
1 .labeledV() ,
(the_Vertices_of a1) \ (a1 .labeledV() ),a
1 & ( for b
2 being
set holds
( b
2 SJoins a
1 .labeledV() ,
(the_Vertices_of a1) \ (a1 .labeledV() ),a
1 implies
(the_Weight_of a1) . b
1 <= (the_Weight_of a1) . b
2 ) ) ) );
existence
ex b1 being Subset of (the_Edges_of c1) st
for b2 being set holds
( b2 in b1 iff ( b2 SJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 & ( for b3 being set holds
( b3 SJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 implies (the_Weight_of c1) . b2 <= (the_Weight_of c1) . b3 ) ) ) )
uniqueness
for b1, b2 being Subset of (the_Edges_of c1) holds
( ( for b3 being set holds
( b3 in b1 iff ( b3 SJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 & ( for b4 being set holds
( b4 SJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 implies (the_Weight_of c1) . b3 <= (the_Weight_of c1) . b4 ) ) ) ) ) & ( for b3 being set holds
( b3 in b2 iff ( b3 SJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 & ( for b4 being set holds
( b4 SJoins c1 .labeledV() ,(the_Vertices_of c1) \ (c1 .labeledV() ),c1 implies (the_Weight_of c1) . b3 <= (the_Weight_of c1) . b4 ) ) ) ) ) implies b1 = b2 )
end;
:: deftheorem Def12 defines PRIM:NextBestEdges GLIB_004:def 12 :
:: deftheorem Def13 defines PRIM:Init GLIB_004:def 13 :
definition
let c
1 be
real-WEV WEVGraph;
set c
2 =
choose (PRIM:NextBestEdges c1);
func PRIM:Step c
1 -> real-WEV WEVGraph equals :
Def14:
:: GLIB_004:def 14
a
1 if PRIM:NextBestEdges a
1 = {} (a1 .labelEdge (choose (PRIM:NextBestEdges a1)),1) .labelVertex ((the_Target_of a1) . (choose (PRIM:NextBestEdges a1))),1
if (
PRIM:NextBestEdges a
1 <> {} &
(the_Source_of a1) . (choose (PRIM:NextBestEdges a1)) in a
1 .labeledV() )
otherwise (a1 .labelEdge (choose (PRIM:NextBestEdges a1)),1) .labelVertex ((the_Source_of a1) . (choose (PRIM:NextBestEdges a1))),1;
coherence
( ( PRIM:NextBestEdges c1 = {} implies c1 is real-WEV WEVGraph ) & ( PRIM:NextBestEdges c1 <> {} & (the_Source_of c1) . (choose (PRIM:NextBestEdges c1)) in c1 .labeledV() implies (c1 .labelEdge (choose (PRIM:NextBestEdges c1)),1) .labelVertex ((the_Target_of c1) . (choose (PRIM:NextBestEdges c1))),1 is real-WEV WEVGraph ) & ( not PRIM:NextBestEdges c1 = {} & not ( PRIM:NextBestEdges c1 <> {} & (the_Source_of c1) . (choose (PRIM:NextBestEdges c1)) in c1 .labeledV() ) implies (c1 .labelEdge (choose (PRIM:NextBestEdges c1)),1) .labelVertex ((the_Source_of c1) . (choose (PRIM:NextBestEdges c1))),1 is real-WEV WEVGraph ) )
;
consistency
for b1 being real-WEV WEVGraph holds
( PRIM:NextBestEdges c1 = {} & PRIM:NextBestEdges c1 <> {} & (the_Source_of c1) . (choose (PRIM:NextBestEdges c1)) in c1 .labeledV() implies ( b1 = c1 iff b1 = (c1 .labelEdge (choose (PRIM:NextBestEdges c1)),1) .labelVertex ((the_Target_of c1) . (choose (PRIM:NextBestEdges c1))),1 ) )
;
end;
:: deftheorem Def14 defines PRIM:Step GLIB_004:def 14 :
:: deftheorem Def15 defines PRIM:CompSeq GLIB_004:def 15 :
:: deftheorem Def16 defines PRIM:MST GLIB_004:def 16 :
Lemma38:
for b1 being real-weighted WGraph 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 )
Lemma39:
for b1 being real-weighted WGraph holds
( (PRIM:Init b1) .labeledV() = {(choose (the_Vertices_of b1))} & (PRIM:Init b1) .labeledE() = {} )
Lemma40:
for b1 being real-WEV WEVGraph holds
not ( PRIM:NextBestEdges b1 <> {} & ( for b2 being Vertex of b1 holds
not ( not b2 in b1 .labeledV() & PRIM:Step b1 = (b1 .labelEdge (choose (PRIM:NextBestEdges b1)),1) .labelVertex b2,1 ) ) )
Lemma41:
for b1 being real-WEV WEVGraph 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() )
Lemma42:
for b1 being finite real-weighted WGraph
for b2 being Nat holds
( b1 == (PRIM:CompSeq b1) .-> b2 & the_Weight_of ((PRIM:CompSeq b1) .-> b2) = the_Weight_of b1 )
Lemma43:
for b1 being finite real-weighted WGraph
for b2 being Nat holds
( ((PRIM:CompSeq b1) .-> b2) .labeledV() is non empty Subset of (the_Vertices_of b1) & ((PRIM:CompSeq b1) .-> b2) .labeledE() c= b1 .edgesBetween (((PRIM:CompSeq b1) .-> b2) .labeledV() ) )
Lemma44:
for b1 being finite real-weighted WGraph
for b2 being Nat
for b3 being inducedSubgraph of b1,((PRIM:CompSeq b1) .-> b2) .labeledV() ,((PRIM:CompSeq b1) .-> b2) .labeledE() holds b3 is connected
Lemma45:
for b1 being finite real-weighted WGraph
for b2 being Nat
for b3 being inducedSubgraph of b1,(((PRIM:CompSeq b1) .-> b2) .labeledV() ) holds b3 is connected
Lemma46:
for b1 being finite real-weighted WGraph
for b2 being Nat holds ((PRIM:CompSeq b1) .-> b2) .labeledV() c= b1 .reachableFrom (choose (the_Vertices_of b1))
Lemma47:
for b1 being finite real-weighted WGraph
for b2, b3 being Nat holds
( b2 <= b3 implies ( ((PRIM:CompSeq b1) .-> b2) .labeledV() c= ((PRIM:CompSeq b1) .-> b3) .labeledV() & ((PRIM:CompSeq b1) .-> b2) .labeledE() c= ((PRIM:CompSeq b1) .-> b3) .labeledE() ) )
Lemma48:
for b1 being finite real-weighted WGraph
for b2 being Nat holds
( PRIM:NextBestEdges ((PRIM:CompSeq b1) .-> b2) = {} iff ((PRIM:CompSeq b1) .-> b2) .labeledV() = b1 .reachableFrom (choose (the_Vertices_of b1)) )
Lemma49:
for b1 being finite real-weighted WGraph
for b2 being Nat holds card (((PRIM:CompSeq b1) .-> b2) .labeledV() ) = min (b2 + 1),(card (b1 .reachableFrom (choose (the_Vertices_of b1))))
Lemma50:
for b1 being finite real-weighted WGraph holds
( PRIM:CompSeq b1 is halting & ((PRIM:CompSeq b1) .Lifespan() ) + 1 = card (b1 .reachableFrom (choose (the_Vertices_of b1))) )
Lemma51:
for b1 being finite real-weighted WGraph
for b2 being Nat
for b3 being inducedSubgraph of b1,((PRIM:CompSeq b1) .-> b2) .labeledV() ,((PRIM:CompSeq b1) .-> b2) .labeledE() holds b3 is Tree-like
Lemma52:
for b1 being finite connected real-weighted WGraph holds (PRIM:MST b1) .labeledV() = the_Vertices_of b1
:: deftheorem Def17 defines min-cost GLIB_004:def 17 :
theorem Th35: :: GLIB_004:35
theorem Th36: :: GLIB_004:36
theorem Th37: :: GLIB_004:37
theorem Th38: :: GLIB_004:38
theorem Th39: :: GLIB_004:39
theorem Th40: :: GLIB_004:40
theorem Th41: :: GLIB_004:41
theorem Th42: :: GLIB_004:42
theorem Th43: :: GLIB_004:43
theorem Th44: :: GLIB_004:44
theorem Th45: :: GLIB_004:45
theorem Th46: :: GLIB_004:46
theorem Th47: :: GLIB_004:47
theorem Th48: :: GLIB_004:48
theorem Th49: :: GLIB_004:49
theorem Th50: :: GLIB_004:50
theorem Th51: :: GLIB_004:51
theorem Th52: :: GLIB_004:52
theorem Th53: :: GLIB_004:53