
theorem Th8:
  for G being real-weighted WGraph, EL being FF:ELabeling of G,
source being Vertex of G, n being Nat, v being set st v in dom (AP:CompSeq(EL,
  source).n) holds ex P being Path of G st P is_augmenting_wrt EL & P
  is_Walk_from source,v & P.vertices() c= dom (AP:CompSeq(EL,source).n)
proof
  let G be real-weighted WGraph, EL being FF:ELabeling of G, source be Vertex
  of G;
  set CS = AP:CompSeq(EL,source), G0 = CS.0;
  defpred P[Nat] means for v being set st v in dom (CS.$1) holds ex P being
Path of G st P is_augmenting_wrt EL & P is_Walk_from source,v & P.vertices() c=
  dom (CS.$1);
A1: now
    let n be Nat;
    set Gn = CS.n, Gn1 = CS.(n+1);
    set Next = AP:NextBestEdges(Gn), e = the Element of Next;
    assume
A2: P[n];
A3: Gn1 = AP:Step(Gn) by Def12;
    now
      per cases;
      suppose
        Next = {};
        then Gn1 = Gn by A3,Def10;
        hence P[n+1] by A2;
      end;
      suppose
A4:     Next <> {};
        set se = (the_Source_of G).e, te = (the_Target_of G).e;
        now
          per cases by A4,Def9;
          suppose
A5:         e is_forward_edge_wrt Gn;
            then
A6:         EL.e < (the_Weight_of G).e;
            let v be set;
            assume
A7:         v in dom Gn1;
A8:         e in the_Edges_of G by A5;
            then
A9:         e DJoins se,te,G;
A10:        se in dom Gn by A5;
            then Gn1 = Gn+*(te .--> e) by A3,A4,Def10;
            then
A11:        dom Gn1 = dom Gn \/ {te} by Lm1;
            te in {te} by TARSKI:def 1;
            then
A12:        te in dom Gn1 by A11,XBOOLE_0:def 3;
A13:        dom Gn c= dom Gn1 by A11,XBOOLE_1:7;
            then
A14:        se in dom Gn1 by A10;
            now
              per cases by A11,A7,XBOOLE_0:def 3;
              suppose
                v in dom Gn;
                then consider P being Path of G such that
A15:            P is_augmenting_wrt EL and
A16:            P is_Walk_from source,v and
A17:            P.vertices() c= dom Gn by A2;
                take P;
                thus P is_augmenting_wrt EL & P is_Walk_from source,v & P
                .vertices() c= dom Gn1 by A13,A15,A16,A17;
              end;
              suppose
                v in {te};
                then
A18:            v = te by TARSKI:def 1;
                now
                  per cases;
                  suppose
A19:                se = source;
                    set P = G.walkOf(se,e,te);
                    take P;
A20:                e Joins se,te,G by A8;
                    now
                      let n be odd Nat;
                      assume n < len P;
                      then n < 2+1 by A20,GLIB_001:14;
                      then n <= 2*1 by NAT_1:13;
                      then n < 1+1 by XXREAL_0:1;
                      then
A21:                  n <= 1 by NAT_1:13;
                      1 <= n by ABIAN:12;
                      then
A22:                  n = 1 by A21,XXREAL_0:1;
A23:                  P = <*se,e,te*> by A20,GLIB_001:def 5;
                      then
A24:                  P.n = se by A22;
A25:                  P.(n+ 2) = te by A22,A23;
A26:                  P.(n+1) = e by A22,A23;
                      hence
                      P.(n+1) DJoins P.n,P.(n+2),G implies EL.(P.(n+1)) <
                      (the_Weight_of G).(P.(n+1)) by A5;
                      assume not P.(n+1) DJoins P.n,P.(n+2),G;
                      hence 0 < EL.(P.(n+1)) by A8,A24,A26,A25;
                    end;
                    hence P is_augmenting_wrt EL;
                    thus P is_Walk_from source,v by A18,A19,A20,GLIB_001:15;
                    now
                      let x be object;
                      assume x in P.vertices();
                      then x in {se,te} by A20,GLIB_001:91;
                      hence x in dom Gn1 by A12,A14,TARSKI:def 2;
                    end;
                    hence P.vertices() c= dom Gn1;
                  end;
                  suppose
A27:                se <> source;
A28:                e Joins se,v,G by A8,A18;
                    consider P being Path of G such that
A29:                P is_augmenting_wrt EL and
A30:                P is_Walk_from source,se and
A31:                P.vertices() c= dom Gn by A2,A10;
                    set P2 = P.addEdge(e);
A32:                not v in P.vertices() by A5,A18,A31;
A33:                se = P.last() by A30,GLIB_001:def 23;
                    then P.first() <> P.last() by A27,A30,GLIB_001:def 23;
                    then P is open by GLIB_001:def 24;
                    then reconsider P2 as Path of G by A28,A33,A32,GLIB_001:151
;
                    take P2;
                    thus P2 is_augmenting_wrt EL by A6,A9,A18,A29,A33,A32,Th3;
                    thus P2 is_Walk_from source,v by A30,A28,GLIB_001:66;
                    now
                      let x be object;
                      assume x in P2.vertices();
                      then
A34:                  x in P.vertices()\/{te} by A28,A33,GLIB_001:95;
                      now
                        per cases by A34,XBOOLE_0:def 3;
                        suppose
                          x in P.vertices();
                          then x in dom Gn by A31;
                          hence x in dom Gn1 by A13;
                        end;
                        suppose
                          x in {te};
                          hence x in dom Gn1 by A11,XBOOLE_0:def 3;
                        end;
                      end;
                      hence x in dom Gn1;
                    end;
                    hence P2.vertices() c= dom Gn1;
                  end;
                end;
                hence ex P being Path of G st P is_augmenting_wrt EL & P
                is_Walk_from source,v & P.vertices() c= dom Gn1;
              end;
            end;
            hence ex P being Path of G st P is_augmenting_wrt EL & P
            is_Walk_from source,v & P.vertices() c= dom Gn1;
          end;
          suppose
A35:        e is_backward_edge_wrt Gn;
            then
A36:        0 < EL.e;
            let v be set;
            assume
A37:        v in dom Gn1;
A38:        e in the_Edges_of G by A35;
            then
A39:        e DJoins se,te,G;
A40:        not se in dom Gn by A35;
            then Gn1 = Gn+*(se .--> e) by A3,A4,Def10;
            then
A41:        dom Gn1 = dom Gn \/ {se} by Lm1;
            se in {se} by TARSKI:def 1;
            then
A42:        se in dom Gn1 by A41,XBOOLE_0:def 3;
A43:        te in dom Gn by A35;
A44:        dom Gn c= dom Gn1 by A41,XBOOLE_1:7;
            then
A45:        te in dom Gn1 by A43;
            now
              per cases by A41,A37,XBOOLE_0:def 3;
              suppose
                v in dom Gn;
                then consider P being Path of G such that
A46:            P is_augmenting_wrt EL and
A47:            P is_Walk_from source,v and
A48:            P.vertices() c= dom Gn by A2;
                take P;
                thus P is_augmenting_wrt EL & P is_Walk_from source,v & P
                .vertices() c= dom Gn1 by A44,A46,A47,A48;
              end;
              suppose
                v in {se};
                then
A49:            v = se by TARSKI:def 1;
                now
                  per cases;
                  suppose
A50:                te = source;
                    set P = G.walkOf(te,e,se);
                    take P;
A51:                e Joins te,se,G by A38;
                    now
                      let n be odd Nat;
                      assume n < len P;
                      then n < 2+1 by A51,GLIB_001:14;
                      then n <= 2*1 by NAT_1:13;
                      then n < 1+1 by XXREAL_0:1;
                      then
A52:                  n <= 1 by NAT_1:13;
                      1 <= n by ABIAN:12;
                      then
A53:                  n = 1 by A52,XXREAL_0:1;
A54:                  P = <*te,e,se*> by A51,GLIB_001:def 5;
                      then
A55:                  P.(n+1) = e by A53;
                      P.n = te by A53,A54;
                      hence
                      P.(n+1) DJoins P.n,P.(n+2),G implies EL.(P.(n+1)) <
(the_Weight_of G).(P.(n+1)) by A43,A40,A55;
                      assume not P.(n+1) DJoins P.n,P.(n+2),G;
                      thus 0 < EL.(P.(n+1)) by A35,A55;
                    end;
                    hence P is_augmenting_wrt EL;
                    thus P is_Walk_from source,v by A49,A50,A51,GLIB_001:15;
                    now
                      let x be object;
                      assume x in P.vertices();
                      then x in {se,te} by A51,GLIB_001:91;
                      hence x in dom Gn1 by A42,A45,TARSKI:def 2;
                    end;
                    hence P.vertices() c= dom Gn1;
                  end;
                  suppose
A56:                te <> source;
A57:                e Joins te,v,G by A38,A49;
                    consider P being Path of G such that
A58:                P is_augmenting_wrt EL and
A59:                P is_Walk_from source,te and
A60:                P.vertices() c= dom Gn by A2,A43;
                    set P2 = P.addEdge(e);
A61:                not v in P.vertices() by A35,A49,A60;
A62:                te = P.last() by A59,GLIB_001:def 23;
                    then P.first() <> P.last() by A56,A59,GLIB_001:def 23;
                    then P is open by GLIB_001:def 24;
                    then reconsider P2 as Path of G by A57,A62,A61,GLIB_001:151
;
                    take P2;
                    thus P2 is_augmenting_wrt EL by A36,A39,A49,A58,A62,A61,Th3
;
                    thus P2 is_Walk_from source,v by A59,A57,GLIB_001:66;
                    now
                      let x be object;
                      assume x in P2.vertices();
                      then
A63:                  x in P.vertices()\/{se} by A57,A62,GLIB_001:95;
                      now
                        per cases by A63,XBOOLE_0:def 3;
                        suppose
                          x in P.vertices();
                          then x in dom Gn by A60;
                          hence x in dom Gn1 by A44;
                        end;
                        suppose
                          x in {se};
                          hence x in dom Gn1 by A41,XBOOLE_0:def 3;
                        end;
                      end;
                      hence x in dom Gn1;
                    end;
                    hence P2.vertices() c= dom Gn1;
                  end;
                end;
                hence ex P being Path of G st P is_augmenting_wrt EL & P
                is_Walk_from source,v & P.vertices() c= dom Gn1;
              end;
            end;
            hence ex P being Path of G st P is_augmenting_wrt EL & P
            is_Walk_from source,v & P.vertices() c= dom Gn1;
          end;
        end;
        hence P[n+1];
      end;
    end;
    hence P[n+1];
  end;
  now
    let v be set;
    assume
A64: v in dom G0;
    then reconsider v9=v as Vertex of G;
    set P = G.walkOf(v9);
    take P;
    thus P is_augmenting_wrt EL by Th1;
    v in {source} by A64,Th4;
    then v = source by TARSKI:def 1;
    hence P is_Walk_from source,v by GLIB_001:13;
    P.vertices() = {v9} by GLIB_001:90;
    hence P.vertices() c= dom G0 by A64,ZFMISC_1:31;
  end;
  then
A65: P[ 0 ];
  for n being Nat holds P[n] from NAT_1:sch 2(A65,A1);
  hence thesis;
end;
