let G be _finite natural-weighted WGraph; :: thesis: for EL being FF:ELabeling of G
for source, sink being set
for P being Path of G st source <> sink & P is_Walk_from source,sink & P is_augmenting_wrt EL holds
(EL .flow (source,sink)) + (P .tolerance EL) = (FF:PushFlow (EL,P)) .flow (source,sink)

let EL be FF:ELabeling of G; :: thesis: for source, sink being set
for P being Path of G st source <> sink & P is_Walk_from source,sink & P is_augmenting_wrt EL holds
(EL .flow (source,sink)) + (P .tolerance EL) = (FF:PushFlow (EL,P)) .flow (source,sink)

let source, sink be set ; :: thesis: for P being Path of G st source <> sink & P is_Walk_from source,sink & P is_augmenting_wrt EL holds
(EL .flow (source,sink)) + (P .tolerance EL) = (FF:PushFlow (EL,P)) .flow (source,sink)

let P be Path of G; :: thesis: ( source <> sink & P is_Walk_from source,sink & P is_augmenting_wrt EL implies (EL .flow (source,sink)) + (P .tolerance EL) = (FF:PushFlow (EL,P)) .flow (source,sink) )
assume that
A1: source <> sink and
A2: P is_Walk_from source,sink and
A3: P is_augmenting_wrt EL ; :: thesis: (EL .flow (source,sink)) + (P .tolerance EL) = (FF:PushFlow (EL,P)) .flow (source,sink)
A4: P .last() = sink by A2, GLIB_001:def 23;
P .first() = source by A2, GLIB_001:def 23;
then P is trivial by A1, A4, GLIB_001:127;
then 3 <= len P by GLIB_001:125;
then reconsider lenP2g = (len P) - (2 * 1) as odd Element of NAT by INT_1:5, XXREAL_0:2;
set e1 = P . (lenP2g + 1);
set EI1 = EL | (G .edgesInto {sink});
set EO1 = EL | (G .edgesOutOf {sink});
set EL2 = FF:PushFlow (EL,P);
set T = P .tolerance EL;
A5: P . (len P) = sink by A2, GLIB_001:17;
A6: lenP2g < (len P) - 0 by XREAL_1:15;
then A7: P . (lenP2g + 1) Joins P . lenP2g,P . (lenP2g + 2),G by GLIB_001:def 3;
then A8: P . (lenP2g + 1) in the_Edges_of G ;
now :: thesis: (FF:PushFlow (EL,P)) .flow (source,sink) = (EL .flow (source,sink)) + (P .tolerance EL)
per cases ( P . (lenP2g + 1) DJoins P . lenP2g,P . (lenP2g + 2),G or not P . (lenP2g + 1) DJoins P . lenP2g,P . (lenP2g + 2),G ) ;
suppose A9: P . (lenP2g + 1) DJoins P . lenP2g,P . (lenP2g + 2),G ; :: thesis: (FF:PushFlow (EL,P)) .flow (source,sink) = (EL .flow (source,sink)) + (P .tolerance EL)
then (the_Target_of G) . (P . (lenP2g + 1)) = P . (lenP2g + 2)
.= sink by A2, GLIB_001:17 ;
then (the_Target_of G) . (P . (lenP2g + 1)) in {sink} by TARSKI:def 1;
then A10: P . (lenP2g + 1) in G .edgesInto {sink} by A8, GLIB_000:def 26;
set EI2 = (EL | (G .edgesInto {sink})) +* ((P . (lenP2g + 1)) .--> (((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) + (P .tolerance EL)));
A11: dom ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) = G .edgesInto {sink} by PARTFUN1:def 2;
A12: dom ((EL | (G .edgesInto {sink})) +* ((P . (lenP2g + 1)) .--> (((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) + (P .tolerance EL)))) = (dom (EL | (G .edgesInto {sink}))) \/ (dom ((P . (lenP2g + 1)) .--> (((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) + (P .tolerance EL)))) by FUNCT_4:def 1
.= (dom (EL | (G .edgesInto {sink}))) \/ {(P . (lenP2g + 1))}
.= (G .edgesInto {sink}) \/ {(P . (lenP2g + 1))} by PARTFUN1:def 2
.= G .edgesInto {sink} by A10, ZFMISC_1:40 ;
then reconsider EI2 = (EL | (G .edgesInto {sink})) +* ((P . (lenP2g + 1)) .--> (((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) + (P .tolerance EL))) as Rbag of G .edgesInto {sink} by PARTFUN1:def 2, RELAT_1:def 18;
A13: (FF:PushFlow (EL,P)) . (P . (lenP2g + 1)) = (EL . (P . (lenP2g + 1))) + (P .tolerance EL) by A3, A6, A9, Def17;
now :: thesis: for e being object st e in dom ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) holds
((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e
let e be object ; :: thesis: ( e in dom ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) implies ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e )
assume A14: e in dom ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) ; :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e
then A15: e in G .edgesInto {sink} ;
A16: ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = (FF:PushFlow (EL,P)) . e by A14, FUNCT_1:49;
(the_Target_of G) . e in {sink} by A15, GLIB_000:def 26;
then A17: (the_Target_of G) . e = sink by TARSKI:def 1;
now :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e
per cases ( e = P . (lenP2g + 1) or e <> P . (lenP2g + 1) ) ;
suppose A18: e = P . (lenP2g + 1) ; :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e
then e in {(P . (lenP2g + 1))} by TARSKI:def 1;
then e in dom ((P . (lenP2g + 1)) .--> (((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) + (P .tolerance EL))) ;
then EI2 . e = ((P . (lenP2g + 1)) .--> (((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) + (P .tolerance EL))) . (P . (lenP2g + 1)) by A18, FUNCT_4:13
.= ((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) + (P .tolerance EL) by FUNCOP_1:72
.= (FF:PushFlow (EL,P)) . (P . (lenP2g + 1)) by A13, A15, A18, FUNCT_1:49 ;
hence ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e by A14, A18, FUNCT_1:49; :: thesis: verum
end;
suppose A19: e <> P . (lenP2g + 1) ; :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e
A20: now :: thesis: not e in P .edges()
assume e in P .edges() ; :: thesis: contradiction
then consider v1, v2 being Vertex of G, m being odd Element of NAT such that
A21: m + 2 <= len P and
A22: v1 = P . m and
A23: e = P . (m + 1) and
A24: v2 = P . (m + 2) and
A25: e Joins v1,v2,G by GLIB_001:103;
now :: thesis: contradictionend;
hence contradiction ; :: thesis: verum
end;
not e in {(P . (lenP2g + 1))} by A19, TARSKI:def 1;
then not e in dom ((P . (lenP2g + 1)) .--> (((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) + (P .tolerance EL))) ;
then EI2 . e = (EL | (G .edgesInto {sink})) . e by FUNCT_4:11
.= EL . e by A15, FUNCT_1:49 ;
hence ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e by A3, A15, A16, A20, Def17; :: thesis: verum
end;
end;
end;
hence ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = EI2 . e ; :: thesis: verum
end;
then A29: Sum ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) = ((Sum (EL | (G .edgesInto {sink}))) + ((P .tolerance EL) + ((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))))) - ((EL | (G .edgesInto {sink})) . (P . (lenP2g + 1))) by A12, A11, FUNCT_1:2, GLIB_004:9
.= (Sum (EL | (G .edgesInto {sink}))) + (P .tolerance EL) ;
A30: dom ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) = G .edgesOutOf {sink} by PARTFUN1:def 2;
A31: now :: thesis: for e being object st e in dom ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) holds
((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = (EL | (G .edgesOutOf {sink})) . e
let e be object ; :: thesis: ( e in dom ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) implies ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = (EL | (G .edgesOutOf {sink})) . e )
assume A32: e in dom ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) ; :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = (EL | (G .edgesOutOf {sink})) . e
then A33: e in G .edgesOutOf {sink} ;
then (the_Source_of G) . e in {sink} by GLIB_000:def 27;
then A34: (the_Source_of G) . e = sink by TARSKI:def 1;
now :: thesis: not e in P .edges()
assume e in P .edges() ; :: thesis: contradiction
then consider v1, v2 being Vertex of G, m being odd Element of NAT such that
A35: m + 2 <= len P and
A36: v1 = P . m and
A37: e = P . (m + 1) and
A38: v2 = P . (m + 2) and
A39: e Joins v1,v2,G by GLIB_001:103;
now :: thesis: contradictionend;
hence contradiction ; :: thesis: verum
end;
then (FF:PushFlow (EL,P)) . e = EL . e by A3, A33, Def17
.= (EL | (G .edgesOutOf {sink})) . e by A33, FUNCT_1:49 ;
hence ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = (EL | (G .edgesOutOf {sink})) . e by A32, FUNCT_1:49; :: thesis: verum
end;
dom (EL | (G .edgesOutOf {sink})) = G .edgesOutOf {sink} by PARTFUN1:def 2;
hence (FF:PushFlow (EL,P)) .flow (source,sink) = ((Sum (EL | (G .edgesInto {sink}))) + (P .tolerance EL)) - (Sum (EL | (G .edgesOutOf {sink}))) by A29, A30, A31, FUNCT_1:2
.= ((Sum (EL | (G .edgesInto {sink}))) - (Sum (EL | (G .edgesOutOf {sink})))) + (P .tolerance EL)
.= (EL .flow (source,sink)) + (P .tolerance EL) ;
:: thesis: verum
end;
suppose A44: not P . (lenP2g + 1) DJoins P . lenP2g,P . (lenP2g + 2),G ; :: thesis: (FF:PushFlow (EL,P)) .flow (source,sink) = (EL .flow (source,sink)) + (P .tolerance EL)
then A45: P . (lenP2g + 1) DJoins P . (lenP2g + 2),P . lenP2g,G by A7;
then (the_Source_of G) . (P . (lenP2g + 1)) = P . (lenP2g + 2)
.= sink by A2, GLIB_001:17 ;
then (the_Source_of G) . (P . (lenP2g + 1)) in {sink} by TARSKI:def 1;
then A46: P . (lenP2g + 1) in G .edgesOutOf {sink} by A8, GLIB_000:def 27;
set EO2 = (EL | (G .edgesOutOf {sink})) +* ((P . (lenP2g + 1)) .--> (((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL)));
A47: dom ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) = G .edgesOutOf {sink} by PARTFUN1:def 2;
A48: dom ((EL | (G .edgesOutOf {sink})) +* ((P . (lenP2g + 1)) .--> (((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL)))) = (dom (EL | (G .edgesOutOf {sink}))) \/ (dom ((P . (lenP2g + 1)) .--> (((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL)))) by FUNCT_4:def 1
.= (dom (EL | (G .edgesOutOf {sink}))) \/ {(P . (lenP2g + 1))}
.= (G .edgesOutOf {sink}) \/ {(P . (lenP2g + 1))} by PARTFUN1:def 2
.= G .edgesOutOf {sink} by A46, ZFMISC_1:40 ;
then reconsider EO2 = (EL | (G .edgesOutOf {sink})) +* ((P . (lenP2g + 1)) .--> (((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL))) as Rbag of G .edgesOutOf {sink} by PARTFUN1:def 2, RELAT_1:def 18;
A49: (FF:PushFlow (EL,P)) . (P . (lenP2g + 1)) = (EL . (P . (lenP2g + 1))) - (P .tolerance EL) by A3, A6, A44, Def17;
now :: thesis: for e being object st e in dom ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) holds
((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e
let e be object ; :: thesis: ( e in dom ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) implies ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e )
assume A50: e in dom ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) ; :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e
then A51: e in G .edgesOutOf {sink} ;
A52: ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = (FF:PushFlow (EL,P)) . e by A50, FUNCT_1:49;
(the_Source_of G) . e in {sink} by A51, GLIB_000:def 27;
then A53: (the_Source_of G) . e = sink by TARSKI:def 1;
now :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e
per cases ( e = P . (lenP2g + 1) or e <> P . (lenP2g + 1) ) ;
suppose A54: e = P . (lenP2g + 1) ; :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e
then e in {(P . (lenP2g + 1))} by TARSKI:def 1;
then e in dom ((P . (lenP2g + 1)) .--> (((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL))) ;
then EO2 . e = ((P . (lenP2g + 1)) .--> (((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL))) . (P . (lenP2g + 1)) by A54, FUNCT_4:13
.= ((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL) by FUNCOP_1:72
.= (FF:PushFlow (EL,P)) . e by A49, A51, A54, FUNCT_1:49 ;
hence ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e by A50, FUNCT_1:49; :: thesis: verum
end;
suppose A55: e <> P . (lenP2g + 1) ; :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e
A56: now :: thesis: not e in P .edges()
assume e in P .edges() ; :: thesis: contradiction
then consider v1, v2 being Vertex of G, m being odd Element of NAT such that
A57: m + 2 <= len P and
A58: v1 = P . m and
A59: e = P . (m + 1) and
A60: v2 = P . (m + 2) and
A61: e Joins v1,v2,G by GLIB_001:103;
now :: thesis: contradiction
per cases ( v1 = sink or v2 = sink ) by A53, A61;
end;
end;
hence contradiction ; :: thesis: verum
end;
not e in {(P . (lenP2g + 1))} by A55, TARSKI:def 1;
then not e in dom ((P . (lenP2g + 1)) .--> (((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL))) ;
then EO2 . e = (EL | (G .edgesOutOf {sink})) . e by FUNCT_4:11
.= EL . e by A51, FUNCT_1:49 ;
hence ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e by A3, A51, A52, A56, Def17; :: thesis: verum
end;
end;
end;
hence ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) . e = EO2 . e ; :: thesis: verum
end;
then A65: Sum ((FF:PushFlow (EL,P)) | (G .edgesOutOf {sink})) = ((Sum (EL | (G .edgesOutOf {sink}))) + (((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) - (P .tolerance EL))) - ((EL | (G .edgesOutOf {sink})) . (P . (lenP2g + 1))) by A48, A47, FUNCT_1:2, GLIB_004:9
.= (Sum (EL | (G .edgesOutOf {sink}))) - (P .tolerance EL) ;
A66: dom ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) = G .edgesInto {sink} by PARTFUN1:def 2;
A67: now :: thesis: for e being object st e in dom ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) holds
((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = (EL | (G .edgesInto {sink})) . e
let e be object ; :: thesis: ( e in dom ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) implies ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = (EL | (G .edgesInto {sink})) . e )
assume A68: e in dom ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) ; :: thesis: ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = (EL | (G .edgesInto {sink})) . e
then A69: e in G .edgesInto {sink} ;
then (the_Target_of G) . e in {sink} by GLIB_000:def 26;
then A70: (the_Target_of G) . e = sink by TARSKI:def 1;
now :: thesis: not e in P .edges()
assume e in P .edges() ; :: thesis: contradiction
then consider v1, v2 being Vertex of G, m being odd Element of NAT such that
A71: m + 2 <= len P and
A72: v1 = P . m and
A73: e = P . (m + 1) and
A74: v2 = P . (m + 2) and
A75: e Joins v1,v2,G by GLIB_001:103;
now :: thesis: contradictionend;
hence contradiction ; :: thesis: verum
end;
then (FF:PushFlow (EL,P)) . e = EL . e by A3, A69, Def17
.= (EL | (G .edgesInto {sink})) . e by A69, FUNCT_1:49 ;
hence ((FF:PushFlow (EL,P)) | (G .edgesInto {sink})) . e = (EL | (G .edgesInto {sink})) . e by A68, FUNCT_1:49; :: thesis: verum
end;
dom (EL | (G .edgesInto {sink})) = G .edgesInto {sink} by PARTFUN1:def 2;
hence (FF:PushFlow (EL,P)) .flow (source,sink) = (Sum (EL | (G .edgesInto {sink}))) - ((Sum (EL | (G .edgesOutOf {sink}))) - (P .tolerance EL)) by A65, A66, A67, FUNCT_1:2
.= ((Sum (EL | (G .edgesInto {sink}))) - (Sum (EL | (G .edgesOutOf {sink})))) + (P .tolerance EL)
.= (EL .flow (source,sink)) + (P .tolerance EL) ;
:: thesis: verum
end;
end;
end;
hence (EL .flow (source,sink)) + (P .tolerance EL) = (FF:PushFlow (EL,P)) .flow (source,sink) ; :: thesis: verum