reserve x,y,z for set;
reserve f,f1,f2,f3 for FinSequence,
  p,p1,p2,p3 for set,
  i,k for Nat;
reserve D for non empty set,
  p,p1,p2,p3 for Element of D,
  f,f1,f2 for FinSequence of D;
reserve D for non empty set;
reserve p, q for FinSequence,
  X, Y, x, y for set,
  D for non empty set,
  i, j, k, l, m, n, r for Nat;

theorem Th8:
  m<=n & n<=r & r<=len p implies
  (m+1, n)-cut p ^ (n+1, r)-cut p = (m+1, r)-cut p
proof
  assume that
A1: m<=n and
A2: n<=r and
A3: r<=len p;
  set p3 = (m+1, r)-cut p;
  set p2 = (n+1, r)-cut p;
  set p1 = (m+1, n)-cut p;
  set p12 = p1^p2;
  now
    reconsider n9=n as Integer;
    reconsider m9=m as Integer;
    thus len p12 = len p12;
A4: dom p12 = Seg len p12 by FINSEQ_1:def 3;
    reconsider nm=n9-m9 as Element of NAT by A1,INT_1:5;
A5: 1<=m+1 by NAT_1:11;
    m<=r by A1,A2,XXREAL_0:2;
    then
A6: m+1<=r+1 by XREAL_1:6;
A7: m+1<=n+1 by A1,XREAL_1:6;
A8: n+1<=r+1 by A2,XREAL_1:6;
    then m+1<=r+1 by A7,XXREAL_0:2;
    then
A9: len p3 +(m+1)=r+1 by A3,A5,Lm2;
A10: n<=len p by A2,A3,XXREAL_0:2;
    then
A11: len p1 +(m+1) = n+1 by A5,A7,Lm2;
A12: 1<=n+1 by NAT_1:11;
    then len p2 +(n+1) = r+1 by A3,A8,Lm2;
    then
A13: len p12= n-m+(r+ -n) by A11,FINSEQ_1:22
      .= r-m;
    hence len p3 = len p12 by A9;
    let i be Nat;
    assume
A14: i in dom p12;
    then
A15: 1<=i by A4,FINSEQ_1:1;
A16: i<=len p12 by A4,A14,FINSEQ_1:1;
    per cases by NAT_1:13;
    suppose
A17:  i<=nm;
      0+1=1;
      then consider k being Nat such that
      0<=k and
A18:  k<nm and
A19:  i=k+1 by A15,A17,Th1;
      nm<=r-m by A2,XREAL_1:9;
      then
A20:  k<len p3 by A9,A18,XXREAL_0:2;
      i in dom p1 by A11,A15,A17,FINSEQ_3:25;
      hence p12.i = p1.i by FINSEQ_1:def 7
        .= p.((m+1)+k) by A5,A7,A10,A11,A18,A19,Lm2
        .= p3.i by A3,A5,A6,A19,A20,Lm2;
    end;
    suppose
      nm+1<=i;
      then consider k such that
A21:  nm<=k and
A22:  k<len p12 and
A23:  i=k+1 by A16,Th1;
      reconsider k99=k as Integer;
      reconsider k9=k99-nm as Element of NAT by A21,INT_1:5;
A24:  1<=k9+1 by NAT_1:11;
      len p12 = len p2 + len p1 by FINSEQ_1:22;
      then len p2 = len p12 - len p1;
      then
A25:  k9<len p2 by A11,A22,XREAL_1:9;
      then k9+1<=len p2 by NAT_1:13;
      then
A26:  k9+1 in dom p2 by A24,FINSEQ_3:25;
A27:  n+1+k9 = m+1+k;
      i = nm+(k9+1) by A23;
      hence p12.i = p2.(k9+1) by A11,A26,FINSEQ_1:def 7
        .= p.(n+1+k9) by A3,A12,A8,A25,Lm2
        .= p3.i by A3,A5,A6,A13,A9,A22,A23,A27,Lm2;
    end;
  end;
  hence thesis by FINSEQ_2:9;
end;
