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;
reserve sc for simple Chain of G;

theorem
  vs is_vertex_seq_of sc implies for n, m st 1<=n & n<m & m<=len vs & vs
  .n = vs.m holds n=1 & m=len vs
proof
  assume
A1: vs is_vertex_seq_of sc;
  consider vs1 such that
A2: vs1 is_vertex_seq_of sc and
A3: for n,m st 1<=n & n<m & m<=len vs1 & vs1.n=vs1.m holds n=1 & m=len
  vs1 by Def9;
  per cases;
  suppose
A4: len sc <= 2;
    thus thesis
    proof
      len sc = 0 or ... or len sc = 2 by A4;
      then per cases;
      suppose
A5:     len sc = 0;
        let n,m;
        len vs = 0+1 by A1,A5;
        hence thesis by XXREAL_0:2;
      end;
      suppose
        len sc = 1;
        then
A6:     len vs = 1+1 by A1;
        let n,m;
        assume that
A7:     1<=n and
A8:     n<m and
A9:     m<=len vs and
        vs.n=vs.m;
A10:    n+1<=m by A8,NAT_1:13;
        then n+1<=1+1 by A6,A9,XXREAL_0:2;
        then n<=1 by XREAL_1:6;
        then n=1 by A7,XXREAL_0:1;
        hence thesis by A6,A9,A10,XXREAL_0:1;
      end;
      suppose
A11:    len sc = 2;
        set v12=vs1/.(1+1);
        set v2=vs/.(1+1);
        set v11=vs1/.1;
A12:    sc.1 joins v11,v12 by A2,A11;
        set v1=vs/.1;
        sc.1 joins v1, v2 by A1,A11;
        then
A13:    v1=v11 & v2=v12 or v1=v12 & v2=v11 by A12;
A14:    len vs = 1+1+1 by A1,A11;
        then
A15:    v2=vs.(1+1) by FINSEQ_4:15;
        set v3=vs/.(1+1+1);
        set v13=vs1/.(1+1+1);
A16:    sc.2 joins v12,v13 by A2,A11;
        sc.2 joins v2, v3 by A1,A11;
        then
A17:    v2=v12 & v3=v13 or v2=v13 & v3=v12 by A16;
A18:    len vs1 = 1+1+1 by A2,A11;
        then
A19:    v11=vs1.1 by FINSEQ_4:15;
A20:    v13=vs1.(1+1+1) by A18,FINSEQ_4:15;
A21:    v12=vs1.(1+1) by A18,FINSEQ_4:15;
        let n,m;
        assume that
A22:    1<=n and
A23:    n<m and
A24:    m<=len vs and
A25:    vs.n=vs.m;
        n+1<=m by A23,NAT_1:13;
        then n+1<=1+1+1 by A14,A24,XXREAL_0:2;
        then
A26:    n<=1+1 by XREAL_1:6;
A27:    v3=vs.(1+1+1) by A14,FINSEQ_4:15;
A28:    v1=vs.1 by A14,FINSEQ_4:15;
        thus thesis
        proof
          per cases by A22,A26,NAT_1:9;
          suppose
A29:        n=1;
            1<m by A22,A23,XXREAL_0:2;
            then
A30:        1+1<=m by NAT_1:13;
            thus thesis
            proof
              per cases by A14,A24,A30,NAT_1:9;
              suppose
                m=1+1;
                hence thesis by A3,A18,A28,A15,A19,A21,A13,A25,A29;
              end;
              suppose
                m=1+1+1;
                hence thesis by A1,A11,A29;
              end;
            end;
          end;
          suppose
A31:        n=1+1;
            then 1+1+1<=m by A23,NAT_1:13;
            then m=1+1+1 by A14,A24,XXREAL_0:1;
            hence thesis by A3,A18,A15,A27,A21,A20,A17,A25,A31;
          end;
        end;
      end;
    end;
  end;
  suppose
    2<len sc;
    then vs=vs1 by A1,A2,Th46;
    hence thesis by A3;
  end;
end;
