reserve p, q for FinSequence,
  X, Y, x, y, e for set,
  D for non empty set,
  i, j, k, l, m, n, r for Nat;
reserve G for Graph;
reserve v, v1, v2, v3, v4 for Element of G;
reserve vs, vs1, vs2 for FinSequence of the carrier of G,
  c, c1, c2 for Chain of G;

theorem Th44:
  vs1 is_vertex_seq_of c1 & vs2 is_vertex_seq_of c2 & vs1.len vs1
  = vs2.1 & c = c1^c2 & vs = vs1^'vs2 implies vs is_vertex_seq_of c
proof
  assume that
A1: vs1 is_vertex_seq_of c1 and
A2: vs2 is_vertex_seq_of c2 and
A3: vs1.len vs1 = vs2.1;
  set p=vs1^'vs2;
  set q=c1^c2;
  assume that
A4: c = c1^c2 and
A5: vs = vs1^'vs2;
A6: len vs1 = len c1 + 1 by A1;
A7: len vs2 = len c2 + 1 by A2;
  then vs2 <> {};
  then len p +1 = len vs1 +len vs2 by FINSEQ_6:139;
  then
A8: len p = len c1 + len c2 + 1 by A6,A7
    .= len q + 1 by FINSEQ_1:22;
  reconsider p as FinSequence of the carrier of G;
  now
    let n be Nat;
    assume that
A9: 1<=n and
A10: n<=len q;
A11: n in dom q by A9,A10,FINSEQ_3:25;
    n<=len p by A8,A10,NAT_1:12;
    then
A12: p/.n=p.n by A9,FINSEQ_4:15;
    1<=n+1 by NAT_1:12;
    then
A13: p/.(n+1)=p.(n+1) by A8,A10,FINSEQ_4:15,XREAL_1:7;
    per cases by A11,FINSEQ_1:25;
    suppose
A14:  n in dom c1;
      set v2=vs1/.(n+1);
      set v1=vs1/.n;
A15:  1<=n by A14,FINSEQ_3:25;
A16:  n<=len c1 by A14,FINSEQ_3:25;
      then
A17:  n+1<=len vs1 by A1,XREAL_1:6;
      then
A18:  vs1/.(n+1)=vs1.(n+1) by FINSEQ_4:15,NAT_1:12;
A19:  n<=len vs1 by A6,A16,NAT_1:12;
      then
A20:  vs1/.n=vs1.n by A15,FINSEQ_4:15;
A21:  p.(n+1) = vs1.(n+1) by A17,FINSEQ_6:140,NAT_1:12;
A22:  p.n = vs1.n by A15,A19,FINSEQ_6:140;
      c1.n joins v1, v2 by A1,A15,A16;
      hence q.n joins p/.n, p/.(n+1) by A12,A13,A14,A20,A18,A22,A21,
FINSEQ_1:def 7;
    end;
    suppose
      ex k being Nat st k in dom c2 & n=len c1 + k;
      then consider k being Element of NAT such that
A23:  k in dom c2 and
A24:  n = len c1 + k;
A25:  0+1<=k by A23,FINSEQ_3:25;
      set v2 = vs2/.(k+1);
      set v1 = vs2/.k;
A26:  k<=len c2 by A23,FINSEQ_3:25;
      then
A27:  k<len vs2 by A7,NAT_1:13;
A28:  1<=k by A23,FINSEQ_3:25;
      then
A29:  c2.k joins v1, v2 by A2,A26;
      k<=len vs2 by A7,A26,NAT_1:12;
      then consider j such that
      0<=j and
A30:  j<len vs2 and
A31:  k=j+1 by A25,FINSEQ_6:127;
A32:  p.n = vs2.k
      proof
        per cases by A28,XXREAL_0:1;
        suppose
A33:      1=k;
          0+1<=len vs1 by A6,NAT_1:13;
          hence thesis by A3,A6,A24,A33,FINSEQ_6:140;
        end;
        suppose
          1<k;
          then
A34:      1<=j by A31,NAT_1:13;
          thus p.n = p.(len vs1 +j) by A6,A24,A31
            .= vs2.k by A30,A31,A34,FINSEQ_6:141;
        end;
      end;
      1<=k+1 by NAT_1:12;
      then
A35:  vs2/.(k+1)=vs2.(k+1) by A7,A26,FINSEQ_4:15,XREAL_1:7;
      k<=len vs2 by A7,A26,NAT_1:12;
      then
A36:  vs2/.k=vs2.k by A28,FINSEQ_4:15;
      p.(n+1) = p.(len c1 +1+k) by A24
        .= vs2.(k+1) by A6,A28,A27,FINSEQ_6:141;
      hence q.n joins p/.n,p/.(n+1) by A12,A13,A23,A24,A36,A35,A29,A32,
FINSEQ_1:def 7;
    end;
  end;
  hence thesis by A4,A5,A8;
end;
