reserve n,m,i,j,k for Nat,
  x,y,e,X,V,U for set,
  W,f,g for Function;
reserve p,q for FinSequence;
reserve G for Graph,
  pe,qe for FinSequence of the carrier' of G;
reserve v,v1,v2,v3 for Element of G;
reserve p,q for oriented Chain of G;

theorem Th42:
  p is_orientedpath_of v1,v2,V implies AcyclicPaths(p) <> {} &
  AcyclicPaths(v1,v2,V) <> {}
proof
  defpred P[Nat] means for p,v1,v2 st len p <= $1+1 & p
  is_orientedpath_of v1,v2,V holds AcyclicPaths(p) <> {};
  set FS=the Source of G, FT=the Target of G;
  assume
A1: p is_orientedpath_of v1,v2,V;
  then p is_orientedpath_of v1,v2;
  then p <> {};
  then len p >=1 by FINSEQ_1:20;
  then
A2: len p -' 1 + 1= len p by XREAL_1:235;
A3: for k st P[k] holds P[k+1]
  proof
    let k;
    assume
A4: P[k];
    now
      let p,v1,v2;
      assume that
A5:   len p <= k+1+1 and
A6:   p is_orientedpath_of v1,v2,V;
      consider vs being FinSequence of the carrier of G such that
A7:   vs is_oriented_vertex_seq_of p by GRAPH_4:9;
A8:   vertices(p) \ {v2} c= V by A6;
A9:   len vs = len p + 1 by A7,GRAPH_4:def 5;
      then
A10:  len vs >= 1 by NAT_1:12;
A11:  p is_orientedpath_of v1,v2 by A6;
      then
A12:  p <> {};
      then
A13:  len p >= 1 by FINSEQ_1:20;
      then p.(len p) orientedly_joins vs/.(len p), vs/.(len p+1) by A7,
GRAPH_4:def 5;
      then FT.(p.(len p)) = vs/.(len p+1) by GRAPH_4:def 1;
      then
A14:  FT.(p.(len p)) = vs.(len vs) by A9,A10,FINSEQ_4:15;
      per cases;
      suppose
        for n,m st 1<=n & n<m & m<=len vs & vs.n=vs.m holds n=1 & m= len vs;
        then p is Simple by A7,GRAPH_4:def 7;
        then
        p in {w where w is Simple oriented Chain of G : w <> {} & FS.(w
.1) = FS.(p.1) & FT.(w.(len w)) = FT.(p.(len p)) & rng (w) c= rng p} by A12;
        hence AcyclicPaths(p) <> {};
      end;
      suppose
        not for n,m st 1<=n & n<m & m<=len vs & vs.n=vs.m holds n=1 & m=len vs;
        then consider n,m such that
A15:    1<=n and
A16:    n<m and
A17:    m<=len vs and
A18:    vs.n=vs.m and
A19:    not (n=1 & m=len vs);
        consider i being Nat such that
A20:    m=1+i by A15,A16,NAT_1:10,XXREAL_0:2;
        reconsider i as Element of NAT by ORDINAL1:def 12;
A21:    m >= 1 by A15,A16,XXREAL_0:2;
        hereby
          per cases;
          suppose
A22:        n=1;
            then m < len vs by A17,A19,XXREAL_0:1;
            then
A23:        m <= len p by A9,NAT_1:13;
            then consider j being Nat such that
A24:        len p=m+j by NAT_1:10;
A25:        p.1 orientedly_joins vs/.1, vs/.(1+1) by A7,A13,GRAPH_4:def 5;
A26:        n <= len vs by A16,A17,XXREAL_0:2;
            p.m orientedly_joins vs/.m, vs/.(m+1) by A7,A16,A22,A23,
GRAPH_4:def 5;
            then
A27:        FS.(p.m) = vs/.m by GRAPH_4:def 1
              .=vs.m by A16,A17,A22,FINSEQ_4:15
              .=vs/.n by A15,A18,A26,FINSEQ_4:15
              .=FS.(p.1) by A22,A25,GRAPH_4:def 1
              .=v1 by A11;
            reconsider j as Element of NAT by ORDINAL1:def 12;
A28:        len p=i+(1+j) by A20,A24;
            then consider p1,p2 being FinSequence such that
A29:        len p1 = i and
A30:        len p2 = 1+j and
A31:        p = p1^p2 by FINSEQ_2:22;
A32:        1 <= len p2 by A30,NAT_1:11;
            then
A33:        p2.1=p.m by A20,A29,A31,Lm2;
            p2.(len p2)=p.(len p) by A28,A29,A30,A31,A32,Lm2;
            then
A34:        FT.(p2.(len p2))=v2 by A11;
            reconsider p1,p2 as oriented Chain of G by A31,Th9;
            i+1+-1 > 1+-1 by A16,A20,A22,XREAL_1:8;
            then len p2 < len p by A28,A30,XREAL_1:29;
            then len p2 < k+1+1 by A5,XXREAL_0:2;
            then
A35:        len p2 <= k+1 by NAT_1:13;
            vertices(p1^p2) \ {v2} c= V by A6,A31;
            then
A36:        vertices(p2) \ {v2} c= V by Th21;
            p2 <> {} by A30;
            then p2 is_orientedpath_of v1,v2 by A27,A33,A34;
            then p2 is_orientedpath_of v1,v2,V by A36;
            then AcyclicPaths(p2) <> {} by A4,A35;
            then consider r being object such that
A37:        r in AcyclicPaths(p2) by XBOOLE_0:def 1;
            consider q being Simple oriented Chain of G such that
            r=q and
A38:        q <> {} and
A39:        FS.(q.1) = v1 & FT.(q.(len q)) = v2 and
A40:        rng q c= rng p2 by A27,A33,A34,A37;
            rng p2 c= rng p by A31,FINSEQ_1:30;
            then
A41:        rng q c= rng p by A40;
            FS.(q.1) = FS.(p.1) & FT.(q.(len q)) = FT.(p.(len p)) by A11,A39;
            then q in {w where w is Simple oriented Chain of G : w <> {} &
FS.(w.1) = FS.(p.1) & FT.(w.(len w)) = FT.(p.(len p)) & rng w c= rng p} by A38
,A41;
            hence AcyclicPaths(p) <> {};
          end;
          suppose
A42:        n<>1;
            consider n1 being Nat such that
A43:        n = 1+n1 by A15,NAT_1:10;
            reconsider n1 as Element of NAT by ORDINAL1:def 12;
A44:        n < len vs by A16,A17,XXREAL_0:2;
            then
A45:        n1 < len p by A9,A43,XREAL_1:7;
            then consider j being Nat such that
A46:        len p=n1+j by NAT_1:10;
            reconsider j as Element of NAT by ORDINAL1:def 12;
            consider p1,p2 being FinSequence such that
A47:        len p1 = n1 and
            len p2 = j and
A48:        p = p1^p2 by A46,FINSEQ_2:22;
A49:        n > 1 by A15,A42,XXREAL_0:1;
            then
A50:        n1 >= 1 by A43,NAT_1:13;
            then
A51:        p1.(len p1)=p.n1 by A47,A48,Lm1;
            p1.1=p.1 by A47,A48,A50,Lm1;
            then
A52:        FS.(p1.1)=v1 by A11;
A53:        rng p1 c= rng p by A48,FINSEQ_1:29;
            reconsider p1,p2 as oriented Chain of G by A48,Th9;
            p.n1 orientedly_joins vs/.n1,vs/.(n1+1)by A7,A45,A50,GRAPH_4:def 5;
            then
A54:        FT.(p.n1) = vs/.n by A43,GRAPH_4:def 1
              .=vs.n by A15,A44,FINSEQ_4:15;
            hereby
              per cases;
              suppose
                m=len vs;
                then
A55:            FT.(p1.(len p1))=v2 by A11,A14,A18,A54,A51;
                vertices(p1^p2) \ {v2} c= V by A6,A48;
                then
A56:            vertices(p1) \ {v2} c= V by Th21;
                n1 < k+1+1 by A5,A45,XXREAL_0:2;
                then
A57:            len p1 <= k+1 by A47,NAT_1:13;
                p1 <> {} by A49,A43,A47;
                then p1 is_orientedpath_of v1,v2 by A52,A55;
                then p1 is_orientedpath_of v1,v2,V by A56;
                then AcyclicPaths(p1) <> {} by A4,A57;
                then consider r being object such that
A58:            r in AcyclicPaths(p1) by XBOOLE_0:def 1;
                consider q being Simple oriented Chain of G such that
                r=q and
A59:            q <> {} and
A60:            FS.(q.1) = v1 and
A61:            FT.(q.(len q))= v2 and
A62:            rng q c= rng p1 by A52,A55,A58;
A63:            FT.(q.(len q)) = FT.(p.(len p)) by A11,A61;
                rng q c= rng p & FS.(q.1) = FS.(p.1) by A11,A53,A60,A62;
                then q in {w where w is Simple oriented Chain of G: w <> {}
& FS.(w.1) = FS.(p.1) & FT.(w.(len w))= FT.(p.(len p)) & rng w c= rng p} by A59
,A63;
                hence AcyclicPaths(p) <> {};
              end;
              suppose
                m<>len vs;
                then m < len vs by A17,XXREAL_0:1;
                then
A64:            m <= len p by A9,NAT_1:13;
                then consider h being Nat such that
A65:            len p=m+h by NAT_1:10;
                p.m orientedly_joins vs/.m,vs/.(m+1)by A7,A21,A64,GRAPH_4:def 5
;
                then
A66:            FS.(p.m) = vs/.m by GRAPH_4:def 1
                  .=FT.(p1.len p1) by A17,A18,A21,A54,A51,FINSEQ_4:15;
                reconsider h as Element of NAT by ORDINAL1:def 12;
A67:            len p=i+(1+h) by A20,A65;
                then consider q1,q2 being FinSequence such that
A68:            len q1 = i and
A69:            len q2 = 1+h and
A70:            p = q1^q2 by FINSEQ_2:22;
                reconsider q2 as oriented Chain of G by A70,Th9;
A71:            1 <= len q2 by A69,NAT_1:12;
                then q2.1=p.m by A20,A68,A70,Lm2;
                then reconsider pq=p1^q2 as oriented Chain of G by A66,Th10;
                pq.(len pq)=pq.(len p1+len q2) by FINSEQ_1:22
                  .=q2.(len q2) by A71,Lm2
                  .=p.(len p) by A67,A68,A69,A70,A71,Lm2;
                then
A72:            FT.(pq.(len pq))=v2 by A11;
A73:            rng pq = rng p1 \/ rng q2 by FINSEQ_1:31;
                rng q2 c= rng p by A70,FINSEQ_1:30;
                then
A74:            rng pq c= rng p by A53,A73,XBOOLE_1:8;
                then
A75:            vertices(pq) \ {v2} c= V by A8,Th20;
A76:            len pq = n1 + (1+h) by A47,A69,FINSEQ_1:22;
                m+h > n+h by A16,XREAL_1:8;
                then len pq < k+1+1 by A5,A43,A65,A76,XXREAL_0:2;
                then
A77:            len pq <= k+1 by NAT_1:13;
A78:            FS.(pq.1)=v1 by A47,A50,A52,Lm1;
                pq <> {} by A76;
                then pq is_orientedpath_of v1,v2 by A78,A72;
                then pq is_orientedpath_of v1,v2,V by A75;
                then AcyclicPaths(pq) <> {} by A4,A77;
                then consider r being object such that
A79:            r in AcyclicPaths(pq) by XBOOLE_0:def 1;
                consider q being Simple oriented Chain of G such that
                r=q and
A80:            q <> {} and
A81:            FS.(q.1) = v1 & FT.(q.(len q))= v2 and
A82:            rng q c= rng pq by A78,A72,A79;
A83:            rng q c= rng p by A74,A82;
                FS.(q.1) = FS.(p.1) & FT.(q.(len q)) = FT.(p.(len p ) )
                by A11,A81;
                then q in {w where w is Simple oriented Chain of G : w <>
{} & FS.(w.1) = FS.(p.1) & FT.(w.(len w))= FT.(p.(len p)) & rng w c= rng p} by
A80,A83;
                hence AcyclicPaths(p) <> {};
              end;
            end;
          end;
        end;
      end;
    end;
    hence thesis;
  end;
A84: P[0]
  proof
    let p,v1,v2;
    assume that
A85: len p <= 0+1 and
A86: p is_orientedpath_of v1,v2,V;
    p is_orientedpath_of v1,v2 by A86;
    then
A87: p <> {};
    then len p >= 1 by FINSEQ_1:20;
    then reconsider r=p as Simple oriented Chain of G by A85,Th13,XXREAL_0:1;
    r in {q where q is Simple oriented Chain of G : q <> {} & FS.(q.1) =
    FS.(p.1) & FT.(q.(len q)) = FT.(p.(len p)) & rng q c= rng p} by A87;
    hence thesis;
  end;
  for k holds P[k] from NAT_1:sch 2(A84,A3);
  hence AcyclicPaths(p) <> {} by A1,A2;
  then
A88: ex x being object st x in AcyclicPaths(p) by XBOOLE_0:def 1;
  AcyclicPaths(p) c= AcyclicPaths(v1,v2,V) by A1,Th39;
  hence thesis by A88;
end;
