:: GRAPHSP semantic presentation begin theorem Th1: :: GRAPHSP:1 for p being FinSequence for x being set holds ( ( not x in rng p & p is one-to-one ) iff p ^ <*x*> is one-to-one ) proof let p be FinSequence; ::_thesis: for x being set holds ( ( not x in rng p & p is one-to-one ) iff p ^ <*x*> is one-to-one ) let x be set ; ::_thesis: ( ( not x in rng p & p is one-to-one ) iff p ^ <*x*> is one-to-one ) A1: rng <*x*> = {x} by FINSEQ_1:38; ( ( rng p misses rng <*x*> & p is one-to-one & <*x*> is one-to-one ) iff p ^ <*x*> is one-to-one ) by FINSEQ_3:91; hence ( ( not x in rng p & p is one-to-one ) iff p ^ <*x*> is one-to-one ) by A1, FINSEQ_3:93, ZFMISC_1:48, ZFMISC_1:50; ::_thesis: verum end; theorem Th2: :: GRAPHSP:2 for X being set for p being FinSequence of X for ii being Integer st 1 <= ii & ii <= len p holds p . ii in X proof let X be set ; ::_thesis: for p being FinSequence of X for ii being Integer st 1 <= ii & ii <= len p holds p . ii in X let p be FinSequence of X; ::_thesis: for ii being Integer st 1 <= ii & ii <= len p holds p . ii in X let ii be Integer; ::_thesis: ( 1 <= ii & ii <= len p implies p . ii in X ) assume that A1: 1 <= ii and A2: ii <= len p ; ::_thesis: p . ii in X reconsider ii = ii as Element of NAT by A1, INT_1:3; ii in dom p by A1, A2, FINSEQ_3:25; hence p . ii in X by PARTFUN1:4; ::_thesis: verum end; theorem Th3: :: GRAPHSP:3 for X being set for p being FinSequence of X for ii being Integer st 1 <= ii & ii <= len p holds p /. ii = p . ii proof let X be set ; ::_thesis: for p being FinSequence of X for ii being Integer st 1 <= ii & ii <= len p holds p /. ii = p . ii let p be FinSequence of X; ::_thesis: for ii being Integer st 1 <= ii & ii <= len p holds p /. ii = p . ii let ii be Integer; ::_thesis: ( 1 <= ii & ii <= len p implies p /. ii = p . ii ) assume that A1: 1 <= ii and A2: ii <= len p ; ::_thesis: p /. ii = p . ii reconsider ii = ii as Element of NAT by A1, INT_1:3; ii in dom p by A1, A2, FINSEQ_3:25; hence p /. ii = p . ii by PARTFUN1:def_6; ::_thesis: verum end; theorem Th4: :: GRAPHSP:4 for G being Graph for pe being FinSequence of the carrier' of G for W being Function st W is_weight_of G & len pe = 1 holds cost (pe,W) = W . (pe . 1) proof let G be Graph; ::_thesis: for pe being FinSequence of the carrier' of G for W being Function st W is_weight_of G & len pe = 1 holds cost (pe,W) = W . (pe . 1) let pe be FinSequence of the carrier' of G; ::_thesis: for W being Function st W is_weight_of G & len pe = 1 holds cost (pe,W) = W . (pe . 1) let W be Function; ::_thesis: ( W is_weight_of G & len pe = 1 implies cost (pe,W) = W . (pe . 1) ) assume that A1: W is_weight_of G and A2: len pe = 1 ; ::_thesis: cost (pe,W) = W . (pe . 1) A3: 1 in dom pe by A2, FINSEQ_3:25; set f = RealSequence (pe,W); dom (RealSequence (pe,W)) = dom pe by A1, GRAPH_5:def_15; then len (RealSequence (pe,W)) = 1 by A2, FINSEQ_3:29; then A4: RealSequence (pe,W) = <*((RealSequence (pe,W)) . 1)*> by FINSEQ_1:40; thus cost (pe,W) = Sum (RealSequence (pe,W)) by GRAPH_5:def_16 .= (RealSequence (pe,W)) . 1 by A4, FINSOP_1:11 .= W . (pe . 1) by A1, A3, GRAPH_5:def_15 ; ::_thesis: verum end; theorem Th5: :: GRAPHSP:5 for G being Graph for e being set st e in the carrier' of G holds <*e*> is oriented Simple Chain of G proof let G be Graph; ::_thesis: for e being set st e in the carrier' of G holds <*e*> is oriented Simple Chain of G let e be set ; ::_thesis: ( e in the carrier' of G implies <*e*> is oriented Simple Chain of G ) assume e in the carrier' of G ; ::_thesis: <*e*> is oriented Simple Chain of G then A1: <*e*> is FinSequence of the carrier' of G by FINSEQ_1:74; len <*e*> = 1 by FINSEQ_1:40; hence <*e*> is oriented Simple Chain of G by A1, GRAPH_5:15; ::_thesis: verum end; Lm1: for n being Nat for p, q being FinSequence st 1 <= n & n <= len p holds p . n = (p ^ q) . n proof let n be Nat; ::_thesis: for p, q being FinSequence st 1 <= n & n <= len p holds p . n = (p ^ q) . n let p, q be FinSequence; ::_thesis: ( 1 <= n & n <= len p implies p . n = (p ^ q) . n ) assume ( 1 <= n & n <= len p ) ; ::_thesis: p . n = (p ^ q) . n then n in dom p by FINSEQ_3:25; hence p . n = (p ^ q) . n by FINSEQ_1:def_7; ::_thesis: verum end; Lm2: for n being Element of NAT for p, q being FinSequence st 1 <= n & n <= len q holds q . n = (p ^ q) . ((len p) + n) proof let n be Element of NAT ; ::_thesis: for p, q being FinSequence st 1 <= n & n <= len q holds q . n = (p ^ q) . ((len p) + n) let p, q be FinSequence; ::_thesis: ( 1 <= n & n <= len q implies q . n = (p ^ q) . ((len p) + n) ) assume ( 1 <= n & n <= len q ) ; ::_thesis: q . n = (p ^ q) . ((len p) + n) then n in dom q by FINSEQ_3:25; hence q . n = (p ^ q) . ((len p) + n) by FINSEQ_1:def_7; ::_thesis: verum end; theorem Th6: :: GRAPHSP:6 for G being Graph for pe, qe being FinSequence of the carrier' of G for p being oriented Simple Chain of G st p = pe ^ qe & len pe >= 1 & len qe >= 1 holds ( the Target of G . (p . (len p)) <> the Target of G . (pe . (len pe)) & the Source of G . (p . 1) <> the Source of G . (qe . 1) ) proof let G be Graph; ::_thesis: for pe, qe being FinSequence of the carrier' of G for p being oriented Simple Chain of G st p = pe ^ qe & len pe >= 1 & len qe >= 1 holds ( the Target of G . (p . (len p)) <> the Target of G . (pe . (len pe)) & the Source of G . (p . 1) <> the Source of G . (qe . 1) ) let pe, qe be FinSequence of the carrier' of G; ::_thesis: for p being oriented Simple Chain of G st p = pe ^ qe & len pe >= 1 & len qe >= 1 holds ( the Target of G . (p . (len p)) <> the Target of G . (pe . (len pe)) & the Source of G . (p . 1) <> the Source of G . (qe . 1) ) let p be oriented Simple Chain of G; ::_thesis: ( p = pe ^ qe & len pe >= 1 & len qe >= 1 implies ( the Target of G . (p . (len p)) <> the Target of G . (pe . (len pe)) & the Source of G . (p . 1) <> the Source of G . (qe . 1) ) ) set FT = the Target of G; set FS = the Source of G; assume that A1: p = pe ^ qe and A2: len pe >= 1 and A3: len qe >= 1 ; ::_thesis: ( the Target of G . (p . (len p)) <> the Target of G . (pe . (len pe)) & the Source of G . (p . 1) <> the Source of G . (qe . 1) ) consider vs being FinSequence of the carrier of G such that A4: vs is_oriented_vertex_seq_of p and A5: for n, m being Element of NAT st 1 <= n & n < m & m <= len vs & vs . n = vs . m holds ( n = 1 & m = len vs ) by GRAPH_4:def_7; A6: len vs = (len p) + 1 by A4, GRAPH_4:def_5; then A7: 1 <= len vs by NAT_1:12; len p = (len pe) + (len qe) by A1, FINSEQ_1:22; then A8: len p >= (len pe) + 1 by A3, XREAL_1:7; then A9: (len pe) + 1 < len vs by A6, NAT_1:13; A10: len p > len pe by A8, NAT_1:13; then A11: len p >= 1 by A2, XXREAL_0:2; then p . 1 orientedly_joins vs /. 1,vs /. (1 + 1) by A4, GRAPH_4:def_5; then A12: the Source of G . (p . 1) = vs /. 1 by GRAPH_4:def_1 .= vs . 1 by A7, FINSEQ_4:15 ; A13: p . (len pe) orientedly_joins vs /. (len pe),vs /. ((len pe) + 1) by A2, A4, A10, GRAPH_4:def_5; p . (len p) orientedly_joins vs /. (len p),vs /. ((len p) + 1) by A4, A11, GRAPH_4:def_5; then A14: the Target of G . (p . (len p)) = vs /. ((len p) + 1) by GRAPH_4:def_1 .= vs . (len vs) by A6, A7, FINSEQ_4:15 ; A15: 1 < (len pe) + 1 by A2, NAT_1:13; then A16: p . ((len pe) + 1) orientedly_joins vs /. ((len pe) + 1),vs /. (((len pe) + 1) + 1) by A4, A8, GRAPH_4:def_5; the Target of G . (pe . (len pe)) = the Target of G . (p . (len pe)) by A1, A2, Lm1 .= vs /. ((len pe) + 1) by A13, GRAPH_4:def_1 .= vs . ((len pe) + 1) by A15, A9, FINSEQ_4:15 ; hence the Target of G . (p . (len p)) <> the Target of G . (pe . (len pe)) by A5, A14, A15, A9; ::_thesis: the Source of G . (p . 1) <> the Source of G . (qe . 1) assume A17: the Source of G . (p . 1) = the Source of G . (qe . 1) ; ::_thesis: contradiction the Source of G . (qe . 1) = the Source of G . (p . ((len pe) + 1)) by A1, A3, Lm2 .= vs /. ((len pe) + 1) by A16, GRAPH_4:def_1 .= vs . ((len pe) + 1) by A15, A9, FINSEQ_4:15 ; hence contradiction by A5, A15, A9, A12, A17; ::_thesis: verum end; begin theorem Th7: :: GRAPHSP:7 for G being Graph for p being oriented Chain of G for V being set for v1, v2 being Vertex of G holds ( p is_orientedpath_of v1,v2,V iff p is_orientedpath_of v1,v2,V \/ {v2} ) proof let G be Graph; ::_thesis: for p being oriented Chain of G for V being set for v1, v2 being Vertex of G holds ( p is_orientedpath_of v1,v2,V iff p is_orientedpath_of v1,v2,V \/ {v2} ) let p be oriented Chain of G; ::_thesis: for V being set for v1, v2 being Vertex of G holds ( p is_orientedpath_of v1,v2,V iff p is_orientedpath_of v1,v2,V \/ {v2} ) let V be set ; ::_thesis: for v1, v2 being Vertex of G holds ( p is_orientedpath_of v1,v2,V iff p is_orientedpath_of v1,v2,V \/ {v2} ) let v1, v2 be Vertex of G; ::_thesis: ( p is_orientedpath_of v1,v2,V iff p is_orientedpath_of v1,v2,V \/ {v2} ) set V9 = V \/ {v2}; thus ( p is_orientedpath_of v1,v2,V implies p is_orientedpath_of v1,v2,V \/ {v2} ) by GRAPH_5:32, XBOOLE_1:7; ::_thesis: ( p is_orientedpath_of v1,v2,V \/ {v2} implies p is_orientedpath_of v1,v2,V ) assume A1: p is_orientedpath_of v1,v2,V \/ {v2} ; ::_thesis: p is_orientedpath_of v1,v2,V then (vertices p) \ {v2} c= V \/ {v2} by GRAPH_5:def_4; then ((vertices p) \ {v2}) \ {v2} c= V by XBOOLE_1:43; then A2: (vertices p) \ ({v2} \/ {v2}) c= V by XBOOLE_1:41; p is_orientedpath_of v1,v2 by A1, GRAPH_5:def_4; hence p is_orientedpath_of v1,v2,V by A2, GRAPH_5:def_4; ::_thesis: verum end; theorem Th8: :: GRAPHSP:8 for G being Graph for p being oriented Chain of G for W being Function for V being set for v1, v2 being Vertex of G holds ( p is_shortestpath_of v1,v2,V,W iff p is_shortestpath_of v1,v2,V \/ {v2},W ) proof let G be Graph; ::_thesis: for p being oriented Chain of G for W being Function for V being set for v1, v2 being Vertex of G holds ( p is_shortestpath_of v1,v2,V,W iff p is_shortestpath_of v1,v2,V \/ {v2},W ) let p be oriented Chain of G; ::_thesis: for W being Function for V being set for v1, v2 being Vertex of G holds ( p is_shortestpath_of v1,v2,V,W iff p is_shortestpath_of v1,v2,V \/ {v2},W ) let W be Function; ::_thesis: for V being set for v1, v2 being Vertex of G holds ( p is_shortestpath_of v1,v2,V,W iff p is_shortestpath_of v1,v2,V \/ {v2},W ) let V be set ; ::_thesis: for v1, v2 being Vertex of G holds ( p is_shortestpath_of v1,v2,V,W iff p is_shortestpath_of v1,v2,V \/ {v2},W ) let v1, v2 be Vertex of G; ::_thesis: ( p is_shortestpath_of v1,v2,V,W iff p is_shortestpath_of v1,v2,V \/ {v2},W ) set V9 = V \/ {v2}; hereby ::_thesis: ( p is_shortestpath_of v1,v2,V \/ {v2},W implies p is_shortestpath_of v1,v2,V,W ) assume A1: p is_shortestpath_of v1,v2,V,W ; ::_thesis: p is_shortestpath_of v1,v2,V \/ {v2},W A2: now__::_thesis:_for_q_being_oriented_Chain_of_G_st_q_is_orientedpath_of_v1,v2,V_\/_{v2}_holds_ cost_(p,W)_<=_cost_(q,W) let q be oriented Chain of G; ::_thesis: ( q is_orientedpath_of v1,v2,V \/ {v2} implies cost (p,W) <= cost (q,W) ) assume q is_orientedpath_of v1,v2,V \/ {v2} ; ::_thesis: cost (p,W) <= cost (q,W) then q is_orientedpath_of v1,v2,V by Th7; hence cost (p,W) <= cost (q,W) by A1, GRAPH_5:def_18; ::_thesis: verum end; p is_orientedpath_of v1,v2,V by A1, GRAPH_5:def_18; then p is_orientedpath_of v1,v2,V \/ {v2} by Th7; hence p is_shortestpath_of v1,v2,V \/ {v2},W by A2, GRAPH_5:def_18; ::_thesis: verum end; assume A3: p is_shortestpath_of v1,v2,V \/ {v2},W ; ::_thesis: p is_shortestpath_of v1,v2,V,W A4: now__::_thesis:_for_q_being_oriented_Chain_of_G_st_q_is_orientedpath_of_v1,v2,V_holds_ cost_(p,W)_<=_cost_(q,W) let q be oriented Chain of G; ::_thesis: ( q is_orientedpath_of v1,v2,V implies cost (p,W) <= cost (q,W) ) assume q is_orientedpath_of v1,v2,V ; ::_thesis: cost (p,W) <= cost (q,W) then q is_orientedpath_of v1,v2,V \/ {v2} by Th7; hence cost (p,W) <= cost (q,W) by A3, GRAPH_5:def_18; ::_thesis: verum end; p is_orientedpath_of v1,v2,V \/ {v2} by A3, GRAPH_5:def_18; then p is_orientedpath_of v1,v2,V by Th7; hence p is_shortestpath_of v1,v2,V,W by A4, GRAPH_5:def_18; ::_thesis: verum end; theorem Th9: :: GRAPHSP:9 for G being Graph for p, q being oriented Chain of G for W being Function for V being set for v1, v2 being Vertex of G st p is_shortestpath_of v1,v2,V,W & q is_shortestpath_of v1,v2,V,W holds cost (p,W) = cost (q,W) proof let G be Graph; ::_thesis: for p, q being oriented Chain of G for W being Function for V being set for v1, v2 being Vertex of G st p is_shortestpath_of v1,v2,V,W & q is_shortestpath_of v1,v2,V,W holds cost (p,W) = cost (q,W) let p, q be oriented Chain of G; ::_thesis: for W being Function for V being set for v1, v2 being Vertex of G st p is_shortestpath_of v1,v2,V,W & q is_shortestpath_of v1,v2,V,W holds cost (p,W) = cost (q,W) let W be Function; ::_thesis: for V being set for v1, v2 being Vertex of G st p is_shortestpath_of v1,v2,V,W & q is_shortestpath_of v1,v2,V,W holds cost (p,W) = cost (q,W) let V be set ; ::_thesis: for v1, v2 being Vertex of G st p is_shortestpath_of v1,v2,V,W & q is_shortestpath_of v1,v2,V,W holds cost (p,W) = cost (q,W) let v1, v2 be Vertex of G; ::_thesis: ( p is_shortestpath_of v1,v2,V,W & q is_shortestpath_of v1,v2,V,W implies cost (p,W) = cost (q,W) ) assume that A1: p is_shortestpath_of v1,v2,V,W and A2: q is_shortestpath_of v1,v2,V,W ; ::_thesis: cost (p,W) = cost (q,W) q is_orientedpath_of v1,v2,V by A2, GRAPH_5:def_18; then A3: cost (p,W) <= cost (q,W) by A1, GRAPH_5:def_18; p is_orientedpath_of v1,v2,V by A1, GRAPH_5:def_18; then cost (q,W) <= cost (p,W) by A2, GRAPH_5:def_18; hence cost (p,W) = cost (q,W) by A3, XXREAL_0:1; ::_thesis: verum end; theorem Th10: :: GRAPHSP:10 for G being oriented Graph for v1, v2 being Vertex of G for e1, e2 being set st e1 in the carrier' of G & e2 in the carrier' of G & e1 orientedly_joins v1,v2 & e2 orientedly_joins v1,v2 holds e1 = e2 proof let G be oriented Graph; ::_thesis: for v1, v2 being Vertex of G for e1, e2 being set st e1 in the carrier' of G & e2 in the carrier' of G & e1 orientedly_joins v1,v2 & e2 orientedly_joins v1,v2 holds e1 = e2 let v1, v2 be Vertex of G; ::_thesis: for e1, e2 being set st e1 in the carrier' of G & e2 in the carrier' of G & e1 orientedly_joins v1,v2 & e2 orientedly_joins v1,v2 holds e1 = e2 let e1, e2 be set ; ::_thesis: ( e1 in the carrier' of G & e2 in the carrier' of G & e1 orientedly_joins v1,v2 & e2 orientedly_joins v1,v2 implies e1 = e2 ) assume that A1: ( e1 in the carrier' of G & e2 in the carrier' of G ) and A2: e1 orientedly_joins v1,v2 and A3: e2 orientedly_joins v1,v2 ; ::_thesis: e1 = e2 A4: ( the Source of G . e2 = v1 & the Target of G . e2 = v2 ) by A3, GRAPH_4:def_1; ( the Source of G . e1 = v1 & the Target of G . e1 = v2 ) by A2, GRAPH_4:def_1; hence e1 = e2 by A1, A4, GRAPH_1:def_7; ::_thesis: verum end; Lm3: for i being Element of NAT for G being Graph for pe being FinSequence of the carrier' of G st 1 <= i & i <= len pe holds ( the Source of G . (pe . i) in the carrier of G & the Target of G . (pe . i) in the carrier of G ) proof let i be Element of NAT ; ::_thesis: for G being Graph for pe being FinSequence of the carrier' of G st 1 <= i & i <= len pe holds ( the Source of G . (pe . i) in the carrier of G & the Target of G . (pe . i) in the carrier of G ) let G be Graph; ::_thesis: for pe being FinSequence of the carrier' of G st 1 <= i & i <= len pe holds ( the Source of G . (pe . i) in the carrier of G & the Target of G . (pe . i) in the carrier of G ) let pe be FinSequence of the carrier' of G; ::_thesis: ( 1 <= i & i <= len pe implies ( the Source of G . (pe . i) in the carrier of G & the Target of G . (pe . i) in the carrier of G ) ) assume ( 1 <= i & i <= len pe ) ; ::_thesis: ( the Source of G . (pe . i) in the carrier of G & the Target of G . (pe . i) in the carrier of G ) then i in dom pe by FINSEQ_3:25; hence ( the Source of G . (pe . i) in the carrier of G & the Target of G . (pe . i) in the carrier of G ) by GRAPH_5:8; ::_thesis: verum end; theorem Th11: :: GRAPHSP:11 for G being Graph for U, V being set for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & v2 in V & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) holds for p being oriented Chain of G holds not p is_orientedpath_of v1,v2 proof let G be Graph; ::_thesis: for U, V being set for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & v2 in V & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) holds for p being oriented Chain of G holds not p is_orientedpath_of v1,v2 let U, V be set ; ::_thesis: for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & v2 in V & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) holds for p being oriented Chain of G holds not p is_orientedpath_of v1,v2 let v1, v2 be Vertex of G; ::_thesis: ( the carrier of G = U \/ V & v1 in U & v2 in V & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) implies for p being oriented Chain of G holds not p is_orientedpath_of v1,v2 ) assume that A1: the carrier of G = U \/ V and A2: v1 in U and A3: v2 in V and A4: for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ; ::_thesis: for p being oriented Chain of G holds not p is_orientedpath_of v1,v2 set FS = the Source of G; set FT = the Target of G; given p being oriented Chain of G such that A5: p is_orientedpath_of v1,v2 ; ::_thesis: contradiction p <> {} by A5, GRAPH_5:def_3; then A6: len p >= 1 by FINSEQ_1:20; defpred S1[ Nat] means ( $1 >= 1 & $1 <= len p & the Source of G . (p . $1) in U ); A7: for k being Nat st S1[k] holds k <= len p ; the Source of G . (p . 1) = v1 by A5, GRAPH_5:def_3; then A8: ex k being Nat st S1[k] by A2, A6; consider k being Nat such that A9: ( S1[k] & ( for n being Nat st S1[n] holds n <= k ) ) from NAT_1:sch_6(A7, A8); reconsider k = k as Element of NAT by ORDINAL1:def_12; reconsider vx = the Source of G . (p . k) as Vertex of G by A9, Lm3; A10: p . k in the carrier' of G by A9, Th2; A11: the Target of G . (p . (len p)) = v2 by A5, GRAPH_5:def_3; percases ( k = len p or k <> len p ) ; suppose k = len p ; ::_thesis: contradiction then p . k orientedly_joins vx,v2 by A11, GRAPH_4:def_1; hence contradiction by A3, A4, A9, A10; ::_thesis: verum end; suppose k <> len p ; ::_thesis: contradiction then A12: k < len p by A9, XXREAL_0:1; A13: k < k + 1 by NAT_1:13; A14: now__::_thesis:_not_the_Source_of_G_._(p_._(k_+_1))_in_U assume A15: the Source of G . (p . (k + 1)) in U ; ::_thesis: contradiction ( k + 1 <= len p & 1 <= k + 1 ) by A12, INT_1:7, NAT_1:12; hence contradiction by A9, A13, A15; ::_thesis: verum end; reconsider vy = the Target of G . (p . k) as Vertex of G by A9, Lm3; A16: p . k orientedly_joins vx,vy by GRAPH_4:def_1; the Source of G . (p . (k + 1)) = the Target of G . (p . k) by A9, A12, GRAPH_1:def_15; then vy in V by A1, A2, A14, XBOOLE_0:def_3; hence contradiction by A4, A9, A10, A16; ::_thesis: verum end; end; end; Lm4: for i being Element of NAT for G being Graph for pe being FinSequence of the carrier' of G for v1 being Vertex of G st 1 <= i & i <= len pe & ( v1 = the Source of G . (pe . i) or v1 = the Target of G . (pe . i) ) holds v1 in vertices pe proof let i be Element of NAT ; ::_thesis: for G being Graph for pe being FinSequence of the carrier' of G for v1 being Vertex of G st 1 <= i & i <= len pe & ( v1 = the Source of G . (pe . i) or v1 = the Target of G . (pe . i) ) holds v1 in vertices pe let G be Graph; ::_thesis: for pe being FinSequence of the carrier' of G for v1 being Vertex of G st 1 <= i & i <= len pe & ( v1 = the Source of G . (pe . i) or v1 = the Target of G . (pe . i) ) holds v1 in vertices pe let pe be FinSequence of the carrier' of G; ::_thesis: for v1 being Vertex of G st 1 <= i & i <= len pe & ( v1 = the Source of G . (pe . i) or v1 = the Target of G . (pe . i) ) holds v1 in vertices pe let v1 be Vertex of G; ::_thesis: ( 1 <= i & i <= len pe & ( v1 = the Source of G . (pe . i) or v1 = the Target of G . (pe . i) ) implies v1 in vertices pe ) assume that A1: ( 1 <= i & i <= len pe ) and A2: ( v1 = the Source of G . (pe . i) or v1 = the Target of G . (pe . i) ) ; ::_thesis: v1 in vertices pe i in dom pe by A1, FINSEQ_3:25; hence v1 in vertices pe by A2, GRAPH_5:24; ::_thesis: verum end; theorem Th12: :: GRAPHSP:12 for G being Graph for p being oriented Chain of G for U, V being set for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) & p is_orientedpath_of v1,v2 holds p is_orientedpath_of v1,v2,U proof let G be Graph; ::_thesis: for p being oriented Chain of G for U, V being set for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) & p is_orientedpath_of v1,v2 holds p is_orientedpath_of v1,v2,U let p be oriented Chain of G; ::_thesis: for U, V being set for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) & p is_orientedpath_of v1,v2 holds p is_orientedpath_of v1,v2,U let U, V be set ; ::_thesis: for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) & p is_orientedpath_of v1,v2 holds p is_orientedpath_of v1,v2,U let v1, v2 be Vertex of G; ::_thesis: ( the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) & p is_orientedpath_of v1,v2 implies p is_orientedpath_of v1,v2,U ) assume that A1: the carrier of G = U \/ V and A2: v1 in U and A3: for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) and A4: p is_orientedpath_of v1,v2 ; ::_thesis: p is_orientedpath_of v1,v2,U set FS = the Source of G; set FT = the Target of G; A5: now__::_thesis:_vertices_p_c=_U assume not vertices p c= U ; ::_thesis: contradiction then consider i being Element of NAT , q, r being FinSequence of the carrier' of G such that A6: i + 1 <= len p and A7: not vertices (p /. (i + 1)) c= U and A8: len q = i and A9: p = q ^ r and A10: vertices q c= U by GRAPH_5:20; A11: p . (i + 1) in the carrier' of G by A6, Th2, NAT_1:12; p /. (i + 1) = p . (i + 1) by A6, FINSEQ_4:15, NAT_1:12; then A12: vertices (p /. (i + 1)) = {( the Source of G . (p . (i + 1))),( the Target of G . (p . (i + 1)))} by GRAPH_5:def_1; A13: now__::_thesis:_(_the_Source_of_G_._(p_._(i_+_1))_in_U_implies_not_the_Target_of_G_._(p_._(i_+_1))_in_U_) assume ( the Source of G . (p . (i + 1)) in U & the Target of G . (p . (i + 1)) in U ) ; ::_thesis: contradiction then (vertices (p /. (i + 1))) \/ U = U by A12, ZFMISC_1:42; hence contradiction by A7, XBOOLE_1:7; ::_thesis: verum end; A14: 1 <= i + 1 by NAT_1:12; then reconsider vy = the Target of G . (p . (i + 1)) as Vertex of G by A6, Lm3; A15: ( vy in U or vy in V ) by A1, A2, XBOOLE_0:def_3; percases ( i = 0 or i <> 0 ) ; supposeA16: i = 0 ; ::_thesis: contradiction then the Source of G . (p . (i + 1)) = v1 by A4, GRAPH_5:def_3; then p . (i + 1) orientedly_joins v1,vy by GRAPH_4:def_1; hence contradiction by A2, A3, A4, A13, A11, A15, A16, GRAPH_5:def_3; ::_thesis: verum end; supposeA17: i <> 0 ; ::_thesis: contradiction reconsider vx = the Source of G . (p . (i + 1)) as Vertex of G by A6, A14, Lm3; hereby ::_thesis: verum percases ( vx in U or not vx in U ) ; supposeA18: vx in U ; ::_thesis: contradiction p . (i + 1) orientedly_joins vx,vy by GRAPH_4:def_1; hence contradiction by A3, A6, A14, A13, A15, A18, Th2; ::_thesis: verum end; supposeA19: not vx in U ; ::_thesis: contradiction A20: i < len p by A6, NAT_1:13; A21: i >= 1 + 0 by A17, INT_1:7; then reconsider vq = the Target of G . (q . i) as Vertex of G by A8, Lm3; A22: vq in vertices q by A8, A21, Lm4; the Target of G . (q . i) = the Target of G . (p . i) by A8, A9, A21, Lm1 .= the Source of G . (p . (i + 1)) by A21, A20, GRAPH_1:def_15 ; hence contradiction by A10, A19, A22; ::_thesis: verum end; end; end; end; end; end; (vertices p) \ {v2} c= vertices p by XBOOLE_1:36; then (vertices p) \ {v2} c= U by A5, XBOOLE_1:1; hence p is_orientedpath_of v1,v2,U by A4, GRAPH_5:def_4; ::_thesis: verum end; begin theorem Th13: :: GRAPHSP:13 for W being Function for V being set for G being finite Graph for P, Q being oriented Chain of G for v1, v2, v3 being Vertex of G st W is_weight>=0of G & P is_shortestpath_of v1,v2,V,W & v1 <> v2 & v1 <> v3 & Q is_shortestpath_of v1,v3,V,W & ( for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) ) & P islongestInShortestpath V,v1,W holds Q is_shortestpath_of v1,v3,V \/ {v2},W proof let W be Function; ::_thesis: for V being set for G being finite Graph for P, Q being oriented Chain of G for v1, v2, v3 being Vertex of G st W is_weight>=0of G & P is_shortestpath_of v1,v2,V,W & v1 <> v2 & v1 <> v3 & Q is_shortestpath_of v1,v3,V,W & ( for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) ) & P islongestInShortestpath V,v1,W holds Q is_shortestpath_of v1,v3,V \/ {v2},W let V be set ; ::_thesis: for G being finite Graph for P, Q being oriented Chain of G for v1, v2, v3 being Vertex of G st W is_weight>=0of G & P is_shortestpath_of v1,v2,V,W & v1 <> v2 & v1 <> v3 & Q is_shortestpath_of v1,v3,V,W & ( for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) ) & P islongestInShortestpath V,v1,W holds Q is_shortestpath_of v1,v3,V \/ {v2},W let G be finite Graph; ::_thesis: for P, Q being oriented Chain of G for v1, v2, v3 being Vertex of G st W is_weight>=0of G & P is_shortestpath_of v1,v2,V,W & v1 <> v2 & v1 <> v3 & Q is_shortestpath_of v1,v3,V,W & ( for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) ) & P islongestInShortestpath V,v1,W holds Q is_shortestpath_of v1,v3,V \/ {v2},W let P, Q be oriented Chain of G; ::_thesis: for v1, v2, v3 being Vertex of G st W is_weight>=0of G & P is_shortestpath_of v1,v2,V,W & v1 <> v2 & v1 <> v3 & Q is_shortestpath_of v1,v3,V,W & ( for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) ) & P islongestInShortestpath V,v1,W holds Q is_shortestpath_of v1,v3,V \/ {v2},W let v1, v2, v3 be Vertex of G; ::_thesis: ( W is_weight>=0of G & P is_shortestpath_of v1,v2,V,W & v1 <> v2 & v1 <> v3 & Q is_shortestpath_of v1,v3,V,W & ( for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) ) & P islongestInShortestpath V,v1,W implies Q is_shortestpath_of v1,v3,V \/ {v2},W ) assume that A1: W is_weight>=0of G and A2: P is_shortestpath_of v1,v2,V,W and A3: v1 <> v2 and A4: v1 <> v3 and A5: Q is_shortestpath_of v1,v3,V,W and A6: for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) and A7: P islongestInShortestpath V,v1,W ; ::_thesis: Q is_shortestpath_of v1,v3,V \/ {v2},W set V9 = V \/ {v2}; set FS = the Source of G; set FT = the Target of G; A8: now__::_thesis:_for_S_being_oriented_Chain_of_G_st_S_is_orientedpath_of_v1,v3,V_\/_{v2}_holds_ cost_(Q,W)_<=_cost_(S,W) let S be oriented Chain of G; ::_thesis: ( S is_orientedpath_of v1,v3,V \/ {v2} implies cost (Q,W) <= cost (b1,W) ) assume A9: S is_orientedpath_of v1,v3,V \/ {v2} ; ::_thesis: cost (Q,W) <= cost (b1,W) then consider s being oriented Simple Chain of G such that A10: s is_shortestpath_of v1,v3,V \/ {v2},W by A1, GRAPH_5:62; A11: cost (s,W) <= cost (S,W) by A9, A10, GRAPH_5:def_18; A12: s is_orientedpath_of v1,v3,V \/ {v2} by A10, GRAPH_5:def_18; then A13: s is_orientedpath_of v1,v3 by GRAPH_5:def_4; then A14: the Source of G . (s . 1) = v1 by GRAPH_5:def_3; s <> {} by A13, GRAPH_5:def_3; then len s >= 1 by FINSEQ_1:20; then consider i being Nat such that A15: len s = 1 + i by NAT_1:10; A16: (vertices s) \ {v3} c= V \/ {v2} by A12, GRAPH_5:def_4; A17: the Target of G . (s . (len s)) = v3 by A13, GRAPH_5:def_3; consider s1, s2 being FinSequence such that A18: len s1 = i and A19: len s2 = 1 and A20: s = s1 ^ s2 by A15, FINSEQ_2:22; reconsider s1 = s1, s2 = s2 as oriented Simple Chain of G by A20, GRAPH_5:14; reconsider vx = the Source of G . (s2 . 1) as Vertex of G by A19, Lm3; A21: s2 . 1 = s . (len s) by A15, A18, A19, A20, Lm2; A22: now__::_thesis:_not_vx_=_v2 assume vx = v2 ; ::_thesis: contradiction then A23: s2 . 1 orientedly_joins v2,v3 by A21, A17, GRAPH_4:def_1; 1 in dom s2 by A19, FINSEQ_3:25; hence contradiction by A6, A23, FINSEQ_2:11; ::_thesis: verum end; percases ( not v2 in vertices s or v2 = v3 or ( v2 in vertices s & v2 <> v3 ) ) ; supposeA24: ( not v2 in vertices s or v2 = v3 ) ; ::_thesis: cost (Q,W) <= cost (b1,W) set Vs = vertices s; ((vertices s) \ {v3}) \ {v2} c= V by A16, XBOOLE_1:43; then A25: (vertices s) \ ({v3} \/ {v2}) c= V by XBOOLE_1:41; now__::_thesis:_(vertices_s)_\_{v3}_c=_V percases ( not v2 in vertices s or v2 = v3 ) by A24; supposeA26: not v2 in vertices s ; ::_thesis: (vertices s) \ {v3} c= V ((vertices s) \ {v2}) \ {v3} c= V by A25, XBOOLE_1:41; hence (vertices s) \ {v3} c= V by A26, ZFMISC_1:57; ::_thesis: verum end; suppose v2 = v3 ; ::_thesis: (vertices s) \ {v3} c= V hence (vertices s) \ {v3} c= V by A25; ::_thesis: verum end; end; end; then s is_orientedpath_of v1,v3,V by A13, GRAPH_5:def_4; then cost (Q,W) <= cost (s,W) by A5, GRAPH_5:def_18; hence cost (Q,W) <= cost (S,W) by A11, XXREAL_0:2; ::_thesis: verum end; supposeA27: ( v2 in vertices s & v2 <> v3 ) ; ::_thesis: cost (Q,W) <= cost (b1,W) A28: len s1 < len s by A15, A18, NAT_1:13; consider j being Element of NAT such that A29: 1 <= j and A30: j <= len s and A31: v2 = the Target of G . (s . j) by A3, A14, A27, GRAPH_5:28; len s1 <> 0 by A15, A18, A17, A27, A29, A30, A31, XXREAL_0:1; then A32: len s1 >= 0 + 1 by INT_1:7; vx = the Source of G . (s . ((len s1) + 1)) by A19, A20, Lm2 .= the Target of G . (s . (len s1)) by A32, A28, GRAPH_1:def_15 ; then vx = the Target of G . (s1 . (len s1)) by A20, A32, Lm1; then A33: vx in vertices s1 by A32, Lm4; not vx in {v2} by A22, TARSKI:def_1; then A34: vx in (vertices s1) \ {v2} by A33, XBOOLE_0:def_5; A35: now__::_thesis:_not_j_>_len_s1 assume j > len s1 ; ::_thesis: contradiction then j >= (len s1) + 1 by INT_1:7; hence contradiction by A15, A18, A17, A27, A30, A31, XXREAL_0:1; ::_thesis: verum end; then consider k being Nat such that A36: len s1 = j + k by NAT_1:10; consider t1, t2 being FinSequence such that A37: len t1 = j and len t2 = k and A38: s1 = t1 ^ t2 by A36, FINSEQ_2:22; reconsider t1 = t1, t2 = t2 as oriented Simple Chain of G by A38, GRAPH_5:14; A39: t1 <> {} by A29, A37; set Vt = vertices t1; (vertices (s1 ^ s2)) \ {v3} c= V \/ {v2} by A12, A20, GRAPH_5:def_4; then A40: (vertices (t1 ^ t2)) \ {v3} c= V \/ {v2} by A38, GRAPH_5:23; then A41: (vertices t1) \ {v3} c= V \/ {v2} by GRAPH_5:23; A42: len s2 >= 1 by A19; then not v3 in vertices s1 by A4, A20, A14, A17, A32, GRAPH_5:18; then vertices s1 c= V \/ {v2} by A38, A40, ZFMISC_1:57; then A43: (vertices s1) \ {v2} c= V by XBOOLE_1:43; not v1 in vertices s2 by A4, A19, A20, A14, A17, A32, GRAPH_5:18; then vx <> v1 by A19, Lm4; then consider q being oriented Chain of G such that A44: q is_shortestpath_of v1,vx,V,W and A45: cost (q,W) <= cost (P,W) by A7, A34, A43, GRAPH_5:def_19; A46: 0 <= cost (t2,W) by A1, GRAPH_5:50; vertices t1 c= vertices (t1 ^ t2) by GRAPH_5:26; then not v3 in vertices t1 by A4, A20, A14, A17, A32, A38, A42, GRAPH_5:18; then vertices t1 c= V \/ {v2} by A41, ZFMISC_1:57; then A47: (vertices t1) \ {v2} c= V by XBOOLE_1:43; A48: the Source of G . (t1 . 1) = the Source of G . (s1 . 1) by A29, A37, A38, Lm1 .= v1 by A20, A14, A32, Lm1 ; cost (s1,W) = (cost (t1,W)) + (cost (t2,W)) by A1, A38, GRAPH_5:46, GRAPH_5:54; then A49: 0 + (cost (t1,W)) <= cost (s1,W) by A46, XREAL_1:7; the Target of G . (t1 . (len t1)) = the Target of G . (s1 . j) by A29, A37, A38, Lm1 .= v2 by A20, A29, A31, A35, Lm1 ; then t1 is_orientedpath_of v1,v2 by A48, A39, GRAPH_5:def_3; then t1 is_orientedpath_of v1,v2,V by A47, GRAPH_5:def_4; then cost (P,W) <= cost (t1,W) by A2, GRAPH_5:def_18; then cost (q,W) <= cost (t1,W) by A45, XXREAL_0:2; then A50: cost (q,W) <= cost (s1,W) by A49, XXREAL_0:2; A51: s2 . 1 orientedly_joins vx,v3 by A21, A17, GRAPH_4:def_1; A52: q is_orientedpath_of v1,vx,V by A44, GRAPH_5:def_18; then A53: q is_orientedpath_of v1,vx by GRAPH_5:def_4; then q <> {} by GRAPH_5:def_3; then A54: len q >= 1 by FINSEQ_1:20; then consider p being oriented Chain of G such that A55: p = q ^ s2 and p is_orientedpath_of v1,v3 by A19, A51, A53, GRAPH_5:33; p is_orientedpath_of v1,v3,V \/ {vx} by A19, A52, A51, A54, A55, GRAPH_5:34; then p is_orientedpath_of v1,v3,V by A34, A43, ZFMISC_1:40; then cost (Q,W) <= cost (p,W) by A5, GRAPH_5:def_18; then A56: cost (Q,W) <= (cost (q,W)) + (cost (s2,W)) by A1, A55, GRAPH_5:46, GRAPH_5:54; cost (s,W) = (cost (s1,W)) + (cost (s2,W)) by A1, A20, GRAPH_5:46, GRAPH_5:54; then (cost (q,W)) + (cost (s2,W)) <= cost (s,W) by A50, XREAL_1:7; then cost (Q,W) <= cost (s,W) by A56, XXREAL_0:2; hence cost (Q,W) <= cost (S,W) by A11, XXREAL_0:2; ::_thesis: verum end; end; end; Q is_orientedpath_of v1,v3,V by A5, GRAPH_5:def_18; then Q is_orientedpath_of v1,v3,V \/ {v2} by GRAPH_5:32, XBOOLE_1:7; hence Q is_shortestpath_of v1,v3,V \/ {v2},W by A8, GRAPH_5:def_18; ::_thesis: verum end; theorem Th14: :: GRAPHSP:14 for e being set for G being oriented finite Graph for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st e in the carrier' of G & P = <*e*> & e orientedly_joins v1,v2 holds P is_shortestpath_of v1,v2,{v1},W proof let e be set ; ::_thesis: for G being oriented finite Graph for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st e in the carrier' of G & P = <*e*> & e orientedly_joins v1,v2 holds P is_shortestpath_of v1,v2,{v1},W let G be oriented finite Graph; ::_thesis: for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st e in the carrier' of G & P = <*e*> & e orientedly_joins v1,v2 holds P is_shortestpath_of v1,v2,{v1},W let P be oriented Chain of G; ::_thesis: for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st e in the carrier' of G & P = <*e*> & e orientedly_joins v1,v2 holds P is_shortestpath_of v1,v2,{v1},W let W be Function of the carrier' of G,Real>=0; ::_thesis: for v1, v2 being Vertex of G st e in the carrier' of G & P = <*e*> & e orientedly_joins v1,v2 holds P is_shortestpath_of v1,v2,{v1},W let v1, v2 be Vertex of G; ::_thesis: ( e in the carrier' of G & P = <*e*> & e orientedly_joins v1,v2 implies P is_shortestpath_of v1,v2,{v1},W ) assume that A1: e in the carrier' of G and A2: P = <*e*> and A3: e orientedly_joins v1,v2 ; ::_thesis: P is_shortestpath_of v1,v2,{v1},W A4: len P = 1 by A2, FINSEQ_1:40; then A5: vertices P = vertices (P /. 1) by GRAPH_5:25; set FS = the Source of G; set FT = the Target of G; set Eg = the carrier' of G; A6: ( the Source of G . e = v1 & the Target of G . e = v2 ) by A3, GRAPH_4:def_1; A7: now__::_thesis:_for_S_being_oriented_Chain_of_G_st_S_is_orientedpath_of_v1,v2,{v1}_holds_ cost_(P,W)_<=_cost_(S,W) let S be oriented Chain of G; ::_thesis: ( S is_orientedpath_of v1,v2,{v1} implies cost (P,W) <= cost (S,W) ) assume A8: S is_orientedpath_of v1,v2,{v1} ; ::_thesis: cost (P,W) <= cost (S,W) W is_weight>=0of G by GRAPH_5:def_13; then consider s being oriented Simple Chain of G such that A9: s is_shortestpath_of v1,v2,{v1},W by A8, GRAPH_5:62; set Vs = vertices s; A10: s is_orientedpath_of v1,v2,{v1} by A9, GRAPH_5:def_18; then A11: s is_orientedpath_of v1,v2 by GRAPH_5:def_4; then s <> {} by GRAPH_5:def_3; then A12: len s >= 1 by FINSEQ_1:20; then consider i being Nat such that A13: len s = 1 + i by NAT_1:10; A14: the Target of G . (s . (len s)) = v2 by A11, GRAPH_5:def_3; then v2 in vertices s by A12, Lm4; then A15: {v2} c= vertices s by ZFMISC_1:31; A16: the Source of G . (s . 1) = v1 by A11, GRAPH_5:def_3; then v1 in vertices s by A12, Lm4; then {v1} c= vertices s by ZFMISC_1:31; then {v1} \/ {v2} c= vertices s by A15, XBOOLE_1:8; then A17: {v1,v2} c= vertices s by ENUMSET1:1; consider s1, s2 being FinSequence such that A18: len s1 = i and A19: len s2 = 1 and A20: s = s1 ^ s2 by A13, FINSEQ_2:22; reconsider s1 = s1, s2 = s2 as oriented Simple Chain of G by A20, GRAPH_5:14; (vertices s) \ {v2} c= {v1} by A10, GRAPH_5:def_4; then vertices s c= {v2} \/ {v1} by XBOOLE_1:44; then A21: vertices s c= {v1,v2} by ENUMSET1:1; now__::_thesis:_not_s1_<>_{} reconsider vx = the Source of G . (s2 . 1) as Vertex of G by A19, Lm3; A22: len s1 < len s by A13, A18, NAT_1:13; A23: vx in vertices s2 by A19, Lm4; vertices s2 c= vertices (s1 ^ s2) by GRAPH_5:26; then A24: vertices s2 c= {v1,v2} by A21, A17, A20, XBOOLE_0:def_10; assume s1 <> {} ; ::_thesis: contradiction then A25: len s1 >= 1 by FINSEQ_1:20; then A26: the Source of G . (s . 1) <> the Source of G . (s2 . 1) by A19, A20, Th6; len s2 = 1 by A19; then A27: the Target of G . (s . (len s)) <> the Target of G . (s1 . (len s1)) by A20, A25, Th6; the Source of G . (s2 . 1) = the Source of G . (s . ((len s1) + 1)) by A19, A20, Lm2 .= the Target of G . (s . (len s1)) by A25, A22, GRAPH_1:def_15 .= the Target of G . (s1 . (len s1)) by A20, A25, Lm1 ; hence contradiction by A16, A14, A27, A26, A24, A23, TARSKI:def_2; ::_thesis: verum end; then A28: len s = 0 + 1 by A13, A18; s /. 1 in the carrier' of G by A1; then s . 1 in the carrier' of G by A28, FINSEQ_4:15; then e = s . 1 by A1, A6, A16, A14, A28, GRAPH_1:def_7; then s = P by A2, A28, FINSEQ_1:40; hence cost (P,W) <= cost (S,W) by A8, A9, GRAPH_5:def_18; ::_thesis: verum end; A29: P . 1 = e by A2, FINSEQ_1:40; then P /. 1 = e by A4, FINSEQ_4:15; then vertices P = {v1,v2} by A6, A5, GRAPH_5:def_1; then A30: (vertices P) \ {v2} = ({v1} \/ {v2}) \ {v2} by ENUMSET1:1 .= {v1} \ {v2} by XBOOLE_1:40 ; P is_orientedpath_of v1,v2 by A2, A6, A4, A29, GRAPH_5:def_3; then P is_orientedpath_of v1,v2,{v1} by A30, GRAPH_5:def_4; hence P is_shortestpath_of v1,v2,{v1},W by A7, GRAPH_5:def_18; ::_thesis: verum end; theorem Th15: :: GRAPHSP:15 for e, V being set for G being oriented finite Graph for P, Q being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2, v3 being Vertex of G st e in the carrier' of G & P is_shortestpath_of v1,v2,V,W & v1 <> v3 & Q = P ^ <*e*> & e orientedly_joins v2,v3 & v1 in V & ( for v4 being Vertex of G st v4 in V holds for ee being set holds ( not ee in the carrier' of G or not ee orientedly_joins v4,v3 ) ) holds Q is_shortestpath_of v1,v3,V \/ {v2},W proof let e, V be set ; ::_thesis: for G being oriented finite Graph for P, Q being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2, v3 being Vertex of G st e in the carrier' of G & P is_shortestpath_of v1,v2,V,W & v1 <> v3 & Q = P ^ <*e*> & e orientedly_joins v2,v3 & v1 in V & ( for v4 being Vertex of G st v4 in V holds for ee being set holds ( not ee in the carrier' of G or not ee orientedly_joins v4,v3 ) ) holds Q is_shortestpath_of v1,v3,V \/ {v2},W let G be oriented finite Graph; ::_thesis: for P, Q being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2, v3 being Vertex of G st e in the carrier' of G & P is_shortestpath_of v1,v2,V,W & v1 <> v3 & Q = P ^ <*e*> & e orientedly_joins v2,v3 & v1 in V & ( for v4 being Vertex of G st v4 in V holds for ee being set holds ( not ee in the carrier' of G or not ee orientedly_joins v4,v3 ) ) holds Q is_shortestpath_of v1,v3,V \/ {v2},W let P, Q be oriented Chain of G; ::_thesis: for W being Function of the carrier' of G,Real>=0 for v1, v2, v3 being Vertex of G st e in the carrier' of G & P is_shortestpath_of v1,v2,V,W & v1 <> v3 & Q = P ^ <*e*> & e orientedly_joins v2,v3 & v1 in V & ( for v4 being Vertex of G st v4 in V holds for ee being set holds ( not ee in the carrier' of G or not ee orientedly_joins v4,v3 ) ) holds Q is_shortestpath_of v1,v3,V \/ {v2},W let W be Function of the carrier' of G,Real>=0; ::_thesis: for v1, v2, v3 being Vertex of G st e in the carrier' of G & P is_shortestpath_of v1,v2,V,W & v1 <> v3 & Q = P ^ <*e*> & e orientedly_joins v2,v3 & v1 in V & ( for v4 being Vertex of G st v4 in V holds for ee being set holds ( not ee in the carrier' of G or not ee orientedly_joins v4,v3 ) ) holds Q is_shortestpath_of v1,v3,V \/ {v2},W let v1, v2, v3 be Vertex of G; ::_thesis: ( e in the carrier' of G & P is_shortestpath_of v1,v2,V,W & v1 <> v3 & Q = P ^ <*e*> & e orientedly_joins v2,v3 & v1 in V & ( for v4 being Vertex of G st v4 in V holds for ee being set holds ( not ee in the carrier' of G or not ee orientedly_joins v4,v3 ) ) implies Q is_shortestpath_of v1,v3,V \/ {v2},W ) assume that A1: e in the carrier' of G and A2: P is_shortestpath_of v1,v2,V,W and A3: v1 <> v3 and A4: Q = P ^ <*e*> and A5: e orientedly_joins v2,v3 and A6: v1 in V and A7: for v4 being Vertex of G st v4 in V holds for ee being set holds ( not ee in the carrier' of G or not ee orientedly_joins v4,v3 ) ; ::_thesis: Q is_shortestpath_of v1,v3,V \/ {v2},W set Eg = the carrier' of G; reconsider pe = <*e*> as FinSequence of the carrier' of G by A1, FINSEQ_1:74; A8: P is_orientedpath_of v1,v2,V by A2, GRAPH_5:def_18; then P is_orientedpath_of v1,v2 by GRAPH_5:def_4; then P <> {} by GRAPH_5:def_3; then A9: len P >= 1 by FINSEQ_1:20; set V9 = V \/ {v2}; set FS = the Source of G; set FT = the Target of G; A10: W is_weight>=0of G by GRAPH_5:def_13; A11: now__::_thesis:_for_S_being_oriented_Chain_of_G_st_S_is_orientedpath_of_v1,v3,V_\/_{v2}_holds_ cost_(Q,W)_<=_cost_(S,W) let S be oriented Chain of G; ::_thesis: ( S is_orientedpath_of v1,v3,V \/ {v2} implies cost (Q,W) <= cost (S,W) ) assume A12: S is_orientedpath_of v1,v3,V \/ {v2} ; ::_thesis: cost (Q,W) <= cost (S,W) then consider s being oriented Simple Chain of G such that A13: s is_shortestpath_of v1,v3,V \/ {v2},W by A10, GRAPH_5:62; set Vs = vertices s; A14: s is_orientedpath_of v1,v3,V \/ {v2} by A13, GRAPH_5:def_18; then A15: s is_orientedpath_of v1,v3 by GRAPH_5:def_4; then A16: the Target of G . (s . (len s)) = v3 by GRAPH_5:def_3; A17: (vertices s) \ {v3} c= V \/ {v2} by A14, GRAPH_5:def_4; s <> {} by A15, GRAPH_5:def_3; then A18: len s >= 1 by FINSEQ_1:20; then consider i being Nat such that A19: len s = 1 + i by NAT_1:10; consider s1, s2 being FinSequence such that A20: len s1 = i and A21: len s2 = 1 and A22: s = s1 ^ s2 by A19, FINSEQ_2:22; reconsider s1 = s1, s2 = s2 as oriented Simple Chain of G by A22, GRAPH_5:14; reconsider vx = the Source of G . (s2 . 1) as Vertex of G by A21, Lm3; A23: s2 . 1 = s . (len s) by A19, A20, A21, A22, Lm2; A24: the Source of G . (s . 1) = v1 by A15, GRAPH_5:def_3; A25: s1 <> {} proof assume s1 = {} ; ::_thesis: contradiction then A26: len s = 1 + 0 by A19, A20; then s . 1 orientedly_joins v1,v3 by A24, A16, GRAPH_4:def_1; hence contradiction by A6, A7, A26, Th2; ::_thesis: verum end; then A27: len s1 >= 1 by FINSEQ_1:20; len s1 < len s by A19, A20, NAT_1:13; then A28: the Source of G . (s . (len s)) = the Target of G . (s . (len s1)) by A19, A20, A27, GRAPH_1:def_15 .= the Target of G . (s1 . (len s1)) by A22, A27, Lm1 ; A29: now__::_thesis:_not_vx_<>_v2 vx <> the Target of G . (s . (len s)) by A21, A22, A23, A27, A28, Th6; then A30: not vx in {v3} by A16, TARSKI:def_1; vx in vertices s by A18, A23, Lm4; then vx in (vertices s) \ {v3} by A30, XBOOLE_0:def_5; then A31: ( vx in V or vx in {v2} ) by A17, XBOOLE_0:def_3; assume A32: vx <> v2 ; ::_thesis: contradiction ( s2 . 1 orientedly_joins vx,v3 & s2 . 1 in the carrier' of G ) by A21, A23, A16, Th2, GRAPH_4:def_1; hence contradiction by A7, A32, A31, TARSKI:def_1; ::_thesis: verum end; len s2 = 1 by A21; then not the Target of G . (s . (len s)) in vertices s1 by A3, A22, A24, A16, A27, GRAPH_5:18; then A33: (vertices s1) \ {v3} = vertices s1 by A16, ZFMISC_1:57; vertices s1 c= vertices (s1 ^ s2) by GRAPH_5:26; then vertices s1 c= (vertices s) \ {v3} by A22, A33, XBOOLE_1:33; then vertices s1 c= V \/ {v2} by A17, XBOOLE_1:1; then (vertices s1) \ {v2} c= (V \/ {v2}) \ {v2} by XBOOLE_1:33; then (vertices s1) \ {v2} c= V \ {v2} by XBOOLE_1:40; then A34: (vertices s1) \ {v2} c= V by XBOOLE_1:1; s2 /. 1 in the carrier' of G by A1; then A35: s2 . 1 in the carrier' of G by A21, FINSEQ_4:15; ( the Source of G . e = v2 & the Target of G . e = v3 ) by A5, GRAPH_4:def_1; then e = s2 . 1 by A1, A23, A16, A29, A35, GRAPH_1:def_7; then s2 = <*e*> by A21, FINSEQ_1:40; then A36: cost (Q,W) = (cost (P,W)) + (cost (s2,W)) by A4, A10, GRAPH_5:46, GRAPH_5:54; the Source of G . (s1 . 1) = v1 by A22, A24, A27, Lm1; then s1 is_orientedpath_of v1,v2 by A23, A25, A28, A29, GRAPH_5:def_3; then s1 is_orientedpath_of v1,v2,V by A34, GRAPH_5:def_4; then A37: cost (P,W) <= cost (s1,W) by A2, GRAPH_5:def_18; A38: cost (s,W) <= cost (S,W) by A12, A13, GRAPH_5:def_18; cost (s,W) = (cost (s1,W)) + (cost (s2,W)) by A10, A22, GRAPH_5:46, GRAPH_5:54; then cost (Q,W) <= cost (s,W) by A37, A36, XREAL_1:7; hence cost (Q,W) <= cost (S,W) by A38, XXREAL_0:2; ::_thesis: verum end; ( len pe = 1 & pe . 1 = e ) by FINSEQ_1:40; then Q is_orientedpath_of v1,v3,V \/ {v2} by A4, A5, A8, A9, GRAPH_5:34; hence Q is_shortestpath_of v1,v3,V \/ {v2},W by A11, GRAPH_5:def_18; ::_thesis: verum end; theorem Th16: :: GRAPHSP:16 for U, V being set for G being oriented finite Graph for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) holds ( P is_shortestpath_of v1,v2,U,W iff P is_shortestpath_of v1,v2,W ) proof let U, V be set ; ::_thesis: for G being oriented finite Graph for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) holds ( P is_shortestpath_of v1,v2,U,W iff P is_shortestpath_of v1,v2,W ) let G be oriented finite Graph; ::_thesis: for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) holds ( P is_shortestpath_of v1,v2,U,W iff P is_shortestpath_of v1,v2,W ) let P be oriented Chain of G; ::_thesis: for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) holds ( P is_shortestpath_of v1,v2,U,W iff P is_shortestpath_of v1,v2,W ) let W be Function of the carrier' of G,Real>=0; ::_thesis: for v1, v2 being Vertex of G st the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) holds ( P is_shortestpath_of v1,v2,U,W iff P is_shortestpath_of v1,v2,W ) let v1, v2 be Vertex of G; ::_thesis: ( the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) implies ( P is_shortestpath_of v1,v2,U,W iff P is_shortestpath_of v1,v2,W ) ) assume A1: ( the carrier of G = U \/ V & v1 in U & ( for v3, v4 being Vertex of G st v3 in U & v4 in V holds for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) ) ; ::_thesis: ( P is_shortestpath_of v1,v2,U,W iff P is_shortestpath_of v1,v2,W ) hereby ::_thesis: ( P is_shortestpath_of v1,v2,W implies P is_shortestpath_of v1,v2,U,W ) assume A2: P is_shortestpath_of v1,v2,U,W ; ::_thesis: P is_shortestpath_of v1,v2,W A3: now__::_thesis:_for_Q_being_oriented_Chain_of_G_st_Q_is_orientedpath_of_v1,v2_holds_ cost_(P,W)_<=_cost_(Q,W) let Q be oriented Chain of G; ::_thesis: ( Q is_orientedpath_of v1,v2 implies cost (P,W) <= cost (Q,W) ) assume Q is_orientedpath_of v1,v2 ; ::_thesis: cost (P,W) <= cost (Q,W) then Q is_orientedpath_of v1,v2,U by A1, Th12; hence cost (P,W) <= cost (Q,W) by A2, GRAPH_5:def_18; ::_thesis: verum end; P is_orientedpath_of v1,v2,U by A2, GRAPH_5:def_18; then P is_orientedpath_of v1,v2 by GRAPH_5:def_4; hence P is_shortestpath_of v1,v2,W by A3, GRAPH_5:def_17; ::_thesis: verum end; hereby ::_thesis: verum assume A4: P is_shortestpath_of v1,v2,W ; ::_thesis: P is_shortestpath_of v1,v2,U,W A5: now__::_thesis:_for_Q_being_oriented_Chain_of_G_st_Q_is_orientedpath_of_v1,v2,U_holds_ cost_(P,W)_<=_cost_(Q,W) let Q be oriented Chain of G; ::_thesis: ( Q is_orientedpath_of v1,v2,U implies cost (P,W) <= cost (Q,W) ) assume Q is_orientedpath_of v1,v2,U ; ::_thesis: cost (P,W) <= cost (Q,W) then Q is_orientedpath_of v1,v2 by GRAPH_5:def_4; hence cost (P,W) <= cost (Q,W) by A4, GRAPH_5:def_17; ::_thesis: verum end; P is_orientedpath_of v1,v2 by A4, GRAPH_5:def_17; then P is_orientedpath_of v1,v2,U by A1, Th12; hence P is_shortestpath_of v1,v2,U,W by A5, GRAPH_5:def_18; ::_thesis: verum end; end; begin notation let f be Function; let i, x be set ; synonym (f,i) := x for f +* (i,x); end; definition let f be FinSequence of REAL ; let x be set ; let r be Real; :: original: := redefine func(f,x) := r -> FinSequence of REAL ; coherence (f,x) := r is FinSequence of REAL proof A1: rng ((f,x) := r) c= REAL proof let y be set ; :: according to TARSKI:def_3 ::_thesis: ( not y in rng ((f,x) := r) or y in REAL ) A2: rng ((f,x) := r) c= (rng f) \/ {r} by FUNCT_7:100; assume y in rng ((f,x) := r) ; ::_thesis: y in REAL then ( y in rng f or y in {r} ) by A2, XBOOLE_0:def_3; hence y in REAL ; ::_thesis: verum end; dom ((f,x) := r) = dom f by FUNCT_7:30 .= Seg (len f) by FINSEQ_1:def_3 ; then (f,x) := r is FinSequence by FINSEQ_1:def_2; hence (f,x) := r is FinSequence of REAL by A1, FINSEQ_1:def_4; ::_thesis: verum end; end; definition let i, k be Element of NAT ; let f be FinSequence of REAL ; let r be Real; func(f,i) := (k,r) -> FinSequence of REAL equals :: GRAPHSP:def 1 (((f,i) := k),k) := r; coherence (((f,i) := k),k) := r is FinSequence of REAL ; end; :: deftheorem defines := GRAPHSP:def_1_:_ for i, k being Element of NAT for f being FinSequence of REAL for r being Real holds (f,i) := (k,r) = (((f,i) := k),k) := r; theorem Th17: :: GRAPHSP:17 for i, k being Element of NAT for f being Element of REAL * for r being Real st i <> k & i in dom f holds ((f,i) := (k,r)) . i = k proof let i, k be Element of NAT ; ::_thesis: for f being Element of REAL * for r being Real st i <> k & i in dom f holds ((f,i) := (k,r)) . i = k let f be Element of REAL * ; ::_thesis: for r being Real st i <> k & i in dom f holds ((f,i) := (k,r)) . i = k let r be Real; ::_thesis: ( i <> k & i in dom f implies ((f,i) := (k,r)) . i = k ) assume that A1: i <> k and A2: i in dom f ; ::_thesis: ((f,i) := (k,r)) . i = k set fik = (f,i) := k; thus ((f,i) := (k,r)) . i = ((f,i) := k) . i by A1, FUNCT_7:32 .= k by A2, FUNCT_7:31 ; ::_thesis: verum end; theorem Th18: :: GRAPHSP:18 for m, i, k being Element of NAT for f being Element of REAL * for r being Real st m <> i & m <> k holds ((f,i) := (k,r)) . m = f . m proof let m, i, k be Element of NAT ; ::_thesis: for f being Element of REAL * for r being Real st m <> i & m <> k holds ((f,i) := (k,r)) . m = f . m let f be Element of REAL * ; ::_thesis: for r being Real st m <> i & m <> k holds ((f,i) := (k,r)) . m = f . m let r be Real; ::_thesis: ( m <> i & m <> k implies ((f,i) := (k,r)) . m = f . m ) assume that A1: m <> i and A2: m <> k ; ::_thesis: ((f,i) := (k,r)) . m = f . m set fik = (f,i) := k; thus ((f,i) := (k,r)) . m = ((f,i) := k) . m by A2, FUNCT_7:32 .= f . m by A1, FUNCT_7:32 ; ::_thesis: verum end; theorem Th19: :: GRAPHSP:19 for k, i being Element of NAT for f being Element of REAL * for r being Real st k in dom f holds ((f,i) := (k,r)) . k = r proof let k, i be Element of NAT ; ::_thesis: for f being Element of REAL * for r being Real st k in dom f holds ((f,i) := (k,r)) . k = r let f be Element of REAL * ; ::_thesis: for r being Real st k in dom f holds ((f,i) := (k,r)) . k = r let r be Real; ::_thesis: ( k in dom f implies ((f,i) := (k,r)) . k = r ) set fik = (f,i) := k; A1: dom ((f,i) := k) = dom f by FUNCT_7:30; assume k in dom f ; ::_thesis: ((f,i) := (k,r)) . k = r hence ((f,i) := (k,r)) . k = r by A1, FUNCT_7:31; ::_thesis: verum end; theorem Th20: :: GRAPHSP:20 for i, k being Element of NAT for f being Element of REAL * for r being Real holds dom ((f,i) := (k,r)) = dom f proof let i, k be Element of NAT ; ::_thesis: for f being Element of REAL * for r being Real holds dom ((f,i) := (k,r)) = dom f let f be Element of REAL * ; ::_thesis: for r being Real holds dom ((f,i) := (k,r)) = dom f let r be Real; ::_thesis: dom ((f,i) := (k,r)) = dom f set fik = (f,i) := k; thus dom ((f,i) := (k,r)) = dom ((f,i) := k) by FUNCT_7:30 .= dom f by FUNCT_7:30 ; ::_thesis: verum end; begin definition let X be set ; let f, g be Element of Funcs (X,X); :: original: * redefine funcg * f -> Element of Funcs (X,X); coherence f * g is Element of Funcs (X,X) proof reconsider f = f, g = g as Function of X,X by FUNCT_2:66; g * f in Funcs (X,X) by FUNCT_2:9; hence f * g is Element of Funcs (X,X) ; ::_thesis: verum end; end; definition let X be set ; let f be Element of Funcs (X,X); let g be Element of X; :: original: . redefine funcf . g -> Element of X; coherence f . g is Element of X proof A1: f is Function of X,X by FUNCT_2:66; percases ( X = {} or X <> {} ) ; supposeA2: X = {} ; ::_thesis: f . g is Element of X then {} = dom f by A1; then f . g = {} by FUNCT_1:def_2; hence f . g is Element of X by A2, SUBSET_1:def_1; ::_thesis: verum end; suppose X <> {} ; ::_thesis: f . g is Element of X hence f . g is Element of X by A1, FUNCT_2:5; ::_thesis: verum end; end; end; end; definition let X be set ; let f be Element of Funcs (X,X); func repeat f -> Function of NAT,(Funcs (X,X)) means :Def2: :: GRAPHSP:def 2 ( it . 0 = id X & ( for i being Nat holds it . (i + 1) = f * (it . i) ) ); existence ex b1 being Function of NAT,(Funcs (X,X)) st ( b1 . 0 = id X & ( for i being Nat holds b1 . (i + 1) = f * (b1 . i) ) ) proof deffunc H1( Nat, Element of Funcs (X,X)) -> Element of Funcs (X,X) = f * $2; ex F being Function of NAT,(Funcs (X,X)) st ( F . 0 = id X & ( for n being Nat holds F . (n + 1) = H1(n,F . n) ) ) from NAT_1:sch_12(); hence ex b1 being Function of NAT,(Funcs (X,X)) st ( b1 . 0 = id X & ( for i being Nat holds b1 . (i + 1) = f * (b1 . i) ) ) ; ::_thesis: verum end; uniqueness for b1, b2 being Function of NAT,(Funcs (X,X)) st b1 . 0 = id X & ( for i being Nat holds b1 . (i + 1) = f * (b1 . i) ) & b2 . 0 = id X & ( for i being Nat holds b2 . (i + 1) = f * (b2 . i) ) holds b1 = b2 proof deffunc H1( Nat, Element of Funcs (X,X)) -> Element of Funcs (X,X) = f * $2; let F1, F2 be Function of NAT,(Funcs (X,X)); ::_thesis: ( F1 . 0 = id X & ( for i being Nat holds F1 . (i + 1) = f * (F1 . i) ) & F2 . 0 = id X & ( for i being Nat holds F2 . (i + 1) = f * (F2 . i) ) implies F1 = F2 ) assume that A1: F1 . 0 = id X and A2: for i being Nat holds F1 . (i + 1) = H1(i,F1 . i) and A3: F2 . 0 = id X and A4: for i being Nat holds F2 . (i + 1) = H1(i,F2 . i) ; ::_thesis: F1 = F2 thus F1 = F2 from NAT_1:sch_16(A1, A2, A3, A4); ::_thesis: verum end; end; :: deftheorem Def2 defines repeat GRAPHSP:def_2_:_ for X being set for f being Element of Funcs (X,X) for b3 being Function of NAT,(Funcs (X,X)) holds ( b3 = repeat f iff ( b3 . 0 = id X & ( for i being Nat holds b3 . (i + 1) = f * (b3 . i) ) ) ); theorem Th21: :: GRAPHSP:21 for F being Element of Funcs ((REAL *),(REAL *)) for f being Element of REAL * for n, i being Element of NAT holds ((repeat F) . 0) . f = f proof let F be Element of Funcs ((REAL *),(REAL *)); ::_thesis: for f being Element of REAL * for n, i being Element of NAT holds ((repeat F) . 0) . f = f let f be Element of REAL * ; ::_thesis: for n, i being Element of NAT holds ((repeat F) . 0) . f = f let n, i be Element of NAT ; ::_thesis: ((repeat F) . 0) . f = f thus ((repeat F) . 0) . f = (id (REAL *)) . f by Def2 .= f by FUNCT_1:18 ; ::_thesis: verum end; Lm5: for X being set for f being Element of Funcs (X,X) holds dom f = X proof let X be set ; ::_thesis: for f being Element of Funcs (X,X) holds dom f = X let f be Element of Funcs (X,X); ::_thesis: dom f = X ex ff being Function st ( f = ff & dom ff = X & rng ff c= X ) by FUNCT_2:def_2; hence dom f = X ; ::_thesis: verum end; theorem Th22: :: GRAPHSP:22 for F, G being Element of Funcs ((REAL *),(REAL *)) for f being Element of REAL * for i being Element of NAT holds ((repeat (F * G)) . (i + 1)) . f = F . (G . (((repeat (F * G)) . i) . f)) proof let F, G be Element of Funcs ((REAL *),(REAL *)); ::_thesis: for f being Element of REAL * for i being Element of NAT holds ((repeat (F * G)) . (i + 1)) . f = F . (G . (((repeat (F * G)) . i) . f)) let f be Element of REAL * ; ::_thesis: for i being Element of NAT holds ((repeat (F * G)) . (i + 1)) . f = F . (G . (((repeat (F * G)) . i) . f)) let i be Element of NAT ; ::_thesis: ((repeat (F * G)) . (i + 1)) . f = F . (G . (((repeat (F * G)) . i) . f)) set Fi = (repeat (F * G)) . i; set ff = ((repeat (F * G)) . i) . f; set FFi = (F * G) * ((repeat (F * G)) . i); A1: dom (F * G) = REAL * by Lm5; A2: dom ((F * G) * ((repeat (F * G)) . i)) = REAL * by Lm5; thus ((repeat (F * G)) . (i + 1)) . f = ((F * G) * ((repeat (F * G)) . i)) . f by Def2 .= (F * G) . (((repeat (F * G)) . i) . f) by A2, FUNCT_1:12 .= F . (G . (((repeat (F * G)) . i) . f)) by A1, FUNCT_1:12 ; ::_thesis: verum end; definition let g be Element of Funcs ((REAL *),(REAL *)); let f be Element of REAL * ; :: original: . redefine funcg . f -> Element of REAL * ; coherence g . f is Element of REAL * proof g . f in REAL * ; hence g . f is Element of REAL * ; ::_thesis: verum end; end; definition let f be Element of REAL * ; let n be Nat; func OuterVx (f,n) -> Subset of NAT equals :: GRAPHSP:def 3 { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 & f . (n + i) <> - 1 ) } ; coherence { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 & f . (n + i) <> - 1 ) } is Subset of NAT proof set NS = { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 & f . (n + i) <> - 1 ) } ; { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 & f . (n + i) <> - 1 ) } c= NAT proof let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 & f . (n + i) <> - 1 ) } or x in NAT ) assume x in { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 & f . (n + i) <> - 1 ) } ; ::_thesis: x in NAT then ex k being Element of NAT st ( x = k & k in dom f & 1 <= k & k <= n & f . k <> - 1 & f . (n + k) <> - 1 ) ; hence x in NAT ; ::_thesis: verum end; hence { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 & f . (n + i) <> - 1 ) } is Subset of NAT ; ::_thesis: verum end; end; :: deftheorem defines OuterVx GRAPHSP:def_3_:_ for f being Element of REAL * for n being Nat holds OuterVx (f,n) = { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 & f . (n + i) <> - 1 ) } ; definition let f be Element of Funcs ((REAL *),(REAL *)); let g be Element of REAL * ; let n be Nat; assume A1: ex i being Element of NAT st OuterVx ((((repeat f) . i) . g),n) = {} ; func LifeSpan (f,g,n) -> Element of NAT means :Def4: :: GRAPHSP:def 4 ( OuterVx ((((repeat f) . it) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds it <= k ) ); existence ex b1 being Element of NAT st ( OuterVx ((((repeat f) . b1) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds b1 <= k ) ) proof defpred S1[ Nat] means OuterVx ((((repeat f) . $1) . g),n) = {} ; A2: ex k being Nat st S1[k] by A1; ex k being Nat st ( S1[k] & ( for n being Nat st S1[n] holds k <= n ) ) from NAT_1:sch_5(A2); then consider k being Nat such that A3: ( S1[k] & ( for n being Nat st S1[n] holds k <= n ) ) ; k in NAT by ORDINAL1:def_12; hence ex b1 being Element of NAT st ( OuterVx ((((repeat f) . b1) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds b1 <= k ) ) by A3; ::_thesis: verum end; uniqueness for b1, b2 being Element of NAT st OuterVx ((((repeat f) . b1) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds b1 <= k ) & OuterVx ((((repeat f) . b2) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds b2 <= k ) holds b1 = b2 proof let it1, it2 be Element of NAT ; ::_thesis: ( OuterVx ((((repeat f) . it1) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds it1 <= k ) & OuterVx ((((repeat f) . it2) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds it2 <= k ) implies it1 = it2 ) assume A4: ( OuterVx ((((repeat f) . it1) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds it1 <= k ) & OuterVx ((((repeat f) . it2) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds it2 <= k ) & not it1 = it2 ) ; ::_thesis: contradiction then ( it1 <= it2 & it2 <= it1 ) ; hence contradiction by A4, XXREAL_0:1; ::_thesis: verum end; end; :: deftheorem Def4 defines LifeSpan GRAPHSP:def_4_:_ for f being Element of Funcs ((REAL *),(REAL *)) for g being Element of REAL * for n being Nat st ex i being Element of NAT st OuterVx ((((repeat f) . i) . g),n) = {} holds for b4 being Element of NAT holds ( b4 = LifeSpan (f,g,n) iff ( OuterVx ((((repeat f) . b4) . g),n) = {} & ( for k being Nat st OuterVx ((((repeat f) . k) . g),n) = {} holds b4 <= k ) ) ); definition let f be Element of Funcs ((REAL *),(REAL *)); let n be Element of NAT ; func while_do (f,n) -> Element of Funcs ((REAL *),(REAL *)) means :Def5: :: GRAPHSP:def 5 ( dom it = REAL * & ( for h being Element of REAL * holds it . h = ((repeat f) . (LifeSpan (f,h,n))) . h ) ); existence ex b1 being Element of Funcs ((REAL *),(REAL *)) st ( dom b1 = REAL * & ( for h being Element of REAL * holds b1 . h = ((repeat f) . (LifeSpan (f,h,n))) . h ) ) proof set X = REAL * ; defpred S1[ set , set ] means for h being Element of REAL * st $1 = h holds $2 = ((repeat f) . (LifeSpan (f,h,n))) . h; A1: ex ff being Function st ( f = ff & dom ff = REAL * & rng ff c= REAL * ) by FUNCT_2:def_2; A2: now__::_thesis:_for_xx_being_set_st_xx_in_dom_f_holds_ ex_y1_being_set_st_S1[xx,y1] let xx be set ; ::_thesis: ( xx in dom f implies ex y1 being set st S1[xx,y1] ) assume xx in dom f ; ::_thesis: ex y1 being set st S1[xx,y1] then reconsider h9 = xx as Element of REAL * by A1; now__::_thesis:_ex_yy_being_Element_of_REAL_*_st_ for_h_being_Element_of_REAL_*_st_xx_=_h_holds_ yy_=_((repeat_f)_._(LifeSpan_(f,h,n)))_._h take yy = ((repeat f) . (LifeSpan (f,h9,n))) . h9; ::_thesis: for h being Element of REAL * st xx = h holds yy = ((repeat f) . (LifeSpan (f,h,n))) . h let h be Element of REAL * ; ::_thesis: ( xx = h implies yy = ((repeat f) . (LifeSpan (f,h,n))) . h ) assume xx = h ; ::_thesis: yy = ((repeat f) . (LifeSpan (f,h,n))) . h hence yy = ((repeat f) . (LifeSpan (f,h,n))) . h ; ::_thesis: verum end; hence ex y1 being set st S1[xx,y1] ; ::_thesis: verum end; consider f9 being Function such that A3: ( dom f9 = dom f & ( for xx being set st xx in dom f holds S1[xx,f9 . xx] ) ) from CLASSES1:sch_1(A2); rng f9 c= REAL * proof let y be set ; :: according to TARSKI:def_3 ::_thesis: ( not y in rng f9 or y in REAL * ) assume y in rng f9 ; ::_thesis: y in REAL * then consider xx being set such that A4: xx in dom f9 and A5: y = f9 . xx by FUNCT_1:def_3; reconsider h9 = xx as Element of REAL * by A1, A3, A4; y = ((repeat f) . (LifeSpan (f,h9,n))) . h9 by A3, A4, A5; hence y in REAL * ; ::_thesis: verum end; then reconsider f9 = f9 as Element of Funcs ((REAL *),(REAL *)) by A1, A3, FUNCT_2:def_2; take f9 ; ::_thesis: ( dom f9 = REAL * & ( for h being Element of REAL * holds f9 . h = ((repeat f) . (LifeSpan (f,h,n))) . h ) ) thus dom f9 = REAL * by A1, A3; ::_thesis: for h being Element of REAL * holds f9 . h = ((repeat f) . (LifeSpan (f,h,n))) . h let h be Element of REAL * ; ::_thesis: f9 . h = ((repeat f) . (LifeSpan (f,h,n))) . h thus f9 . h = ((repeat f) . (LifeSpan (f,h,n))) . h by A1, A3; ::_thesis: verum end; uniqueness for b1, b2 being Element of Funcs ((REAL *),(REAL *)) st dom b1 = REAL * & ( for h being Element of REAL * holds b1 . h = ((repeat f) . (LifeSpan (f,h,n))) . h ) & dom b2 = REAL * & ( for h being Element of REAL * holds b2 . h = ((repeat f) . (LifeSpan (f,h,n))) . h ) holds b1 = b2 proof set X = REAL * ; let g1, g2 be Element of Funcs ((REAL *),(REAL *)); ::_thesis: ( dom g1 = REAL * & ( for h being Element of REAL * holds g1 . h = ((repeat f) . (LifeSpan (f,h,n))) . h ) & dom g2 = REAL * & ( for h being Element of REAL * holds g2 . h = ((repeat f) . (LifeSpan (f,h,n))) . h ) implies g1 = g2 ) assume that A6: dom g1 = REAL * and A7: for h being Element of REAL * holds g1 . h = ((repeat f) . (LifeSpan (f,h,n))) . h and A8: dom g2 = REAL * and A9: for h being Element of REAL * holds g2 . h = ((repeat f) . (LifeSpan (f,h,n))) . h ; ::_thesis: g1 = g2 now__::_thesis:_for_xx_being_set_st_xx_in_dom_g1_holds_ g1_._xx_=_g2_._xx let xx be set ; ::_thesis: ( xx in dom g1 implies g1 . xx = g2 . xx ) assume xx in dom g1 ; ::_thesis: g1 . xx = g2 . xx then reconsider h = xx as Element of REAL * by A6; thus g1 . xx = ((repeat f) . (LifeSpan (f,h,n))) . h by A7 .= g2 . xx by A9 ; ::_thesis: verum end; hence g1 = g2 by A6, A8, FUNCT_1:2; ::_thesis: verum end; end; :: deftheorem Def5 defines while_do GRAPHSP:def_5_:_ for f being Element of Funcs ((REAL *),(REAL *)) for n being Element of NAT for b3 being Element of Funcs ((REAL *),(REAL *)) holds ( b3 = while_do (f,n) iff ( dom b3 = REAL * & ( for h being Element of REAL * holds b3 . h = ((repeat f) . (LifeSpan (f,h,n))) . h ) ) ); begin definition let G be oriented Graph; let v1, v2 be Vertex of G; assume A1: ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) ; func XEdge (v1,v2) -> set means :Def6: :: GRAPHSP:def 6 ex e being set st ( it = e & e in the carrier' of G & e orientedly_joins v1,v2 ); existence ex b1 being set ex e being set st ( b1 = e & e in the carrier' of G & e orientedly_joins v1,v2 ) by A1; uniqueness for b1, b2 being set st ex e being set st ( b1 = e & e in the carrier' of G & e orientedly_joins v1,v2 ) & ex e being set st ( b2 = e & e in the carrier' of G & e orientedly_joins v1,v2 ) holds b1 = b2 by Th10; end; :: deftheorem Def6 defines XEdge GRAPHSP:def_6_:_ for G being oriented Graph for v1, v2 being Vertex of G st ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) holds for b4 being set holds ( b4 = XEdge (v1,v2) iff ex e being set st ( b4 = e & e in the carrier' of G & e orientedly_joins v1,v2 ) ); definition let G be oriented Graph; let v1, v2 be Vertex of G; let W be Function; func Weight (v1,v2,W) -> set equals :Def7: :: GRAPHSP:def 7 W . (XEdge (v1,v2)) if ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) otherwise - 1; correctness coherence ( ( ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) implies W . (XEdge (v1,v2)) is set ) & ( ( for e being set holds ( not e in the carrier' of G or not e orientedly_joins v1,v2 ) ) implies - 1 is set ) ); consistency for b1 being set holds verum; ; end; :: deftheorem Def7 defines Weight GRAPHSP:def_7_:_ for G being oriented Graph for v1, v2 being Vertex of G for W being Function holds ( ( ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) implies Weight (v1,v2,W) = W . (XEdge (v1,v2)) ) & ( ( for e being set holds ( not e in the carrier' of G or not e orientedly_joins v1,v2 ) ) implies Weight (v1,v2,W) = - 1 ) ); definition let G be oriented Graph; let v1, v2 be Vertex of G; let W be Function of the carrier' of G,Real>=0; :: original: Weight redefine func Weight (v1,v2,W) -> Real; coherence Weight (v1,v2,W) is Real proof percases ( ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) or for e being set holds ( not e in the carrier' of G or not e orientedly_joins v1,v2 ) ) ; supposeA1: ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) ; ::_thesis: Weight (v1,v2,W) is Real then consider e being set such that A2: XEdge (v1,v2) = e and A3: e in the carrier' of G and e orientedly_joins v1,v2 by Def6; e in dom W by A3, FUNCT_2:def_1; then W . (XEdge (v1,v2)) in Real>=0 by A2, PARTFUN1:4; hence Weight (v1,v2,W) is Real by A1, Def7; ::_thesis: verum end; suppose for e being set holds ( not e in the carrier' of G or not e orientedly_joins v1,v2 ) ; ::_thesis: Weight (v1,v2,W) is Real hence Weight (v1,v2,W) is Real by Def7; ::_thesis: verum end; end; end; end; theorem Th23: :: GRAPHSP:23 for G being oriented Graph for v1, v2 being Vertex of G for W being Function of the carrier' of G,Real>=0 holds ( Weight (v1,v2,W) >= 0 iff ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) ) proof let G be oriented Graph; ::_thesis: for v1, v2 being Vertex of G for W being Function of the carrier' of G,Real>=0 holds ( Weight (v1,v2,W) >= 0 iff ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) ) let v1, v2 be Vertex of G; ::_thesis: for W being Function of the carrier' of G,Real>=0 holds ( Weight (v1,v2,W) >= 0 iff ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) ) let W be Function of the carrier' of G,Real>=0; ::_thesis: ( Weight (v1,v2,W) >= 0 iff ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) ) set EG = the carrier' of G; hereby ::_thesis: ( ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) implies Weight (v1,v2,W) >= 0 ) assume A1: Weight (v1,v2,W) >= 0 ; ::_thesis: ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) assume for e being set holds ( not e in the carrier' of G or not e orientedly_joins v1,v2 ) ; ::_thesis: contradiction then Weight (v1,v2,W) = - 1 by Def7; hence contradiction by A1; ::_thesis: verum end; assume ex e being set st ( e in the carrier' of G & e orientedly_joins v1,v2 ) ; ::_thesis: Weight (v1,v2,W) >= 0 then consider e being set such that A2: XEdge (v1,v2) = e and A3: e in the carrier' of G and A4: e orientedly_joins v1,v2 by Def6; e in dom W by A3, FUNCT_2:def_1; then W . e in Real>=0 by PARTFUN1:4; then ex r being Real st ( W . e = r & r >= 0 ) by GRAPH_5:def_12; hence Weight (v1,v2,W) >= 0 by A2, A3, A4, Def7; ::_thesis: verum end; theorem :: GRAPHSP:24 for G being oriented Graph for v1, v2 being Vertex of G for W being Function of the carrier' of G,Real>=0 holds ( Weight (v1,v2,W) = - 1 iff for e being set holds ( not e in the carrier' of G or not e orientedly_joins v1,v2 ) ) by Def7, Th23; theorem Th25: :: GRAPHSP:25 for e being set for G being oriented Graph for v1, v2 being Vertex of G for W being Function of the carrier' of G,Real>=0 st e in the carrier' of G & e orientedly_joins v1,v2 holds Weight (v1,v2,W) = W . e proof let e be set ; ::_thesis: for G being oriented Graph for v1, v2 being Vertex of G for W being Function of the carrier' of G,Real>=0 st e in the carrier' of G & e orientedly_joins v1,v2 holds Weight (v1,v2,W) = W . e let G be oriented Graph; ::_thesis: for v1, v2 being Vertex of G for W being Function of the carrier' of G,Real>=0 st e in the carrier' of G & e orientedly_joins v1,v2 holds Weight (v1,v2,W) = W . e let v1, v2 be Vertex of G; ::_thesis: for W being Function of the carrier' of G,Real>=0 st e in the carrier' of G & e orientedly_joins v1,v2 holds Weight (v1,v2,W) = W . e let W be Function of the carrier' of G,Real>=0; ::_thesis: ( e in the carrier' of G & e orientedly_joins v1,v2 implies Weight (v1,v2,W) = W . e ) set EG = the carrier' of G; assume A1: ( e in the carrier' of G & e orientedly_joins v1,v2 ) ; ::_thesis: Weight (v1,v2,W) = W . e then consider e1 being set such that A2: XEdge (v1,v2) = e1 and A3: ( e1 in the carrier' of G & e1 orientedly_joins v1,v2 ) by Def6; e = e1 by A1, A3, Th10; hence Weight (v1,v2,W) = W . e by A2, A3, Def7; ::_thesis: verum end; begin definition let f be Element of REAL * ; let n be Element of NAT ; func UnusedVx (f,n) -> Subset of NAT equals :: GRAPHSP:def 8 { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 ) } ; coherence { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 ) } is Subset of NAT proof set NS = { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 ) } ; { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 ) } c= NAT proof let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 ) } or x in NAT ) assume x in { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 ) } ; ::_thesis: x in NAT then ex k being Element of NAT st ( x = k & k in dom f & 1 <= k & k <= n & f . k <> - 1 ) ; hence x in NAT ; ::_thesis: verum end; hence { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 ) } is Subset of NAT ; ::_thesis: verum end; end; :: deftheorem defines UnusedVx GRAPHSP:def_8_:_ for f being Element of REAL * for n being Element of NAT holds UnusedVx (f,n) = { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i <> - 1 ) } ; definition let f be Element of REAL * ; let n be Element of NAT ; func UsedVx (f,n) -> Subset of NAT equals :: GRAPHSP:def 9 { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i = - 1 ) } ; coherence { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i = - 1 ) } is Subset of NAT proof set NS = { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i = - 1 ) } ; { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i = - 1 ) } c= NAT proof let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i = - 1 ) } or x in NAT ) assume x in { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i = - 1 ) } ; ::_thesis: x in NAT then ex k being Element of NAT st ( x = k & k in dom f & 1 <= k & k <= n & f . k = - 1 ) ; hence x in NAT ; ::_thesis: verum end; hence { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i = - 1 ) } is Subset of NAT ; ::_thesis: verum end; end; :: deftheorem defines UsedVx GRAPHSP:def_9_:_ for f being Element of REAL * for n being Element of NAT holds UsedVx (f,n) = { i where i is Element of NAT : ( i in dom f & 1 <= i & i <= n & f . i = - 1 ) } ; theorem Th26: :: GRAPHSP:26 for n being Element of NAT for f being Element of REAL * holds UnusedVx (f,n) c= Seg n proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * holds UnusedVx (f,n) c= Seg n let f be Element of REAL * ; ::_thesis: UnusedVx (f,n) c= Seg n let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in UnusedVx (f,n) or x in Seg n ) assume x in UnusedVx (f,n) ; ::_thesis: x in Seg n then ex i being Element of NAT st ( x = i & i in dom f & 1 <= i & i <= n & f . i <> - 1 ) ; then x in { k where k is Element of NAT : ( 1 <= k & k <= n ) } ; hence x in Seg n by FINSEQ_1:def_1; ::_thesis: verum end; registration let f be Element of REAL * ; let n be Element of NAT ; cluster UnusedVx (f,n) -> finite ; coherence UnusedVx (f,n) is finite proof UnusedVx (f,n) c= Seg n by Th26; hence UnusedVx (f,n) is finite ; ::_thesis: verum end; end; theorem Th27: :: GRAPHSP:27 for n being Element of NAT for f being Element of REAL * holds OuterVx (f,n) c= UnusedVx (f,n) proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * holds OuterVx (f,n) c= UnusedVx (f,n) let f be Element of REAL * ; ::_thesis: OuterVx (f,n) c= UnusedVx (f,n) let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in OuterVx (f,n) or x in UnusedVx (f,n) ) assume x in OuterVx (f,n) ; ::_thesis: x in UnusedVx (f,n) then ex k being Element of NAT st ( x = k & k in dom f & 1 <= k & k <= n & f . k <> - 1 & f . (n + k) <> - 1 ) ; hence x in UnusedVx (f,n) ; ::_thesis: verum end; theorem Th28: :: GRAPHSP:28 for n being Element of NAT for f being Element of REAL * holds OuterVx (f,n) c= Seg n proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * holds OuterVx (f,n) c= Seg n let f be Element of REAL * ; ::_thesis: OuterVx (f,n) c= Seg n ( OuterVx (f,n) c= UnusedVx (f,n) & UnusedVx (f,n) c= Seg n ) by Th26, Th27; hence OuterVx (f,n) c= Seg n by XBOOLE_1:1; ::_thesis: verum end; registration let f be Element of REAL * ; let n be Element of NAT ; cluster OuterVx (f,n) -> finite ; coherence OuterVx (f,n) is finite proof OuterVx (f,n) c= Seg n by Th28; hence OuterVx (f,n) is finite ; ::_thesis: verum end; end; definition let X be finite Subset of NAT; let f be Element of REAL * ; let n be Element of NAT ; func Argmin (X,f,n) -> Element of NAT means :Def10: :: GRAPHSP:def 10 ( ( X <> {} implies ex i being Element of NAT st ( i = it & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies it = 0 ) ); existence ex b1 being Element of NAT st ( ( X <> {} implies ex i being Element of NAT st ( i = b1 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies b1 = 0 ) ) proof percases ( X = {} or X <> {} ) ; supposeA1: X = {} ; ::_thesis: ex b1 being Element of NAT st ( ( X <> {} implies ex i being Element of NAT st ( i = b1 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies b1 = 0 ) ) take 0 ; ::_thesis: ( ( X <> {} implies ex i being Element of NAT st ( i = 0 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies 0 = 0 ) ) thus ( ( X <> {} implies ex i being Element of NAT st ( i = 0 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies 0 = 0 ) ) by A1; ::_thesis: verum end; supposeA2: X <> {} ; ::_thesis: ex b1 being Element of NAT st ( ( X <> {} implies ex i being Element of NAT st ( i = b1 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies b1 = 0 ) ) then reconsider X9 = X as non empty finite Subset of NAT ; deffunc H1( Element of X9) -> Element of REAL = f /. ((2 * n) + $1); consider x being Element of X9 such that A3: for y being Element of X9 holds H1(x) <= H1(y) from GRAPH_5:sch_2(); reconsider x = x as Element of NAT ; defpred S1[ Nat] means ( $1 in X & f /. ((2 * n) + x) = f /. ((2 * n) + $1) ); A4: ex i being Nat st S1[i] ; consider i being Nat such that A5: ( S1[i] & ( for k being Nat st S1[k] holds i <= k ) ) from NAT_1:sch_5(A4); reconsider i = i as Element of NAT by ORDINAL1:def_12; take F = i; ::_thesis: ( ( X <> {} implies ex i being Element of NAT st ( i = F & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies F = 0 ) ) hereby ::_thesis: ( X = {} implies F = 0 ) assume X <> {} ; ::_thesis: ex i being Element of NAT st ( i = F & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) take i = F; ::_thesis: ( i = F & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) thus ( i = F & i in X ) by A5; ::_thesis: ( ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) thus for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) by A3, A5; ::_thesis: for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k thus for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k by A5; ::_thesis: verum end; thus ( X = {} implies F = 0 ) by A2; ::_thesis: verum end; end; end; uniqueness for b1, b2 being Element of NAT st ( X <> {} implies ex i being Element of NAT st ( i = b1 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies b1 = 0 ) & ( X <> {} implies ex i being Element of NAT st ( i = b2 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies b2 = 0 ) holds b1 = b2 proof let F1, F2 be Element of NAT ; ::_thesis: ( ( X <> {} implies ex i being Element of NAT st ( i = F1 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies F1 = 0 ) & ( X <> {} implies ex i being Element of NAT st ( i = F2 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies F2 = 0 ) implies F1 = F2 ) assume that A6: ( X <> {} implies ex i being Element of NAT st ( i = F1 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) and A7: ( X = {} implies F1 = 0 ) and A8: ( X <> {} implies ex i being Element of NAT st ( i = F2 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) and A9: ( X = {} implies F2 = 0 ) ; ::_thesis: F1 = F2 percases ( X <> {} or X = {} ) ; supposeA10: X <> {} ; ::_thesis: F1 = F2 then consider j being Element of NAT such that A11: j = F2 and A12: j in X and A13: for k being Element of NAT st k in X holds f /. ((2 * n) + j) <= f /. ((2 * n) + k) and A14: for k being Element of NAT st k in X & f /. ((2 * n) + j) = f /. ((2 * n) + k) holds j <= k by A8; consider i being Element of NAT such that A15: i = F1 and A16: i in X and A17: for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) and A18: for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k by A6, A10; ( f /. ((2 * n) + i) <= f /. ((2 * n) + j) & f /. ((2 * n) + j) <= f /. ((2 * n) + i) ) by A16, A17, A12, A13; then f /. ((2 * n) + j) = f /. ((2 * n) + i) by XXREAL_0:1; then ( i <= j & j <= i ) by A16, A18, A12, A14; hence F1 = F2 by A15, A11, XXREAL_0:1; ::_thesis: verum end; suppose X = {} ; ::_thesis: F1 = F2 hence F1 = F2 by A7, A9; ::_thesis: verum end; end; end; end; :: deftheorem Def10 defines Argmin GRAPHSP:def_10_:_ for X being finite Subset of NAT for f being Element of REAL * for n, b4 being Element of NAT holds ( b4 = Argmin (X,f,n) iff ( ( X <> {} implies ex i being Element of NAT st ( i = b4 & i in X & ( for k being Element of NAT st k in X holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in X & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) ) & ( X = {} implies b4 = 0 ) ) ); theorem Th29: :: GRAPHSP:29 for n, j being Element of NAT for f being Element of REAL * st OuterVx (f,n) <> {} & j = Argmin ((OuterVx (f,n)),f,n) holds ( j in dom f & 1 <= j & j <= n & f . j <> - 1 & f . (n + j) <> - 1 ) proof let n, j be Element of NAT ; ::_thesis: for f being Element of REAL * st OuterVx (f,n) <> {} & j = Argmin ((OuterVx (f,n)),f,n) holds ( j in dom f & 1 <= j & j <= n & f . j <> - 1 & f . (n + j) <> - 1 ) let f be Element of REAL * ; ::_thesis: ( OuterVx (f,n) <> {} & j = Argmin ((OuterVx (f,n)),f,n) implies ( j in dom f & 1 <= j & j <= n & f . j <> - 1 & f . (n + j) <> - 1 ) ) set IN = OuterVx (f,n); assume ( OuterVx (f,n) <> {} & j = Argmin ((OuterVx (f,n)),f,n) ) ; ::_thesis: ( j in dom f & 1 <= j & j <= n & f . j <> - 1 & f . (n + j) <> - 1 ) then ex i being Element of NAT st ( i = j & i in OuterVx (f,n) & ( for k being Element of NAT st k in OuterVx (f,n) holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) ) & ( for k being Element of NAT st k in OuterVx (f,n) & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k ) ) by Def10; then ex k being Element of NAT st ( j = k & k in dom f & 1 <= k & k <= n & f . k <> - 1 & f . (n + k) <> - 1 ) ; hence ( j in dom f & 1 <= j & j <= n & f . j <> - 1 & f . (n + j) <> - 1 ) ; ::_thesis: verum end; theorem Th30: :: GRAPHSP:30 for n being Element of NAT for f being Element of REAL * holds Argmin ((OuterVx (f,n)),f,n) <= n proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * holds Argmin ((OuterVx (f,n)),f,n) <= n let f be Element of REAL * ; ::_thesis: Argmin ((OuterVx (f,n)),f,n) <= n set IN = OuterVx (f,n); percases ( OuterVx (f,n) <> {} or OuterVx (f,n) = {} ) ; suppose OuterVx (f,n) <> {} ; ::_thesis: Argmin ((OuterVx (f,n)),f,n) <= n hence Argmin ((OuterVx (f,n)),f,n) <= n by Th29; ::_thesis: verum end; suppose OuterVx (f,n) = {} ; ::_thesis: Argmin ((OuterVx (f,n)),f,n) <= n hence Argmin ((OuterVx (f,n)),f,n) <= n by Def10; ::_thesis: verum end; end; end; definition let n be Element of NAT ; func findmin n -> Element of Funcs ((REAL *),(REAL *)) means :Def11: :: GRAPHSP:def 11 ( dom it = REAL * & ( for f being Element of REAL * holds it . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ) ); existence ex b1 being Element of Funcs ((REAL *),(REAL *)) st ( dom b1 = REAL * & ( for f being Element of REAL * holds b1 . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ) ) proof set X = REAL * ; set mi = ((n * n) + (3 * n)) + 1; defpred S1[ set , set ] means for f being Element of REAL * st $1 = f holds $2 = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)); A1: now__::_thesis:_for_xx_being_set_st_xx_in_REAL_*_holds_ ex_y_being_set_st_S1[xx,y] let xx be set ; ::_thesis: ( xx in REAL * implies ex y being set st S1[xx,y] ) assume xx in REAL * ; ::_thesis: ex y being set st S1[xx,y] then reconsider h = xx as Element of REAL * ; reconsider y = (h,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (h,n)),h,n)),(- 1)) as set ; take y = y; ::_thesis: S1[xx,y] thus S1[xx,y] ; ::_thesis: verum end; consider F being Function such that A2: ( dom F = REAL * & ( for x being set st x in REAL * holds S1[x,F . x] ) ) from CLASSES1:sch_1(A1); rng F c= REAL * proof let y be set ; :: according to TARSKI:def_3 ::_thesis: ( not y in rng F or y in REAL * ) assume y in rng F ; ::_thesis: y in REAL * then consider xx being set such that A3: xx in dom F and A4: y = F . xx by FUNCT_1:def_3; reconsider h = xx as Element of REAL * by A2, A3; y = (h,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (h,n)),h,n)),(- 1)) by A2, A4; hence y in REAL * by FINSEQ_1:def_11; ::_thesis: verum end; then reconsider F = F as Element of Funcs ((REAL *),(REAL *)) by A2, FUNCT_2:def_2; take F ; ::_thesis: ( dom F = REAL * & ( for f being Element of REAL * holds F . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ) ) thus dom F = REAL * by A2; ::_thesis: for f being Element of REAL * holds F . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) let f be Element of REAL * ; ::_thesis: F . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) thus F . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) by A2; ::_thesis: verum end; uniqueness for b1, b2 being Element of Funcs ((REAL *),(REAL *)) st dom b1 = REAL * & ( for f being Element of REAL * holds b1 . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ) & dom b2 = REAL * & ( for f being Element of REAL * holds b2 . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ) holds b1 = b2 proof set X = REAL * ; set mi = ((n * n) + (3 * n)) + 1; let F1, F2 be Element of Funcs ((REAL *),(REAL *)); ::_thesis: ( dom F1 = REAL * & ( for f being Element of REAL * holds F1 . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ) & dom F2 = REAL * & ( for f being Element of REAL * holds F2 . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ) implies F1 = F2 ) assume that A5: dom F1 = REAL * and A6: for f being Element of REAL * holds F1 . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) and A7: dom F2 = REAL * and A8: for f being Element of REAL * holds F2 . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ; ::_thesis: F1 = F2 now__::_thesis:_for_xx_being_set_st_xx_in_dom_F1_holds_ F1_._xx_=_F2_._xx let xx be set ; ::_thesis: ( xx in dom F1 implies F1 . xx = F2 . xx ) assume xx in dom F1 ; ::_thesis: F1 . xx = F2 . xx then reconsider h = xx as Element of REAL * by A5; thus F1 . xx = (h,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (h,n)),h,n)),(- 1)) by A6 .= F2 . xx by A8 ; ::_thesis: verum end; hence F1 = F2 by A5, A7, FUNCT_1:2; ::_thesis: verum end; end; :: deftheorem Def11 defines findmin GRAPHSP:def_11_:_ for n being Element of NAT for b2 being Element of Funcs ((REAL *),(REAL *)) holds ( b2 = findmin n iff ( dom b2 = REAL * & ( for f being Element of REAL * holds b2 . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) ) ) ); theorem Th31: :: GRAPHSP:31 for i, n being Element of NAT for f being Element of REAL * st i > n & i <> ((n * n) + (3 * n)) + 1 holds ((findmin n) . f) . i = f . i proof let i, n be Element of NAT ; ::_thesis: for f being Element of REAL * st i > n & i <> ((n * n) + (3 * n)) + 1 holds ((findmin n) . f) . i = f . i let f be Element of REAL * ; ::_thesis: ( i > n & i <> ((n * n) + (3 * n)) + 1 implies ((findmin n) . f) . i = f . i ) set k = Argmin ((OuterVx (f,n)),f,n); set mi = ((n * n) + (3 * n)) + 1; assume A1: ( i > n & i <> ((n * n) + (3 * n)) + 1 ) ; ::_thesis: ((findmin n) . f) . i = f . i ( ((findmin n) . f) . i = ((f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1))) . i & Argmin ((OuterVx (f,n)),f,n) <= n ) by Def11, Th30; hence ((findmin n) . f) . i = f . i by A1, Th18; ::_thesis: verum end; theorem Th32: :: GRAPHSP:32 for i, n being Element of NAT for f being Element of REAL * st i in dom f & f . i = - 1 & i <> ((n * n) + (3 * n)) + 1 holds ((findmin n) . f) . i = - 1 proof let i, n be Element of NAT ; ::_thesis: for f being Element of REAL * st i in dom f & f . i = - 1 & i <> ((n * n) + (3 * n)) + 1 holds ((findmin n) . f) . i = - 1 let f be Element of REAL * ; ::_thesis: ( i in dom f & f . i = - 1 & i <> ((n * n) + (3 * n)) + 1 implies ((findmin n) . f) . i = - 1 ) set k = Argmin ((OuterVx (f,n)),f,n); set mi = ((n * n) + (3 * n)) + 1; assume that A1: i in dom f and A2: ( f . i = - 1 & i <> ((n * n) + (3 * n)) + 1 ) ; ::_thesis: ((findmin n) . f) . i = - 1 A3: ((findmin n) . f) . i = ((f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1))) . i by Def11; percases ( i = Argmin ((OuterVx (f,n)),f,n) or i <> Argmin ((OuterVx (f,n)),f,n) ) ; suppose i = Argmin ((OuterVx (f,n)),f,n) ; ::_thesis: ((findmin n) . f) . i = - 1 hence ((findmin n) . f) . i = - 1 by A1, A3, Th19; ::_thesis: verum end; suppose i <> Argmin ((OuterVx (f,n)),f,n) ; ::_thesis: ((findmin n) . f) . i = - 1 hence ((findmin n) . f) . i = - 1 by A2, A3, Th18; ::_thesis: verum end; end; end; theorem Th33: :: GRAPHSP:33 for n being Element of NAT for f being Element of REAL * holds dom ((findmin n) . f) = dom f proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * holds dom ((findmin n) . f) = dom f let f be Element of REAL * ; ::_thesis: dom ((findmin n) . f) = dom f (findmin n) . f = (f,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (f,n)),f,n)),(- 1)) by Def11; hence dom ((findmin n) . f) = dom f by Th20; ::_thesis: verum end; Lm6: for k, n being Element of NAT st k >= 1 holds n <= k * n proof let k, n be Element of NAT ; ::_thesis: ( k >= 1 implies n <= k * n ) assume k >= 1 ; ::_thesis: n <= k * n then 1 * n <= k * n by NAT_1:4; hence n <= k * n ; ::_thesis: verum end; Lm7: for n being Element of NAT holds ( 3 * n < ((n * n) + (3 * n)) + 1 & n < ((n * n) + (3 * n)) + 1 & 2 * n < ((n * n) + (3 * n)) + 1 ) proof let n be Element of NAT ; ::_thesis: ( 3 * n < ((n * n) + (3 * n)) + 1 & n < ((n * n) + (3 * n)) + 1 & 2 * n < ((n * n) + (3 * n)) + 1 ) 3 * n <= (n * n) + (3 * n) by NAT_1:12; hence A1: 3 * n < ((n * n) + (3 * n)) + 1 by NAT_1:13; ::_thesis: ( n < ((n * n) + (3 * n)) + 1 & 2 * n < ((n * n) + (3 * n)) + 1 ) n <= 3 * n by Lm6; hence n < ((n * n) + (3 * n)) + 1 by A1, XXREAL_0:2; ::_thesis: 2 * n < ((n * n) + (3 * n)) + 1 2 * n <= 3 * n by NAT_1:4; hence 2 * n < ((n * n) + (3 * n)) + 1 by A1, XXREAL_0:2; ::_thesis: verum end; Lm8: for n, k being Element of NAT holds ( ( n < k & k <= 2 * n implies ( ( not 2 * n < k or not k <= 3 * n ) & not k <= n & not k > 3 * n ) ) & ( ( k <= n or k > 3 * n ) implies ( ( not 2 * n < k or not k <= 3 * n ) & ( not n < k or not k <= 2 * n ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( not n < k or not k <= 2 * n ) & not k <= n & not k > 3 * n ) ) ) proof let n, k be Element of NAT ; ::_thesis: ( ( n < k & k <= 2 * n implies ( ( not 2 * n < k or not k <= 3 * n ) & not k <= n & not k > 3 * n ) ) & ( ( k <= n or k > 3 * n ) implies ( ( not 2 * n < k or not k <= 3 * n ) & ( not n < k or not k <= 2 * n ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( not n < k or not k <= 2 * n ) & not k <= n & not k > 3 * n ) ) ) A1: 2 * n <= 3 * n by NAT_1:4; hence ( n < k & k <= 2 * n implies ( ( not 2 * n < k or not k <= 3 * n ) & not k <= n & not k > 3 * n ) ) by XXREAL_0:2; ::_thesis: ( ( ( k <= n or k > 3 * n ) implies ( ( not 2 * n < k or not k <= 3 * n ) & ( not n < k or not k <= 2 * n ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( not n < k or not k <= 2 * n ) & not k <= n & not k > 3 * n ) ) ) A2: 2 * n = n + n ; hereby ::_thesis: ( 2 * n < k & k <= 3 * n implies ( ( not n < k or not k <= 2 * n ) & not k <= n & not k > 3 * n ) ) assume A3: ( k <= n or k > 3 * n ) ; ::_thesis: ( ( not 2 * n < k or not k <= 3 * n ) & ( not n < k or not k <= 2 * n ) ) percases ( k <= n or k > 3 * n ) by A3; supposeA4: k <= n ; ::_thesis: ( ( not 2 * n < k or not k <= 3 * n ) & ( not n < k or not k <= 2 * n ) ) hence ( not 2 * n < k or not k <= 3 * n ) by A2, NAT_1:12; ::_thesis: ( not n < k or not k <= 2 * n ) thus ( not n < k or not k <= 2 * n ) by A4; ::_thesis: verum end; supposeA5: k > 3 * n ; ::_thesis: ( ( not 2 * n < k or not k <= 3 * n ) & ( not n < k or not k <= 2 * n ) ) hence ( not 2 * n < k or not k <= 3 * n ) ; ::_thesis: ( not n < k or not k <= 2 * n ) thus ( not n < k or not k <= 2 * n ) by A1, A5, XXREAL_0:2; ::_thesis: verum end; end; end; assume that A6: 2 * n < k and A7: k <= 3 * n ; ::_thesis: ( ( not n < k or not k <= 2 * n ) & not k <= n & not k > 3 * n ) thus ( not n < k or not k <= 2 * n ) by A6; ::_thesis: ( not k <= n & not k > 3 * n ) thus ( not k <= n & not k > 3 * n ) by A2, A6, A7, NAT_1:12; ::_thesis: verum end; theorem Th34: :: GRAPHSP:34 for n being Element of NAT for f being Element of REAL * st OuterVx (f,n) <> {} holds ex j being Element of NAT st ( j in OuterVx (f,n) & 1 <= j & j <= n & ((findmin n) . f) . j = - 1 ) proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * st OuterVx (f,n) <> {} holds ex j being Element of NAT st ( j in OuterVx (f,n) & 1 <= j & j <= n & ((findmin n) . f) . j = - 1 ) let f be Element of REAL * ; ::_thesis: ( OuterVx (f,n) <> {} implies ex j being Element of NAT st ( j in OuterVx (f,n) & 1 <= j & j <= n & ((findmin n) . f) . j = - 1 ) ) set IX = OuterVx (f,n); assume OuterVx (f,n) <> {} ; ::_thesis: ex j being Element of NAT st ( j in OuterVx (f,n) & 1 <= j & j <= n & ((findmin n) . f) . j = - 1 ) then consider i being Element of NAT such that A1: i = Argmin ((OuterVx (f,n)),f,n) and A2: i in OuterVx (f,n) and for k being Element of NAT st k in OuterVx (f,n) holds f /. ((2 * n) + i) <= f /. ((2 * n) + k) and for k being Element of NAT st k in OuterVx (f,n) & f /. ((2 * n) + i) = f /. ((2 * n) + k) holds i <= k by Def10; take i ; ::_thesis: ( i in OuterVx (f,n) & 1 <= i & i <= n & ((findmin n) . f) . i = - 1 ) thus i in OuterVx (f,n) by A2; ::_thesis: ( 1 <= i & i <= n & ((findmin n) . f) . i = - 1 ) A3: ex k being Element of NAT st ( i = k & k in dom f & 1 <= k & k <= n & f . k <> - 1 & f . (n + k) <> - 1 ) by A2; hence ( 1 <= i & i <= n ) ; ::_thesis: ((findmin n) . f) . i = - 1 thus ((findmin n) . f) . i = ((f,(((n * n) + (3 * n)) + 1)) := (i,(- 1))) . i by A1, Def11 .= - 1 by A3, Th19 ; ::_thesis: verum end; definition let f be Element of REAL * ; let n, k be Element of NAT ; func newpathcost (f,n,k) -> Real equals :: GRAPHSP:def 12 (f /. ((2 * n) + (f /. (((n * n) + (3 * n)) + 1)))) + (f /. (((2 * n) + (n * (f /. (((n * n) + (3 * n)) + 1)))) + k)); correctness coherence (f /. ((2 * n) + (f /. (((n * n) + (3 * n)) + 1)))) + (f /. (((2 * n) + (n * (f /. (((n * n) + (3 * n)) + 1)))) + k)) is Real; ; end; :: deftheorem defines newpathcost GRAPHSP:def_12_:_ for f being Element of REAL * for n, k being Element of NAT holds newpathcost (f,n,k) = (f /. ((2 * n) + (f /. (((n * n) + (3 * n)) + 1)))) + (f /. (((2 * n) + (n * (f /. (((n * n) + (3 * n)) + 1)))) + k)); definition let n, k be Element of NAT ; let f be Element of REAL * ; predf hasBetterPathAt n,k means :Def13: :: GRAPHSP:def 13 ( ( f . (n + k) = - 1 or f /. ((2 * n) + k) > newpathcost (f,n,k) ) & f /. (((2 * n) + (n * (f /. (((n * n) + (3 * n)) + 1)))) + k) >= 0 & f . k <> - 1 ); end; :: deftheorem Def13 defines hasBetterPathAt GRAPHSP:def_13_:_ for n, k being Element of NAT for f being Element of REAL * holds ( f hasBetterPathAt n,k iff ( ( f . (n + k) = - 1 or f /. ((2 * n) + k) > newpathcost (f,n,k) ) & f /. (((2 * n) + (n * (f /. (((n * n) + (3 * n)) + 1)))) + k) >= 0 & f . k <> - 1 ) ); definition let f be Element of REAL * ; let n be Element of NAT ; func Relax (f,n) -> Element of REAL * means :Def14: :: GRAPHSP:def 14 ( dom it = dom f & ( for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies it . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies it . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies it . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies it . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies it . k = f . k ) ) ) ); existence ex b1 being Element of REAL * st ( dom b1 = dom f & ( for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies b1 . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies b1 . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies b1 . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies b1 . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies b1 . k = f . k ) ) ) ) proof defpred S1[ Element of NAT ] means f hasBetterPathAt n,$1 -' (2 * n); defpred S2[ Element of NAT ] means f hasBetterPathAt n,$1 -' n; set X = dom f; defpred S3[ set , set ] means for k being Element of NAT st $1 = k & k in dom f holds ( ( n < k & k <= 2 * n implies ( ( S2[k] implies $2 = f /. (((n * n) + (3 * n)) + 1) ) & ( not S2[k] implies $2 = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( S1[k] implies $2 = newpathcost (f,n,(k -' (2 * n))) ) & ( not S1[k] implies $2 = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies $2 = f . k ) ); A1: now__::_thesis:_for_xx_being_set_st_xx_in_dom_f_holds_ ex_y1_being_set_st_S3[xx,y1] let xx be set ; ::_thesis: ( xx in dom f implies ex y1 being set st S3[y1,b2] ) assume xx in dom f ; ::_thesis: ex y1 being set st S3[y1,b2] then reconsider k = xx as Element of NAT ; percases ( ( n < k & k <= 2 * n ) or ( 2 * n < k & k <= 3 * n ) or k <= n or k > 3 * n ) ; supposeA2: ( n < k & k <= 2 * n ) ; ::_thesis: ex y1 being set st S3[y1,b2] thus ex y1 being set st S3[xx,y1] ::_thesis: verum proof percases ( S2[k] or not S2[k] ) ; supposeA3: S2[k] ; ::_thesis: ex y1 being set st S3[xx,y1] take y1 = f /. (((n * n) + (3 * n)) + 1); ::_thesis: S3[xx,y1] thus S3[xx,y1] by A2, A3, Lm8; ::_thesis: verum end; supposeA4: not S2[k] ; ::_thesis: ex y1 being set st S3[xx,y1] take y1 = f . k; ::_thesis: S3[xx,y1] thus S3[xx,y1] by A2, A4; ::_thesis: verum end; end; end; end; supposeA5: ( 2 * n < k & k <= 3 * n ) ; ::_thesis: ex y1 being set st S3[y1,b2] thus ex y1 being set st S3[xx,y1] ::_thesis: verum proof percases ( S1[k] or not S1[k] ) ; supposeA6: S1[k] ; ::_thesis: ex y1 being set st S3[xx,y1] take y1 = newpathcost (f,n,(k -' (2 * n))); ::_thesis: S3[xx,y1] thus S3[xx,y1] by A5, A6, Lm8; ::_thesis: verum end; supposeA7: not S1[k] ; ::_thesis: ex y1 being set st S3[xx,y1] take y1 = f . k; ::_thesis: S3[xx,y1] thus S3[xx,y1] by A5, A7; ::_thesis: verum end; end; end; end; supposeA8: ( k <= n or k > 3 * n ) ; ::_thesis: ex y1 being set st S3[y1,b2] thus ex y1 being set st S3[xx,y1] ::_thesis: verum proof take y1 = f . k; ::_thesis: S3[xx,y1] thus S3[xx,y1] by A8, Lm8; ::_thesis: verum end; end; end; end; consider F being Function such that A9: ( dom F = dom f & ( for x being set st x in dom f holds S3[x,F . x] ) ) from CLASSES1:sch_1(A1); A10: rng F c= REAL proof let y1 be set ; :: according to TARSKI:def_3 ::_thesis: ( not y1 in rng F or y1 in REAL ) assume y1 in rng F ; ::_thesis: y1 in REAL then consider xx being set such that A11: xx in dom F and A12: y1 = F . xx by FUNCT_1:def_3; reconsider k = xx as Element of NAT by A9, A11; percases ( ( n < k & k <= 2 * n ) or ( 2 * n < k & k <= 3 * n ) or k <= n or k > 3 * n ) ; supposeA13: ( n < k & k <= 2 * n ) ; ::_thesis: y1 in REAL hereby ::_thesis: verum percases ( S2[k] or not S2[k] ) ; suppose S2[k] ; ::_thesis: y1 in REAL then y1 = f /. (((n * n) + (3 * n)) + 1) by A9, A11, A12, A13; hence y1 in REAL ; ::_thesis: verum end; suppose not S2[k] ; ::_thesis: y1 in REAL then y1 = f . k by A9, A11, A12, A13 .= f /. k by A9, A11, PARTFUN1:def_6 ; hence y1 in REAL ; ::_thesis: verum end; end; end; end; supposeA14: ( 2 * n < k & k <= 3 * n ) ; ::_thesis: y1 in REAL hereby ::_thesis: verum percases ( S1[k] or not S1[k] ) ; suppose S1[k] ; ::_thesis: y1 in REAL then y1 = newpathcost (f,n,(k -' (2 * n))) by A9, A11, A12, A14; hence y1 in REAL ; ::_thesis: verum end; suppose not S1[k] ; ::_thesis: y1 in REAL then y1 = f . k by A9, A11, A12, A14 .= f /. k by A9, A11, PARTFUN1:def_6 ; hence y1 in REAL ; ::_thesis: verum end; end; end; end; suppose ( k <= n or k > 3 * n ) ; ::_thesis: y1 in REAL then y1 = f . k by A9, A11, A12 .= f /. k by A9, A11, PARTFUN1:def_6 ; hence y1 in REAL ; ::_thesis: verum end; end; end; dom f = Seg (len f) by FINSEQ_1:def_3; then F is FinSequence by A9, FINSEQ_1:def_2; then F is FinSequence of REAL by A10, FINSEQ_1:def_4; then reconsider F = F as Element of REAL * by FINSEQ_1:def_11; take F ; ::_thesis: ( dom F = dom f & ( for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F . k = f . k ) ) ) ) thus dom F = dom f by A9; ::_thesis: for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F . k = f . k ) ) let k be Element of NAT ; ::_thesis: ( k in dom f implies ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F . k = f . k ) ) ) assume k in dom f ; ::_thesis: ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F . k = f . k ) ) hence ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F . k = f . k ) ) by A9; ::_thesis: verum end; uniqueness for b1, b2 being Element of REAL * st dom b1 = dom f & ( for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies b1 . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies b1 . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies b1 . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies b1 . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies b1 . k = f . k ) ) ) & dom b2 = dom f & ( for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies b2 . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies b2 . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies b2 . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies b2 . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies b2 . k = f . k ) ) ) holds b1 = b2 proof let F1, F2 be Element of REAL * ; ::_thesis: ( dom F1 = dom f & ( for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F1 . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F1 . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F1 . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F1 . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F1 . k = f . k ) ) ) & dom F2 = dom f & ( for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F2 . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F2 . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F2 . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F2 . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F2 . k = f . k ) ) ) implies F1 = F2 ) assume that A15: dom F1 = dom f and A16: for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F1 . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F1 . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F1 . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F1 . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F1 . k = f . k ) ) and A17: dom F2 = dom f and A18: for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies F2 . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies F2 . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies F2 . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies F2 . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies F2 . k = f . k ) ) ; ::_thesis: F1 = F2 now__::_thesis:_for_xx_being_set_st_xx_in_dom_F1_holds_ F1_._xx_=_F2_._xx let xx be set ; ::_thesis: ( xx in dom F1 implies F1 . b1 = F2 . b1 ) assume A19: xx in dom F1 ; ::_thesis: F1 . b1 = F2 . b1 then reconsider k = xx as Element of NAT ; defpred S1[] means f hasBetterPathAt n,k -' (2 * n); defpred S2[] means f hasBetterPathAt n,k -' n; percases ( ( n < k & k <= 2 * n ) or ( 2 * n < k & k <= 3 * n ) or k <= n or k > 3 * n ) ; supposeA20: ( n < k & k <= 2 * n ) ; ::_thesis: F1 . b1 = F2 . b1 hereby ::_thesis: verum percases ( S2[] or not S2[] ) ; supposeA21: S2[] ; ::_thesis: F1 . xx = F2 . xx hence F1 . xx = f /. (((n * n) + (3 * n)) + 1) by A15, A16, A19, A20 .= F2 . xx by A15, A18, A19, A20, A21 ; ::_thesis: verum end; supposeA22: not S2[] ; ::_thesis: F1 . xx = F2 . xx hence F1 . xx = f . k by A15, A16, A19, A20 .= F2 . xx by A15, A18, A19, A20, A22 ; ::_thesis: verum end; end; end; end; supposeA23: ( 2 * n < k & k <= 3 * n ) ; ::_thesis: F1 . b1 = F2 . b1 hereby ::_thesis: verum percases ( S1[] or not S1[] ) ; supposeA24: S1[] ; ::_thesis: F1 . xx = F2 . xx hence F1 . xx = newpathcost (f,n,(k -' (2 * n))) by A15, A16, A19, A23 .= F2 . xx by A15, A18, A19, A23, A24 ; ::_thesis: verum end; supposeA25: not S1[] ; ::_thesis: F1 . xx = F2 . xx hence F1 . xx = f . k by A15, A16, A19, A23 .= F2 . xx by A15, A18, A19, A23, A25 ; ::_thesis: verum end; end; end; end; supposeA26: ( k <= n or k > 3 * n ) ; ::_thesis: F1 . b1 = F2 . b1 hence F1 . xx = f . k by A15, A16, A19 .= F2 . xx by A15, A18, A19, A26 ; ::_thesis: verum end; end; end; hence F1 = F2 by A15, A17, FUNCT_1:2; ::_thesis: verum end; end; :: deftheorem Def14 defines Relax GRAPHSP:def_14_:_ for f being Element of REAL * for n being Element of NAT for b3 being Element of REAL * holds ( b3 = Relax (f,n) iff ( dom b3 = dom f & ( for k being Element of NAT st k in dom f holds ( ( n < k & k <= 2 * n implies ( ( f hasBetterPathAt n,k -' n implies b3 . k = f /. (((n * n) + (3 * n)) + 1) ) & ( not f hasBetterPathAt n,k -' n implies b3 . k = f . k ) ) ) & ( 2 * n < k & k <= 3 * n implies ( ( f hasBetterPathAt n,k -' (2 * n) implies b3 . k = newpathcost (f,n,(k -' (2 * n))) ) & ( not f hasBetterPathAt n,k -' (2 * n) implies b3 . k = f . k ) ) ) & ( ( k <= n or k > 3 * n ) implies b3 . k = f . k ) ) ) ) ); definition let n be Element of NAT ; func Relax n -> Element of Funcs ((REAL *),(REAL *)) means :Def15: :: GRAPHSP:def 15 ( dom it = REAL * & ( for f being Element of REAL * holds it . f = Relax (f,n) ) ); existence ex b1 being Element of Funcs ((REAL *),(REAL *)) st ( dom b1 = REAL * & ( for f being Element of REAL * holds b1 . f = Relax (f,n) ) ) proof defpred S1[ set , set ] means for f being Element of REAL * st $1 = f holds $2 = Relax (f,n); set X = REAL * ; A1: now__::_thesis:_for_xx_being_set_st_xx_in_REAL_*_holds_ ex_y1_being_set_st_S1[xx,y1] let xx be set ; ::_thesis: ( xx in REAL * implies ex y1 being set st S1[xx,y1] ) assume xx in REAL * ; ::_thesis: ex y1 being set st S1[xx,y1] then reconsider h = xx as Element of REAL * ; thus ex y1 being set st S1[xx,y1] ::_thesis: verum proof take y1 = Relax (h,n); ::_thesis: S1[xx,y1] thus S1[xx,y1] ; ::_thesis: verum end; end; consider F being Function such that A2: ( dom F = REAL * & ( for x being set st x in REAL * holds S1[x,F . x] ) ) from CLASSES1:sch_1(A1); now__::_thesis:_for_y1_being_set_st_y1_in_rng_F_holds_ y1_in_REAL_* let y1 be set ; ::_thesis: ( y1 in rng F implies y1 in REAL * ) assume y1 in rng F ; ::_thesis: y1 in REAL * then consider xx being set such that A3: xx in dom F and A4: y1 = F . xx by FUNCT_1:def_3; reconsider h = xx as Element of REAL * by A2, A3; y1 = Relax (h,n) by A2, A4; hence y1 in REAL * ; ::_thesis: verum end; then rng F c= REAL * by TARSKI:def_3; then reconsider F = F as Element of Funcs ((REAL *),(REAL *)) by A2, FUNCT_2:def_2; take F ; ::_thesis: ( dom F = REAL * & ( for f being Element of REAL * holds F . f = Relax (f,n) ) ) thus dom F = REAL * by A2; ::_thesis: for f being Element of REAL * holds F . f = Relax (f,n) let f be Element of REAL * ; ::_thesis: F . f = Relax (f,n) thus F . f = Relax (f,n) by A2; ::_thesis: verum end; uniqueness for b1, b2 being Element of Funcs ((REAL *),(REAL *)) st dom b1 = REAL * & ( for f being Element of REAL * holds b1 . f = Relax (f,n) ) & dom b2 = REAL * & ( for f being Element of REAL * holds b2 . f = Relax (f,n) ) holds b1 = b2 proof set X = REAL * ; let F1, F2 be Element of Funcs ((REAL *),(REAL *)); ::_thesis: ( dom F1 = REAL * & ( for f being Element of REAL * holds F1 . f = Relax (f,n) ) & dom F2 = REAL * & ( for f being Element of REAL * holds F2 . f = Relax (f,n) ) implies F1 = F2 ) assume that A5: dom F1 = REAL * and A6: for f being Element of REAL * holds F1 . f = Relax (f,n) and A7: dom F2 = REAL * and A8: for f being Element of REAL * holds F2 . f = Relax (f,n) ; ::_thesis: F1 = F2 now__::_thesis:_for_xx_being_set_st_xx_in_dom_F1_holds_ F1_._xx_=_F2_._xx let xx be set ; ::_thesis: ( xx in dom F1 implies F1 . xx = F2 . xx ) assume xx in dom F1 ; ::_thesis: F1 . xx = F2 . xx then reconsider h = xx as Element of REAL * by A5; thus F1 . xx = Relax (h,n) by A6 .= F2 . xx by A8 ; ::_thesis: verum end; hence F1 = F2 by A5, A7, FUNCT_1:2; ::_thesis: verum end; end; :: deftheorem Def15 defines Relax GRAPHSP:def_15_:_ for n being Element of NAT for b2 being Element of Funcs ((REAL *),(REAL *)) holds ( b2 = Relax n iff ( dom b2 = REAL * & ( for f being Element of REAL * holds b2 . f = Relax (f,n) ) ) ); theorem Th35: :: GRAPHSP:35 for n being Element of NAT for f being Element of REAL * holds dom ((Relax n) . f) = dom f proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * holds dom ((Relax n) . f) = dom f let f be Element of REAL * ; ::_thesis: dom ((Relax n) . f) = dom f thus dom ((Relax n) . f) = dom (Relax (f,n)) by Def15 .= dom f by Def14 ; ::_thesis: verum end; theorem Th36: :: GRAPHSP:36 for i, n being Element of NAT for f being Element of REAL * st ( i <= n or i > 3 * n ) & i in dom f holds ((Relax n) . f) . i = f . i proof let i, n be Element of NAT ; ::_thesis: for f being Element of REAL * st ( i <= n or i > 3 * n ) & i in dom f holds ((Relax n) . f) . i = f . i let f be Element of REAL * ; ::_thesis: ( ( i <= n or i > 3 * n ) & i in dom f implies ((Relax n) . f) . i = f . i ) assume A1: ( ( i <= n or i > 3 * n ) & i in dom f ) ; ::_thesis: ((Relax n) . f) . i = f . i thus ((Relax n) . f) . i = (Relax (f,n)) . i by Def15 .= f . i by A1, Def14 ; ::_thesis: verum end; theorem Th37: :: GRAPHSP:37 for n, i being Element of NAT for f being Element of REAL * holds dom (((repeat ((Relax n) * (findmin n))) . i) . f) = dom (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) proof let n, i be Element of NAT ; ::_thesis: for f being Element of REAL * holds dom (((repeat ((Relax n) * (findmin n))) . i) . f) = dom (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) let f be Element of REAL * ; ::_thesis: dom (((repeat ((Relax n) * (findmin n))) . i) . f) = dom (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) set R = Relax n; set M = findmin n; set ff = ((repeat ((Relax n) * (findmin n))) . i) . f; thus dom (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) = dom ((Relax n) . ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f))) by Th22 .= dom ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) by Th35 .= dom (((repeat ((Relax n) * (findmin n))) . i) . f) by Th33 ; ::_thesis: verum end; theorem Th38: :: GRAPHSP:38 for n, i being Element of NAT for f being Element of REAL * st OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) <> {} holds UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) c< UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) proof let n, i be Element of NAT ; ::_thesis: for f being Element of REAL * st OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) <> {} holds UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) c< UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) let f be Element of REAL * ; ::_thesis: ( OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) <> {} implies UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) c< UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) ) set R = Relax n; set M = findmin n; set ff = ((repeat ((Relax n) * (findmin n))) . i) . f; set Fi1 = ((repeat ((Relax n) * (findmin n))) . (i + 1)) . f; assume OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) <> {} ; ::_thesis: UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) c< UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) then A1: ex j being Element of NAT st ( j in OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) & 1 <= j & j <= n & ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . j = - 1 ) by Th34; A2: dom (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) = dom (((repeat ((Relax n) * (findmin n))) . i) . f) by Th37 .= dom ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) by Th33 ; A3: now__::_thesis:_for_x_being_set_st_x_in_UnusedVx_((((repeat_((Relax_n)_*_(findmin_n)))_._(i_+_1))_._f),n)_holds_ ((findmin_n)_._(((repeat_((Relax_n)_*_(findmin_n)))_._i)_._f))_._x_<>_-_1 let x be set ; ::_thesis: ( x in UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) implies ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . x <> - 1 ) assume x in UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) ; ::_thesis: ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . x <> - 1 then consider k being Element of NAT such that A4: x = k and A5: k in dom (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) and 1 <= k and A6: k <= n and A7: (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) . k <> - 1 ; (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) . k = ((Relax n) . ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f))) . k by Th22 .= ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . k by A2, A5, A6, Th36 ; hence ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . x <> - 1 by A4, A7; ::_thesis: verum end; A8: UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) c= UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) proof A9: n < ((n * n) + (3 * n)) + 1 by Lm7; let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) or x in UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) ) assume x in UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) ; ::_thesis: x in UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) then consider k being Element of NAT such that A10: x = k and A11: k in dom (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) and A12: 1 <= k and A13: k <= n and A14: (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) . k <> - 1 ; A15: k in dom (((repeat ((Relax n) * (findmin n))) . i) . f) by A11, Th37; (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) . k = ((Relax n) . ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f))) . k by Th22 .= ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . k by A2, A11, A13, Th36 ; then (((repeat ((Relax n) * (findmin n))) . i) . f) . k <> - 1 by A13, A14, A15, A9, Th32; hence x in UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) by A10, A12, A13, A15; ::_thesis: verum end; OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) c= UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) by Th27; then UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) <> UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) by A1, A3; hence UnusedVx ((((repeat ((Relax n) * (findmin n))) . (i + 1)) . f),n) c< UnusedVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) by A8, XBOOLE_0:def_8; ::_thesis: verum end; theorem Th39: :: GRAPHSP:39 for n, i, k being Element of NAT for g, f, h being Element of REAL * st g = ((repeat ((Relax n) * (findmin n))) . i) . f & h = ((repeat ((Relax n) * (findmin n))) . (i + 1)) . f & k = Argmin ((OuterVx (g,n)),g,n) & OuterVx (g,n) <> {} holds ( UsedVx (h,n) = (UsedVx (g,n)) \/ {k} & not k in UsedVx (g,n) ) proof let n, i, k be Element of NAT ; ::_thesis: for g, f, h being Element of REAL * st g = ((repeat ((Relax n) * (findmin n))) . i) . f & h = ((repeat ((Relax n) * (findmin n))) . (i + 1)) . f & k = Argmin ((OuterVx (g,n)),g,n) & OuterVx (g,n) <> {} holds ( UsedVx (h,n) = (UsedVx (g,n)) \/ {k} & not k in UsedVx (g,n) ) let g, f, h be Element of REAL * ; ::_thesis: ( g = ((repeat ((Relax n) * (findmin n))) . i) . f & h = ((repeat ((Relax n) * (findmin n))) . (i + 1)) . f & k = Argmin ((OuterVx (g,n)),g,n) & OuterVx (g,n) <> {} implies ( UsedVx (h,n) = (UsedVx (g,n)) \/ {k} & not k in UsedVx (g,n) ) ) set R = Relax n; set M = findmin n; set ff = ((repeat ((Relax n) * (findmin n))) . i) . f; set Fi1 = ((repeat ((Relax n) * (findmin n))) . (i + 1)) . f; set mi = ((n * n) + (3 * n)) + 1; assume that A1: g = ((repeat ((Relax n) * (findmin n))) . i) . f and A2: h = ((repeat ((Relax n) * (findmin n))) . (i + 1)) . f and A3: k = Argmin ((OuterVx (g,n)),g,n) and A4: OuterVx (g,n) <> {} ; ::_thesis: ( UsedVx (h,n) = (UsedVx (g,n)) \/ {k} & not k in UsedVx (g,n) ) A5: (findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f) = ((((repeat ((Relax n) * (findmin n))) . i) . f),(((n * n) + (3 * n)) + 1)) := (k,(- 1)) by A1, A3, Def11; A6: dom h = dom (((repeat ((Relax n) * (findmin n))) . i) . f) by A2, Th37; A7: dom g = dom ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) by A1, Th33; A8: now__::_thesis:_for_x_being_set_st_x_in_(UsedVx_(g,n))_\/_{k}_holds_ x_in_UsedVx_(h,n) let x be set ; ::_thesis: ( x in (UsedVx (g,n)) \/ {k} implies b1 in UsedVx (h,n) ) assume A9: x in (UsedVx (g,n)) \/ {k} ; ::_thesis: b1 in UsedVx (h,n) percases ( x in UsedVx (g,n) or x in {k} ) by A9, XBOOLE_0:def_3; supposeA10: x in UsedVx (g,n) ; ::_thesis: b1 in UsedVx (h,n) A11: n < ((n * n) + (3 * n)) + 1 by Lm7; consider m being Element of NAT such that A12: x = m and A13: m in dom g and A14: 1 <= m and A15: m <= n and A16: g . m = - 1 by A10; h . m = ((Relax n) . ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f))) . m by A2, Th22 .= ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . m by A7, A13, A15, Th36 .= - 1 by A1, A13, A15, A16, A11, Th32 ; hence x in UsedVx (h,n) by A1, A6, A12, A13, A14, A15; ::_thesis: verum end; suppose x in {k} ; ::_thesis: b1 in UsedVx (h,n) then A17: x = k by TARSKI:def_1; A18: k in dom g by A3, A4, Th29; A19: 1 <= k by A3, A4, Th29; A20: k <= n by A3, A4, Th29; h . k = ((Relax n) . ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f))) . k by A2, Th22 .= ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . k by A7, A18, A20, Th36 .= - 1 by A1, A5, A18, Th19 ; hence x in UsedVx (h,n) by A1, A6, A17, A18, A19, A20; ::_thesis: verum end; end; end; A21: dom h = dom ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) by A6, Th33; now__::_thesis:_for_x_being_set_st_x_in_UsedVx_(h,n)_holds_ x_in_(UsedVx_(g,n))_\/_{k} let x be set ; ::_thesis: ( x in UsedVx (h,n) implies b1 in (UsedVx (g,n)) \/ {k} ) assume x in UsedVx (h,n) ; ::_thesis: b1 in (UsedVx (g,n)) \/ {k} then consider m being Element of NAT such that A22: x = m and A23: m in dom h and A24: 1 <= m and A25: m <= n and A26: h . m = - 1 ; percases ( m = k or m <> k ) ; suppose m = k ; ::_thesis: b1 in (UsedVx (g,n)) \/ {k} then x in {k} by A22, TARSKI:def_1; hence x in (UsedVx (g,n)) \/ {k} by XBOOLE_0:def_3; ::_thesis: verum end; supposeA27: m <> k ; ::_thesis: b1 in (UsedVx (g,n)) \/ {k} A28: n < ((n * n) + (3 * n)) + 1 by Lm7; - 1 = ((Relax n) . ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f))) . m by A2, A26, Th22 .= ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . m by A21, A23, A25, Th36 .= (((repeat ((Relax n) * (findmin n))) . i) . f) . m by A5, A25, A27, A28, Th18 ; then m in { j where j is Element of NAT : ( j in dom (((repeat ((Relax n) * (findmin n))) . i) . f) & 1 <= j & j <= n & (((repeat ((Relax n) * (findmin n))) . i) . f) . j = - 1 ) } by A6, A23, A24, A25; hence x in (UsedVx (g,n)) \/ {k} by A1, A22, XBOOLE_0:def_3; ::_thesis: verum end; end; end; hence UsedVx (h,n) = (UsedVx (g,n)) \/ {k} by A8, TARSKI:1; ::_thesis: not k in UsedVx (g,n) assume k in UsedVx (g,n) ; ::_thesis: contradiction then ex j being Element of NAT st ( j = k & j in dom g & 1 <= j & j <= n & g . j = - 1 ) ; hence contradiction by A3, A4, Th29; ::_thesis: verum end; theorem Th40: :: GRAPHSP:40 for n being Element of NAT for f being Element of REAL * ex i being Element of NAT st ( i <= n & OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) = {} ) proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * ex i being Element of NAT st ( i <= n & OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) = {} ) let f be Element of REAL * ; ::_thesis: ex i being Element of NAT st ( i <= n & OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) = {} ) set R = Relax n; set M = findmin n; defpred S1[ Element of NAT ] means ( $1 <= n implies card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . $1) . f),n)) <= n - $1 ); set nf = ((repeat ((Relax n) * (findmin n))) . n) . f; assume A1: for i being Element of NAT holds ( not i <= n or not OuterVx ((((repeat ((Relax n) * (findmin n))) . i) . f),n) = {} ) ; ::_thesis: contradiction A2: for k being Element of NAT st S1[k] holds S1[k + 1] proof let k be Element of NAT ; ::_thesis: ( S1[k] implies S1[k + 1] ) assume A3: S1[k] ; ::_thesis: S1[k + 1] now__::_thesis:_(_k_+_1_<=_n_implies_card_(UnusedVx_((((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f),n))_<=_n_-_(k_+_1)_) set fk = UnusedVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n); set fk1 = UnusedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n); A4: k <= k + 1 by NAT_1:11; assume A5: k + 1 <= n ; ::_thesis: card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n)) <= n - (k + 1) then OuterVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n) <> {} by A1, A4, XXREAL_0:2; then UnusedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) c< UnusedVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n) by Th38; then card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n)) < n - k by A3, A5, A4, CARD_2:48, XXREAL_0:2; then (card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n))) + 1 <= n - k by INT_1:7; then card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n)) <= (n - k) - 1 by XREAL_1:19; hence card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n)) <= n - (k + 1) ; ::_thesis: verum end; hence S1[k + 1] ; ::_thesis: verum end; A6: S1[ 0 ] proof set f0 = ((repeat ((Relax n) * (findmin n))) . 0) . f; assume 0 <= n ; ::_thesis: card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n)) <= n - 0 card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n)) <= card (Seg n) by Th26, NAT_1:43; hence card (UnusedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n)) <= n - 0 by FINSEQ_1:57; ::_thesis: verum end; for k being Element of NAT holds S1[k] from NAT_1:sch_1(A6, A2); then S1[n] ; then A7: UnusedVx ((((repeat ((Relax n) * (findmin n))) . n) . f),n) = {} ; OuterVx ((((repeat ((Relax n) * (findmin n))) . n) . f),n) c= UnusedVx ((((repeat ((Relax n) * (findmin n))) . n) . f),n) by Th27; hence contradiction by A1, A7, XBOOLE_1:3; ::_thesis: verum end; Lm9: for n, k being Element of NAT holds n - k <= n proof let n, k be Element of NAT ; ::_thesis: n - k <= n n <= n + k by NAT_1:11; hence n - k <= n by XREAL_1:20; ::_thesis: verum end; Lm10: for p, q being FinSequence of NAT for f being Element of REAL * for i, n being Element of NAT st ( for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = f . ((p /. (((len p) - k) + 1)) + n) ) & ( for k being Element of NAT st 1 <= k & k < len q holds q . ((len q) - k) = f . ((q /. (((len q) - k) + 1)) + n) ) & len p <= len q & p . (len p) = q . (len q) holds for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = q . ((len q) - k) proof let p, q be FinSequence of NAT ; ::_thesis: for f being Element of REAL * for i, n being Element of NAT st ( for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = f . ((p /. (((len p) - k) + 1)) + n) ) & ( for k being Element of NAT st 1 <= k & k < len q holds q . ((len q) - k) = f . ((q /. (((len q) - k) + 1)) + n) ) & len p <= len q & p . (len p) = q . (len q) holds for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = q . ((len q) - k) let f be Element of REAL * ; ::_thesis: for i, n being Element of NAT st ( for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = f . ((p /. (((len p) - k) + 1)) + n) ) & ( for k being Element of NAT st 1 <= k & k < len q holds q . ((len q) - k) = f . ((q /. (((len q) - k) + 1)) + n) ) & len p <= len q & p . (len p) = q . (len q) holds for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = q . ((len q) - k) let i, n be Element of NAT ; ::_thesis: ( ( for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = f . ((p /. (((len p) - k) + 1)) + n) ) & ( for k being Element of NAT st 1 <= k & k < len q holds q . ((len q) - k) = f . ((q /. (((len q) - k) + 1)) + n) ) & len p <= len q & p . (len p) = q . (len q) implies for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = q . ((len q) - k) ) assume that A1: for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = f . ((p /. (((len p) - k) + 1)) + n) and A2: for k being Element of NAT st 1 <= k & k < len q holds q . ((len q) - k) = f . ((q /. (((len q) - k) + 1)) + n) and A3: len p <= len q and A4: p . (len p) = q . (len q) ; ::_thesis: for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = q . ((len q) - k) defpred S1[ Element of NAT ] means ( $1 < len p implies p . ((len p) - $1) = q . ((len q) - $1) ); A5: for k being Element of NAT st S1[k] holds S1[k + 1] proof let k be Element of NAT ; ::_thesis: ( S1[k] implies S1[k + 1] ) assume A6: S1[k] ; ::_thesis: S1[k + 1] now__::_thesis:_(_k_+_1_<_len_p_implies_p_._((len_p)_-_(k_+_1))_=_q_._((len_q)_-_(k_+_1))_) A7: ( k <= k + 1 & (len q) - k <= len q ) by Lm9, NAT_1:11; assume A8: k + 1 < len p ; ::_thesis: p . ((len p) - (k + 1)) = q . ((len q) - (k + 1)) then A9: 1 <= (len p) - k by XREAL_1:19; (len p) - k <= (len q) - k by A3, XREAL_1:9; then A10: 1 <= (len q) - k by A9, XXREAL_0:2; A11: k + 1 < len q by A3, A8, XXREAL_0:2; A12: p /. ((len p) - k) = p . ((len p) - k) by A9, Lm9, Th3 .= q /. ((len q) - k) by A6, A8, A7, A10, Th3, XXREAL_0:2 ; thus p . ((len p) - (k + 1)) = f . ((p /. (((len p) - (k + 1)) + 1)) + n) by A1, A8, NAT_1:11 .= f . ((q /. (((len q) - (k + 1)) + 1)) + n) by A12 .= q . ((len q) - (k + 1)) by A2, A11, NAT_1:11 ; ::_thesis: verum end; hence S1[k + 1] ; ::_thesis: verum end; A13: S1[ 0 ] by A4; for k being Element of NAT holds S1[k] from NAT_1:sch_1(A13, A5); hence for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = q . ((len q) - k) ; ::_thesis: verum end; theorem Th41: :: GRAPHSP:41 for n, i being Element of NAT for f being Element of REAL * holds dom f = dom (((repeat ((Relax n) * (findmin n))) . i) . f) proof let n, i be Element of NAT ; ::_thesis: for f being Element of REAL * holds dom f = dom (((repeat ((Relax n) * (findmin n))) . i) . f) let f be Element of REAL * ; ::_thesis: dom f = dom (((repeat ((Relax n) * (findmin n))) . i) . f) set R = Relax n; set M = findmin n; defpred S1[ Element of NAT ] means dom f = dom (((repeat ((Relax n) * (findmin n))) . $1) . f); dom (((repeat ((Relax n) * (findmin n))) . 0) . f) = dom ((id (REAL *)) . f) by Def2 .= dom f by FUNCT_1:18 ; then A1: S1[ 0 ] ; A2: for k being Element of NAT st S1[k] holds S1[k + 1] by Th37; for k being Element of NAT holds S1[k] from NAT_1:sch_1(A1, A2); hence dom f = dom (((repeat ((Relax n) * (findmin n))) . i) . f) ; ::_thesis: verum end; definition let f, g be Element of REAL * ; let m, n be Element of NAT ; predf,g equal_at m,n means :Def16: :: GRAPHSP:def 16 ( dom f = dom g & ( for k being Element of NAT st k in dom f & m <= k & k <= n holds f . k = g . k ) ); end; :: deftheorem Def16 defines equal_at GRAPHSP:def_16_:_ for f, g being Element of REAL * for m, n being Element of NAT holds ( f,g equal_at m,n iff ( dom f = dom g & ( for k being Element of NAT st k in dom f & m <= k & k <= n holds f . k = g . k ) ) ); theorem Th42: :: GRAPHSP:42 for m, n being Element of NAT for f being Element of REAL * holds f,f equal_at m,n proof let m, n be Element of NAT ; ::_thesis: for f being Element of REAL * holds f,f equal_at m,n let f be Element of REAL * ; ::_thesis: f,f equal_at m,n for k being Element of NAT st k in dom f & m <= k & k <= n holds f . k = f . k ; hence f,f equal_at m,n by Def16; ::_thesis: verum end; theorem Th43: :: GRAPHSP:43 for m, n being Element of NAT for f, g, h being Element of REAL * st f,g equal_at m,n & g,h equal_at m,n holds f,h equal_at m,n proof let m, n be Element of NAT ; ::_thesis: for f, g, h being Element of REAL * st f,g equal_at m,n & g,h equal_at m,n holds f,h equal_at m,n let f, g, h be Element of REAL * ; ::_thesis: ( f,g equal_at m,n & g,h equal_at m,n implies f,h equal_at m,n ) assume that A1: f,g equal_at m,n and A2: g,h equal_at m,n ; ::_thesis: f,h equal_at m,n A3: dom f = dom g by A1, Def16; A4: now__::_thesis:_for_k_being_Element_of_NAT_st_k_in_dom_f_&_m_<=_k_&_k_<=_n_holds_ f_._k_=_h_._k let k be Element of NAT ; ::_thesis: ( k in dom f & m <= k & k <= n implies f . k = h . k ) assume A5: ( k in dom f & m <= k & k <= n ) ; ::_thesis: f . k = h . k hence f . k = g . k by A1, Def16 .= h . k by A2, A3, A5, Def16 ; ::_thesis: verum end; dom g = dom h by A2, Def16; hence f,h equal_at m,n by A3, A4, Def16; ::_thesis: verum end; theorem Th44: :: GRAPHSP:44 for n, i being Element of NAT for f being Element of REAL * holds ((repeat ((Relax n) * (findmin n))) . i) . f,((repeat ((Relax n) * (findmin n))) . (i + 1)) . f equal_at (3 * n) + 1,(n * n) + (3 * n) proof let n, i be Element of NAT ; ::_thesis: for f being Element of REAL * holds ((repeat ((Relax n) * (findmin n))) . i) . f,((repeat ((Relax n) * (findmin n))) . (i + 1)) . f equal_at (3 * n) + 1,(n * n) + (3 * n) let f be Element of REAL * ; ::_thesis: ((repeat ((Relax n) * (findmin n))) . i) . f,((repeat ((Relax n) * (findmin n))) . (i + 1)) . f equal_at (3 * n) + 1,(n * n) + (3 * n) set R = Relax n; set M = findmin n; set ff = ((repeat ((Relax n) * (findmin n))) . i) . f; set Fi1 = ((repeat ((Relax n) * (findmin n))) . (i + 1)) . f; A1: now__::_thesis:_for_k_being_Element_of_NAT_st_k_in_dom_(((repeat_((Relax_n)_*_(findmin_n)))_._i)_._f)_&_(3_*_n)_+_1_<=_k_&_k_<=_(n_*_n)_+_(3_*_n)_holds_ (((repeat_((Relax_n)_*_(findmin_n)))_._(i_+_1))_._f)_._k_=_(((repeat_((Relax_n)_*_(findmin_n)))_._i)_._f)_._k let k be Element of NAT ; ::_thesis: ( k in dom (((repeat ((Relax n) * (findmin n))) . i) . f) & (3 * n) + 1 <= k & k <= (n * n) + (3 * n) implies (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) . k = (((repeat ((Relax n) * (findmin n))) . i) . f) . k ) assume that A2: k in dom (((repeat ((Relax n) * (findmin n))) . i) . f) and A3: (3 * n) + 1 <= k and A4: k <= (n * n) + (3 * n) ; ::_thesis: (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) . k = (((repeat ((Relax n) * (findmin n))) . i) . f) . k A5: k > 3 * n by A3, NAT_1:13; A6: k in dom ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) by A2, Th33; A7: k < ((n * n) + (3 * n)) + 1 by A4, NAT_1:13; 3 * n >= n by Lm6; then A8: k > n by A5, XXREAL_0:2; thus (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) . k = ((Relax n) . ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f))) . k by Th22 .= ((findmin n) . (((repeat ((Relax n) * (findmin n))) . i) . f)) . k by A5, A6, Th36 .= (((repeat ((Relax n) * (findmin n))) . i) . f) . k by A7, A8, Th31 ; ::_thesis: verum end; dom (((repeat ((Relax n) * (findmin n))) . (i + 1)) . f) = dom (((repeat ((Relax n) * (findmin n))) . i) . f) by Th37; hence ((repeat ((Relax n) * (findmin n))) . i) . f,((repeat ((Relax n) * (findmin n))) . (i + 1)) . f equal_at (3 * n) + 1,(n * n) + (3 * n) by A1, Def16; ::_thesis: verum end; theorem :: GRAPHSP:45 for F being Element of Funcs ((REAL *),(REAL *)) for f being Element of REAL * for n, i being Element of NAT st i < LifeSpan (F,f,n) holds OuterVx ((((repeat F) . i) . f),n) <> {} by Def4; theorem Th46: :: GRAPHSP:46 for n, i being Element of NAT for f being Element of REAL * holds f,((repeat ((Relax n) * (findmin n))) . i) . f equal_at (3 * n) + 1,(n * n) + (3 * n) proof let n, i be Element of NAT ; ::_thesis: for f being Element of REAL * holds f,((repeat ((Relax n) * (findmin n))) . i) . f equal_at (3 * n) + 1,(n * n) + (3 * n) let f be Element of REAL * ; ::_thesis: f,((repeat ((Relax n) * (findmin n))) . i) . f equal_at (3 * n) + 1,(n * n) + (3 * n) set R = Relax n; set M = findmin n; set m = (3 * n) + 1; set mm = (n * n) + (3 * n); defpred S1[ Element of NAT ] means f,((repeat ((Relax n) * (findmin n))) . $1) . f equal_at (3 * n) + 1,(n * n) + (3 * n); A1: for k being Element of NAT st S1[k] holds S1[k + 1] proof let k be Element of NAT ; ::_thesis: ( S1[k] implies S1[k + 1] ) assume A2: S1[k] ; ::_thesis: S1[k + 1] ((repeat ((Relax n) * (findmin n))) . k) . f,((repeat ((Relax n) * (findmin n))) . (k + 1)) . f equal_at (3 * n) + 1,(n * n) + (3 * n) by Th44; hence S1[k + 1] by A2, Th43; ::_thesis: verum end; ((repeat ((Relax n) * (findmin n))) . 0) . f = f by Th21; then A3: S1[ 0 ] by Th42; for k being Element of NAT holds S1[k] from NAT_1:sch_1(A3, A1); hence f,((repeat ((Relax n) * (findmin n))) . i) . f equal_at (3 * n) + 1,(n * n) + (3 * n) ; ::_thesis: verum end; theorem Th47: :: GRAPHSP:47 for n being Element of NAT for f being Element of REAL * st 1 <= n & 1 in dom f & f . (n + 1) <> - 1 & ( for i being Element of NAT st 1 <= i & i <= n holds f . i = 1 ) & ( for i being Element of NAT st 2 <= i & i <= n holds f . (n + i) = - 1 ) holds ( 1 = Argmin ((OuterVx (f,n)),f,n) & UsedVx (f,n) = {} & {1} = UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) ) proof let n be Element of NAT ; ::_thesis: for f being Element of REAL * st 1 <= n & 1 in dom f & f . (n + 1) <> - 1 & ( for i being Element of NAT st 1 <= i & i <= n holds f . i = 1 ) & ( for i being Element of NAT st 2 <= i & i <= n holds f . (n + i) = - 1 ) holds ( 1 = Argmin ((OuterVx (f,n)),f,n) & UsedVx (f,n) = {} & {1} = UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) ) let f be Element of REAL * ; ::_thesis: ( 1 <= n & 1 in dom f & f . (n + 1) <> - 1 & ( for i being Element of NAT st 1 <= i & i <= n holds f . i = 1 ) & ( for i being Element of NAT st 2 <= i & i <= n holds f . (n + i) = - 1 ) implies ( 1 = Argmin ((OuterVx (f,n)),f,n) & UsedVx (f,n) = {} & {1} = UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) ) ) set R = Relax n; set M = findmin n; set f0 = ((repeat ((Relax n) * (findmin n))) . 0) . f; set RT = repeat ((Relax n) * (findmin n)); assume that A1: 1 <= n and A2: ( 1 in dom f & f . (n + 1) <> - 1 ) and A3: for i being Element of NAT st 1 <= i & i <= n holds f . i = 1 and A4: for i being Element of NAT st 2 <= i & i <= n holds f . (n + i) = - 1 ; ::_thesis: ( 1 = Argmin ((OuterVx (f,n)),f,n) & UsedVx (f,n) = {} & {1} = UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) ) set k = Argmin ((OuterVx (f,n)),f,n); f . 1 = 1 by A1, A3; then A5: 1 in { j where j is Element of NAT : ( j in dom f & 1 <= j & j <= n & f . j <> - 1 & f . (n + j) <> - 1 ) } by A1, A2; thus A6: Argmin ((OuterVx (f,n)),f,n) = 1 ::_thesis: ( UsedVx (f,n) = {} & {1} = UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) ) proof assume A7: Argmin ((OuterVx (f,n)),f,n) <> 1 ; ::_thesis: contradiction 1 <= Argmin ((OuterVx (f,n)),f,n) by A5, Th29; then 1 < Argmin ((OuterVx (f,n)),f,n) by A7, XXREAL_0:1; then A8: 1 + 1 <= Argmin ((OuterVx (f,n)),f,n) by INT_1:7; ( Argmin ((OuterVx (f,n)),f,n) <= n & f . (n + (Argmin ((OuterVx (f,n)),f,n))) <> - 1 ) by A5, Th29; hence contradiction by A4, A8; ::_thesis: verum end; thus A9: UsedVx (f,n) = {} ::_thesis: {1} = UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) proof assume UsedVx (f,n) <> {} ; ::_thesis: contradiction then consider x being set such that A10: x in UsedVx (f,n) by XBOOLE_0:def_1; ex j being Element of NAT st ( x = j & j in dom f & 1 <= j & j <= n & f . j = - 1 ) by A10; hence contradiction by A3; ::_thesis: verum end; OuterVx (f,n) <> {} by A5; then A11: OuterVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) <> {} by Th21; A12: Argmin ((OuterVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n)),(((repeat ((Relax n) * (findmin n))) . 0) . f),n) = Argmin ((OuterVx (f,n)),(((repeat ((Relax n) * (findmin n))) . 0) . f),n) by Th21 .= 1 by A6, Th21 ; thus UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) = UsedVx ((((repeat ((Relax n) * (findmin n))) . (0 + 1)) . f),n) .= (UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n)) \/ {1} by A11, A12, Th39 .= (UsedVx (f,n)) \/ {1} by Th21 .= {1} by A9 ; ::_thesis: verum end; theorem Th48: :: GRAPHSP:48 for n, i, m being Element of NAT for g, f, h being Element of REAL * st g = ((repeat ((Relax n) * (findmin n))) . 1) . f & h = ((repeat ((Relax n) * (findmin n))) . i) . f & 1 <= i & i <= LifeSpan (((Relax n) * (findmin n)),f,n) & m in UsedVx (g,n) holds m in UsedVx (h,n) proof let n, i, m be Element of NAT ; ::_thesis: for g, f, h being Element of REAL * st g = ((repeat ((Relax n) * (findmin n))) . 1) . f & h = ((repeat ((Relax n) * (findmin n))) . i) . f & 1 <= i & i <= LifeSpan (((Relax n) * (findmin n)),f,n) & m in UsedVx (g,n) holds m in UsedVx (h,n) let g, f, h be Element of REAL * ; ::_thesis: ( g = ((repeat ((Relax n) * (findmin n))) . 1) . f & h = ((repeat ((Relax n) * (findmin n))) . i) . f & 1 <= i & i <= LifeSpan (((Relax n) * (findmin n)),f,n) & m in UsedVx (g,n) implies m in UsedVx (h,n) ) set RF = (Relax n) * (findmin n); set RT = repeat ((Relax n) * (findmin n)); set cn = LifeSpan (((Relax n) * (findmin n)),f,n); assume that A1: g = ((repeat ((Relax n) * (findmin n))) . 1) . f and A2: ( h = ((repeat ((Relax n) * (findmin n))) . i) . f & 1 <= i & i <= LifeSpan (((Relax n) * (findmin n)),f,n) ) and A3: m in UsedVx (g,n) ; ::_thesis: m in UsedVx (h,n) defpred S1[ Element of NAT ] means ( 1 <= $1 & $1 <= LifeSpan (((Relax n) * (findmin n)),f,n) implies m in UsedVx ((((repeat ((Relax n) * (findmin n))) . $1) . f),n) ); A4: for k being Element of NAT st S1[k] holds S1[k + 1] proof let k be Element of NAT ; ::_thesis: ( S1[k] implies S1[k + 1] ) assume A5: S1[k] ; ::_thesis: S1[k + 1] hereby ::_thesis: verum assume that 1 <= k + 1 and A6: k + 1 <= LifeSpan (((Relax n) * (findmin n)),f,n) ; ::_thesis: m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) percases ( k = 0 or k <> 0 ) ; suppose k = 0 ; ::_thesis: m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) hence m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) by A1, A3; ::_thesis: verum end; supposeA7: k <> 0 ; ::_thesis: m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) k < LifeSpan (((Relax n) * (findmin n)),f,n) by A6, NAT_1:13; then OuterVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n) <> {} by Def4; then UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) = (UsedVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n)) \/ {(Argmin ((OuterVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n)),(((repeat ((Relax n) * (findmin n))) . k) . f),n))} by Th39; then A8: UsedVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n) c= UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) by XBOOLE_1:7; k >= 1 + 0 by A7, INT_1:7; hence m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) by A5, A6, A8, NAT_1:13; ::_thesis: verum end; end; end; end; A9: S1[ 0 ] ; for k being Element of NAT holds S1[k] from NAT_1:sch_1(A9, A4); hence m in UsedVx (h,n) by A2; ::_thesis: verum end; definition let p be FinSequence of NAT ; let f be Element of REAL * ; let i, n be Element of NAT ; predp is_vertex_seq_at f,i,n means :Def17: :: GRAPHSP:def 17 ( p . (len p) = i & ( for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = f . (n + (p /. (((len p) - k) + 1))) ) ); end; :: deftheorem Def17 defines is_vertex_seq_at GRAPHSP:def_17_:_ for p being FinSequence of NAT for f being Element of REAL * for i, n being Element of NAT holds ( p is_vertex_seq_at f,i,n iff ( p . (len p) = i & ( for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = f . (n + (p /. (((len p) - k) + 1))) ) ) ); definition let p be FinSequence of NAT ; let f be Element of REAL * ; let i, n be Element of NAT ; predp is_simple_vertex_seq_at f,i,n means :Def18: :: GRAPHSP:def 18 ( p . 1 = 1 & len p > 1 & p is_vertex_seq_at f,i,n & p is one-to-one ); end; :: deftheorem Def18 defines is_simple_vertex_seq_at GRAPHSP:def_18_:_ for p being FinSequence of NAT for f being Element of REAL * for i, n being Element of NAT holds ( p is_simple_vertex_seq_at f,i,n iff ( p . 1 = 1 & len p > 1 & p is_vertex_seq_at f,i,n & p is one-to-one ) ); theorem :: GRAPHSP:49 for p, q being FinSequence of NAT for f being Element of REAL * for i, n being Element of NAT st p is_simple_vertex_seq_at f,i,n & q is_simple_vertex_seq_at f,i,n holds p = q proof let p, q be FinSequence of NAT ; ::_thesis: for f being Element of REAL * for i, n being Element of NAT st p is_simple_vertex_seq_at f,i,n & q is_simple_vertex_seq_at f,i,n holds p = q let f be Element of REAL * ; ::_thesis: for i, n being Element of NAT st p is_simple_vertex_seq_at f,i,n & q is_simple_vertex_seq_at f,i,n holds p = q let i, n be Element of NAT ; ::_thesis: ( p is_simple_vertex_seq_at f,i,n & q is_simple_vertex_seq_at f,i,n implies p = q ) assume that A1: p is_simple_vertex_seq_at f,i,n and A2: q is_simple_vertex_seq_at f,i,n ; ::_thesis: p = q A3: p . 1 = 1 by A1, Def18; A4: q . 1 = 1 by A2, Def18; A5: p is_vertex_seq_at f,i,n by A1, Def18; then A6: ( p . (len p) = i & ( for k being Element of NAT st 1 <= k & k < len p holds p . ((len p) - k) = f . ((p /. (((len p) - k) + 1)) + n) ) ) by Def17; A7: q is_vertex_seq_at f,i,n by A2, Def18; then A8: q . (len q) = i by Def17; A9: for k being Element of NAT st 1 <= k & k < len q holds q . ((len q) - k) = f . ((q /. (((len q) - k) + 1)) + n) by A7, Def17; A10: len p > 1 by A1, Def18; A11: now__::_thesis:_not_len_p_<>_len_q assume A12: len p <> len q ; ::_thesis: contradiction percases ( len p < len q or len p >= len q ) ; supposeA13: len p < len q ; ::_thesis: contradiction A14: (len p) - 1 > 1 - 1 by A10, XREAL_1:14; then reconsider k = (len p) - 1 as Element of NAT by INT_1:3; A15: (len p) - k = 0 + 1 ; then A16: (len q) - k > 1 by A13, XREAL_1:14; then reconsider m = (len q) - k as Element of NAT by INT_1:3; A17: k < len p by XREAL_1:146; k >= 0 + 1 by A14, INT_1:7; then A18: 1 = q . ((len q) - k) by A3, A6, A8, A9, A13, A15, A17, Lm10; ( q is one-to-one & m <= len q ) by A2, Def18, Lm9; hence contradiction by A4, A18, A16, GRAPH_5:6; ::_thesis: verum end; supposeA19: len p >= len q ; ::_thesis: contradiction A20: p is one-to-one by A1, Def18; A21: len p > len q by A12, A19, XXREAL_0:1; hereby ::_thesis: verum percases ( len q <= 1 or len q > 1 ) ; suppose len q <= 1 ; ::_thesis: contradiction hence contradiction by A2, Def18; ::_thesis: verum end; suppose len q > 1 ; ::_thesis: contradiction then A22: (len q) - 1 > 1 - 1 by XREAL_1:14; then reconsider k = (len q) - 1 as Element of NAT by INT_1:3; A23: k < len q by XREAL_1:146; A24: (len q) - k = 0 + 1 ; then A25: (len p) - k > 1 by A21, XREAL_1:14; then reconsider m = (len p) - k as Element of NAT by INT_1:3; k >= 0 + 1 by A22, INT_1:7; then A26: 1 = p . ((len p) - k) by A6, A4, A8, A9, A19, A24, A23, Lm10; m <= len p by Lm9; hence contradiction by A3, A20, A26, A25, GRAPH_5:6; ::_thesis: verum end; end; end; end; end; end; now__::_thesis:_for_k_being_Nat_st_1_<=_k_&_k_<=_len_p_holds_ p_._k_=_q_._k let k be Nat; ::_thesis: ( 1 <= k & k <= len p implies p . b1 = q . b1 ) assume that A27: 1 <= k and A28: k <= len p ; ::_thesis: p . b1 = q . b1 percases ( k = len p or k <> len p ) ; suppose k = len p ; ::_thesis: p . b1 = q . b1 hence p . k = q . k by A5, A8, A11, Def17; ::_thesis: verum end; suppose k <> len p ; ::_thesis: p . b1 = q . b1 then k < len p by A28, XXREAL_0:1; then A29: (len p) - k > k - k by XREAL_1:14; then reconsider m = (len p) - k as Element of NAT by INT_1:3; A30: (len q) - m = 0 + k by A11; (len p) - k <= (len p) - 1 by A27, XREAL_1:13; then A31: m < len p by XREAL_1:146, XXREAL_0:2; m >= 0 + 1 by A29, INT_1:7; hence p . k = q . k by A6, A8, A9, A30, A31, Lm10; ::_thesis: verum end; end; end; hence p = q by A11, FINSEQ_1:14; ::_thesis: verum end; definition let G be Graph; let p be FinSequence of the carrier' of G; let vs be FinSequence; predp is_oriented_edge_seq_of vs means :Def19: :: GRAPHSP:def 19 ( len vs = (len p) + 1 & ( for n being Nat st 1 <= n & n <= len p holds ( the Source of G . (p . n) = vs . n & the Target of G . (p . n) = vs . (n + 1) ) ) ); end; :: deftheorem Def19 defines is_oriented_edge_seq_of GRAPHSP:def_19_:_ for G being Graph for p being FinSequence of the carrier' of G for vs being FinSequence holds ( p is_oriented_edge_seq_of vs iff ( len vs = (len p) + 1 & ( for n being Nat st 1 <= n & n <= len p holds ( the Source of G . (p . n) = vs . n & the Target of G . (p . n) = vs . (n + 1) ) ) ) ); theorem :: GRAPHSP:50 for G being oriented Graph for vs being FinSequence for p, q being oriented Chain of G st p is_oriented_edge_seq_of vs & q is_oriented_edge_seq_of vs holds p = q proof let G be oriented Graph; ::_thesis: for vs being FinSequence for p, q being oriented Chain of G st p is_oriented_edge_seq_of vs & q is_oriented_edge_seq_of vs holds p = q let vs be FinSequence; ::_thesis: for p, q being oriented Chain of G st p is_oriented_edge_seq_of vs & q is_oriented_edge_seq_of vs holds p = q let p, q be oriented Chain of G; ::_thesis: ( p is_oriented_edge_seq_of vs & q is_oriented_edge_seq_of vs implies p = q ) assume that A1: p is_oriented_edge_seq_of vs and A2: q is_oriented_edge_seq_of vs ; ::_thesis: p = q A3: (len p) + 1 = len vs by A1, Def19 .= (len q) + 1 by A2, Def19 ; now__::_thesis:_for_k_being_Nat_st_1_<=_k_&_k_<=_len_p_holds_ p_._k_=_q_._k let k be Nat; ::_thesis: ( 1 <= k & k <= len p implies p . k = q . k ) assume A4: ( 1 <= k & k <= len p ) ; ::_thesis: p . k = q . k then A5: the Target of G . (p . k) = vs . (k + 1) by A1, Def19 .= the Target of G . (q . k) by A2, A3, A4, Def19 ; A6: ( p . k in the carrier' of G & q . k in the carrier' of G ) by A3, A4, Th2; the Source of G . (p . k) = vs . k by A1, A4, Def19 .= the Source of G . (q . k) by A2, A3, A4, Def19 ; hence p . k = q . k by A5, A6, GRAPH_1:def_7; ::_thesis: verum end; hence p = q by A3, FINSEQ_1:14; ::_thesis: verum end; theorem :: GRAPHSP:51 for G being Graph for vs1, vs2 being FinSequence for p being oriented Chain of G st p is_oriented_edge_seq_of vs1 & p is_oriented_edge_seq_of vs2 & len p >= 1 holds vs1 = vs2 proof let G be Graph; ::_thesis: for vs1, vs2 being FinSequence for p being oriented Chain of G st p is_oriented_edge_seq_of vs1 & p is_oriented_edge_seq_of vs2 & len p >= 1 holds vs1 = vs2 let vs1, vs2 be FinSequence; ::_thesis: for p being oriented Chain of G st p is_oriented_edge_seq_of vs1 & p is_oriented_edge_seq_of vs2 & len p >= 1 holds vs1 = vs2 let p be oriented Chain of G; ::_thesis: ( p is_oriented_edge_seq_of vs1 & p is_oriented_edge_seq_of vs2 & len p >= 1 implies vs1 = vs2 ) assume that A1: p is_oriented_edge_seq_of vs1 and A2: p is_oriented_edge_seq_of vs2 and A3: len p >= 1 ; ::_thesis: vs1 = vs2 A4: now__::_thesis:_for_k_being_Nat_st_1_<=_k_&_k_<=_len_vs1_holds_ vs1_._k_=_vs2_._k let k be Nat; ::_thesis: ( 1 <= k & k <= len vs1 implies vs1 . b1 = vs2 . b1 ) assume that A5: 1 <= k and A6: k <= len vs1 ; ::_thesis: vs1 . b1 = vs2 . b1 percases ( k = len vs1 or k <> len vs1 ) ; suppose k = len vs1 ; ::_thesis: vs1 . b1 = vs2 . b1 then A7: k = (len p) + 1 by A1, Def19; hence vs1 . k = the Target of G . (p . (len p)) by A1, A3, Def19 .= vs2 . k by A2, A3, A7, Def19 ; ::_thesis: verum end; suppose k <> len vs1 ; ::_thesis: vs1 . b1 = vs2 . b1 then k < len vs1 by A6, XXREAL_0:1; then k + 1 <= len vs1 by INT_1:7; then k + 1 <= (len p) + 1 by A1, Def19; then A8: k <= len p by XREAL_1:6; hence vs1 . k = the Source of G . (p . k) by A1, A5, Def19 .= vs2 . k by A2, A5, A8, Def19 ; ::_thesis: verum end; end; end; len vs1 = (len p) + 1 by A1, Def19 .= len vs2 by A2, Def19 ; hence vs1 = vs2 by A4, FINSEQ_1:14; ::_thesis: verum end; Lm11: for i, n being Element of NAT st 1 <= i & i <= n holds ( 1 < (2 * n) + i & (2 * n) + i < ((n * n) + (3 * n)) + 1 & i < (2 * n) + i ) proof let i, n be Element of NAT ; ::_thesis: ( 1 <= i & i <= n implies ( 1 < (2 * n) + i & (2 * n) + i < ((n * n) + (3 * n)) + 1 & i < (2 * n) + i ) ) assume that A1: 1 <= i and A2: i <= n ; ::_thesis: ( 1 < (2 * n) + i & (2 * n) + i < ((n * n) + (3 * n)) + 1 & i < (2 * n) + i ) set m2 = (2 * n) + i; (2 * n) + 1 <= (2 * n) + i by A1, XREAL_1:7; then A3: 2 * n < (2 * n) + i by NAT_1:13; 1 <= n by A1, A2, XXREAL_0:2; then 2 * 1 <= 2 * n by XREAL_1:64; then 2 < (2 * n) + i by A3, XXREAL_0:2; hence 1 < (2 * n) + i by XXREAL_0:2; ::_thesis: ( (2 * n) + i < ((n * n) + (3 * n)) + 1 & i < (2 * n) + i ) A4: 3 * n < ((n * n) + (3 * n)) + 1 by Lm7; (2 * n) + n = (2 + 1) * n ; then (2 * n) + i <= 3 * n by A2, XREAL_1:7; hence (2 * n) + i < ((n * n) + (3 * n)) + 1 by A4, XXREAL_0:2; ::_thesis: i < (2 * n) + i n <= 2 * n by Lm6; then i <= 2 * n by A2, XXREAL_0:2; hence i < (2 * n) + i by A3, XXREAL_0:2; ::_thesis: verum end; Lm12: for i, n being Element of NAT st 1 <= i & i <= n holds ( 1 < n + i & n + i <= 2 * n & n + i < ((n * n) + (3 * n)) + 1 ) proof let i, n be Element of NAT ; ::_thesis: ( 1 <= i & i <= n implies ( 1 < n + i & n + i <= 2 * n & n + i < ((n * n) + (3 * n)) + 1 ) ) assume that A1: 1 <= i and A2: i <= n ; ::_thesis: ( 1 < n + i & n + i <= 2 * n & n + i < ((n * n) + (3 * n)) + 1 ) set ni = n + i; 1 <= n by A1, A2, XXREAL_0:2; then 1 + 1 <= n + i by A1, XREAL_1:7; hence 1 < n + i by NAT_1:13; ::_thesis: ( n + i <= 2 * n & n + i < ((n * n) + (3 * n)) + 1 ) A3: n + i <= n + n by A2, XREAL_1:7; hence n + i <= 2 * n ; ::_thesis: n + i < ((n * n) + (3 * n)) + 1 2 * n < ((n * n) + (3 * n)) + 1 by Lm7; hence n + i < ((n * n) + (3 * n)) + 1 by A3, XXREAL_0:2; ::_thesis: verum end; Lm13: for i, n, j being Element of NAT st 1 <= i & i <= n & j <= n holds ( 1 < ((2 * n) + (n * i)) + j & i < ((2 * n) + (n * i)) + j & ((2 * n) + (n * i)) + j < ((n * n) + (3 * n)) + 1 ) proof let i, n, j be Element of NAT ; ::_thesis: ( 1 <= i & i <= n & j <= n implies ( 1 < ((2 * n) + (n * i)) + j & i < ((2 * n) + (n * i)) + j & ((2 * n) + (n * i)) + j < ((n * n) + (3 * n)) + 1 ) ) assume that A1: 1 <= i and A2: i <= n and A3: j <= n ; ::_thesis: ( 1 < ((2 * n) + (n * i)) + j & i < ((2 * n) + (n * i)) + j & ((2 * n) + (n * i)) + j < ((n * n) + (3 * n)) + 1 ) A4: 1 <= n by A1, A2, XXREAL_0:2; then 2 * 1 <= 2 * n by XREAL_1:64; then A5: 1 < 2 * n by XXREAL_0:2; set m3 = ((2 * n) + (n * i)) + j; A6: ( ((2 * n) + (n * i)) + j = ((2 * n) + j) + (n * i) & n * i <= n * n ) by A2, XREAL_1:64; ((2 * n) + (n * i)) + j = (2 * n) + ((n * i) + j) ; then 2 * n <= ((2 * n) + (n * i)) + j by NAT_1:12; hence 1 < ((2 * n) + (n * i)) + j by A5, XXREAL_0:2; ::_thesis: ( i < ((2 * n) + (n * i)) + j & ((2 * n) + (n * i)) + j < ((n * n) + (3 * n)) + 1 ) A7: (2 * n) + (n * i) <= ((2 * n) + (n * i)) + j by NAT_1:12; 1 * i <= n * i by A4, XREAL_1:64; then 1 + i < (2 * n) + (n * i) by A5, XREAL_1:8; then 1 + i < ((2 * n) + (n * i)) + j by A7, XXREAL_0:2; hence i < ((2 * n) + (n * i)) + j by NAT_1:13; ::_thesis: ((2 * n) + (n * i)) + j < ((n * n) + (3 * n)) + 1 (2 * n) + n = (2 + 1) * n ; then (2 * n) + j <= 3 * n by A3, XREAL_1:7; then ((2 * n) + (n * i)) + j <= (n * n) + (3 * n) by A6, XREAL_1:7; hence ((2 * n) + (n * i)) + j < ((n * n) + (3 * n)) + 1 by NAT_1:13; ::_thesis: verum end; Lm14: for i, n, j being Element of NAT st 1 <= i & i <= n & 1 <= j & j <= n holds ( (3 * n) + 1 <= ((2 * n) + (n * i)) + j & ((2 * n) + (n * i)) + j <= (n * n) + (3 * n) ) proof let i, n, j be Element of NAT ; ::_thesis: ( 1 <= i & i <= n & 1 <= j & j <= n implies ( (3 * n) + 1 <= ((2 * n) + (n * i)) + j & ((2 * n) + (n * i)) + j <= (n * n) + (3 * n) ) ) assume that A1: 1 <= i and A2: i <= n and A3: 1 <= j and A4: j <= n ; ::_thesis: ( (3 * n) + 1 <= ((2 * n) + (n * i)) + j & ((2 * n) + (n * i)) + j <= (n * n) + (3 * n) ) set m3 = ((2 * n) + (n * i)) + j; A5: ( ((2 * n) + (n * i)) + j = ((2 * n) + j) + (n * i) & n * i <= n * n ) by A2, XREAL_1:64; n * 1 <= n * i by A1, XREAL_1:64; then (2 * n) + n <= (2 * n) + (n * i) by XREAL_1:7; hence (3 * n) + 1 <= ((2 * n) + (n * i)) + j by A3, XREAL_1:7; ::_thesis: ((2 * n) + (n * i)) + j <= (n * n) + (3 * n) (2 * n) + n = (2 + 1) * n ; then (2 * n) + j <= 3 * n by A4, XREAL_1:7; hence ((2 * n) + (n * i)) + j <= (n * n) + (3 * n) by A5, XREAL_1:7; ::_thesis: verum end; begin definition let f be Element of REAL * ; let G be oriented Graph; let n be Element of NAT ; let W be Function of the carrier' of G,Real>=0; predf is_Input_of_Dijkstra_Alg G,n,W means :Def20: :: GRAPHSP:def 20 ( len f = ((n * n) + (3 * n)) + 1 & Seg n = the carrier of G & ( for i being Element of NAT st 1 <= i & i <= n holds ( f . i = 1 & f . ((2 * n) + i) = 0 ) ) & f . (n + 1) = 0 & ( for i being Element of NAT st 2 <= i & i <= n holds f . (n + i) = - 1 ) & ( for i, j being Vertex of G for k, m being Element of NAT st k = i & m = j holds f . (((2 * n) + (n * k)) + m) = Weight (i,j,W) ) ); end; :: deftheorem Def20 defines is_Input_of_Dijkstra_Alg GRAPHSP:def_20_:_ for f being Element of REAL * for G being oriented Graph for n being Element of NAT for W being Function of the carrier' of G,Real>=0 holds ( f is_Input_of_Dijkstra_Alg G,n,W iff ( len f = ((n * n) + (3 * n)) + 1 & Seg n = the carrier of G & ( for i being Element of NAT st 1 <= i & i <= n holds ( f . i = 1 & f . ((2 * n) + i) = 0 ) ) & f . (n + 1) = 0 & ( for i being Element of NAT st 2 <= i & i <= n holds f . (n + i) = - 1 ) & ( for i, j being Vertex of G for k, m being Element of NAT st k = i & m = j holds f . (((2 * n) + (n * k)) + m) = Weight (i,j,W) ) ) ); begin definition let n be Element of NAT ; func DijkstraAlgorithm n -> Element of Funcs ((REAL *),(REAL *)) equals :: GRAPHSP:def 21 while_do (((Relax n) * (findmin n)),n); coherence while_do (((Relax n) * (findmin n)),n) is Element of Funcs ((REAL *),(REAL *)) ; end; :: deftheorem defines DijkstraAlgorithm GRAPHSP:def_21_:_ for n being Element of NAT holds DijkstraAlgorithm n = while_do (((Relax n) * (findmin n)),n); begin Lm15: for n being Element of NAT for f, h being Element of REAL * for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & h = ((repeat ((Relax n) * (findmin n))) . 1) . f holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) proof let n be Element of NAT ; ::_thesis: for f, h being Element of REAL * for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & h = ((repeat ((Relax n) * (findmin n))) . 1) . f holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let f, h be Element of REAL * ; ::_thesis: for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & h = ((repeat ((Relax n) * (findmin n))) . 1) . f holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let G be oriented finite Graph; ::_thesis: for W being Function of the carrier' of G,Real>=0 for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & h = ((repeat ((Relax n) * (findmin n))) . 1) . f holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let W be Function of the carrier' of G,Real>=0; ::_thesis: for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & h = ((repeat ((Relax n) * (findmin n))) . 1) . f holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let v1 be Vertex of G; ::_thesis: ( f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & h = ((repeat ((Relax n) * (findmin n))) . 1) . f implies ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) ) set R = Relax n; set M = findmin n; set f0 = ((repeat ((Relax n) * (findmin n))) . 0) . f; set mi = ((n * n) + (3 * n)) + 1; assume that A1: f is_Input_of_Dijkstra_Alg G,n,W and A2: v1 = 1 and A3: n >= 1 and A4: h = ((repeat ((Relax n) * (findmin n))) . 1) . f ; ::_thesis: ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) A5: len f = ((n * n) + (3 * n)) + 1 by A1, Def20; set nk = n + 1; A6: (2 * n) + n = (2 + 1) * n ; A7: f . (n + 1) = 0 by A1, Def20; A8: 1 <= ((n * n) + (3 * n)) + 1 by NAT_1:12; then A9: 1 in dom f by A5, FINSEQ_3:25; A10: ( ( for j being Element of NAT st 1 <= j & j <= n holds f . j = 1 ) & ( for j being Element of NAT st 2 <= j & j <= n holds f . (n + j) = - 1 ) ) by A1, Def20; then A11: {1} = UsedVx (h,n) by A3, A4, A7, A9, Th47; h = ((repeat ((Relax n) * (findmin n))) . (0 + 1)) . f by A4; then h = (Relax n) . ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) by Th22; then A12: h = Relax (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)),n) by Def15; A13: Seg n = the carrier of G by A1, Def20; then reconsider VG = the carrier of G as non empty Subset of NAT by A3; set Ak = Argmin ((OuterVx (f,n)),f,n); A14: dom ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) = dom (((repeat ((Relax n) * (findmin n))) . 0) . f) by Th33 .= dom f by Th21 ; A15: 1 = Argmin ((OuterVx (f,n)),f,n) by A3, A7, A10, A9, Th47; A16: (findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f) = (findmin n) . f by Th21 .= (f,(((n * n) + (3 * n)) + 1)) := (1,(- 1)) by A15, Def11 ; then ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . 1 = - 1 by A9, Th19; then not (findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f) hasBetterPathAt n,1 by Def13; then A17: not (findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f) hasBetterPathAt n,(n + 1) -' n by NAT_D:34; A18: n + 1 < ((n * n) + (3 * n)) + 1 by A3, Lm12; A19: W is_weight>=0of G by GRAPH_5:def_13; hereby ::_thesis: ( ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) set w1 = (2 * n) + 1; let v3 be Vertex of G; ::_thesis: for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex pe being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & pe is_oriented_edge_seq_of p & pe is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) let j be Element of NAT ; ::_thesis: ( v3 <> v1 & v3 = j & h . (n + j) <> - 1 implies ex p being FinSequence of NAT ex pe being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & pe is_oriented_edge_seq_of p & pe is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) ) set nj = n + j; assume that A20: v3 <> v1 and A21: v3 = j and A22: h . (n + j) <> - 1 ; ::_thesis: ex p being FinSequence of NAT ex pe being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & pe is_oriented_edge_seq_of p & pe is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) set m2 = (2 * n) + j; A23: j in VG by A21; then A24: 1 <= j by A13, FINSEQ_1:1; then n + 1 <= n + j by XREAL_1:7; then A25: n < n + j by NAT_1:13; A26: j <= n by A13, A23, FINSEQ_1:1; then A27: ( 1 < (2 * n) + j & (2 * n) + j < ((n * n) + (3 * n)) + 1 ) by A24, Lm11; j > 1 by A2, A20, A21, A24, XXREAL_0:1; then j >= 1 + 1 by INT_1:7; then A28: f . (n + j) = - 1 by A1, A26, Def20; A29: n + j <= 2 * n by A24, A26, Lm12; A30: ((n * n) + (3 * n)) + 1 in dom f by A8, A5, FINSEQ_3:25; then A31: ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((n * n) + (3 * n)) + 1) = ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . (((n * n) + (3 * n)) + 1) by A14, PARTFUN1:def_6 .= 1 by A16, A27, A30, Th17 ; A32: ( 1 < (2 * n) + 1 & (2 * n) + 1 < ((n * n) + (3 * n)) + 1 ) by A3, Lm11; then (2 * n) + 1 in dom f by A5, FINSEQ_3:25; then A33: ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. ((2 * n) + (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((n * n) + (3 * n)) + 1))) = ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . ((2 * n) + 1) by A14, A31, PARTFUN1:def_6 .= f . ((2 * n) + 1) by A16, A32, Th18 .= 0 by A1, A3, Def20 ; A34: (2 * n) + j <= 3 * n by A6, A26, XREAL_1:7; A35: ( 1 < n + j & n + j < ((n * n) + (3 * n)) + 1 ) by A24, A26, Lm12; then A36: n + j in dom f by A5, FINSEQ_3:25; ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . (n + j) = f . (n + j) by A16, A35, Th18; then A37: (findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f) hasBetterPathAt n,(n + j) -' n by A14, A12, A22, A29, A36, A25, A28, Def14; (2 * n) + 1 <= (2 * n) + j by A24, XREAL_1:7; then A38: 2 * n < (2 * n) + j by NAT_1:13; set m3 = ((2 * n) + (n * 1)) + j; reconsider p = <*1,j*> as FinSequence of NAT ; A39: p . 1 = 1 by FINSEQ_1:44; A40: ( 1 < ((2 * n) + (n * 1)) + j & ((2 * n) + (n * 1)) + j < ((n * n) + (3 * n)) + 1 ) by A3, A26, Lm13; then ((2 * n) + (n * 1)) + j in dom f by A5, FINSEQ_3:25; then A41: ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((2 * n) + (n * (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((n * n) + (3 * n)) + 1)))) + j) = ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . (((2 * n) + (n * 1)) + j) by A14, A31, PARTFUN1:def_6 .= f . (((2 * n) + (n * 1)) + j) by A16, A40, Th18 .= Weight (v1,v3,W) by A1, A2, A21, Def20 ; A42: (n + j) -' n = j by NAT_D:34; then ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((2 * n) + (n * (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((n * n) + (3 * n)) + 1)))) + j) >= 0 by A37, Def13; then consider e being set such that A43: e in the carrier' of G and A44: e orientedly_joins v1,v3 by A41, Th23; reconsider pe = <*e*> as oriented Chain of G by A43, Th5; A45: len pe = 1 by FINSEQ_1:40; A46: len p = 2 by FINSEQ_1:44; then A47: p . (len p) = j by FINSEQ_1:44; A48: now__::_thesis:_for_k_being_Nat_st_1_<=_k_&_k_<=_len_pe_holds_ (_the_Source_of_G_._(pe_._k)_=_p_._k_&_the_Target_of_G_._(pe_._k)_=_p_._(k_+_1)_) let k be Nat; ::_thesis: ( 1 <= k & k <= len pe implies ( the Source of G . (pe . k) = p . k & the Target of G . (pe . k) = p . (k + 1) ) ) assume ( 1 <= k & k <= len pe ) ; ::_thesis: ( the Source of G . (pe . k) = p . k & the Target of G . (pe . k) = p . (k + 1) ) then A49: k = 1 by A45, XXREAL_0:1; hence the Source of G . (pe . k) = the Source of G . e by FINSEQ_1:40 .= p . k by A2, A44, A39, A49, GRAPH_4:def_1 ; ::_thesis: the Target of G . (pe . k) = p . (k + 1) thus the Target of G . (pe . k) = the Target of G . e by A49, FINSEQ_1:40 .= p . (k + 1) by A21, A44, A46, A47, A49, GRAPH_4:def_1 ; ::_thesis: verum end; A50: h . (n + j) = 1 by A14, A12, A29, A36, A25, A37, A31, Def14; now__::_thesis:_for_k_being_Element_of_NAT_st_1_<=_k_&_k_<_len_p_holds_ p_._((len_p)_-_k)_=_h_._(n_+_(p_/._(((len_p)_-_k)_+_1))) let k be Element of NAT ; ::_thesis: ( 1 <= k & k < len p implies p . ((len p) - k) = h . (n + (p /. (((len p) - k) + 1))) ) assume that A51: 1 <= k and A52: k < len p ; ::_thesis: p . ((len p) - k) = h . (n + (p /. (((len p) - k) + 1))) k < 1 + 1 by A52, FINSEQ_1:44; then k <= 1 by NAT_1:13; then k = 1 by A51, XXREAL_0:1; hence p . ((len p) - k) = h . (n + (p /. (((len p) - k) + 1))) by A50, A39, A46, A47, FINSEQ_4:15; ::_thesis: verum end; then A53: p is_vertex_seq_at h,j,n by A47, Def17; ( ((2 * n) + j) -' (2 * n) = j & (2 * n) + j in dom ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) ) by A5, A14, A27, FINSEQ_3:25, NAT_D:34; then A54: (Relax (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)),n)) . ((2 * n) + j) = newpathcost (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)),n,(((2 * n) + j) -' (2 * n))) by A42, A37, A34, A38, Def14 .= 0 + (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((2 * n) + (n * (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((n * n) + (3 * n)) + 1)))) + j)) by A33, NAT_D:34 ; take p = p; ::_thesis: ex pe being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & pe is_oriented_edge_seq_of p & pe is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) take pe = pe; ::_thesis: ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & pe is_oriented_edge_seq_of p & pe is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) p is one-to-one by A2, A20, A21, FINSEQ_3:94; hence p is_simple_vertex_seq_at h,j,n by A39, A46, A53, Def18; ::_thesis: ( ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & pe is_oriented_edge_seq_of p & pe is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) hereby ::_thesis: ( pe is_oriented_edge_seq_of p & pe is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) let i be Element of NAT ; ::_thesis: ( 1 <= i & i < len p implies p . i in UsedVx (h,n) ) assume that A55: 1 <= i and A56: i < len p ; ::_thesis: p . i in UsedVx (h,n) i + 1 <= 1 + 1 by A46, A56, INT_1:7; then i <= 1 by XREAL_1:6; then i = 1 by A55, XXREAL_0:1; hence p . i in UsedVx (h,n) by A11, A39, TARSKI:def_1; ::_thesis: verum end; len p = (len pe) + 1 by A45, FINSEQ_1:44; hence pe is_oriented_edge_seq_of p by A48, Def19; ::_thesis: ( pe is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) thus pe is_shortestpath_of v1,v3, UsedVx (h,n),W by A2, A11, A43, A44, Th14; ::_thesis: ( cost (pe,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) ) thus cost (pe,W) = W . (pe . 1) by A19, A45, Th4, GRAPH_5:46 .= W . e by FINSEQ_1:40 .= h . ((2 * n) + j) by A12, A41, A54, A43, A44, Th25 ; ::_thesis: ( not v3 in UsedVx (h,n) implies pe islongestInShortestpath UsedVx (h,n),v1,W ) assume not v3 in UsedVx (h,n) ; ::_thesis: pe islongestInShortestpath UsedVx (h,n),v1,W for v2 being Vertex of G st v2 in UsedVx (h,n) & v2 <> v1 holds ex Q being oriented Chain of G st ( Q is_shortestpath_of v1,v2, UsedVx (h,n),W & cost (Q,W) <= cost (pe,W) ) by A2, A11, TARSKI:def_1; hence pe islongestInShortestpath UsedVx (h,n),v1,W by GRAPH_5:def_19; ::_thesis: verum end; A57: 2 * n < ((n * n) + (3 * n)) + 1 by Lm7; A58: 2 * 1 <= 2 * n by A3, XREAL_1:64; 1 < n + 1 by A3, Lm12; then A59: n + 1 in dom f by A5, A18, FINSEQ_3:25; A60: n < n + 1 by NAT_1:13; n + 1 <= 2 * n by A3, Lm12; then A61: h . (n + 1) = ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . (n + 1) by A14, A12, A60, A59, A17, Def14 .= (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + 1) by A18, A60, Th31 .= 0 by A7, Th21 ; A62: n * 1 <= n * n by A3, XREAL_1:64; hereby ::_thesis: for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 A63: n < ((n * n) + (3 * n)) + 1 by Lm7; let m, j be Element of NAT ; ::_thesis: ( h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) implies f . (((2 * n) + (n * m)) + j) = - 1 ) assume that A64: h . (n + j) = - 1 and A65: 1 <= j and A66: j <= n and A67: m in UsedVx (h,n) ; ::_thesis: f . (((2 * n) + (n * m)) + j) = - 1 reconsider v2 = j as Vertex of G by A13, A65, A66, FINSEQ_1:1; A68: 3 * n < ((n * n) + (3 * n)) + 1 by Lm7; set m2 = (2 * n) + j; (2 * n) + j <= 3 * n by A6, A66, XREAL_1:7; then A69: (2 * n) + j < ((n * n) + (3 * n)) + 1 by A68, XXREAL_0:2; (2 * n) + 1 <= (2 * n) + j by A65, XREAL_1:7; then 2 * n < (2 * n) + j by NAT_1:13; then 2 < (2 * n) + j by A58, XXREAL_0:2; then A70: 1 < (2 * n) + j by XXREAL_0:2; j <> 1 by A61, A64; then A71: ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . j = f . j by A16, A66, A63, Th18 .= 1 by A1, A65, A66, Def20 ; A72: ((n * n) + (3 * n)) + 1 in dom f by A8, A5, FINSEQ_3:25; then A73: ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((n * n) + (3 * n)) + 1) = ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . (((n * n) + (3 * n)) + 1) by A14, PARTFUN1:def_6 .= 1 by A16, A69, A70, A72, Th17 ; set nj = n + j; 1 + 1 <= n + j by A3, A65, XREAL_1:7; then A74: 1 < n + j by NAT_1:13; A75: n + j <= n + n by A66, XREAL_1:7; then n + j < ((n * n) + (3 * n)) + 1 by A57, XXREAL_0:2; then A76: n + j in dom f by A5, A74, FINSEQ_3:25; n + 1 <= n + j by A65, XREAL_1:7; then A77: n < n + j by NAT_1:13; A78: n + j <= 2 * n by A75; then A79: not (findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f) hasBetterPathAt n,(n + j) -' n by A14, A12, A64, A76, A77, A73, Def14; then ( (n + j) -' n = j & ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . (n + j) = - 1 ) by A14, A12, A64, A78, A76, A77, Def14, NAT_D:34; then A80: not ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((2 * n) + (n * (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((n * n) + (3 * n)) + 1)))) + j) >= 0 by A79, A71, Def13; set m3 = ((2 * n) + (n * 1)) + j; ((2 * n) + (n * 1)) + j = (2 * n) + ((n * 1) + j) ; then 2 <= ((2 * n) + (n * 1)) + j by A58, NAT_1:12; then A81: 1 < ((2 * n) + (n * 1)) + j by XXREAL_0:2; j <= n * n by A62, A66, XXREAL_0:2; then ((2 * n) + (n * 1)) + j <= (3 * n) + (n * n) by XREAL_1:7; then A82: ((2 * n) + (n * 1)) + j < ((n * n) + (3 * n)) + 1 by NAT_1:13; then ((2 * n) + (n * 1)) + j in dom f by A5, A81, FINSEQ_3:25; then A83: ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((2 * n) + (n * (((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) /. (((n * n) + (3 * n)) + 1)))) + j) = ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . (((2 * n) + (n * 1)) + j) by A14, A73, PARTFUN1:def_6; ((findmin n) . (((repeat ((Relax n) * (findmin n))) . 0) . f)) . (((2 * n) + (n * 1)) + j) = f . (((2 * n) + (n * 1)) + j) by A16, A81, A82, Th18 .= Weight (v1,v2,W) by A1, A2, Def20 ; then for e being set holds ( not e in the carrier' of G or not e orientedly_joins v1,v2 ) by A80, A83, Th23; then A84: Weight (v1,v2,W) = - 1 by Def7; m = 1 by A11, A67, TARSKI:def_1; hence f . (((2 * n) + (n * m)) + j) = - 1 by A1, A2, A84, Def20; ::_thesis: verum end; let m be Element of NAT ; ::_thesis: ( m in UsedVx (h,n) implies h . (n + m) <> - 1 ) assume m in UsedVx (h,n) ; ::_thesis: h . (n + m) <> - 1 then m = 1 by A11, TARSKI:def_1; hence h . (n + m) <> - 1 by A61; ::_thesis: verum end; Lm16: for n, k, i being Element of NAT for g, f, h being Element of REAL * st g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & i in UsedVx (g,n) & len f = ((n * n) + (3 * n)) + 1 holds h . (n + i) = g . (n + i) proof let n, k, i be Element of NAT ; ::_thesis: for g, f, h being Element of REAL * st g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & i in UsedVx (g,n) & len f = ((n * n) + (3 * n)) + 1 holds h . (n + i) = g . (n + i) let g, f, h be Element of REAL * ; ::_thesis: ( g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & i in UsedVx (g,n) & len f = ((n * n) + (3 * n)) + 1 implies h . (n + i) = g . (n + i) ) set R = Relax n; set M = findmin n; set RF = repeat ((Relax n) * (findmin n)); set mi = ((n * n) + (3 * n)) + 1; set Ak = Argmin ((OuterVx (g,n)),g,n); assume that A1: g = ((repeat ((Relax n) * (findmin n))) . k) . f and A2: h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f and A3: OuterVx (g,n) <> {} and A4: i in UsedVx (g,n) and A5: len f = ((n * n) + (3 * n)) + 1 ; ::_thesis: h . (n + i) = g . (n + i) A6: h = (Relax n) . ((findmin n) . g) by A1, A2, Th22 .= Relax (((findmin n) . g),n) by Def15 ; set ni = n + i; A7: ex j being Element of NAT st ( i = j & j in dom g & 1 <= j & j <= n & g . j = - 1 ) by A4; then A8: n + i <= n + n by XREAL_1:7; A9: 1 <= n + i by A7, NAT_1:12; A10: 2 * n < ((n * n) + (3 * n)) + 1 by Lm7; then n + i < ((n * n) + (3 * n)) + 1 by A8, XXREAL_0:2; then n + i in dom f by A5, A9, FINSEQ_3:25; then n + i in dom g by A1, Th41; then A11: ( (n + i) -' n = i & n + i in dom ((findmin n) . g) ) by Th33, NAT_D:34; A12: Argmin ((OuterVx (g,n)),g,n) <= n by A3, Th29; A13: n < ((n * n) + (3 * n)) + 1 by Lm7; A14: (findmin n) . g = (g,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (g,n)),g,n)),(- 1)) by Def11; A15: g . (Argmin ((OuterVx (g,n)),g,n)) <> - 1 by A3, Th29; A16: now__::_thesis:_not_(findmin_n)_._g_hasBetterPathAt_n,i assume (findmin n) . g hasBetterPathAt n,i ; ::_thesis: contradiction then ((findmin n) . g) . i <> - 1 by Def13; hence contradiction by A14, A15, A7, A13, Th18; ::_thesis: verum end; n + 1 <= n + i by A7, XREAL_1:7; then A17: n < n + i by NAT_1:13; n + i <= 2 * n by A8; hence h . (n + i) = ((findmin n) . g) . (n + i) by A6, A17, A11, A16, Def14 .= g . (n + i) by A14, A12, A8, A17, A10, Th18 ; ::_thesis: verum end; Lm17: for n, k, j being Element of NAT for g, f, h being Element of REAL * for p being FinSequence of NAT st g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 & p is_simple_vertex_seq_at g,j,n & g . (n + j) = h . (n + j) & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) holds p is_simple_vertex_seq_at h,j,n proof let n, k, j be Element of NAT ; ::_thesis: for g, f, h being Element of REAL * for p being FinSequence of NAT st g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 & p is_simple_vertex_seq_at g,j,n & g . (n + j) = h . (n + j) & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) holds p is_simple_vertex_seq_at h,j,n let g, f, h be Element of REAL * ; ::_thesis: for p being FinSequence of NAT st g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 & p is_simple_vertex_seq_at g,j,n & g . (n + j) = h . (n + j) & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) holds p is_simple_vertex_seq_at h,j,n let p be FinSequence of NAT ; ::_thesis: ( g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 & p is_simple_vertex_seq_at g,j,n & g . (n + j) = h . (n + j) & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) implies p is_simple_vertex_seq_at h,j,n ) set RT = repeat ((Relax n) * (findmin n)); assume that A1: ( g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 ) and A2: p is_simple_vertex_seq_at g,j,n and A3: g . (n + j) = h . (n + j) and A4: for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ; ::_thesis: p is_simple_vertex_seq_at h,j,n A5: len p > 1 by A2, Def18; A6: p is_vertex_seq_at g,j,n by A2, Def18; then A7: p . (len p) = j by Def17; now__::_thesis:_for_k_being_Element_of_NAT_st_1_<=_k_&_k_<_len_p_holds_ p_._((len_p)_-_k)_=_h_._(n_+_(p_/._(((len_p)_-_k)_+_1))) let k be Element of NAT ; ::_thesis: ( 1 <= k & k < len p implies p . ((len p) - b1) = h . (n + (p /. (((len p) - b1) + 1))) ) assume that A8: 1 <= k and A9: k < len p ; ::_thesis: p . ((len p) - b1) = h . (n + (p /. (((len p) - b1) + 1))) A10: k - k < (len p) - k by A9, XREAL_1:14; then reconsider m = (len p) - k as Element of NAT by INT_1:3; m <= (len p) - 1 by A8, XREAL_1:13; then A11: m + 1 <= ((len p) - 1) + 1 by XREAL_1:7; A12: 1 + 0 < m + 1 by A10, XREAL_1:8; then A13: p /. (m + 1) = p . (m + 1) by A11, FINSEQ_4:15; percases ( m + 1 = len p or m + 1 <> len p ) ; suppose m + 1 = len p ; ::_thesis: p . ((len p) - b1) = h . (n + (p /. (((len p) - b1) + 1))) hence p . ((len p) - k) = h . (n + (p /. (((len p) - k) + 1))) by A3, A5, A6, A7, A13, Def17; ::_thesis: verum end; suppose m + 1 <> len p ; ::_thesis: p . ((len p) - b1) = h . (n + (p /. (((len p) - b1) + 1))) then A14: m + 1 < len p by A11, XXREAL_0:1; thus p . ((len p) - k) = g . (n + (p /. (((len p) - k) + 1))) by A6, A8, A9, Def17 .= h . (n + (p /. (((len p) - k) + 1))) by A1, A4, A12, A13, A14, Lm16 ; ::_thesis: verum end; end; end; then A15: p is_vertex_seq_at h,j,n by A7, Def17; ( p . 1 = 1 & p is one-to-one ) by A2, Def18; hence p is_simple_vertex_seq_at h,j,n by A5, A15, Def18; ::_thesis: verum end; Lm18: for n, k, m, j being Element of NAT for g, f, h being Element of REAL * for p being FinSequence of NAT st g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 & p is_simple_vertex_seq_at g,m,n & m = h . (n + j) & g . (n + m) = h . (n + m) & m <> j & not j in UsedVx (g,n) & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) holds p ^ <*j*> is_simple_vertex_seq_at h,j,n proof let n, k, m, j be Element of NAT ; ::_thesis: for g, f, h being Element of REAL * for p being FinSequence of NAT st g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 & p is_simple_vertex_seq_at g,m,n & m = h . (n + j) & g . (n + m) = h . (n + m) & m <> j & not j in UsedVx (g,n) & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) holds p ^ <*j*> is_simple_vertex_seq_at h,j,n let g, f, h be Element of REAL * ; ::_thesis: for p being FinSequence of NAT st g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 & p is_simple_vertex_seq_at g,m,n & m = h . (n + j) & g . (n + m) = h . (n + m) & m <> j & not j in UsedVx (g,n) & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) holds p ^ <*j*> is_simple_vertex_seq_at h,j,n let p be FinSequence of NAT ; ::_thesis: ( g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 & p is_simple_vertex_seq_at g,m,n & m = h . (n + j) & g . (n + m) = h . (n + m) & m <> j & not j in UsedVx (g,n) & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) implies p ^ <*j*> is_simple_vertex_seq_at h,j,n ) set RT = repeat ((Relax n) * (findmin n)); assume that A1: ( g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & len f = ((n * n) + (3 * n)) + 1 ) and A2: p is_simple_vertex_seq_at g,m,n and A3: m = h . (n + j) and A4: g . (n + m) = h . (n + m) and A5: m <> j and A6: not j in UsedVx (g,n) and A7: for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ; ::_thesis: p ^ <*j*> is_simple_vertex_seq_at h,j,n A8: p is_vertex_seq_at g,m,n by A2, Def18; then A9: p . (len p) = m by Def17; set q = p ^ <*j*>; A10: len p > 1 by A2, Def18; A11: len (p ^ <*j*>) = (len p) + 1 by FINSEQ_2:16; then A12: (p ^ <*j*>) . (len (p ^ <*j*>)) = j by FINSEQ_1:42; now__::_thesis:_for_ii_being_Element_of_NAT_st_1_<=_ii_&_ii_<_len_(p_^_<*j*>)_holds_ (p_^_<*j*>)_._((len_(p_^_<*j*>))_-_ii)_=_h_._(n_+_((p_^_<*j*>)_/._(((len_(p_^_<*j*>))_-_ii)_+_1))) let ii be Element of NAT ; ::_thesis: ( 1 <= ii & ii < len (p ^ <*j*>) implies (p ^ <*j*>) . ((len (p ^ <*j*>)) - b1) = h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - b1) + 1))) ) assume that A13: 1 <= ii and A14: ii < len (p ^ <*j*>) ; ::_thesis: (p ^ <*j*>) . ((len (p ^ <*j*>)) - b1) = h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - b1) + 1))) A15: ii - ii < (len (p ^ <*j*>)) - ii by A14, XREAL_1:14; then reconsider mm = (len (p ^ <*j*>)) - ii as Element of NAT by INT_1:3; A16: 1 + 0 < mm + 1 by A15, XREAL_1:8; mm <= (len (p ^ <*j*>)) - 1 by A13, XREAL_1:13; then A17: mm + 1 <= ((len (p ^ <*j*>)) - 1) + 1 by XREAL_1:7; then A18: (p ^ <*j*>) /. (mm + 1) = (p ^ <*j*>) . (mm + 1) by A16, FINSEQ_4:15; percases ( mm + 1 = len (p ^ <*j*>) or mm + 1 <> len (p ^ <*j*>) ) ; suppose mm + 1 = len (p ^ <*j*>) ; ::_thesis: (p ^ <*j*>) . ((len (p ^ <*j*>)) - b1) = h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - b1) + 1))) hence (p ^ <*j*>) . ((len (p ^ <*j*>)) - ii) = h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - ii) + 1))) by A3, A10, A9, A11, A12, A18, Lm1; ::_thesis: verum end; suppose mm + 1 <> len (p ^ <*j*>) ; ::_thesis: (p ^ <*j*>) . ((len (p ^ <*j*>)) - b1) = h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - b1) + 1))) then A19: mm + 1 < len (p ^ <*j*>) by A17, XXREAL_0:1; then A20: mm + 1 <= len p by A11, INT_1:7; A21: 1 + 0 <= mm by A15, INT_1:7; mm < len p by A11, A19, XREAL_1:7; then A22: (p ^ <*j*>) . ((len (p ^ <*j*>)) - ii) = p . mm by A21, Lm1; hereby ::_thesis: verum percases ( mm + 1 = len p or mm + 1 <> len p ) ; supposeA23: mm + 1 = len p ; ::_thesis: (p ^ <*j*>) . ((len (p ^ <*j*>)) - ii) = h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - ii) + 1))) A24: p /. (((len p) - 1) + 1) = m by A10, A9, FINSEQ_4:15; (p ^ <*j*>) /. (((len (p ^ <*j*>)) - ii) + 1) = m by A10, A9, A18, A23, Lm1; hence (p ^ <*j*>) . ((len (p ^ <*j*>)) - ii) = h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - ii) + 1))) by A4, A10, A8, A22, A23, A24, Def17; ::_thesis: verum end; supposeA25: mm + 1 <> len p ; ::_thesis: (p ^ <*j*>) . ((len (p ^ <*j*>)) - ii) = h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - ii) + 1))) set i2 = ii - 1; A26: mm + 1 < len p by A20, A25, XXREAL_0:1; A27: now__::_thesis:_not_ii_-_1_<=_1 assume ii - 1 <= 1 ; ::_thesis: contradiction then (len p) - 1 <= (len p) - (ii - 1) by XREAL_1:13; hence contradiction by A11, A26, XREAL_1:20; ::_thesis: verum end; then reconsider i3 = ii - 1 as Element of NAT by INT_1:3; A28: p /. (mm + 1) = p . (mm + 1) by A16, A20, FINSEQ_4:15; A29: (p ^ <*j*>) /. (((len (p ^ <*j*>)) - ii) + 1) = (p ^ <*j*>) . (mm + 1) by A16, A17, FINSEQ_4:15 .= p /. (mm + 1) by A16, A20, A28, Lm1 ; ii - 1 < (len (p ^ <*j*>)) - 1 by A14, XREAL_1:14; hence (p ^ <*j*>) . ((len (p ^ <*j*>)) - ii) = g . (n + (p /. (((len p) - i3) + 1))) by A8, A11, A22, A27, Def17 .= h . (n + ((p ^ <*j*>) /. (((len (p ^ <*j*>)) - ii) + 1))) by A1, A7, A11, A16, A26, A28, A29, Lm16 ; ::_thesis: verum end; end; end; end; end; end; then A30: p ^ <*j*> is_vertex_seq_at h,j,n by A12, Def17; A31: now__::_thesis:_not_j_in_rng_p assume j in rng p ; ::_thesis: contradiction then consider i being Nat such that A32: i in dom p and A33: j = p . i by FINSEQ_2:10; A34: 1 <= i by A32, FINSEQ_3:25; A35: i <= len p by A32, FINSEQ_3:25; percases ( i = len p or i <> len p ) ; suppose i = len p ; ::_thesis: contradiction hence contradiction by A5, A8, A33, Def17; ::_thesis: verum end; suppose i <> len p ; ::_thesis: contradiction then i < len p by A35, XXREAL_0:1; hence contradiction by A6, A7, A32, A33, A34; ::_thesis: verum end; end; end; p is one-to-one by A2, Def18; then A36: p ^ <*j*> is one-to-one by A31, Th1; p . 1 = 1 by A2, Def18; then A37: (p ^ <*j*>) . 1 = 1 by A10, Lm1; len (p ^ <*j*>) > 1 by A10, A11, NAT_1:13; hence p ^ <*j*> is_simple_vertex_seq_at h,j,n by A37, A30, A36, Def18; ::_thesis: verum end; Lm19: for n, i being Element of NAT for V being set for f, g being Element of REAL * for G being oriented finite Graph for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v2, v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & W is_weight>=0of G & v2 = i & v1 <> v2 & 1 <= i & i <= n & P is_shortestpath_of v1,v2,V,W & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ) holds g . (n + i) <> - 1 proof let n, i be Element of NAT ; ::_thesis: for V being set for f, g being Element of REAL * for G being oriented finite Graph for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v2, v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & W is_weight>=0of G & v2 = i & v1 <> v2 & 1 <= i & i <= n & P is_shortestpath_of v1,v2,V,W & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ) holds g . (n + i) <> - 1 let V be set ; ::_thesis: for f, g being Element of REAL * for G being oriented finite Graph for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v2, v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & W is_weight>=0of G & v2 = i & v1 <> v2 & 1 <= i & i <= n & P is_shortestpath_of v1,v2,V,W & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ) holds g . (n + i) <> - 1 let f, g be Element of REAL * ; ::_thesis: for G being oriented finite Graph for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v2, v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & W is_weight>=0of G & v2 = i & v1 <> v2 & 1 <= i & i <= n & P is_shortestpath_of v1,v2,V,W & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ) holds g . (n + i) <> - 1 let G be oriented finite Graph; ::_thesis: for P being oriented Chain of G for W being Function of the carrier' of G,Real>=0 for v2, v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & W is_weight>=0of G & v2 = i & v1 <> v2 & 1 <= i & i <= n & P is_shortestpath_of v1,v2,V,W & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ) holds g . (n + i) <> - 1 let P be oriented Chain of G; ::_thesis: for W being Function of the carrier' of G,Real>=0 for v2, v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & W is_weight>=0of G & v2 = i & v1 <> v2 & 1 <= i & i <= n & P is_shortestpath_of v1,v2,V,W & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ) holds g . (n + i) <> - 1 let W be Function of the carrier' of G,Real>=0; ::_thesis: for v2, v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & W is_weight>=0of G & v2 = i & v1 <> v2 & 1 <= i & i <= n & P is_shortestpath_of v1,v2,V,W & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ) holds g . (n + i) <> - 1 let v2, v1 be Vertex of G; ::_thesis: ( f is_Input_of_Dijkstra_Alg G,n,W & W is_weight>=0of G & v2 = i & v1 <> v2 & 1 <= i & i <= n & P is_shortestpath_of v1,v2,V,W & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ) implies g . (n + i) <> - 1 ) assume that A1: f is_Input_of_Dijkstra_Alg G,n,W and A2: W is_weight>=0of G and A3: v2 = i and A4: v1 <> v2 and A5: ( 1 <= i & i <= n ) and A6: P is_shortestpath_of v1,v2,V,W and A7: for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in V holds f . (((2 * n) + (n * m)) + j) = - 1 ; ::_thesis: g . (n + i) <> - 1 P is_orientedpath_of v1,v2,V by A6, GRAPH_5:def_18; then consider q being oriented Simple Chain of G such that A8: q is_shortestpath_of v1,v2,V,W by A2, GRAPH_5:62; set FT = the Target of G; assume A9: g . (n + i) = - 1 ; ::_thesis: contradiction set e = q . (len q); consider vs being FinSequence of the carrier of G such that A10: vs is_oriented_vertex_seq_of q and A11: for n1, m1 being Element of NAT st 1 <= n1 & n1 < m1 & m1 <= len vs & vs . n1 = vs . m1 holds ( n1 = 1 & m1 = len vs ) by GRAPH_4:def_7; A12: q is_orientedpath_of v1,v2,V by A8, GRAPH_5:def_18; then A13: q is_orientedpath_of v1,v2 by GRAPH_5:def_4; then q <> {} by GRAPH_5:def_3; then A14: len q >= 1 by FINSEQ_1:20; then A15: q . (len q) orientedly_joins vs /. (len q),vs /. ((len q) + 1) by A10, GRAPH_4:def_5; len q in dom q by A14, FINSEQ_3:25; then A16: q . (len q) in the carrier' of G by FINSEQ_2:11; A17: len vs = (len q) + 1 by A10, GRAPH_4:def_5; then A18: len q < len vs by NAT_1:13; then A19: len q in dom vs by A14, FINSEQ_3:25; A20: vs /. (len q) = vs . (len q) by A14, A18, FINSEQ_4:15; then reconsider v3 = vs . (len q) as Vertex of G ; the Target of G . (q . (len q)) = v2 by A13, GRAPH_5:def_3; then A21: v2 = vs /. ((len q) + 1) by A15, GRAPH_4:def_1; A22: 1 < (len q) + 1 by A14, NAT_1:13; then A23: v2 = vs . (len vs) by A17, A21, FINSEQ_4:15; now__::_thesis:_not_v3_=_v2 A24: q . 1 orientedly_joins vs /. 1,vs /. (1 + 1) by A10, A14, GRAPH_4:def_5; assume A25: v3 = v2 ; ::_thesis: contradiction v1 = the Source of G . (q . 1) by A13, GRAPH_5:def_3 .= vs /. 1 by A24, GRAPH_4:def_1 .= vs . 1 by A17, A22, FINSEQ_4:15 .= v3 by A11, A14, A18, A23, A25 ; hence contradiction by A4, A25; ::_thesis: verum end; then A26: not v3 in {v2} by TARSKI:def_1; Seg n = the carrier of G by A1, Def20; then v3 in Seg n by A19, FINSEQ_2:11; then reconsider m = v3 as Element of NAT ; A27: f . (((2 * n) + (n * m)) + i) = Weight (v3,v2,W) by A1, A3, Def20; v3 = the Source of G . (q . (len q)) by A15, A20, GRAPH_4:def_1; then v3 in vertices q by A14, Lm4; then A28: m in (vertices q) \ {v2} by A26, XBOOLE_0:def_5; (vertices q) \ {v2} c= V by A12, GRAPH_5:def_4; then f . (((2 * n) + (n * m)) + i) = - 1 by A5, A7, A9, A28; hence contradiction by A15, A16, A20, A21, A27, Th23; ::_thesis: verum end; Lm20: for n, k being Element of NAT for f, g, h being Element of REAL * for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & 1 in UsedVx (g,n) & ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & g . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (P,W) = g . ((2 * n) + j) & ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) ) ) & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (g,n) holds g . (n + m) <> - 1 ) holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) proof let n, k be Element of NAT ; ::_thesis: for f, g, h being Element of REAL * for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & 1 in UsedVx (g,n) & ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & g . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (P,W) = g . ((2 * n) + j) & ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) ) ) & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (g,n) holds g . (n + m) <> - 1 ) holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let f, g, h be Element of REAL * ; ::_thesis: for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & 1 in UsedVx (g,n) & ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & g . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (P,W) = g . ((2 * n) + j) & ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) ) ) & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (g,n) holds g . (n + m) <> - 1 ) holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let G be oriented finite Graph; ::_thesis: for W being Function of the carrier' of G,Real>=0 for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & 1 in UsedVx (g,n) & ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & g . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (P,W) = g . ((2 * n) + j) & ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) ) ) & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (g,n) holds g . (n + m) <> - 1 ) holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let W be Function of the carrier' of G,Real>=0; ::_thesis: for v1 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & 1 in UsedVx (g,n) & ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & g . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (P,W) = g . ((2 * n) + j) & ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) ) ) & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (g,n) holds g . (n + m) <> - 1 ) holds ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let v1 be Vertex of G; ::_thesis: ( f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & n >= 1 & g = ((repeat ((Relax n) * (findmin n))) . k) . f & h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f & OuterVx (g,n) <> {} & 1 in UsedVx (g,n) & ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & g . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (P,W) = g . ((2 * n) + j) & ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) ) ) & ( for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (g,n) holds g . (n + m) <> - 1 ) implies ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) ) set R = Relax n; set M = findmin n; set IN = OuterVx (g,n); set Ug = UsedVx (g,n); assume that A1: f is_Input_of_Dijkstra_Alg G,n,W and A2: v1 = 1 and A3: n >= 1 and A4: g = ((repeat ((Relax n) * (findmin n))) . k) . f and A5: h = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f and A6: OuterVx (g,n) <> {} and A7: 1 in UsedVx (g,n) ; ::_thesis: ( ex v3 being Vertex of G ex j being Element of NAT st ( v3 <> v1 & v3 = j & g . (n + j) <> - 1 & ( for p being FinSequence of NAT for P being oriented Chain of G holds ( not p is_simple_vertex_seq_at g,j,n or ex i being Element of NAT st ( 1 <= i & i < len p & not p . i in UsedVx (g,n) ) or not P is_oriented_edge_seq_of p or not P is_shortestpath_of v1,v3, UsedVx (g,n),W or not cost (P,W) = g . ((2 * n) + j) or ( not v3 in UsedVx (g,n) & not P islongestInShortestpath UsedVx (g,n),v1,W ) ) ) ) or ex m, j being Element of NAT st ( g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) & not f . (((2 * n) + (n * m)) + j) = - 1 ) or ex m being Element of NAT st ( m in UsedVx (g,n) & not g . (n + m) <> - 1 ) or ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) ) assume A8: for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & g . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (P,W) = g . ((2 * n) + j) & ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) ) ; ::_thesis: ( ex m, j being Element of NAT st ( g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) & not f . (((2 * n) + (n * m)) + j) = - 1 ) or ex m being Element of NAT st ( m in UsedVx (g,n) & not g . (n + m) <> - 1 ) or ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) ) assume that A9: for m, j being Element of NAT st g . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (g,n) holds f . (((2 * n) + (n * m)) + j) = - 1 and A10: for m being Element of NAT st m in UsedVx (g,n) holds g . (n + m) <> - 1 ; ::_thesis: ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) ) & ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) set mi = ((n * n) + (3 * n)) + 1; set Ak = Argmin ((OuterVx (g,n)),g,n); A11: 1 <= ((n * n) + (3 * n)) + 1 by NAT_1:12; A12: len f = ((n * n) + (3 * n)) + 1 by A1, Def20; A13: (findmin n) . g = (g,(((n * n) + (3 * n)) + 1)) := ((Argmin ((OuterVx (g,n)),g,n)),(- 1)) by Def11; A14: dom ((findmin n) . g) = dom g by Th33; h = (Relax n) . ((findmin n) . g) by A4, A5, Th22; then A15: h = Relax (((findmin n) . g),n) by Def15; A16: Seg n = the carrier of G by A1, Def20; then reconsider VG = the carrier of G as non empty Subset of NAT by A3; A17: W is_weight>=0of G by GRAPH_5:def_13; A18: (2 * n) + n = (2 + 1) * n ; A19: dom f = dom g by A4, Th41; A20: 1 <= Argmin ((OuterVx (g,n)),g,n) by A6, Th29; A21: Argmin ((OuterVx (g,n)),g,n) <= n by A6, Th29; A22: g . (n + (Argmin ((OuterVx (g,n)),g,n))) <> - 1 by A6, Th29; set Uh = UsedVx (h,n); A23: ( UsedVx (h,n) = (UsedVx (g,n)) \/ {(Argmin ((OuterVx (g,n)),g,n))} & not Argmin ((OuterVx (g,n)),g,n) in UsedVx (g,n) ) by A4, A5, A6, Th39; then A24: UsedVx (g,n) c= UsedVx (h,n) by XBOOLE_1:7; A25: n < ((n * n) + (3 * n)) + 1 by Lm7; A26: dom f = dom h by A5, Th41; reconsider vk = Argmin ((OuterVx (g,n)),g,n) as Vertex of G by A16, A20, A21, FINSEQ_1:1; consider pk being FinSequence of NAT , PK being oriented Chain of G such that A27: pk is_simple_vertex_seq_at g, Argmin ((OuterVx (g,n)),g,n),n and A28: for i being Element of NAT st 1 <= i & i < len pk holds pk . i in UsedVx (g,n) and A29: PK is_oriented_edge_seq_of pk and A30: PK is_shortestpath_of v1,vk, UsedVx (g,n),W and A31: cost (PK,W) = g . ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) and A32: ( not vk in UsedVx (g,n) implies PK islongestInShortestpath UsedVx (g,n),v1,W ) by A2, A7, A8, A22, A23; A33: ex kk being Element of NAT st ( kk = Argmin ((OuterVx (g,n)),g,n) & kk in OuterVx (g,n) & ( for i being Element of NAT st i in OuterVx (g,n) holds g /. ((2 * n) + kk) <= g /. ((2 * n) + i) ) & ( for i being Element of NAT st i in OuterVx (g,n) & g /. ((2 * n) + kk) = g /. ((2 * n) + i) holds kk <= i ) ) by A6, Def10; set nAk = (2 * n) + (Argmin ((OuterVx (g,n)),g,n)); A34: 1 < (2 * n) + (Argmin ((OuterVx (g,n)),g,n)) by A20, A21, Lm11; A35: (2 * n) + (Argmin ((OuterVx (g,n)),g,n)) < ((n * n) + (3 * n)) + 1 by A20, A21, Lm11; A36: Argmin ((OuterVx (g,n)),g,n) < (2 * n) + (Argmin ((OuterVx (g,n)),g,n)) by A20, A21, Lm11; A37: (2 * n) + (Argmin ((OuterVx (g,n)),g,n)) in dom g by A12, A19, A34, A35, FINSEQ_3:25; A38: f,g equal_at (3 * n) + 1,(n * n) + (3 * n) by A4, Th46; PK is_orientedpath_of v1,vk, UsedVx (g,n) by A30, GRAPH_5:def_18; then A39: PK is_orientedpath_of v1,vk by GRAPH_5:def_4; then PK <> {} by GRAPH_5:def_3; then A40: len PK >= 1 by FINSEQ_1:20; A41: ((n * n) + (3 * n)) + 1 in dom g by A11, A12, A19, FINSEQ_3:25; then A42: ((findmin n) . g) /. (((n * n) + (3 * n)) + 1) = ((findmin n) . g) . (((n * n) + (3 * n)) + 1) by A14, PARTFUN1:def_6 .= Argmin ((OuterVx (g,n)),g,n) by A13, A21, A25, A41, Th17 ; A43: ((findmin n) . g) /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) = ((findmin n) . g) . ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) by A14, A37, PARTFUN1:def_6 .= cost (PK,W) by A13, A31, A35, A36, Th18 ; set nk = n + (Argmin ((OuterVx (g,n)),g,n)); A44: 1 < n + (Argmin ((OuterVx (g,n)),g,n)) by A20, A21, Lm12; A45: n + (Argmin ((OuterVx (g,n)),g,n)) <= 2 * n by A20, A21, Lm12; A46: n + (Argmin ((OuterVx (g,n)),g,n)) < ((n * n) + (3 * n)) + 1 by A20, A21, Lm12; n + 1 <= n + (Argmin ((OuterVx (g,n)),g,n)) by A20, XREAL_1:7; then A47: n < n + (Argmin ((OuterVx (g,n)),g,n)) by NAT_1:13; A48: n + (Argmin ((OuterVx (g,n)),g,n)) in dom g by A12, A19, A44, A46, FINSEQ_3:25; A49: ((findmin n) . g) . (n + (Argmin ((OuterVx (g,n)),g,n))) = g . (n + (Argmin ((OuterVx (g,n)),g,n))) by A46, A47, Th31; now__::_thesis:_not_(findmin_n)_._g_hasBetterPathAt_n,_Argmin_((OuterVx_(g,n)),g,n) set Wke = ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + (Argmin ((OuterVx (g,n)),g,n))); assume A50: (findmin n) . g hasBetterPathAt n, Argmin ((OuterVx (g,n)),g,n) ; ::_thesis: contradiction then A51: ( ((findmin n) . g) . (n + (Argmin ((OuterVx (g,n)),g,n))) = - 1 or ((findmin n) . g) /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) > newpathcost (((findmin n) . g),n,(Argmin ((OuterVx (g,n)),g,n))) ) by Def13; ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + (Argmin ((OuterVx (g,n)),g,n))) >= 0 by A50, Def13; then (((findmin n) . g) /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n)))) + (((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + (Argmin ((OuterVx (g,n)),g,n)))) >= (((findmin n) . g) /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n)))) + 0 by XREAL_1:7; hence contradiction by A6, A42, A49, A51, Th29; ::_thesis: verum end; then not (findmin n) . g hasBetterPathAt n,(n + (Argmin ((OuterVx (g,n)),g,n))) -' n by NAT_D:34; then A52: h . (n + (Argmin ((OuterVx (g,n)),g,n))) = g . (n + (Argmin ((OuterVx (g,n)),g,n))) by A14, A15, A45, A47, A48, A49, Def14; hereby ::_thesis: ( ( for m, j being Element of NAT st h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 ) ) let v3 be Vertex of G; ::_thesis: for j being Element of NAT st v3 <> v1 & v3 = j & h . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( b4 is_simple_vertex_seq_at h,P,n & ( for i being Element of NAT st 1 <= b6 & b6 < len i holds i . b6 in UsedVx (h,n) ) & b5 is_oriented_edge_seq_of b4 & b5 is_shortestpath_of v1,p, UsedVx (h,n),W & cost (b5,W) = h . ((2 * n) + P) & ( not p in UsedVx (h,n) implies b5 islongestInShortestpath UsedVx (h,n),v1,W ) ) let j be Element of NAT ; ::_thesis: ( v3 <> v1 & v3 = j & h . (n + j) <> - 1 implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( b3 is_simple_vertex_seq_at h,P,n & ( for i being Element of NAT st 1 <= b5 & b5 < len i holds i . b5 in UsedVx (h,n) ) & b4 is_oriented_edge_seq_of b3 & b4 is_shortestpath_of v1,p, UsedVx (h,n),W & cost (b4,W) = h . ((2 * n) + P) & ( not p in UsedVx (h,n) implies b4 islongestInShortestpath UsedVx (h,n),v1,W ) ) ) assume that A53: v3 <> v1 and A54: v3 = j and A55: h . (n + j) <> - 1 ; ::_thesis: ex p being FinSequence of NAT ex P being oriented Chain of G st ( b3 is_simple_vertex_seq_at h,P,n & ( for i being Element of NAT st 1 <= b5 & b5 < len i holds i . b5 in UsedVx (h,n) ) & b4 is_oriented_edge_seq_of b3 & b4 is_shortestpath_of v1,p, UsedVx (h,n),W & cost (b4,W) = h . ((2 * n) + P) & ( not p in UsedVx (h,n) implies b4 islongestInShortestpath UsedVx (h,n),v1,W ) ) set nj = n + j; A56: j in VG by A54; then A57: 1 <= j by A16, FINSEQ_1:1; A58: j <= n by A16, A56, FINSEQ_1:1; then A59: 1 < n + j by A57, Lm12; A60: n + j <= 2 * n by A57, A58, Lm12; A61: n + j < ((n * n) + (3 * n)) + 1 by A57, A58, Lm12; then A62: n + j in dom g by A12, A19, A59, FINSEQ_3:25; A63: (n + j) -' n = j by NAT_D:34; n + 1 <= n + j by A57, XREAL_1:7; then A64: n < n + j by NAT_1:13; set m2 = (2 * n) + j; A65: (2 * n) + j <= 3 * n by A18, A58, XREAL_1:7; (2 * n) + 1 <= (2 * n) + j by A57, XREAL_1:7; then A66: 2 * n < (2 * n) + j by NAT_1:13; A67: ((2 * n) + j) -' (2 * n) = j by NAT_D:34; A68: 1 < (2 * n) + j by A57, A58, Lm11; A69: (2 * n) + j < ((n * n) + (3 * n)) + 1 by A57, A58, Lm11; then A70: (2 * n) + j in dom g by A12, A19, A68, FINSEQ_3:25; A71: (2 * n) + j in dom ((findmin n) . g) by A12, A14, A19, A68, A69, FINSEQ_3:25; A72: ((findmin n) . g) . (n + j) = g . (n + j) by A13, A21, A61, A64, Th18; n <= 2 * n by Lm6; then n < (2 * n) + j by A66, XXREAL_0:2; then A73: ((findmin n) . g) . ((2 * n) + j) = g . ((2 * n) + j) by A13, A21, A69, Th18; A74: j < ((n * n) + (3 * n)) + 1 by A25, A58, XXREAL_0:2; then A75: j in dom g by A12, A19, A57, FINSEQ_3:25; A76: j in dom h by A12, A26, A57, A74, FINSEQ_3:25; set Akj = ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j; A77: 1 < ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j by A20, A21, A58, Lm13; A78: Argmin ((OuterVx (g,n)),g,n) < ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j by A20, A21, A58, Lm13; A79: ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j < ((n * n) + (3 * n)) + 1 by A20, A21, A58, Lm13; then A80: ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j in dom g by A12, A19, A77, FINSEQ_3:25; A81: (3 * n) + 1 <= ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j by A20, A21, A57, A58, Lm14; A82: ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j <= (n * n) + (3 * n) by A20, A21, A57, A58, Lm14; A83: ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + j) = ((findmin n) . g) . (((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j) by A14, A42, A80, PARTFUN1:def_6 .= g . (((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j) by A13, A78, A79, Th18 .= f . (((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j) by A19, A38, A80, A81, A82, Def16 .= Weight (vk,v3,W) by A1, A54, Def20 ; A84: ((findmin n) . g) /. ((2 * n) + j) = g . ((2 * n) + j) by A14, A70, A73, PARTFUN1:def_6; percases ( not (findmin n) . g hasBetterPathAt n,(n + j) -' n or (findmin n) . g hasBetterPathAt n,(n + j) -' n ) ; supposeA85: not (findmin n) . g hasBetterPathAt n,(n + j) -' n ; ::_thesis: ex p being FinSequence of NAT ex P being oriented Chain of G st ( b3 is_simple_vertex_seq_at h,P,n & ( for i being Element of NAT st 1 <= b5 & b5 < len i holds i . b5 in UsedVx (h,n) ) & b4 is_oriented_edge_seq_of b3 & b4 is_shortestpath_of v1,p, UsedVx (h,n),W & cost (b4,W) = h . ((2 * n) + P) & ( not p in UsedVx (h,n) implies b4 islongestInShortestpath UsedVx (h,n),v1,W ) ) then A86: h . (n + j) = g . (n + j) by A14, A15, A60, A62, A64, A72, Def14; then consider p being FinSequence of NAT , P being oriented Chain of G such that A87: p is_simple_vertex_seq_at g,j,n and A88: for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) and A89: P is_oriented_edge_seq_of p and A90: P is_shortestpath_of v1,v3, UsedVx (g,n),W and A91: cost (P,W) = g . ((2 * n) + j) and A92: ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) by A8, A53, A54, A55; take p = p; ::_thesis: ex P being oriented Chain of G st ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) take P = P; ::_thesis: ( p is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) thus p is_simple_vertex_seq_at h,j,n by A4, A5, A6, A12, A86, A87, A88, Lm17; ::_thesis: ( ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (h,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) hereby ::_thesis: ( P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) let i be Element of NAT ; ::_thesis: ( 1 <= i & i < len p implies p . i in UsedVx (h,n) ) assume that A93: 1 <= i and A94: i < len p ; ::_thesis: p . i in UsedVx (h,n) p . i in UsedVx (g,n) by A88, A93, A94; hence p . i in UsedVx (h,n) by A24; ::_thesis: verum end; thus P is_oriented_edge_seq_of p by A89; ::_thesis: ( P is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) hereby ::_thesis: ( cost (P,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) ) percases ( ((findmin n) . g) . j = - 1 or ((findmin n) . g) . j <> - 1 ) ; suppose ((findmin n) . g) . j = - 1 ; ::_thesis: P is_shortestpath_of v1,v3, UsedVx (h,n),W then (Relax (((findmin n) . g),n)) . j = - 1 by A14, A58, A75, Def14; then j in { i where i is Element of NAT : ( i in dom h & 1 <= i & i <= n & h . i = - 1 ) } by A15, A57, A58, A76; then A95: ( j in UsedVx (g,n) or j in {(Argmin ((OuterVx (g,n)),g,n))} ) by A23, XBOOLE_0:def_3; now__::_thesis:_for_Q_being_oriented_Chain_of_G for_v4_being_Vertex_of_G_st_not_v4_in_UsedVx_(g,n)_&_Q_is_shortestpath_of_v1,v4,_UsedVx_(g,n),W_holds_ cost_(P,W)_<=_cost_(Q,W) let Q be oriented Chain of G; ::_thesis: for v4 being Vertex of G st not v4 in UsedVx (g,n) & Q is_shortestpath_of v1,v4, UsedVx (g,n),W holds cost (P,W) <= cost (b2,W) let v4 be Vertex of G; ::_thesis: ( not v4 in UsedVx (g,n) & Q is_shortestpath_of v1,v4, UsedVx (g,n),W implies cost (P,W) <= cost (b1,W) ) assume that A96: not v4 in UsedVx (g,n) and A97: Q is_shortestpath_of v1,v4, UsedVx (g,n),W ; ::_thesis: cost (P,W) <= cost (b1,W) A98: v4 in VG ; then reconsider j4 = v4 as Element of NAT ; A99: 1 <= j4 by A16, A98, FINSEQ_1:1; A100: j4 <= n by A16, A98, FINSEQ_1:1; then A101: g . (n + j4) <> - 1 by A1, A2, A7, A9, A17, A96, A97, A99, Lm19; then consider q being FinSequence of NAT , R being oriented Chain of G such that q is_simple_vertex_seq_at g,j4,n and for i being Element of NAT st 1 <= i & i < len q holds q . i in UsedVx (g,n) and R is_oriented_edge_seq_of q and A102: R is_shortestpath_of v1,v4, UsedVx (g,n),W and A103: cost (R,W) = g . ((2 * n) + j4) and A104: ( not v4 in UsedVx (g,n) implies R islongestInShortestpath UsedVx (g,n),v1,W ) by A2, A7, A8, A96; A105: cost (R,W) = cost (Q,W) by A97, A102, Th9; percases ( j in UsedVx (g,n) or j = Argmin ((OuterVx (g,n)),g,n) ) by A95, TARSKI:def_1; suppose j in UsedVx (g,n) ; ::_thesis: cost (P,W) <= cost (b1,W) then ex PP being oriented Chain of G st ( PP is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (PP,W) <= cost (R,W) ) by A53, A54, A96, A104, GRAPH_5:def_19; hence cost (P,W) <= cost (Q,W) by A90, A105, Th9; ::_thesis: verum end; supposeA106: j = Argmin ((OuterVx (g,n)),g,n) ; ::_thesis: cost (P,W) <= cost (b1,W) j4 <= ((n * n) + (3 * n)) + 1 by A25, A100, XXREAL_0:2; then A107: j4 in dom g by A12, A19, A99, FINSEQ_3:25; then g . j4 <> - 1 by A96, A99, A100; then j4 in { i where i is Element of NAT : ( i in dom g & 1 <= i & i <= n & g . i <> - 1 & g . (n + i) <> - 1 ) } by A99, A100, A101, A107; then A108: g /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) <= g /. ((2 * n) + j4) by A33; A109: g /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) = g . ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) by A37, PARTFUN1:def_6; A110: 1 < (2 * n) + j4 by A99, A100, Lm11; (2 * n) + j4 < ((n * n) + (3 * n)) + 1 by A99, A100, Lm11; then (2 * n) + j4 in dom g by A12, A19, A110, FINSEQ_3:25; hence cost (P,W) <= cost (Q,W) by A91, A103, A105, A106, A108, A109, PARTFUN1:def_6; ::_thesis: verum end; end; end; hence P is_shortestpath_of v1,v3, UsedVx (h,n),W by A17, A24, A53, A90, GRAPH_5:64; ::_thesis: verum end; supposeA111: ((findmin n) . g) . j <> - 1 ; ::_thesis: P is_shortestpath_of v1,v3, UsedVx (h,n),W hereby ::_thesis: verum percases ( ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + j) >= 0 or ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + j) < 0 ) ; supposeA112: ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + j) >= 0 ; ::_thesis: P is_shortestpath_of v1,v3, UsedVx (h,n),W then A113: ((findmin n) . g) /. ((2 * n) + j) <= newpathcost (((findmin n) . g),n,j) by A63, A85, A111, Def13; A114: ((findmin n) . g) /. ((2 * n) + j) = cost (P,W) by A71, A73, A91, PARTFUN1:def_6; consider e being set such that A115: e in the carrier' of G and A116: e orientedly_joins vk,v3 by A83, A112, Th23; reconsider pe = <*e*> as oriented Chain of G by A115, Th5; A117: len pe = 1 by FINSEQ_1:40; A118: pe . 1 = e by FINSEQ_1:40; then consider Q being oriented Chain of G such that A119: Q = PK ^ pe and Q is_orientedpath_of v1,v3 by A39, A40, A116, A117, GRAPH_5:33; cost (pe,W) = W . (pe . 1) by A17, A117, Th4, GRAPH_5:46 .= Weight (vk,v3,W) by A115, A116, A118, Th25 ; then cost (Q,W) = newpathcost (((findmin n) . g),n,j) by A17, A42, A43, A83, A119, GRAPH_5:46, GRAPH_5:54; hence P is_shortestpath_of v1,v3, UsedVx (h,n),W by A2, A7, A17, A23, A30, A32, A40, A53, A90, A113, A114, A115, A116, A119, GRAPH_5:65; ::_thesis: verum end; suppose ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + j) < 0 ; ::_thesis: P is_shortestpath_of v1,v3, UsedVx (h,n),W then for e being set holds ( not e in the carrier' of G or not e orientedly_joins vk,v3 ) by A83, Th23; hence P is_shortestpath_of v1,v3, UsedVx (h,n),W by A2, A7, A17, A23, A30, A32, A53, A90, Th13; ::_thesis: verum end; end; end; end; end; end; thus cost (P,W) = h . ((2 * n) + j) by A15, A63, A65, A66, A67, A71, A73, A85, A91, Def14; ::_thesis: ( not v3 in UsedVx (h,n) implies P islongestInShortestpath UsedVx (h,n),v1,W ) hereby ::_thesis: verum assume A120: not v3 in UsedVx (h,n) ; ::_thesis: P islongestInShortestpath UsedVx (h,n),v1,W then A121: not v3 in UsedVx (g,n) by A23, XBOOLE_0:def_3; now__::_thesis:_for_v2_being_Vertex_of_G_st_v2_in_UsedVx_(h,n)_&_v2_<>_v1_holds_ ex_PK_being_oriented_Chain_of_G_st_ (_PK_is_shortestpath_of_v1,v2,_UsedVx_(h,n),W_&_cost_(PK,W)_<=_cost_(P,W)_) let v2 be Vertex of G; ::_thesis: ( v2 in UsedVx (h,n) & v2 <> v1 implies ex PK being oriented Chain of G st ( b2 is_shortestpath_of v1,PK, UsedVx (h,n),W & cost (b2,W) <= cost (P,W) ) ) assume that A122: v2 in UsedVx (h,n) and A123: v2 <> v1 ; ::_thesis: ex PK being oriented Chain of G st ( b2 is_shortestpath_of v1,PK, UsedVx (h,n),W & cost (b2,W) <= cost (P,W) ) percases ( v2 in {(Argmin ((OuterVx (g,n)),g,n))} or v2 in UsedVx (g,n) ) by A23, A122, XBOOLE_0:def_3; suppose v2 in {(Argmin ((OuterVx (g,n)),g,n))} ; ::_thesis: ex PK being oriented Chain of G st ( b2 is_shortestpath_of v1,PK, UsedVx (h,n),W & cost (b2,W) <= cost (P,W) ) then A124: v2 = vk by TARSKI:def_1; take PK = PK; ::_thesis: ( PK is_shortestpath_of v1,v2, UsedVx (h,n),W & cost (PK,W) <= cost (P,W) ) thus PK is_shortestpath_of v1,v2, UsedVx (h,n),W by A23, A30, A124, Th8; ::_thesis: cost (PK,W) <= cost (P,W) g . j <> - 1 by A54, A57, A58, A75, A121; then j in { i where i is Element of NAT : ( i in dom g & 1 <= i & i <= n & g . i <> - 1 & g . (n + i) <> - 1 ) } by A55, A57, A58, A75, A86; then A125: g /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) <= g /. ((2 * n) + j) by A33; g /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n))) = cost (PK,W) by A31, A37, PARTFUN1:def_6; hence cost (PK,W) <= cost (P,W) by A70, A91, A125, PARTFUN1:def_6; ::_thesis: verum end; supposeA126: v2 in UsedVx (g,n) ; ::_thesis: ex Q being oriented Chain of G st ( b2 is_shortestpath_of v1,Q, UsedVx (h,n),W & cost (b2,W) <= cost (P,W) ) then consider Q being oriented Chain of G such that A127: Q is_shortestpath_of v1,v2, UsedVx (g,n),W and A128: cost (Q,W) <= cost (P,W) by A23, A92, A120, A123, GRAPH_5:def_19, XBOOLE_0:def_3; A129: now__::_thesis:_for_R_being_oriented_Chain_of_G for_v4_being_Vertex_of_G_st_not_v4_in_UsedVx_(g,n)_&_R_is_shortestpath_of_v1,v4,_UsedVx_(g,n),W_holds_ cost_(Q,W)_<=_cost_(R,W) let R be oriented Chain of G; ::_thesis: for v4 being Vertex of G st not v4 in UsedVx (g,n) & R is_shortestpath_of v1,v4, UsedVx (g,n),W holds cost (Q,W) <= cost (R,W) let v4 be Vertex of G; ::_thesis: ( not v4 in UsedVx (g,n) & R is_shortestpath_of v1,v4, UsedVx (g,n),W implies cost (Q,W) <= cost (R,W) ) assume that A130: not v4 in UsedVx (g,n) and A131: R is_shortestpath_of v1,v4, UsedVx (g,n),W ; ::_thesis: cost (Q,W) <= cost (R,W) A132: v4 in VG ; then reconsider j4 = v4 as Element of NAT ; A133: 1 <= j4 by A16, A132, FINSEQ_1:1; j4 <= n by A16, A132, FINSEQ_1:1; then g . (n + j4) <> - 1 by A1, A2, A7, A9, A17, A130, A131, A133, Lm19; then consider rn being FinSequence of NAT , RR being oriented Chain of G such that rn is_simple_vertex_seq_at g,j4,n and for i being Element of NAT st 1 <= i & i < len rn holds rn . i in UsedVx (g,n) and RR is_oriented_edge_seq_of rn and A134: RR is_shortestpath_of v1,v4, UsedVx (g,n),W and cost (RR,W) = g . ((2 * n) + j4) and A135: ( not v4 in UsedVx (g,n) implies RR islongestInShortestpath UsedVx (g,n),v1,W ) by A2, A7, A8, A130; consider QQ being oriented Chain of G such that A136: QQ is_shortestpath_of v1,v2, UsedVx (g,n),W and A137: cost (QQ,W) <= cost (RR,W) by A123, A126, A130, A135, GRAPH_5:def_19; cost (QQ,W) = cost (Q,W) by A127, A136, Th9; hence cost (Q,W) <= cost (R,W) by A131, A134, A137, Th9; ::_thesis: verum end; take Q = Q; ::_thesis: ( Q is_shortestpath_of v1,v2, UsedVx (h,n),W & cost (Q,W) <= cost (P,W) ) thus Q is_shortestpath_of v1,v2, UsedVx (h,n),W by A17, A24, A123, A127, A129, GRAPH_5:64; ::_thesis: cost (Q,W) <= cost (P,W) thus cost (Q,W) <= cost (P,W) by A128; ::_thesis: verum end; end; end; hence P islongestInShortestpath UsedVx (h,n),v1,W by GRAPH_5:def_19; ::_thesis: verum end; end; supposeA138: (findmin n) . g hasBetterPathAt n,(n + j) -' n ; ::_thesis: ex q being FinSequence of NAT ex Q being oriented Chain of G st ( b3 is_simple_vertex_seq_at h,Q,n & ( for i being Element of NAT st 1 <= b5 & b5 < len i holds i . b5 in UsedVx (h,n) ) & b4 is_oriented_edge_seq_of b3 & b4 is_shortestpath_of v1,q, UsedVx (h,n),W & cost (b4,W) = h . ((2 * n) + Q) & ( not q in UsedVx (h,n) implies b4 islongestInShortestpath UsedVx (h,n),v1,W ) ) then A139: (Relax (((findmin n) . g),n)) . (n + j) = Argmin ((OuterVx (g,n)),g,n) by A14, A42, A60, A62, A64, Def14; A140: ( ((findmin n) . g) . (n + j) = - 1 or ((findmin n) . g) /. ((2 * n) + j) > newpathcost (((findmin n) . g),n,j) ) by A63, A138, Def13; A141: ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + j) >= 0 by A63, A138, Def13; A142: ((findmin n) . g) . j <> - 1 by A63, A138, Def13; A143: newpathcost (((findmin n) . g),n,j) = (((findmin n) . g) /. ((2 * n) + (Argmin ((OuterVx (g,n)),g,n)))) + (Weight (vk,v3,W)) by A42, A83; A144: now__::_thesis:_not_Argmin_((OuterVx_(g,n)),g,n)_=_j assume A145: Argmin ((OuterVx (g,n)),g,n) = j ; ::_thesis: contradiction then A146: ((findmin n) . g) . (n + j) <> - 1 by A13, A21, A22, A61, A64, Th18; (((findmin n) . g) /. ((2 * n) + j)) + (Weight (vk,v3,W)) >= (((findmin n) . g) /. ((2 * n) + j)) + 0 by A83, A141, XREAL_1:7; hence contradiction by A63, A138, A143, A145, A146, Def13; ::_thesis: verum end; A147: now__::_thesis:_not_j_in_UsedVx_(g,n) assume j in UsedVx (g,n) ; ::_thesis: contradiction then ex i being Element of NAT st ( j = i & i in dom g & 1 <= i & i <= n & g . i = - 1 ) ; hence contradiction by A25, A142, Th32; ::_thesis: verum end; consider e being set such that A148: ( e in the carrier' of G & e orientedly_joins vk,v3 ) by A83, A141, Th23; reconsider pe = <*e*> as oriented Chain of G by A148, Th5; A149: len pe = 1 by FINSEQ_1:40; A150: pe . 1 = e by FINSEQ_1:40; then consider Q being oriented Chain of G such that A151: Q = PK ^ pe and Q is_orientedpath_of v1,v3 by A39, A40, A148, A149, GRAPH_5:33; take q = pk ^ <*j*>; ::_thesis: ex Q being oriented Chain of G st ( q is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len q holds q . i in UsedVx (h,n) ) & Q is_oriented_edge_seq_of q & Q is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (Q,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies Q islongestInShortestpath UsedVx (h,n),v1,W ) ) take Q = Q; ::_thesis: ( q is_simple_vertex_seq_at h,j,n & ( for i being Element of NAT st 1 <= i & i < len q holds q . i in UsedVx (h,n) ) & Q is_oriented_edge_seq_of q & Q is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (Q,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies Q islongestInShortestpath UsedVx (h,n),v1,W ) ) thus q is_simple_vertex_seq_at h,j,n by A4, A5, A6, A12, A15, A27, A28, A52, A139, A144, A147, Lm18; ::_thesis: ( ( for i being Element of NAT st 1 <= i & i < len q holds q . i in UsedVx (h,n) ) & Q is_oriented_edge_seq_of q & Q is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (Q,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies Q islongestInShortestpath UsedVx (h,n),v1,W ) ) A152: len pk > 1 by A27, Def18; A153: pk is_vertex_seq_at g, Argmin ((OuterVx (g,n)),g,n),n by A27, Def18; A154: q . (len pk) = pk . (len pk) by A152, Lm1 .= Argmin ((OuterVx (g,n)),g,n) by A153, Def17 ; hereby ::_thesis: ( Q is_oriented_edge_seq_of q & Q is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (Q,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies Q islongestInShortestpath UsedVx (h,n),v1,W ) ) let i be Element of NAT ; ::_thesis: ( 1 <= i & i < len q implies q . i in UsedVx (h,n) ) assume that A155: 1 <= i and A156: i < len q ; ::_thesis: q . i in UsedVx (h,n) i < (len pk) + 1 by A156, FINSEQ_2:16; then A157: i <= len pk by NAT_1:13; now__::_thesis:_(_q_._i_in_{(Argmin_((OuterVx_(g,n)),g,n))}_or_q_._i_in_UsedVx_(g,n)_) percases ( i = len pk or i <> len pk ) ; suppose i = len pk ; ::_thesis: ( q . i in {(Argmin ((OuterVx (g,n)),g,n))} or q . i in UsedVx (g,n) ) hence ( q . i in {(Argmin ((OuterVx (g,n)),g,n))} or q . i in UsedVx (g,n) ) by A154, TARSKI:def_1; ::_thesis: verum end; suppose i <> len pk ; ::_thesis: ( q . i in {(Argmin ((OuterVx (g,n)),g,n))} or q . i in UsedVx (g,n) ) then A158: i < len pk by A157, XXREAL_0:1; q . i = pk . i by A155, A157, Lm1; hence ( q . i in {(Argmin ((OuterVx (g,n)),g,n))} or q . i in UsedVx (g,n) ) by A28, A155, A158; ::_thesis: verum end; end; end; hence q . i in UsedVx (h,n) by A23, XBOOLE_0:def_3; ::_thesis: verum end; A159: len Q = (len PK) + 1 by A149, A151, FINSEQ_1:22; A160: len pk = (len PK) + 1 by A29, Def19; then A161: len q = (len Q) + 1 by A159, FINSEQ_2:16; set FS = the Source of G; set FT = the Target of G; now__::_thesis:_for_i_being_Nat_st_1_<=_i_&_i_<=_len_Q_holds_ (_the_Source_of_G_._(Q_._i)_=_q_._i_&_the_Target_of_G_._(Q_._i)_=_q_._(i_+_1)_) let i be Nat; ::_thesis: ( 1 <= i & i <= len Q implies ( the Source of G . (Q . b1) = q . b1 & the Target of G . (Q . b1) = q . (b1 + 1) ) ) assume that A162: 1 <= i and A163: i <= len Q ; ::_thesis: ( the Source of G . (Q . b1) = q . b1 & the Target of G . (Q . b1) = q . (b1 + 1) ) percases ( i = len Q or i <> len Q ) ; supposeA164: i = len Q ; ::_thesis: ( the Source of G . (Q . b1) = q . b1 & the Target of G . (Q . b1) = q . (b1 + 1) ) then A165: Q . i = e by A149, A150, A151, A159, Lm2; then A166: the Target of G . (Q . i) = v3 by A148, GRAPH_4:def_1; thus the Source of G . (Q . i) = q . i by A148, A154, A159, A160, A164, A165, GRAPH_4:def_1; ::_thesis: the Target of G . (Q . i) = q . (i + 1) thus the Target of G . (Q . i) = q . (i + 1) by A54, A159, A160, A164, A166, FINSEQ_1:42; ::_thesis: verum end; suppose i <> len Q ; ::_thesis: ( the Source of G . (Q . b1) = q . b1 & the Target of G . (Q . b1) = q . (b1 + 1) ) then A167: i < len Q by A163, XXREAL_0:1; then A168: i <= len PK by A159, NAT_1:13; then A169: the Source of G . (PK . i) = pk . i by A29, A162, Def19; A170: the Target of G . (PK . i) = pk . (i + 1) by A29, A162, A168, Def19; A171: Q . i = PK . i by A151, A162, A168, Lm1; A172: i + 1 <= len pk by A159, A160, A167, NAT_1:13; thus the Source of G . (Q . i) = q . i by A159, A160, A162, A163, A169, A171, Lm1; ::_thesis: the Target of G . (Q . i) = q . (i + 1) thus the Target of G . (Q . i) = q . (i + 1) by A170, A171, A172, Lm1, NAT_1:12; ::_thesis: verum end; end; end; hence Q is_oriented_edge_seq_of q by A161, Def19; ::_thesis: ( Q is_shortestpath_of v1,v3, UsedVx (h,n),W & cost (Q,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies Q islongestInShortestpath UsedVx (h,n),v1,W ) ) A173: (cost (PK,W)) + (cost (pe,W)) = cost (Q,W) by A17, A151, GRAPH_5:46, GRAPH_5:54; A174: cost (pe,W) = W . (pe . 1) by A17, A149, Th4, GRAPH_5:46 .= Weight (vk,v3,W) by A148, A150, Th25 ; then A175: newpathcost (((findmin n) . g),n,j) = cost (Q,W) by A17, A42, A43, A83, A151, GRAPH_5:46, GRAPH_5:54; hereby ::_thesis: ( cost (Q,W) = h . ((2 * n) + j) & ( not v3 in UsedVx (h,n) implies Q islongestInShortestpath UsedVx (h,n),v1,W ) ) percases ( g . (n + j) = - 1 or g . (n + j) <> - 1 ) ; supposeA176: g . (n + j) = - 1 ; ::_thesis: Q is_shortestpath_of v1,v3, UsedVx (h,n),W now__::_thesis:_for_v2_being_Vertex_of_G_st_v2_in_UsedVx_(g,n)_holds_ for_e_being_set_holds_ (_not_e_in_the_carrier'_of_G_or_not_e_orientedly_joins_v2,v3_) let v2 be Vertex of G; ::_thesis: ( v2 in UsedVx (g,n) implies for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) ) assume A177: v2 in UsedVx (g,n) ; ::_thesis: for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) then reconsider m = v2 as Element of NAT ; - 1 = f . (((2 * n) + (n * m)) + j) by A9, A57, A58, A176, A177 .= Weight (v2,v3,W) by A1, A54, Def20 ; hence for e being set holds ( not e in the carrier' of G or not e orientedly_joins v2,v3 ) by Th23; ::_thesis: verum end; hence Q is_shortestpath_of v1,v3, UsedVx (h,n),W by A2, A7, A23, A30, A53, A148, A151, Th15; ::_thesis: verum end; supposeA178: g . (n + j) <> - 1 ; ::_thesis: Q is_shortestpath_of v1,v3, UsedVx (h,n),W then ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,j,n & ( for i being Element of NAT st 1 <= i & i < len p holds p . i in UsedVx (g,n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx (g,n),W & cost (P,W) = g . ((2 * n) + j) & ( not v3 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) ) by A8, A53, A54; hence Q is_shortestpath_of v1,v3, UsedVx (h,n),W by A2, A7, A13, A17, A21, A23, A30, A32, A40, A42, A43, A53, A61, A64, A83, A84, A140, A148, A151, A173, A174, A178, Th18, GRAPH_5:65; ::_thesis: verum end; end; end; thus cost (Q,W) = h . ((2 * n) + j) by A15, A63, A65, A66, A67, A71, A138, A175, Def14; ::_thesis: ( not v3 in UsedVx (h,n) implies Q islongestInShortestpath UsedVx (h,n),v1,W ) 0 <= cost (pe,W) by A17, GRAPH_5:50; then A179: (cost (PK,W)) + 0 <= cost (Q,W) by A173, XREAL_1:7; hereby ::_thesis: verum assume not v3 in UsedVx (h,n) ; ::_thesis: Q islongestInShortestpath UsedVx (h,n),v1,W now__::_thesis:_for_v2_being_Vertex_of_G_st_v2_in_UsedVx_(h,n)_&_v2_<>_v1_holds_ ex_PK_being_oriented_Chain_of_G_st_ (_PK_is_shortestpath_of_v1,v2,_UsedVx_(h,n),W_&_cost_(PK,W)_<=_cost_(Q,W)_) let v2 be Vertex of G; ::_thesis: ( v2 in UsedVx (h,n) & v2 <> v1 implies ex PK being oriented Chain of G st ( b2 is_shortestpath_of v1,PK, UsedVx (h,n),W & cost (b2,W) <= cost (Q,W) ) ) assume that A180: v2 in UsedVx (h,n) and A181: v2 <> v1 ; ::_thesis: ex PK being oriented Chain of G st ( b2 is_shortestpath_of v1,PK, UsedVx (h,n),W & cost (b2,W) <= cost (Q,W) ) percases ( v2 in {(Argmin ((OuterVx (g,n)),g,n))} or v2 in UsedVx (g,n) ) by A23, A180, XBOOLE_0:def_3; suppose v2 in {(Argmin ((OuterVx (g,n)),g,n))} ; ::_thesis: ex PK being oriented Chain of G st ( b2 is_shortestpath_of v1,PK, UsedVx (h,n),W & cost (b2,W) <= cost (Q,W) ) then A182: v2 = Argmin ((OuterVx (g,n)),g,n) by TARSKI:def_1; take PK = PK; ::_thesis: ( PK is_shortestpath_of v1,v2, UsedVx (h,n),W & cost (PK,W) <= cost (Q,W) ) thus PK is_shortestpath_of v1,v2, UsedVx (h,n),W by A23, A30, A182, Th8; ::_thesis: cost (PK,W) <= cost (Q,W) thus cost (PK,W) <= cost (Q,W) by A179; ::_thesis: verum end; supposeA183: v2 in UsedVx (g,n) ; ::_thesis: ex P being oriented Chain of G st ( b2 is_shortestpath_of v1,P, UsedVx (h,n),W & cost (b2,W) <= cost (Q,W) ) then consider P being oriented Chain of G such that A184: P is_shortestpath_of v1,v2, UsedVx (g,n),W and A185: cost (P,W) <= cost (PK,W) by A4, A5, A6, A32, A181, Th39, GRAPH_5:def_19; A186: now__::_thesis:_for_R_being_oriented_Chain_of_G for_v4_being_Vertex_of_G_st_not_v4_in_UsedVx_(g,n)_&_R_is_shortestpath_of_v1,v4,_UsedVx_(g,n),W_holds_ cost_(P,W)_<=_cost_(R,W) let R be oriented Chain of G; ::_thesis: for v4 being Vertex of G st not v4 in UsedVx (g,n) & R is_shortestpath_of v1,v4, UsedVx (g,n),W holds cost (P,W) <= cost (R,W) let v4 be Vertex of G; ::_thesis: ( not v4 in UsedVx (g,n) & R is_shortestpath_of v1,v4, UsedVx (g,n),W implies cost (P,W) <= cost (R,W) ) assume that A187: not v4 in UsedVx (g,n) and A188: R is_shortestpath_of v1,v4, UsedVx (g,n),W ; ::_thesis: cost (P,W) <= cost (R,W) A189: v4 in VG ; then reconsider j4 = v4 as Element of NAT ; A190: 1 <= j4 by A16, A189, FINSEQ_1:1; j4 <= n by A16, A189, FINSEQ_1:1; then g . (n + j4) <> - 1 by A1, A2, A7, A9, A17, A187, A188, A190, Lm19; then consider rn being FinSequence of NAT , RR being oriented Chain of G such that rn is_simple_vertex_seq_at g,j4,n and for i being Element of NAT st 1 <= i & i < len rn holds rn . i in UsedVx (g,n) and RR is_oriented_edge_seq_of rn and A191: RR is_shortestpath_of v1,v4, UsedVx (g,n),W and cost (RR,W) = g . ((2 * n) + j4) and A192: ( not v4 in UsedVx (g,n) implies RR islongestInShortestpath UsedVx (g,n),v1,W ) by A2, A7, A8, A187; consider PP being oriented Chain of G such that A193: PP is_shortestpath_of v1,v2, UsedVx (g,n),W and A194: cost (PP,W) <= cost (RR,W) by A181, A183, A187, A192, GRAPH_5:def_19; cost (PP,W) = cost (P,W) by A184, A193, Th9; hence cost (P,W) <= cost (R,W) by A188, A191, A194, Th9; ::_thesis: verum end; take P = P; ::_thesis: ( P is_shortestpath_of v1,v2, UsedVx (h,n),W & cost (P,W) <= cost (Q,W) ) thus P is_shortestpath_of v1,v2, UsedVx (h,n),W by A17, A24, A181, A184, A186, GRAPH_5:64; ::_thesis: cost (P,W) <= cost (Q,W) thus cost (P,W) <= cost (Q,W) by A179, A185, XXREAL_0:2; ::_thesis: verum end; end; end; hence Q islongestInShortestpath UsedVx (h,n),v1,W by GRAPH_5:def_19; ::_thesis: verum end; end; end; end; hereby ::_thesis: for m being Element of NAT st m in UsedVx (h,n) holds h . (n + m) <> - 1 let m, j be Element of NAT ; ::_thesis: ( h . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx (h,n) implies f . (((2 * n) + (n * b1)) + b2) = - 1 ) assume that A195: h . (n + j) = - 1 and A196: 1 <= j and A197: j <= n and A198: m in UsedVx (h,n) ; ::_thesis: f . (((2 * n) + (n * b1)) + b2) = - 1 set nj = n + j; A199: 1 < n + j by A196, A197, Lm12; A200: n + j <= 2 * n by A196, A197, Lm12; A201: n + j < ((n * n) + (3 * n)) + 1 by A196, A197, Lm12; then A202: n + j in dom g by A12, A19, A199, FINSEQ_3:25; n + 1 <= n + j by A196, XREAL_1:7; then A203: n < n + j by NAT_1:13; A204: now__::_thesis:_not_(findmin_n)_._g_hasBetterPathAt_n,(n_+_j)_-'_n assume (findmin n) . g hasBetterPathAt n,(n + j) -' n ; ::_thesis: contradiction then h . (n + j) = Argmin ((OuterVx (g,n)),g,n) by A14, A15, A42, A200, A202, A203, Def14; hence contradiction by A195, NAT_1:2; ::_thesis: verum end; A205: ((findmin n) . g) . (n + j) = g . (n + j) by A13, A21, A201, A203, Th18; then A206: g . (n + j) = - 1 by A14, A15, A195, A200, A202, A203, A204, Def14; then A207: not j in UsedVx (g,n) by A10; j < ((n * n) + (3 * n)) + 1 by A25, A197, XXREAL_0:2; then j in dom g by A12, A19, A196, FINSEQ_3:25; then g . j <> - 1 by A196, A197, A207; then A208: ((findmin n) . g) . j <> - 1 by A13, A22, A25, A197, A206, Th18; not (findmin n) . g hasBetterPathAt n,j by A204, NAT_D:34; then A209: ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + j) < 0 by A205, A206, A208, Def13; reconsider v3 = j as Vertex of G by A16, A196, A197, FINSEQ_1:1; set Akj = ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j; A210: 1 < ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j by A20, A21, A197, Lm13; A211: Argmin ((OuterVx (g,n)),g,n) < ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j by A20, A21, A197, Lm13; A212: ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j < ((n * n) + (3 * n)) + 1 by A20, A21, A197, Lm13; then A213: ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j in dom g by A12, A19, A210, FINSEQ_3:25; A214: (3 * n) + 1 <= ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j by A20, A21, A196, A197, Lm14; A215: ((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j <= (n * n) + (3 * n) by A20, A21, A196, A197, Lm14; A216: f . (((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j) = Weight (vk,v3,W) by A1, Def20; A217: ((findmin n) . g) /. (((2 * n) + (n * (((findmin n) . g) /. (((n * n) + (3 * n)) + 1)))) + j) = ((findmin n) . g) . (((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j) by A14, A42, A213, PARTFUN1:def_6 .= g . (((2 * n) + (n * (Argmin ((OuterVx (g,n)),g,n)))) + j) by A13, A211, A212, Th18 .= Weight (vk,v3,W) by A19, A38, A213, A214, A215, A216, Def16 ; percases ( m in {(Argmin ((OuterVx (g,n)),g,n))} or m in UsedVx (g,n) ) by A23, A198, XBOOLE_0:def_3; suppose m in {(Argmin ((OuterVx (g,n)),g,n))} ; ::_thesis: f . (((2 * n) + (n * b1)) + b2) = - 1 then A218: m = Argmin ((OuterVx (g,n)),g,n) by TARSKI:def_1; for e being set holds ( not e in the carrier' of G or not e orientedly_joins vk,v3 ) by A209, A217, Th23; then Weight (vk,v3,W) = - 1 by Def7; hence f . (((2 * n) + (n * m)) + j) = - 1 by A1, A218, Def20; ::_thesis: verum end; suppose m in UsedVx (g,n) ; ::_thesis: f . (((2 * n) + (n * b1)) + b2) = - 1 hence f . (((2 * n) + (n * m)) + j) = - 1 by A9, A196, A197, A206; ::_thesis: verum end; end; end; let m be Element of NAT ; ::_thesis: ( m in UsedVx (h,n) implies h . (n + m) <> - 1 ) assume A219: m in UsedVx (h,n) ; ::_thesis: h . (n + m) <> - 1 percases ( m in UsedVx (g,n) or m in {(Argmin ((OuterVx (g,n)),g,n))} ) by A23, A219, XBOOLE_0:def_3; supposeA220: m in UsedVx (g,n) ; ::_thesis: h . (n + m) <> - 1 then h . (n + m) = g . (n + m) by A4, A5, A6, A12, Lm16; hence h . (n + m) <> - 1 by A10, A220; ::_thesis: verum end; suppose m in {(Argmin ((OuterVx (g,n)),g,n))} ; ::_thesis: h . (n + m) <> - 1 hence h . (n + m) <> - 1 by A22, A52, TARSKI:def_1; ::_thesis: verum end; end; end; theorem :: GRAPHSP:52 for n, i being Element of NAT for f, g being Element of REAL * for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & 1 <> v2 & v2 = i & n >= 1 & g = (DijkstraAlgorithm n) . f holds ( the carrier of G = (UsedVx (g,n)) \/ (UnusedVx (g,n)) & ( v2 in UsedVx (g,n) implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) ) & ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) ) proof let n, i be Element of NAT ; ::_thesis: for f, g being Element of REAL * for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & 1 <> v2 & v2 = i & n >= 1 & g = (DijkstraAlgorithm n) . f holds ( the carrier of G = (UsedVx (g,n)) \/ (UnusedVx (g,n)) & ( v2 in UsedVx (g,n) implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) ) & ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) ) let f, g be Element of REAL * ; ::_thesis: for G being oriented finite Graph for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & 1 <> v2 & v2 = i & n >= 1 & g = (DijkstraAlgorithm n) . f holds ( the carrier of G = (UsedVx (g,n)) \/ (UnusedVx (g,n)) & ( v2 in UsedVx (g,n) implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) ) & ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) ) let G be oriented finite Graph; ::_thesis: for W being Function of the carrier' of G,Real>=0 for v1, v2 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & 1 <> v2 & v2 = i & n >= 1 & g = (DijkstraAlgorithm n) . f holds ( the carrier of G = (UsedVx (g,n)) \/ (UnusedVx (g,n)) & ( v2 in UsedVx (g,n) implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) ) & ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) ) let W be Function of the carrier' of G,Real>=0; ::_thesis: for v1, v2 being Vertex of G st f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & 1 <> v2 & v2 = i & n >= 1 & g = (DijkstraAlgorithm n) . f holds ( the carrier of G = (UsedVx (g,n)) \/ (UnusedVx (g,n)) & ( v2 in UsedVx (g,n) implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) ) & ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) ) let v1, v2 be Vertex of G; ::_thesis: ( f is_Input_of_Dijkstra_Alg G,n,W & v1 = 1 & 1 <> v2 & v2 = i & n >= 1 & g = (DijkstraAlgorithm n) . f implies ( the carrier of G = (UsedVx (g,n)) \/ (UnusedVx (g,n)) & ( v2 in UsedVx (g,n) implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) ) & ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) ) ) assume that A1: f is_Input_of_Dijkstra_Alg G,n,W and A2: v1 = 1 and A3: 1 <> v2 and A4: v2 = i and A5: n >= 1 and A6: g = (DijkstraAlgorithm n) . f ; ::_thesis: ( the carrier of G = (UsedVx (g,n)) \/ (UnusedVx (g,n)) & ( v2 in UsedVx (g,n) implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) ) & ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) ) A7: Seg n = the carrier of G by A1, Def20; then reconsider VG = the carrier of G as non empty Subset of NAT by A5; A8: f . (n + 1) = 0 by A1, Def20; set Ug = UsedVx (g,n); set Vg = UnusedVx (g,n); set R = Relax n; set M = findmin n; set RM = repeat ((Relax n) * (findmin n)); set cn = LifeSpan (((Relax n) * (findmin n)),f,n); set mi = ((n * n) + (3 * n)) + 1; A9: g = ((repeat ((Relax n) * (findmin n))) . (LifeSpan (((Relax n) * (findmin n)),f,n))) . f by A6, Def5; A10: (UsedVx (g,n)) \/ (UnusedVx (g,n)) c= VG proof let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in (UsedVx (g,n)) \/ (UnusedVx (g,n)) or x in VG ) assume A11: x in (UsedVx (g,n)) \/ (UnusedVx (g,n)) ; ::_thesis: x in VG percases ( x in UsedVx (g,n) or x in UnusedVx (g,n) ) by A11, XBOOLE_0:def_3; suppose x in UsedVx (g,n) ; ::_thesis: x in VG then ex k being Element of NAT st ( x = k & k in dom g & 1 <= k & k <= n & g . k = - 1 ) ; hence x in VG by A7, FINSEQ_1:1; ::_thesis: verum end; suppose x in UnusedVx (g,n) ; ::_thesis: x in VG then ex k being Element of NAT st ( x = k & k in dom g & 1 <= k & k <= n & g . k <> - 1 ) ; hence x in VG by A7, FINSEQ_1:1; ::_thesis: verum end; end; end; A12: len f = ((n * n) + (3 * n)) + 1 by A1, Def20; VG c= (UsedVx (g,n)) \/ (UnusedVx (g,n)) proof let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in VG or x in (UsedVx (g,n)) \/ (UnusedVx (g,n)) ) assume A13: x in VG ; ::_thesis: x in (UsedVx (g,n)) \/ (UnusedVx (g,n)) then reconsider j = x as Element of NAT ; A14: 1 <= j by A7, A13, FINSEQ_1:1; A15: j <= n by A7, A13, FINSEQ_1:1; n < ((n * n) + (3 * n)) + 1 by Lm7; then j < ((n * n) + (3 * n)) + 1 by A15, XXREAL_0:2; then j in dom f by A12, A14, FINSEQ_3:25; then A16: j in dom g by A9, Th41; percases ( g . j = - 1 or g . j <> - 1 ) ; suppose g . j = - 1 ; ::_thesis: x in (UsedVx (g,n)) \/ (UnusedVx (g,n)) then j in { k where k is Element of NAT : ( k in dom g & 1 <= k & k <= n & g . k = - 1 ) } by A14, A15, A16; hence x in (UsedVx (g,n)) \/ (UnusedVx (g,n)) by XBOOLE_0:def_3; ::_thesis: verum end; suppose g . j <> - 1 ; ::_thesis: x in (UsedVx (g,n)) \/ (UnusedVx (g,n)) then j in { k where k is Element of NAT : ( k in dom g & 1 <= k & k <= n & g . k <> - 1 ) } by A14, A15, A16; hence x in (UsedVx (g,n)) \/ (UnusedVx (g,n)) by XBOOLE_0:def_3; ::_thesis: verum end; end; end; hence A17: the carrier of G = (UsedVx (g,n)) \/ (UnusedVx (g,n)) by A10, XBOOLE_0:def_10; ::_thesis: ( ( v2 in UsedVx (g,n) implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) ) & ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) ) defpred S1[ Element of NAT ] means ( $1 <= LifeSpan (((Relax n) * (findmin n)),f,n) implies ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . $1) . f) . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . $1) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . $1) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . $1) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . $1) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . $1) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . $1) . f),n),v1,W ) ) ) & ( for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . $1) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . $1) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . $1) . f),n) holds (((repeat ((Relax n) * (findmin n))) . $1) . f) . (n + m) <> - 1 ) ) ); 1 <= ((n * n) + (3 * n)) + 1 by NAT_1:12; then A18: 1 in dom f by A12, FINSEQ_3:25; A19: ( ( for m being Element of NAT st 1 <= m & m <= n holds f . m = 1 ) & ( for m being Element of NAT st 2 <= m & m <= n holds f . (n + m) = - 1 ) ) by A1, Def20; then {1} = UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) by A5, A8, A18, Th47; then A20: 1 in UsedVx ((((repeat ((Relax n) * (findmin n))) . 1) . f),n) by TARSKI:def_1; A21: for k being Element of NAT st S1[k] holds S1[k + 1] proof let k be Element of NAT ; ::_thesis: ( S1[k] implies S1[k + 1] ) assume A22: S1[k] ; ::_thesis: S1[k + 1] now__::_thesis:_(_k_+_1_<=_LifeSpan_(((Relax_n)_*_(findmin_n)),f,n)_implies_(_(_for_v3_being_Vertex_of_G for_j_being_Element_of_NAT_st_v3_<>_v1_&_v3_=_j_&_(((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f)_._(n_+_j)_<>_-_1_holds_ ex_p_being_FinSequence_of_NAT_ex_P_being_oriented_Chain_of_G_st_ (_p_is_simple_vertex_seq_at_((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f,j,n_&_(_for_m_being_Element_of_NAT_st_1_<=_m_&_m_<_len_p_holds_ p_._m_in_UsedVx_((((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f),n)_)_&_P_is_oriented_edge_seq_of_p_&_P_is_shortestpath_of_v1,v3,_UsedVx_((((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f),n),W_&_cost_(P,W)_=_(((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f)_._((2_*_n)_+_j)_&_(_not_v3_in_UsedVx_((((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f),n)_implies_P_islongestInShortestpath_UsedVx_((((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f),n),v1,W_)_)_)_&_(_for_m,_j_being_Element_of_NAT_st_(((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f)_._(n_+_j)_=_-_1_&_1_<=_j_&_j_<=_n_&_m_in_UsedVx_((((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f),n)_holds_ f_._(((2_*_n)_+_(n_*_m))_+_j)_=_-_1_)_&_(_for_m_being_Element_of_NAT_st_m_in_UsedVx_((((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f),n)_holds_ (((repeat_((Relax_n)_*_(findmin_n)))_._(k_+_1))_._f)_._(n_+_m)_<>_-_1_)_)_) set FK1 = ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f; set UV1 = UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n); set FK = ((repeat ((Relax n) * (findmin n))) . k) . f; assume A23: k + 1 <= LifeSpan (((Relax n) * (findmin n)),f,n) ; ::_thesis: ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),v1,W ) ) ) & ( for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + m) <> - 1 ) ) then A24: k < LifeSpan (((Relax n) * (findmin n)),f,n) by NAT_1:13; then A25: OuterVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n) <> {} by Def4; percases ( k = 0 or k <> 0 ) ; suppose k = 0 ; ::_thesis: ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),v1,W ) ) ) & ( for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + m) <> - 1 ) ) hence ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),v1,W ) ) ) & ( for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + m) <> - 1 ) ) by A1, A2, A5, Lm15; ::_thesis: verum end; suppose k <> 0 ; ::_thesis: ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),v1,W ) ) ) & ( for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + m) <> - 1 ) ) then k >= 1 + 0 by INT_1:7; then 1 in UsedVx ((((repeat ((Relax n) * (findmin n))) . k) . f),n) by A20, A24, Th48; hence ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . (k + 1)) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n),v1,W ) ) ) & ( for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . (k + 1)) . f),n) holds (((repeat ((Relax n) * (findmin n))) . (k + 1)) . f) . (n + m) <> - 1 ) ) by A1, A2, A5, A22, A23, A25, Lm20, NAT_1:13; ::_thesis: verum end; end; end; hence S1[k + 1] ; ::_thesis: verum end; A26: ((repeat ((Relax n) * (findmin n))) . 0) . f = f by Th21; A27: S1[ 0 ] proof set UV = UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n); set h = ((repeat ((Relax n) * (findmin n))) . 0) . f; assume 0 <= LifeSpan (((Relax n) * (findmin n)),f,n) ; ::_thesis: ( ( for v3 being Vertex of G for j being Element of NAT st v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . 0) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . 0) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),v1,W ) ) ) & ( for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) holds (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + m) <> - 1 ) ) hereby ::_thesis: ( ( for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 ) & ( for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) holds (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + m) <> - 1 ) ) let v3 be Vertex of G; ::_thesis: for j being Element of NAT st v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + j) <> - 1 holds ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . 0) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . 0) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),v1,W ) ) let j be Element of NAT ; ::_thesis: ( v3 <> v1 & v3 = j & (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + j) <> - 1 implies ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . 0) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . 0) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),v1,W ) ) ) assume that A28: v3 <> v1 and A29: v3 = j and A30: (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + j) <> - 1 ; ::_thesis: ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . 0) . f,j,n & ( for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) ) & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),W & cost (P,W) = (((repeat ((Relax n) * (findmin n))) . 0) . f) . ((2 * n) + j) & ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) implies P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),v1,W ) ) A31: v3 in VG ; then 1 <= j by A7, A29, FINSEQ_1:1; then 1 < j by A2, A28, A29, XXREAL_0:1; then A32: 1 + 1 <= j by INT_1:7; assume for p being FinSequence of NAT for P being oriented Chain of G holds ( not p is_simple_vertex_seq_at ((repeat ((Relax n) * (findmin n))) . 0) . f,j,n or ex m being Element of NAT st ( 1 <= m & m < len p & not p . m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) ) or not P is_oriented_edge_seq_of p or not P is_shortestpath_of v1,v3, UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),W or not cost (P,W) = (((repeat ((Relax n) * (findmin n))) . 0) . f) . ((2 * n) + j) or ( not v3 in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) & not P islongestInShortestpath UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n),v1,W ) ) ; ::_thesis: contradiction j <= n by A7, A29, A31, FINSEQ_1:1; hence contradiction by A1, A26, A30, A32, Def20; ::_thesis: verum end; thus for m, j being Element of NAT st (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + j) = - 1 & 1 <= j & j <= n & m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) holds f . (((2 * n) + (n * m)) + j) = - 1 by A5, A26, A8, A19, A18, Th47; ::_thesis: for m being Element of NAT st m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) holds (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + m) <> - 1 let m be Element of NAT ; ::_thesis: ( m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) implies (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + m) <> - 1 ) assume A33: m in UsedVx ((((repeat ((Relax n) * (findmin n))) . 0) . f),n) ; ::_thesis: (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + m) <> - 1 assume (((repeat ((Relax n) * (findmin n))) . 0) . f) . (n + m) = - 1 ; ::_thesis: contradiction thus contradiction by A5, A26, A8, A19, A18, A33, Th47; ::_thesis: verum end; A34: for k being Element of NAT holds S1[k] from NAT_1:sch_1(A27, A21); ex ii being Element of NAT st ( ii <= n & OuterVx ((((repeat ((Relax n) * (findmin n))) . ii) . f),n) = {} ) by Th40; then A35: OuterVx (g,n) = {} by A9, Def4; A36: now__::_thesis:_for_v3,_v4_being_Vertex_of_G_st_v3_in_UsedVx_(g,n)_&_v4_in_UnusedVx_(g,n)_holds_ for_e_being_set_holds_ (_not_e_in_the_carrier'_of_G_or_not_e_orientedly_joins_v3,v4_) let v3, v4 be Vertex of G; ::_thesis: ( v3 in UsedVx (g,n) & v4 in UnusedVx (g,n) implies for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) ) assume that A37: v3 in UsedVx (g,n) and A38: v4 in UnusedVx (g,n) ; ::_thesis: for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) v3 in VG ; then reconsider m = v3 as Element of NAT ; consider j being Element of NAT such that A39: v4 = j and A40: j in dom g and A41: ( 1 <= j & j <= n ) and A42: g . j <> - 1 by A38; now__::_thesis:_not_g_._(n_+_j)_<>_-_1 assume g . (n + j) <> - 1 ; ::_thesis: contradiction then j in { k where k is Element of NAT : ( k in dom g & 1 <= k & k <= n & g . k <> - 1 & g . (n + k) <> - 1 ) } by A40, A41, A42; hence contradiction by A35; ::_thesis: verum end; then - 1 = f . (((2 * n) + (n * m)) + j) by A9, A34, A37, A41 .= Weight (v3,v4,W) by A1, A39, Def20 ; hence for e being set holds ( not e in the carrier' of G or not e orientedly_joins v3,v4 ) by Th23; ::_thesis: verum end; A43: f . 1 = 1 by A1, A5, Def20; now__::_thesis:_not_LifeSpan_(((Relax_n)_*_(findmin_n)),f,n)_=_0 assume A44: LifeSpan (((Relax n) * (findmin n)),f,n) = 0 ; ::_thesis: contradiction 1 in { k where k is Element of NAT : ( k in dom f & 1 <= k & k <= n & f . k <> - 1 & f . (n + k) <> - 1 ) } by A5, A43, A8, A18; hence contradiction by A9, A26, A35, A44; ::_thesis: verum end; then LifeSpan (((Relax n) * (findmin n)),f,n) >= 1 + 0 by INT_1:7; then A45: v1 in UsedVx (g,n) by A2, A9, A20, Th48; hereby ::_thesis: ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) assume v2 in UsedVx (g,n) ; ::_thesis: ex p being FinSequence of NAT ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) then g . (n + i) <> - 1 by A4, A9, A34; then consider p being FinSequence of NAT , P being oriented Chain of G such that A46: p is_simple_vertex_seq_at g,i,n and for m being Element of NAT st 1 <= m & m < len p holds p . m in UsedVx (g,n) and A47: P is_oriented_edge_seq_of p and A48: P is_shortestpath_of v1,v2, UsedVx (g,n),W and A49: cost (P,W) = g . ((2 * n) + i) and ( not v2 in UsedVx (g,n) implies P islongestInShortestpath UsedVx (g,n),v1,W ) by A2, A3, A4, A9, A34; take p = p; ::_thesis: ex P being oriented Chain of G st ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) take P = P; ::_thesis: ( p is_simple_vertex_seq_at g,i,n & P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) thus p is_simple_vertex_seq_at g,i,n by A46; ::_thesis: ( P is_oriented_edge_seq_of p & P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) thus P is_oriented_edge_seq_of p by A47; ::_thesis: ( P is_shortestpath_of v1,v2,W & cost (P,W) = g . ((2 * n) + i) ) thus P is_shortestpath_of v1,v2,W by A17, A36, A45, A48, Th16; ::_thesis: cost (P,W) = g . ((2 * n) + i) thus cost (P,W) = g . ((2 * n) + i) by A49; ::_thesis: verum end; thus ( v2 in UnusedVx (g,n) implies for Q being oriented Chain of G holds not Q is_orientedpath_of v1,v2 ) by A17, A36, A45, Th11; ::_thesis: verum end;