reserve x,y for set;
reserve G for Graph;
reserve vs,vs9 for FinSequence of the carrier of G;
reserve IT for oriented Chain of G;
reserve N for Nat;
reserve n,m,k,i,j for Nat;
reserve r,r1,r2 for Real;
reserve X for non empty set;

theorem Th6:
  for f being FinSequence of X holds PairF(f) is oriented Chain of PGraph(X)
proof
  let f be FinSequence of X;
A1: now
    per cases;
    case
      len f>=1;
      then len f-1+1=len f-'1+1 by XREAL_1:233;
      then
A2:   len f = len PairF(f) + 1 by Def2;
A3:   for n being Nat
      st 1 <= n & n <= len f holds f.n in the carrier of PGraph(X)
      proof
        let n be Nat;
        assume 1 <= n & n <= len f;
        then n in dom f by FINSEQ_3:25;
        then f.n in rng f by FUNCT_1:def 3;
        hence thesis;
      end;
A4:   for n being Nat
st 1 <= n & n <= len PairF(f) ex x9, y9 being Element
 of PGraph(X) st x9 = f.n & y9 = f.(n+1) & (PairF(f)).n joins x9, y9
      proof
A5:     len f-'1<len f-'1+1 by NAT_1:13;
        let n be Nat;
        assume that
A6:     1 <= n and
A7:     n <= len PairF(f);
A8:     1<n+1 by A6,NAT_1:13;
A9:     len PairF(f)=len f-'1 by Def2;
        then 1<=len f-'1 by A6,A7,XXREAL_0:2;
        then len f-'1=len f-1 by NAT_D:39;
        then
A10:    n<len f by A7,A9,A5,XXREAL_0:2;
        then n+1<=len f by NAT_1:13;
        then n+1 in dom f by A8,FINSEQ_3:25;
        then
A11:    f.(n+1) in rng f by FUNCT_1:def 3;
        n in dom f by A6,A10,FINSEQ_3:25;
        then
A12:    f.n in rng f by FUNCT_1:def 3;
        then reconsider
        a=f.n,b=f.(n+1) as Element of PGraph(X ) by A11;
        (pr2(X,X)).(f.n,f.(n+1))=f.(n+1) by A12,A11,FUNCT_3:def 5;
        then
A13:    (the Target of PGraph(X)).((PairF(f)).n) = b by A6,A10,Def2;
        (pr1(X,X)).(f.n,f.(n+1))=f.n by A12,A11,FUNCT_3:def 4;
        then (the Source of PGraph(X)).((PairF(f)).n) = a by A6,A10,Def2;
        then (PairF(f)).n joins a, b by A13,GRAPH_1:def 12;
        hence thesis;
      end;
      for n being Nat
       st 1 <= n & n <= len PairF(f) holds (PairF(f)).n in the
      carrier' of PGraph(X) by Th5;
      hence PairF(f) is Chain of PGraph(X) by A2,A3,A4,GRAPH_1:def 14;
    end;
    case
      len f<1;
      then len f+1<=1 by NAT_1:13;
      then len f+1-1<=1-1 by XREAL_1:9;
      then
A14:  len f=0;
      0 qua Nat-1<0;
      then len f-'1=0 by A14,XREAL_0:def 2;
      then len PairF(f)=0 by Def2;
      then PairF(f)= {};
      hence thesis by GRAPH_1:14;
    end;
  end;
  for n being Nat
   st 1 <= n & n < len PairF(f) holds (the Source of PGraph(X)).((
  PairF(f)).(n+1)) = (the Target of PGraph(X)).((PairF(f)).n)
  proof
A15: len f-'1<len f-'1+1 by NAT_1:13;
    let n be Nat;
    assume that
A16: 1 <= n and
A17: n < len PairF(f);
A18: len PairF(f)=len f-'1 by Def2;
    then 1<=len f-'1 by A16,A17,XXREAL_0:2;
    then
A19: len f-'1=len f-1 by NAT_D:39;
    then
A20: n<len f by A17,A18,A15,XXREAL_0:2;
    then n in dom f by A16,FINSEQ_3:25;
    then
A21: f.n in rng f by FUNCT_1:def 3;
    n+1<=len PairF(f) by A17,NAT_1:13;
    then
A22: n+1<len f by A18,A19,A15,XXREAL_0:2;
    then
A23: n+1+1<=len f by NAT_1:13;
A24: 1<n+1 by A16,NAT_1:13;
    then 1<n+1+1 by NAT_1:13;
    then n+1+1 in dom f by A23,FINSEQ_3:25;
    then
A25: f.(n+1+1) in rng f by FUNCT_1:def 3;
    n+1<=len f by A20,NAT_1:13;
    then n+1 in dom f by A24,FINSEQ_3:25;
    then
A26: f.(n+1) in rng f by FUNCT_1:def 3;
    then reconsider
    b=f.(n+1) as Element of PGraph(X);
    (pr2(X,X)).(f.n,f.(n+1))=f.(n+1) by A21,A26,FUNCT_3:def 5;
    then
A27: (the Target of PGraph(X)).((PairF(f)).n) = b by A16,A20,Def2;
    n+1 in dom f by A22,A24,FINSEQ_3:25;
    then f.(n+1) in rng f by FUNCT_1:def 3;
    then (pr1(X,X)).(f.(n+1),f.((n+1)+1))=f.(n+1) by A25,FUNCT_3:def 4;
    hence thesis by A22,A24,A27,Def2;
  end;
  hence thesis by A1,GRAPH_1:def 15;
end;
