Article GRAPHSP, MML version 4.99.1005
:: GRAPHSP:th 1
theorem
for b1 being Relation-like Function-like FinSequence-like set
for b2 being set holds
not b2 in proj2 b1 & b1 is one-to-one
iff
b1 ^ <*b2*> is one-to-one;
:: GRAPHSP:th 2
theorem
for b1 being set
for b2 being FinSequence of b1
for b3 being integer set
st 1 <= b3 & b3 <= len b2
holds b2 . b3 in b1;
:: GRAPHSP:th 3
theorem
for b1 being set
for b2 being FinSequence of b1
for b3 being integer set
st 1 <= b3 & b3 <= len b2
holds b2 /. b3 = b2 . b3;
:: GRAPHSP:th 4
theorem
for b1 being Graph-like MultiGraphStruct
for b2 being FinSequence of the Edges of b1
for b3 being Relation-like Function-like set
st b3 is_weight_of b1 & len b2 = 1
holds cost(b2,b3) = b3 . (b2 . 1);
:: GRAPHSP:th 5
theorem
for b1 being Graph-like MultiGraphStruct
for b2 being set
st b2 in the Edges of b1
holds <*b2*> is oriented Simple Chain of b1;
:: GRAPHSP:th 6
theorem
for b1 being Graph-like MultiGraphStruct
for b2, b3 being FinSequence of the Edges of b1
for b4 being oriented Simple Chain of b1
st b4 = b2 ^ b3 & 1 <= len b2 & 1 <= len b3
holds (the Target of b1) . (b4 . len b4) <> (the Target of b1) . (b2 . len b2) &
(the Source of b1) . (b4 . 1) <> (the Source of b1) . (b3 . 1);
:: GRAPHSP:th 7
theorem
for b1 being Graph-like MultiGraphStruct
for b2 being oriented Chain of b1
for b3 being set
for b4, b5 being Element of the Vertices of b1 holds
b2 is_orientedpath_of b4,b5,b3
iff
b2 is_orientedpath_of b4,b5,b3 \/ {b5};
:: GRAPHSP:th 8
theorem
for b1 being Graph-like MultiGraphStruct
for b2 being oriented Chain of b1
for b3 being Relation-like Function-like set
for b4 being set
for b5, b6 being Element of the Vertices of b1 holds
b2 is_shortestpath_of b5,b6,b4,b3
iff
b2 is_shortestpath_of b5,b6,b4 \/ {b6},b3;
:: GRAPHSP:th 9
theorem
for b1 being Graph-like MultiGraphStruct
for b2, b3 being oriented Chain of b1
for b4 being Relation-like Function-like set
for b5 being set
for b6, b7 being Element of the Vertices of b1
st b2 is_shortestpath_of b6,b7,b5,b4 & b3 is_shortestpath_of b6,b7,b5,b4
holds cost(b2,b4) = cost(b3,b4);
:: GRAPHSP:th 10
theorem
for b1 being Graph-like oriented MultiGraphStruct
for b2, b3 being Element of the Vertices of b1
for b4, b5 being set
st b4 in the Edges of b1 & b5 in the Edges of b1 & b4 orientedly_joins b2,b3 & b5 orientedly_joins b2,b3
holds b4 = b5;
:: GRAPHSP:th 11
theorem
for b1 being Graph-like MultiGraphStruct
for b2, b3 being set
for b4, b5 being Element of the Vertices of b1
st the Vertices of b1 = b2 \/ b3 &
b4 in b2 &
b5 in b3 &
(for b6, b7 being Element of the Vertices of b1
st b6 in b2 & b7 in b3
for b8 being set
st b8 in the Edges of b1
holds not b8 orientedly_joins b6,b7)
for b6 being oriented Chain of b1 holds
not b6 is_orientedpath_of b4,b5;
:: GRAPHSP:th 12
theorem
for b1 being Graph-like MultiGraphStruct
for b2 being oriented Chain of b1
for b3, b4 being set
for b5, b6 being Element of the Vertices of b1
st the Vertices of b1 = b3 \/ b4 &
b5 in b3 &
(for b7, b8 being Element of the Vertices of b1
st b7 in b3 & b8 in b4
for b9 being set
st b9 in the Edges of b1
holds not b9 orientedly_joins b7,b8) &
b2 is_orientedpath_of b5,b6
holds b2 is_orientedpath_of b5,b6,b3;
:: GRAPHSP:th 13
theorem
for b1 being Relation-like Function-like set
for b2 being set
for b3 being Graph-like finite MultiGraphStruct
for b4, b5 being oriented Chain of b3
for b6, b7, b8 being Element of the Vertices of b3
st b1 is_weight>=0of b3 &
b4 is_shortestpath_of b6,b7,b2,b1 &
b6 <> b7 &
b6 <> b8 &
b5 is_shortestpath_of b6,b8,b2,b1 &
(for b9 being set
st b9 in the Edges of b3
holds not b9 orientedly_joins b7,b8) &
b4 islongestInShortestpath b2,b6,b1
holds b5 is_shortestpath_of b6,b8,b2 \/ {b7},b1;
:: GRAPHSP:th 14
theorem
for b1 being set
for b2 being Graph-like oriented finite MultiGraphStruct
for b3 being oriented Chain of b2
for b4 being Function-like quasi_total Relation of the Edges of b2,Real>=0
for b5, b6 being Element of the Vertices of b2
st b1 in the Edges of b2 & b5 <> b6 & b3 = <*b1*> & b1 orientedly_joins b5,b6
holds b3 is_shortestpath_of b5,b6,{b5},b4;
:: GRAPHSP:th 15
theorem
for b1, b2 being set
for b3 being Graph-like oriented finite MultiGraphStruct
for b4, b5 being oriented Chain of b3
for b6 being Function-like quasi_total Relation of the Edges of b3,Real>=0
for b7, b8, b9 being Element of the Vertices of b3
st b1 in the Edges of b3 &
b4 is_shortestpath_of b7,b8,b2,b6 &
b7 <> b9 &
b5 = b4 ^ <*b1*> &
b1 orientedly_joins b8,b9 &
b7 in b2 &
(for b10 being Element of the Vertices of b3
st b10 in b2
for b11 being set
st b11 in the Edges of b3
holds not b11 orientedly_joins b10,b9)
holds b5 is_shortestpath_of b7,b9,b2 \/ {b8},b6;
:: GRAPHSP:th 16
theorem
for b1, b2 being set
for b3 being Graph-like oriented finite MultiGraphStruct
for b4 being oriented Chain of b3
for b5 being Function-like quasi_total Relation of the Edges of b3,Real>=0
for b6, b7 being Element of the Vertices of b3
st the Vertices of b3 = b1 \/ b2 &
b6 in b1 &
(for b8, b9 being Element of the Vertices of b3
st b8 in b1 & b9 in b2
for b10 being set
st b10 in the Edges of b3
holds not b10 orientedly_joins b8,b9)
holds b4 is_shortestpath_of b6,b7,b1,b5
iff
b4 is_shortestpath_of b6,b7,b5;
:: GRAPHSP:funcnot 1 => FUNCT_7:func 2
notation
let a1 be Relation-like Function-like set;
let a2, a3 be set;
synonym (a1,a2):= a3 for a1 +*(a2,a3);
end;
:: GRAPHSP:funcnot 2 => GRAPHSP:func 1
definition
let a1 be FinSequence of REAL;
let a2 be set;
let a3 be Element of REAL;
redefine func (a1,a2):= a3 -> FinSequence of REAL;
end;
:: GRAPHSP:funcnot 3 => GRAPHSP:func 2
definition
let a1, a2 be Element of NAT;
let a3 be FinSequence of REAL;
let a4 be Element of REAL;
func (A3,A1):=(A2,A4) -> FinSequence of REAL equals
((a3,a1):= a2,a2):= a4;
end;
:: GRAPHSP:def 1
theorem
for b1, b2 being Element of NAT
for b3 being FinSequence of REAL
for b4 being Element of REAL holds
(b3,b1):=(b2,b4) = ((b3,b1):= b2,b2):= b4;
:: GRAPHSP:th 18
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL *
for b4 being Element of REAL
st b1 <> b2 & b1 in dom b3
holds ((b3,b1):=(b2,b4)) . b1 = b2;
:: GRAPHSP:th 19
theorem
for b1, b2, b3 being Element of NAT
for b4 being Element of REAL *
for b5 being Element of REAL
st b1 <> b2 & b1 <> b3 & b1 in dom b4
holds ((b4,b2):=(b3,b5)) . b1 = b4 . b1;
:: GRAPHSP:th 20
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL *
for b4 being Element of REAL
st b1 in dom b3
holds ((b3,b2):=(b1,b4)) . b1 = b4;
:: GRAPHSP:th 21
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL *
for b4 being Element of REAL holds
dom ((b3,b1):=(b2,b4)) = dom b3;
:: GRAPHSP:funcnot 4 => GRAPHSP:func 3
definition
let a1 be set;
let a2, a3 be Element of Funcs(a1,a1);
redefine func a3 * a2 -> Element of Funcs(a1,a1);
end;
:: GRAPHSP:funcnot 5 => GRAPHSP:func 4
definition
let a1 be set;
let a2 be Element of Funcs(a1,a1);
let a3 be Element of a1;
redefine func a2 . a3 -> Element of a1;
end;
:: GRAPHSP:funcnot 6 => GRAPHSP:func 5
definition
let a1 be set;
let a2 be Element of Funcs(a1,a1);
func repeat A2 -> Function-like quasi_total Relation of NAT,Funcs(a1,a1) means
it . 0 = id a1 &
(for b1 being natural set holds
it . (b1 + 1) = a2 * (it . b1));
end;
:: GRAPHSP:def 2
theorem
for b1 being set
for b2 being Element of Funcs(b1,b1)
for b3 being Function-like quasi_total Relation of NAT,Funcs(b1,b1) holds
b3 = repeat b2
iff
b3 . 0 = id b1 &
(for b4 being natural set holds
b3 . (b4 + 1) = b2 * (b3 . b4));
:: GRAPHSP:th 22
theorem
for b1 being Element of Funcs(REAL *,REAL *)
for b2 being Element of REAL *
for b3, b4 being Element of NAT holds
((repeat b1) . 0) . b2 = b2;
:: GRAPHSP:th 23
theorem
for b1, b2 being Element of Funcs(REAL *,REAL *)
for b3 being Element of REAL *
for b4 being Element of NAT holds
((repeat (b1 * b2)) . (b4 + 1)) . b3 = b1 . (b2 . (((repeat (b1 * b2)) . b4) . b3));
:: GRAPHSP:funcnot 7 => GRAPHSP:func 6
definition
let a1 be Element of Funcs(REAL *,REAL *);
let a2 be Element of REAL *;
redefine func a1 . a2 -> Element of REAL *;
end;
:: GRAPHSP:funcnot 8 => GRAPHSP:func 7
definition
let a1 be Element of REAL *;
let a2 be natural set;
func OuterVx(A1,A2) -> Element of bool NAT equals
{b1 where b1 is Element of NAT: b1 in dom a1 & 1 <= b1 & b1 <= a2 & a1 . b1 <> - 1 & a1 . (a2 + b1) <> - 1};
end;
:: GRAPHSP:def 3
theorem
for b1 being Element of REAL *
for b2 being natural set holds
OuterVx(b1,b2) = {b3 where b3 is Element of NAT: b3 in dom b1 & 1 <= b3 & b3 <= b2 & b1 . b3 <> - 1 & b1 . (b2 + b3) <> - 1};
:: GRAPHSP:funcnot 9 => GRAPHSP:func 8
definition
let a1 be Element of Funcs(REAL *,REAL *);
let a2 be Element of REAL *;
let a3 be natural set;
assume ex b1 being Element of NAT st
OuterVx(((repeat a1) . b1) . a2,a3) = {};
func LifeSpan(A1,A2,A3) -> Element of NAT means
OuterVx(((repeat a1) . it) . a2,a3) = {} &
(for b1 being natural set
st OuterVx(((repeat a1) . b1) . a2,a3) = {}
holds it <= b1);
end;
:: GRAPHSP:def 4
theorem
for b1 being Element of Funcs(REAL *,REAL *)
for b2 being Element of REAL *
for b3 being natural set
st ex b4 being Element of NAT st
OuterVx(((repeat b1) . b4) . b2,b3) = {}
for b4 being Element of NAT holds
b4 = LifeSpan(b1,b2,b3)
iff
OuterVx(((repeat b1) . b4) . b2,b3) = {} &
(for b5 being natural set
st OuterVx(((repeat b1) . b5) . b2,b3) = {}
holds b4 <= b5);
:: GRAPHSP:funcnot 10 => GRAPHSP:func 9
definition
let a1 be Element of Funcs(REAL *,REAL *);
let a2 be Element of NAT;
func while_do(A1,A2) -> Element of Funcs(REAL *,REAL *) means
proj1 it = REAL * &
(for b1 being Element of REAL * holds
it . b1 = ((repeat a1) . LifeSpan(a1,b1,a2)) . b1);
end;
:: GRAPHSP:def 5
theorem
for b1 being Element of Funcs(REAL *,REAL *)
for b2 being Element of NAT
for b3 being Element of Funcs(REAL *,REAL *) holds
b3 = while_do(b1,b2)
iff
proj1 b3 = REAL * &
(for b4 being Element of REAL * holds
b3 . b4 = ((repeat b1) . LifeSpan(b1,b4,b2)) . b4);
:: GRAPHSP:funcnot 11 => GRAPHSP:func 10
definition
let a1 be Graph-like oriented MultiGraphStruct;
let a2, a3 be Element of the Vertices of a1;
assume ex b1 being set st
b1 in the Edges of a1 & b1 orientedly_joins a2,a3;
func Edge(A2,A3) -> set means
ex b1 being set st
it = b1 & b1 in the Edges of a1 & b1 orientedly_joins a2,a3;
end;
:: GRAPHSP:def 6
theorem
for b1 being Graph-like oriented MultiGraphStruct
for b2, b3 being Element of the Vertices of b1
st ex b4 being set st
b4 in the Edges of b1 & b4 orientedly_joins b2,b3
for b4 being set holds
b4 = Edge(b2,b3)
iff
ex b5 being set st
b4 = b5 & b5 in the Edges of b1 & b5 orientedly_joins b2,b3;
:: GRAPHSP:funcnot 12 => GRAPHSP:func 11
definition
let a1 be Graph-like oriented MultiGraphStruct;
let a2, a3 be Element of the Vertices of a1;
let a4 be Relation-like Function-like set;
func Weight(A2,A3,A4) -> set equals
a4 . Edge(a2,a3)
if ex b1 being set st
b1 in the Edges of a1 & b1 orientedly_joins a2,a3
otherwise - 1;
end;
:: GRAPHSP:def 7
theorem
for b1 being Graph-like oriented MultiGraphStruct
for b2, b3 being Element of the Vertices of b1
for b4 being Relation-like Function-like set holds
(for b5 being set
st b5 in the Edges of b1
holds not b5 orientedly_joins b2,b3 or Weight(b2,b3,b4) = b4 . Edge(b2,b3)) &
(for b5 being set
st b5 in the Edges of b1
holds not b5 orientedly_joins b2,b3 implies Weight(b2,b3,b4) = - 1);
:: GRAPHSP:funcnot 13 => GRAPHSP:func 12
definition
let a1 be Graph-like oriented MultiGraphStruct;
let a2, a3 be Element of the Vertices of a1;
let a4 be Function-like quasi_total Relation of the Edges of a1,Real>=0;
redefine func Weight(a2,a3,a4) -> Element of REAL;
end;
:: GRAPHSP:th 24
theorem
for b1 being Graph-like oriented MultiGraphStruct
for b2, b3 being Element of the Vertices of b1
for b4 being Function-like quasi_total Relation of the Edges of b1,Real>=0 holds
0 <= Weight(b2,b3,b4)
iff
ex b5 being set st
b5 in the Edges of b1 & b5 orientedly_joins b2,b3;
:: GRAPHSP:th 25
theorem
for b1 being Graph-like oriented MultiGraphStruct
for b2, b3 being Element of the Vertices of b1
for b4 being Function-like quasi_total Relation of the Edges of b1,Real>=0 holds
Weight(b2,b3,b4) = - 1
iff
for b5 being set
st b5 in the Edges of b1
holds not b5 orientedly_joins b2,b3;
:: GRAPHSP:th 26
theorem
for b1 being set
for b2 being Graph-like oriented MultiGraphStruct
for b3, b4 being Element of the Vertices of b2
for b5 being Function-like quasi_total Relation of the Edges of b2,Real>=0
st b1 in the Edges of b2 & b1 orientedly_joins b3,b4
holds Weight(b3,b4,b5) = b5 . b1;
:: GRAPHSP:funcnot 14 => GRAPHSP:func 13
definition
let a1 be Element of REAL *;
let a2 be Element of NAT;
func UnusedVx(A1,A2) -> Element of bool NAT equals
{b1 where b1 is Element of NAT: b1 in dom a1 & 1 <= b1 & b1 <= a2 & a1 . b1 <> - 1};
end;
:: GRAPHSP:def 8
theorem
for b1 being Element of REAL *
for b2 being Element of NAT holds
UnusedVx(b1,b2) = {b3 where b3 is Element of NAT: b3 in dom b1 & 1 <= b3 & b3 <= b2 & b1 . b3 <> - 1};
:: GRAPHSP:funcnot 15 => GRAPHSP:func 14
definition
let a1 be Element of REAL *;
let a2 be Element of NAT;
func UsedVx(A1,A2) -> Element of bool NAT equals
{b1 where b1 is Element of NAT: b1 in dom a1 & 1 <= b1 & b1 <= a2 & a1 . b1 = - 1};
end;
:: GRAPHSP:def 9
theorem
for b1 being Element of REAL *
for b2 being Element of NAT holds
UsedVx(b1,b2) = {b3 where b3 is Element of NAT: b3 in dom b1 & 1 <= b3 & b3 <= b2 & b1 . b3 = - 1};
:: GRAPHSP:th 27
theorem
for b1 being Element of NAT
for b2 being Element of REAL * holds
UnusedVx(b2,b1) c= Seg b1;
:: GRAPHSP:funcreg 1
registration
let a1 be Element of REAL *;
let a2 be Element of NAT;
cluster UnusedVx(a1,a2) -> finite;
end;
:: GRAPHSP:th 28
theorem
for b1 being Element of NAT
for b2 being Element of REAL * holds
OuterVx(b2,b1) c= UnusedVx(b2,b1);
:: GRAPHSP:th 29
theorem
for b1 being Element of NAT
for b2 being Element of REAL * holds
OuterVx(b2,b1) c= Seg b1;
:: GRAPHSP:funcreg 2
registration
let a1 be Element of REAL *;
let a2 be Element of NAT;
cluster OuterVx(a1,a2) -> finite;
end;
:: GRAPHSP:funcnot 16 => GRAPHSP:func 15
definition
let a1 be finite Element of bool NAT;
let a2 be Element of REAL *;
let a3 be Element of NAT;
func Argmin(A1,A2,A3) -> Element of NAT means
(a1 <> {} implies ex b1 being Element of NAT st
b1 = it &
b1 in a1 &
(for b2 being Element of NAT
st b2 in a1
holds a2 /. ((2 * a3) + b1) <= a2 /. ((2 * a3) + b2)) &
(for b2 being Element of NAT
st b2 in a1 &
a2 /. ((2 * a3) + b1) = a2 /. ((2 * a3) + b2)
holds b1 <= b2)) &
(a1 = {} implies it = 0);
end;
:: GRAPHSP:def 10
theorem
for b1 being finite Element of bool NAT
for b2 being Element of REAL *
for b3, b4 being Element of NAT holds
b4 = Argmin(b1,b2,b3)
iff
(b1 <> {} implies ex b5 being Element of NAT st
b5 = b4 &
b5 in b1 &
(for b6 being Element of NAT
st b6 in b1
holds b2 /. ((2 * b3) + b5) <= b2 /. ((2 * b3) + b6)) &
(for b6 being Element of NAT
st b6 in b1 &
b2 /. ((2 * b3) + b5) = b2 /. ((2 * b3) + b6)
holds b5 <= b6)) &
(b1 = {} implies b4 = 0);
:: GRAPHSP:th 30
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL *
st OuterVx(b3,b1) <> {} & b2 = Argmin(OuterVx(b3,b1),b3,b1)
holds b2 in dom b3 & 1 <= b2 & b2 <= b1 & b3 . b2 <> - 1 & b3 . (b1 + b2) <> - 1;
:: GRAPHSP:th 31
theorem
for b1 being Element of NAT
for b2 being Element of REAL * holds
Argmin(OuterVx(b2,b1),b2,b1) <= b1;
:: GRAPHSP:funcnot 17 => GRAPHSP:func 16
definition
let a1 be Element of NAT;
func findmin A1 -> Element of Funcs(REAL *,REAL *) means
proj1 it = REAL * &
(for b1 being Element of REAL * holds
it . b1 = (b1,((a1 * a1) + (3 * a1)) + 1):=(Argmin(OuterVx(b1,a1),b1,a1),- 1));
end;
:: GRAPHSP:def 11
theorem
for b1 being Element of NAT
for b2 being Element of Funcs(REAL *,REAL *) holds
b2 = findmin b1
iff
proj1 b2 = REAL * &
(for b3 being Element of REAL * holds
b2 . b3 = (b3,((b1 * b1) + (3 * b1)) + 1):=(Argmin(OuterVx(b3,b1),b3,b1),- 1));
:: GRAPHSP:th 32
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL *
st b1 in dom b3 &
b2 < b1 &
b1 <> ((b2 * b2) + (3 * b2)) + 1
holds ((findmin b2) . b3) . b1 = b3 . b1;
:: GRAPHSP:th 33
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL *
st b1 in dom b3 &
b3 . b1 = - 1 &
b1 <> ((b2 * b2) + (3 * b2)) + 1
holds ((findmin b2) . b3) . b1 = - 1;
:: GRAPHSP:th 34
theorem
for b1 being Element of NAT
for b2 being Element of REAL * holds
dom ((findmin b1) . b2) = dom b2;
:: GRAPHSP:th 35
theorem
for b1 being Element of NAT
for b2 being Element of REAL *
st OuterVx(b2,b1) <> {}
holds ex b3 being Element of NAT st
b3 in OuterVx(b2,b1) & 1 <= b3 & b3 <= b1 & ((findmin b1) . b2) . b3 = - 1;
:: GRAPHSP:funcnot 18 => GRAPHSP:func 17
definition
let a1 be Element of REAL *;
let a2, a3 be Element of NAT;
func newpathcost(A1,A2,A3) -> Element of REAL equals
(a1 /. ((2 * a2) + (a1 /. (((a2 * a2) + (3 * a2)) + 1)))) + (a1 /. (((2 * a2) + (a2 * (a1 /. (((a2 * a2) + (3 * a2)) + 1)))) + a3));
end;
:: GRAPHSP:def 12
theorem
for b1 being Element of REAL *
for b2, b3 being Element of NAT holds
newpathcost(b1,b2,b3) = (b1 /. ((2 * b2) + (b1 /. (((b2 * b2) + (3 * b2)) + 1)))) + (b1 /. (((2 * b2) + (b2 * (b1 /. (((b2 * b2) + (3 * b2)) + 1)))) + b3));
:: GRAPHSP:prednot 1 => GRAPHSP:pred 1
definition
let a1, a2 be Element of NAT;
let a3 be Element of REAL *;
pred A3 hasBetterPathAt A1,A2 means
(a3 . (a1 + a2) <> - 1 implies newpathcost(a3,a1,a2) < a3 /. ((2 * a1) + a2)) &
0 <= a3 /. (((2 * a1) + (a1 * (a3 /. (((a1 * a1) + (3 * a1)) + 1)))) + a2) &
a3 . a2 <> - 1;
end;
:: GRAPHSP:dfs 13
definiens
let a1, a2 be Element of NAT;
let a3 be Element of REAL *;
To prove
a3 hasBetterPathAt a1,a2
it is sufficient to prove
thus (a3 . (a1 + a2) <> - 1 implies newpathcost(a3,a1,a2) < a3 /. ((2 * a1) + a2)) &
0 <= a3 /. (((2 * a1) + (a1 * (a3 /. (((a1 * a1) + (3 * a1)) + 1)))) + a2) &
a3 . a2 <> - 1;
:: GRAPHSP:def 13
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL * holds
b3 hasBetterPathAt b1,b2
iff
(b3 . (b1 + b2) <> - 1 implies newpathcost(b3,b1,b2) < b3 /. ((2 * b1) + b2)) &
0 <= b3 /. (((2 * b1) + (b1 * (b3 /. (((b1 * b1) + (3 * b1)) + 1)))) + b2) &
b3 . b2 <> - 1;
:: GRAPHSP:funcnot 19 => GRAPHSP:func 18
definition
let a1 be Element of REAL *;
let a2 be Element of NAT;
func Relax(A1,A2) -> Element of REAL * means
dom it = dom a1 &
(for b1 being Element of NAT
st b1 in dom a1
holds (a2 < b1 & b1 <= 2 * a2 implies (a1 hasBetterPathAt a2,b1 -' a2 implies it . b1 = a1 /. (((a2 * a2) + (3 * a2)) + 1)) &
(a1 hasBetterPathAt a2,b1 -' a2 or it . b1 = a1 . b1)) &
(2 * a2 < b1 & b1 <= 3 * a2 implies (a1 hasBetterPathAt a2,b1 -' (2 * a2) implies it . b1 = newpathcost(a1,a2,b1 -' (2 * a2))) &
(a1 hasBetterPathAt a2,b1 -' (2 * a2) or it . b1 = a1 . b1)) &
(a2 < b1 & b1 <= 3 * a2 or it . b1 = a1 . b1));
end;
:: GRAPHSP:def 14
theorem
for b1 being Element of REAL *
for b2 being Element of NAT
for b3 being Element of REAL * holds
b3 = Relax(b1,b2)
iff
dom b3 = dom b1 &
(for b4 being Element of NAT
st b4 in dom b1
holds (b2 < b4 & b4 <= 2 * b2 implies (b1 hasBetterPathAt b2,b4 -' b2 implies b3 . b4 = b1 /. (((b2 * b2) + (3 * b2)) + 1)) &
(b1 hasBetterPathAt b2,b4 -' b2 or b3 . b4 = b1 . b4)) &
(2 * b2 < b4 & b4 <= 3 * b2 implies (b1 hasBetterPathAt b2,b4 -' (2 * b2) implies b3 . b4 = newpathcost(b1,b2,b4 -' (2 * b2))) &
(b1 hasBetterPathAt b2,b4 -' (2 * b2) or b3 . b4 = b1 . b4)) &
(b2 < b4 & b4 <= 3 * b2 or b3 . b4 = b1 . b4));
:: GRAPHSP:funcnot 20 => GRAPHSP:func 19
definition
let a1 be Element of NAT;
func Relax A1 -> Element of Funcs(REAL *,REAL *) means
proj1 it = REAL * &
(for b1 being Element of REAL * holds
it . b1 = Relax(b1,a1));
end;
:: GRAPHSP:def 15
theorem
for b1 being Element of NAT
for b2 being Element of Funcs(REAL *,REAL *) holds
b2 = Relax b1
iff
proj1 b2 = REAL * &
(for b3 being Element of REAL * holds
b2 . b3 = Relax(b3,b1));
:: GRAPHSP:th 36
theorem
for b1 being Element of NAT
for b2 being Element of REAL * holds
dom ((Relax b1) . b2) = dom b2;
:: GRAPHSP:th 37
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL *
st (b2 < b1 implies 3 * b2 < b1) & b1 in dom b3
holds ((Relax b2) . b3) . b1 = b3 . b1;
:: GRAPHSP:th 38
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL * holds
dom (((repeat ((Relax b1) * findmin b1)) . b2) . b3) = dom (((repeat ((Relax b1) * findmin b1)) . (b2 + 1)) . b3);
:: GRAPHSP:th 39
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL *
st OuterVx(((repeat ((Relax b1) * findmin b1)) . b2) . b3,b1) <> {}
holds UnusedVx(((repeat ((Relax b1) * findmin b1)) . (b2 + 1)) . b3,b1) c< UnusedVx(((repeat ((Relax b1) * findmin b1)) . b2) . b3,b1);
:: GRAPHSP:th 40
theorem
for b1, b2, b3 being Element of NAT
for b4, b5, b6 being Element of REAL *
st b4 = ((repeat ((Relax b1) * findmin b1)) . b2) . b5 &
b6 = ((repeat ((Relax b1) * findmin b1)) . (b2 + 1)) . b5 &
b3 = Argmin(OuterVx(b4,b1),b4,b1) &
OuterVx(b4,b1) <> {}
holds UsedVx(b6,b1) = (UsedVx(b4,b1)) \/ {b3} &
not b3 in UsedVx(b4,b1);
:: GRAPHSP:th 41
theorem
for b1 being Element of NAT
for b2 being Element of REAL * holds
ex b3 being Element of NAT st
b3 <= b1 &
OuterVx(((repeat ((Relax b1) * findmin b1)) . b3) . b2,b1) = {};
:: GRAPHSP:th 42
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL * holds
dom b3 = dom (((repeat ((Relax b1) * findmin b1)) . b2) . b3);
:: GRAPHSP:prednot 2 => GRAPHSP:pred 2
definition
let a1, a2 be Element of REAL *;
let a3, a4 be Element of NAT;
pred A1,A2 equal_at A3,A4 means
dom a1 = dom a2 &
(for b1 being Element of NAT
st b1 in dom a1 & a3 <= b1 & b1 <= a4
holds a1 . b1 = a2 . b1);
end;
:: GRAPHSP:dfs 16
definiens
let a1, a2 be Element of REAL *;
let a3, a4 be Element of NAT;
To prove
a1,a2 equal_at a3,a4
it is sufficient to prove
thus dom a1 = dom a2 &
(for b1 being Element of NAT
st b1 in dom a1 & a3 <= b1 & b1 <= a4
holds a1 . b1 = a2 . b1);
:: GRAPHSP:def 16
theorem
for b1, b2 being Element of REAL *
for b3, b4 being Element of NAT holds
b1,b2 equal_at b3,b4
iff
dom b1 = dom b2 &
(for b5 being Element of NAT
st b5 in dom b1 & b3 <= b5 & b5 <= b4
holds b1 . b5 = b2 . b5);
:: GRAPHSP:th 43
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL * holds
b3,b3 equal_at b1,b2;
:: GRAPHSP:th 44
theorem
for b1, b2 being Element of NAT
for b3, b4, b5 being Element of REAL *
st b3,b4 equal_at b1,b2 & b4,b5 equal_at b1,b2
holds b3,b5 equal_at b1,b2;
:: GRAPHSP:th 45
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL * holds
((repeat ((Relax b1) * findmin b1)) . b2) . b3,((repeat ((Relax b1) * findmin b1)) . (b2 + 1)) . b3 equal_at (3 * b1) + 1,(b1 * b1) + (3 * b1);
:: GRAPHSP:th 46
theorem
for b1 being Element of Funcs(REAL *,REAL *)
for b2 being Element of REAL *
for b3, b4 being Element of NAT
st b4 < LifeSpan(b1,b2,b3)
holds OuterVx(((repeat b1) . b4) . b2,b3) <> {};
:: GRAPHSP:th 47
theorem
for b1, b2 being Element of NAT
for b3 being Element of REAL * holds
b3,((repeat ((Relax b1) * findmin b1)) . b2) . b3 equal_at (3 * b1) + 1,(b1 * b1) + (3 * b1);
:: GRAPHSP:th 48
theorem
for b1 being Element of NAT
for b2 being Element of REAL *
st 1 <= b1 &
1 in dom b2 &
b2 . (b1 + 1) <> - 1 &
(for b3 being Element of NAT
st 1 <= b3 & b3 <= b1
holds b2 . b3 = 1) &
(for b3 being Element of NAT
st 2 <= b3 & b3 <= b1
holds b2 . (b1 + b3) = - 1)
holds 1 = Argmin(OuterVx(b2,b1),b2,b1) &
UsedVx(b2,b1) = {} &
{1} = UsedVx(((repeat ((Relax b1) * findmin b1)) . 1) . b2,b1);
:: GRAPHSP:th 49
theorem
for b1, b2, b3 being Element of NAT
for b4, b5, b6 being Element of REAL *
st b4 = ((repeat ((Relax b1) * findmin b1)) . 1) . b5 &
b6 = ((repeat ((Relax b1) * findmin b1)) . b2) . b5 &
1 <= b2 &
b2 <= LifeSpan((Relax b1) * findmin b1,b5,b1) &
b3 in UsedVx(b4,b1)
holds b3 in UsedVx(b6,b1);
:: GRAPHSP:prednot 3 => GRAPHSP:pred 3
definition
let a1 be FinSequence of NAT;
let a2 be Element of REAL *;
let a3, a4 be Element of NAT;
pred A1 is_vertex_seq_at A2,A3,A4 means
a1 . len a1 = a3 &
(for b1 being Element of NAT
st 1 <= b1 & b1 < len a1
holds a1 . ((len a1) - b1) = a2 . (a4 + (a1 /. (((len a1) - b1) + 1))));
end;
:: GRAPHSP:dfs 17
definiens
let a1 be FinSequence of NAT;
let a2 be Element of REAL *;
let a3, a4 be Element of NAT;
To prove
a1 is_vertex_seq_at a2,a3,a4
it is sufficient to prove
thus a1 . len a1 = a3 &
(for b1 being Element of NAT
st 1 <= b1 & b1 < len a1
holds a1 . ((len a1) - b1) = a2 . (a4 + (a1 /. (((len a1) - b1) + 1))));
:: GRAPHSP:def 17
theorem
for b1 being FinSequence of NAT
for b2 being Element of REAL *
for b3, b4 being Element of NAT holds
b1 is_vertex_seq_at b2,b3,b4
iff
b1 . len b1 = b3 &
(for b5 being Element of NAT
st 1 <= b5 & b5 < len b1
holds b1 . ((len b1) - b5) = b2 . (b4 + (b1 /. (((len b1) - b5) + 1))));
:: GRAPHSP:prednot 4 => GRAPHSP:pred 4
definition
let a1 be FinSequence of NAT;
let a2 be Element of REAL *;
let a3, a4 be Element of NAT;
pred A1 is_simple_vertex_seq_at A2,A3,A4 means
a1 . 1 = 1 & 1 < len a1 & a1 is_vertex_seq_at a2,a3,a4 & a1 is one-to-one;
end;
:: GRAPHSP:dfs 18
definiens
let a1 be FinSequence of NAT;
let a2 be Element of REAL *;
let a3, a4 be Element of NAT;
To prove
a1 is_simple_vertex_seq_at a2,a3,a4
it is sufficient to prove
thus a1 . 1 = 1 & 1 < len a1 & a1 is_vertex_seq_at a2,a3,a4 & a1 is one-to-one;
:: GRAPHSP:def 18
theorem
for b1 being FinSequence of NAT
for b2 being Element of REAL *
for b3, b4 being Element of NAT holds
b1 is_simple_vertex_seq_at b2,b3,b4
iff
b1 . 1 = 1 & 1 < len b1 & b1 is_vertex_seq_at b2,b3,b4 & b1 is one-to-one;
:: GRAPHSP:th 50
theorem
for b1, b2 being FinSequence of NAT
for b3 being Element of REAL *
for b4, b5 being Element of NAT
st b1 is_simple_vertex_seq_at b3,b4,b5 & b2 is_simple_vertex_seq_at b3,b4,b5
holds b1 = b2;
:: GRAPHSP:prednot 5 => GRAPHSP:pred 5
definition
let a1 be Graph-like MultiGraphStruct;
let a2 be FinSequence of the Edges of a1;
let a3 be Relation-like Function-like FinSequence-like set;
pred A2 is_oriented_edge_seq_of A3 means
len a3 = (len a2) + 1 &
(for b1 being natural set
st 1 <= b1 & b1 <= len a2
holds (the Source of a1) . (a2 . b1) = a3 . b1 &
(the Target of a1) . (a2 . b1) = a3 . (b1 + 1));
end;
:: GRAPHSP:dfs 19
definiens
let a1 be Graph-like MultiGraphStruct;
let a2 be FinSequence of the Edges of a1;
let a3 be Relation-like Function-like FinSequence-like set;
To prove
a2 is_oriented_edge_seq_of a3
it is sufficient to prove
thus len a3 = (len a2) + 1 &
(for b1 being natural set
st 1 <= b1 & b1 <= len a2
holds (the Source of a1) . (a2 . b1) = a3 . b1 &
(the Target of a1) . (a2 . b1) = a3 . (b1 + 1));
:: GRAPHSP:def 19
theorem
for b1 being Graph-like MultiGraphStruct
for b2 being FinSequence of the Edges of b1
for b3 being Relation-like Function-like FinSequence-like set holds
b2 is_oriented_edge_seq_of b3
iff
len b3 = (len b2) + 1 &
(for b4 being natural set
st 1 <= b4 & b4 <= len b2
holds (the Source of b1) . (b2 . b4) = b3 . b4 &
(the Target of b1) . (b2 . b4) = b3 . (b4 + 1));
:: GRAPHSP:th 51
theorem
for b1 being Graph-like oriented MultiGraphStruct
for b2 being Relation-like Function-like FinSequence-like set
for b3, b4 being oriented Chain of b1
st b3 is_oriented_edge_seq_of b2 & b4 is_oriented_edge_seq_of b2
holds b3 = b4;
:: GRAPHSP:th 52
theorem
for b1 being Graph-like MultiGraphStruct
for b2, b3 being Relation-like Function-like FinSequence-like set
for b4 being oriented Chain of b1
st b4 is_oriented_edge_seq_of b2 & b4 is_oriented_edge_seq_of b3 & 1 <= len b4
holds b2 = b3;
:: GRAPHSP:prednot 6 => GRAPHSP:pred 6
definition
let a1 be Element of REAL *;
let a2 be Graph-like oriented MultiGraphStruct;
let a3 be Element of NAT;
let a4 be Function-like quasi_total Relation of the Edges of a2,Real>=0;
pred A1 is_Input_of_Dijkstra_Alg A2,A3,A4 means
len a1 = ((a3 * a3) + (3 * a3)) + 1 &
Seg a3 = the Vertices of a2 &
(for b1 being Element of NAT
st 1 <= b1 & b1 <= a3
holds a1 . b1 = 1 & a1 . ((2 * a3) + b1) = 0) &
a1 . (a3 + 1) = 0 &
(for b1 being Element of NAT
st 2 <= b1 & b1 <= a3
holds a1 . (a3 + b1) = - 1) &
(for b1, b2 being Element of the Vertices of a2
for b3, b4 being Element of NAT
st b3 = b1 & b4 = b2
holds a1 . (((2 * a3) + (a3 * b3)) + b4) = Weight(b1,b2,a4));
end;
:: GRAPHSP:dfs 20
definiens
let a1 be Element of REAL *;
let a2 be Graph-like oriented MultiGraphStruct;
let a3 be Element of NAT;
let a4 be Function-like quasi_total Relation of the Edges of a2,Real>=0;
To prove
a1 is_Input_of_Dijkstra_Alg a2,a3,a4
it is sufficient to prove
thus len a1 = ((a3 * a3) + (3 * a3)) + 1 &
Seg a3 = the Vertices of a2 &
(for b1 being Element of NAT
st 1 <= b1 & b1 <= a3
holds a1 . b1 = 1 & a1 . ((2 * a3) + b1) = 0) &
a1 . (a3 + 1) = 0 &
(for b1 being Element of NAT
st 2 <= b1 & b1 <= a3
holds a1 . (a3 + b1) = - 1) &
(for b1, b2 being Element of the Vertices of a2
for b3, b4 being Element of NAT
st b3 = b1 & b4 = b2
holds a1 . (((2 * a3) + (a3 * b3)) + b4) = Weight(b1,b2,a4));
:: GRAPHSP:def 20
theorem
for b1 being Element of REAL *
for b2 being Graph-like oriented MultiGraphStruct
for b3 being Element of NAT
for b4 being Function-like quasi_total Relation of the Edges of b2,Real>=0 holds
b1 is_Input_of_Dijkstra_Alg b2,b3,b4
iff
len b1 = ((b3 * b3) + (3 * b3)) + 1 &
Seg b3 = the Vertices of b2 &
(for b5 being Element of NAT
st 1 <= b5 & b5 <= b3
holds b1 . b5 = 1 & b1 . ((2 * b3) + b5) = 0) &
b1 . (b3 + 1) = 0 &
(for b5 being Element of NAT
st 2 <= b5 & b5 <= b3
holds b1 . (b3 + b5) = - 1) &
(for b5, b6 being Element of the Vertices of b2
for b7, b8 being Element of NAT
st b7 = b5 & b8 = b6
holds b1 . (((2 * b3) + (b3 * b7)) + b8) = Weight(b5,b6,b4));
:: GRAPHSP:funcnot 21 => GRAPHSP:func 20
definition
let a1 be Element of NAT;
func DijkstraAlgorithm A1 -> Element of Funcs(REAL *,REAL *) equals
while_do((Relax a1) * findmin a1,a1);
end;
:: GRAPHSP:def 21
theorem
for b1 being Element of NAT holds
DijkstraAlgorithm b1 = while_do((Relax b1) * findmin b1,b1);
:: GRAPHSP:th 53
theorem
for b1, b2 being Element of NAT
for b3, b4 being Element of REAL *
for b5 being Graph-like oriented finite MultiGraphStruct
for b6 being Function-like quasi_total Relation of the Edges of b5,Real>=0
for b7, b8 being Element of the Vertices of b5
st b3 is_Input_of_Dijkstra_Alg b5,b1,b6 & b7 = 1 & 1 <> b8 & b8 = b2 & 1 <= b1 & b4 = (DijkstraAlgorithm b1) . b3
holds the Vertices of b5 = (UsedVx(b4,b1)) \/ UnusedVx(b4,b1) &
(b8 in UsedVx(b4,b1) implies ex b9 being FinSequence of NAT st
ex b10 being oriented Chain of b5 st
b9 is_simple_vertex_seq_at b4,b2,b1 &
b10 is_oriented_edge_seq_of b9 &
b10 is_shortestpath_of b7,b8,b6 &
cost(b10,b6) = b4 . ((2 * b1) + b2)) &
(b8 in UnusedVx(b4,b1) implies for b9 being oriented Chain of b5 holds
not b9 is_orientedpath_of b7,b8);