:: GLIB_004 semantic presentation begin Lm1: for F being Function for x, y being set holds dom (F +* (x .--> y)) = (dom F) \/ {x} proof let F be Function; ::_thesis: for x, y being set holds dom (F +* (x .--> y)) = (dom F) \/ {x} let x, y be set ; ::_thesis: dom (F +* (x .--> y)) = (dom F) \/ {x} thus dom (F +* (x .--> y)) = (dom F) \/ (dom (x .--> y)) by FUNCT_4:def_1 .= (dom F) \/ {x} by FUNCOP_1:13 ; ::_thesis: verum end; Lm2: for F being Function for x, y, z being set st z in dom (F +* (x .--> y)) & not z in dom F holds x = z proof let F be Function; ::_thesis: for x, y, z being set st z in dom (F +* (x .--> y)) & not z in dom F holds x = z let x, y, z be set ; ::_thesis: ( z in dom (F +* (x .--> y)) & not z in dom F implies x = z ) assume that A1: z in dom (F +* (x .--> y)) and A2: not z in dom F ; ::_thesis: x = z dom (x .--> y) = {x} by FUNCOP_1:13; then z in (dom F) \/ {x} by A1, FUNCT_4:def_1; then z in {x} by A2, XBOOLE_0:def_3; hence x = z by TARSKI:def_1; ::_thesis: verum end; theorem Th1: :: GLIB_004:1 for f, g being Function holds support (f +* g) c= (support f) \/ (support g) proof let f, g be Function; ::_thesis: support (f +* g) c= (support f) \/ (support g) let a be set ; :: according to TARSKI:def_3 ::_thesis: ( not a in support (f +* g) or a in (support f) \/ (support g) ) assume a in support (f +* g) ; ::_thesis: a in (support f) \/ (support g) then A1: (f +* g) . a <> 0 by PRE_POLY:def_7; assume A2: not a in (support f) \/ (support g) ; ::_thesis: contradiction then not a in support f by XBOOLE_0:def_3; then A3: f . a = 0 by PRE_POLY:def_7; not a in support g by A2, XBOOLE_0:def_3; then A4: g . a = 0 by PRE_POLY:def_7; ( a in dom g or not a in dom g ) ; hence contradiction by A1, A3, A4, FUNCT_4:11, FUNCT_4:13; ::_thesis: verum end; theorem Th2: :: GLIB_004:2 for f being Function for x, y being set holds support (f +* (x .--> y)) c= (support f) \/ {x} proof let f be Function; ::_thesis: for x, y being set holds support (f +* (x .--> y)) c= (support f) \/ {x} let x, y be set ; ::_thesis: support (f +* (x .--> y)) c= (support f) \/ {x} let a be set ; :: according to TARSKI:def_3 ::_thesis: ( not a in support (f +* (x .--> y)) or a in (support f) \/ {x} ) assume a in support (f +* (x .--> y)) ; ::_thesis: a in (support f) \/ {x} then A1: (f +* (x .--> y)) . a <> 0 by PRE_POLY:def_7; percases ( a = x or a <> x ) ; suppose a = x ; ::_thesis: a in (support f) \/ {x} then a in {x} by TARSKI:def_1; hence a in (support f) \/ {x} by XBOOLE_0:def_3; ::_thesis: verum end; suppose a <> x ; ::_thesis: a in (support f) \/ {x} then (f +* (x .--> y)) . a = f . a by FUNCT_4:83; then a in support f by A1, PRE_POLY:def_7; hence a in (support f) \/ {x} by XBOOLE_0:def_3; ::_thesis: verum end; end; end; theorem Th3: :: GLIB_004:3 for A, B being set for b being Rbag of A for b1 being Rbag of B for b2 being Rbag of A \ B st b = b1 +* b2 holds Sum b = (Sum b1) + (Sum b2) proof let A, B be set ; ::_thesis: for b being Rbag of A for b1 being Rbag of B for b2 being Rbag of A \ B st b = b1 +* b2 holds Sum b = (Sum b1) + (Sum b2) let b be Rbag of A; ::_thesis: for b1 being Rbag of B for b2 being Rbag of A \ B st b = b1 +* b2 holds Sum b = (Sum b1) + (Sum b2) let b1 be Rbag of B; ::_thesis: for b2 being Rbag of A \ B st b = b1 +* b2 holds Sum b = (Sum b1) + (Sum b2) let b2 be Rbag of A \ B; ::_thesis: ( b = b1 +* b2 implies Sum b = (Sum b1) + (Sum b2) ) assume A1: b = b1 +* b2 ; ::_thesis: Sum b = (Sum b1) + (Sum b2) dom b = (dom b1) \/ (dom b2) by A1, FUNCT_4:def_1; then dom b1 c= dom b by XBOOLE_1:7; then B c= dom b by PARTFUN1:def_2; then A2: B c= A by PARTFUN1:def_2; set B1 = (EmptyBag A) +* b1; A3: dom ((EmptyBag A) +* b1) = (dom (EmptyBag A)) \/ (dom b1) by FUNCT_4:def_1 .= A \/ (dom b1) by PARTFUN1:def_2 .= A \/ B by PARTFUN1:def_2 .= A by A2, XBOOLE_1:12 ; support ((EmptyBag A) +* b1) c= (support (EmptyBag A)) \/ (support b1) by Th1; then reconsider B1 = (EmptyBag A) +* b1 as Rbag of A by A3, PARTFUN1:def_2, PRE_POLY:def_8, RELAT_1:def_18; set B2 = (EmptyBag A) +* b2; A4: dom ((EmptyBag A) +* b2) = (dom (EmptyBag A)) \/ (dom b2) by FUNCT_4:def_1 .= A \/ (dom b2) by PARTFUN1:def_2 .= A \/ (A \ B) by PARTFUN1:def_2 .= A by XBOOLE_1:12 ; support ((EmptyBag A) +* b2) c= (support (EmptyBag A)) \/ (support b2) by Th1; then reconsider B2 = (EmptyBag A) +* b2 as Rbag of A by A4, PARTFUN1:def_2, PRE_POLY:def_8, RELAT_1:def_18; A5: now__::_thesis:_for_x_being_set_st_x_in_A_holds_ b_._x_=_(B1_+_B2)_._x let x be set ; ::_thesis: ( x in A implies b . b1 = (B1 + B2) . b1 ) assume A6: x in A ; ::_thesis: b . b1 = (B1 + B2) . b1 A7: dom b1 = B by PARTFUN1:def_2; A8: dom b2 = A \ B by PARTFUN1:def_2; percases ( x in B or not x in B ) ; supposeA9: x in B ; ::_thesis: b . b1 = (B1 + B2) . b1 then A10: B1 . x = b1 . x by A7, FUNCT_4:13; A11: not x in dom b2 by A9, XBOOLE_0:def_5; then B2 . x = (EmptyBag A) . x by FUNCT_4:11 .= 0 by PRE_POLY:52 ; hence b . x = (B1 . x) + (B2 . x) by A1, A11, A10, FUNCT_4:11 .= (B1 + B2) . x by PRE_POLY:def_5 ; ::_thesis: verum end; supposeA12: not x in B ; ::_thesis: b . b1 = (B1 + B2) . b1 then A13: B1 . x = (EmptyBag A) . x by A7, FUNCT_4:11 .= 0 by PRE_POLY:52 ; A14: x in dom b2 by A6, A8, A12, XBOOLE_0:def_5; then B2 . x = b2 . x by FUNCT_4:13; hence b . x = (B1 . x) + (B2 . x) by A1, A13, A14, FUNCT_4:13 .= (B1 + B2) . x by PRE_POLY:def_5 ; ::_thesis: verum end; end; end; consider F2 being FinSequence of REAL such that A15: Sum B2 = Sum F2 and A16: F2 = B2 * (canFS (support B2)) by UPROOTS:def_3; ( rng (canFS (support B2)) = support B2 & support B2 c= dom B2 ) by FUNCT_2:def_3, PRE_POLY:37; then A17: dom F2 = dom (canFS (support B2)) by A16, RELAT_1:27; consider F1 being FinSequence of REAL such that A18: Sum B1 = Sum F1 and A19: F1 = B1 * (canFS (support B1)) by UPROOTS:def_3; consider f1 being FinSequence of REAL such that A20: Sum b1 = Sum f1 and A21: f1 = b1 * (canFS (support b1)) by UPROOTS:def_3; A22: ( rng (canFS (support b1)) = support b1 & support b1 c= dom b1 ) by FUNCT_2:def_3, PRE_POLY:37; then A23: dom f1 = dom (canFS (support b1)) by A21, RELAT_1:27; A24: now__::_thesis:_for_x_being_set_holds_ (_(_x_in_support_b1_implies_x_in_support_B1_)_&_(_x_in_support_B1_implies_x_in_support_b1_)_) let x be set ; ::_thesis: ( ( x in support b1 implies x in support B1 ) & ( x in support B1 implies b1 in support b1 ) ) hereby ::_thesis: ( x in support B1 implies b1 in support b1 ) assume A25: x in support b1 ; ::_thesis: x in support B1 then A26: b1 . x <> 0 by PRE_POLY:def_7; support b1 c= dom b1 by PRE_POLY:37; then B1 . x = b1 . x by A25, FUNCT_4:13; hence x in support B1 by A26, PRE_POLY:def_7; ::_thesis: verum end; assume A27: x in support B1 ; ::_thesis: b1 in support b1 then A28: B1 . x <> 0 by PRE_POLY:def_7; percases ( not x in dom b1 or x in dom b1 ) ; suppose not x in dom b1 ; ::_thesis: b1 in support b1 then B1 . x = (EmptyBag A) . x by FUNCT_4:11 .= 0 by PRE_POLY:52 ; hence x in support b1 by A27, PRE_POLY:def_7; ::_thesis: verum end; suppose x in dom b1 ; ::_thesis: b1 in support b1 then B1 . x = b1 . x by FUNCT_4:13; hence x in support b1 by A28, PRE_POLY:def_7; ::_thesis: verum end; end; end; then A29: support b1 = support B1 by TARSKI:1; A30: now__::_thesis:_for_k_being_Nat_st_k_in_dom_f1_holds_ f1_._k_=_F1_._k let k be Nat; ::_thesis: ( k in dom f1 implies f1 . k = F1 . k ) assume A31: k in dom f1 ; ::_thesis: f1 . k = F1 . k A32: (canFS (support b1)) . k in rng (canFS (support b1)) by A23, A31, FUNCT_1:3; thus f1 . k = b1 . ((canFS (support b1)) . k) by A21, A23, A31, FUNCT_1:13 .= B1 . ((canFS (support b1)) . k) by A22, A32, FUNCT_4:13 .= F1 . k by A19, A23, A29, A31, FUNCT_1:13 ; ::_thesis: verum end; ( rng (canFS (support B1)) = support B1 & support B1 c= dom B1 ) by FUNCT_2:def_3, PRE_POLY:37; then dom F1 = dom (canFS (support B1)) by A19, RELAT_1:27; then dom f1 = dom F1 by A23, A24, TARSKI:1; then A33: Sum B1 = Sum b1 by A20, A18, A30, FINSEQ_1:13; consider f2 being FinSequence of REAL such that A34: Sum b2 = Sum f2 and A35: f2 = b2 * (canFS (support b2)) by UPROOTS:def_3; A36: ( rng (canFS (support b2)) = support b2 & support b2 c= dom b2 ) by FUNCT_2:def_3, PRE_POLY:37; then A37: dom f2 = dom (canFS (support b2)) by A35, RELAT_1:27; now__::_thesis:_for_x_being_set_holds_ (_(_x_in_support_b2_implies_x_in_support_B2_)_&_(_x_in_support_B2_implies_x_in_support_b2_)_) let x be set ; ::_thesis: ( ( x in support b2 implies x in support B2 ) & ( x in support B2 implies b1 in support b2 ) ) hereby ::_thesis: ( x in support B2 implies b1 in support b2 ) assume A38: x in support b2 ; ::_thesis: x in support B2 then A39: b2 . x <> 0 by PRE_POLY:def_7; support b2 c= dom b2 by PRE_POLY:37; then B2 . x = b2 . x by A38, FUNCT_4:13; hence x in support B2 by A39, PRE_POLY:def_7; ::_thesis: verum end; assume A40: x in support B2 ; ::_thesis: b1 in support b2 then A41: B2 . x <> 0 by PRE_POLY:def_7; percases ( not x in dom b2 or x in dom b2 ) ; suppose not x in dom b2 ; ::_thesis: b1 in support b2 then B2 . x = (EmptyBag A) . x by FUNCT_4:11 .= 0 by PRE_POLY:52 ; hence x in support b2 by A40, PRE_POLY:def_7; ::_thesis: verum end; suppose x in dom b2 ; ::_thesis: b1 in support b2 then B2 . x = b2 . x by FUNCT_4:13; hence x in support b2 by A41, PRE_POLY:def_7; ::_thesis: verum end; end; end; then A42: support b2 = support B2 by TARSKI:1; now__::_thesis:_for_k_being_Nat_st_k_in_dom_f2_holds_ f2_._k_=_F2_._k let k be Nat; ::_thesis: ( k in dom f2 implies f2 . k = F2 . k ) assume A43: k in dom f2 ; ::_thesis: f2 . k = F2 . k A44: (canFS (support b2)) . k in rng (canFS (support b2)) by A37, A43, FUNCT_1:3; thus f2 . k = b2 . ((canFS (support b2)) . k) by A35, A37, A43, FUNCT_1:13 .= B2 . ((canFS (support b2)) . k) by A36, A44, FUNCT_4:13 .= F2 . k by A16, A37, A42, A43, FUNCT_1:13 ; ::_thesis: verum end; then Sum B2 = Sum b2 by A34, A35, A15, A36, A17, A42, FINSEQ_1:13, RELAT_1:27; hence Sum b = (Sum b1) + (Sum b2) by A33, A5, PBOOLE:3, UPROOTS:15; ::_thesis: verum end; theorem Th4: :: GLIB_004:4 for X, x being set for b being Rbag of X st dom b = {x} holds Sum b = b . x proof let X, x be set ; ::_thesis: for b being Rbag of X st dom b = {x} holds Sum b = b . x let b be Rbag of X; ::_thesis: ( dom b = {x} implies Sum b = b . x ) assume A1: dom b = {x} ; ::_thesis: Sum b = b . x then A2: x in dom b by TARSKI:def_1; ( support b c= {x} & {x} c= X ) by A1, PRE_POLY:37; then consider f being FinSequence of REAL such that A3: f = b * (canFS {x}) and A4: Sum b = Sum f by UPROOTS:14; f = b * <*x*> by A3, UPROOTS:4; then f = <*(b . x)*> by A2, FINSEQ_2:34; hence Sum b = b . x by A4, FINSOP_1:11; ::_thesis: verum end; theorem Th5: :: GLIB_004:5 for A being set for b1, b2 being Rbag of A st ( for x being set st x in A holds b1 . x <= b2 . x ) holds Sum b1 <= Sum b2 proof let A be set ; ::_thesis: for b1, b2 being Rbag of A st ( for x being set st x in A holds b1 . x <= b2 . x ) holds Sum b1 <= Sum b2 let b1, b2 be Rbag of A; ::_thesis: ( ( for x being set st x in A holds b1 . x <= b2 . x ) implies Sum b1 <= Sum b2 ) assume A1: for x being set st x in A holds b1 . x <= b2 . x ; ::_thesis: Sum b1 <= Sum b2 set S = (support b1) \/ (support b2); A2: dom b2 = A by PARTFUN1:def_2; then A3: support b2 c= A by PRE_POLY:37; A4: dom b1 = A by PARTFUN1:def_2; then support b1 c= A by PRE_POLY:37; then reconsider S = (support b1) \/ (support b2) as finite Subset of A by A3, XBOOLE_1:8; consider f1 being FinSequence of REAL such that A5: f1 = b1 * (canFS S) and A6: Sum b1 = Sum f1 by UPROOTS:14, XBOOLE_1:7; consider f2 being FinSequence of REAL such that A7: f2 = b2 * (canFS S) and A8: Sum b2 = Sum f2 by UPROOTS:14, XBOOLE_1:7; A9: rng (canFS S) = S by FUNCT_2:def_3; then A10: dom f1 = dom (canFS S) by A4, A5, RELAT_1:27; A11: now__::_thesis:_for_j_being_Nat_st_j_in_Seg_(len_f1)_holds_ f1_._j_<=_f2_._j let j be Nat; ::_thesis: ( j in Seg (len f1) implies f1 . j <= f2 . j ) assume j in Seg (len f1) ; ::_thesis: f1 . j <= f2 . j then A12: j in dom f1 by FINSEQ_1:def_3; then A13: (canFS S) . j in S by A9, A10, FUNCT_1:3; ( f1 . j = b1 . ((canFS S) . j) & f2 . j = b2 . ((canFS S) . j) ) by A5, A7, A10, A12, FUNCT_1:13; hence f1 . j <= f2 . j by A1, A13; ::_thesis: verum end; dom f2 = dom (canFS S) by A2, A7, A9, RELAT_1:27; then A14: len f1 = len f2 by A10, FINSEQ_3:29; ( f1 is Element of (len f1) -tuples_on REAL & f2 is Element of (len f2) -tuples_on REAL ) by FINSEQ_2:92; hence Sum b1 <= Sum b2 by A6, A8, A14, A11, RVSUM_1:82; ::_thesis: verum end; theorem :: GLIB_004:6 for A being set for b1, b2 being Rbag of A st ( for x being set st x in A holds b1 . x = b2 . x ) holds Sum b1 = Sum b2 proof let A be set ; ::_thesis: for b1, b2 being Rbag of A st ( for x being set st x in A holds b1 . x = b2 . x ) holds Sum b1 = Sum b2 let b1, b2 be Rbag of A; ::_thesis: ( ( for x being set st x in A holds b1 . x = b2 . x ) implies Sum b1 = Sum b2 ) assume A1: for x being set st x in A holds b1 . x = b2 . x ; ::_thesis: Sum b1 = Sum b2 then for x being set st x in A holds b2 . x <= b1 . x ; then A2: Sum b2 <= Sum b1 by Th5; for x being set st x in A holds b1 . x <= b2 . x by A1; then Sum b1 <= Sum b2 by Th5; hence Sum b1 = Sum b2 by A2, XXREAL_0:1; ::_thesis: verum end; theorem :: GLIB_004:7 for A1, A2 being set for b1 being Rbag of A1 for b2 being Rbag of A2 st b1 = b2 holds Sum b1 = Sum b2 proof let A1, A2 be set ; ::_thesis: for b1 being Rbag of A1 for b2 being Rbag of A2 st b1 = b2 holds Sum b1 = Sum b2 let b1 be Rbag of A1; ::_thesis: for b2 being Rbag of A2 st b1 = b2 holds Sum b1 = Sum b2 let b2 be Rbag of A2; ::_thesis: ( b1 = b2 implies Sum b1 = Sum b2 ) assume b1 = b2 ; ::_thesis: Sum b1 = Sum b2 then ex f1 being FinSequence of REAL st ( Sum b1 = Sum f1 & f1 = b2 * (canFS (support b2)) ) by UPROOTS:def_3; hence Sum b1 = Sum b2 by UPROOTS:def_3; ::_thesis: verum end; theorem Th8: :: GLIB_004:8 for X, x being set for b being Rbag of X for y being real number st b = (EmptyBag X) +* (x .--> y) holds Sum b = y proof let X, x be set ; ::_thesis: for b being Rbag of X for y being real number st b = (EmptyBag X) +* (x .--> y) holds Sum b = y let b be Rbag of X; ::_thesis: for y being real number st b = (EmptyBag X) +* (x .--> y) holds Sum b = y let y be real number ; ::_thesis: ( b = (EmptyBag X) +* (x .--> y) implies Sum b = y ) assume A1: b = (EmptyBag X) +* (x .--> y) ; ::_thesis: Sum b = y ( dom (x .--> y) = {x} & dom b = (dom (EmptyBag X)) \/ (dom (x .--> y)) ) by A1, FUNCOP_1:13, FUNCT_4:def_1; then A2: {x} c= dom b by XBOOLE_1:7; then reconsider S = {x} as finite Subset of X by PARTFUN1:def_2; support b c= S proof let a be set ; :: according to TARSKI:def_3 ::_thesis: ( not a in support b or a in S ) assume a in support b ; ::_thesis: a in S then A3: b . a <> 0 by PRE_POLY:def_7; assume not a in S ; ::_thesis: contradiction then a <> x by TARSKI:def_1; then b . a = (EmptyBag X) . a by A1, FUNCT_4:83; hence contradiction by A3, PRE_POLY:52; ::_thesis: verum end; then consider f being FinSequence of REAL such that A4: f = b * (canFS S) and A5: Sum b = Sum f by UPROOTS:14; {x} c= X by A2, PARTFUN1:def_2; then x in X by ZFMISC_1:31; then ( canFS S = <*x*> & x in dom b ) by PARTFUN1:def_2, UPROOTS:4; then f = <*(b . x)*> by A4, FINSEQ_2:34; hence Sum b = b . x by A5, FINSOP_1:11 .= y by A1, FUNCT_7:94 ; ::_thesis: verum end; theorem :: GLIB_004:9 for X, x being set for b1, b2 being Rbag of X for y being real number st b2 = b1 +* (x .--> y) holds Sum b2 = ((Sum b1) + y) - (b1 . x) proof let X, x be set ; ::_thesis: for b1, b2 being Rbag of X for y being real number st b2 = b1 +* (x .--> y) holds Sum b2 = ((Sum b1) + y) - (b1 . x) let b1, b2 be Rbag of X; ::_thesis: for y being real number st b2 = b1 +* (x .--> y) holds Sum b2 = ((Sum b1) + y) - (b1 . x) let y be real number ; ::_thesis: ( b2 = b1 +* (x .--> y) implies Sum b2 = ((Sum b1) + y) - (b1 . x) ) assume A1: b2 = b1 +* (x .--> y) ; ::_thesis: Sum b2 = ((Sum b1) + y) - (b1 . x) ( dom (x .--> y) = {x} & dom b2 = (dom b1) \/ (dom (x .--> y)) ) by A1, FUNCOP_1:13, FUNCT_4:def_1; then {x} c= dom b2 by XBOOLE_1:7; then {x} c= X by PARTFUN1:def_2; then A2: x in X by ZFMISC_1:31; set c = (EmptyBag X) +* (x .--> y); A3: dom ((EmptyBag X) +* (x .--> y)) = (dom (EmptyBag X)) \/ (dom (x .--> y)) by FUNCT_4:def_1 .= X \/ (dom (x .--> y)) by PARTFUN1:def_2 .= X \/ {x} by FUNCOP_1:13 .= X by A2, ZFMISC_1:40 ; set a = b1 +* (x .--> 0); A4: dom (b1 +* (x .--> 0)) = (dom b1) \/ (dom (x .--> 0)) by FUNCT_4:def_1 .= X \/ (dom (x .--> 0)) by PARTFUN1:def_2 .= X \/ {x} by FUNCOP_1:13 .= X by A2, ZFMISC_1:40 ; set b = (EmptyBag X) +* (x .--> (b1 . x)); A5: dom ((EmptyBag X) +* (x .--> (b1 . x))) = (dom (EmptyBag X)) \/ (dom (x .--> (b1 . x))) by FUNCT_4:def_1 .= X \/ (dom (x .--> (b1 . x))) by PARTFUN1:def_2 .= X \/ {x} by FUNCOP_1:13 .= X by A2, ZFMISC_1:40 ; support ((EmptyBag X) +* (x .--> (b1 . x))) c= (support (EmptyBag X)) \/ {x} by Th2; then reconsider b = (EmptyBag X) +* (x .--> (b1 . x)) as Rbag of X by A5, PARTFUN1:def_2, PRE_POLY:def_8, RELAT_1:def_18; support (b1 +* (x .--> 0)) c= (support b1) \/ {x} by Th2; then reconsider a = b1 +* (x .--> 0) as Rbag of X by A4, PARTFUN1:def_2, PRE_POLY:def_8, RELAT_1:def_18; support ((EmptyBag X) +* (x .--> y)) c= (support (EmptyBag X)) \/ {x} by Th2; then reconsider c = (EmptyBag X) +* (x .--> y) as Rbag of X by A3, PARTFUN1:def_2, PRE_POLY:def_8, RELAT_1:def_18; now__::_thesis:_for_i_being_set_st_i_in_X_holds_ (a_+_b)_._i_=_b1_._i let i be set ; ::_thesis: ( i in X implies (a + b) . b1 = b1 . b1 ) assume i in X ; ::_thesis: (a + b) . b1 = b1 . b1 A6: (EmptyBag X) . i = 0 by PRE_POLY:52; percases ( i = x or i <> x ) ; supposeA7: i = x ; ::_thesis: (a + b) . b1 = b1 . b1 thus (a + b) . i = (a . i) + (b . i) by PRE_POLY:def_5 .= 0 + (b . i) by A7, FUNCT_7:94 .= b1 . i by A7, FUNCT_7:94 ; ::_thesis: verum end; supposeA8: i <> x ; ::_thesis: (a + b) . b1 = b1 . b1 thus (a + b) . i = (a . i) + (b . i) by PRE_POLY:def_5 .= (b1 . i) + (b . i) by A8, FUNCT_4:83 .= (b1 . i) + 0 by A6, A8, FUNCT_4:83 .= b1 . i ; ::_thesis: verum end; end; end; then A9: (Sum b1) - (Sum b) = ((Sum a) + (Sum b)) - (Sum b) by PBOOLE:3, UPROOTS:15; A10: ( Sum c = y & Sum b = b1 . x ) by Th8; now__::_thesis:_for_i_being_set_st_i_in_X_holds_ b2_._i_=_(a_+_c)_._i let i be set ; ::_thesis: ( i in X implies b2 . b1 = (a + c) . b1 ) assume i in X ; ::_thesis: b2 . b1 = (a + c) . b1 A11: (EmptyBag X) . i = 0 by PRE_POLY:52; percases ( i = x or i <> x ) ; supposeA12: i = x ; ::_thesis: b2 . b1 = (a + c) . b1 hence b2 . i = y by A1, FUNCT_7:94 .= 0 + (c . i) by A12, FUNCT_7:94 .= (a . i) + (c . i) by A12, FUNCT_7:94 .= (a + c) . i by PRE_POLY:def_5 ; ::_thesis: verum end; supposeA13: i <> x ; ::_thesis: b2 . b1 = (a + c) . b1 then A14: c . i = 0 by A11, FUNCT_4:83; thus b2 . i = b1 . i by A1, A13, FUNCT_4:83 .= (a . i) + (c . i) by A13, A14, FUNCT_4:83 .= (a + c) . i by PRE_POLY:def_5 ; ::_thesis: verum end; end; end; hence Sum b2 = ((Sum b1) - (Sum b)) + (Sum c) by A9, PBOOLE:3, UPROOTS:15 .= ((Sum b1) + y) - (b1 . x) by A10 ; ::_thesis: verum end; begin definition let G1 be real-weighted WGraph; let G2 be WSubgraph of G1; let v be set ; predG2 is_mincost_DTree_rooted_at v means :Def1: :: GLIB_004:def 1 ( G2 is Tree-like & ( for x being Vertex of G2 ex W2 being DPath of G2 st ( W2 is_Walk_from v,x & ( for W1 being DPath of G1 st W1 is_Walk_from v,x holds W2 .cost() <= W1 .cost() ) ) ) ); end; :: deftheorem Def1 defines is_mincost_DTree_rooted_at GLIB_004:def_1_:_ for G1 being real-weighted WGraph for G2 being WSubgraph of G1 for v being set holds ( G2 is_mincost_DTree_rooted_at v iff ( G2 is Tree-like & ( for x being Vertex of G2 ex W2 being DPath of G2 st ( W2 is_Walk_from v,x & ( for W1 being DPath of G1 st W1 is_Walk_from v,x holds W2 .cost() <= W1 .cost() ) ) ) ) ); definition let G be real-weighted WGraph; let W be DPath of G; let x, y be set ; predW is_mincost_DPath_from x,y means :Def2: :: GLIB_004:def 2 ( W is_Walk_from x,y & ( for W2 being DPath of G st W2 is_Walk_from x,y holds W .cost() <= W2 .cost() ) ); end; :: deftheorem Def2 defines is_mincost_DPath_from GLIB_004:def_2_:_ for G being real-weighted WGraph for W being DPath of G for x, y being set holds ( W is_mincost_DPath_from x,y iff ( W is_Walk_from x,y & ( for W2 being DPath of G st W2 is_Walk_from x,y holds W .cost() <= W2 .cost() ) ) ); definition let G be finite real-weighted WGraph; let x, y be set ; funcG .min_DPath_cost (x,y) -> Real means :Def3: :: GLIB_004:def 3 ex W being DPath of G st ( W is_mincost_DPath_from x,y & it = W .cost() ) if ex W being DWalk of G st W is_Walk_from x,y otherwise it = 0 ; existence ( ( ex W being DWalk of G st W is_Walk_from x,y implies ex b1 being Real ex W being DPath of G st ( W is_mincost_DPath_from x,y & b1 = W .cost() ) ) & ( ( for W being DWalk of G holds not W is_Walk_from x,y ) implies ex b1 being Real st b1 = 0 ) ) proof set X = { W where W is DPath of G : W is_Walk_from x,y } ; now__::_thesis:_for_e_being_set_st_e_in__{__W_where_W_is_DPath_of_G_:_W_is_Walk_from_x,y__}__holds_ e_in_G_.allDPaths() let e be set ; ::_thesis: ( e in { W where W is DPath of G : W is_Walk_from x,y } implies e in G .allDPaths() ) assume e in { W where W is DPath of G : W is_Walk_from x,y } ; ::_thesis: e in G .allDPaths() then ex W being DPath of G st ( e = W & W is_Walk_from x,y ) ; then e in { w where w is DPath of G : verum } ; hence e in G .allDPaths() by GLIB_001:def_38; ::_thesis: verum end; then reconsider X = { W where W is DPath of G : W is_Walk_from x,y } as finite Subset of (G .allDPaths()) by TARSKI:def_3; hereby ::_thesis: ( ( for W being DWalk of G holds not W is_Walk_from x,y ) implies ex b1 being Real st b1 = 0 ) assume ex W being DWalk of G st W is_Walk_from x,y ; ::_thesis: ex IT being Element of REAL ex WA being DPath of G st ( WA is_mincost_DPath_from x,y & IT = WA .cost() ) then consider W being DWalk of G such that A1: W is_Walk_from x,y ; set P = the DPath of W; the DPath of W is_Walk_from x,y by A1, GLIB_001:160; then the DPath of W in X ; then reconsider X = X as non empty finite Subset of (G .allDPaths()) ; deffunc H1( Element of X) -> Element of REAL = $1 .cost() ; consider W1 being Element of X such that A2: for W2 being Element of X holds H1(W1) <= H1(W2) from GRAPH_5:sch_2(); W1 in X ; then consider WA being DPath of G such that A3: WA = W1 and A4: WA is_Walk_from x,y ; A5: now__::_thesis:_for_WB_being_DPath_of_G_st_WB_is_Walk_from_x,y_holds_ WA_.cost()_<=_WB_.cost() let WB be DPath of G; ::_thesis: ( WB is_Walk_from x,y implies WA .cost() <= WB .cost() ) assume WB is_Walk_from x,y ; ::_thesis: WA .cost() <= WB .cost() then WB in X ; then reconsider WB9 = WB as Element of X ; H1(W1) <= H1(WB9) by A2; hence WA .cost() <= WB .cost() by A3; ::_thesis: verum end; reconsider WA = WA as DPath of G ; set IT = WA .cost() ; take IT = WA .cost() ; ::_thesis: ex WA being DPath of G st ( WA is_mincost_DPath_from x,y & IT = WA .cost() ) take WA = WA; ::_thesis: ( WA is_mincost_DPath_from x,y & IT = WA .cost() ) thus WA is_mincost_DPath_from x,y by A4, A5, Def2; ::_thesis: IT = WA .cost() thus IT = WA .cost() ; ::_thesis: verum end; thus ( ( for W being DWalk of G holds not W is_Walk_from x,y ) implies ex b1 being Real st b1 = 0 ) ; ::_thesis: verum end; uniqueness for b1, b2 being Real holds ( ( ex W being DWalk of G st W is_Walk_from x,y & ex W being DPath of G st ( W is_mincost_DPath_from x,y & b1 = W .cost() ) & ex W being DPath of G st ( W is_mincost_DPath_from x,y & b2 = W .cost() ) implies b1 = b2 ) & ( ( for W being DWalk of G holds not W is_Walk_from x,y ) & b1 = 0 & b2 = 0 implies b1 = b2 ) ) proof let IT1, IT2 be Real; ::_thesis: ( ( ex W being DWalk of G st W is_Walk_from x,y & ex W being DPath of G st ( W is_mincost_DPath_from x,y & IT1 = W .cost() ) & ex W being DPath of G st ( W is_mincost_DPath_from x,y & IT2 = W .cost() ) implies IT1 = IT2 ) & ( ( for W being DWalk of G holds not W is_Walk_from x,y ) & IT1 = 0 & IT2 = 0 implies IT1 = IT2 ) ) hereby ::_thesis: ( ( for W being DWalk of G holds not W is_Walk_from x,y ) & IT1 = 0 & IT2 = 0 implies IT1 = IT2 ) assume ex W being DWalk of G st W is_Walk_from x,y ; ::_thesis: ( ex W1 being DPath of G st ( W1 is_mincost_DPath_from x,y & IT1 = W1 .cost() ) & ex W2 being DPath of G st ( W2 is_mincost_DPath_from x,y & IT2 = W2 .cost() ) implies IT1 = IT2 ) given W1 being DPath of G such that A6: W1 is_mincost_DPath_from x,y and A7: IT1 = W1 .cost() ; ::_thesis: ( ex W2 being DPath of G st ( W2 is_mincost_DPath_from x,y & IT2 = W2 .cost() ) implies IT1 = IT2 ) given W2 being DPath of G such that A8: W2 is_mincost_DPath_from x,y and A9: IT2 = W2 .cost() ; ::_thesis: IT1 = IT2 W2 is_Walk_from x,y by A8, Def2; then A10: IT1 <= IT2 by A6, A7, A9, Def2; W1 is_Walk_from x,y by A6, Def2; then IT2 <= IT1 by A7, A8, A9, Def2; hence IT1 = IT2 by A10, XXREAL_0:1; ::_thesis: verum end; thus ( ( for W being DWalk of G holds not W is_Walk_from x,y ) & IT1 = 0 & IT2 = 0 implies IT1 = IT2 ) ; ::_thesis: verum end; consistency for b1 being Real holds verum ; end; :: deftheorem Def3 defines .min_DPath_cost GLIB_004:def_3_:_ for G being finite real-weighted WGraph for x, y being set for b4 being Real holds ( ( ex W being DWalk of G st W is_Walk_from x,y implies ( b4 = G .min_DPath_cost (x,y) iff ex W being DPath of G st ( W is_mincost_DPath_from x,y & b4 = W .cost() ) ) ) & ( ( for W being DWalk of G holds not W is_Walk_from x,y ) implies ( b4 = G .min_DPath_cost (x,y) iff b4 = 0 ) ) ); definition func WGraphSelectors -> non empty finite Subset of NAT equals :: GLIB_004:def 4 {VertexSelector,EdgeSelector,SourceSelector,TargetSelector,WeightSelector}; coherence {VertexSelector,EdgeSelector,SourceSelector,TargetSelector,WeightSelector} is non empty finite Subset of NAT ; end; :: deftheorem defines WGraphSelectors GLIB_004:def_4_:_ WGraphSelectors = {VertexSelector,EdgeSelector,SourceSelector,TargetSelector,WeightSelector}; Lm3: for G being WGraph holds WGraphSelectors c= dom G proof let G be WGraph; ::_thesis: WGraphSelectors c= dom G now__::_thesis:_for_x_being_set_st_x_in_WGraphSelectors_holds_ x_in_dom_G let x be set ; ::_thesis: ( x in WGraphSelectors implies x in dom G ) assume x in WGraphSelectors ; ::_thesis: x in dom G then ( x = VertexSelector or x = EdgeSelector or x = SourceSelector or x = TargetSelector or x = WeightSelector ) by ENUMSET1:def_3; hence x in dom G by GLIB_000:def_10, GLIB_003:def_4; ::_thesis: verum end; hence WGraphSelectors c= dom G by TARSKI:def_3; ::_thesis: verum end; registration let G be WGraph; clusterG | WGraphSelectors -> [Graph-like] [Weighted] ; coherence ( G | WGraphSelectors is [Graph-like] & G | WGraphSelectors is [Weighted] ) proof set G2 = G | WGraphSelectors; A1: VertexSelector in WGraphSelectors by ENUMSET1:def_3; A2: TargetSelector in WGraphSelectors by ENUMSET1:def_3; then A3: the_Target_of (G | WGraphSelectors) = the_Target_of G by FUNCT_1:49; A4: SourceSelector in WGraphSelectors by ENUMSET1:def_3; then A5: the_Source_of (G | WGraphSelectors) = the_Source_of G by FUNCT_1:49; A6: EdgeSelector in WGraphSelectors by ENUMSET1:def_3; then A7: the_Edges_of (G | WGraphSelectors) = the_Edges_of G by FUNCT_1:49; A8: dom (G | WGraphSelectors) = (dom G) /\ WGraphSelectors by RELAT_1:61 .= WGraphSelectors by Lm3, XBOOLE_1:28 ; then for x being set st x in _GraphSelectors holds x in dom (G | WGraphSelectors) by A1, A6, A4, A2, ENUMSET1:def_2; then A9: _GraphSelectors c= dom (G | WGraphSelectors) by TARSKI:def_3; the_Vertices_of (G | WGraphSelectors) = the_Vertices_of G by A1, FUNCT_1:49; hence G | WGraphSelectors is [Graph-like] by A7, A5, A3, A9, GLIB_000:5; ::_thesis: G | WGraphSelectors is [Weighted] A10: WeightSelector in WGraphSelectors by ENUMSET1:def_3; then (G | WGraphSelectors) . WeightSelector = G . WeightSelector by FUNCT_1:49; then (G | WGraphSelectors) . WeightSelector is ManySortedSet of the_Edges_of (G | WGraphSelectors) by A7, GLIB_003:def_4; hence G | WGraphSelectors is [Weighted] by A8, A10, GLIB_003:def_4; ::_thesis: verum end; end; Lm4: for G being WGraph holds ( G == G | WGraphSelectors & the_Weight_of G = the_Weight_of (G | WGraphSelectors) ) proof let G be WGraph; ::_thesis: ( G == G | WGraphSelectors & the_Weight_of G = the_Weight_of (G | WGraphSelectors) ) set G2 = G | WGraphSelectors; EdgeSelector in WGraphSelectors by ENUMSET1:def_3; then A1: the_Edges_of (G | WGraphSelectors) = the_Edges_of G by FUNCT_1:49; SourceSelector in WGraphSelectors by ENUMSET1:def_3; then A2: the_Source_of (G | WGraphSelectors) = the_Source_of G by FUNCT_1:49; TargetSelector in WGraphSelectors by ENUMSET1:def_3; then A3: the_Target_of (G | WGraphSelectors) = the_Target_of G by FUNCT_1:49; VertexSelector in WGraphSelectors by ENUMSET1:def_3; then the_Vertices_of (G | WGraphSelectors) = the_Vertices_of G by FUNCT_1:49; hence G == G | WGraphSelectors by A1, A2, A3, GLIB_000:def_34; ::_thesis: the_Weight_of G = the_Weight_of (G | WGraphSelectors) WeightSelector in WGraphSelectors by ENUMSET1:def_3; hence the_Weight_of G = the_Weight_of (G | WGraphSelectors) by FUNCT_1:49; ::_thesis: verum end; Lm5: for G being WGraph holds dom (G | WGraphSelectors) = WGraphSelectors proof let G be WGraph; ::_thesis: dom (G | WGraphSelectors) = WGraphSelectors WGraphSelectors c= dom G by Lm3; hence dom (G | WGraphSelectors) = WGraphSelectors by RELAT_1:62; ::_thesis: verum end; definition let G be WGraph; funcG .allWSubgraphs() -> non empty set means :Def5: :: GLIB_004:def 5 for x being set holds ( x in it iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ); existence ex b1 being non empty set st for x being set holds ( x in b1 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) proof set G9 = G | WGraphSelectors; A1: G == G | WGraphSelectors by Lm4; A2: the_Weight_of G = the_Weight_of (G | WGraphSelectors) by Lm4; reconsider G9 = G | WGraphSelectors as [Weighted] Subgraph of G by A1, GLIB_000:87; dom (the_Weight_of G) = the_Edges_of G9 by A2, PARTFUN1:def_2; then the_Weight_of G9 = (the_Weight_of G) | (the_Edges_of G9) by A2, RELAT_1:69; then reconsider G9 = G9 as WSubgraph of G by GLIB_003:def_10; set Z = {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))}; set Y = union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))}; set X = Funcs (WGraphSelectors,(union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))})); defpred S1[ set ] means $1 is WSubgraph of G; consider IT being Subset of (Funcs (WGraphSelectors,(union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))}))) such that A3: for x being set holds ( x in IT iff ( x in Funcs (WGraphSelectors,(union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))})) & S1[x] ) ) from SUBSET_1:sch_1(); A4: now__::_thesis:_for_G2_being_WSubgraph_of_G_st_dom_G2_=_WGraphSelectors_holds_ rng_G2_c=_union_{(bool_(the_Vertices_of_G)),(bool_(the_Edges_of_G)),(bool_(the_Source_of_G)),(bool_(the_Target_of_G)),(bool_(the_Weight_of_G))} let G2 be WSubgraph of G; ::_thesis: ( dom G2 = WGraphSelectors implies rng G2 c= union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} ) assume A5: dom G2 = WGraphSelectors ; ::_thesis: rng G2 c= union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} now__::_thesis:_for_y_being_set_st_y_in_rng_G2_holds_ y_in_union_{(bool_(the_Vertices_of_G)),(bool_(the_Edges_of_G)),(bool_(the_Source_of_G)),(bool_(the_Target_of_G)),(bool_(the_Weight_of_G))} let y be set ; ::_thesis: ( y in rng G2 implies y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} ) assume y in rng G2 ; ::_thesis: y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} then consider x being set such that A6: x in WGraphSelectors and A7: G2 . x = y by A5, FUNCT_1:def_3; now__::_thesis:_y_in_union_{(bool_(the_Vertices_of_G)),(bool_(the_Edges_of_G)),(bool_(the_Source_of_G)),(bool_(the_Target_of_G)),(bool_(the_Weight_of_G))} percases ( x = VertexSelector or x = EdgeSelector or x = SourceSelector or x = TargetSelector or x = WeightSelector ) by A6, ENUMSET1:def_3; supposeA8: x = VertexSelector ; ::_thesis: y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} A9: bool (the_Vertices_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; y = the_Vertices_of G2 by A7, A8; hence y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by A9, TARSKI:def_4; ::_thesis: verum end; supposeA10: x = EdgeSelector ; ::_thesis: y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} A11: bool (the_Edges_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; y = the_Edges_of G2 by A7, A10; hence y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by A11, TARSKI:def_4; ::_thesis: verum end; suppose x = SourceSelector ; ::_thesis: y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} then y = the_Source_of G2 by A7; then y = (the_Source_of G) | (the_Edges_of G2) by GLIB_000:45; then A12: y c= the_Source_of G by RELAT_1:59; bool (the_Source_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; hence y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by A12, TARSKI:def_4; ::_thesis: verum end; suppose x = TargetSelector ; ::_thesis: y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} then y = the_Target_of G2 by A7; then y = (the_Target_of G) | (the_Edges_of G2) by GLIB_000:45; then A13: y c= the_Target_of G by RELAT_1:59; bool (the_Target_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; hence y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by A13, TARSKI:def_4; ::_thesis: verum end; suppose x = WeightSelector ; ::_thesis: y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} then y = the_Weight_of G2 by A7; then y = (the_Weight_of G) | (the_Edges_of G2) by GLIB_003:def_10; then A14: y c= the_Weight_of G by RELAT_1:59; bool (the_Weight_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; hence y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by A14, TARSKI:def_4; ::_thesis: verum end; end; end; hence y in union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} ; ::_thesis: verum end; hence rng G2 c= union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by TARSKI:def_3; ::_thesis: verum end; A15: dom G9 = WGraphSelectors by Lm5; then rng G9 c= union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by A4; then G9 in Funcs (WGraphSelectors,(union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))})) by A15, FUNCT_2:def_2; then reconsider IT = IT as non empty set by A3; take IT ; ::_thesis: for x being set holds ( x in IT iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) let x be set ; ::_thesis: ( x in IT iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) hereby ::_thesis: ( ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) implies x in IT ) assume A16: x in IT ; ::_thesis: ex x9 being WSubgraph of G st ( x9 = x & dom x9 = WGraphSelectors ) then reconsider x9 = x as WSubgraph of G by A3; take x9 = x9; ::_thesis: ( x9 = x & dom x9 = WGraphSelectors ) thus x9 = x ; ::_thesis: dom x9 = WGraphSelectors ex f being Function st ( f = x & dom f = WGraphSelectors & rng f c= union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} ) by A16, FUNCT_2:def_2; hence dom x9 = WGraphSelectors ; ::_thesis: verum end; given G2 being WSubgraph of G such that A17: G2 = x and A18: dom G2 = WGraphSelectors ; ::_thesis: x in IT rng G2 c= union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by A4, A18; then x in Funcs (WGraphSelectors,(union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))})) by A17, A18, FUNCT_2:def_2; hence x in IT by A3, A17; ::_thesis: verum end; uniqueness for b1, b2 being non empty set st ( for x being set holds ( x in b1 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) ) & ( for x being set holds ( x in b2 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) ) holds b1 = b2 proof let IT1, IT2 be non empty set ; ::_thesis: ( ( for x being set holds ( x in IT1 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) ) & ( for x being set holds ( x in IT2 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) ) implies IT1 = IT2 ) assume that A19: for x being set holds ( x in IT1 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) and A20: for x being set holds ( x in IT2 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) ; ::_thesis: IT1 = IT2 now__::_thesis:_for_x_being_set_holds_ (_x_in_IT1_iff_x_in_IT2_) let x be set ; ::_thesis: ( x in IT1 iff x in IT2 ) ( x in IT1 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) by A19; hence ( x in IT1 iff x in IT2 ) by A20; ::_thesis: verum end; hence IT1 = IT2 by TARSKI:1; ::_thesis: verum end; end; :: deftheorem Def5 defines .allWSubgraphs() GLIB_004:def_5_:_ for G being WGraph for b2 being non empty set holds ( b2 = G .allWSubgraphs() iff for x being set holds ( x in b2 iff ex G2 being WSubgraph of G st ( x = G2 & dom G2 = WGraphSelectors ) ) ); registration let G be finite WGraph; clusterG .allWSubgraphs() -> non empty finite ; coherence G .allWSubgraphs() is finite proof set Z = {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))}; set Y = union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))}; for x being set st x in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} holds x is finite by ENUMSET1:def_3; then reconsider Y = union {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} as finite set by FINSET_1:7; set X = Funcs (WGraphSelectors,Y); now__::_thesis:_for_x_being_set_st_x_in_G_.allWSubgraphs()_holds_ x_in_Funcs_(WGraphSelectors,Y) let x be set ; ::_thesis: ( x in G .allWSubgraphs() implies x in Funcs (WGraphSelectors,Y) ) assume x in G .allWSubgraphs() ; ::_thesis: x in Funcs (WGraphSelectors,Y) then consider G2 being WSubgraph of G such that A1: x = G2 and A2: dom G2 = WGraphSelectors by Def5; now__::_thesis:_for_y_being_set_st_y_in_rng_G2_holds_ y_in_Y let y be set ; ::_thesis: ( y in rng G2 implies y in Y ) assume y in rng G2 ; ::_thesis: y in Y then consider x being set such that A3: x in WGraphSelectors and A4: G2 . x = y by A2, FUNCT_1:def_3; now__::_thesis:_y_in_Y percases ( x = VertexSelector or x = EdgeSelector or x = SourceSelector or x = TargetSelector or x = WeightSelector ) by A3, ENUMSET1:def_3; supposeA5: x = VertexSelector ; ::_thesis: y in Y A6: bool (the_Vertices_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; y = the_Vertices_of G2 by A4, A5; hence y in Y by A6, TARSKI:def_4; ::_thesis: verum end; supposeA7: x = EdgeSelector ; ::_thesis: y in Y A8: bool (the_Edges_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; y = the_Edges_of G2 by A4, A7; hence y in Y by A8, TARSKI:def_4; ::_thesis: verum end; suppose x = SourceSelector ; ::_thesis: y in Y then y = the_Source_of G2 by A4; then y = (the_Source_of G) | (the_Edges_of G2) by GLIB_000:45; then A9: y c= the_Source_of G by RELAT_1:59; bool (the_Source_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; hence y in Y by A9, TARSKI:def_4; ::_thesis: verum end; suppose x = TargetSelector ; ::_thesis: y in Y then y = the_Target_of G2 by A4; then y = (the_Target_of G) | (the_Edges_of G2) by GLIB_000:45; then A10: y c= the_Target_of G by RELAT_1:59; bool (the_Target_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; hence y in Y by A10, TARSKI:def_4; ::_thesis: verum end; suppose x = WeightSelector ; ::_thesis: y in Y then y = the_Weight_of G2 by A4; then y = (the_Weight_of G) | (the_Edges_of G2) by GLIB_003:def_10; then A11: y c= the_Weight_of G by RELAT_1:59; bool (the_Weight_of G) in {(bool (the_Vertices_of G)),(bool (the_Edges_of G)),(bool (the_Source_of G)),(bool (the_Target_of G)),(bool (the_Weight_of G))} by ENUMSET1:def_3; hence y in Y by A11, TARSKI:def_4; ::_thesis: verum end; end; end; hence y in Y ; ::_thesis: verum end; then rng G2 c= Y by TARSKI:def_3; hence x in Funcs (WGraphSelectors,Y) by A1, A2, FUNCT_2:def_2; ::_thesis: verum end; then G .allWSubgraphs() c= Funcs (WGraphSelectors,Y) by TARSKI:def_3; hence G .allWSubgraphs() is finite ; ::_thesis: verum end; end; definition let G be WGraph; let X be non empty Subset of (G .allWSubgraphs()); :: original: Element redefine mode Element of X -> WSubgraph of G; coherence for b1 being Element of X holds b1 is WSubgraph of G proof let x be Element of X; ::_thesis: x is WSubgraph of G ex G2 being WSubgraph of G st ( G2 = x & dom G2 = WGraphSelectors ) by Def5; hence x is WSubgraph of G ; ::_thesis: verum end; end; definition let G be finite real-weighted WGraph; funcG .cost() -> Real equals :: GLIB_004:def 6 Sum (the_Weight_of G); coherence Sum (the_Weight_of G) is Real by XREAL_0:def_1; end; :: deftheorem defines .cost() GLIB_004:def_6_:_ for G being finite real-weighted WGraph holds G .cost() = Sum (the_Weight_of G); theorem Th10: :: GLIB_004:10 for G1 being finite real-weighted WGraph for e being set for G2 being [Weighted] weight-inheriting removeEdge of G1,e st e in the_Edges_of G1 holds G1 .cost() = (G2 .cost()) + ((the_Weight_of G1) . e) proof let G1 be finite real-weighted WGraph; ::_thesis: for e being set for G2 being [Weighted] weight-inheriting removeEdge of G1,e st e in the_Edges_of G1 holds G1 .cost() = (G2 .cost()) + ((the_Weight_of G1) . e) let e be set ; ::_thesis: for G2 being [Weighted] weight-inheriting removeEdge of G1,e st e in the_Edges_of G1 holds G1 .cost() = (G2 .cost()) + ((the_Weight_of G1) . e) let G2 be [Weighted] weight-inheriting removeEdge of G1,e; ::_thesis: ( e in the_Edges_of G1 implies G1 .cost() = (G2 .cost()) + ((the_Weight_of G1) . e) ) set EG1 = the_Edges_of G1; set EG2 = the_Edges_of G2; assume A1: e in the_Edges_of G1 ; ::_thesis: G1 .cost() = (G2 .cost()) + ((the_Weight_of G1) . e) A2: dom (the_Weight_of G1) = the_Edges_of G1 by PARTFUN1:def_2; set b2 = e .--> ((the_Weight_of G1) . e); A3: dom (e .--> ((the_Weight_of G1) . e)) = {e} by FUNCOP_1:13; A4: the_Edges_of G2 = (the_Edges_of G1) \ {e} by GLIB_000:51; then (the_Edges_of G1) \ (the_Edges_of G2) = (the_Edges_of G1) /\ {e} by XBOOLE_1:48 .= {e} by A1, ZFMISC_1:46 ; then reconsider b2 = e .--> ((the_Weight_of G1) . e) as ManySortedSet of (the_Edges_of G1) \ (the_Edges_of G2) ; reconsider b2 = b2 as Rbag of (the_Edges_of G1) \ (the_Edges_of G2) ; A5: the_Weight_of G2 = (the_Weight_of G1) | (the_Edges_of G2) by GLIB_003:def_10; A6: now__::_thesis:_for_x_being_set_st_x_in_dom_(the_Weight_of_G1)_holds_ (the_Weight_of_G1)_._x_=_((the_Weight_of_G2)_+*_b2)_._x let x be set ; ::_thesis: ( x in dom (the_Weight_of G1) implies (the_Weight_of G1) . x = ((the_Weight_of G2) +* b2) . x ) assume x in dom (the_Weight_of G1) ; ::_thesis: (the_Weight_of G1) . x = ((the_Weight_of G2) +* b2) . x then A7: x in the_Edges_of G1 ; now__::_thesis:_((the_Weight_of_G2)_+*_b2)_._x_=_(the_Weight_of_G1)_._x percases ( x in {e} or not x in {e} ) ; supposeA8: x in {e} ; ::_thesis: ((the_Weight_of G2) +* b2) . x = (the_Weight_of G1) . x then A9: x = e by TARSKI:def_1; hence ((the_Weight_of G2) +* b2) . x = b2 . e by A3, A8, FUNCT_4:13 .= (the_Weight_of G1) . x by A9, FUNCOP_1:72 ; ::_thesis: verum end; suppose not x in {e} ; ::_thesis: ((the_Weight_of G2) +* b2) . x = (the_Weight_of G1) . x then ( ((the_Weight_of G2) +* b2) . x = (the_Weight_of G2) . x & x in (the_Edges_of G1) \ {e} ) by A3, A7, FUNCT_4:11, XBOOLE_0:def_5; hence ((the_Weight_of G2) +* b2) . x = (the_Weight_of G1) . x by A4, A5, FUNCT_1:49; ::_thesis: verum end; end; end; hence (the_Weight_of G1) . x = ((the_Weight_of G2) +* b2) . x ; ::_thesis: verum end; dom ((the_Weight_of G2) +* b2) = (dom (the_Weight_of G2)) \/ {e} by A3, FUNCT_4:def_1 .= ((the_Edges_of G1) \ {e}) \/ {e} by A4, PARTFUN1:def_2 .= (the_Edges_of G1) \/ {e} by XBOOLE_1:39 .= the_Edges_of G1 by A1, ZFMISC_1:40 ; hence G1 .cost() = (G2 .cost()) + (Sum b2) by A2, A6, Th3, FUNCT_1:2 .= (G2 .cost()) + (b2 . e) by A3, Th4 .= (G2 .cost()) + ((the_Weight_of G1) . e) by FUNCOP_1:72 ; ::_thesis: verum end; theorem Th11: :: GLIB_004:11 for G being finite real-weighted WGraph for V1 being non empty Subset of (the_Vertices_of G) for E1 being Subset of (G .edgesBetween V1) for G1 being inducedWSubgraph of G,V1,E1 for e being set for G2 being inducedWSubgraph of G,V1,E1 \/ {e} st not e in E1 & e in G .edgesBetween V1 holds (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() proof let G be finite real-weighted WGraph; ::_thesis: for V1 being non empty Subset of (the_Vertices_of G) for E1 being Subset of (G .edgesBetween V1) for G1 being inducedWSubgraph of G,V1,E1 for e being set for G2 being inducedWSubgraph of G,V1,E1 \/ {e} st not e in E1 & e in G .edgesBetween V1 holds (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() let V1 be non empty Subset of (the_Vertices_of G); ::_thesis: for E1 being Subset of (G .edgesBetween V1) for G1 being inducedWSubgraph of G,V1,E1 for e being set for G2 being inducedWSubgraph of G,V1,E1 \/ {e} st not e in E1 & e in G .edgesBetween V1 holds (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() let E1 be Subset of (G .edgesBetween V1); ::_thesis: for G1 being inducedWSubgraph of G,V1,E1 for e being set for G2 being inducedWSubgraph of G,V1,E1 \/ {e} st not e in E1 & e in G .edgesBetween V1 holds (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() let G1 be inducedWSubgraph of G,V1,E1; ::_thesis: for e being set for G2 being inducedWSubgraph of G,V1,E1 \/ {e} st not e in E1 & e in G .edgesBetween V1 holds (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() let e be set ; ::_thesis: for G2 being inducedWSubgraph of G,V1,E1 \/ {e} st not e in E1 & e in G .edgesBetween V1 holds (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() let G2 be inducedWSubgraph of G,V1,E1 \/ {e}; ::_thesis: ( not e in E1 & e in G .edgesBetween V1 implies (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() ) assume that A1: not e in E1 and A2: e in G .edgesBetween V1 ; ::_thesis: (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() {e} c= G .edgesBetween V1 by A2, ZFMISC_1:31; then E1 \/ {e} c= G .edgesBetween V1 by XBOOLE_1:8; then A3: the_Edges_of G2 = E1 \/ {e} by GLIB_000:def_37; then A4: dom (the_Weight_of G2) = E1 \/ {e} by PARTFUN1:def_2; set W2 = e .--> ((the_Weight_of G) . e); A5: dom (e .--> ((the_Weight_of G) . e)) = {e} by FUNCOP_1:13; A6: the_Edges_of G1 = E1 by GLIB_000:def_37; then (the_Edges_of G2) \ (the_Edges_of G1) = {e} \ E1 by A3, XBOOLE_1:40 .= {e} by A1, ZFMISC_1:59 ; then reconsider W2 = e .--> ((the_Weight_of G) . e) as ManySortedSet of (the_Edges_of G2) \ (the_Edges_of G1) ; reconsider W2 = W2 as Rbag of (the_Edges_of G2) \ (the_Edges_of G1) ; A7: the_Weight_of G1 = (the_Weight_of G) | E1 by A6, GLIB_003:def_10; A8: now__::_thesis:_for_x_being_set_st_x_in_dom_(the_Weight_of_G2)_holds_ (the_Weight_of_G2)_._x_=_((the_Weight_of_G1)_+*_W2)_._x let x be set ; ::_thesis: ( x in dom (the_Weight_of G2) implies (the_Weight_of G2) . x = ((the_Weight_of G1) +* W2) . x ) assume x in dom (the_Weight_of G2) ; ::_thesis: (the_Weight_of G2) . x = ((the_Weight_of G1) +* W2) . x then A9: x in E1 \/ {e} by A3; the_Weight_of G2 = (the_Weight_of G) | (E1 \/ {e}) by A3, GLIB_003:def_10; then A10: (the_Weight_of G2) . x = (the_Weight_of G) . x by A9, FUNCT_1:49; now__::_thesis:_((the_Weight_of_G1)_+*_W2)_._x_=_(the_Weight_of_G2)_._x percases ( not x in dom W2 or x in dom W2 ) ; suppose not x in dom W2 ; ::_thesis: ((the_Weight_of G1) +* W2) . x = (the_Weight_of G2) . x then ( ((the_Weight_of G1) +* W2) . x = (the_Weight_of G1) . x & x in E1 ) by A5, A9, FUNCT_4:11, XBOOLE_0:def_3; hence ((the_Weight_of G1) +* W2) . x = (the_Weight_of G2) . x by A7, A10, FUNCT_1:49; ::_thesis: verum end; supposeA11: x in dom W2 ; ::_thesis: ((the_Weight_of G1) +* W2) . x = (the_Weight_of G2) . x then A12: x = e by A5, TARSKI:def_1; ((the_Weight_of G1) +* W2) . x = W2 . x by A11, FUNCT_4:13 .= (the_Weight_of G) . e by A12, FUNCOP_1:72 ; hence ((the_Weight_of G1) +* W2) . x = (the_Weight_of G2) . x by A5, A10, A11, TARSKI:def_1; ::_thesis: verum end; end; end; hence (the_Weight_of G2) . x = ((the_Weight_of G1) +* W2) . x ; ::_thesis: verum end; dom W2 = {e} by FUNCOP_1:13; then A13: Sum W2 = W2 . e by Th4 .= (the_Weight_of G) . e by FUNCOP_1:72 ; dom ((the_Weight_of G1) +* W2) = (dom (the_Weight_of G1)) \/ (dom W2) by FUNCT_4:def_1 .= E1 \/ {e} by A6, A5, PARTFUN1:def_2 ; hence (G1 .cost()) + ((the_Weight_of G) . e) = G2 .cost() by A4, A8, A13, Th3, FUNCT_1:2; ::_thesis: verum end; theorem Th12: :: GLIB_004:12 for G being finite nonnegative-weighted WGraph for W being DPath of G for x, y being set for m, n being Element of NAT st W is_mincost_DPath_from x,y holds W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() proof let G be finite nonnegative-weighted WGraph; ::_thesis: for W being DPath of G for x, y being set for m, n being Element of NAT st W is_mincost_DPath_from x,y holds W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() let W be DPath of G; ::_thesis: for x, y being set for m, n being Element of NAT st W is_mincost_DPath_from x,y holds W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() let x, y be set ; ::_thesis: for m, n being Element of NAT st W is_mincost_DPath_from x,y holds W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() let m, n be Element of NAT ; ::_thesis: ( W is_mincost_DPath_from x,y implies W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() ) set WC = W .cut (m,n); A1: W .cut (m,n) is_Walk_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() by GLIB_001:def_23; assume A2: W is_mincost_DPath_from x,y ; ::_thesis: W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() then A3: W is_Walk_from x,y by Def2; then A4: ( W . 1 = x & W . (len W) = y ) by GLIB_001:17; now__::_thesis:_W_.cut_(m,n)_is_mincost_DPath_from_(W_.cut_(m,n))_.first()_,(W_.cut_(m,n))_.last() percases ( ( m is odd & n is odd & m <= n & n <= len W ) or not m is odd or not n is odd or not m <= n or not n <= len W ) ; supposeA5: ( m is odd & n is odd & m <= n & n <= len W ) ; ::_thesis: W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() set W1 = W .cut (1,m); set W3 = W .cut (n,(len W)); A6: 1 <= n by A5, ABIAN:12; then A7: (W .cut (1,n)) .append (W .cut (n,(len W))) = W .cut (1,(len W)) by A5, GLIB_001:38, JORDAN12:2 .= W by GLIB_001:39 ; (W .cut (1,n)) .last() = W . n by A5, A6, GLIB_001:37, JORDAN12:2 .= (W .cut (n,(len W))) .first() by A5, GLIB_001:37 ; then A8: W .cost() = ((W .cut (1,n)) .cost()) + ((W .cut (n,(len W))) .cost()) by A7, GLIB_003:24; A9: 1 <= m by A5, ABIAN:12; then A10: (W .cut (1,m)) .append (W .cut (m,n)) = W .cut (1,n) by A5, GLIB_001:38, JORDAN12:2; A11: m <= len W by A5, XXREAL_0:2; then (W .cut (1,m)) .last() = W . m by A5, A9, GLIB_001:37, JORDAN12:2 .= (W .cut (m,n)) .first() by A5, GLIB_001:37 ; then (W .cut (1,n)) .cost() = ((W .cut (1,m)) .cost()) + ((W .cut (m,n)) .cost()) by A10, GLIB_003:24; then A12: W .cost() = ((W .cut (m,n)) .cost()) + (((W .cut (1,m)) .cost()) + ((W .cut (n,(len W))) .cost())) by A8; A13: W .cut (n,(len W)) is_Walk_from W . n,W . (len W) by A5, GLIB_001:37; A14: W .cut (1,m) is_Walk_from W . 1,W . m by A5, A9, A11, GLIB_001:37, JORDAN12:2; now__::_thesis:_W_.cut_(m,n)_is_mincost_DPath_from_(W_.cut_(m,n))_.first()_,(W_.cut_(m,n))_.last() assume not W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() ; ::_thesis: contradiction then consider W2 being DPath of G such that A15: W2 is_Walk_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() and A16: W2 .cost() < (W .cut (m,n)) .cost() by A1, Def2; set WA = (W .cut (1,m)) .append W2; set WB = ((W .cut (1,m)) .append W2) .append (W .cut (n,(len W))); set WB2 = the DPath of ((W .cut (1,m)) .append W2) .append (W .cut (n,(len W))); A17: (W .cut (m,n)) .last() = W . n by A5, GLIB_001:37; A18: (W .cut (m,n)) .first() = W . m by A5, GLIB_001:37; then (W .cut (1,m)) .append W2 is_Walk_from W . 1,W . n by A14, A15, A17, GLIB_001:31; then ((W .cut (1,m)) .append W2) .append (W .cut (n,(len W))) is_Walk_from x,y by A4, A13, GLIB_001:31; then A19: the DPath of ((W .cut (1,m)) .append W2) .append (W .cut (n,(len W))) is_Walk_from x,y by GLIB_001:160; W2 .first() = W . m by A15, A18, GLIB_001:def_23; then A20: (W .cut (1,m)) .last() = W2 .first() by A5, A9, A11, GLIB_001:37, JORDAN12:2; then A21: ((W .cut (1,m)) .append W2) .cost() = ((W .cut (1,m)) .cost()) + (W2 .cost()) by GLIB_003:24; W2 .last() = W . n by A15, A17, GLIB_001:def_23; then (W .cut (n,(len W))) .first() = W2 .last() by A5, GLIB_001:37 .= ((W .cut (1,m)) .append W2) .last() by A20, GLIB_001:30 ; then (((W .cut (1,m)) .append W2) .append (W .cut (n,(len W)))) .cost() = (((W .cut (1,m)) .cost()) + (W2 .cost())) + ((W .cut (n,(len W))) .cost()) by A21, GLIB_003:24 .= (W2 .cost()) + (((W .cut (1,m)) .cost()) + ((W .cut (n,(len W))) .cost())) ; then A22: (((W .cut (1,m)) .append W2) .append (W .cut (n,(len W)))) .cost() < W .cost() by A12, A16, XREAL_1:8; the DPath of ((W .cut (1,m)) .append W2) .append (W .cut (n,(len W))) .cost() <= (((W .cut (1,m)) .append W2) .append (W .cut (n,(len W)))) .cost() by GLIB_003:30; then the DPath of ((W .cut (1,m)) .append W2) .append (W .cut (n,(len W))) .cost() < W .cost() by A22, XXREAL_0:2; hence contradiction by A2, A19, Def2; ::_thesis: verum end; hence W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() ; ::_thesis: verum end; suppose ( not m is odd or not n is odd or not m <= n or not n <= len W ) ; ::_thesis: W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() then A23: W .cut (m,n) = W by GLIB_001:def_11; then (W .cut (m,n)) .first() = x by A3, GLIB_001:def_23; hence W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() by A2, A3, A23, GLIB_001:def_23; ::_thesis: verum end; end; end; hence W .cut (m,n) is_mincost_DPath_from (W .cut (m,n)) .first() ,(W .cut (m,n)) .last() ; ::_thesis: verum end; theorem :: GLIB_004:13 for G being finite real-weighted WGraph for W1, W2 being DPath of G for x, y being set st W1 is_mincost_DPath_from x,y & W2 is_mincost_DPath_from x,y holds W1 .cost() = W2 .cost() proof let G be finite real-weighted WGraph; ::_thesis: for W1, W2 being DPath of G for x, y being set st W1 is_mincost_DPath_from x,y & W2 is_mincost_DPath_from x,y holds W1 .cost() = W2 .cost() let W1, W2 be DPath of G; ::_thesis: for x, y being set st W1 is_mincost_DPath_from x,y & W2 is_mincost_DPath_from x,y holds W1 .cost() = W2 .cost() let x, y be set ; ::_thesis: ( W1 is_mincost_DPath_from x,y & W2 is_mincost_DPath_from x,y implies W1 .cost() = W2 .cost() ) assume that A1: W1 is_mincost_DPath_from x,y and A2: W2 is_mincost_DPath_from x,y ; ::_thesis: W1 .cost() = W2 .cost() W2 is_Walk_from x,y by A2, Def2; then A3: W1 .cost() <= W2 .cost() by A1, Def2; W1 is_Walk_from x,y by A1, Def2; then W2 .cost() <= W1 .cost() by A2, Def2; hence W1 .cost() = W2 .cost() by A3, XXREAL_0:1; ::_thesis: verum end; theorem Th14: :: GLIB_004:14 for G being finite real-weighted WGraph for W being DPath of G for x, y being set st W is_mincost_DPath_from x,y holds G .min_DPath_cost (x,y) = W .cost() proof let G be finite real-weighted WGraph; ::_thesis: for W being DPath of G for x, y being set st W is_mincost_DPath_from x,y holds G .min_DPath_cost (x,y) = W .cost() let W be DPath of G; ::_thesis: for x, y being set st W is_mincost_DPath_from x,y holds G .min_DPath_cost (x,y) = W .cost() let x, y be set ; ::_thesis: ( W is_mincost_DPath_from x,y implies G .min_DPath_cost (x,y) = W .cost() ) assume A1: W is_mincost_DPath_from x,y ; ::_thesis: G .min_DPath_cost (x,y) = W .cost() then W is_Walk_from x,y by Def2; hence G .min_DPath_cost (x,y) = W .cost() by A1, Def3; ::_thesis: verum end; begin definition let G be _Graph; mode DIJK:Labeling of G is Element of [:(PFuncs ((the_Vertices_of G),REAL)),(bool (the_Edges_of G)):]; end; definition let X1, X3 be set ; let X2 be non empty set ; let x be Element of [:(PFuncs (X1,X3)),X2:]; :: original: `1 redefine funcx `1 -> Element of PFuncs (X1,X3); coherence x `1 is Element of PFuncs (X1,X3) by MCART_1:10; end; registration let G be finite _Graph; let L be DIJK:Labeling of G; clusterL `1 -> finite ; coherence L `1 is finite proof dom (L `1) c= the_Vertices_of G ; hence L `1 is finite by FINSET_1:10; ::_thesis: verum end; clusterL `2 -> finite ; coherence L `2 is finite proof thus L `2 is finite ; ::_thesis: verum end; end; definition let G be real-weighted WGraph; let L be DIJK:Labeling of G; func DIJK:NextBestEdges L -> Subset of (the_Edges_of G) means :Def7: :: GLIB_004:def 7 for e1 being set holds ( e1 in it iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ); existence ex b1 being Subset of (the_Edges_of G) st for e1 being set holds ( e1 in b1 iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ) proof defpred S1[ set ] means ( $1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . $1)) + ((the_Weight_of G) . $1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ); consider IT being Subset of (the_Edges_of G) such that A1: for e being set holds ( e in IT iff ( e in the_Edges_of G & S1[e] ) ) from SUBSET_1:sch_1(); take IT ; ::_thesis: for e1 being set holds ( e1 in IT iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ) now__::_thesis:_for_e1_being_set_holds_ (_(_e1_in_IT_implies_S1[e1]_)_&_(_S1[e1]_implies_e1_in_IT_)_) let e1 be set ; ::_thesis: ( ( e1 in IT implies S1[e1] ) & ( S1[e1] implies e1 in IT ) ) thus ( e1 in IT implies S1[e1] ) by A1; ::_thesis: ( S1[e1] implies e1 in IT ) assume A2: S1[e1] ; ::_thesis: e1 in IT then e1 in the_Edges_of G by GLIB_000:def_16; hence e1 in IT by A1, A2; ::_thesis: verum end; hence for e1 being set holds ( e1 in IT iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ) ; ::_thesis: verum end; uniqueness for b1, b2 being Subset of (the_Edges_of G) st ( for e1 being set holds ( e1 in b1 iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ) ) & ( for e1 being set holds ( e1 in b2 iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ) ) holds b1 = b2 proof defpred S1[ set ] means ( $1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . $1)) + ((the_Weight_of G) . $1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ); let IT1, IT2 be Subset of (the_Edges_of G); ::_thesis: ( ( for e1 being set holds ( e1 in IT1 iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ) ) & ( for e1 being set holds ( e1 in IT2 iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ) ) implies IT1 = IT2 ) assume that A3: for y being set holds ( y in IT1 iff S1[y] ) and A4: for y being set holds ( y in IT2 iff S1[y] ) ; ::_thesis: IT1 = IT2 now__::_thesis:_for_x_being_set_holds_ (_(_x_in_IT1_implies_x_in_IT2_)_&_(_x_in_IT2_implies_x_in_IT1_)_) let x be set ; ::_thesis: ( ( x in IT1 implies x in IT2 ) & ( x in IT2 implies x in IT1 ) ) hereby ::_thesis: ( x in IT2 implies x in IT1 ) assume x in IT1 ; ::_thesis: x in IT2 then S1[x] by A3; hence x in IT2 by A4; ::_thesis: verum end; assume x in IT2 ; ::_thesis: x in IT1 then S1[x] by A4; hence x in IT1 by A3; ::_thesis: verum end; hence IT1 = IT2 by TARSKI:1; ::_thesis: verum end; end; :: deftheorem Def7 defines DIJK:NextBestEdges GLIB_004:def_7_:_ for G being real-weighted WGraph for L being DIJK:Labeling of G for b3 being Subset of (the_Edges_of G) holds ( b3 = DIJK:NextBestEdges L iff for e1 being set holds ( e1 in b3 iff ( e1 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G & ( for e2 being set st e2 DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G holds ((L `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((L `1) . ((the_Source_of G) . e2)) + ((the_Weight_of G) . e2) ) ) ) ); definition let G be real-weighted WGraph; let L be DIJK:Labeling of G; func DIJK:Step L -> DIJK:Labeling of G equals :Def8: :: GLIB_004:def 8 L if DIJK:NextBestEdges L = {} otherwise [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})]; coherence ( ( DIJK:NextBestEdges L = {} implies L is DIJK:Labeling of G ) & ( not DIJK:NextBestEdges L = {} implies [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})] is DIJK:Labeling of G ) ) proof set V = the_Vertices_of G; set E = the_Edges_of G; set BE = DIJK:NextBestEdges L; set e = choose (DIJK:NextBestEdges L); set nE = (L `2) \/ {(choose (DIJK:NextBestEdges L))}; set s = (the_Source_of G) . (choose (DIJK:NextBestEdges L)); set t = (the_Target_of G) . (choose (DIJK:NextBestEdges L)); set val = ((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L))); now__::_thesis:_(_DIJK:NextBestEdges_L_<>_{}_implies_[((L_`1)_+*_(((the_Target_of_G)_._(choose_(DIJK:NextBestEdges_L)))_.-->_(((L_`1)_._((the_Source_of_G)_._(choose_(DIJK:NextBestEdges_L))))_+_((the_Weight_of_G)_._(choose_(DIJK:NextBestEdges_L)))))),((L_`2)_\/_{(choose_(DIJK:NextBestEdges_L))})]_is_DIJK:Labeling_of_G_) assume A1: DIJK:NextBestEdges L <> {} ; ::_thesis: [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})] is DIJK:Labeling of G then choose (DIJK:NextBestEdges L) in DIJK:NextBestEdges L ; then reconsider e9 = choose (DIJK:NextBestEdges L) as Element of the_Edges_of G ; A2: choose (DIJK:NextBestEdges L) in DIJK:NextBestEdges L by A1; then reconsider t9 = (the_Target_of G) . (choose (DIJK:NextBestEdges L)) as Element of the_Vertices_of G by FUNCT_2:5; ( L `2 in bool (the_Edges_of G) & {e9} c= the_Edges_of G ) by A2, ZFMISC_1:31; then A3: (L `2) \/ {(choose (DIJK:NextBestEdges L))} c= the_Edges_of G by XBOOLE_1:8; ( {t9} c= the_Vertices_of G & dom ((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))) = (dom (L `1)) \/ {((the_Target_of G) . (choose (DIJK:NextBestEdges L)))} ) by Lm1; then A4: dom ((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))) c= the_Vertices_of G by XBOOLE_1:8; rng ((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))) c= REAL ; then (L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L))))) in PFuncs ((the_Vertices_of G),REAL) by A4, PARTFUN1:def_3; hence [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})] is DIJK:Labeling of G by A3, ZFMISC_1:def_2; ::_thesis: verum end; hence ( ( DIJK:NextBestEdges L = {} implies L is DIJK:Labeling of G ) & ( not DIJK:NextBestEdges L = {} implies [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})] is DIJK:Labeling of G ) ) ; ::_thesis: verum end; consistency for b1 being DIJK:Labeling of G holds verum ; end; :: deftheorem Def8 defines DIJK:Step GLIB_004:def_8_:_ for G being real-weighted WGraph for L being DIJK:Labeling of G holds ( ( DIJK:NextBestEdges L = {} implies DIJK:Step L = L ) & ( not DIJK:NextBestEdges L = {} implies DIJK:Step L = [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})] ) ); definition let G be real-weighted WGraph; let src be Vertex of G; func DIJK:Init src -> DIJK:Labeling of G equals :: GLIB_004:def 9 [(src .--> 0),{}]; coherence [(src .--> 0),{}] is DIJK:Labeling of G proof set f = src .--> 0; ( dom (src .--> 0) = {src} & rng (src .--> 0) = {0} ) by FUNCOP_1:8, FUNCOP_1:13; then A1: src .--> 0 in PFuncs ((the_Vertices_of G),REAL) by PARTFUN1:def_3; {} c= the_Edges_of G by XBOOLE_1:2; hence [(src .--> 0),{}] is DIJK:Labeling of G by A1, ZFMISC_1:def_2; ::_thesis: verum end; end; :: deftheorem defines DIJK:Init GLIB_004:def_9_:_ for G being real-weighted WGraph for src being Vertex of G holds DIJK:Init src = [(src .--> 0),{}]; definition let G be real-weighted WGraph; mode DIJK:LabelingSeq of G -> ManySortedSet of NAT means :Def10: :: GLIB_004:def 10 for n being Nat holds it . n is DIJK:Labeling of G; existence ex b1 being ManySortedSet of NAT st for n being Nat holds b1 . n is DIJK:Labeling of G proof defpred S1[ set , set ] means $2 is DIJK:Labeling of G; A1: now__::_thesis:_for_i_being_set_st_i_in_NAT_holds_ ex_r_being_set_st_S1[i,r] let i be set ; ::_thesis: ( i in NAT implies ex r being set st S1[i,r] ) assume i in NAT ; ::_thesis: ex r being set st S1[i,r] take r = [{},{}]; ::_thesis: S1[i,r] {} is PartFunc of (the_Vertices_of G),REAL by RELSET_1:12; then A2: {} in PFuncs ((the_Vertices_of G),REAL) by PARTFUN1:45; {} c= the_Edges_of G by XBOOLE_1:2; hence S1[i,r] by A2, ZFMISC_1:def_2; ::_thesis: verum end; consider s being ManySortedSet of NAT such that A3: for i being set st i in NAT holds S1[i,s . i] from PBOOLE:sch_3(A1); take s ; ::_thesis: for n being Nat holds s . n is DIJK:Labeling of G let i be Nat; ::_thesis: s . i is DIJK:Labeling of G i in NAT by ORDINAL1:def_12; hence s . i is DIJK:Labeling of G by A3; ::_thesis: verum end; end; :: deftheorem Def10 defines DIJK:LabelingSeq GLIB_004:def_10_:_ for G being real-weighted WGraph for b2 being ManySortedSet of NAT holds ( b2 is DIJK:LabelingSeq of G iff for n being Nat holds b2 . n is DIJK:Labeling of G ); definition let G be real-weighted WGraph; let S be DIJK:LabelingSeq of G; let n be Nat; :: original: . redefine funcS . n -> DIJK:Labeling of G; coherence S . n is DIJK:Labeling of G by Def10; end; definition let G be real-weighted WGraph; let src be Vertex of G; func DIJK:CompSeq src -> DIJK:LabelingSeq of G means :Def11: :: GLIB_004:def 11 ( it . 0 = DIJK:Init src & ( for n being Nat holds it . (n + 1) = DIJK:Step (it . n) ) ); existence ex b1 being DIJK:LabelingSeq of G st ( b1 . 0 = DIJK:Init src & ( for n being Nat holds b1 . (n + 1) = DIJK:Step (b1 . n) ) ) proof defpred S1[ set , set , set ] means ( ( $2 is DIJK:Labeling of G & ex Gn, Gn1 being DIJK:Labeling of G st ( $2 = Gn & $3 = Gn1 & Gn1 = DIJK:Step Gn ) ) or ( $2 is not DIJK:Labeling of G & $2 = $3 ) ); now__::_thesis:_for_n,_x_being_set_ex_y_being_set_st_S1[n,x,y] let n, x be set ; ::_thesis: ex y being set st S1[n,x,y] now__::_thesis:_ex_y_being_set_st_S1[n,x,y] percases ( x is DIJK:Labeling of G or not x is DIJK:Labeling of G ) ; suppose x is DIJK:Labeling of G ; ::_thesis: ex y being set st S1[n,x,y] then reconsider Gn = x as DIJK:Labeling of G ; S1[n,x, DIJK:Step Gn] ; hence ex y being set st S1[n,x,y] ; ::_thesis: verum end; suppose x is not DIJK:Labeling of G ; ::_thesis: ex y being set st S1[n,x,y] hence ex y being set st S1[n,x,y] ; ::_thesis: verum end; end; end; hence ex y being set st S1[n,x,y] ; ::_thesis: verum end; then A1: for n being Element of NAT for x being set ex y being set st S1[n,x,y] ; consider IT being Function such that A2: ( dom IT = NAT & IT . 0 = DIJK:Init src & ( for n being Element of NAT holds S1[n,IT . n,IT . (n + 1)] ) ) from RECDEF_1:sch_1(A1); reconsider IT = IT as ManySortedSet of NAT by A2, PARTFUN1:def_2, RELAT_1:def_18; defpred S2[ Nat] means IT . $1 is DIJK:Labeling of G; A3: now__::_thesis:_for_n_being_Nat_st_S2[n]_holds_ S2[n_+_1] let n be Nat; ::_thesis: ( S2[n] implies S2[n + 1] ) assume A4: S2[n] ; ::_thesis: S2[n + 1] n in NAT by ORDINAL1:def_12; then ex Gn, Gn1 being DIJK:Labeling of G st ( IT . n = Gn & IT . (n + 1) = Gn1 & Gn1 = DIJK:Step Gn ) by A2, A4; hence S2[n + 1] ; ::_thesis: verum end; A5: S2[ 0 ] by A2; for n being Nat holds S2[n] from NAT_1:sch_2(A5, A3); then reconsider IT = IT as DIJK:LabelingSeq of G by Def10; reconsider IT = IT as DIJK:LabelingSeq of G ; take IT ; ::_thesis: ( IT . 0 = DIJK:Init src & ( for n being Nat holds IT . (n + 1) = DIJK:Step (IT . n) ) ) thus IT . 0 = DIJK:Init src by A2; ::_thesis: for n being Nat holds IT . (n + 1) = DIJK:Step (IT . n) let n be Nat; ::_thesis: IT . (n + 1) = DIJK:Step (IT . n) reconsider n9 = n as Element of NAT by ORDINAL1:def_12; ex Gn, Gn1 being DIJK:Labeling of G st ( IT . n9 = Gn & IT . (n + 1) = Gn1 & Gn1 = DIJK:Step Gn ) by A2; hence IT . (n + 1) = DIJK:Step (IT . n) ; ::_thesis: verum end; uniqueness for b1, b2 being DIJK:LabelingSeq of G st b1 . 0 = DIJK:Init src & ( for n being Nat holds b1 . (n + 1) = DIJK:Step (b1 . n) ) & b2 . 0 = DIJK:Init src & ( for n being Nat holds b2 . (n + 1) = DIJK:Step (b2 . n) ) holds b1 = b2 proof let IT1, IT2 be DIJK:LabelingSeq of G; ::_thesis: ( IT1 . 0 = DIJK:Init src & ( for n being Nat holds IT1 . (n + 1) = DIJK:Step (IT1 . n) ) & IT2 . 0 = DIJK:Init src & ( for n being Nat holds IT2 . (n + 1) = DIJK:Step (IT2 . n) ) implies IT1 = IT2 ) assume that A6: IT1 . 0 = DIJK:Init src and A7: for n being Nat holds IT1 . (n + 1) = DIJK:Step (IT1 . n) and A8: IT2 . 0 = DIJK:Init src and A9: for n being Nat holds IT2 . (n + 1) = DIJK:Step (IT2 . n) ; ::_thesis: IT1 = IT2 defpred S1[ Nat] means IT1 . $1 = IT2 . $1; now__::_thesis:_for_n_being_Element_of_NAT_st_S1[n]_holds_ S1[n_+_1] let n be Element of NAT ; ::_thesis: ( S1[n] implies S1[n + 1] ) assume S1[n] ; ::_thesis: S1[n + 1] then IT1 . (n + 1) = DIJK:Step (IT2 . n) by A7 .= IT2 . (n + 1) by A9 ; hence S1[n + 1] ; ::_thesis: verum end; then A10: for n being Element of NAT st S1[n] holds S1[n + 1] ; A11: S1[ 0 ] by A6, A8; for n being Element of NAT holds S1[n] from NAT_1:sch_1(A11, A10); then for n being set st n in NAT holds IT1 . n = IT2 . n ; hence IT1 = IT2 by PBOOLE:3; ::_thesis: verum end; end; :: deftheorem Def11 defines DIJK:CompSeq GLIB_004:def_11_:_ for G being real-weighted WGraph for src being Vertex of G for b3 being DIJK:LabelingSeq of G holds ( b3 = DIJK:CompSeq src iff ( b3 . 0 = DIJK:Init src & ( for n being Nat holds b3 . (n + 1) = DIJK:Step (b3 . n) ) ) ); definition let G be real-weighted WGraph; let src be Vertex of G; func DIJK:SSSP (G,src) -> DIJK:Labeling of G equals :: GLIB_004:def 12 (DIJK:CompSeq src) .Result() ; coherence (DIJK:CompSeq src) .Result() is DIJK:Labeling of G proof set DCS = DIJK:CompSeq src; (DIJK:CompSeq src) .Result() = (DIJK:CompSeq src) . ((DIJK:CompSeq src) .Lifespan()) ; hence (DIJK:CompSeq src) .Result() is DIJK:Labeling of G ; ::_thesis: verum end; end; :: deftheorem defines DIJK:SSSP GLIB_004:def_12_:_ for G being real-weighted WGraph for src being Vertex of G holds DIJK:SSSP (G,src) = (DIJK:CompSeq src) .Result() ; begin theorem Th15: :: GLIB_004:15 for G being finite real-weighted WGraph for L being DIJK:Labeling of G holds ( ( card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) implies DIJK:NextBestEdges L = {} ) & ( DIJK:NextBestEdges L = {} implies card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) ) & ( card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 implies DIJK:NextBestEdges L <> {} ) & ( DIJK:NextBestEdges L <> {} implies card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 ) ) proof let G be finite real-weighted WGraph; ::_thesis: for L being DIJK:Labeling of G holds ( ( card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) implies DIJK:NextBestEdges L = {} ) & ( DIJK:NextBestEdges L = {} implies card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) ) & ( card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 implies DIJK:NextBestEdges L <> {} ) & ( DIJK:NextBestEdges L <> {} implies card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 ) ) let L be DIJK:Labeling of G; ::_thesis: ( ( card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) implies DIJK:NextBestEdges L = {} ) & ( DIJK:NextBestEdges L = {} implies card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) ) & ( card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 implies DIJK:NextBestEdges L <> {} ) & ( DIJK:NextBestEdges L <> {} implies card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 ) ) set BestEdges = DIJK:NextBestEdges L; set e = choose (DIJK:NextBestEdges L); set nextEG = (L `2) \/ {(choose (DIJK:NextBestEdges L))}; set nL = DIJK:Step L; set src = (the_Source_of G) . (choose (DIJK:NextBestEdges L)); set target = (the_Target_of G) . (choose (DIJK:NextBestEdges L)); set val = ((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L))); hereby ::_thesis: ( ( DIJK:NextBestEdges L = {} implies card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) ) & ( card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 implies DIJK:NextBestEdges L <> {} ) & ( DIJK:NextBestEdges L <> {} implies card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 ) ) assume A1: card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) ; ::_thesis: DIJK:NextBestEdges L = {} now__::_thesis:_not_DIJK:NextBestEdges_L_<>_{} assume A2: DIJK:NextBestEdges L <> {} ; ::_thesis: contradiction then DIJK:Step L = [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})] by Def8; then (DIJK:Step L) `1 = (L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L))))) by MCART_1:7; then A3: dom ((DIJK:Step L) `1) = (dom (L `1)) \/ {((the_Target_of G) . (choose (DIJK:NextBestEdges L)))} by Lm1; choose (DIJK:NextBestEdges L) in DIJK:NextBestEdges L by A2; then reconsider target = (the_Target_of G) . (choose (DIJK:NextBestEdges L)) as Vertex of G by FUNCT_2:5; choose (DIJK:NextBestEdges L) DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G by A2, Def7; then target in (the_Vertices_of G) \ (dom (L `1)) by GLIB_000:def_16; then not target in dom (L `1) by XBOOLE_0:def_5; then card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 by A3, CARD_2:41; hence contradiction by A1; ::_thesis: verum end; hence DIJK:NextBestEdges L = {} ; ::_thesis: verum end; thus ( DIJK:NextBestEdges L = {} implies card (dom ((DIJK:Step L) `1)) = card (dom (L `1)) ) by Def8; ::_thesis: ( card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 iff DIJK:NextBestEdges L <> {} ) hereby ::_thesis: ( DIJK:NextBestEdges L <> {} implies card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 ) assume A4: card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 ; ::_thesis: DIJK:NextBestEdges L <> {} now__::_thesis:_not_DIJK:NextBestEdges_L_=_{} assume DIJK:NextBestEdges L = {} ; ::_thesis: contradiction then 0 + (card (dom (L `1))) = (card (dom (L `1))) + 1 by A4, Def8; hence contradiction ; ::_thesis: verum end; hence DIJK:NextBestEdges L <> {} ; ::_thesis: verum end; assume A5: DIJK:NextBestEdges L <> {} ; ::_thesis: card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 then DIJK:Step L = [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})] by Def8; then (DIJK:Step L) `1 = (L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L))))) by MCART_1:7; then A6: dom ((DIJK:Step L) `1) = (dom (L `1)) \/ {((the_Target_of G) . (choose (DIJK:NextBestEdges L)))} by Lm1; choose (DIJK:NextBestEdges L) in DIJK:NextBestEdges L by A5; then reconsider target = (the_Target_of G) . (choose (DIJK:NextBestEdges L)) as Vertex of G by FUNCT_2:5; choose (DIJK:NextBestEdges L) DSJoins dom (L `1),(the_Vertices_of G) \ (dom (L `1)),G by A5, Def7; then target in (the_Vertices_of G) \ (dom (L `1)) by GLIB_000:def_16; then not target in dom (L `1) by XBOOLE_0:def_5; hence card (dom ((DIJK:Step L) `1)) = (card (dom (L `1))) + 1 by A6, CARD_2:41; ::_thesis: verum end; theorem Th16: :: GLIB_004:16 for G being real-weighted WGraph for L being DIJK:Labeling of G holds ( dom (L `1) c= dom ((DIJK:Step L) `1) & L `2 c= (DIJK:Step L) `2 ) proof let G be real-weighted WGraph; ::_thesis: for L being DIJK:Labeling of G holds ( dom (L `1) c= dom ((DIJK:Step L) `1) & L `2 c= (DIJK:Step L) `2 ) let L be DIJK:Labeling of G; ::_thesis: ( dom (L `1) c= dom ((DIJK:Step L) `1) & L `2 c= (DIJK:Step L) `2 ) set nL = DIJK:Step L; set BestEdges = DIJK:NextBestEdges L; set e = choose (DIJK:NextBestEdges L); set NextEG = (L `2) \/ {(choose (DIJK:NextBestEdges L))}; set target = (the_Target_of G) . (choose (DIJK:NextBestEdges L)); set val = ((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L))); now__::_thesis:_(_dom_(L_`1)_c=_dom_((DIJK:Step_L)_`1)_&_L_`2_c=_(DIJK:Step_L)_`2_) percases ( DIJK:NextBestEdges L = {} or DIJK:NextBestEdges L <> {} ) ; suppose DIJK:NextBestEdges L = {} ; ::_thesis: ( dom (L `1) c= dom ((DIJK:Step L) `1) & L `2 c= (DIJK:Step L) `2 ) hence ( dom (L `1) c= dom ((DIJK:Step L) `1) & L `2 c= (DIJK:Step L) `2 ) by Def8; ::_thesis: verum end; suppose DIJK:NextBestEdges L <> {} ; ::_thesis: ( dom (L `1) c= dom ((DIJK:Step L) `1) & L `2 c= (DIJK:Step L) `2 ) then A1: DIJK:Step L = [((L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L)))))),((L `2) \/ {(choose (DIJK:NextBestEdges L))})] by Def8; then (DIJK:Step L) `1 = (L `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges L))) .--> (((L `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges L)))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges L))))) by MCART_1:7; then A2: dom ((DIJK:Step L) `1) = (dom (L `1)) \/ {((the_Target_of G) . (choose (DIJK:NextBestEdges L)))} by Lm1; now__::_thesis:_for_x_being_set_st_x_in_dom_(L_`1)_holds_ x_in_dom_((DIJK:Step_L)_`1) let x be set ; ::_thesis: ( x in dom (L `1) implies x in dom ((DIJK:Step L) `1) ) assume A3: x in dom (L `1) ; ::_thesis: x in dom ((DIJK:Step L) `1) dom (L `1) c= dom ((DIJK:Step L) `1) by A2, XBOOLE_1:7; hence x in dom ((DIJK:Step L) `1) by A3; ::_thesis: verum end; hence dom (L `1) c= dom ((DIJK:Step L) `1) by TARSKI:def_3; ::_thesis: L `2 c= (DIJK:Step L) `2 now__::_thesis:_for_x_being_set_st_x_in_L_`2_holds_ x_in_(DIJK:Step_L)_`2 let x be set ; ::_thesis: ( x in L `2 implies x in (DIJK:Step L) `2 ) assume A4: x in L `2 ; ::_thesis: x in (DIJK:Step L) `2 ( L `2 c= (L `2) \/ {(choose (DIJK:NextBestEdges L))} & (L `2) \/ {(choose (DIJK:NextBestEdges L))} = (DIJK:Step L) `2 ) by A1, MCART_1:7, XBOOLE_1:7; hence x in (DIJK:Step L) `2 by A4; ::_thesis: verum end; hence L `2 c= (DIJK:Step L) `2 by TARSKI:def_3; ::_thesis: verum end; end; end; hence ( dom (L `1) c= dom ((DIJK:Step L) `1) & L `2 c= (DIJK:Step L) `2 ) ; ::_thesis: verum end; theorem Th17: :: GLIB_004:17 for G being real-weighted WGraph for src being Vertex of G holds dom ((DIJK:Init src) `1) = {src} proof let G be real-weighted WGraph; ::_thesis: for src being Vertex of G holds dom ((DIJK:Init src) `1) = {src} let src be Vertex of G; ::_thesis: dom ((DIJK:Init src) `1) = {src} set G2 = DIJK:Init src; (DIJK:Init src) `1 = src .--> 0 by MCART_1:7; hence dom ((DIJK:Init src) `1) = {src} by FUNCOP_1:13; ::_thesis: verum end; theorem Th18: :: GLIB_004:18 for G being real-weighted WGraph for src being Vertex of G for i, j being Nat st i <= j holds ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . j) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . j) `2 ) proof let G be real-weighted WGraph; ::_thesis: for src being Vertex of G for i, j being Nat st i <= j holds ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . j) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . j) `2 ) let src be Vertex of G; ::_thesis: for i, j being Nat st i <= j holds ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . j) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . j) `2 ) let i, j be Nat; ::_thesis: ( i <= j implies ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . j) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . j) `2 ) ) set DCS = DIJK:CompSeq src; set dDCS = dom (((DIJK:CompSeq src) . i) `1); set eDCS = ((DIJK:CompSeq src) . i) `2 ; defpred S1[ Nat] means ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . (i + $1)) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . (i + $1)) `2 ); assume i <= j ; ::_thesis: ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . j) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . j) `2 ) then A1: ex x being Nat st j = i + x by NAT_1:10; now__::_thesis:_for_k_being_Nat_st_dom_(((DIJK:CompSeq_src)_._i)_`1)_c=_dom_(((DIJK:CompSeq_src)_._(i_+_k))_`1)_&_((DIJK:CompSeq_src)_._i)_`2_c=_((DIJK:CompSeq_src)_._(i_+_k))_`2_holds_ (_dom_(((DIJK:CompSeq_src)_._i)_`1)_c=_dom_(((DIJK:CompSeq_src)_._(i_+_(k_+_1)))_`1)_&_((DIJK:CompSeq_src)_._i)_`2_c=_((DIJK:CompSeq_src)_._(i_+_(k_+_1)))_`2_) let k be Nat; ::_thesis: ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . (i + k)) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . (i + k)) `2 implies ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . (i + (k + 1))) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . (i + (k + 1))) `2 ) ) (DIJK:CompSeq src) . ((i + k) + 1) = DIJK:Step ((DIJK:CompSeq src) . (i + k)) by Def11; then A2: ( dom (((DIJK:CompSeq src) . (i + k)) `1) c= dom (((DIJK:CompSeq src) . ((i + k) + 1)) `1) & ((DIJK:CompSeq src) . (i + k)) `2 c= ((DIJK:CompSeq src) . ((i + k) + 1)) `2 ) by Th16; assume ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . (i + k)) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . (i + k)) `2 ) ; ::_thesis: ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . (i + (k + 1))) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . (i + (k + 1))) `2 ) hence ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . (i + (k + 1))) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . (i + (k + 1))) `2 ) by A2, XBOOLE_1:1; ::_thesis: verum end; then A3: for k being Nat st S1[k] holds S1[k + 1] ; A4: S1[ 0 ] ; for k being Nat holds S1[k] from NAT_1:sch_2(A4, A3); hence ( dom (((DIJK:CompSeq src) . i) `1) c= dom (((DIJK:CompSeq src) . j) `1) & ((DIJK:CompSeq src) . i) `2 c= ((DIJK:CompSeq src) . j) `2 ) by A1; ::_thesis: verum end; theorem Th19: :: GLIB_004:19 for G being finite real-weighted WGraph for src being Vertex of G for n being Nat holds dom (((DIJK:CompSeq src) . n) `1) c= G .reachableDFrom src proof let G be finite real-weighted WGraph; ::_thesis: for src being Vertex of G for n being Nat holds dom (((DIJK:CompSeq src) . n) `1) c= G .reachableDFrom src let src be Vertex of G; ::_thesis: for n being Nat holds dom (((DIJK:CompSeq src) . n) `1) c= G .reachableDFrom src set DCS = DIJK:CompSeq src; defpred S1[ Nat] means dom (((DIJK:CompSeq src) . $1) `1) c= G .reachableDFrom src; (DIJK:CompSeq src) . 0 = DIJK:Init src by Def11; then A1: dom (((DIJK:CompSeq src) . 0) `1) = {src} by Th17; now__::_thesis:_for_k_being_Nat_st_dom_(((DIJK:CompSeq_src)_._k)_`1)_c=_G_.reachableDFrom_src_holds_ dom_(((DIJK:CompSeq_src)_._(k_+_1))_`1)_c=_G_.reachableDFrom_src let k be Nat; ::_thesis: ( dom (((DIJK:CompSeq src) . k) `1) c= G .reachableDFrom src implies dom (((DIJK:CompSeq src) . (k + 1)) `1) c= G .reachableDFrom src ) assume A2: dom (((DIJK:CompSeq src) . k) `1) c= G .reachableDFrom src ; ::_thesis: dom (((DIJK:CompSeq src) . (k + 1)) `1) c= G .reachableDFrom src set Gk = (DIJK:CompSeq src) . k; set NextG = (DIJK:CompSeq src) . (k + 1); set BestEdges = DIJK:NextBestEdges ((DIJK:CompSeq src) . k); set e = choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)); set NextEG = (((DIJK:CompSeq src) . k) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)))}; set v1 = (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))); set target = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))); set pc = (((DIJK:CompSeq src) . k) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)))); set ec = (the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))); A3: (DIJK:CompSeq src) . (k + 1) = DIJK:Step ((DIJK:CompSeq src) . k) by Def11; now__::_thesis:_for_x_being_set_st_x_in_dom_(((DIJK:CompSeq_src)_._(k_+_1))_`1)_holds_ x_in_G_.reachableDFrom_src let x be set ; ::_thesis: ( x in dom (((DIJK:CompSeq src) . (k + 1)) `1) implies x in G .reachableDFrom src ) assume A4: x in dom (((DIJK:CompSeq src) . (k + 1)) `1) ; ::_thesis: x in G .reachableDFrom src now__::_thesis:_x_in_G_.reachableDFrom_src percases ( DIJK:NextBestEdges ((DIJK:CompSeq src) . k) = {} or DIJK:NextBestEdges ((DIJK:CompSeq src) . k) <> {} ) ; suppose DIJK:NextBestEdges ((DIJK:CompSeq src) . k) = {} ; ::_thesis: x in G .reachableDFrom src then (DIJK:CompSeq src) . k = (DIJK:CompSeq src) . (k + 1) by A3, Def8; hence x in G .reachableDFrom src by A2, A4; ::_thesis: verum end; supposeA5: DIJK:NextBestEdges ((DIJK:CompSeq src) . k) <> {} ; ::_thesis: x in G .reachableDFrom src set xx = x; reconsider xx = x as Vertex of G by A4; choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)) DSJoins dom (((DIJK:CompSeq src) . k) `1),(the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . k) `1)),G by A5, Def7; then A6: (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))) in dom (((DIJK:CompSeq src) . k) `1) by GLIB_000:def_16; then reconsider v19 = (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))) as Vertex of G ; (DIJK:CompSeq src) . (k + 1) = [((((DIJK:CompSeq src) . k) `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)))) .--> (((((DIJK:CompSeq src) . k) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))))))),((((DIJK:CompSeq src) . k) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)))})] by A3, A5, Def8; then A7: ((DIJK:CompSeq src) . (k + 1)) `1 = (((DIJK:CompSeq src) . k) `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)))) .--> (((((DIJK:CompSeq src) . k) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)))))) by MCART_1:7; now__::_thesis:_xx_in_G_.reachableDFrom_src percases ( xx in dom (((DIJK:CompSeq src) . k) `1) or not xx in dom (((DIJK:CompSeq src) . k) `1) ) ; suppose xx in dom (((DIJK:CompSeq src) . k) `1) ; ::_thesis: xx in G .reachableDFrom src hence xx in G .reachableDFrom src by A2; ::_thesis: verum end; supposeA8: not xx in dom (((DIJK:CompSeq src) . k) `1) ; ::_thesis: xx in G .reachableDFrom src A9: choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)) in DIJK:NextBestEdges ((DIJK:CompSeq src) . k) by A5; (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k))) = xx by A4, A7, A8, Lm2; then choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . k)) DJoins v19,xx,G by A9, GLIB_000:def_14; hence xx in G .reachableDFrom src by A2, A6, GLIB_002:19; ::_thesis: verum end; end; end; hence x in G .reachableDFrom src ; ::_thesis: verum end; end; end; hence x in G .reachableDFrom src ; ::_thesis: verum end; hence dom (((DIJK:CompSeq src) . (k + 1)) `1) c= G .reachableDFrom src by TARSKI:def_3; ::_thesis: verum end; then A10: for k being Nat st S1[k] holds S1[k + 1] ; src in G .reachableDFrom src by GLIB_002:18; then A11: S1[ 0 ] by A1, ZFMISC_1:31; for n being Nat holds S1[n] from NAT_1:sch_2(A11, A10); hence for n being Nat holds dom (((DIJK:CompSeq src) . n) `1) c= G .reachableDFrom src ; ::_thesis: verum end; theorem Th20: :: GLIB_004:20 for G being finite real-weighted WGraph for src being Vertex of G for n being Nat holds ( DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} iff dom (((DIJK:CompSeq src) . n) `1) = G .reachableDFrom src ) proof let G be finite real-weighted WGraph; ::_thesis: for src being Vertex of G for n being Nat holds ( DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} iff dom (((DIJK:CompSeq src) . n) `1) = G .reachableDFrom src ) let src be Vertex of G; ::_thesis: for n being Nat holds ( DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} iff dom (((DIJK:CompSeq src) . n) `1) = G .reachableDFrom src ) let n be Nat; ::_thesis: ( DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} iff dom (((DIJK:CompSeq src) . n) `1) = G .reachableDFrom src ) set DCS = DIJK:CompSeq src; set RFS = G .reachableDFrom src; set Gn = (DIJK:CompSeq src) . n; set Gn1a = (DIJK:CompSeq src) . (n + 1); set BestEdges = DIJK:NextBestEdges ((DIJK:CompSeq src) . n); set SGn = the_Source_of G; set TGn = the_Target_of G; hereby ::_thesis: ( dom (((DIJK:CompSeq src) . n) `1) = G .reachableDFrom src implies DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} ) assume A1: DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} ; ::_thesis: dom (((DIJK:CompSeq src) . n) `1) = G .reachableDFrom src now__::_thesis:_not_dom_(((DIJK:CompSeq_src)_._n)_`1)_<>_G_.reachableDFrom_src defpred S1[ set ] means ( (the_Source_of G) . $1 in dom (((DIJK:CompSeq src) . n) `1) & not (the_Target_of G) . $1 in dom (((DIJK:CompSeq src) . n) `1) ); assume A2: dom (((DIJK:CompSeq src) . n) `1) <> G .reachableDFrom src ; ::_thesis: contradiction consider BE1 being Subset of (the_Edges_of G) such that A3: for x being set holds ( x in BE1 iff ( x in the_Edges_of G & S1[x] ) ) from SUBSET_1:sch_1(); dom (((DIJK:CompSeq src) . n) `1) c= G .reachableDFrom src by Th19; then A4: dom (((DIJK:CompSeq src) . n) `1) c< G .reachableDFrom src by A2, XBOOLE_0:def_8; now__::_thesis:_not_BE1_=_{} (DIJK:CompSeq src) . 0 = DIJK:Init src by Def11; then dom (((DIJK:CompSeq src) . 0) `1) = {src} by Th17; then A5: src in dom (((DIJK:CompSeq src) . 0) `1) by TARSKI:def_1; assume A6: BE1 = {} ; ::_thesis: contradiction consider v being set such that A7: v in G .reachableDFrom src and A8: not v in dom (((DIJK:CompSeq src) . n) `1) by A4, XBOOLE_0:6; reconsider v = v as Vertex of G by A7; consider W being directed Walk of G such that A9: W is_Walk_from src,v by A7, GLIB_002:def_6; defpred S2[ Nat] means ( $1 is odd & $1 <= len W & not W . $1 in dom (((DIJK:CompSeq src) . n) `1) ); W . (len W) = W .last() by GLIB_001:def_7 .= v by A9, GLIB_001:def_23 ; then A10: ex k being Nat st S2[k] by A8; consider k being Nat such that A11: ( S2[k] & ( for m being Nat st S2[m] holds k <= m ) ) from NAT_1:sch_5(A10); A12: dom (((DIJK:CompSeq src) . 0) `1) c= dom (((DIJK:CompSeq src) . n) `1) by Th18; now__::_thesis:_contradiction percases ( k = 1 or k <> 1 ) ; suppose k = 1 ; ::_thesis: contradiction then W . k = W .first() by GLIB_001:def_6 .= src by A9, GLIB_001:def_23 ; hence contradiction by A5, A12, A11; ::_thesis: verum end; supposeA13: k <> 1 ; ::_thesis: contradiction reconsider k9 = k as odd Element of NAT by A11, ORDINAL1:def_12; 1 <= k by A11, ABIAN:12; then 1 < k by A13, XXREAL_0:1; then 1 + 1 < k + 1 by XREAL_1:8; then 2 * 1 <= k by NAT_1:13; then reconsider k2a = k9 - (2 * 1) as odd Element of NAT by INT_1:5; set e = W . (k2a + 1); A14: k - 2 < (len W) - 0 by A11, XREAL_1:15; then A15: W . (k2a + 1) DJoins W . k2a,W . (k2a + 2),G by GLIB_001:122; then A16: (the_Target_of G) . (W . (k2a + 1)) = W . (k2a + 2) by GLIB_000:def_14; k2a < k - 0 by XREAL_1:15; then A17: W . k2a in dom (((DIJK:CompSeq src) . n) `1) by A11, A14; ( W . (k2a + 1) in the_Edges_of G & (the_Source_of G) . (W . (k2a + 1)) = W . k2a ) by A15, GLIB_000:def_14; hence contradiction by A3, A6, A11, A17, A16; ::_thesis: verum end; end; end; hence contradiction ; ::_thesis: verum end; then reconsider BE1 = BE1 as non empty finite set ; deffunc H1( Element of BE1) -> set = ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . $1)) + ((the_Weight_of G) . $1); consider e1 being Element of BE1 such that A18: for e2 being Element of BE1 holds H1(e1) <= H1(e2) from GRAPH_5:sch_2(); A19: not (the_Target_of G) . e1 in dom (((DIJK:CompSeq src) . n) `1) by A3; A20: e1 in the_Edges_of G by A3; then (the_Target_of G) . e1 in the_Vertices_of G by FUNCT_2:5; then A21: (the_Target_of G) . e1 in (the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)) by A19, XBOOLE_0:def_5; A22: now__::_thesis:_for_y_being_set_st_y_DSJoins_dom_(((DIJK:CompSeq_src)_._n)_`1),(the_Vertices_of_G)_\_(dom_(((DIJK:CompSeq_src)_._n)_`1)),G_holds_ ((((DIJK:CompSeq_src)_._n)_`1)_._((the_Source_of_G)_._e1))_+_((the_Weight_of_G)_._e1)_<=_((((DIJK:CompSeq_src)_._n)_`1)_._((the_Source_of_G)_._y))_+_((the_Weight_of_G)_._y) let y be set ; ::_thesis: ( y DSJoins dom (((DIJK:CompSeq src) . n) `1),(the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)),G implies ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . y)) + ((the_Weight_of G) . y) ) assume A23: y DSJoins dom (((DIJK:CompSeq src) . n) `1),(the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)),G ; ::_thesis: ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . y)) + ((the_Weight_of G) . y) then (the_Target_of G) . y in (the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)) by GLIB_000:def_16; then A24: not (the_Target_of G) . y in dom (((DIJK:CompSeq src) . n) `1) by XBOOLE_0:def_5; ( y in the_Edges_of G & (the_Source_of G) . y in dom (((DIJK:CompSeq src) . n) `1) ) by A23, GLIB_000:def_16; then y in BE1 by A3, A24; hence ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . e1)) + ((the_Weight_of G) . e1) <= ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . y)) + ((the_Weight_of G) . y) by A18; ::_thesis: verum end; (the_Source_of G) . e1 in dom (((DIJK:CompSeq src) . n) `1) by A3; then e1 DSJoins dom (((DIJK:CompSeq src) . n) `1),(the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)),G by A20, A21, GLIB_000:def_16; hence contradiction by A1, A22, Def7; ::_thesis: verum end; hence dom (((DIJK:CompSeq src) . n) `1) = G .reachableDFrom src ; ::_thesis: verum end; assume A25: dom (((DIJK:CompSeq src) . n) `1) = G .reachableDFrom src ; ::_thesis: DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} A26: (DIJK:CompSeq src) . (n + 1) = DIJK:Step ((DIJK:CompSeq src) . n) by Def11; now__::_thesis:_not_DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)_<>_{} assume DIJK:NextBestEdges ((DIJK:CompSeq src) . n) <> {} ; ::_thesis: contradiction then A27: card (dom (((DIJK:CompSeq src) . (n + 1)) `1)) = (card (G .reachableDFrom src)) + 1 by A26, A25, Th15; card (dom (((DIJK:CompSeq src) . (n + 1)) `1)) c= card (G .reachableDFrom src) by Th19, CARD_1:11; then (card (G .reachableDFrom src)) + 1 <= (card (G .reachableDFrom src)) + 0 by A27, NAT_1:39; hence contradiction by XREAL_1:6; ::_thesis: verum end; hence DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} ; ::_thesis: verum end; theorem Th21: :: GLIB_004:21 for G being finite real-weighted WGraph for s being Vertex of G for n being Nat holds card (dom (((DIJK:CompSeq s) . n) `1)) = min ((n + 1),(card (G .reachableDFrom s))) proof let G be finite real-weighted WGraph; ::_thesis: for s being Vertex of G for n being Nat holds card (dom (((DIJK:CompSeq s) . n) `1)) = min ((n + 1),(card (G .reachableDFrom s))) let src be Vertex of G; ::_thesis: for n being Nat holds card (dom (((DIJK:CompSeq src) . n) `1)) = min ((n + 1),(card (G .reachableDFrom src))) set DCS = DIJK:CompSeq src; set VL0 = dom (((DIJK:CompSeq src) . 0) `1); set RFS = G .reachableDFrom src; defpred S1[ Nat] means card (dom (((DIJK:CompSeq src) . $1) `1)) = min (($1 + 1),(card (G .reachableDFrom src))); src in G .reachableDFrom src by GLIB_002:18; then {src} c= G .reachableDFrom src by ZFMISC_1:31; then card {src} <= card (G .reachableDFrom src) by NAT_1:43; then A1: 0 + 1 <= card (G .reachableDFrom src) by CARD_1:30; now__::_thesis:_for_k_being_Nat_st_card_(dom_(((DIJK:CompSeq_src)_._k)_`1))_=_min_((k_+_1),(card_(G_.reachableDFrom_src)))_holds_ card_(dom_(((DIJK:CompSeq_src)_._(k_+_1))_`1))_=_min_(((k_+_1)_+_1),(card_(G_.reachableDFrom_src))) let k be Nat; ::_thesis: ( card (dom (((DIJK:CompSeq src) . k) `1)) = min ((k + 1),(card (G .reachableDFrom src))) implies card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = min (((k + 1) + 1),(card (G .reachableDFrom src))) ) assume A2: card (dom (((DIJK:CompSeq src) . k) `1)) = min ((k + 1),(card (G .reachableDFrom src))) ; ::_thesis: card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = min (((k + 1) + 1),(card (G .reachableDFrom src))) set Gk = (DIJK:CompSeq src) . k; set Gk1b = (DIJK:CompSeq src) . (k + 1); set BestEdges = DIJK:NextBestEdges ((DIJK:CompSeq src) . k); A3: (DIJK:CompSeq src) . (k + 1) = DIJK:Step ((DIJK:CompSeq src) . k) by Def11; now__::_thesis:_card_(dom_(((DIJK:CompSeq_src)_._(k_+_1))_`1))_=_min_(((k_+_1)_+_1),(card_(G_.reachableDFrom_src))) percases ( DIJK:NextBestEdges ((DIJK:CompSeq src) . k) = {} or DIJK:NextBestEdges ((DIJK:CompSeq src) . k) <> {} ) ; supposeA4: DIJK:NextBestEdges ((DIJK:CompSeq src) . k) = {} ; ::_thesis: card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = min (((k + 1) + 1),(card (G .reachableDFrom src))) then card (dom (((DIJK:CompSeq src) . k) `1)) = card (G .reachableDFrom src) by Th20; then card (G .reachableDFrom src) <= k + 1 by A2, XXREAL_0:def_9; then A5: card (G .reachableDFrom src) <= (k + 1) + 1 by NAT_1:12; card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = card (dom (((DIJK:CompSeq src) . k) `1)) by A3, A4, Th15; then card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = card (G .reachableDFrom src) by A4, Th20; hence card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = min (((k + 1) + 1),(card (G .reachableDFrom src))) by A5, XXREAL_0:def_9; ::_thesis: verum end; supposeA6: DIJK:NextBestEdges ((DIJK:CompSeq src) . k) <> {} ; ::_thesis: card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = min (((k + 1) + 1),(card (G .reachableDFrom src))) then A7: dom (((DIJK:CompSeq src) . k) `1) <> G .reachableDFrom src by Th20; A8: now__::_thesis:_not_card_(dom_(((DIJK:CompSeq_src)_._k)_`1))_=_card_(G_.reachableDFrom_src) dom (((DIJK:CompSeq src) . k) `1) c= G .reachableDFrom src by Th19; then A9: dom (((DIJK:CompSeq src) . k) `1) c< G .reachableDFrom src by A7, XBOOLE_0:def_8; assume card (dom (((DIJK:CompSeq src) . k) `1)) = card (G .reachableDFrom src) ; ::_thesis: contradiction hence contradiction by A9, CARD_2:48; ::_thesis: verum end; then k + 1 <= card (G .reachableDFrom src) by A2, XXREAL_0:def_9; then A10: (k + 1) + 1 <= (card (G .reachableDFrom src)) + 1 by XREAL_1:6; (k + 1) + 1 <> (card (G .reachableDFrom src)) + 1 by A2, A8; then (k + 1) + 1 < (card (G .reachableDFrom src)) + 1 by A10, XXREAL_0:1; then A11: (k + 1) + 1 <= card (G .reachableDFrom src) by NAT_1:13; card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = (card (dom (((DIJK:CompSeq src) . k) `1))) + 1 by A3, A6, Th15; then card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = (k + 1) + 1 by A2, A8, XXREAL_0:15; hence card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = min (((k + 1) + 1),(card (G .reachableDFrom src))) by A11, XXREAL_0:def_9; ::_thesis: verum end; end; end; hence card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = min (((k + 1) + 1),(card (G .reachableDFrom src))) ; ::_thesis: verum end; then A12: for k being Nat st S1[k] holds S1[k + 1] ; (DIJK:CompSeq src) . 0 = DIJK:Init src by Def11; then card (dom (((DIJK:CompSeq src) . 0) `1)) = card {src} by Th17 .= 1 by CARD_1:30 ; then A13: S1[ 0 ] by A1, XXREAL_0:def_9; for n being Nat holds S1[n] from NAT_1:sch_2(A13, A12); hence for n being Nat holds card (dom (((DIJK:CompSeq src) . n) `1)) = min ((n + 1),(card (G .reachableDFrom src))) ; ::_thesis: verum end; theorem Th22: :: GLIB_004:22 for G being finite real-weighted WGraph for src being Vertex of G for n being Nat holds ((DIJK:CompSeq src) . n) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . n) `1)) proof let G be finite real-weighted WGraph; ::_thesis: for src being Vertex of G for n being Nat holds ((DIJK:CompSeq src) . n) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . n) `1)) let src be Vertex of G; ::_thesis: for n being Nat holds ((DIJK:CompSeq src) . n) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . n) `1)) set DCS = DIJK:CompSeq src; set D0 = (DIJK:CompSeq src) . 0; defpred S1[ Nat] means ((DIJK:CompSeq src) . $1) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . $1) `1)); now__::_thesis:_for_n_being_Nat_st_((DIJK:CompSeq_src)_._n)_`2_c=_G_.edgesBetween_(dom_(((DIJK:CompSeq_src)_._n)_`1))_holds_ ((DIJK:CompSeq_src)_._(n_+_1))_`2_c=_G_.edgesBetween_(dom_(((DIJK:CompSeq_src)_._(n_+_1))_`1)) let n be Nat; ::_thesis: ( ((DIJK:CompSeq src) . n) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . n) `1)) implies ((DIJK:CompSeq src) . (n + 1)) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) ) set Dn = (DIJK:CompSeq src) . n; set Dn1 = (DIJK:CompSeq src) . (n + 1); set BE = DIJK:NextBestEdges ((DIJK:CompSeq src) . n); set e = choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)); set target = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))); set val = ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))); set DnE = (((DIJK:CompSeq src) . n) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))}; assume A1: ((DIJK:CompSeq src) . n) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . n) `1)) ; ::_thesis: ((DIJK:CompSeq src) . (n + 1)) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) A2: (DIJK:CompSeq src) . (n + 1) = DIJK:Step ((DIJK:CompSeq src) . n) by Def11; now__::_thesis:_for_x_being_set_st_x_in_((DIJK:CompSeq_src)_._(n_+_1))_`2_holds_ x_in_G_.edgesBetween_(dom_(((DIJK:CompSeq_src)_._(n_+_1))_`1)) let x be set ; ::_thesis: ( x in ((DIJK:CompSeq src) . (n + 1)) `2 implies x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) ) n <= n + 1 by NAT_1:12; then A3: dom (((DIJK:CompSeq src) . n) `1) c= dom (((DIJK:CompSeq src) . (n + 1)) `1) by Th18; assume A4: x in ((DIJK:CompSeq src) . (n + 1)) `2 ; ::_thesis: x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) now__::_thesis:_x_in_G_.edgesBetween_(dom_(((DIJK:CompSeq_src)_._(n_+_1))_`1)) percases ( DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} or DIJK:NextBestEdges ((DIJK:CompSeq src) . n) <> {} ) ; suppose DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} ; ::_thesis: x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) then (DIJK:CompSeq src) . (n + 1) = (DIJK:CompSeq src) . n by A2, Def8; hence x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) by A1, A4; ::_thesis: verum end; supposeA5: DIJK:NextBestEdges ((DIJK:CompSeq src) . n) <> {} ; ::_thesis: x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) then A6: (DIJK:CompSeq src) . (n + 1) = [((((DIJK:CompSeq src) . n) `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))))),((((DIJK:CompSeq src) . n) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))})] by A2, Def8; then A7: ((DIJK:CompSeq src) . (n + 1)) `2 = (((DIJK:CompSeq src) . n) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))} by MCART_1:7; ((DIJK:CompSeq src) . (n + 1)) `1 = (((DIJK:CompSeq src) . n) `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))))) by A6, MCART_1:7; then A8: dom (((DIJK:CompSeq src) . (n + 1)) `1) = (dom (((DIJK:CompSeq src) . n) `1)) \/ {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} by Lm1; A9: choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in DIJK:NextBestEdges ((DIJK:CompSeq src) . n) by A5; now__::_thesis:_x_in_G_.edgesBetween_(dom_(((DIJK:CompSeq_src)_._(n_+_1))_`1)) percases ( x in ((DIJK:CompSeq src) . n) `2 or x in {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))} ) by A4, A7, XBOOLE_0:def_3; supposeA10: x in ((DIJK:CompSeq src) . n) `2 ; ::_thesis: x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) ( (the_Source_of G) . x in dom (((DIJK:CompSeq src) . n) `1) & (the_Target_of G) . x in dom (((DIJK:CompSeq src) . n) `1) ) by A1, A10, GLIB_000:31; hence x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) by A3, A10, GLIB_000:31; ::_thesis: verum end; suppose x in {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))} ; ::_thesis: x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) then A11: x = choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) by TARSKI:def_1; then (the_Target_of G) . x in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} by TARSKI:def_1; then A12: (the_Target_of G) . x in dom (((DIJK:CompSeq src) . (n + 1)) `1) by A8, XBOOLE_0:def_3; choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) DSJoins dom (((DIJK:CompSeq src) . n) `1),(the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)),G by A5, Def7; then (the_Source_of G) . x in dom (((DIJK:CompSeq src) . n) `1) by A11, GLIB_000:def_16; hence x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) by A3, A9, A11, A12, GLIB_000:31; ::_thesis: verum end; end; end; hence x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) ; ::_thesis: verum end; end; end; hence x in G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) ; ::_thesis: verum end; hence ((DIJK:CompSeq src) . (n + 1)) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) by TARSKI:def_3; ::_thesis: verum end; then A13: for k being Nat st S1[k] holds S1[k + 1] ; (DIJK:CompSeq src) . 0 = DIJK:Init src by Def11; then for x being set st x in ((DIJK:CompSeq src) . 0) `2 holds x in G .edgesBetween (dom (((DIJK:CompSeq src) . 0) `1)) by MCART_1:7; then A14: S1[ 0 ] by TARSKI:def_3; for n being Nat holds S1[n] from NAT_1:sch_2(A14, A13); hence for n being Nat holds ((DIJK:CompSeq src) . n) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . n) `1)) ; ::_thesis: verum end; theorem Th23: :: GLIB_004:23 for G being finite nonnegative-weighted WGraph for s being Vertex of G for n being Nat for G2 being inducedWSubgraph of G, dom (((DIJK:CompSeq s) . n) `1),((DIJK:CompSeq s) . n) `2 holds ( G2 is_mincost_DTree_rooted_at s & ( for v being Vertex of G st v in dom (((DIJK:CompSeq s) . n) `1) holds G .min_DPath_cost (s,v) = (((DIJK:CompSeq s) . n) `1) . v ) ) proof let G be finite nonnegative-weighted WGraph; ::_thesis: for s being Vertex of G for n being Nat for G2 being inducedWSubgraph of G, dom (((DIJK:CompSeq s) . n) `1),((DIJK:CompSeq s) . n) `2 holds ( G2 is_mincost_DTree_rooted_at s & ( for v being Vertex of G st v in dom (((DIJK:CompSeq s) . n) `1) holds G .min_DPath_cost (s,v) = (((DIJK:CompSeq s) . n) `1) . v ) ) let src be Vertex of G; ::_thesis: for n being Nat for G2 being inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 holds ( G2 is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . n) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . n) `1) . v ) ) set DCS = DIJK:CompSeq src; set D0 = (DIJK:CompSeq src) . 0; defpred S1[ Nat] means for G2 being inducedWSubgraph of G, dom (((DIJK:CompSeq src) . $1) `1),((DIJK:CompSeq src) . $1) `2 holds ( G2 is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . $1) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . $1) `1) . v ) ); A1: (DIJK:CompSeq src) . 0 = DIJK:Init src by Def11; then A2: ((DIJK:CompSeq src) . 0) `1 = src .--> 0 by MCART_1:7; then A3: dom (((DIJK:CompSeq src) . 0) `1) = {src} by FUNCOP_1:13; now__::_thesis:_for_n_being_Nat_st_S1[n]_holds_ for_Dn1W_being_inducedWSubgraph_of_G,_dom_(((DIJK:CompSeq_src)_._(n_+_1))_`1),((DIJK:CompSeq_src)_._(n_+_1))_`2_holds_ (_Dn1W_is_mincost_DTree_rooted_at_src_&_(_for_v_being_Vertex_of_G_st_v_in_dom_(((DIJK:CompSeq_src)_._(n_+_1))_`1)_holds_ G_.min_DPath_cost_(src,v)_=_(((DIJK:CompSeq_src)_._(n_+_1))_`1)_._v_)_) let n be Nat; ::_thesis: ( S1[n] implies for Dn1W being inducedWSubgraph of G, dom (((DIJK:CompSeq src) . (n + 1)) `1),((DIJK:CompSeq src) . (n + 1)) `2 holds ( Dn1W is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . (n + 1)) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ) ) ) set Dn = (DIJK:CompSeq src) . n; set Dn1 = (DIJK:CompSeq src) . (n + 1); set BE = DIJK:NextBestEdges ((DIJK:CompSeq src) . n); set e = choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)); set source = (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))); set target = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))); set DnE = (((DIJK:CompSeq src) . n) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))}; set pc = (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))); set ec = (the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))); set DnW = the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ; A4: (DIJK:CompSeq src) . (n + 1) = DIJK:Step ((DIJK:CompSeq src) . n) by Def11; assume A5: S1[n] ; ::_thesis: for Dn1W being inducedWSubgraph of G, dom (((DIJK:CompSeq src) . (n + 1)) `1),((DIJK:CompSeq src) . (n + 1)) `2 holds ( Dn1W is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . (n + 1)) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ) ) then A6: the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 is_mincost_DTree_rooted_at src ; then A7: the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 is Tree-like by Def1; let Dn1W be inducedWSubgraph of G, dom (((DIJK:CompSeq src) . (n + 1)) `1),((DIJK:CompSeq src) . (n + 1)) `2 ; ::_thesis: ( Dn1W is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . (n + 1)) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ) ) A8: ( src in dom (((DIJK:CompSeq src) . 0) `1) & dom (((DIJK:CompSeq src) . 0) `1) c= dom (((DIJK:CompSeq src) . n) `1) ) by A3, Th18, TARSKI:def_1; A9: ((DIJK:CompSeq src) . n) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . n) `1)) by Th22; then A10: card (((DIJK:CompSeq src) . n) `2) = the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 .size() by A8, GLIB_000:def_37; A11: ((DIJK:CompSeq src) . n) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . n) `1)) by Th22; then A12: the_Vertices_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 = dom (((DIJK:CompSeq src) . n) `1) by A8, GLIB_000:def_37; A13: the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 = ((DIJK:CompSeq src) . n) `2 by A8, A11, GLIB_000:def_37; A14: card (dom (((DIJK:CompSeq src) . n) `1)) = the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 .order() by A8, A9, GLIB_000:def_37; now__::_thesis:_(_Dn1W_is_mincost_DTree_rooted_at_src_&_(_for_v_being_Vertex_of_G_st_v_in_dom_(((DIJK:CompSeq_src)_._(n_+_1))_`1)_holds_ G_.min_DPath_cost_(src,v)_=_(((DIJK:CompSeq_src)_._(n_+_1))_`1)_._v_)_) percases ( DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} or DIJK:NextBestEdges ((DIJK:CompSeq src) . n) <> {} ) ; suppose DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} ; ::_thesis: ( Dn1W is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . (n + 1)) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ) ) then (DIJK:CompSeq src) . (n + 1) = (DIJK:CompSeq src) . n by A4, Def8; hence ( Dn1W is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . (n + 1)) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ) ) by A5; ::_thesis: verum end; supposeA15: DIJK:NextBestEdges ((DIJK:CompSeq src) . n) <> {} ; ::_thesis: ( Dn1W is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . (n + 1)) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ) ) set mc = G .min_DPath_cost (src,((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))); A16: the_Weight_of Dn1W = (the_Weight_of G) | (the_Edges_of Dn1W) by GLIB_003:def_10; A17: choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) DSJoins dom (((DIJK:CompSeq src) . n) `1),(the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)),G by A15, Def7; then A18: (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) in (the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)) by GLIB_000:def_16; then A19: src <> (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A8, XBOOLE_0:def_5; A20: not (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) in dom (((DIJK:CompSeq src) . n) `1) by A18, XBOOLE_0:def_5; then A21: card ((dom (((DIJK:CompSeq src) . n) `1)) \/ {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))}) = (card (dom (((DIJK:CompSeq src) . n) `1))) + 1 by CARD_2:41; A22: (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) in dom (((DIJK:CompSeq src) . n) `1) by A17, GLIB_000:def_16; A23: (DIJK:CompSeq src) . (n + 1) = [((((DIJK:CompSeq src) . n) `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))))),((((DIJK:CompSeq src) . n) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))})] by A4, A15, Def8; then ((DIJK:CompSeq src) . (n + 1)) `1 = (((DIJK:CompSeq src) . n) `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))))) by MCART_1:7; then A24: dom (((DIJK:CompSeq src) . (n + 1)) `1) = (dom (((DIJK:CompSeq src) . n) `1)) \/ {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} by Lm1; A25: ((DIJK:CompSeq src) . (n + 1)) `2 c= G .edgesBetween (dom (((DIJK:CompSeq src) . (n + 1)) `1)) by Th22; then A26: the_Vertices_of Dn1W = (dom (((DIJK:CompSeq src) . n) `1)) \/ {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} by A24, GLIB_000:def_37; ((DIJK:CompSeq src) . (n + 1)) `2 = (((DIJK:CompSeq src) . n) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))} by A23, MCART_1:7; then A27: the_Edges_of Dn1W = (((DIJK:CompSeq src) . n) `2) \/ {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))} by A24, A25, GLIB_000:def_37; A28: now__::_thesis:_(_the_Vertices_of_the_inducedWSubgraph_of_G,_dom_(((DIJK:CompSeq_src)_._n)_`1),((DIJK:CompSeq_src)_._n)_`2_c=_the_Vertices_of_Dn1W_&_the_Edges_of_the_inducedWSubgraph_of_G,_dom_(((DIJK:CompSeq_src)_._n)_`1),((DIJK:CompSeq_src)_._n)_`2_c=_the_Edges_of_Dn1W_&_(_for_e_being_set_st_e_in_the_Edges_of_the_inducedWSubgraph_of_G,_dom_(((DIJK:CompSeq_src)_._n)_`1),((DIJK:CompSeq_src)_._n)_`2_holds_ (_(the_Source_of_the_inducedWSubgraph_of_G,_dom_(((DIJK:CompSeq_src)_._n)_`1),((DIJK:CompSeq_src)_._n)_`2_)_._e_=_(the_Source_of_Dn1W)_._e_&_(the_Target_of_the_inducedWSubgraph_of_G,_dom_(((DIJK:CompSeq_src)_._n)_`1),((DIJK:CompSeq_src)_._n)_`2_)_._e_=_(the_Target_of_Dn1W)_._e_)_)_) thus ( the_Vertices_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 c= the_Vertices_of Dn1W & the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 c= the_Edges_of Dn1W ) by A12, A13, A26, A27, XBOOLE_1:7; ::_thesis: for e being set st e in the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 holds ( (the_Source_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Source_of Dn1W) . e & (the_Target_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Target_of Dn1W) . e ) let e be set ; ::_thesis: ( e in the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 implies ( (the_Source_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Source_of Dn1W) . e & (the_Target_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Target_of Dn1W) . e ) ) assume A29: e in the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ; ::_thesis: ( (the_Source_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Source_of Dn1W) . e & (the_Target_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Target_of Dn1W) . e ) then A30: (the_Target_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Target_of G) . e by GLIB_000:def_32; ( e in the_Edges_of Dn1W & (the_Source_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Source_of G) . e ) by A13, A27, A29, GLIB_000:def_32, XBOOLE_0:def_3; hence ( (the_Source_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Source_of Dn1W) . e & (the_Target_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) . e = (the_Target_of Dn1W) . e ) by A30, GLIB_000:def_32; ::_thesis: verum end; then reconsider DnW9 = the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 as [Weighted] Subgraph of Dn1W by GLIB_000:def_32; choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in {(choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))} by TARSKI:def_1; then A31: choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in the_Edges_of Dn1W by A27, XBOOLE_0:def_3; choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in DIJK:NextBestEdges ((DIJK:CompSeq src) . n) by A15; then choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) DJoins (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),G by GLIB_000:def_14; then A32: choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) DJoins (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),Dn1W by A31, GLIB_000:73; then A33: choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) Joins (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),Dn1W by GLIB_000:16; A34: the_Weight_of DnW9 = (the_Weight_of G) | (the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) by GLIB_003:def_10; A35: now__::_thesis:_for_y_being_set_st_y_in_dom_(the_Weight_of_DnW9)_holds_ (the_Weight_of_DnW9)_._y_=_(the_Weight_of_Dn1W)_._y let y be set ; ::_thesis: ( y in dom (the_Weight_of DnW9) implies (the_Weight_of DnW9) . y = (the_Weight_of Dn1W) . y ) assume y in dom (the_Weight_of DnW9) ; ::_thesis: (the_Weight_of DnW9) . y = (the_Weight_of Dn1W) . y then A36: y in the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ; hence (the_Weight_of DnW9) . y = (the_Weight_of G) . y by A34, FUNCT_1:49 .= (the_Weight_of Dn1W) . y by A28, A16, A36, FUNCT_1:49 ; ::_thesis: verum end; dom (the_Weight_of Dn1W) = the_Edges_of Dn1W by PARTFUN1:def_2; then (dom (the_Weight_of Dn1W)) /\ (the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) = the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 by A28, XBOOLE_1:28; then dom (the_Weight_of DnW9) = (dom (the_Weight_of Dn1W)) /\ (the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) by PARTFUN1:def_2; then the_Weight_of DnW9 = (the_Weight_of Dn1W) | (the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 ) by A35, FUNCT_1:46; then A37: the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 is WSubgraph of Dn1W by GLIB_003:def_10; A38: the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 is Subgraph of Dn1W by A28, GLIB_000:def_32; now__::_thesis:_for_u,_v_being_Vertex_of_Dn1W_ex_W_being_Walk_of_Dn1W_st_W_is_Walk_from_u,v let u, v be Vertex of Dn1W; ::_thesis: ex W being Walk of Dn1W st W is_Walk_from u,v A39: now__::_thesis:_for_u,_v_being_set_st_u_in_dom_(((DIJK:CompSeq_src)_._n)_`1)_&_v_in_dom_(((DIJK:CompSeq_src)_._n)_`1)_holds_ ex_W_being_Walk_of_Dn1W_st_W_is_Walk_from_u,v let u, v be set ; ::_thesis: ( u in dom (((DIJK:CompSeq src) . n) `1) & v in dom (((DIJK:CompSeq src) . n) `1) implies ex W being Walk of Dn1W st W is_Walk_from u,v ) assume ( u in dom (((DIJK:CompSeq src) . n) `1) & v in dom (((DIJK:CompSeq src) . n) `1) ) ; ::_thesis: ex W being Walk of Dn1W st W is_Walk_from u,v then reconsider u9 = u, v9 = v as Vertex of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 by A11, GLIB_000:def_37; consider W1 being Walk of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 such that A40: W1 is_Walk_from u9,v9 by A7, GLIB_002:def_1; reconsider W2 = W1 as Walk of Dn1W by A38, GLIB_001:167; W2 is_Walk_from u,v by A40, GLIB_001:19; hence ex W being Walk of Dn1W st W is_Walk_from u,v ; ::_thesis: verum end; now__::_thesis:_ex_W_being_Walk_of_Dn1W_st_W_is_Walk_from_u,v percases ( ( u in dom (((DIJK:CompSeq src) . n) `1) & v in dom (((DIJK:CompSeq src) . n) `1) ) or ( u in dom (((DIJK:CompSeq src) . n) `1) & v in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ) or ( u in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} & v in dom (((DIJK:CompSeq src) . n) `1) ) or ( u in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} & v in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ) ) by A26, XBOOLE_0:def_3; suppose ( u in dom (((DIJK:CompSeq src) . n) `1) & v in dom (((DIJK:CompSeq src) . n) `1) ) ; ::_thesis: ex W being Walk of Dn1W st W is_Walk_from u,v hence ex W being Walk of Dn1W st W is_Walk_from u,v by A39; ::_thesis: verum end; supposeA41: ( u in dom (((DIJK:CompSeq src) . n) `1) & v in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ) ; ::_thesis: ex W being Walk of Dn1W st W is_Walk_from u,v then A42: v = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by TARSKI:def_1; consider W being Walk of Dn1W such that A43: W is_Walk_from u,(the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A22, A39, A41; W .addEdge (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) is_Walk_from u,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A33, A43, GLIB_001:66; hence ex W being Walk of Dn1W st W is_Walk_from u,v by A42; ::_thesis: verum end; supposeA44: ( u in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} & v in dom (((DIJK:CompSeq src) . n) `1) ) ; ::_thesis: ex W being Walk of Dn1W st W is_Walk_from u,v then consider W being Walk of Dn1W such that A45: W is_Walk_from v,(the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A22, A39; W .addEdge (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) is_Walk_from v,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A33, A45, GLIB_001:66; then W .addEdge (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) is_Walk_from v,u by A44, TARSKI:def_1; then (W .addEdge (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .reverse() is_Walk_from u,v by GLIB_001:23; hence ex W being Walk of Dn1W st W is_Walk_from u,v ; ::_thesis: verum end; supposeA46: ( u in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} & v in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ) ; ::_thesis: ex W being Walk of Dn1W st W is_Walk_from u,v take W = Dn1W .walkOf u; ::_thesis: W is_Walk_from u,v ( u = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) & v = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) ) by A46, TARSKI:def_1; hence W is_Walk_from u,v by GLIB_001:13; ::_thesis: verum end; end; end; hence ex W being Walk of Dn1W st W is_Walk_from u,v ; ::_thesis: verum end; then A47: Dn1W is connected by GLIB_002:def_1; A48: not choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in ((DIJK:CompSeq src) . n) `2 by A9, A20, GLIB_000:31; then Dn1W .size() = ( the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 .size()) + 1 by A10, A27, CARD_2:41; then Dn1W .order() = (Dn1W .size()) + 1 by A14, A7, A26, A21, GLIB_002:47; then A49: Dn1W is Tree-like by A47, GLIB_002:47; now__::_thesis:_ex_W2_being_DPath_of_Dn1W_st_ (_W2_is_Walk_from_src,(the_Target_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))_&_W2_.cost()_=_((((DIJK:CompSeq_src)_._n)_`1)_._((the_Source_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))))_+_((the_Weight_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n))))_) consider WT being DPath of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 such that A50: WT is_Walk_from src,(the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) and A51: for W1 being DPath of G st W1 is_Walk_from src,(the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) holds WT .cost() <= W1 .cost() by A12, A6, A22, Def1; reconsider WT9 = WT as DPath of Dn1W by A38, GLIB_001:175; set W2 = WT9 .addEdge (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))); A52: WT9 is_Walk_from src,(the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A50, GLIB_001:19; then reconsider W2 = WT9 .addEdge (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) as DWalk of Dn1W by A32, GLIB_001:123; now__::_thesis:_(_(the_Target_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))_is_Vertex_of_Dn1W_&_choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n))_Joins_WT9_.last()_,(the_Target_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n))),Dn1W_&_not_choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n))_in_WT9_.edges()_&_(_WT9_is_trivial_or_WT9_is_open_)_&_(_for_n_being_odd_Element_of_NAT_st_1_<_n_&_n_<=_len_WT9_holds_ WT9_._n_<>_(the_Target_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))_)_) (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} by TARSKI:def_1; hence (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) is Vertex of Dn1W by A26, XBOOLE_0:def_3; ::_thesis: ( choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) Joins WT9 .last() ,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),Dn1W & not choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in WT9 .edges() & ( WT9 is trivial or WT9 is open ) & ( for n being odd Element of NAT st 1 < n & n <= len WT9 holds WT9 . n <> (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) ) ) thus choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) Joins WT9 .last() ,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),Dn1W by A33, A52, GLIB_001:def_23; ::_thesis: ( not choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in WT9 .edges() & ( WT9 is trivial or WT9 is open ) & ( for n being odd Element of NAT st 1 < n & n <= len WT9 holds WT9 . n <> (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) ) ) ( not choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in the_Edges_of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 & WT .edges() = WT9 .edges() ) by A8, A9, A48, GLIB_000:def_37, GLIB_001:110; hence not choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in WT9 .edges() ; ::_thesis: ( ( WT9 is trivial or WT9 is open ) & ( for n being odd Element of NAT st 1 < n & n <= len WT9 holds WT9 . n <> (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) ) ) now__::_thesis:_(_not_WT9_is_trivial_implies_WT9_is_open_) assume A53: not WT9 is trivial ; ::_thesis: WT9 is open now__::_thesis:_not_WT9_is_closed assume WT9 is closed ; ::_thesis: contradiction then WT9 is Cycle-like by A53, GLIB_001:def_31; hence contradiction by A49, GLIB_002:def_2; ::_thesis: verum end; hence WT9 is open ; ::_thesis: verum end; hence ( WT9 is trivial or WT9 is open ) ; ::_thesis: for n being odd Element of NAT st 1 < n & n <= len WT9 holds WT9 . n <> (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) let n be odd Element of NAT ; ::_thesis: ( 1 < n & n <= len WT9 implies WT9 . n <> (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) ) assume that 1 < n and A54: n <= len WT9 ; ::_thesis: WT9 . n <> (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) WT9 .vertices() = WT .vertices() by GLIB_001:98; then not (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) in WT9 .vertices() by A12, A18, XBOOLE_0:def_5; hence WT9 . n <> (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A54, GLIB_001:87; ::_thesis: verum end; then reconsider W2 = W2 as DPath of Dn1W by GLIB_001:150; take W2 = W2; ::_thesis: ( W2 is_Walk_from src,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) & W2 .cost() = ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) ) thus W2 is_Walk_from src,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A33, A52, GLIB_001:66; ::_thesis: W2 .cost() = ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) now__::_thesis:_(_choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n))_in_(WT9_.last())_.edgesInOut()_&_(the_Weight_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))_=_(the_Weight_of_Dn1W)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))_&_WT9_.cost()_=_(((DIJK:CompSeq_src)_._n)_`1)_._((the_Source_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n))))_) ( WT9 .last() = (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) & (the_Source_of Dn1W) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) = (the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) ) by A32, A52, GLIB_000:def_14, GLIB_001:def_23; hence choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)) in (WT9 .last()) .edgesInOut() by A31, GLIB_000:61; ::_thesis: ( (the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) = (the_Weight_of Dn1W) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) & WT9 .cost() = (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) ) reconsider WTG = WT as DPath of G by GLIB_001:175; A55: WTG is_Walk_from src,(the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A50, GLIB_001:19; (the_Weight_of Dn1W) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) = ((the_Weight_of G) | (the_Edges_of Dn1W)) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by GLIB_003:def_10; hence (the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) = (the_Weight_of Dn1W) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A31, FUNCT_1:49; ::_thesis: WT9 .cost() = (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) = G .min_DPath_cost (src,((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) by A5, A22; then consider WX being DPath of G such that A56: WX is_mincost_DPath_from src,(the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) and A57: (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) = WX .cost() by A55, Def3; WX is_Walk_from src,(the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A56, Def2; then WT .cost() <= (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) by A51, A57; then A58: WT9 .cost() <= (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) by A37, GLIB_003:27; (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) <= WTG .cost() by A55, A56, A57, Def2; then (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) <= WT9 .cost() by GLIB_003:27; hence WT9 .cost() = (((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) by A58, XXREAL_0:1; ::_thesis: verum end; hence W2 .cost() = ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) by GLIB_003:25; ::_thesis: verum end; then consider W2 being DPath of Dn1W such that A59: W2 is_Walk_from src,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) and A60: W2 .cost() = ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) ; reconsider W2G = W2 as DPath of G by GLIB_001:175; A61: W2G is_Walk_from src,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A59, GLIB_001:19; A62: W2G .cost() = ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) by A60, GLIB_003:27; now__::_thesis:_(_G_.min_DPath_cost_(src,((the_Target_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))))_<=_((((DIJK:CompSeq_src)_._n)_`1)_._((the_Source_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))))_+_((the_Weight_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n))))_&_G_.min_DPath_cost_(src,((the_Target_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))))_>=_((((DIJK:CompSeq_src)_._n)_`1)_._((the_Source_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))))_+_((the_Weight_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n))))_) consider WB being DPath of G such that A63: WB is_mincost_DPath_from src,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) and A64: G .min_DPath_cost (src,((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) = WB .cost() by A61, Def3; thus G .min_DPath_cost (src,((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) <= ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) by A61, A62, A63, A64, Def2; ::_thesis: G .min_DPath_cost (src,((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) >= ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) A65: WB is_Walk_from src,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A63, Def2; then reconsider target9 = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) as Vertex of G by GLIB_001:18; ( WB .first() = src & WB .last() = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) ) by A65, GLIB_001:def_23; then consider lenWB2h being odd Element of NAT such that A66: lenWB2h = (len WB) - 2 and A67: (WB .cut (1,lenWB2h)) .addEdge (WB . (lenWB2h + 1)) = WB by A19, GLIB_001:127, GLIB_001:133; A68: lenWB2h < (len WB) - 0 by A66, XREAL_1:15; set sa = WB . lenWB2h; set ea = WB . (lenWB2h + 1); set WA = WB .cut (1,lenWB2h); A69: 1 <= lenWB2h by ABIAN:12; A70: WB . 1 = WB .first() by GLIB_001:def_6 .= src by A65, GLIB_001:def_23 ; then WB .cut (1,lenWB2h) is_Walk_from src,WB . lenWB2h by A69, A68, GLIB_001:37, JORDAN12:2; then reconsider sa = WB . lenWB2h as Vertex of G by GLIB_001:18; A71: WB . (lenWB2h + 1) DJoins sa,WB . (lenWB2h + 2),G by A68, GLIB_001:122; then A72: WB . (lenWB2h + 1) DJoins sa,WB .last() ,G by A66, GLIB_001:def_7; then WB . (lenWB2h + 1) DJoins sa,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),G by A65, GLIB_001:def_23; then WB . (lenWB2h + 1) Joins sa,target9,G by GLIB_000:16; then WB . (lenWB2h + 1) in sa .edgesInOut() by GLIB_000:62; then A73: WB . (lenWB2h + 1) in ((WB .cut (1,lenWB2h)) .last()) .edgesInOut() by A69, A68, GLIB_001:37, JORDAN12:2; then A74: G .min_DPath_cost (src,((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) = ((WB .cut (1,lenWB2h)) .cost()) + ((the_Weight_of G) . (WB . (lenWB2h + 1))) by A64, A67, GLIB_003:25; reconsider WA = WB .cut (1,lenWB2h) as DPath of G ; A75: WA .first() = src by A69, A68, A70, GLIB_001:37, JORDAN12:2; A76: WA .last() = sa by A69, A68, GLIB_001:37, JORDAN12:2; then A77: WA is_mincost_DPath_from src,sa by A63, A75, Th12; A78: WB . (lenWB2h + 1) DJoins sa,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))),G by A65, A72, GLIB_001:def_23; A79: WA .cost() = G .min_DPath_cost (src,sa) by A63, A75, A76, Th12, Th14; now__::_thesis:_not_G_.min_DPath_cost_(src,((the_Target_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))))_<_((((DIJK:CompSeq_src)_._n)_`1)_._((the_Source_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))))_+_((the_Weight_of_G)_._(choose_(DIJK:NextBestEdges_((DIJK:CompSeq_src)_._n)))) defpred S2[ Nat] means ( $1 is odd & $1 <= len WA & not WA . $1 in dom (((DIJK:CompSeq src) . n) `1) ); A80: (the_Source_of G) . (WB . (lenWB2h + 1)) = sa by A71, GLIB_000:def_14; assume A81: G .min_DPath_cost (src,((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) < ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) ; ::_thesis: contradiction A82: now__::_thesis:_sa_in_dom_(((DIJK:CompSeq_src)_._n)_`1) assume A83: not sa in dom (((DIJK:CompSeq src) . n) `1) ; ::_thesis: contradiction sa = WA .last() by A69, A68, GLIB_001:37, JORDAN12:2 .= WA . (len WA) by GLIB_001:def_7 ; then A84: ex k being Nat st S2[k] by A83; consider k being Nat such that A85: ( S2[k] & ( for m being Nat st S2[m] holds k <= m ) ) from NAT_1:sch_5(A84); reconsider k = k as odd Element of NAT by A85, ORDINAL1:def_12; A86: 1 <= k by ABIAN:12; WA . 1 = WA .first() by GLIB_001:def_6 .= src by A69, A68, A70, GLIB_001:37, JORDAN12:2 ; then k <> 1 by A8, A85; then 1 < k by A86, XXREAL_0:1; then 1 + 1 < k + 1 by XREAL_1:8; then 2 <= k by NAT_1:13; then reconsider k2a = k - (2 * 1) as odd Element of NAT by INT_1:5; set sk = WA . k2a; set ek = WA . (k2a + 1); set tk = WA . k; A87: k2a < (len WA) - 0 by A85, XREAL_1:15; set WKA = WA .cut (1,k); set WKB = WA .cut (k,(len WA)); set WK1 = WA .cut (1,k2a); reconsider WK1 = WA .cut (1,k2a), WKA = WA .cut (1,k), WKB = WA .cut (k,(len WA)) as DPath of G ; A88: 1 <= k by ABIAN:12; then A89: WKA .append WKB = WA .cut (1,(len WA)) by A85, GLIB_001:38, JORDAN12:2 .= WA by GLIB_001:39 ; A90: k2a < k - 0 by XREAL_1:15; then A91: WA . k2a in dom (((DIJK:CompSeq src) . n) `1) by A85, A87; then reconsider sk = WA . k2a as Vertex of G ; A92: 1 <= k2a by ABIAN:12; then A93: WK1 .last() = sk by A87, GLIB_001:37, JORDAN12:2; WK1 .first() = WA . 1 by A92, A87, GLIB_001:37, JORDAN12:2; then WK1 is_mincost_DPath_from WA . 1,sk by A77, A93, Th12; then WK1 is_mincost_DPath_from WA .first() ,sk by GLIB_001:def_6; then G .min_DPath_cost (src,sk) = WK1 .cost() by A75, Th14; then A94: (((DIJK:CompSeq src) . n) `1) . sk = WK1 .cost() by A5, A85, A87, A90; reconsider tk = WA . k as Vertex of G by A85, GLIB_001:7; A95: tk in (the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)) by A85, XBOOLE_0:def_5; tk = WA . (k2a + 2) ; then A96: WA . (k2a + 1) DJoins sk,tk,G by A87, GLIB_001:122; then A97: (the_Source_of G) . (WA . (k2a + 1)) = sk by GLIB_000:def_14; WKB .first() = WA . k by A85, GLIB_001:37 .= WKA .last() by A85, A88, GLIB_001:37, JORDAN12:2 ; then A98: WA .cost() = (WKA .cost()) + (WKB .cost()) by A89, GLIB_003:24; 0 <= WKB .cost() by GLIB_003:29; then A99: 0 + (WKA .cost()) <= WA .cost() by A98, XREAL_1:7; WB . (lenWB2h + 1) in the_Edges_of G by A71, GLIB_000:def_14; then A100: 0 <= (the_Weight_of G) . (WB . (lenWB2h + 1)) by GLIB_003:31; ( WA . (k2a + 1) in the_Edges_of G & (the_Target_of G) . (WA . (k2a + 1)) = tk ) by A96, GLIB_000:def_14; then WA . (k2a + 1) DSJoins dom (((DIJK:CompSeq src) . n) `1),(the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)),G by A91, A97, A95, GLIB_000:def_16; then A101: ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) <= (WK1 .cost()) + ((the_Weight_of G) . (WA . (k2a + 1))) by A15, A97, A94, Def7; ( WA . (k2a + 1) in the_Edges_of G & (the_Source_of G) . (WA . (k2a + 1)) = sk ) by A96, GLIB_000:def_14; then A102: WA . (k2a + 1) in sk .edgesInOut() by GLIB_000:61; k2a + 2 = k ; then WK1 .addEdge (WA . (k2a + 1)) = WKA by A87, ABIAN:12, GLIB_001:41, JORDAN12:2; then ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) <= WKA .cost() by A93, A101, A102, GLIB_003:25; then ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) <= WA .cost() by A99, XXREAL_0:2; then (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + 0 <= (WA .cost()) + ((the_Weight_of G) . (WB . (lenWB2h + 1))) by A100, XREAL_1:7; hence contradiction by A64, A67, A73, A81, GLIB_003:25; ::_thesis: verum end; then A103: WA .cost() = (((DIJK:CompSeq src) . n) `1) . sa by A5, A79; ( WB . (lenWB2h + 1) in the_Edges_of G & (the_Target_of G) . (WB . (lenWB2h + 1)) = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) ) by A78, GLIB_000:def_14; then WB . (lenWB2h + 1) DSJoins dom (((DIJK:CompSeq src) . n) `1),(the_Vertices_of G) \ (dom (((DIJK:CompSeq src) . n) `1)),G by A18, A82, A80, GLIB_000:def_16; hence contradiction by A15, A74, A81, A103, A80, Def7; ::_thesis: verum end; hence G .min_DPath_cost (src,((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) >= ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) ; ::_thesis: verum end; then A104: G .min_DPath_cost (src,((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) = ((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) by XXREAL_0:1; now__::_thesis:_for_x_being_Vertex_of_Dn1W_ex_W2_being_DPath_of_Dn1W_st_ (_W2_is_Walk_from_src,x_&_(_for_W1_being_DPath_of_G_st_W1_is_Walk_from_src,x_holds_ W2_.cost()_<=_W1_.cost()_)_) let x be Vertex of Dn1W; ::_thesis: ex W2 being DPath of Dn1W st ( W2 is_Walk_from src,x & ( for W1 being DPath of G st W1 is_Walk_from src,x holds W2 .cost() <= W1 .cost() ) ) now__::_thesis:_ex_W29_being_DPath_of_Dn1W_st_ (_W29_is_Walk_from_src,x_&_(_for_W1_being_DPath_of_G_st_W1_is_Walk_from_src,x_holds_ W29_.cost()_<=_W1_.cost()_)_) percases ( x in dom (((DIJK:CompSeq src) . n) `1) or x in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ) by A26, XBOOLE_0:def_3; suppose x in dom (((DIJK:CompSeq src) . n) `1) ; ::_thesis: ex W29 being DPath of Dn1W st ( W29 is_Walk_from src,x & ( for W1 being DPath of G st W1 is_Walk_from src,x holds W29 .cost() <= W1 .cost() ) ) then reconsider x9 = x as Vertex of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 by A11, GLIB_000:def_37; the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 is_mincost_DTree_rooted_at src by A5; then consider W2 being DPath of the inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 such that A105: W2 is_Walk_from src,x9 and A106: for W1 being DPath of G st W1 is_Walk_from src,x9 holds W2 .cost() <= W1 .cost() by Def1; reconsider W29 = W2 as DPath of Dn1W by A38, GLIB_001:175; take W29 = W29; ::_thesis: ( W29 is_Walk_from src,x & ( for W1 being DPath of G st W1 is_Walk_from src,x holds W29 .cost() <= W1 .cost() ) ) thus W29 is_Walk_from src,x by A105, GLIB_001:19; ::_thesis: for W1 being DPath of G st W1 is_Walk_from src,x holds W29 .cost() <= W1 .cost() let W1 be DPath of G; ::_thesis: ( W1 is_Walk_from src,x implies W29 .cost() <= W1 .cost() ) assume W1 is_Walk_from src,x ; ::_thesis: W29 .cost() <= W1 .cost() then W2 .cost() <= W1 .cost() by A106; hence W29 .cost() <= W1 .cost() by A37, GLIB_003:27; ::_thesis: verum end; supposeA107: x in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ; ::_thesis: ex W2 being DPath of Dn1W st ( W2 is_Walk_from src,x & ( for W1 being DPath of G st W1 is_Walk_from src,x holds W2 .cost() <= W1 .cost() ) ) take W2 = W2; ::_thesis: ( W2 is_Walk_from src,x & ( for W1 being DPath of G st W1 is_Walk_from src,x holds W2 .cost() <= W1 .cost() ) ) thus W2 is_Walk_from src,x by A59, A107, TARSKI:def_1; ::_thesis: for W1 being DPath of G st W1 is_Walk_from src,x holds W2 .cost() <= W1 .cost() let W1 be DPath of G; ::_thesis: ( W1 is_Walk_from src,x implies W2 .cost() <= W1 .cost() ) assume A108: W1 is_Walk_from src,x ; ::_thesis: W2 .cost() <= W1 .cost() A109: x = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A107, TARSKI:def_1; ex WX being DPath of G st ( WX is_mincost_DPath_from src,(the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) & WX .cost() = W2 .cost() ) by A60, A61, A104, Def3; hence W2 .cost() <= W1 .cost() by A109, A108, Def2; ::_thesis: verum end; end; end; hence ex W2 being DPath of Dn1W st ( W2 is_Walk_from src,x & ( for W1 being DPath of G st W1 is_Walk_from src,x holds W2 .cost() <= W1 .cost() ) ) ; ::_thesis: verum end; hence Dn1W is_mincost_DTree_rooted_at src by A49, Def1; ::_thesis: for v being Vertex of G st v in dom (((DIJK:CompSeq src) . (n + 1)) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v let v be Vertex of G; ::_thesis: ( v in dom (((DIJK:CompSeq src) . (n + 1)) `1) implies G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ) assume A110: v in dom (((DIJK:CompSeq src) . (n + 1)) `1) ; ::_thesis: G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v now__::_thesis:_G_.min_DPath_cost_(src,v)_=_(((DIJK:CompSeq_src)_._(n_+_1))_`1)_._v percases ( v in dom (((DIJK:CompSeq src) . n) `1) or v in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ) by A24, A110, XBOOLE_0:def_3; supposeA111: v in dom (((DIJK:CompSeq src) . n) `1) ; ::_thesis: G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v then A112: G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . n) `1) . v by A5; A113: ((DIJK:CompSeq src) . (n + 1)) `1 = (((DIJK:CompSeq src) . n) `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))))) by A23, MCART_1:7; A114: dom (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))))) = {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} by FUNCOP_1:13; not v in dom (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))))) by A20, A111, TARSKI:def_1; hence G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v by A24, A110, A112, A113, A114, FUNCT_4:def_1; ::_thesis: verum end; supposeA115: v in {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ; ::_thesis: G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ( ((DIJK:CompSeq src) . (n + 1)) `1 = (((DIJK:CompSeq src) . n) `1) +* (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))))) & dom (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))))) = {((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))} ) by A23, FUNCOP_1:13, MCART_1:7; then A116: (((DIJK:CompSeq src) . (n + 1)) `1) . v = (((the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))) .--> (((((DIJK:CompSeq src) . n) `1) . ((the_Source_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))))) + ((the_Weight_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n)))))) . v by A115, FUNCT_4:13; v = (the_Target_of G) . (choose (DIJK:NextBestEdges ((DIJK:CompSeq src) . n))) by A115, TARSKI:def_1; hence G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v by A104, A116, FUNCOP_1:72; ::_thesis: verum end; end; end; hence G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ; ::_thesis: verum end; end; end; hence ( Dn1W is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . (n + 1)) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . (n + 1)) `1) . v ) ) ; ::_thesis: verum end; then A117: for k being Nat st S1[k] holds S1[k + 1] ; A118: ((DIJK:CompSeq src) . 0) `2 = {} by A1, MCART_1:7; now__::_thesis:_for_D0W_being_inducedWSubgraph_of_G,_dom_(((DIJK:CompSeq_src)_._0)_`1),((DIJK:CompSeq_src)_._0)_`2_holds_ (_D0W_is_mincost_DTree_rooted_at_src_&_(_for_v_being_Vertex_of_G_st_v_in_dom_(((DIJK:CompSeq_src)_._0)_`1)_holds_ G_.min_DPath_cost_(src,v)_=_(((DIJK:CompSeq_src)_._0)_`1)_._v_)_) let D0W be inducedWSubgraph of G, dom (((DIJK:CompSeq src) . 0) `1),((DIJK:CompSeq src) . 0) `2 ; ::_thesis: ( D0W is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . 0) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . 0) `1) . v ) ) A119: {} c= G .edgesBetween (dom (((DIJK:CompSeq src) . 0) `1)) by XBOOLE_1:2; then A120: the_Vertices_of D0W = {src} by A3, A118, GLIB_000:def_37; then card (the_Vertices_of D0W) = 1 by CARD_1:30; then A121: D0W is trivial by GLIB_000:def_19; A122: now__::_thesis:_for_x_being_Vertex_of_D0W_ex_W2_being_Walk_of_D0W_st_ (_W2_is_Walk_from_src,x_&_(_for_W1_being_DPath_of_G_st_W1_is_Walk_from_src,x_holds_ W2_.cost()_<=_W1_.cost()_)_) let x be Vertex of D0W; ::_thesis: ex W2 being Walk of D0W st ( W2 is_Walk_from src,x & ( for W1 being DPath of G st W1 is_Walk_from src,x holds W2 .cost() <= W1 .cost() ) ) set W2 = D0W .walkOf x; take W2 = D0W .walkOf x; ::_thesis: ( W2 is_Walk_from src,x & ( for W1 being DPath of G st W1 is_Walk_from src,x holds W2 .cost() <= W1 .cost() ) ) x = src by A120, TARSKI:def_1; hence W2 is_Walk_from src,x by GLIB_001:13; ::_thesis: for W1 being DPath of G st W1 is_Walk_from src,x holds W2 .cost() <= W1 .cost() let W1 be DPath of G; ::_thesis: ( W1 is_Walk_from src,x implies W2 .cost() <= W1 .cost() ) assume W1 is_Walk_from src,x ; ::_thesis: W2 .cost() <= W1 .cost() 0 <= W1 .cost() by GLIB_003:29; hence W2 .cost() <= W1 .cost() by GLIB_003:21; ::_thesis: verum end; the_Edges_of D0W = {} by A2, A118, A119, GLIB_000:def_37; then D0W .order() = (D0W .size()) + 1 by A120, CARD_1:27, CARD_1:30; then D0W is Tree-like by A121, GLIB_002:47; hence D0W is_mincost_DTree_rooted_at src by A122, Def1; ::_thesis: for v being Vertex of G st v in dom (((DIJK:CompSeq src) . 0) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . 0) `1) . v let v be Vertex of G; ::_thesis: ( v in dom (((DIJK:CompSeq src) . 0) `1) implies G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . 0) `1) . v ) assume A123: v in dom (((DIJK:CompSeq src) . 0) `1) ; ::_thesis: G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . 0) `1) . v then A124: v = src by A3, TARSKI:def_1; A125: now__::_thesis:_G_.min_DPath_cost_(src,v)_=_0 set W1 = G .walkOf v; A126: G .walkOf v is_Walk_from src,v by A124, GLIB_001:13; then consider W being DPath of G such that A127: W is_mincost_DPath_from src,v and A128: G .min_DPath_cost (src,v) = W .cost() by Def3; (G .walkOf v) .cost() = 0 by GLIB_003:21; then W .cost() <= 0 by A126, A127, Def2; hence G .min_DPath_cost (src,v) = 0 by A128, GLIB_003:29; ::_thesis: verum end; (((DIJK:CompSeq src) . 0) `1) . src = 0 by A2, FUNCOP_1:72; hence G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . 0) `1) . v by A3, A123, A125, TARSKI:def_1; ::_thesis: verum end; then A129: S1[ 0 ] ; for n being Nat holds S1[n] from NAT_1:sch_2(A129, A117); hence for n being Nat for G2 being inducedWSubgraph of G, dom (((DIJK:CompSeq src) . n) `1),((DIJK:CompSeq src) . n) `2 holds ( G2 is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in dom (((DIJK:CompSeq src) . n) `1) holds G .min_DPath_cost (src,v) = (((DIJK:CompSeq src) . n) `1) . v ) ) ; ::_thesis: verum end; theorem Th24: :: GLIB_004:24 for G being finite real-weighted WGraph for s being Vertex of G holds DIJK:CompSeq s is halting proof let G be finite real-weighted WGraph; ::_thesis: for s being Vertex of G holds DIJK:CompSeq s is halting let src be Vertex of G; ::_thesis: DIJK:CompSeq src is halting set DCS = DIJK:CompSeq src; now__::_thesis:_ex_n_being_Element_of_NAT_st_(DIJK:CompSeq_src)_._n_=_(DIJK:CompSeq_src)_._(n_+_1) set RSize = card (G .reachableDFrom src); take n = card (G .reachableDFrom src); ::_thesis: (DIJK:CompSeq src) . n = (DIJK:CompSeq src) . (n + 1) set Gn = (DIJK:CompSeq src) . n; set Gn1a = (DIJK:CompSeq src) . (n + 1); set BestEdges = DIJK:NextBestEdges ((DIJK:CompSeq src) . n); A1: (DIJK:CompSeq src) . (n + 1) = DIJK:Step ((DIJK:CompSeq src) . n) by Def11; now__::_thesis:_(DIJK:CompSeq_src)_._n_=_(DIJK:CompSeq_src)_._(n_+_1) percases ( DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} or DIJK:NextBestEdges ((DIJK:CompSeq src) . n) <> {} ) ; suppose DIJK:NextBestEdges ((DIJK:CompSeq src) . n) = {} ; ::_thesis: (DIJK:CompSeq src) . n = (DIJK:CompSeq src) . (n + 1) hence (DIJK:CompSeq src) . n = (DIJK:CompSeq src) . (n + 1) by A1, Def8; ::_thesis: verum end; supposeA2: DIJK:NextBestEdges ((DIJK:CompSeq src) . n) <> {} ; ::_thesis: (DIJK:CompSeq src) . n = (DIJK:CompSeq src) . (n + 1) ( card (dom (((DIJK:CompSeq src) . n) `1)) = min ((n + 1),(card (G .reachableDFrom src))) & card (G .reachableDFrom src) <= (card (G .reachableDFrom src)) + 1 ) by Th21, NAT_1:11; then A3: card (dom (((DIJK:CompSeq src) . n) `1)) = card (G .reachableDFrom src) by XXREAL_0:def_9; ( (card (G .reachableDFrom src)) + 1 <= ((card (G .reachableDFrom src)) + 1) + 1 & card (G .reachableDFrom src) <= (card (G .reachableDFrom src)) + 1 ) by NAT_1:11; then A4: card (G .reachableDFrom src) <= (n + 1) + 1 by XXREAL_0:2; A5: card (dom (((DIJK:CompSeq src) . (n + 1)) `1)) = min (((n + 1) + 1),(card (G .reachableDFrom src))) by Th21 .= card (G .reachableDFrom src) by A4, XXREAL_0:def_9 ; card (dom ((DIJK:Step ((DIJK:CompSeq src) . n)) `1)) = (card (dom (((DIJK:CompSeq src) . n) `1))) + 1 by A2, Th15; hence (DIJK:CompSeq src) . n = (DIJK:CompSeq src) . (n + 1) by A3, A5, Def11; ::_thesis: verum end; end; end; hence (DIJK:CompSeq src) . n = (DIJK:CompSeq src) . (n + 1) ; ::_thesis: verum end; hence DIJK:CompSeq src is halting by GLIB_000:def_54; ::_thesis: verum end; registration let G be finite real-weighted WGraph; let src be Vertex of G; cluster DIJK:CompSeq src -> halting ; coherence DIJK:CompSeq src is halting by Th24; end; theorem Th25: :: GLIB_004:25 for G being finite real-weighted WGraph for s being Vertex of G holds ((DIJK:CompSeq s) .Lifespan()) + 1 = card (G .reachableDFrom s) proof let G be finite real-weighted WGraph; ::_thesis: for s being Vertex of G holds ((DIJK:CompSeq s) .Lifespan()) + 1 = card (G .reachableDFrom s) let src be Vertex of G; ::_thesis: ((DIJK:CompSeq src) .Lifespan()) + 1 = card (G .reachableDFrom src) set DCS = DIJK:CompSeq src; set RFS = G .reachableDFrom src; consider k being Nat such that A1: card (G .reachableDFrom src) = k + 1 by NAT_1:6; reconsider k = k as Element of NAT by ORDINAL1:def_12; A2: now__::_thesis:_for_n_being_Nat_st_(DIJK:CompSeq_src)_._n_=_(DIJK:CompSeq_src)_._(n_+_1)_holds_ k_<=_n let n be Nat; ::_thesis: ( (DIJK:CompSeq src) . n = (DIJK:CompSeq src) . (n + 1) implies k <= n ) set Gn = (DIJK:CompSeq src) . n; set Gn1 = (DIJK:CompSeq src) . (n + 1); assume A3: (DIJK:CompSeq src) . n = (DIJK:CompSeq src) . (n + 1) ; ::_thesis: k <= n now__::_thesis:_not_n_<_k assume n < k ; ::_thesis: contradiction then A4: n + 1 < card (G .reachableDFrom src) by A1, XREAL_1:8; then A5: (n + 1) + 1 <= card (G .reachableDFrom src) by NAT_1:13; card (dom (((DIJK:CompSeq src) . n) `1)) = min ((n + 1),(card (G .reachableDFrom src))) by Th21; then A6: card (dom (((DIJK:CompSeq src) . n) `1)) = n + 1 by A4, XXREAL_0:def_9; card (dom (((DIJK:CompSeq src) . (n + 1)) `1)) = min (((n + 1) + 1),(card (G .reachableDFrom src))) by Th21; then 0 + (n + 1) = 1 + (n + 1) by A3, A6, A5, XXREAL_0:def_9; hence contradiction ; ::_thesis: verum end; hence k <= n ; ::_thesis: verum end; set Gk = (DIJK:CompSeq src) . k; set Gk1 = (DIJK:CompSeq src) . (k + 1); A7: card (G .reachableDFrom src) <= (card (G .reachableDFrom src)) + 1 by NAT_1:11; A8: (DIJK:CompSeq src) . (k + 1) = DIJK:Step ((DIJK:CompSeq src) . k) by Def11; ( card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = min (((card (G .reachableDFrom src)) + 1),(card (G .reachableDFrom src))) & card (dom (((DIJK:CompSeq src) . k) `1)) = min ((card (G .reachableDFrom src)),(card (G .reachableDFrom src))) ) by A1, Th21; then card (dom (((DIJK:CompSeq src) . (k + 1)) `1)) = card (dom (((DIJK:CompSeq src) . k) `1)) by A7, XXREAL_0:def_9; then DIJK:NextBestEdges ((DIJK:CompSeq src) . k) = {} by A8, Th15; then (DIJK:CompSeq src) . k = (DIJK:CompSeq src) . (k + 1) by A8, Def8; hence ((DIJK:CompSeq src) .Lifespan()) + 1 = card (G .reachableDFrom src) by A1, A2, GLIB_000:def_55; ::_thesis: verum end; theorem Th26: :: GLIB_004:26 for G being finite real-weighted WGraph for s being Vertex of G holds dom ((DIJK:SSSP (G,s)) `1) = G .reachableDFrom s proof let G be finite real-weighted WGraph; ::_thesis: for s being Vertex of G holds dom ((DIJK:SSSP (G,s)) `1) = G .reachableDFrom s let src be Vertex of G; ::_thesis: dom ((DIJK:SSSP (G,src)) `1) = G .reachableDFrom src set Gn = DIJK:SSSP (G,src); set RFS = G .reachableDFrom src; set DCS = DIJK:CompSeq src; set n = (DIJK:CompSeq src) .Lifespan() ; A1: card (dom ((DIJK:SSSP (G,src)) `1)) = min ((((DIJK:CompSeq src) .Lifespan()) + 1),(card (G .reachableDFrom src))) by Th21 .= min ((card (G .reachableDFrom src)),(card (G .reachableDFrom src))) by Th25 .= card (G .reachableDFrom src) ; now__::_thesis:_not_dom_((DIJK:SSSP_(G,src))_`1)_<>_G_.reachableDFrom_src assume A2: dom ((DIJK:SSSP (G,src)) `1) <> G .reachableDFrom src ; ::_thesis: contradiction dom ((DIJK:SSSP (G,src)) `1) c= G .reachableDFrom src by Th19; then dom ((DIJK:SSSP (G,src)) `1) c< G .reachableDFrom src by A2, XBOOLE_0:def_8; hence contradiction by A1, TREES_1:6; ::_thesis: verum end; hence dom ((DIJK:SSSP (G,src)) `1) = G .reachableDFrom src ; ::_thesis: verum end; theorem :: GLIB_004:27 for G being finite nonnegative-weighted WGraph for s being Vertex of G for G2 being inducedWSubgraph of G, dom ((DIJK:SSSP (G,s)) `1),(DIJK:SSSP (G,s)) `2 holds ( G2 is_mincost_DTree_rooted_at s & ( for v being Vertex of G st v in G .reachableDFrom s holds ( v in the_Vertices_of G2 & G .min_DPath_cost (s,v) = ((DIJK:SSSP (G,s)) `1) . v ) ) ) proof let G be finite nonnegative-weighted WGraph; ::_thesis: for s being Vertex of G for G2 being inducedWSubgraph of G, dom ((DIJK:SSSP (G,s)) `1),(DIJK:SSSP (G,s)) `2 holds ( G2 is_mincost_DTree_rooted_at s & ( for v being Vertex of G st v in G .reachableDFrom s holds ( v in the_Vertices_of G2 & G .min_DPath_cost (s,v) = ((DIJK:SSSP (G,s)) `1) . v ) ) ) let src be Vertex of G; ::_thesis: for G2 being inducedWSubgraph of G, dom ((DIJK:SSSP (G,src)) `1),(DIJK:SSSP (G,src)) `2 holds ( G2 is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in G .reachableDFrom src holds ( v in the_Vertices_of G2 & G .min_DPath_cost (src,v) = ((DIJK:SSSP (G,src)) `1) . v ) ) ) let G2 be inducedWSubgraph of G, dom ((DIJK:SSSP (G,src)) `1),(DIJK:SSSP (G,src)) `2 ; ::_thesis: ( G2 is_mincost_DTree_rooted_at src & ( for v being Vertex of G st v in G .reachableDFrom src holds ( v in the_Vertices_of G2 & G .min_DPath_cost (src,v) = ((DIJK:SSSP (G,src)) `1) . v ) ) ) set Res = DIJK:SSSP (G,src); set dR = dom ((DIJK:SSSP (G,src)) `1); thus G2 is_mincost_DTree_rooted_at src by Th23; ::_thesis: for v being Vertex of G st v in G .reachableDFrom src holds ( v in the_Vertices_of G2 & G .min_DPath_cost (src,v) = ((DIJK:SSSP (G,src)) `1) . v ) let v be Vertex of G; ::_thesis: ( v in G .reachableDFrom src implies ( v in the_Vertices_of G2 & G .min_DPath_cost (src,v) = ((DIJK:SSSP (G,src)) `1) . v ) ) assume v in G .reachableDFrom src ; ::_thesis: ( v in the_Vertices_of G2 & G .min_DPath_cost (src,v) = ((DIJK:SSSP (G,src)) `1) . v ) then A1: v in dom ((DIJK:SSSP (G,src)) `1) by Th26; (DIJK:SSSP (G,src)) `2 c= G .edgesBetween (dom ((DIJK:SSSP (G,src)) `1)) by Th22; hence v in the_Vertices_of G2 by A1, GLIB_000:def_37; ::_thesis: G .min_DPath_cost (src,v) = ((DIJK:SSSP (G,src)) `1) . v thus G .min_DPath_cost (src,v) = ((DIJK:SSSP (G,src)) `1) . v by A1, Th23; ::_thesis: verum end; begin definition let G be _Graph; mode PRIM:Labeling of G is Element of [:(bool (the_Vertices_of G)),(bool (the_Edges_of G)):]; end; registration let G be finite _Graph; let L be PRIM:Labeling of G; clusterL `1 -> finite ; coherence L `1 is finite proof thus L `1 is finite ; ::_thesis: verum end; clusterL `2 -> finite ; coherence L `2 is finite proof thus L `2 is finite ; ::_thesis: verum end; end; definition let G be real-weighted WGraph; let L be PRIM:Labeling of G; func PRIM:NextBestEdges L -> Subset of (the_Edges_of G) means :Def13: :: GLIB_004:def 13 for e1 being set holds ( e1 in it iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ); existence ex b1 being Subset of (the_Edges_of G) st for e1 being set holds ( e1 in b1 iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) proof defpred S1[ set ] means ( $1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . $1 <= (the_Weight_of G) . e2 ) ); consider IT being Subset of (the_Edges_of G) such that A1: for e1 being set holds ( e1 in IT iff ( e1 in the_Edges_of G & S1[e1] ) ) from SUBSET_1:sch_1(); take IT ; ::_thesis: for e1 being set holds ( e1 in IT iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) let e1 be set ; ::_thesis: ( e1 in IT iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) thus ( e1 in IT implies S1[e1] ) by A1; ::_thesis: ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) implies e1 in IT ) assume A2: S1[e1] ; ::_thesis: e1 in IT then e1 in the_Edges_of G by GLIB_000:def_15; hence e1 in IT by A1, A2; ::_thesis: verum end; uniqueness for b1, b2 being Subset of (the_Edges_of G) st ( for e1 being set holds ( e1 in b1 iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) ) & ( for e1 being set holds ( e1 in b2 iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) ) holds b1 = b2 proof defpred S1[ set ] means ( $1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . $1 <= (the_Weight_of G) . e2 ) ); let IT1, IT2 be Subset of (the_Edges_of G); ::_thesis: ( ( for e1 being set holds ( e1 in IT1 iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) ) & ( for e1 being set holds ( e1 in IT2 iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) ) implies IT1 = IT2 ) assume that A3: for e1 being set holds ( e1 in IT1 iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) and A4: for e1 being set holds ( e1 in IT2 iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) ; ::_thesis: IT1 = IT2 now__::_thesis:_for_e1_being_set_holds_ (_(_e1_in_IT1_implies_e1_in_IT2_)_&_(_e1_in_IT2_implies_e1_in_IT1_)_) let e1 be set ; ::_thesis: ( ( e1 in IT1 implies e1 in IT2 ) & ( e1 in IT2 implies e1 in IT1 ) ) hereby ::_thesis: ( e1 in IT2 implies e1 in IT1 ) assume e1 in IT1 ; ::_thesis: e1 in IT2 then S1[e1] by A3; hence e1 in IT2 by A4; ::_thesis: verum end; assume e1 in IT2 ; ::_thesis: e1 in IT1 then S1[e1] by A4; hence e1 in IT1 by A3; ::_thesis: verum end; hence IT1 = IT2 by TARSKI:1; ::_thesis: verum end; end; :: deftheorem Def13 defines PRIM:NextBestEdges GLIB_004:def_13_:_ for G being real-weighted WGraph for L being PRIM:Labeling of G for b3 being Subset of (the_Edges_of G) holds ( b3 = PRIM:NextBestEdges L iff for e1 being set holds ( e1 in b3 iff ( e1 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G & ( for e2 being set st e2 SJoins L `1 ,(the_Vertices_of G) \ (L `1),G holds (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) ) ) ); definition let G be real-weighted WGraph; func PRIM:Init G -> PRIM:Labeling of G equals :: GLIB_004:def 14 [{(choose (the_Vertices_of G))},{}]; coherence [{(choose (the_Vertices_of G))},{}] is PRIM:Labeling of G proof {} c= the_Edges_of G by XBOOLE_1:2; hence [{(choose (the_Vertices_of G))},{}] is PRIM:Labeling of G by ZFMISC_1:def_2; ::_thesis: verum end; end; :: deftheorem defines PRIM:Init GLIB_004:def_14_:_ for G being real-weighted WGraph holds PRIM:Init G = [{(choose (the_Vertices_of G))},{}]; definition let G be real-weighted WGraph; let L be PRIM:Labeling of G; func PRIM:Step L -> PRIM:Labeling of G equals :Def15: :: GLIB_004:def 15 L if PRIM:NextBestEdges L = {} [((L `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] if ( PRIM:NextBestEdges L <> {} & (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 ) otherwise [((L `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})]; coherence ( ( PRIM:NextBestEdges L = {} implies L is PRIM:Labeling of G ) & ( PRIM:NextBestEdges L <> {} & (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 implies [((L `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] is PRIM:Labeling of G ) & ( not PRIM:NextBestEdges L = {} & ( not PRIM:NextBestEdges L <> {} or not (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 ) implies [((L `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] is PRIM:Labeling of G ) ) proof set V = the_Vertices_of G; set E = the_Edges_of G; set BE = PRIM:NextBestEdges L; set e = choose (PRIM:NextBestEdges L); set s = (the_Source_of G) . (choose (PRIM:NextBestEdges L)); set t = (the_Target_of G) . (choose (PRIM:NextBestEdges L)); A1: now__::_thesis:_(_PRIM:NextBestEdges_L_<>_{}_&_not_(the_Source_of_G)_._(choose_(PRIM:NextBestEdges_L))_in_L_`1_implies_[((L_`1)_\/_{((the_Source_of_G)_._(choose_(PRIM:NextBestEdges_L)))}),((L_`2)_\/_{(choose_(PRIM:NextBestEdges_L))})]_is_PRIM:Labeling_of_G_) assume that A2: PRIM:NextBestEdges L <> {} and not (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 ; ::_thesis: [((L `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] is PRIM:Labeling of G choose (PRIM:NextBestEdges L) in PRIM:NextBestEdges L by A2; then reconsider s9 = (the_Source_of G) . (choose (PRIM:NextBestEdges L)) as Element of the_Vertices_of G by FUNCT_2:5; A3: (L `1) \/ {s9} c= the_Vertices_of G ; A4: {(choose (PRIM:NextBestEdges L))} c= the_Edges_of G proof let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in {(choose (PRIM:NextBestEdges L))} or x in the_Edges_of G ) assume x in {(choose (PRIM:NextBestEdges L))} ; ::_thesis: x in the_Edges_of G then x = choose (PRIM:NextBestEdges L) by TARSKI:def_1; then x in PRIM:NextBestEdges L by A2; hence x in the_Edges_of G ; ::_thesis: verum end; (L `2) \/ {(choose (PRIM:NextBestEdges L))} c= the_Edges_of G by A4, XBOOLE_1:8; hence [((L `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] is PRIM:Labeling of G by A3, ZFMISC_1:def_2; ::_thesis: verum end; now__::_thesis:_(_PRIM:NextBestEdges_L_<>_{}_&_(the_Source_of_G)_._(choose_(PRIM:NextBestEdges_L))_in_L_`1_implies_[((L_`1)_\/_{((the_Target_of_G)_._(choose_(PRIM:NextBestEdges_L)))}),((L_`2)_\/_{(choose_(PRIM:NextBestEdges_L))})]_is_PRIM:Labeling_of_G_) assume that A5: PRIM:NextBestEdges L <> {} and (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 ; ::_thesis: [((L `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] is PRIM:Labeling of G choose (PRIM:NextBestEdges L) in PRIM:NextBestEdges L by A5; then reconsider t9 = (the_Target_of G) . (choose (PRIM:NextBestEdges L)) as Element of the_Vertices_of G by FUNCT_2:5; A6: (L `1) \/ {t9} c= the_Vertices_of G ; A7: {(choose (PRIM:NextBestEdges L))} c= the_Edges_of G proof let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in {(choose (PRIM:NextBestEdges L))} or x in the_Edges_of G ) assume x in {(choose (PRIM:NextBestEdges L))} ; ::_thesis: x in the_Edges_of G then x = choose (PRIM:NextBestEdges L) by TARSKI:def_1; then x in PRIM:NextBestEdges L by A5; hence x in the_Edges_of G ; ::_thesis: verum end; (L `2) \/ {(choose (PRIM:NextBestEdges L))} c= the_Edges_of G by A7, XBOOLE_1:8; hence [((L `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] is PRIM:Labeling of G by A6, ZFMISC_1:def_2; ::_thesis: verum end; hence ( ( PRIM:NextBestEdges L = {} implies L is PRIM:Labeling of G ) & ( PRIM:NextBestEdges L <> {} & (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 implies [((L `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] is PRIM:Labeling of G ) & ( not PRIM:NextBestEdges L = {} & ( not PRIM:NextBestEdges L <> {} or not (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 ) implies [((L `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] is PRIM:Labeling of G ) ) by A1; ::_thesis: verum end; consistency for b1 being PRIM:Labeling of G st PRIM:NextBestEdges L = {} & PRIM:NextBestEdges L <> {} & (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 holds ( b1 = L iff b1 = [((L `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) ; end; :: deftheorem Def15 defines PRIM:Step GLIB_004:def_15_:_ for G being real-weighted WGraph for L being PRIM:Labeling of G holds ( ( PRIM:NextBestEdges L = {} implies PRIM:Step L = L ) & ( PRIM:NextBestEdges L <> {} & (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 implies PRIM:Step L = [((L `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) & ( not PRIM:NextBestEdges L = {} & ( not PRIM:NextBestEdges L <> {} or not (the_Source_of G) . (choose (PRIM:NextBestEdges L)) in L `1 ) implies PRIM:Step L = [((L `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges L)))}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) ); definition let G be real-weighted WGraph; mode PRIM:LabelingSeq of G -> ManySortedSet of NAT means :Def16: :: GLIB_004:def 16 for n being Nat holds it . n is PRIM:Labeling of G; existence ex b1 being ManySortedSet of NAT st for n being Nat holds b1 . n is PRIM:Labeling of G proof defpred S1[ set , set ] means $2 is PRIM:Labeling of G; A1: now__::_thesis:_for_i_being_set_st_i_in_NAT_holds_ ex_r_being_set_st_S1[i,r] let i be set ; ::_thesis: ( i in NAT implies ex r being set st S1[i,r] ) assume i in NAT ; ::_thesis: ex r being set st S1[i,r] take r = [{},{}]; ::_thesis: S1[i,r] ( {} c= the_Vertices_of G & {} c= the_Edges_of G ) by XBOOLE_1:2; hence S1[i,r] by ZFMISC_1:def_2; ::_thesis: verum end; consider s being ManySortedSet of NAT such that A2: for i being set st i in NAT holds S1[i,s . i] from PBOOLE:sch_3(A1); take s ; ::_thesis: for n being Nat holds s . n is PRIM:Labeling of G let i be Nat; ::_thesis: s . i is PRIM:Labeling of G i in NAT by ORDINAL1:def_12; hence s . i is PRIM:Labeling of G by A2; ::_thesis: verum end; end; :: deftheorem Def16 defines PRIM:LabelingSeq GLIB_004:def_16_:_ for G being real-weighted WGraph for b2 being ManySortedSet of NAT holds ( b2 is PRIM:LabelingSeq of G iff for n being Nat holds b2 . n is PRIM:Labeling of G ); definition let G be real-weighted WGraph; let S be PRIM:LabelingSeq of G; let n be Nat; :: original: . redefine funcS . n -> PRIM:Labeling of G; coherence S . n is PRIM:Labeling of G by Def16; end; definition let G be real-weighted WGraph; func PRIM:CompSeq G -> PRIM:LabelingSeq of G means :Def17: :: GLIB_004:def 17 ( it . 0 = PRIM:Init G & ( for n being Nat holds it . (n + 1) = PRIM:Step (it . n) ) ); existence ex b1 being PRIM:LabelingSeq of G st ( b1 . 0 = PRIM:Init G & ( for n being Nat holds b1 . (n + 1) = PRIM:Step (b1 . n) ) ) proof defpred S1[ set , set , set ] means ( ( $2 is PRIM:Labeling of G & ex Gn, Gn1 being PRIM:Labeling of G st ( $2 = Gn & $3 = Gn1 & Gn1 = PRIM:Step Gn ) ) or ( $2 is not PRIM:Labeling of G & $2 = $3 ) ); now__::_thesis:_for_n_being_Element_of_NAT_ for_x_being_set_ex_y_being_set_st_S1[n,x,y] let n be Element of NAT ; ::_thesis: for x being set ex y being set st S1[n,x,y] let x be set ; ::_thesis: ex y being set st S1[n,x,y] now__::_thesis:_ex_y_being_set_st_S1[n,x,y] percases ( x is PRIM:Labeling of G or not x is PRIM:Labeling of G ) ; suppose x is PRIM:Labeling of G ; ::_thesis: ex y being set st S1[n,x,y] then reconsider Gn = x as PRIM:Labeling of G ; S1[n,x, PRIM:Step Gn] ; hence ex y being set st S1[n,x,y] ; ::_thesis: verum end; suppose x is not PRIM:Labeling of G ; ::_thesis: ex y being set st S1[n,x,y] hence ex y being set st S1[n,x,y] ; ::_thesis: verum end; end; end; hence ex y being set st S1[n,x,y] ; ::_thesis: verum end; then A1: for n being Element of NAT for x being set ex y being set st S1[n,x,y] ; consider IT being Function such that A2: ( dom IT = NAT & IT . 0 = PRIM:Init G & ( for n being Element of NAT holds S1[n,IT . n,IT . (n + 1)] ) ) from RECDEF_1:sch_1(A1); reconsider IT = IT as ManySortedSet of NAT by A2, PARTFUN1:def_2, RELAT_1:def_18; defpred S2[ Nat] means IT . $1 is PRIM:Labeling of G; A3: now__::_thesis:_for_n_being_Nat_st_S2[n]_holds_ S2[n_+_1] let n be Nat; ::_thesis: ( S2[n] implies S2[n + 1] ) reconsider n9 = n as Element of NAT by ORDINAL1:def_12; assume S2[n] ; ::_thesis: S2[n + 1] then ex Gn, Gn1 being PRIM:Labeling of G st ( IT . n9 = Gn & IT . (n + 1) = Gn1 & Gn1 = PRIM:Step Gn ) by A2; hence S2[n + 1] ; ::_thesis: verum end; A4: S2[ 0 ] by A2; for n being Nat holds S2[n] from NAT_1:sch_2(A4, A3); then reconsider IT = IT as PRIM:LabelingSeq of G by Def16; take IT ; ::_thesis: ( IT . 0 = PRIM:Init G & ( for n being Nat holds IT . (n + 1) = PRIM:Step (IT . n) ) ) thus IT . 0 = PRIM:Init G by A2; ::_thesis: for n being Nat holds IT . (n + 1) = PRIM:Step (IT . n) let n be Nat; ::_thesis: IT . (n + 1) = PRIM:Step (IT . n) reconsider n9 = n as Element of NAT by ORDINAL1:def_12; ex Gn, Gn1 being PRIM:Labeling of G st ( IT . n9 = Gn & IT . (n + 1) = Gn1 & Gn1 = PRIM:Step Gn ) by A2; hence IT . (n + 1) = PRIM:Step (IT . n) ; ::_thesis: verum end; uniqueness for b1, b2 being PRIM:LabelingSeq of G st b1 . 0 = PRIM:Init G & ( for n being Nat holds b1 . (n + 1) = PRIM:Step (b1 . n) ) & b2 . 0 = PRIM:Init G & ( for n being Nat holds b2 . (n + 1) = PRIM:Step (b2 . n) ) holds b1 = b2 proof let IT1, IT2 be PRIM:LabelingSeq of G; ::_thesis: ( IT1 . 0 = PRIM:Init G & ( for n being Nat holds IT1 . (n + 1) = PRIM:Step (IT1 . n) ) & IT2 . 0 = PRIM:Init G & ( for n being Nat holds IT2 . (n + 1) = PRIM:Step (IT2 . n) ) implies IT1 = IT2 ) assume that A5: IT1 . 0 = PRIM:Init G and A6: for n being Nat holds IT1 . (n + 1) = PRIM:Step (IT1 . n) and A7: IT2 . 0 = PRIM:Init G and A8: for n being Nat holds IT2 . (n + 1) = PRIM:Step (IT2 . n) ; ::_thesis: IT1 = IT2 defpred S1[ Nat] means IT1 . $1 = IT2 . $1; now__::_thesis:_for_n_being_Nat_st_S1[n]_holds_ S1[n_+_1] let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] ) assume S1[n] ; ::_thesis: S1[n + 1] then IT1 . (n + 1) = PRIM:Step (IT2 . n) by A6 .= IT2 . (n + 1) by A8 ; hence S1[n + 1] ; ::_thesis: verum end; then A9: for n being Nat st S1[n] holds S1[n + 1] ; A10: S1[ 0 ] by A5, A7; for n being Nat holds S1[n] from NAT_1:sch_2(A10, A9); then for n being set st n in NAT holds IT1 . n = IT2 . n ; hence IT1 = IT2 by PBOOLE:3; ::_thesis: verum end; end; :: deftheorem Def17 defines PRIM:CompSeq GLIB_004:def_17_:_ for G being real-weighted WGraph for b2 being PRIM:LabelingSeq of G holds ( b2 = PRIM:CompSeq G iff ( b2 . 0 = PRIM:Init G & ( for n being Nat holds b2 . (n + 1) = PRIM:Step (b2 . n) ) ) ); definition let G be real-weighted WGraph; func PRIM:MST G -> PRIM:Labeling of G equals :: GLIB_004:def 18 (PRIM:CompSeq G) .Result() ; coherence (PRIM:CompSeq G) .Result() is PRIM:Labeling of G proof set PCS = PRIM:CompSeq G; (PRIM:CompSeq G) .Result() = (PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan()) ; hence (PRIM:CompSeq G) .Result() is PRIM:Labeling of G ; ::_thesis: verum end; end; :: deftheorem defines PRIM:MST GLIB_004:def_18_:_ for G being real-weighted WGraph holds PRIM:MST G = (PRIM:CompSeq G) .Result() ; theorem Th28: :: GLIB_004:28 for G being real-weighted WGraph for L being PRIM:Labeling of G st PRIM:NextBestEdges L <> {} holds ex v being Vertex of G st ( not v in L `1 & PRIM:Step L = [((L `1) \/ {v}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) proof let G be real-weighted WGraph; ::_thesis: for L being PRIM:Labeling of G st PRIM:NextBestEdges L <> {} holds ex v being Vertex of G st ( not v in L `1 & PRIM:Step L = [((L `1) \/ {v}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) let L be PRIM:Labeling of G; ::_thesis: ( PRIM:NextBestEdges L <> {} implies ex v being Vertex of G st ( not v in L `1 & PRIM:Step L = [((L `1) \/ {v}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) ) set G2 = PRIM:Step L; set e = choose (PRIM:NextBestEdges L); set src = (the_Source_of G) . (choose (PRIM:NextBestEdges L)); set tar = (the_Target_of G) . (choose (PRIM:NextBestEdges L)); assume A1: PRIM:NextBestEdges L <> {} ; ::_thesis: ex v being Vertex of G st ( not v in L `1 & PRIM:Step L = [((L `1) \/ {v}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) then choose (PRIM:NextBestEdges L) in PRIM:NextBestEdges L ; then reconsider src = (the_Source_of G) . (choose (PRIM:NextBestEdges L)), tar = (the_Target_of G) . (choose (PRIM:NextBestEdges L)) as Vertex of G by FUNCT_2:5; A2: choose (PRIM:NextBestEdges L) SJoins L `1 ,(the_Vertices_of G) \ (L `1),G by A1, Def13; now__::_thesis:_ex_tar_being_Vertex_of_G_st_ (_not_tar_in_L_`1_&_PRIM:Step_L_=_[((L_`1)_\/_{tar}),((L_`2)_\/_{(choose_(PRIM:NextBestEdges_L))})]_) percases ( src in L `1 or not src in L `1 ) ; supposeA3: src in L `1 ; ::_thesis: ex tar being Vertex of G st ( not tar in L `1 & PRIM:Step L = [((L `1) \/ {tar}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) take tar = tar; ::_thesis: ( not tar in L `1 & PRIM:Step L = [((L `1) \/ {tar}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) not src in (the_Vertices_of G) \ (L `1) by A3, XBOOLE_0:def_5; then tar in (the_Vertices_of G) \ (L `1) by A2, GLIB_000:def_15; hence not tar in L `1 by XBOOLE_0:def_5; ::_thesis: PRIM:Step L = [((L `1) \/ {tar}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] thus PRIM:Step L = [((L `1) \/ {tar}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] by A1, A3, Def15; ::_thesis: verum end; supposeA4: not src in L `1 ; ::_thesis: ex src being Vertex of G st ( not src in L `1 & PRIM:Step L = [((L `1) \/ {src}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) take src = src; ::_thesis: ( not src in L `1 & PRIM:Step L = [((L `1) \/ {src}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) thus not src in L `1 by A4; ::_thesis: PRIM:Step L = [((L `1) \/ {src}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] thus PRIM:Step L = [((L `1) \/ {src}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] by A1, A4, Def15; ::_thesis: verum end; end; end; hence ex v being Vertex of G st ( not v in L `1 & PRIM:Step L = [((L `1) \/ {v}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] ) ; ::_thesis: verum end; theorem Th29: :: GLIB_004:29 for G being real-weighted WGraph for L being PRIM:Labeling of G holds ( L `1 c= (PRIM:Step L) `1 & L `2 c= (PRIM:Step L) `2 ) proof let G be real-weighted WGraph; ::_thesis: for L being PRIM:Labeling of G holds ( L `1 c= (PRIM:Step L) `1 & L `2 c= (PRIM:Step L) `2 ) let L be PRIM:Labeling of G; ::_thesis: ( L `1 c= (PRIM:Step L) `1 & L `2 c= (PRIM:Step L) `2 ) set G2 = PRIM:Step L; set Next = PRIM:NextBestEdges L; set e = choose (PRIM:NextBestEdges L); now__::_thesis:_(_L_`1_c=_(PRIM:Step_L)_`1_&_L_`2_c=_(PRIM:Step_L)_`2_) percases ( PRIM:NextBestEdges L = {} or PRIM:NextBestEdges L <> {} ) ; suppose PRIM:NextBestEdges L = {} ; ::_thesis: ( L `1 c= (PRIM:Step L) `1 & L `2 c= (PRIM:Step L) `2 ) hence ( L `1 c= (PRIM:Step L) `1 & L `2 c= (PRIM:Step L) `2 ) by Def15; ::_thesis: verum end; suppose PRIM:NextBestEdges L <> {} ; ::_thesis: ( L `1 c= (PRIM:Step L) `1 & L `2 c= (PRIM:Step L) `2 ) then consider v being Vertex of G such that not v in L `1 and A1: PRIM:Step L = [((L `1) \/ {v}),((L `2) \/ {(choose (PRIM:NextBestEdges L))})] by Th28; (PRIM:Step L) `1 = (L `1) \/ {v} by A1, MCART_1:7; hence L `1 c= (PRIM:Step L) `1 by XBOOLE_1:7; ::_thesis: L `2 c= (PRIM:Step L) `2 (PRIM:Step L) `2 = (L `2) \/ {(choose (PRIM:NextBestEdges L))} by A1, MCART_1:7; hence L `2 c= (PRIM:Step L) `2 by XBOOLE_1:7; ::_thesis: verum end; end; end; hence ( L `1 c= (PRIM:Step L) `1 & L `2 c= (PRIM:Step L) `2 ) ; ::_thesis: verum end; theorem Th30: :: GLIB_004:30 for G being finite real-weighted WGraph for n being Nat holds ( ((PRIM:CompSeq G) . n) `1 is non empty Subset of (the_Vertices_of G) & ((PRIM:CompSeq G) . n) `2 c= G .edgesBetween (((PRIM:CompSeq G) . n) `1) ) proof let G be finite real-weighted WGraph; ::_thesis: for n being Nat holds ( ((PRIM:CompSeq G) . n) `1 is non empty Subset of (the_Vertices_of G) & ((PRIM:CompSeq G) . n) `2 c= G .edgesBetween (((PRIM:CompSeq G) . n) `1) ) set PCS = PRIM:CompSeq G; defpred S1[ Nat] means ( ((PRIM:CompSeq G) . $1) `1 is non empty Subset of (the_Vertices_of G) & ((PRIM:CompSeq G) . $1) `2 c= G .edgesBetween (((PRIM:CompSeq G) . $1) `1) ); A1: ((PRIM:CompSeq G) . 0) `2 = (PRIM:Init G) `2 by Def17 .= {} by MCART_1:7 ; now__::_thesis:_for_n_being_Nat_st_S1[n]_holds_ S1[n_+_1] let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] ) assume A2: S1[n] ; ::_thesis: S1[n + 1] set Gn = (PRIM:CompSeq G) . n; set Gn1 = (PRIM:CompSeq G) . (n + 1); set Next = PRIM:NextBestEdges ((PRIM:CompSeq G) . n); set e = choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)); A3: (PRIM:CompSeq G) . (n + 1) = PRIM:Step ((PRIM:CompSeq G) . n) by Def17; now__::_thesis:_S1[n_+_1] percases ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} or PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} ) ; suppose PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} ; ::_thesis: S1[n + 1] then (PRIM:CompSeq G) . (n + 1) = (PRIM:CompSeq G) . n by A3, Def15; hence S1[n + 1] by A2; ::_thesis: verum end; supposeA4: PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} ; ::_thesis: S1[n + 1] set src = (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))); set tar = (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))); A5: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) in PRIM:NextBestEdges ((PRIM:CompSeq G) . n) by A4; A6: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) SJoins ((PRIM:CompSeq G) . n) `1 ,(the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1),G by A4, Def13; now__::_thesis:_(_((PRIM:CompSeq_G)_._(n_+_1))_`1_is_non_empty_Subset_of_(the_Vertices_of_G)_&_((PRIM:CompSeq_G)_._(n_+_1))_`2_c=_G_.edgesBetween_(((PRIM:CompSeq_G)_._(n_+_1))_`1)_) percases ( (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 or not (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ) ; supposeA7: (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ; ::_thesis: ( ((PRIM:CompSeq G) . (n + 1)) `1 is non empty Subset of (the_Vertices_of G) & ((PRIM:CompSeq G) . (n + 1)) `2 c= G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) ) then A8: (PRIM:CompSeq G) . (n + 1) = [((((PRIM:CompSeq G) . n) `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))}),((((PRIM:CompSeq G) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))})] by A3, A4, Def15; then A9: ((PRIM:CompSeq G) . (n + 1)) `1 = (((PRIM:CompSeq G) . n) `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} by MCART_1:7; then A10: G .edgesBetween (((PRIM:CompSeq G) . n) `1) c= G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) by GLIB_000:36, XBOOLE_1:7; thus ((PRIM:CompSeq G) . (n + 1)) `1 is non empty Subset of (the_Vertices_of G) by A8, MCART_1:7; ::_thesis: ((PRIM:CompSeq G) . (n + 1)) `2 c= G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) A11: ((PRIM:CompSeq G) . (n + 1)) `2 = (((PRIM:CompSeq G) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))} by A8, MCART_1:7; A12: ((PRIM:CompSeq G) . n) `1 c= ((PRIM:CompSeq G) . (n + 1)) `1 by A9, XBOOLE_1:7; now__::_thesis:_for_x_being_set_st_x_in_((PRIM:CompSeq_G)_._(n_+_1))_`2_holds_ x_in_G_.edgesBetween_(((PRIM:CompSeq_G)_._(n_+_1))_`1) let x be set ; ::_thesis: ( x in ((PRIM:CompSeq G) . (n + 1)) `2 implies x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) ) assume A13: x in ((PRIM:CompSeq G) . (n + 1)) `2 ; ::_thesis: x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) now__::_thesis:_x_in_G_.edgesBetween_(((PRIM:CompSeq_G)_._(n_+_1))_`1) percases ( x in ((PRIM:CompSeq G) . n) `2 or x in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))} ) by A11, A13, XBOOLE_0:def_3; suppose x in ((PRIM:CompSeq G) . n) `2 ; ::_thesis: x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) then x in G .edgesBetween (((PRIM:CompSeq G) . n) `1) by A2; hence x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) by A10; ::_thesis: verum end; suppose x in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))} ; ::_thesis: x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) then A14: x = choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) by TARSKI:def_1; then (the_Target_of G) . x in {((the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} by TARSKI:def_1; then (the_Target_of G) . x in ((PRIM:CompSeq G) . (n + 1)) `1 by A9, XBOOLE_0:def_3; hence x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) by A5, A7, A12, A14, GLIB_000:31; ::_thesis: verum end; end; end; hence x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) ; ::_thesis: verum end; hence ((PRIM:CompSeq G) . (n + 1)) `2 c= G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) by TARSKI:def_3; ::_thesis: verum end; supposeA15: not (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ; ::_thesis: ( ((PRIM:CompSeq G) . (n + 1)) `1 is non empty Subset of (the_Vertices_of G) & ((PRIM:CompSeq G) . (n + 1)) `2 c= G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) ) then A16: (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 by A6, GLIB_000:def_15; A17: (PRIM:CompSeq G) . (n + 1) = [((((PRIM:CompSeq G) . n) `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))}),((((PRIM:CompSeq G) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))})] by A3, A4, A15, Def15; then A18: ((PRIM:CompSeq G) . (n + 1)) `1 = (((PRIM:CompSeq G) . n) `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} by MCART_1:7; then A19: G .edgesBetween (((PRIM:CompSeq G) . n) `1) c= G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) by GLIB_000:36, XBOOLE_1:7; thus ((PRIM:CompSeq G) . (n + 1)) `1 is non empty Subset of (the_Vertices_of G) by A17, MCART_1:7; ::_thesis: ((PRIM:CompSeq G) . (n + 1)) `2 c= G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) A20: ((PRIM:CompSeq G) . (n + 1)) `2 = (((PRIM:CompSeq G) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))} by A17, MCART_1:7; A21: ((PRIM:CompSeq G) . n) `1 c= ((PRIM:CompSeq G) . (n + 1)) `1 by A18, XBOOLE_1:7; now__::_thesis:_for_x_being_set_st_x_in_((PRIM:CompSeq_G)_._(n_+_1))_`2_holds_ x_in_G_.edgesBetween_(((PRIM:CompSeq_G)_._(n_+_1))_`1) let x be set ; ::_thesis: ( x in ((PRIM:CompSeq G) . (n + 1)) `2 implies x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) ) assume A22: x in ((PRIM:CompSeq G) . (n + 1)) `2 ; ::_thesis: x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) now__::_thesis:_x_in_G_.edgesBetween_(((PRIM:CompSeq_G)_._(n_+_1))_`1) percases ( x in ((PRIM:CompSeq G) . n) `2 or x in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))} ) by A20, A22, XBOOLE_0:def_3; suppose x in ((PRIM:CompSeq G) . n) `2 ; ::_thesis: x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) then x in G .edgesBetween (((PRIM:CompSeq G) . n) `1) by A2; hence x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) by A19; ::_thesis: verum end; suppose x in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))} ; ::_thesis: x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) then A23: x = choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) by TARSKI:def_1; then (the_Source_of G) . x in {((the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} by TARSKI:def_1; then (the_Source_of G) . x in ((PRIM:CompSeq G) . (n + 1)) `1 by A18, XBOOLE_0:def_3; hence x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) by A5, A21, A16, A23, GLIB_000:31; ::_thesis: verum end; end; end; hence x in G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) ; ::_thesis: verum end; hence ((PRIM:CompSeq G) . (n + 1)) `2 c= G .edgesBetween (((PRIM:CompSeq G) . (n + 1)) `1) by TARSKI:def_3; ::_thesis: verum end; end; end; hence S1[n + 1] ; ::_thesis: verum end; end; end; hence S1[n + 1] ; ::_thesis: verum end; then A24: for n being Nat st S1[n] holds S1[n + 1] ; ((PRIM:CompSeq G) . 0) `1 = (PRIM:Init G) `1 by Def17 .= {(choose (the_Vertices_of G))} by MCART_1:7 ; then A25: S1[ 0 ] by A1, XBOOLE_1:2; for n being Nat holds S1[n] from NAT_1:sch_2(A25, A24); hence for n being Nat holds ( ((PRIM:CompSeq G) . n) `1 is non empty Subset of (the_Vertices_of G) & ((PRIM:CompSeq G) . n) `2 c= G .edgesBetween (((PRIM:CompSeq G) . n) `1) ) ; ::_thesis: verum end; theorem Th31: :: GLIB_004:31 for G1 being finite real-weighted WGraph for n being Nat for G2 being inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 holds G2 is connected proof let G1 be finite real-weighted WGraph; ::_thesis: for n being Nat for G2 being inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 holds G2 is connected defpred S1[ Nat] means for G2 being inducedSubgraph of G1,((PRIM:CompSeq G1) . $1) `1 ,((PRIM:CompSeq G1) . $1) `2 holds G2 is connected ; set G0 = (PRIM:CompSeq G1) . 0; set v = choose (the_Vertices_of G1); now__::_thesis:_for_n_being_Nat_st_S1[n]_holds_ S1[n_+_1] let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] ) assume A1: S1[n] ; ::_thesis: S1[n + 1] set Gn = (PRIM:CompSeq G1) . n; set Gn1 = (PRIM:CompSeq G1) . (n + 1); set e = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)); set v1 = (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))); set v2 = (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))); A2: (PRIM:CompSeq G1) . (n + 1) = PRIM:Step ((PRIM:CompSeq G1) . n) by Def17; now__::_thesis:_for_Gn1s_being_inducedSubgraph_of_G1,((PRIM:CompSeq_G1)_._(n_+_1))_`1_,((PRIM:CompSeq_G1)_._(n_+_1))_`2_holds_Gn1s_is_connected let Gn1s be inducedSubgraph of G1,((PRIM:CompSeq G1) . (n + 1)) `1 ,((PRIM:CompSeq G1) . (n + 1)) `2 ; ::_thesis: Gn1s is connected A3: ( ((PRIM:CompSeq G1) . (n + 1)) `1 is non empty Subset of (the_Vertices_of G1) & ((PRIM:CompSeq G1) . (n + 1)) `2 c= G1 .edgesBetween (((PRIM:CompSeq G1) . (n + 1)) `1) ) by Th30; then A4: the_Vertices_of Gn1s = ((PRIM:CompSeq G1) . (n + 1)) `1 by GLIB_000:def_37; A5: the_Edges_of Gn1s = ((PRIM:CompSeq G1) . (n + 1)) `2 by A3, GLIB_000:def_37; now__::_thesis:_Gn1s_is_connected percases ( PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) = {} or ( PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) <> {} & (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in ((PRIM:CompSeq G1) . n) `1 ) or ( PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) <> {} & not (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in ((PRIM:CompSeq G1) . n) `1 ) ) ; suppose PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) = {} ; ::_thesis: Gn1s is connected then (PRIM:CompSeq G1) . (n + 1) = (PRIM:CompSeq G1) . n by A2, Def15; hence Gn1s is connected by A1; ::_thesis: verum end; supposeA6: ( PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) <> {} & (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in ((PRIM:CompSeq G1) . n) `1 ) ; ::_thesis: Gn1s is connected then A7: (PRIM:CompSeq G1) . (n + 1) = [((((PRIM:CompSeq G1) . n) `1) \/ {((the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))))}),((((PRIM:CompSeq G1) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)))})] by A2, Def15; then A8: ((PRIM:CompSeq G1) . (n + 1)) `2 = (((PRIM:CompSeq G1) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)))} by MCART_1:7; A9: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) in PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) by A6; then reconsider v1 = (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) as Vertex of G1 by FUNCT_2:5; A10: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) Joins (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))),v1,G1 by A9, GLIB_000:def_13; set Gns = the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 ; A11: the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 is connected by A1; A12: ( ((PRIM:CompSeq G1) . n) `1 is non empty Subset of (the_Vertices_of G1) & ((PRIM:CompSeq G1) . n) `2 c= G1 .edgesBetween (((PRIM:CompSeq G1) . n) `1) ) by Th30; then A13: the_Vertices_of the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 = ((PRIM:CompSeq G1) . n) `1 by GLIB_000:def_37; A14: ((PRIM:CompSeq G1) . (n + 1)) `1 = (((PRIM:CompSeq G1) . n) `1) \/ {v1} by A7, MCART_1:7; then A15: the_Vertices_of the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 c= the_Vertices_of Gn1s by A4, A13, XBOOLE_1:7; the_Edges_of the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 = ((PRIM:CompSeq G1) . n) `2 by A12, GLIB_000:def_37; then reconsider Gns = the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 as Subgraph of Gn1s by A5, A8, A15, GLIB_000:44, XBOOLE_1:7; set src = the Vertex of Gns; reconsider src9 = the Vertex of Gns as Vertex of Gn1s by GLIB_000:42; choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)))} by TARSKI:def_1; then choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) in the_Edges_of Gn1s by A5, A8, XBOOLE_0:def_3; then A16: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) Joins (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))),v1,Gn1s by A10, GLIB_000:73; now__::_thesis:_for_x_being_Vertex_of_Gn1s_ex_W_being_Walk_of_Gn1s_st_W_is_Walk_from_src9,x let x be Vertex of Gn1s; ::_thesis: ex W being Walk of Gn1s st W is_Walk_from src9,x now__::_thesis:_ex_W_being_Walk_of_Gn1s_st_W_is_Walk_from_src9,x percases ( x = v1 or x <> v1 ) ; supposeA17: x = v1 ; ::_thesis: ex W being Walk of Gn1s st W is_Walk_from src9,x reconsider v29 = (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) as Vertex of Gns by A6, A12, GLIB_000:def_37; consider W being Walk of Gns such that A18: W is_Walk_from the Vertex of Gns,v29 by A11, GLIB_002:def_1; reconsider W = W as Walk of Gn1s by GLIB_001:167; W is_Walk_from src9,(the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) by A18, GLIB_001:19; then W .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) is_Walk_from src9,x by A16, A17, GLIB_001:66; hence ex W being Walk of Gn1s st W is_Walk_from src9,x ; ::_thesis: verum end; suppose x <> v1 ; ::_thesis: ex W being Walk of Gn1s st W is_Walk_from src9,x then not x in {v1} by TARSKI:def_1; then reconsider x9 = x as Vertex of Gns by A4, A14, A13, XBOOLE_0:def_3; consider W being Walk of Gns such that A19: W is_Walk_from the Vertex of Gns,x9 by A11, GLIB_002:def_1; reconsider W9 = W as Walk of Gn1s by GLIB_001:167; W9 is_Walk_from src9,x by A19, GLIB_001:19; hence ex W being Walk of Gn1s st W is_Walk_from src9,x ; ::_thesis: verum end; end; end; hence ex W being Walk of Gn1s st W is_Walk_from src9,x ; ::_thesis: verum end; hence Gn1s is connected by GLIB_002:6; ::_thesis: verum end; supposeA20: ( PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) <> {} & not (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in ((PRIM:CompSeq G1) . n) `1 ) ; ::_thesis: Gn1s is connected then A21: (PRIM:CompSeq G1) . (n + 1) = [((((PRIM:CompSeq G1) . n) `1) \/ {((the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))))}),((((PRIM:CompSeq G1) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)))})] by A2, Def15; then A22: ((PRIM:CompSeq G1) . (n + 1)) `2 = (((PRIM:CompSeq G1) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)))} by MCART_1:7; A23: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) SJoins ((PRIM:CompSeq G1) . n) `1 ,(the_Vertices_of G1) \ (((PRIM:CompSeq G1) . n) `1),G1 by A20, Def13; then A24: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) in the_Edges_of G1 by GLIB_000:def_15; then reconsider v2 = (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) as Vertex of G1 by FUNCT_2:5; A25: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) Joins (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))),v2,G1 by A24, GLIB_000:def_13; choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)))} by TARSKI:def_1; then choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) in the_Edges_of Gn1s by A5, A22, XBOOLE_0:def_3; then A26: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) Joins (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))),v2,Gn1s by A25, GLIB_000:73; set Gns = the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 ; A27: the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 is connected by A1; A28: ( ((PRIM:CompSeq G1) . n) `1 is non empty Subset of (the_Vertices_of G1) & ((PRIM:CompSeq G1) . n) `2 c= G1 .edgesBetween (((PRIM:CompSeq G1) . n) `1) ) by Th30; then A29: the_Vertices_of the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 = ((PRIM:CompSeq G1) . n) `1 by GLIB_000:def_37; A30: ((PRIM:CompSeq G1) . (n + 1)) `1 = (((PRIM:CompSeq G1) . n) `1) \/ {v2} by A21, MCART_1:7; then A31: the_Vertices_of the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 c= the_Vertices_of Gn1s by A4, A29, XBOOLE_1:7; the_Edges_of the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 = ((PRIM:CompSeq G1) . n) `2 by A28, GLIB_000:def_37; then reconsider Gns = the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 as Subgraph of Gn1s by A5, A22, A31, GLIB_000:44, XBOOLE_1:7; set src = the Vertex of Gns; reconsider src9 = the Vertex of Gns as Vertex of Gn1s by GLIB_000:42; A32: (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in ((PRIM:CompSeq G1) . n) `1 by A20, A23, GLIB_000:def_15; now__::_thesis:_for_x_being_Vertex_of_Gn1s_ex_W_being_Walk_of_Gn1s_st_W_is_Walk_from_src9,x let x be Vertex of Gn1s; ::_thesis: ex W being Walk of Gn1s st W is_Walk_from src9,x now__::_thesis:_ex_W_being_Walk_of_Gn1s_st_W_is_Walk_from_src9,x percases ( x = v2 or x <> v2 ) ; supposeA33: x = v2 ; ::_thesis: ex W being Walk of Gn1s st W is_Walk_from src9,x reconsider v19 = (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) as Vertex of Gns by A32, A28, GLIB_000:def_37; consider W being Walk of Gns such that A34: W is_Walk_from the Vertex of Gns,v19 by A27, GLIB_002:def_1; reconsider W = W as Walk of Gn1s by GLIB_001:167; W is_Walk_from src9,(the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) by A34, GLIB_001:19; then W .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) is_Walk_from src9,x by A26, A33, GLIB_001:66; hence ex W being Walk of Gn1s st W is_Walk_from src9,x ; ::_thesis: verum end; suppose x <> v2 ; ::_thesis: ex W being Walk of Gn1s st W is_Walk_from src9,x then not x in {v2} by TARSKI:def_1; then reconsider x9 = x as Vertex of Gns by A4, A30, A29, XBOOLE_0:def_3; consider W being Walk of Gns such that A35: W is_Walk_from the Vertex of Gns,x9 by A27, GLIB_002:def_1; reconsider W9 = W as Walk of Gn1s by GLIB_001:167; W9 is_Walk_from src9,x by A35, GLIB_001:19; hence ex W being Walk of Gn1s st W is_Walk_from src9,x ; ::_thesis: verum end; end; end; hence ex W being Walk of Gn1s st W is_Walk_from src9,x ; ::_thesis: verum end; hence Gn1s is connected by GLIB_002:6; ::_thesis: verum end; end; end; hence Gn1s is connected ; ::_thesis: verum end; hence S1[n + 1] ; ::_thesis: verum end; then A36: for n being Nat st S1[n] holds S1[n + 1] ; now__::_thesis:_for_G_being_inducedSubgraph_of_G1,((PRIM:CompSeq_G1)_._0)_`1_,((PRIM:CompSeq_G1)_._0)_`2_holds_G_is_connected let G be inducedSubgraph of G1,((PRIM:CompSeq G1) . 0) `1 ,((PRIM:CompSeq G1) . 0) `2 ; ::_thesis: G is connected A37: (PRIM:CompSeq G1) . 0 = PRIM:Init G1 by Def17; then ((PRIM:CompSeq G1) . 0) `1 = {(choose (the_Vertices_of G1))} by MCART_1:7; then reconsider G9 = G as inducedSubgraph of G1,{(choose (the_Vertices_of G1))}, {} by A37, MCART_1:7; G9 is connected ; hence G is connected ; ::_thesis: verum end; then A38: S1[ 0 ] ; for n being Nat holds S1[n] from NAT_1:sch_2(A38, A36); hence for n being Nat for G2 being inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 holds G2 is connected ; ::_thesis: verum end; theorem Th32: :: GLIB_004:32 for G1 being finite real-weighted WGraph for n being Nat for G2 being inducedSubgraph of G1,(((PRIM:CompSeq G1) . n) `1) holds G2 is connected proof let G1 be finite real-weighted WGraph; ::_thesis: for n being Nat for G2 being inducedSubgraph of G1,(((PRIM:CompSeq G1) . n) `1) holds G2 is connected let n be Nat; ::_thesis: for G2 being inducedSubgraph of G1,(((PRIM:CompSeq G1) . n) `1) holds G2 is connected set V = ((PRIM:CompSeq G1) . n) `1 ; let G2 be inducedSubgraph of G1,(((PRIM:CompSeq G1) . n) `1); ::_thesis: G2 is connected reconsider V = ((PRIM:CompSeq G1) . n) `1 as non empty Subset of (the_Vertices_of G1) by Th30; set E = ((PRIM:CompSeq G1) . n) `2 ; reconsider E = ((PRIM:CompSeq G1) . n) `2 as Subset of (G1 .edgesBetween V) by Th30; set G3 = the inducedSubgraph of G1,V,E; A1: ( the_Vertices_of the inducedSubgraph of G1,V,E = V & the_Vertices_of G2 = V ) by GLIB_000:def_37; ( the_Edges_of the inducedSubgraph of G1,V,E = E & the_Edges_of G2 = G1 .edgesBetween V ) by GLIB_000:def_37; then reconsider G3 = the inducedSubgraph of G1,V,E as Subgraph of G2 by A1, GLIB_000:44; A2: G3 is spanning by A1, GLIB_000:def_33; G3 is connected by Th31; hence G2 is connected by A2, GLIB_002:23; ::_thesis: verum end; registration let G1 be finite real-weighted WGraph; let n be Nat; cluster -> connected for inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,G1 .edgesBetween (((PRIM:CompSeq G1) . n) `1); coherence for b1 being inducedSubgraph of G1,(((PRIM:CompSeq G1) . n) `1) holds b1 is connected by Th32; end; registration let G1 be finite real-weighted WGraph; let n be Nat; cluster -> connected for inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 ; coherence for b1 being inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 holds b1 is connected by Th31; end; theorem Th33: :: GLIB_004:33 for G being finite real-weighted WGraph for n being Nat holds ((PRIM:CompSeq G) . n) `1 c= G .reachableFrom (choose (the_Vertices_of G)) proof let G be finite real-weighted WGraph; ::_thesis: for n being Nat holds ((PRIM:CompSeq G) . n) `1 c= G .reachableFrom (choose (the_Vertices_of G)) set src = choose (the_Vertices_of G); defpred S1[ Nat] means ((PRIM:CompSeq G) . $1) `1 c= G .reachableFrom (choose (the_Vertices_of G)); set G0 = (PRIM:CompSeq G) . 0; (PRIM:CompSeq G) . 0 = PRIM:Init G by Def17; then A1: ((PRIM:CompSeq G) . 0) `1 = {(choose (the_Vertices_of G))} by MCART_1:7; A2: now__::_thesis:_for_n_being_Nat_st_S1[n]_holds_ S1[n_+_1] let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] ) assume A3: S1[n] ; ::_thesis: S1[n + 1] set Gn = (PRIM:CompSeq G) . n; set Gn1 = (PRIM:CompSeq G) . (n + 1); set Next = PRIM:NextBestEdges ((PRIM:CompSeq G) . n); set e = choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)); set sc = (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))); set tar = (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))); A4: (PRIM:CompSeq G) . (n + 1) = PRIM:Step ((PRIM:CompSeq G) . n) by Def17; now__::_thesis:_S1[n_+_1] percases ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} or ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} & (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ) or ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} & not (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ) ) ; suppose PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} ; ::_thesis: S1[n + 1] hence S1[n + 1] by A3, A4, Def15; ::_thesis: verum end; supposeA5: ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} & (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ) ; ::_thesis: S1[n + 1] then (PRIM:CompSeq G) . (n + 1) = [((((PRIM:CompSeq G) . n) `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))}),((((PRIM:CompSeq G) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))})] by A4, Def15; then A6: ((PRIM:CompSeq G) . (n + 1)) `1 = (((PRIM:CompSeq G) . n) `1) \/ {((the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} by MCART_1:7; A7: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) in PRIM:NextBestEdges ((PRIM:CompSeq G) . n) by A5; now__::_thesis:_for_v_being_set_st_v_in_((PRIM:CompSeq_G)_._(n_+_1))_`1_holds_ v_in_G_.reachableFrom_(choose_(the_Vertices_of_G)) let v be set ; ::_thesis: ( v in ((PRIM:CompSeq G) . (n + 1)) `1 implies v in G .reachableFrom (choose (the_Vertices_of G)) ) assume A8: v in ((PRIM:CompSeq G) . (n + 1)) `1 ; ::_thesis: v in G .reachableFrom (choose (the_Vertices_of G)) now__::_thesis:_v_in_G_.reachableFrom_(choose_(the_Vertices_of_G)) percases ( v in ((PRIM:CompSeq G) . n) `1 or v in {((the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} ) by A6, A8, XBOOLE_0:def_3; suppose v in ((PRIM:CompSeq G) . n) `1 ; ::_thesis: v in G .reachableFrom (choose (the_Vertices_of G)) hence v in G .reachableFrom (choose (the_Vertices_of G)) by A3; ::_thesis: verum end; suppose v in {((the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} ; ::_thesis: v in G .reachableFrom (choose (the_Vertices_of G)) then v = (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) by TARSKI:def_1; then choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) Joins (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))),v,G by A7, GLIB_000:def_13; hence v in G .reachableFrom (choose (the_Vertices_of G)) by A3, A5, GLIB_002:10; ::_thesis: verum end; end; end; hence v in G .reachableFrom (choose (the_Vertices_of G)) ; ::_thesis: verum end; hence S1[n + 1] by TARSKI:def_3; ::_thesis: verum end; supposeA9: ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} & not (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ) ; ::_thesis: S1[n + 1] then (PRIM:CompSeq G) . (n + 1) = [((((PRIM:CompSeq G) . n) `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))}),((((PRIM:CompSeq G) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))})] by A4, Def15; then A10: ((PRIM:CompSeq G) . (n + 1)) `1 = (((PRIM:CompSeq G) . n) `1) \/ {((the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} by MCART_1:7; A11: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) SJoins ((PRIM:CompSeq G) . n) `1 ,(the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1),G by A9, Def13; then A12: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) in the_Edges_of G by GLIB_000:def_15; A13: (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 by A9, A11, GLIB_000:def_15; now__::_thesis:_for_v_being_set_st_v_in_((PRIM:CompSeq_G)_._(n_+_1))_`1_holds_ v_in_G_.reachableFrom_(choose_(the_Vertices_of_G)) let v be set ; ::_thesis: ( v in ((PRIM:CompSeq G) . (n + 1)) `1 implies v in G .reachableFrom (choose (the_Vertices_of G)) ) assume A14: v in ((PRIM:CompSeq G) . (n + 1)) `1 ; ::_thesis: v in G .reachableFrom (choose (the_Vertices_of G)) now__::_thesis:_v_in_G_.reachableFrom_(choose_(the_Vertices_of_G)) percases ( v in ((PRIM:CompSeq G) . n) `1 or v in {((the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} ) by A10, A14, XBOOLE_0:def_3; suppose v in ((PRIM:CompSeq G) . n) `1 ; ::_thesis: v in G .reachableFrom (choose (the_Vertices_of G)) hence v in G .reachableFrom (choose (the_Vertices_of G)) by A3; ::_thesis: verum end; suppose v in {((the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))))} ; ::_thesis: v in G .reachableFrom (choose (the_Vertices_of G)) then v = (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) by TARSKI:def_1; then choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) Joins (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))),v,G by A12, GLIB_000:def_13; hence v in G .reachableFrom (choose (the_Vertices_of G)) by A3, A13, GLIB_002:10; ::_thesis: verum end; end; end; hence v in G .reachableFrom (choose (the_Vertices_of G)) ; ::_thesis: verum end; hence S1[n + 1] by TARSKI:def_3; ::_thesis: verum end; end; end; hence S1[n + 1] ; ::_thesis: verum end; choose (the_Vertices_of G) in G .reachableFrom (choose (the_Vertices_of G)) by GLIB_002:9; then A15: S1[ 0 ] by A1, ZFMISC_1:31; for n being Nat holds S1[n] from NAT_1:sch_2(A15, A2); hence for n being Nat holds ((PRIM:CompSeq G) . n) `1 c= G .reachableFrom (choose (the_Vertices_of G)) ; ::_thesis: verum end; theorem Th34: :: GLIB_004:34 for G being finite real-weighted WGraph for i, j being Nat st i <= j holds ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . j) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . j) `2 ) proof let G be finite real-weighted WGraph; ::_thesis: for i, j being Nat st i <= j holds ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . j) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . j) `2 ) let i, j be Nat; ::_thesis: ( i <= j implies ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . j) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . j) `2 ) ) set PCS = PRIM:CompSeq G; set vPCS = ((PRIM:CompSeq G) . i) `1 ; set ePCS = ((PRIM:CompSeq G) . i) `2 ; defpred S1[ Nat] means ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . (i + $1)) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . (i + $1)) `2 ); assume i <= j ; ::_thesis: ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . j) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . j) `2 ) then A1: ex x being Nat st j = i + x by NAT_1:10; now__::_thesis:_for_k_being_Nat_st_((PRIM:CompSeq_G)_._i)_`1_c=_((PRIM:CompSeq_G)_._(i_+_k))_`1_&_((PRIM:CompSeq_G)_._i)_`2_c=_((PRIM:CompSeq_G)_._(i_+_k))_`2_holds_ (_((PRIM:CompSeq_G)_._i)_`1_c=_((PRIM:CompSeq_G)_._(i_+_(k_+_1)))_`1_&_((PRIM:CompSeq_G)_._i)_`2_c=_((PRIM:CompSeq_G)_._(i_+_(k_+_1)))_`2_) let k be Nat; ::_thesis: ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . (i + k)) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . (i + k)) `2 implies ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . (i + (k + 1))) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . (i + (k + 1))) `2 ) ) (PRIM:CompSeq G) . ((i + k) + 1) = PRIM:Step ((PRIM:CompSeq G) . (i + k)) by Def17; then A2: ( ((PRIM:CompSeq G) . (i + k)) `1 c= ((PRIM:CompSeq G) . ((i + k) + 1)) `1 & ((PRIM:CompSeq G) . (i + k)) `2 c= ((PRIM:CompSeq G) . ((i + k) + 1)) `2 ) by Th29; assume ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . (i + k)) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . (i + k)) `2 ) ; ::_thesis: ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . (i + (k + 1))) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . (i + (k + 1))) `2 ) hence ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . (i + (k + 1))) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . (i + (k + 1))) `2 ) by A2, XBOOLE_1:1; ::_thesis: verum end; then A3: for k being Nat st S1[k] holds S1[k + 1] ; A4: S1[ 0 ] ; for k being Nat holds S1[k] from NAT_1:sch_2(A4, A3); hence ( ((PRIM:CompSeq G) . i) `1 c= ((PRIM:CompSeq G) . j) `1 & ((PRIM:CompSeq G) . i) `2 c= ((PRIM:CompSeq G) . j) `2 ) by A1; ::_thesis: verum end; theorem Th35: :: GLIB_004:35 for G being finite real-weighted WGraph for n being Nat holds ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} iff ((PRIM:CompSeq G) . n) `1 = G .reachableFrom (choose (the_Vertices_of G)) ) proof let G be finite real-weighted WGraph; ::_thesis: for n being Nat holds ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} iff ((PRIM:CompSeq G) . n) `1 = G .reachableFrom (choose (the_Vertices_of G)) ) let n be Nat; ::_thesis: ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} iff ((PRIM:CompSeq G) . n) `1 = G .reachableFrom (choose (the_Vertices_of G)) ) set src = choose (the_Vertices_of G); set PCS = PRIM:CompSeq G; set RFS = G .reachableFrom (choose (the_Vertices_of G)); set Gn = (PRIM:CompSeq G) . n; set EG = the_Edges_of G; set Next = PRIM:NextBestEdges ((PRIM:CompSeq G) . n); set GnV = ((PRIM:CompSeq G) . n) `1 ; set GnVg = (the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1); set e = choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)); hereby ::_thesis: ( ((PRIM:CompSeq G) . n) `1 = G .reachableFrom (choose (the_Vertices_of G)) implies PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} ) assume A1: PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} ; ::_thesis: ((PRIM:CompSeq G) . n) `1 = G .reachableFrom (choose (the_Vertices_of G)) now__::_thesis:_not_((PRIM:CompSeq_G)_._n)_`1_<>_G_.reachableFrom_(choose_(the_Vertices_of_G)) defpred S1[ set ] means $1 SJoins ((PRIM:CompSeq G) . n) `1 ,(the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1),G; assume A2: ((PRIM:CompSeq G) . n) `1 <> G .reachableFrom (choose (the_Vertices_of G)) ; ::_thesis: contradiction consider BE1 being Subset of (the_Edges_of G) such that A3: for x being set holds ( x in BE1 iff ( x in the_Edges_of G & S1[x] ) ) from SUBSET_1:sch_1(); ((PRIM:CompSeq G) . n) `1 c= G .reachableFrom (choose (the_Vertices_of G)) by Th33; then A4: ((PRIM:CompSeq G) . n) `1 c< G .reachableFrom (choose (the_Vertices_of G)) by A2, XBOOLE_0:def_8; now__::_thesis:_not_BE1_=_{} choose (the_Vertices_of G) in {(choose (the_Vertices_of G))} by TARSKI:def_1; then choose (the_Vertices_of G) in (PRIM:Init G) `1 by MCART_1:7; then A5: choose (the_Vertices_of G) in ((PRIM:CompSeq G) . 0) `1 by Def17; assume A6: BE1 = {} ; ::_thesis: contradiction consider v being set such that A7: v in G .reachableFrom (choose (the_Vertices_of G)) and A8: not v in ((PRIM:CompSeq G) . n) `1 by A4, XBOOLE_0:6; reconsider v = v as Vertex of G by A7; consider W being Walk of G such that A9: W is_Walk_from choose (the_Vertices_of G),v by A7, GLIB_002:def_5; defpred S2[ Nat] means ( $1 is odd & $1 <= len W & not W . $1 in ((PRIM:CompSeq G) . n) `1 ); W . (len W) = W .last() by GLIB_001:def_7 .= v by A9, GLIB_001:def_23 ; then A10: ex k being Nat st S2[k] by A8; consider k being Nat such that A11: ( S2[k] & ( for m being Nat st S2[m] holds k <= m ) ) from NAT_1:sch_5(A10); A12: ((PRIM:CompSeq G) . 0) `1 c= ((PRIM:CompSeq G) . n) `1 by Th34; now__::_thesis:_contradiction percases ( k = 1 or k <> 1 ) ; suppose k = 1 ; ::_thesis: contradiction then W . k = W .first() by GLIB_001:def_6 .= choose (the_Vertices_of G) by A9, GLIB_001:def_23 ; hence contradiction by A5, A12, A11; ::_thesis: verum end; supposeA13: k <> 1 ; ::_thesis: contradiction reconsider k9 = k as odd Element of NAT by A11, ORDINAL1:def_12; 1 <= k by A11, ABIAN:12; then 1 < k by A13, XXREAL_0:1; then 1 + 1 <= k by NAT_1:13; then reconsider k2a = k9 - (2 * 1) as odd Element of NAT by INT_1:5; set e = W . (k2a + 1); A14: k - 2 < (len W) - 0 by A11, XREAL_1:15; then A15: W . (k2a + 1) Joins W . k2a,W . (k2a + 2),G by GLIB_001:def_3; then A16: W . (k2a + 1) in the_Edges_of G by GLIB_000:def_13; k2a < k - 0 by XREAL_1:15; then A17: W . k2a in ((PRIM:CompSeq G) . n) `1 by A11, A14; W . k in the_Vertices_of G by A15, GLIB_000:13; then W . k in (the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1) by A11, XBOOLE_0:def_5; then S1[W . (k2a + 1)] by A17, A15, GLIB_000:17; hence contradiction by A3, A6, A16; ::_thesis: verum end; end; end; hence contradiction ; ::_thesis: verum end; then reconsider BE1 = BE1 as non empty finite set ; deffunc H1( Element of BE1) -> Element of REAL = (the_Weight_of G) . $1; consider e1 being Element of BE1 such that A18: for e2 being Element of BE1 holds H1(e1) <= H1(e2) from GRAPH_5:sch_2(); A19: now__::_thesis:_for_e2_being_set_st_e2_SJoins_((PRIM:CompSeq_G)_._n)_`1_,(the_Vertices_of_G)_\_(((PRIM:CompSeq_G)_._n)_`1),G_holds_ (the_Weight_of_G)_._e1_<=_(the_Weight_of_G)_._e2 let e2 be set ; ::_thesis: ( e2 SJoins ((PRIM:CompSeq G) . n) `1 ,(the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1),G implies (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ) assume A20: e2 SJoins ((PRIM:CompSeq G) . n) `1 ,(the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1),G ; ::_thesis: (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 then e2 in the_Edges_of G by GLIB_000:def_15; then reconsider e29 = e2 as Element of BE1 by A3, A20; (the_Weight_of G) . e1 <= (the_Weight_of G) . e29 by A18; hence (the_Weight_of G) . e1 <= (the_Weight_of G) . e2 ; ::_thesis: verum end; e1 SJoins ((PRIM:CompSeq G) . n) `1 ,(the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1),G by A3; hence contradiction by A1, A19, Def13; ::_thesis: verum end; hence ((PRIM:CompSeq G) . n) `1 = G .reachableFrom (choose (the_Vertices_of G)) ; ::_thesis: verum end; assume A21: ((PRIM:CompSeq G) . n) `1 = G .reachableFrom (choose (the_Vertices_of G)) ; ::_thesis: PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} now__::_thesis:_not_PRIM:NextBestEdges_((PRIM:CompSeq_G)_._n)_<>_{} assume PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} ; ::_thesis: contradiction then A22: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) SJoins ((PRIM:CompSeq G) . n) `1 ,(the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1),G by Def13; then A23: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) in the_Edges_of G by GLIB_000:def_15; now__::_thesis:_contradiction percases ( ( (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 & (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in (the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1) ) or ( (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in (the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1) & (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ) ) by A22, GLIB_000:def_15; supposeA24: ( (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 & (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in (the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1) ) ; ::_thesis: contradiction A25: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) Joins (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))),(the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))),G by A23, GLIB_000:def_13; not (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 by A24, XBOOLE_0:def_5; hence contradiction by A21, A24, A25, GLIB_002:10; ::_thesis: verum end; supposeA26: ( (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in (the_Vertices_of G) \ (((PRIM:CompSeq G) . n) `1) & (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 ) ; ::_thesis: contradiction A27: choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)) Joins (the_Target_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))),(the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))),G by A23, GLIB_000:def_13; not (the_Source_of G) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n))) in ((PRIM:CompSeq G) . n) `1 by A26, XBOOLE_0:def_5; hence contradiction by A21, A26, A27, GLIB_002:10; ::_thesis: verum end; end; end; hence contradiction ; ::_thesis: verum end; hence PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} ; ::_thesis: verum end; theorem Th36: :: GLIB_004:36 for G being finite real-weighted WGraph for n being Nat holds card (((PRIM:CompSeq G) . n) `1) = min ((n + 1),(card (G .reachableFrom (choose (the_Vertices_of G))))) proof let G be finite real-weighted WGraph; ::_thesis: for n being Nat holds card (((PRIM:CompSeq G) . n) `1) = min ((n + 1),(card (G .reachableFrom (choose (the_Vertices_of G))))) set CS = PRIM:CompSeq G; set src = choose (the_Vertices_of G); defpred S1[ Nat] means card (((PRIM:CompSeq G) . $1) `1) = min (($1 + 1),(card (G .reachableFrom (choose (the_Vertices_of G))))); set G0 = (PRIM:CompSeq G) . 0; choose (the_Vertices_of G) in G .reachableFrom (choose (the_Vertices_of G)) by GLIB_002:9; then {(choose (the_Vertices_of G))} c= G .reachableFrom (choose (the_Vertices_of G)) by ZFMISC_1:31; then card {(choose (the_Vertices_of G))} <= card (G .reachableFrom (choose (the_Vertices_of G))) by NAT_1:43; then A1: 0 + 1 <= card (G .reachableFrom (choose (the_Vertices_of G))) by CARD_1:30; A2: now__::_thesis:_for_n_being_Nat_st_S1[n]_holds_ S1[n_+_1] let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] ) assume A3: S1[n] ; ::_thesis: S1[n + 1] set Gn = (PRIM:CompSeq G) . n; set Gn1 = (PRIM:CompSeq G) . (n + 1); set e = choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)); A4: (PRIM:CompSeq G) . (n + 1) = PRIM:Step ((PRIM:CompSeq G) . n) by Def17; now__::_thesis:_S1[n_+_1] percases ( PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} or PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} ) ; supposeA5: PRIM:NextBestEdges ((PRIM:CompSeq G) . n) = {} ; ::_thesis: S1[n + 1] then A6: card (((PRIM:CompSeq G) . n) `1) = card (G .reachableFrom (choose (the_Vertices_of G))) by Th35; then card (G .reachableFrom (choose (the_Vertices_of G))) <= n + 1 by A3, XXREAL_0:def_9; then A7: card (G .reachableFrom (choose (the_Vertices_of G))) <= (n + 1) + 1 by NAT_1:12; card (((PRIM:CompSeq G) . (n + 1)) `1) = min ((n + 1),(card (G .reachableFrom (choose (the_Vertices_of G))))) by A3, A4, A5, Def15; hence S1[n + 1] by A3, A6, A7, XXREAL_0:def_9; ::_thesis: verum end; supposeA8: PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} ; ::_thesis: S1[n + 1] A9: ((PRIM:CompSeq G) . n) `1 c= G .reachableFrom (choose (the_Vertices_of G)) by Th33; A10: ((PRIM:CompSeq G) . n) `1 <> G .reachableFrom (choose (the_Vertices_of G)) by A8, Th35; A11: now__::_thesis:_not_card_(((PRIM:CompSeq_G)_._n)_`1)_=_card_(G_.reachableFrom_(choose_(the_Vertices_of_G))) assume A12: card (((PRIM:CompSeq G) . n) `1) = card (G .reachableFrom (choose (the_Vertices_of G))) ; ::_thesis: contradiction ((PRIM:CompSeq G) . n) `1 c< G .reachableFrom (choose (the_Vertices_of G)) by A10, A9, XBOOLE_0:def_8; hence contradiction by A12, CARD_2:48; ::_thesis: verum end; then A13: card (((PRIM:CompSeq G) . n) `1) = n + 1 by A3, XXREAL_0:15; consider v being Vertex of G such that A14: not v in ((PRIM:CompSeq G) . n) `1 and A15: (PRIM:CompSeq G) . (n + 1) = [((((PRIM:CompSeq G) . n) `1) \/ {v}),((((PRIM:CompSeq G) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))})] by A4, A8, Th28; A16: card (((PRIM:CompSeq G) . (n + 1)) `1) = card ((((PRIM:CompSeq G) . n) `1) \/ {v}) by A15, MCART_1:7 .= (card (((PRIM:CompSeq G) . n) `1)) + 1 by A14, CARD_2:41 ; card (((PRIM:CompSeq G) . n) `1) <= card (G .reachableFrom (choose (the_Vertices_of G))) by Th33, NAT_1:43; then n + 1 < card (G .reachableFrom (choose (the_Vertices_of G))) by A11, A13, XXREAL_0:1; then (n + 1) + 1 <= card (G .reachableFrom (choose (the_Vertices_of G))) by NAT_1:13; hence S1[n + 1] by A16, A13, XXREAL_0:def_9; ::_thesis: verum end; end; end; hence S1[n + 1] ; ::_thesis: verum end; (PRIM:CompSeq G) . 0 = PRIM:Init G by Def17; then {(choose (the_Vertices_of G))} = ((PRIM:CompSeq G) . 0) `1 by MCART_1:7; then card (((PRIM:CompSeq G) . 0) `1) = 1 by CARD_1:30; then A17: S1[ 0 ] by A1, XXREAL_0:def_9; for n being Nat holds S1[n] from NAT_1:sch_2(A17, A2); hence for n being Nat holds card (((PRIM:CompSeq G) . n) `1) = min ((n + 1),(card (G .reachableFrom (choose (the_Vertices_of G))))) ; ::_thesis: verum end; theorem Th37: :: GLIB_004:37 for G being finite real-weighted WGraph holds ( PRIM:CompSeq G is halting & ((PRIM:CompSeq G) .Lifespan()) + 1 = card (G .reachableFrom (choose (the_Vertices_of G))) ) proof let G be finite real-weighted WGraph; ::_thesis: ( PRIM:CompSeq G is halting & ((PRIM:CompSeq G) .Lifespan()) + 1 = card (G .reachableFrom (choose (the_Vertices_of G))) ) set PCS = PRIM:CompSeq G; set src = choose (the_Vertices_of G); set RFS = G .reachableFrom (choose (the_Vertices_of G)); consider n being Nat such that A1: n + 1 = card (G .reachableFrom (choose (the_Vertices_of G))) by NAT_1:6; reconsider n = n as Element of NAT by ORDINAL1:def_12; set Gn = (PRIM:CompSeq G) . n; set Gn1 = (PRIM:CompSeq G) . (n + 1); A2: card (G .reachableFrom (choose (the_Vertices_of G))) <= (card (G .reachableFrom (choose (the_Vertices_of G)))) + 1 by NAT_1:11; A3: card (((PRIM:CompSeq G) . (n + 1)) `1) = min (((card (G .reachableFrom (choose (the_Vertices_of G)))) + 1),(card (G .reachableFrom (choose (the_Vertices_of G))))) by A1, Th36 .= card (G .reachableFrom (choose (the_Vertices_of G))) by A2, XXREAL_0:def_9 ; set e = choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)); A4: card (((PRIM:CompSeq G) . n) `1) = min ((card (G .reachableFrom (choose (the_Vertices_of G)))),(card (G .reachableFrom (choose (the_Vertices_of G))))) by A1, Th36 .= card (G .reachableFrom (choose (the_Vertices_of G))) ; A5: (PRIM:CompSeq G) . (n + 1) = PRIM:Step ((PRIM:CompSeq G) . n) by Def17; then A6: ((PRIM:CompSeq G) . n) `1 c= ((PRIM:CompSeq G) . (n + 1)) `1 by Th29; A7: now__::_thesis:_not_((PRIM:CompSeq_G)_._n)_`1_<>_((PRIM:CompSeq_G)_._(n_+_1))_`1 assume ((PRIM:CompSeq G) . n) `1 <> ((PRIM:CompSeq G) . (n + 1)) `1 ; ::_thesis: contradiction then ((PRIM:CompSeq G) . n) `1 c< ((PRIM:CompSeq G) . (n + 1)) `1 by A6, XBOOLE_0:def_8; hence contradiction by A4, A3, CARD_2:48; ::_thesis: verum end; now__::_thesis:_not_PRIM:NextBestEdges_((PRIM:CompSeq_G)_._n)_<>_{} assume PRIM:NextBestEdges ((PRIM:CompSeq G) . n) <> {} ; ::_thesis: contradiction then consider v being Vertex of G such that A8: not v in ((PRIM:CompSeq G) . n) `1 and A9: (PRIM:CompSeq G) . (n + 1) = [((((PRIM:CompSeq G) . n) `1) \/ {v}),((((PRIM:CompSeq G) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . n)))})] by A5, Th28; A10: v in {v} by TARSKI:def_1; ((PRIM:CompSeq G) . (n + 1)) `1 = (((PRIM:CompSeq G) . n) `1) \/ {v} by A9, MCART_1:7; hence contradiction by A7, A8, A10, XBOOLE_0:def_3; ::_thesis: verum end; then A11: (PRIM:CompSeq G) . (n + 1) = (PRIM:CompSeq G) . n by A5, Def15; hence A12: PRIM:CompSeq G is halting by GLIB_000:def_54; ::_thesis: ((PRIM:CompSeq G) .Lifespan()) + 1 = card (G .reachableFrom (choose (the_Vertices_of G))) now__::_thesis:_for_m_being_Nat_st_(PRIM:CompSeq_G)_._m_=_(PRIM:CompSeq_G)_._(m_+_1)_holds_ n_<=_m let m be Nat; ::_thesis: ( (PRIM:CompSeq G) . m = (PRIM:CompSeq G) . (m + 1) implies n <= m ) set Gm = (PRIM:CompSeq G) . m; assume A13: (PRIM:CompSeq G) . m = (PRIM:CompSeq G) . (m + 1) ; ::_thesis: n <= m now__::_thesis:_not_m_<_n assume m < n ; ::_thesis: contradiction then A14: m + 1 <= n by NAT_1:13; n + 0 < card (G .reachableFrom (choose (the_Vertices_of G))) by A1, XREAL_1:8; then A15: m + 1 < card (G .reachableFrom (choose (the_Vertices_of G))) by A14, XXREAL_0:2; then A16: (m + 1) + 1 <= card (G .reachableFrom (choose (the_Vertices_of G))) by NAT_1:13; A17: card (((PRIM:CompSeq G) . m) `1) = min ((m + 1),(card (G .reachableFrom (choose (the_Vertices_of G))))) by Th36 .= m + 1 by A15, XXREAL_0:def_9 ; card (((PRIM:CompSeq G) . m) `1) = min (((m + 1) + 1),(card (G .reachableFrom (choose (the_Vertices_of G))))) by A13, Th36 .= (m + 1) + 1 by A16, XXREAL_0:def_9 ; hence contradiction by A17; ::_thesis: verum end; hence n <= m ; ::_thesis: verum end; hence ((PRIM:CompSeq G) .Lifespan()) + 1 = card (G .reachableFrom (choose (the_Vertices_of G))) by A1, A11, A12, GLIB_000:def_55; ::_thesis: verum end; theorem Th38: :: GLIB_004:38 for G1 being finite real-weighted WGraph for n being Nat for G2 being inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 holds G2 is Tree-like proof let G1 be finite real-weighted WGraph; ::_thesis: for n being Nat for G2 being inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 holds G2 is Tree-like set PCS = PRIM:CompSeq G1; defpred S1[ Nat] means for G2 being inducedSubgraph of G1,((PRIM:CompSeq G1) . $1) `1 ,((PRIM:CompSeq G1) . $1) `2 holds G2 is Tree-like ; set G0 = (PRIM:CompSeq G1) . 0; set src = choose (the_Vertices_of G1); now__::_thesis:_for_n_being_Nat_st_S1[n]_holds_ S1[n_+_1] let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] ) set Gn = (PRIM:CompSeq G1) . n; set Gn1 = (PRIM:CompSeq G1) . (n + 1); set Next = PRIM:NextBestEdges ((PRIM:CompSeq G1) . n); set e = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)); set G3 = the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 ; A1: (PRIM:CompSeq G1) . (n + 1) = PRIM:Step ((PRIM:CompSeq G1) . n) by Def17; A2: ((PRIM:CompSeq G1) . n) `2 c= G1 .edgesBetween (((PRIM:CompSeq G1) . n) `1) by Th30; ((PRIM:CompSeq G1) . n) `1 is non empty Subset of (the_Vertices_of G1) by Th30; then A3: ( the_Vertices_of the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 = ((PRIM:CompSeq G1) . n) `1 & the_Edges_of the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 = ((PRIM:CompSeq G1) . n) `2 ) by A2, GLIB_000:def_37; assume A4: S1[n] ; ::_thesis: S1[n + 1] then A5: the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 is Tree-like ; now__::_thesis:_for_G2_being_inducedSubgraph_of_G1,((PRIM:CompSeq_G1)_._(n_+_1))_`1_,((PRIM:CompSeq_G1)_._(n_+_1))_`2_holds_G2_is_Tree-like A6: the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 .order() = ( the inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 .size()) + 1 by A5, GLIB_002:46; let G2 be inducedSubgraph of G1,((PRIM:CompSeq G1) . (n + 1)) `1 ,((PRIM:CompSeq G1) . (n + 1)) `2 ; ::_thesis: G2 is Tree-like A7: ((PRIM:CompSeq G1) . (n + 1)) `2 c= G1 .edgesBetween (((PRIM:CompSeq G1) . (n + 1)) `1) by Th30; ((PRIM:CompSeq G1) . (n + 1)) `1 is non empty Subset of (the_Vertices_of G1) by Th30; then A8: the_Vertices_of G2 = ((PRIM:CompSeq G1) . (n + 1)) `1 by A7, GLIB_000:def_37; now__::_thesis:_G2_is_Tree-like percases ( PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) = {} or PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) <> {} ) ; suppose PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) = {} ; ::_thesis: G2 is Tree-like then (PRIM:CompSeq G1) . n = (PRIM:CompSeq G1) . (n + 1) by A1, Def15; hence G2 is Tree-like by A4; ::_thesis: verum end; supposeA9: PRIM:NextBestEdges ((PRIM:CompSeq G1) . n) <> {} ; ::_thesis: G2 is Tree-like set GnV = ((PRIM:CompSeq G1) . n) `1 ; set GnVg = (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . n) `1); A10: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) SJoins ((PRIM:CompSeq G1) . n) `1 ,(the_Vertices_of G1) \ (((PRIM:CompSeq G1) . n) `1),G1 by A9, Def13; A11: now__::_thesis:_not_choose_(PRIM:NextBestEdges_((PRIM:CompSeq_G1)_._n))_in_((PRIM:CompSeq_G1)_._n)_`2 assume A12: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)) in ((PRIM:CompSeq G1) . n) `2 ; ::_thesis: contradiction then (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in ((PRIM:CompSeq G1) . n) `1 by A2, GLIB_000:31; then A13: not (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . n) `1) by XBOOLE_0:def_5; (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in ((PRIM:CompSeq G1) . n) `1 by A2, A12, GLIB_000:31; then not (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n))) in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . n) `1) by XBOOLE_0:def_5; hence contradiction by A10, A13, GLIB_000:def_15; ::_thesis: verum end; consider v being Vertex of G1 such that A14: not v in ((PRIM:CompSeq G1) . n) `1 and A15: (PRIM:CompSeq G1) . (n + 1) = [((((PRIM:CompSeq G1) . n) `1) \/ {v}),((((PRIM:CompSeq G1) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)))})] by A1, A9, Th28; A16: card (((PRIM:CompSeq G1) . (n + 1)) `1) = card ((((PRIM:CompSeq G1) . n) `1) \/ {v}) by A15, MCART_1:7 .= (card (((PRIM:CompSeq G1) . n) `1)) + 1 by A14, CARD_2:41 ; card (((PRIM:CompSeq G1) . (n + 1)) `2) = card ((((PRIM:CompSeq G1) . n) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . n)))}) by A15, MCART_1:7 .= (card (((PRIM:CompSeq G1) . n) `2)) + 1 by A11, CARD_2:41 ; then G2 .order() = (G2 .size()) + 1 by A3, A7, A8, A6, A16, GLIB_000:def_37; hence G2 is Tree-like by GLIB_002:47; ::_thesis: verum end; end; end; hence G2 is Tree-like ; ::_thesis: verum end; hence S1[n + 1] ; ::_thesis: verum end; then A17: for n being Nat st S1[n] holds S1[n + 1] ; (PRIM:CompSeq G1) . 0 = PRIM:Init G1 by Def17; then ( ((PRIM:CompSeq G1) . 0) `1 = {(choose (the_Vertices_of G1))} & ((PRIM:CompSeq G1) . 0) `2 = {} ) by MCART_1:7; then A18: S1[ 0 ] ; for n being Nat holds S1[n] from NAT_1:sch_2(A18, A17); hence for n being Nat for G2 being inducedSubgraph of G1,((PRIM:CompSeq G1) . n) `1 ,((PRIM:CompSeq G1) . n) `2 holds G2 is Tree-like ; ::_thesis: verum end; theorem Th39: :: GLIB_004:39 for G being finite connected real-weighted WGraph holds (PRIM:MST G) `1 = the_Vertices_of G proof let G be finite connected real-weighted WGraph; ::_thesis: (PRIM:MST G) `1 = the_Vertices_of G set M = PRIM:MST G; set PCS = PRIM:CompSeq G; set V = (PRIM:MST G) `1 ; set src = choose (the_Vertices_of G); set RFS = G .reachableFrom (choose (the_Vertices_of G)); ((PRIM:CompSeq G) .Lifespan()) + 1 = card (G .reachableFrom (choose (the_Vertices_of G))) by Th37; then A1: card ((PRIM:MST G) `1) = min ((card (G .reachableFrom (choose (the_Vertices_of G)))),(card (G .reachableFrom (choose (the_Vertices_of G))))) by Th36; A2: (PRIM:MST G) `1 c= G .reachableFrom (choose (the_Vertices_of G)) by Th33; now__::_thesis:_not_(PRIM:MST_G)_`1_<>_G_.reachableFrom_(choose_(the_Vertices_of_G)) assume (PRIM:MST G) `1 <> G .reachableFrom (choose (the_Vertices_of G)) ; ::_thesis: contradiction then (PRIM:MST G) `1 c< G .reachableFrom (choose (the_Vertices_of G)) by A2, XBOOLE_0:def_8; hence contradiction by A1, CARD_2:48; ::_thesis: verum end; hence (PRIM:MST G) `1 = the_Vertices_of G by GLIB_002:16; ::_thesis: verum end; registration let G be finite connected real-weighted WGraph; cluster Relation-like NAT -defined Function-like finite finite-support [Graph-like] finite spanning Tree-like [Weighted] weight-inheriting real-weighted for Subgraph of G; existence ex b1 being WSubgraph of G st ( b1 is spanning & b1 is Tree-like ) proof set PCS = PRIM:CompSeq G; set n = (PRIM:CompSeq G) .Lifespan() ; set IT = the inducedWSubgraph of G,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `1 ,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `2 ; take the inducedWSubgraph of G,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `1 ,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `2 ; ::_thesis: ( the inducedWSubgraph of G,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `1 ,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `2 is spanning & the inducedWSubgraph of G,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `1 ,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `2 is Tree-like ) PRIM:MST G = (PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan()) ; then A1: ((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `1 = the_Vertices_of G by Th39; thus the inducedWSubgraph of G,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `1 ,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `2 is spanning by A1; ::_thesis: the inducedWSubgraph of G,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `1 ,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `2 is Tree-like thus the inducedWSubgraph of G,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `1 ,((PRIM:CompSeq G) . ((PRIM:CompSeq G) .Lifespan())) `2 is Tree-like by Th38; ::_thesis: verum end; end; definition let G1 be finite connected real-weighted WGraph; let G2 be spanning Tree-like WSubgraph of G1; attrG2 is min-cost means :Def19: :: GLIB_004:def 19 for G3 being spanning Tree-like WSubgraph of G1 holds G2 .cost() <= G3 .cost() ; end; :: deftheorem Def19 defines min-cost GLIB_004:def_19_:_ for G1 being finite connected real-weighted WGraph for G2 being spanning Tree-like WSubgraph of G1 holds ( G2 is min-cost iff for G3 being spanning Tree-like WSubgraph of G1 holds G2 .cost() <= G3 .cost() ); registration let G1 be finite connected real-weighted WGraph; cluster Relation-like NAT -defined Function-like finite finite-support [Graph-like] finite loopless non-multi non-Dmulti simple Dsimple spanning connected acyclic Tree-like [Weighted] weight-inheriting real-weighted min-cost for Subgraph of G1; existence ex b1 being spanning Tree-like WSubgraph of G1 st b1 is min-cost proof set GT = the spanning Tree-like WSubgraph of G1; set G3 = the spanning Tree-like WSubgraph of G1 | WGraphSelectors; A1: the spanning Tree-like WSubgraph of G1 | WGraphSelectors == the spanning Tree-like WSubgraph of G1 by Lm4; the_Weight_of ( the spanning Tree-like WSubgraph of G1 | WGraphSelectors) = the_Weight_of the spanning Tree-like WSubgraph of G1 by Lm4; then reconsider G3 = the spanning Tree-like WSubgraph of G1 | WGraphSelectors as WSubgraph of G1 by A1, GLIB_003:8; the_Vertices_of G3 = the_Vertices_of the spanning Tree-like WSubgraph of G1 by A1, GLIB_000:def_34 .= the_Vertices_of G1 by GLIB_000:def_33 ; then reconsider G3 = G3 as spanning Tree-like WSubgraph of G1 by A1, GLIB_000:def_33, GLIB_002:48; set X = { G2 where G2 is Element of G1 .allWSubgraphs() : G2 is spanning Tree-like WSubgraph of G1 } ; now__::_thesis:_for_x_being_set_st_x_in__{__G2_where_G2_is_Element_of_G1_.allWSubgraphs()_:_G2_is_spanning_Tree-like_WSubgraph_of_G1__}__holds_ x_in_G1_.allWSubgraphs() let x be set ; ::_thesis: ( x in { G2 where G2 is Element of G1 .allWSubgraphs() : G2 is spanning Tree-like WSubgraph of G1 } implies x in G1 .allWSubgraphs() ) assume x in { G2 where G2 is Element of G1 .allWSubgraphs() : G2 is spanning Tree-like WSubgraph of G1 } ; ::_thesis: x in G1 .allWSubgraphs() then ex G2 being Element of G1 .allWSubgraphs() st ( x = G2 & G2 is spanning Tree-like WSubgraph of G1 ) ; hence x in G1 .allWSubgraphs() ; ::_thesis: verum end; then reconsider X = { G2 where G2 is Element of G1 .allWSubgraphs() : G2 is spanning Tree-like WSubgraph of G1 } as finite Subset of (G1 .allWSubgraphs()) by TARSKI:def_3; deffunc H1( finite real-weighted WGraph) -> Real = G1 .cost() ; dom G3 = WGraphSelectors by Lm5; then G3 in G1 .allWSubgraphs() by Def5; then G3 in X ; then reconsider X = X as non empty finite Subset of (G1 .allWSubgraphs()) ; consider x being Element of X such that A2: for y being Element of X holds H1(x) <= H1(y) from GRAPH_5:sch_2(); x in X ; then ex G2 being Element of G1 .allWSubgraphs() st ( x = G2 & G2 is spanning Tree-like WSubgraph of G1 ) ; then reconsider x = x as spanning Tree-like WSubgraph of G1 ; take x ; ::_thesis: x is min-cost now__::_thesis:_for_GT_being_spanning_Tree-like_WSubgraph_of_G1_holds_x_.cost()_<=_GT_.cost() let GT be spanning Tree-like WSubgraph of G1; ::_thesis: x .cost() <= GT .cost() set G3 = GT | WGraphSelectors; A3: GT | WGraphSelectors == GT by Lm4; A4: the_Weight_of (GT | WGraphSelectors) = the_Weight_of GT by Lm4; then reconsider G3 = GT | WGraphSelectors as WSubgraph of G1 by A3, GLIB_003:8; the_Vertices_of G3 = the_Vertices_of GT by A3, GLIB_000:def_34 .= the_Vertices_of G1 by GLIB_000:def_33 ; then reconsider G3 = G3 as spanning Tree-like WSubgraph of G1 by A3, GLIB_000:def_33, GLIB_002:48; dom G3 = WGraphSelectors by Lm5; then G3 in G1 .allWSubgraphs() by Def5; then G3 in X ; then x .cost() <= G3 .cost() by A2; hence x .cost() <= GT .cost() by A3, A4, GLIB_000:def_34; ::_thesis: verum end; hence x is min-cost by Def19; ::_thesis: verum end; end; definition let G be finite connected real-weighted WGraph; mode minimumSpanningTree of G is spanning Tree-like min-cost WSubgraph of G; end; begin theorem :: GLIB_004:40 for G1, G2 being finite connected real-weighted WGraph for G3 being WSubgraph of G1 st G3 is minimumSpanningTree of G1 & G1 == G2 & the_Weight_of G1 = the_Weight_of G2 holds G3 is minimumSpanningTree of G2 proof let G1, G2 be finite connected real-weighted WGraph; ::_thesis: for G3 being WSubgraph of G1 st G3 is minimumSpanningTree of G1 & G1 == G2 & the_Weight_of G1 = the_Weight_of G2 holds G3 is minimumSpanningTree of G2 let G3 be WSubgraph of G1; ::_thesis: ( G3 is minimumSpanningTree of G1 & G1 == G2 & the_Weight_of G1 = the_Weight_of G2 implies G3 is minimumSpanningTree of G2 ) assume that A1: G3 is minimumSpanningTree of G1 and A2: G1 == G2 and A3: the_Weight_of G1 = the_Weight_of G2 ; ::_thesis: G3 is minimumSpanningTree of G2 set G39 = G3; reconsider G39 = G3 as Tree-like WSubgraph of G2 by A1, A2, A3, GLIB_003:10; the_Vertices_of G3 = the_Vertices_of G1 by A1, GLIB_000:def_33 .= the_Vertices_of G2 by A2, GLIB_000:def_34 ; then reconsider G39 = G39 as spanning Tree-like WSubgraph of G2 by GLIB_000:def_33; now__::_thesis:_for_G_being_spanning_Tree-like_WSubgraph_of_G2_holds_G3_.cost()_<=_G_.cost() let G be spanning Tree-like WSubgraph of G2; ::_thesis: G3 .cost() <= G .cost() reconsider G9 = G as Tree-like WSubgraph of G1 by A2, A3, GLIB_003:10; the_Vertices_of G = the_Vertices_of G2 by GLIB_000:def_33 .= the_Vertices_of G1 by A2, GLIB_000:def_34 ; then G9 is spanning by GLIB_000:def_33; hence G3 .cost() <= G .cost() by A1, Def19; ::_thesis: verum end; then G39 is min-cost by Def19; hence G3 is minimumSpanningTree of G2 ; ::_thesis: verum end; theorem Th41: :: GLIB_004:41 for G being finite connected real-weighted WGraph for G1 being minimumSpanningTree of G for G2 being WGraph st G1 == G2 & the_Weight_of G1 = the_Weight_of G2 holds G2 is minimumSpanningTree of G proof let G be finite connected real-weighted WGraph; ::_thesis: for G1 being minimumSpanningTree of G for G2 being WGraph st G1 == G2 & the_Weight_of G1 = the_Weight_of G2 holds G2 is minimumSpanningTree of G let G1 be minimumSpanningTree of G; ::_thesis: for G2 being WGraph st G1 == G2 & the_Weight_of G1 = the_Weight_of G2 holds G2 is minimumSpanningTree of G let G2 be WGraph; ::_thesis: ( G1 == G2 & the_Weight_of G1 = the_Weight_of G2 implies G2 is minimumSpanningTree of G ) assume that A1: G1 == G2 and A2: the_Weight_of G1 = the_Weight_of G2 ; ::_thesis: G2 is minimumSpanningTree of G reconsider G29 = G2 as WSubgraph of G by A1, A2, GLIB_003:8; the_Vertices_of G2 = the_Vertices_of G1 by A1, GLIB_000:def_34 .= the_Vertices_of G by GLIB_000:def_33 ; then reconsider G29 = G29 as spanning Tree-like WSubgraph of G by A1, GLIB_000:def_33, GLIB_002:48; now__::_thesis:_for_G3_being_spanning_Tree-like_WSubgraph_of_G_holds_G29_.cost()_<=_G3_.cost() let G3 be spanning Tree-like WSubgraph of G; ::_thesis: G29 .cost() <= G3 .cost() G1 .cost() <= G3 .cost() by Def19; hence G29 .cost() <= G3 .cost() by A1, A2, GLIB_000:def_34; ::_thesis: verum end; hence G2 is minimumSpanningTree of G by Def19; ::_thesis: verum end; theorem Th42: :: GLIB_004:42 for G being finite connected real-weighted WGraph for n being Nat holds ((PRIM:CompSeq G) . n) `2 c= (PRIM:MST G) `2 proof let G be finite connected real-weighted WGraph; ::_thesis: for n being Nat holds ((PRIM:CompSeq G) . n) `2 c= (PRIM:MST G) `2 let n be Nat; ::_thesis: ((PRIM:CompSeq G) . n) `2 c= (PRIM:MST G) `2 set PCS = PRIM:CompSeq G; defpred S1[ Nat] means (PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + $1) = PRIM:MST G; A1: now__::_thesis:_for_n_being_Nat_st_S1[n]_holds_ S1[n_+_1] set off = (PRIM:CompSeq G) .Lifespan() ; let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] ) set Gn = (PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n); set Gn1 = (PRIM:CompSeq G) . ((((PRIM:CompSeq G) .Lifespan()) + n) + 1); set Next = PRIM:NextBestEdges ((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n)); set e = choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n))); A2: (PRIM:CompSeq G) . ((((PRIM:CompSeq G) .Lifespan()) + n) + 1) = PRIM:Step ((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n)) by Def17; assume A3: S1[n] ; ::_thesis: S1[n + 1] then A4: ((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n)) `1 = the_Vertices_of G by Th39; now__::_thesis:_not_PRIM:NextBestEdges_((PRIM:CompSeq_G)_._(((PRIM:CompSeq_G)_.Lifespan())_+_n))_<>_{} assume PRIM:NextBestEdges ((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n)) <> {} ; ::_thesis: contradiction then ex v being Vertex of G st ( not v in ((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n)) `1 & (PRIM:CompSeq G) . ((((PRIM:CompSeq G) .Lifespan()) + n) + 1) = [((((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n)) `1) \/ {v}),((((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n)) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G) . (((PRIM:CompSeq G) .Lifespan()) + n))))})] ) by A2, Th28; hence contradiction by A4; ::_thesis: verum end; hence S1[n + 1] by A3, A2, Def15; ::_thesis: verum end; A5: S1[ 0 ] ; A6: for n being Nat holds S1[n] from NAT_1:sch_2(A5, A1); now__::_thesis:_((PRIM:CompSeq_G)_._n)_`2_c=_(PRIM:MST_G)_`2 percases ( n <= (PRIM:CompSeq G) .Lifespan() or (PRIM:CompSeq G) .Lifespan() < n ) ; suppose n <= (PRIM:CompSeq G) .Lifespan() ; ::_thesis: ((PRIM:CompSeq G) . n) `2 c= (PRIM:MST G) `2 hence ((PRIM:CompSeq G) . n) `2 c= (PRIM:MST G) `2 by Th34; ::_thesis: verum end; suppose (PRIM:CompSeq G) .Lifespan() < n ; ::_thesis: ((PRIM:CompSeq G) . n) `2 c= (PRIM:MST G) `2 then ex k being Nat st n = ((PRIM:CompSeq G) .Lifespan()) + k by NAT_1:10; hence ((PRIM:CompSeq G) . n) `2 c= (PRIM:MST G) `2 by A6; ::_thesis: verum end; end; end; hence ((PRIM:CompSeq G) . n) `2 c= (PRIM:MST G) `2 ; ::_thesis: verum end; theorem :: GLIB_004:43 for G1 being finite connected real-weighted WGraph for G2 being inducedWSubgraph of G1,(PRIM:MST G1) `1 ,(PRIM:MST G1) `2 holds G2 is minimumSpanningTree of G1 proof let G1 be finite connected real-weighted WGraph; ::_thesis: for G2 being inducedWSubgraph of G1,(PRIM:MST G1) `1 ,(PRIM:MST G1) `2 holds G2 is minimumSpanningTree of G1 set PMST = PRIM:MST G1; let G2 be inducedWSubgraph of G1,(PRIM:MST G1) `1 ,(PRIM:MST G1) `2 ; ::_thesis: G2 is minimumSpanningTree of G1 reconsider G29 = G2 as Tree-like _Graph by Th38; set VG1 = the_Vertices_of G1; set EG1 = the_Edges_of G1; set WG1 = the_Weight_of G1; set PCS = PRIM:CompSeq G1; A1: (PRIM:MST G1) `1 = the_Vertices_of G1 by Th39; (PRIM:MST G1) `2 c= the_Edges_of G1 ; then A2: (PRIM:MST G1) `2 c= G1 .edgesBetween ((PRIM:MST G1) `1) by A1, GLIB_000:34; A3: the_Vertices_of G2 = the_Vertices_of G1 by A1, A2, GLIB_000:def_37; A4: the_Edges_of G2 = (PRIM:MST G1) `2 by A1, A2, GLIB_000:def_37; A5: G2 is Tree-like by Th38; now__::_thesis:_G2_is_minimumSpanningTree_of_G1 set X = { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } ; now__::_thesis:_for_x_being_set_st_x_in__{__x_where_x_is_Element_of_G1_.allWSubgraphs()_:_x_is_minimumSpanningTree_of_G1__}__holds_ x_in_G1_.allWSubgraphs() let x be set ; ::_thesis: ( x in { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } implies x in G1 .allWSubgraphs() ) assume x in { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } ; ::_thesis: x in G1 .allWSubgraphs() then ex G2 being Element of G1 .allWSubgraphs() st ( x = G2 & G2 is minimumSpanningTree of G1 ) ; hence x in G1 .allWSubgraphs() ; ::_thesis: verum end; then reconsider X = { x where x is Element of G1 .allWSubgraphs() : x is minimumSpanningTree of G1 } as finite Subset of (G1 .allWSubgraphs()) by TARSKI:def_3; defpred S1[ finite _Graph, Nat] means ( not ((PRIM:CompSeq G1) . ($2 + 1)) `2 c= the_Edges_of $1 & ( for n being Nat st n <= $2 holds ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of $1 ) ); defpred S2[ finite _Graph, finite _Graph] means ( card ((the_Edges_of $1) /\ (the_Edges_of G2)) > card ((the_Edges_of $2) /\ (the_Edges_of G2)) or ( card ((the_Edges_of $1) /\ (the_Edges_of G2)) = card ((the_Edges_of $2) /\ (the_Edges_of G2)) & ( for k1, k2 being Nat st S1[$1,k1] & S1[$2,k2] holds k1 >= k2 ) ) ); A6: G1 .edgesBetween (the_Vertices_of G1) = the_Edges_of G1 by GLIB_000:34; now__::_thesis:_X_<>_{} set M = the minimumSpanningTree of G1; set M9 = the minimumSpanningTree of G1 | WGraphSelectors; ( the minimumSpanningTree of G1 | WGraphSelectors == the minimumSpanningTree of G1 & the_Weight_of ( the minimumSpanningTree of G1 | WGraphSelectors) = the_Weight_of the minimumSpanningTree of G1 ) by Lm4; then reconsider M9 = the minimumSpanningTree of G1 | WGraphSelectors as minimumSpanningTree of G1 by Th41; dom M9 = WGraphSelectors by Lm5; then M9 in G1 .allWSubgraphs() by Def5; then M9 in X ; hence X <> {} ; ::_thesis: verum end; then reconsider X = X as non empty finite Subset of (G1 .allWSubgraphs()) ; assume A7: G2 is not minimumSpanningTree of G1 ; ::_thesis: contradiction A8: now__::_thesis:_for_G_being_Element_of_X_ex_k1_being_Nat_st_S1[G,k1] let G be Element of X; ::_thesis: ex k1 being Nat st S1[G,k1] G in X ; then ex G9 being Element of G1 .allWSubgraphs() st ( G = G9 & G9 is minimumSpanningTree of G1 ) ; then reconsider G9 = G as minimumSpanningTree of G1 ; defpred S3[ Nat] means not ((PRIM:CompSeq G1) . $1) `2 c= the_Edges_of G9; A9: the_Vertices_of G2 = the_Vertices_of G9 by A3, GLIB_000:def_33; A10: now__::_thesis:_not_the_Edges_of_G2_=_the_Edges_of_G9 assume A11: the_Edges_of G2 = the_Edges_of G9 ; ::_thesis: contradiction the_Weight_of G2 = (the_Weight_of G1) | (the_Edges_of G2) by GLIB_003:def_10 .= the_Weight_of G9 by A11, GLIB_003:def_10 ; hence contradiction by A7, A9, A11, Th41, GLIB_000:86; ::_thesis: verum end; now__::_thesis:_not_the_Edges_of_G2_c=_the_Edges_of_G9 assume the_Edges_of G2 c= the_Edges_of G9 ; ::_thesis: contradiction then the_Edges_of G2 c< the_Edges_of G9 by A10, XBOOLE_0:def_8; then (G2 .size()) + 1 < (G9 .size()) + 1 by CARD_2:48, XREAL_1:8; then A12: G2 .order() < (G9 .size()) + 1 by A5, GLIB_002:46; G2 .order() = G9 .order() by A3, GLIB_000:def_33; hence contradiction by A12, GLIB_002:46; ::_thesis: verum end; then A13: ex n being Nat st S3[n] by A4; consider k3 being Nat such that A14: ( S3[k3] & ( for n being Nat st S3[n] holds k3 <= n ) ) from NAT_1:sch_5(A13); now__::_thesis:_not_k3_=_0 assume k3 = 0 ; ::_thesis: contradiction then A15: not (PRIM:Init G1) `2 c= the_Edges_of G9 by A14, Def17; (PRIM:Init G1) `2 = {} by MCART_1:7; hence contradiction by A15, XBOOLE_1:2; ::_thesis: verum end; then consider k2 being Nat such that A16: k2 + 1 = k3 by NAT_1:6; (k2 + 1) - 1 < k3 - 0 by A16, XREAL_1:15; then A17: ((PRIM:CompSeq G1) . k2) `2 c= the_Edges_of G9 by A14; now__::_thesis:_for_n_being_Nat_st_n_<=_k2_holds_ ((PRIM:CompSeq_G1)_._n)_`2_c=_the_Edges_of_G9 let n be Nat; ::_thesis: ( n <= k2 implies ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of G9 ) assume n <= k2 ; ::_thesis: ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of G9 then ((PRIM:CompSeq G1) . n) `2 c= ((PRIM:CompSeq G1) . k2) `2 by Th34; hence ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of G9 by A17, XBOOLE_1:1; ::_thesis: verum end; hence ex k1 being Nat st S1[G,k1] by A14, A16; ::_thesis: verum end; now__::_thesis:_for_x,_y,_z_being_Element_of_X_st_S2[x,y]_&_S2[y,z]_holds_ S2[x,z] let x, y, z be Element of X; ::_thesis: ( S2[x,y] & S2[y,z] implies S2[x,z] ) assume that A18: S2[x,y] and A19: S2[y,z] ; ::_thesis: S2[x,z] y in X ; then consider y9 being WSubgraph of G1 such that A20: y9 = y and dom y9 = WGraphSelectors by Def5; set CY = card ((the_Edges_of y9) /\ (the_Edges_of G2)); x in X ; then consider x9 being WSubgraph of G1 such that A21: x9 = x and dom x9 = WGraphSelectors by Def5; z in X ; then consider z9 being WSubgraph of G1 such that A22: z9 = z and dom z9 = WGraphSelectors by Def5; set CZ = card ((the_Edges_of z9) /\ (the_Edges_of G2)); set CX = card ((the_Edges_of x9) /\ (the_Edges_of G2)); now__::_thesis:_S2[x,z] percases ( card ((the_Edges_of x9) /\ (the_Edges_of G2)) > card ((the_Edges_of y9) /\ (the_Edges_of G2)) or ( card ((the_Edges_of x9) /\ (the_Edges_of G2)) = card ((the_Edges_of y9) /\ (the_Edges_of G2)) & ( for kx, ky being Nat st S1[x9,kx] & S1[y9,ky] holds kx >= ky ) ) ) by A18, A21, A20; supposeA23: card ((the_Edges_of x9) /\ (the_Edges_of G2)) > card ((the_Edges_of y9) /\ (the_Edges_of G2)) ; ::_thesis: S2[x,z] now__::_thesis:_S2[x,z] percases ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) > card ((the_Edges_of z9) /\ (the_Edges_of G2)) or ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of z9) /\ (the_Edges_of G2)) & ( for ky, kz being Nat st S1[y9,ky] & S1[z9,kz] holds ky >= kz ) ) ) by A19, A20, A22; suppose card ((the_Edges_of y9) /\ (the_Edges_of G2)) > card ((the_Edges_of z9) /\ (the_Edges_of G2)) ; ::_thesis: S2[x,z] hence S2[x,z] by A21, A22, A23, XXREAL_0:2; ::_thesis: verum end; suppose ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of z9) /\ (the_Edges_of G2)) & ( for ky, kz being Nat st S1[y9,ky] & S1[z9,kz] holds ky >= kz ) ) ; ::_thesis: S2[x,z] hence S2[x,z] by A21, A22, A23; ::_thesis: verum end; end; end; hence S2[x,z] ; ::_thesis: verum end; supposeA24: ( card ((the_Edges_of x9) /\ (the_Edges_of G2)) = card ((the_Edges_of y9) /\ (the_Edges_of G2)) & ( for kx, ky being Nat st S1[x9,kx] & S1[y9,ky] holds kx >= ky ) ) ; ::_thesis: S2[x,z] now__::_thesis:_S2[x,z] percases ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) > card ((the_Edges_of z9) /\ (the_Edges_of G2)) or ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of z9) /\ (the_Edges_of G2)) & ( for ky, kz being Nat st S1[y9,ky] & S1[z9,kz] holds ky >= kz ) ) ) by A19, A20, A22; suppose card ((the_Edges_of y9) /\ (the_Edges_of G2)) > card ((the_Edges_of z9) /\ (the_Edges_of G2)) ; ::_thesis: S2[x,z] hence S2[x,z] by A21, A22, A24; ::_thesis: verum end; supposeA25: ( card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of z9) /\ (the_Edges_of G2)) & ( for ky, kz being Nat st S1[y9,ky] & S1[z9,kz] holds ky >= kz ) ) ; ::_thesis: S2[x,z] consider zy being Nat such that A26: S1[y,zy] by A8; now__::_thesis:_for_kx,_kz_being_Nat_st_S1[x9,kx]_&_S1[z9,kz]_holds_ kx_>=_kz let kx, kz be Nat; ::_thesis: ( S1[x9,kx] & S1[z9,kz] implies kx >= kz ) assume ( S1[x9,kx] & S1[z9,kz] ) ; ::_thesis: kx >= kz then ( kx >= zy & zy >= kz ) by A20, A24, A25, A26; hence kx >= kz by XXREAL_0:2; ::_thesis: verum end; hence S2[x,z] by A21, A22, A24, A25; ::_thesis: verum end; end; end; hence S2[x,z] ; ::_thesis: verum end; end; end; hence S2[x,z] ; ::_thesis: verum end; then A27: for x, y, z being Element of X st S2[x,y] & S2[y,z] holds S2[x,z] ; A28: now__::_thesis:_for_G_being_Element_of_X for_k1,_k2_being_Nat_st_S1[G,k1]_&_S1[G,k2]_holds_ k1_=_k2 let G be Element of X; ::_thesis: for k1, k2 being Nat st S1[G,k1] & S1[G,k2] holds k1 = k2 let k1, k2 be Nat; ::_thesis: ( S1[G,k1] & S1[G,k2] implies k1 = k2 ) assume A29: ( S1[G,k1] & S1[G,k2] ) ; ::_thesis: k1 = k2 then k2 + 1 > k1 ; then A30: k2 >= k1 by NAT_1:13; k1 + 1 > k2 by A29; then k1 >= k2 by NAT_1:13; hence k1 = k2 by A30, XXREAL_0:1; ::_thesis: verum end; now__::_thesis:_for_x,_y_being_Element_of_X_holds_ (_S2[x,y]_or_S2[y,x]_) let x, y be Element of X; ::_thesis: ( S2[x,y] or S2[y,x] ) x in X ; then consider x9 being WSubgraph of G1 such that A31: x9 = x and dom x9 = WGraphSelectors by Def5; set CX = card ((the_Edges_of x9) /\ (the_Edges_of G2)); y in X ; then consider y9 being WSubgraph of G1 such that A32: y9 = y and dom y9 = WGraphSelectors by Def5; set CY = card ((the_Edges_of y9) /\ (the_Edges_of G2)); now__::_thesis:_(_S2[x,y]_or_S2[y,x]_) percases ( card ((the_Edges_of x9) /\ (the_Edges_of G2)) < card ((the_Edges_of y9) /\ (the_Edges_of G2)) or card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of x9) /\ (the_Edges_of G2)) or card ((the_Edges_of x9) /\ (the_Edges_of G2)) > card ((the_Edges_of y9) /\ (the_Edges_of G2)) ) by XXREAL_0:1; suppose card ((the_Edges_of x9) /\ (the_Edges_of G2)) < card ((the_Edges_of y9) /\ (the_Edges_of G2)) ; ::_thesis: ( S2[x,y] or S2[y,x] ) hence ( S2[x,y] or S2[y,x] ) by A31, A32; ::_thesis: verum end; supposeA33: card ((the_Edges_of y9) /\ (the_Edges_of G2)) = card ((the_Edges_of x9) /\ (the_Edges_of G2)) ; ::_thesis: ( S2[x,y] or S2[y,x] ) consider k1 being Nat such that A34: S1[x,k1] by A8; consider k2 being Nat such that A35: S1[y,k2] by A8; now__::_thesis:_(_S2[x,y]_or_S2[y,x]_) percases ( k1 >= k2 or k1 < k2 ) ; supposeA36: k1 >= k2 ; ::_thesis: ( S2[x,y] or S2[y,x] ) now__::_thesis:_for_z1,_z2_being_Nat_st_S1[x,z1]_&_S1[y,z2]_holds_ z1_>=_z2 let z1, z2 be Nat; ::_thesis: ( S1[x,z1] & S1[y,z2] implies z1 >= z2 ) assume that A37: S1[x,z1] and A38: S1[y,z2] ; ::_thesis: z1 >= z2 z1 = k1 by A28, A34, A37; hence z1 >= z2 by A28, A35, A36, A38; ::_thesis: verum end; hence ( S2[x,y] or S2[y,x] ) by A31, A32, A33; ::_thesis: verum end; supposeA39: k1 < k2 ; ::_thesis: ( S2[x,y] or S2[y,x] ) now__::_thesis:_for_z1,_z2_being_Nat_st_S1[x,z1]_&_S1[y,z2]_holds_ z1_<=_z2 let z1, z2 be Nat; ::_thesis: ( S1[x,z1] & S1[y,z2] implies z1 <= z2 ) assume that A40: S1[x,z1] and A41: S1[y,z2] ; ::_thesis: z1 <= z2 z1 = k1 by A28, A34, A40; hence z1 <= z2 by A28, A35, A39, A41; ::_thesis: verum end; hence ( S2[x,y] or S2[y,x] ) by A31, A32, A33; ::_thesis: verum end; end; end; hence ( S2[x,y] or S2[y,x] ) ; ::_thesis: verum end; suppose card ((the_Edges_of x9) /\ (the_Edges_of G2)) > card ((the_Edges_of y9) /\ (the_Edges_of G2)) ; ::_thesis: ( S2[x,y] or S2[y,x] ) hence ( S2[x,y] or S2[y,x] ) by A31, A32; ::_thesis: verum end; end; end; hence ( S2[x,y] or S2[y,x] ) ; ::_thesis: verum end; then A42: for x, y being Element of X holds ( S2[x,y] or S2[y,x] ) ; A43: ( X is finite & X <> {} & X c= X ) ; consider M being Element of X such that A44: ( M in X & ( for y being Element of X st y in X holds S2[M,y] ) ) from CQC_SIM1:sch_4(A43, A42, A27); ex x being Element of G1 .allWSubgraphs() st ( M = x & x is minimumSpanningTree of G1 ) by A44; then reconsider M = M as minimumSpanningTree of G1 ; defpred S3[ Nat] means not ((PRIM:CompSeq G1) . $1) `2 c= the_Edges_of M; A45: the_Vertices_of G2 = the_Vertices_of M by A3, GLIB_000:def_33; A46: now__::_thesis:_not_the_Edges_of_G2_=_the_Edges_of_M assume A47: the_Edges_of G2 = the_Edges_of M ; ::_thesis: contradiction the_Weight_of G2 = (the_Weight_of G1) | (the_Edges_of G2) by GLIB_003:def_10 .= the_Weight_of M by A47, GLIB_003:def_10 ; hence contradiction by A7, A45, A47, Th41, GLIB_000:86; ::_thesis: verum end; now__::_thesis:_not_the_Edges_of_G2_c=_the_Edges_of_M assume the_Edges_of G2 c= the_Edges_of M ; ::_thesis: contradiction then the_Edges_of G2 c< the_Edges_of M by A46, XBOOLE_0:def_8; then (G2 .size()) + 1 < (M .size()) + 1 by CARD_2:48, XREAL_1:8; then A48: G2 .order() < (M .size()) + 1 by A5, GLIB_002:46; G2 .order() = M .order() by A3, GLIB_000:def_33; hence contradiction by A48, GLIB_002:46; ::_thesis: verum end; then A49: ex k being Nat st S3[k] by A4; consider k being Nat such that A50: ( S3[k] & ( for n being Nat st S3[n] holds k <= n ) ) from NAT_1:sch_5(A49); now__::_thesis:_not_k_=_0 assume k = 0 ; ::_thesis: contradiction then A51: not (PRIM:Init G1) `2 c= the_Edges_of M by A50, Def17; (PRIM:Init G1) `2 = {} by MCART_1:7; hence contradiction by A51, XBOOLE_1:2; ::_thesis: verum end; then consider k1o being Nat such that A52: k = k1o + 1 by NAT_1:6; set Gk1b = (PRIM:CompSeq G1) . k1o; set Gk = (PRIM:CompSeq G1) . k; (k1o + 1) - 1 < k - 0 by A52, XREAL_1:15; then A53: ((PRIM:CompSeq G1) . k1o) `2 c= the_Edges_of M by A50; set Next = PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o); set ep = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)); A54: (PRIM:CompSeq G1) . k = PRIM:Step ((PRIM:CompSeq G1) . k1o) by A52, Def17; then A55: PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) <> {} by A50, A53, Def15; then A56: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) SJoins ((PRIM:CompSeq G1) . k1o) `1 ,(the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1),G1 by Def13; ex v being Vertex of G1 st ( not v in ((PRIM:CompSeq G1) . k1o) `1 & (PRIM:CompSeq G1) . k = [((((PRIM:CompSeq G1) . k1o) `1) \/ {v}),((((PRIM:CompSeq G1) . k1o) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})] ) by A54, A55, Th28; then A57: ((PRIM:CompSeq G1) . k) `2 = (((PRIM:CompSeq G1) . k1o) `2) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by MCART_1:7; then A58: not {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} c= the_Edges_of M by A50, A53, XBOOLE_1:8; then A59: not choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in the_Edges_of M by ZFMISC_1:31; set Mep = the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}; A60: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o) by A55; then {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} c= the_Edges_of G1 by ZFMISC_1:31; then (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} c= the_Edges_of G1 by XBOOLE_1:8; then A61: ( the_Vertices_of G1 c= the_Vertices_of G1 & (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} c= G1 .edgesBetween (the_Vertices_of G1) ) by GLIB_000:34; then A62: the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} = the_Vertices_of G1 by GLIB_000:def_37; the_Vertices_of G1 = the_Vertices_of M by GLIB_000:def_33; then ( the_Vertices_of G1 c= the_Vertices_of G1 & M is inducedWSubgraph of G1, the_Vertices_of G1, the_Edges_of M ) by A6, GLIB_000:def_37; then A63: the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} .cost() = (M .cost()) + ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) by A60, A59, A6, Th11; set MG2 = (the_Edges_of M) /\ (the_Edges_of G2); A64: ((PRIM:CompSeq G1) . k) `2 c= (PRIM:MST G1) `2 by Th42; choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by TARSKI:def_1; then A65: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in ((PRIM:CompSeq G1) . k) `2 by A57, XBOOLE_0:def_3; then A66: {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} /\ (the_Edges_of G2) = {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A4, A64, ZFMISC_1:46; now__::_thesis:_not_((the_Edges_of_M)_/\_(the_Edges_of_G2))_/\_{(choose_(PRIM:NextBestEdges_((PRIM:CompSeq_G1)_._k1o)))}_<>_{} assume ((the_Edges_of M) /\ (the_Edges_of G2)) /\ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} <> {} ; ::_thesis: contradiction then consider x being set such that A67: x in ((the_Edges_of M) /\ (the_Edges_of G2)) /\ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by XBOOLE_0:def_1; x in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A67, XBOOLE_0:def_4; then A68: x = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by TARSKI:def_1; x in (the_Edges_of M) /\ (the_Edges_of G2) by A67, XBOOLE_0:def_4; then x in the_Edges_of M by XBOOLE_0:def_4; hence contradiction by A58, A68, ZFMISC_1:31; ::_thesis: verum end; then A69: (the_Edges_of M) /\ (the_Edges_of G2) misses {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by XBOOLE_0:def_7; set v1 = (the_Source_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))); set v2 = (the_Target_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))); set V = ((PRIM:CompSeq G1) . k1o) `1 ; A70: the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} = (the_Weight_of G1) | (the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) by GLIB_003:def_10; A71: the_Vertices_of G1 = the_Vertices_of M by GLIB_000:def_33; then reconsider V = ((PRIM:CompSeq G1) . k1o) `1 as non empty Subset of (the_Vertices_of M) by Th30; A72: the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} = (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A61, GLIB_000:def_37; the_Vertices_of M c= the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A62; then reconsider M9 = M as connected Subgraph of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A72, GLIB_000:44, XBOOLE_1:7; choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by TARSKI:def_1; then A73: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A72, XBOOLE_0:def_3; the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} = the_Vertices_of M by A62, GLIB_000:def_33; then reconsider v1 = (the_Source_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))), v2 = (the_Target_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) as Vertex of M by A73, FUNCT_2:5; consider W being Walk of M9 such that A74: W is_Walk_from v2,v1 by GLIB_002:def_1; set PW = the Path of W; reconsider P = the Path of W as Path of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by GLIB_001:175; A75: the Path of W is_Walk_from v2,v1 by A74, GLIB_001:160; then A76: P is_Walk_from v2,v1 by GLIB_001:19; A77: now__::_thesis:_for_n_being_odd_Element_of_NAT_st_1_<_n_&_n_<=_len_P_holds_ not_P_._n_=_v2 reconsider PM = P as Walk of M ; let n be odd Element of NAT ; ::_thesis: ( 1 < n & n <= len P implies not P . n = v2 ) assume that A78: ( 1 < n & n <= len P ) and A79: P . n = v2 ; ::_thesis: contradiction v2 = P .first() by A76, GLIB_001:def_23 .= P . ((2 * 0) + 1) by GLIB_001:def_6 ; then n = len P by A78, A79, GLIB_001:def_28; then P .last() = v2 by A79, GLIB_001:def_7 .= P .first() by A76, GLIB_001:def_23 ; then P is closed by GLIB_001:def_24; then A80: PM is closed by GLIB_001:176; not PM is trivial by A78, GLIB_001:126; then PM is Cycle-like by A80, GLIB_001:def_31; hence contradiction by GLIB_002:def_2; ::_thesis: verum end; A81: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) Joins v1,v2, the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A73, GLIB_000:def_13; then A82: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) Joins P .last() ,v2, the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A76, GLIB_001:def_23; choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) Joins v1,v2,G1 by A81, GLIB_000:72; then A83: choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) Joins v1,v2,G29 by A4, A65, A64, GLIB_000:73; then ( ( (the_Source_of G2) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v1 & (the_Target_of G2) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v2 ) or ( (the_Target_of G2) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v1 & (the_Source_of G2) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v2 ) ) by GLIB_000:def_13; then v1 <> v2 by A4, A65, A64, A83, GLIB_000:def_18; then v1 <> P .first() by A76, GLIB_001:def_23; then P .last() <> P .first() by A76, GLIB_001:def_23; then A84: P is open by GLIB_001:def_24; the Path of W .edges() c= the_Edges_of M ; then P .edges() c= the_Edges_of M by GLIB_001:110; then not choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) in P .edges() by A58, ZFMISC_1:31; then A85: P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is Path-like by A84, A82, A77, GLIB_001:150; P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is_Walk_from v2,v2 by A76, A81, GLIB_001:66; then A86: P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is closed by GLIB_001:119; the_Vertices_of M c= the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A62; then reconsider M9 = M as connected Subgraph of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A72, GLIB_000:44, XBOOLE_1:7; the_Vertices_of M9 = the_Vertices_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A62, GLIB_000:def_33; then M9 is spanning by GLIB_000:def_33; then A87: the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} is connected by GLIB_002:23; A88: v2 = P . 1 by A75, GLIB_001:17; set C = P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))); A89: v1 = P . (len P) by A75, GLIB_001:17; A90: ( (the_Source_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v1 & (the_Target_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) = v2 ) by A73, GLIB_000:def_32; now__::_thesis:_ex_em_being_set_st_ (_em_in_(P_.addEdge_(choose_(PRIM:NextBestEdges_((PRIM:CompSeq_G1)_._k1o))))_.edges()_&_em_<>_choose_(PRIM:NextBestEdges_((PRIM:CompSeq_G1)_._k1o))_&_em_SJoins_V,(the_Vertices_of_M)_\_V,M_) percases ( ( v1 in ((PRIM:CompSeq G1) . k1o) `1 & v2 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ) or ( v2 in ((PRIM:CompSeq G1) . k1o) `1 & v1 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ) ) by A56, A90, GLIB_000:def_15; supposeA91: ( v1 in ((PRIM:CompSeq G1) . k1o) `1 & v2 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ) ; ::_thesis: ex em being set st ( em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() & em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M ) A92: ( len (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) = (len P) + 2 & (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) . ((len P) + 1) = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) ) by A82, GLIB_001:64, GLIB_001:65; defpred S4[ Nat] means ( $1 is odd & $1 <= len P & P . $1 in ((PRIM:CompSeq G1) . k1o) `1 ); A93: ex n being Nat st S4[n] by A89, A91; consider m being Nat such that A94: ( S4[m] & ( for n being Nat st S4[n] holds m <= n ) ) from NAT_1:sch_5(A93); reconsider m = m as odd Element of NAT by A94, ORDINAL1:def_12; ( 1 <= m & m <> 1 ) by A88, A91, A94, ABIAN:12, XBOOLE_0:def_5; then 1 < m by XXREAL_0:1; then 1 + 1 <= m by NAT_1:13; then reconsider m2k = m - (2 * 1) as odd Element of NAT by INT_1:5; A95: m2k < m - 0 by XREAL_1:15; then A96: m2k < len P by A94, XXREAL_0:2; then A97: not P . m2k in ((PRIM:CompSeq G1) . k1o) `1 by A94, A95; set em = P . (m2k + 1); A98: P . (m2k + 1) in P .edges() by A96, GLIB_001:100; then consider i being even Element of NAT such that A99: 1 <= i and A100: i <= len P and A101: P . i = P . (m2k + 1) by GLIB_001:99; i in dom P by A99, A100, FINSEQ_3:25; then A102: (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) . i = P . (m2k + 1) by A82, A101, GLIB_001:65; take em = P . (m2k + 1); ::_thesis: ( em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() & em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M ) (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() = (P .edges()) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A82, GLIB_001:111; hence em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() by A98, XBOOLE_0:def_3; ::_thesis: ( em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M ) A103: (len P) + 1 <= (len P) + 2 by XREAL_1:7; (len P) + 0 < (len P) + 1 by XREAL_1:8; then i < (len P) + 1 by A100, XXREAL_0:2; hence em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by A85, A99, A102, A92, A103, GLIB_001:138; ::_thesis: em SJoins V,(the_Vertices_of M) \ V,M m2k + 2 = m ; then A104: em Joins the Path of W . m2k, the Path of W . m,M by A96, GLIB_001:def_3; then the Path of W . m2k in the_Vertices_of M by GLIB_000:13; then the Path of W . m2k in (the_Vertices_of M) \ (((PRIM:CompSeq G1) . k1o) `1) by A97, XBOOLE_0:def_5; hence em SJoins V,(the_Vertices_of M) \ V,M by A94, A104, GLIB_000:17; ::_thesis: verum end; supposeA105: ( v2 in ((PRIM:CompSeq G1) . k1o) `1 & v1 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ) ; ::_thesis: ex em being set st ( em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() & em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M ) A106: ( len (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) = (len P) + 2 & (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) . ((len P) + 1) = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) ) by A82, GLIB_001:64, GLIB_001:65; defpred S4[ Nat] means ( $1 is odd & $1 <= len P & P . $1 in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) ); A107: ex n being Nat st S4[n] by A89, A105; consider m being Nat such that A108: ( S4[m] & ( for n being Nat st S4[n] holds m <= n ) ) from NAT_1:sch_5(A107); reconsider m = m as odd Element of NAT by A108, ORDINAL1:def_12; ( 1 <= m & m <> 1 ) by A88, A105, A108, ABIAN:12, XBOOLE_0:def_5; then 1 < m by XXREAL_0:1; then 1 + 1 <= m by NAT_1:13; then reconsider m2k = m - (2 * 1) as odd Element of NAT by INT_1:5; A109: m2k < m - 0 by XREAL_1:15; then A110: m2k < len P by A108, XXREAL_0:2; A111: now__::_thesis:_P_._m2k_in_((PRIM:CompSeq_G1)_._k1o)_`1 assume A112: not P . m2k in ((PRIM:CompSeq G1) . k1o) `1 ; ::_thesis: contradiction P . m2k in the_Vertices_of G1 by A71, A110, GLIB_001:7; then P . m2k in (the_Vertices_of G1) \ (((PRIM:CompSeq G1) . k1o) `1) by A112, XBOOLE_0:def_5; hence contradiction by A108, A109, A110; ::_thesis: verum end; set em = P . (m2k + 1); A113: P . (m2k + 1) in P .edges() by A110, GLIB_001:100; then consider i being even Element of NAT such that A114: 1 <= i and A115: i <= len P and A116: P . i = P . (m2k + 1) by GLIB_001:99; i in dom P by A114, A115, FINSEQ_3:25; then A117: (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) . i = P . (m2k + 1) by A82, A116, GLIB_001:65; take em = P . (m2k + 1); ::_thesis: ( em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() & em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M ) (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() = (P .edges()) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A82, GLIB_001:111; hence em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() by A113, XBOOLE_0:def_3; ::_thesis: ( em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) & em SJoins V,(the_Vertices_of M) \ V,M ) A118: (len P) + 1 <= (len P) + 2 by XREAL_1:7; (len P) + 0 < (len P) + 1 by XREAL_1:8; then i < (len P) + 1 by A115, XXREAL_0:2; hence em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by A85, A114, A117, A106, A118, GLIB_001:138; ::_thesis: em SJoins V,(the_Vertices_of M) \ V,M m2k + 2 = m ; then em Joins the Path of W . m2k, the Path of W . m,M by A110, GLIB_001:def_3; hence em SJoins V,(the_Vertices_of M) \ V,M by A71, A108, A111, GLIB_000:17; ::_thesis: verum end; end; end; then consider em being set such that A119: em in (P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) .edges() and A120: em <> choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) and A121: em SJoins V,(the_Vertices_of M) \ V,M ; set M2 = the [Weighted] weight-inheriting removeEdge of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))},em; reconsider M2 = the [Weighted] weight-inheriting removeEdge of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))},em as WSubgraph of G1 by GLIB_003:9; A122: M2 .order() = card (the_Vertices_of G1) by A62, GLIB_000:53 .= M .order() by GLIB_000:def_33 ; A123: em SJoins V,(the_Vertices_of G1) \ V,G1 by A71, A121, GLIB_000:72; then A124: (the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) <= (the_Weight_of G1) . em by A55, Def13; set M29 = M2 | WGraphSelectors; A125: M2 | WGraphSelectors == M2 by Lm4; A126: the_Edges_of M2 = ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) \ {em} by A72, GLIB_000:51; then A127: the_Edges_of (M2 | WGraphSelectors) = ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) \ {em} by A125, GLIB_000:def_34; {em} c= (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A72, A119, ZFMISC_1:31; then M2 .size() = (card ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})) - (card {em}) by A126, CARD_2:44 .= (card ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})) - 1 by CARD_1:30 .= ((card (the_Edges_of M)) + 1) - 1 by A59, CARD_2:41 .= M .size() ; then A128: M2 .order() = (M2 .size()) + 1 by A122, GLIB_002:46; A129: the_Weight_of (M2 | WGraphSelectors) = the_Weight_of M2 by Lm4; then reconsider M29 = M2 | WGraphSelectors as WSubgraph of G1 by A125, GLIB_003:8; A130: the_Vertices_of M29 = the_Vertices_of M2 by A125, GLIB_000:def_34 .= the_Vertices_of G1 by A62, GLIB_000:53 ; not P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is trivial by A82, GLIB_001:132; then P .addEdge (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))) is Cycle-like by A85, A86, GLIB_001:def_31; then M2 is connected by A119, A87, GLIB_002:5; then M2 is Tree-like by A128, GLIB_002:47; then M29 is Tree-like by Lm4, GLIB_002:48; then reconsider M29 = M29 as spanning Tree-like WSubgraph of G1 by A130, GLIB_000:def_33; (M2 .cost()) + ((the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . em) = the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} .cost() by A119, Th10; then M2 .cost() = ( the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} .cost()) - ((the_Weight_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) . em) ; then M2 .cost() = ((M .cost()) + ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))))) - ((the_Weight_of G1) . em) by A119, A63, A70, FUNCT_1:49; then M29 .cost() = ((M .cost()) + ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))))) - ((the_Weight_of G1) . em) by A125, A129, GLIB_000:def_34; then A131: ((M29 .cost()) + ((the_Weight_of G1) . em)) - ((the_Weight_of G1) . em) <= ((M .cost()) + ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o))))) - ((the_Weight_of G1) . (choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))) by A124, XREAL_1:13; now__::_thesis:_for_G3_being_spanning_Tree-like_WSubgraph_of_G1_holds_M29_.cost()_<=_G3_.cost() let G3 be spanning Tree-like WSubgraph of G1; ::_thesis: M29 .cost() <= G3 .cost() M .cost() <= G3 .cost() by Def19; hence M29 .cost() <= G3 .cost() by A131, XXREAL_0:2; ::_thesis: verum end; then reconsider M29 = M29 as minimumSpanningTree of G1 by Def19; set MG29 = (the_Edges_of M29) /\ (the_Edges_of G2); A132: (the_Edges_of M29) /\ (the_Edges_of G2) = (((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2)) \ ({em} /\ (the_Edges_of G2)) by A127, XBOOLE_1:50; dom M29 = WGraphSelectors by Lm5; then M29 in G1 .allWSubgraphs() by Def5; then A133: M29 in X ; A134: now__::_thesis:_(_not_((PRIM:CompSeq_G1)_._(k1o_+_1))_`2_c=_the_Edges_of_M_&_(_for_n_being_Nat_st_n_<=_k1o_holds_ ((PRIM:CompSeq_G1)_._n)_`2_c=_the_Edges_of_M_)_) thus not ((PRIM:CompSeq G1) . (k1o + 1)) `2 c= the_Edges_of M by A50, A52; ::_thesis: for n being Nat st n <= k1o holds ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M let n be Nat; ::_thesis: ( n <= k1o implies ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M ) assume n <= k1o ; ::_thesis: ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M then ((PRIM:CompSeq G1) . n) `2 c= ((PRIM:CompSeq G1) . k1o) `2 by Th34; hence ((PRIM:CompSeq G1) . n) `2 c= the_Edges_of M by A53, XBOOLE_1:1; ::_thesis: verum end; A135: now__::_thesis:_not_em_in_the_Edges_of_G2 consider k2 being Nat such that A136: S1[M29,k2] by A8, A133; A137: now__::_thesis:_not_em_in_((PRIM:CompSeq_G1)_._k1o)_`2 set Vr = (the_Vertices_of G1) \ V; assume A138: em in ((PRIM:CompSeq G1) . k1o) `2 ; ::_thesis: contradiction A139: ((PRIM:CompSeq G1) . k1o) `2 c= G1 .edgesBetween (((PRIM:CompSeq G1) . k1o) `1) by Th30; then (the_Target_of G1) . em in ((PRIM:CompSeq G1) . k1o) `1 by A138, GLIB_000:31; then A140: not (the_Target_of G1) . em in (the_Vertices_of G1) \ V by XBOOLE_0:def_5; (the_Source_of G1) . em in ((PRIM:CompSeq G1) . k1o) `1 by A138, A139, GLIB_000:31; then not (the_Source_of G1) . em in (the_Vertices_of G1) \ V by XBOOLE_0:def_5; hence contradiction by A123, A140, GLIB_000:def_15; ::_thesis: verum end; now__::_thesis:_for_x_being_set_st_x_in_((PRIM:CompSeq_G1)_._k)_`2_holds_ x_in_the_Edges_of_M29 let x be set ; ::_thesis: ( x in ((PRIM:CompSeq G1) . k) `2 implies x in the_Edges_of M29 ) assume A141: x in ((PRIM:CompSeq G1) . k) `2 ; ::_thesis: x in the_Edges_of M29 now__::_thesis:_x_in_the_Edges_of_M29 percases ( x in ((PRIM:CompSeq G1) . k1o) `2 or x in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} ) by A57, A141, XBOOLE_0:def_3; suppose x in ((PRIM:CompSeq G1) . k1o) `2 ; ::_thesis: x in the_Edges_of M29 then ( x in (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} & not x in {em} ) by A53, A137, TARSKI:def_1, XBOOLE_0:def_3; hence x in the_Edges_of M29 by A127, XBOOLE_0:def_5; ::_thesis: verum end; supposeA142: x in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} ; ::_thesis: x in the_Edges_of M29 then x = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by TARSKI:def_1; then A143: not x in {em} by A120, TARSKI:def_1; x in (the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A142, XBOOLE_0:def_3; hence x in the_Edges_of M29 by A127, A143, XBOOLE_0:def_5; ::_thesis: verum end; end; end; hence x in the_Edges_of M29 ; ::_thesis: verum end; then A144: ((PRIM:CompSeq G1) . k) `2 c= the_Edges_of M29 by TARSKI:def_3; A145: now__::_thesis:_not_k2_<_k assume k2 < k ; ::_thesis: contradiction then k2 + 1 <= k by NAT_1:13; then ((PRIM:CompSeq G1) . (k2 + 1)) `2 c= ((PRIM:CompSeq G1) . k) `2 by Th34; hence contradiction by A136, A144, XBOOLE_1:1; ::_thesis: verum end; assume A146: em in the_Edges_of G2 ; ::_thesis: contradiction now__::_thesis:_for_x_being_set_st_x_in_{em}_holds_ x_in_((the_Edges_of_M)_\/_{(choose_(PRIM:NextBestEdges_((PRIM:CompSeq_G1)_._k1o)))})_/\_(the_Edges_of_G2) let x be set ; ::_thesis: ( x in {em} implies x in ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2) ) assume x in {em} ; ::_thesis: x in ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2) then x = em by TARSKI:def_1; hence x in ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2) by A72, A119, A146, XBOOLE_0:def_4; ::_thesis: verum end; then A147: {em} c= ((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2) by TARSKI:def_3; (the_Edges_of M29) /\ (the_Edges_of G2) = (((the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2)) \ {em} by A132, A146, ZFMISC_1:46; then card ((the_Edges_of M29) /\ (the_Edges_of G2)) = (card ((the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2))) - (card {em}) by A72, A147, CARD_2:44 .= (card ((the_Edges_of the inducedWSubgraph of G1, the_Vertices_of G1,(the_Edges_of M) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) /\ (the_Edges_of G2))) - 1 by CARD_1:30 .= (card (((the_Edges_of M) /\ (the_Edges_of G2)) \/ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})) - 1 by A72, A66, XBOOLE_1:23 .= ((card ((the_Edges_of M) /\ (the_Edges_of G2))) + (card {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))})) - 1 by A69, CARD_2:40 .= ((card ((the_Edges_of M) /\ (the_Edges_of G2))) + 1) - 1 by CARD_1:30 .= card ((the_Edges_of M) /\ (the_Edges_of G2)) ; then A148: k1o >= k2 by A44, A133, A134, A136; (k1o + 1) - 1 < k - 0 by A52, XREAL_1:15; hence contradiction by A145, A148, XXREAL_0:2; ::_thesis: verum end; now__::_thesis:_not_{em}_/\_(the_Edges_of_G2)_<>_{} assume {em} /\ (the_Edges_of G2) <> {} ; ::_thesis: contradiction then consider x being set such that A149: x in {em} /\ (the_Edges_of G2) by XBOOLE_0:def_1; ( x in {em} & x in the_Edges_of G2 ) by A149, XBOOLE_0:def_4; hence contradiction by A135, TARSKI:def_1; ::_thesis: verum end; then A150: (the_Edges_of M29) /\ (the_Edges_of G2) = ((the_Edges_of M) /\ (the_Edges_of G2)) \/ ({(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} /\ (the_Edges_of G2)) by A132, XBOOLE_1:23; now__::_thesis:_not_((the_Edges_of_M)_/\_(the_Edges_of_G2))_/\_{(choose_(PRIM:NextBestEdges_((PRIM:CompSeq_G1)_._k1o)))}_<>_{} assume ((the_Edges_of M) /\ (the_Edges_of G2)) /\ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} <> {} ; ::_thesis: contradiction then consider x being set such that A151: x in ((the_Edges_of M) /\ (the_Edges_of G2)) /\ {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by XBOOLE_0:def_1; x in {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by A151, XBOOLE_0:def_4; then A152: x = choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)) by TARSKI:def_1; x in (the_Edges_of M) /\ (the_Edges_of G2) by A151, XBOOLE_0:def_4; then x in the_Edges_of M by XBOOLE_0:def_4; hence contradiction by A58, A152, ZFMISC_1:31; ::_thesis: verum end; then (the_Edges_of M) /\ (the_Edges_of G2) misses {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))} by XBOOLE_0:def_7; then card ((the_Edges_of M29) /\ (the_Edges_of G2)) = (card ((the_Edges_of M) /\ (the_Edges_of G2))) + (card {(choose (PRIM:NextBestEdges ((PRIM:CompSeq G1) . k1o)))}) by A66, A150, CARD_2:40 .= (card ((the_Edges_of M) /\ (the_Edges_of G2))) + 1 by CARD_1:30 ; then (card ((the_Edges_of M) /\ (the_Edges_of G2))) + 0 >= (card ((the_Edges_of M) /\ (the_Edges_of G2))) + 1 by A44, A133; hence contradiction by XREAL_1:6; ::_thesis: verum end; hence G2 is minimumSpanningTree of G1 ; ::_thesis: verum end;