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 Th41:
  p is_orientedpath_of v1,v2 implies AcyclicPaths(p) <> {} &
  AcyclicPaths(v1,v2) <> {}
proof
  defpred P[Nat] means for p,v1,v2 st $1+1 = len p & p
  is_orientedpath_of v1,v2 holds AcyclicPaths(p) <> {};
  set FS=the Source of G, FT=the Target of G;
A1: for k st P[k] holds P[k+1]
  proof
    let k;
    assume
A2: P[k];
    now
      let p,v1,v2;
      assume that
A3:   k+1+1 = len p and
      p is_orientedpath_of v1,v2;
      consider p1,p2 being FinSequence such that
A4:   len p1 = k+1 and
A5:   len p2 = 1 and
A6:   p = p1^p2 by A3,FINSEQ_2:22;
      reconsider p1 as oriented Chain of G by A6,Th9;
A7:   1 <= len p1 by A4,NAT_1:11;
      then 1 in dom p1 by FINSEQ_3:25;
      then reconsider x=FS.(p1.1) as Element of G by FINSEQ_2:11,FUNCT_2:5;
A8:   p1.1=p.1 by A6,A7,Lm1;
      len p1 in dom p1 by A7,FINSEQ_3:25;
      then reconsider y=FT.(p1.(len p1)) as Element of G by FINSEQ_2:11
,FUNCT_2:5;
      p1 <> {} by A4;
      then p1 is_orientedpath_of x,y;
      then AcyclicPaths(p1) <> {} by A2,A4;
      then consider r being object such that
A9:   r in AcyclicPaths(p1) by XBOOLE_0:def 1;
A10:  rng p1 c= rng p by A6,FINSEQ_1:29;
A11:  rng p2 c= rng p by A6,FINSEQ_1:30;
A12:  1 in dom p2 by A5,FINSEQ_3:25;
      then
A13:  p.(len p1+1)=p2.1 by A6,FINSEQ_1:def 7;
      consider q being Simple oriented Chain of G such that
      r=q and
A14:  q <> {} and
A15:  FS.(q.1) = x and
A16:  FT.(q.(len q)) = y and
A17:  rng q c= rng p1 by A9;
      len p1 < len p by A3,A4,NAT_1:13;
      then
A18:  FS.(p.(len p1+1)) = FT.(p.(len p1)) by A7,GRAPH_1:def 15
        .=FT.(q.(len q)) by A6,A7,A16,Lm1;
      then
A19:  FS.(p2.1)=FT.(q.(len q)) by A6,A12,FINSEQ_1:def 7;
      per cases;
      suppose
        ex k st 1<=k & k <= len q & FT.(q.k)=FT.(p2.1);
        then consider k such that
A20:    1<=k and
A21:    k <= len q and
A22:    FT.(q.k)=FT.(p2.1);
        consider i being Nat such that
A23:    len q = k + i by A21,NAT_1:10;
        consider q1,q2 being FinSequence such that
A24:    len q1 = k and
        len q2 = i and
A25:    q = q1^q2 by A23,FINSEQ_2:22;
        reconsider q1 as Simple oriented Chain of G by A25,Th12;
A26:    q1 <> {} & FS.(q1.1) = FS.(p.1) by A8,A15,A20,A24,A25,Lm1;
        rng q1 c= rng q by A25,FINSEQ_1:29;
        then rng q1 c= rng p1 by A17;
        then
A27:    rng q1 c= rng p by A10;
        FT.(q1.(len q1)) = FT.(p.(len p)) by A3,A4,A13,A20,A22,A24,A25,Lm1;
        then
        q1 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 A27
,A26;
        hence AcyclicPaths(p) <> {};
      end;
      suppose
A28:    not ex k st 1<=k & k <= len q & FT.(q.k)=FT.(p2.1);
        reconsider p2 as oriented Chain of G by A6,Th9;
        hereby
          per cases;
          suppose
A29:        FS.(q.1) <> FT.(q.(len q));
            set qp=q^p2;
            rng qp = rng q \/ rng p2 & rng q c= rng p by A17,A10,FINSEQ_1:31;
            then
A30:        rng qp c= rng p \/ rng p by A11,XBOOLE_1:13;
A31:        len q >=1 by A14,FINSEQ_1:20;
            then
A32:        FS.(qp.1) = FS.(p.1) by A8,A15,Lm1;
            len qp = len q + 1 by A5,FINSEQ_1:22;
            then
A33:        qp <> {} & FT.(qp.(len qp)) = FT.(p.(len p)) by A3,A4,A5,A13,Lm2;
            qp is Simple oriented Chain of G by A5,A13,A18,A28,A29,A31,Th14;
            then qp 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
A32,A33,A30;
            hence AcyclicPaths(p) <> {};
          end;
          suppose
A34:        FS.(q.1) = FT.(q.(len q));
            reconsider p2 as Simple oriented Chain of G by A5,Th13;
            p2 <> {} & FT.(p2.(len p2)) =FT.(p.(len p)) by A3,A4,A5,A6,Lm2;
            then p2 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 A8
,A15,A11,A19,A34;
            hence AcyclicPaths(p) <> {};
          end;
        end;
      end;
    end;
    hence thesis;
  end;
A35: P[0]
  proof
    let p,v1,v2;
    assume that
A36: 0+1 = len p and
    p is_orientedpath_of v1,v2;
    reconsider r=p as Simple oriented Chain of G by A36,Th13;
    r <> {} by A36;
    then
    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};
    hence thesis;
  end;
A37: for k holds P[k] from NAT_1:sch 2(A35,A1);
  assume
A38: p is_orientedpath_of v1,v2;
  then p <> {};
  then len p >=1 by FINSEQ_1:20;
  then len p -' 1 + 1= len p by XREAL_1:235;
  hence AcyclicPaths(p) <> {} by A38,A37;
  then
A39: ex x being object st x in AcyclicPaths(p) by XBOOLE_0:def 1;
  AcyclicPaths(p) c= AcyclicPaths(v1,v2) by A38,Th38;
  hence thesis by A39;
end;
