reserve i,j,k,n,m for Nat;
reserve p,q for Point of TOP-REAL 2;
reserve G for Go-board;
reserve C for Subset of TOP-REAL 2;

theorem
  for f being rectangular special_circular_sequence, g being
S-Sequence_in_R2 st g/.1 in LeftComp f & g/.len g in RightComp f holds L_Cut(g,
  Last_Point(L~g,g/.1,g/.len g,L~f)) is_in_the_area_of f
proof
  let f be rectangular special_circular_sequence, g be S-Sequence_in_R2 such
  that
A1: g/.1 in LeftComp f and
A2: g/.len g in RightComp f;
A3: L~g meets L~f by A1,A2,Th33;
  1 in dom g by FINSEQ_5:6;
  then
A4: len g >= 1 by FINSEQ_3:25;
  set lp = Last_Point(L~g,g/.1,g/.len g,L~f), ilp = Index(lp,g), h = L_Cut(g,
  lp);
  L~g is_an_arc_of g/.1,g/.len g by TOPREAL1:25;
  then
A5: lp in L~g /\ L~f by A3,JORDAN5C:def 2;
  then
A6: lp in L~g by XBOOLE_0:def 4;
  then
A7: 1 <= ilp by JORDAN3:8;
A8: lp in LSeg(g,ilp) by A6,JORDAN3:9;
A9: ilp < len g by A6,JORDAN3:8;
  then
A10: ilp+1<=len g by NAT_1:13;
  given n such that
A11: n in dom h and
A12: W-bound L~f > (h/.n)`1 or (h/.n)`1 > E-bound L~f or S-bound L~f > (
  h/.n)`2 or (h/.n)`2 > N-bound L~f;
A13: 1 <= n by A11,FINSEQ_3:25;
  then
A14: ilp+n-'1 = ilp+(n-'1) by NAT_D:38;
  LeftComp f = {p : not(W-bound L~f <= p`1 & p`1 <= E-bound L~f & S-bound
  L~f <= p`2 & p`2 <= N-bound L~f)} by Th37;
  then
A15: h/.n in LeftComp f by A12;
A16: 1<=ilp+1 by NAT_1:11;
  then
A17: ilp+1 in dom g by A10,FINSEQ_3:25;
A18: LeftComp f misses RightComp f by SPRECT_1:88;
A19: L~f misses LeftComp f by Th26;
A20: len g in dom g by FINSEQ_5:6;
A21: lp in L~f by A5,XBOOLE_0:def 4;
  now
    assume
A22: n = 1;
    per cases;
    suppose
      lp <> g.(ilp+1);
      then h = <*lp*>^mid(g,ilp+1,len g) by JORDAN3:def 3;
      then h/.n = lp by A22,FINSEQ_5:15;
      hence contradiction by A19,A21,A15,XBOOLE_0:3;
    end;
    suppose
A23:  lp = g.(ilp+1);
      then h = mid(g,ilp+1,len g) by JORDAN3:def 3;
      then h/.n = g/.(1+(ilp+1)-'1) by A20,A11,A10,A17,A22,SPRECT_2:3
        .= g/.(ilp+1) by NAT_D:34
        .= lp by A17,A23,PARTFUN1:def 6;
      hence contradiction by A19,A21,A15,XBOOLE_0:3;
    end;
  end;
  then
A24: n > 1 by A13,XXREAL_0:1;
  then
A25: 1+1 < ilp+n by A7,XREAL_1:8;
  then
A26: 1 <= ilp+n-'1 by NAT_D:49;
  set m = mid(g,ilp+n,len g);
A27: len<*lp*> = 1 by FINSEQ_1:39;
A28: n <= len h by A11,FINSEQ_3:25;
  then
A29: n+ilp <= len h + ilp by XREAL_1:6;
A30: n = n -'1 +1 by A13,XREAL_1:235;
  then
A31: 1 <= n-'1 by A24,NAT_1:13;
A32: len mid(g,ilp+1,len g)=len g-'(ilp+1)+1 by A10,A16,FINSEQ_6:186
    .= len g -' ilp by A6,JORDAN3:8,NAT_2:7;
  then
A33: ilp + len mid(g,ilp+1,len g) + 1 = len g + 1 by A9,XREAL_1:235;
  now
A34: ilp+1 <= ilp+n-'1 by A14,A31,XREAL_1:6;
    assume
A35: lp <> g.(ilp+1);
    then
A36: h = <*lp*>^mid(g,ilp+1,len g) by JORDAN3:def 3;
    then
A37: len h = 1 + len mid(g,ilp+1,len g) by A27,FINSEQ_1:22;
    then
A38: ilp+n-'1 <= len g by A33,A29,NAT_D:53;
A39: len h -' 1 = len mid(g,ilp+1,len g) by A37,NAT_D:34;
    then n-'1 <= len mid(g,ilp+1,len g) by A28,NAT_D:42;
    then
A40: n-'1 in dom mid(g,ilp+1,len g) by A31,FINSEQ_3:25;
    h/.n = (mid(g,ilp+1,len g))/.(n-'1) by A28,A30,A27,A31,A36,A39,NAT_D:42
,SEQ_4:136;
    then
A41: h/.n = g/.(n-'1+(ilp+1)-'1) by A20,A10,A17,A40,SPRECT_2:3
      .= g/.(n+ilp-'1) by A30;
    then
A42: ilp+n-'1<>len g by A2,A15,A18,XBOOLE_0:3;
    then
A43: ilp+n-'1<len g by A38,XXREAL_0:1;
    reconsider m = mid(g,ilp+n-'1,len g) as S-Sequence_in_R2 by A4,A26,A38,A42,
JORDAN3:6;
A44: ilp+n-'1 in dom g by A26,A38,FINSEQ_3:25;
    then
A45: m/.len m in RightComp f by A2,A20,SPRECT_2:9;
    m/.1 in LeftComp f by A20,A15,A41,A44,SPRECT_2:8;
    then L~f meets L~m by A45,Th33;
    then consider q being object such that
A46: q in L~f and
A47: q in L~m by XBOOLE_0:3;
    reconsider q as Point of TOP-REAL 2 by A47;
    consider i such that
A48: 1 <= i and
A49: i+1 <= len m and
A50: q in LSeg(m,i) by A47,SPPOL_2:13;
A51: len m = len g-'(ilp+n-'1)+1 by A26,A38,FINSEQ_6:186;
    then i <= len g-'(ilp+n-'1) by A49,XREAL_1:6;
    then
A52: i+(ilp+n-'1) <= len g by A38,NAT_D:54;
    i < len m by A49,NAT_1:13;
    then
A53: LSeg(m,i)=LSeg(g,i+(ilp+n-'1)-'1) by A26,A48,A51,A43,JORDAN4:19;
    set j = i+(ilp+n-'1)-'1;
    i <= i+(ilp+n-'1) by NAT_1:11;
    then
A54: j + 1 <= len g by A48,A52,XREAL_1:235,XXREAL_0:2;
    j = i-'1+(ilp+n-'1) by A48,NAT_D:38;
    then j >= ilp+n-'1 by NAT_1:11;
    then
A55: ilp +1 <= j by A34,XXREAL_0:2;
A56: lp <> g/.(ilp+1) by A17,A35,PARTFUN1:def 6;
A57: now
      assume lp = q;
      then
A58:  lp in LSeg(g,ilp) /\ LSeg(g,j) by A8,A50,A53,XBOOLE_0:def 4;
      then
A59:  LSeg(g,ilp) meets LSeg(g,j);
      per cases by A55,XXREAL_0:1;
      suppose
A60:    ilp+1 = j;
        then ilp + (1+1) <= len g by A54;
        then LSeg(g,ilp) /\ LSeg(g,ilp+1) = {g/.(ilp+1)} by A7,TOPREAL1:def 6;
        hence contradiction by A56,A58,A60,TARSKI:def 1;
      end;
      suppose
        ilp+1 < j;
        hence contradiction by A59,TOPREAL1:def 7;
      end;
    end;
    1 <= j by A16,A55,XXREAL_0:2;
    then ilp >= j by A3,A8,A10,A7,A46,A50,A53,A54,A57,JORDAN5C:28;
    then ilp >= ilp+1 by A55,XXREAL_0:2;
    hence contradiction by XREAL_1:29;
  end;
  then
A61: h = mid(g,ilp+1,len g) by JORDAN3:def 3;
  then
A62: ilp + len h = len g by A9,A32,XREAL_1:235;
  then
A63: m = g/^(ilp+n-'1) by A29,FINSEQ_6:117;
A64: 1 <= ilp+n by A25,XXREAL_0:2;
  ilp+n -' 1 + 1 = ilp+n by A25,XREAL_1:235,XXREAL_0:2;
  then ilp+n-'1 < len g by A29,A62,NAT_1:13;
  then
A65: m/.len m in RightComp f by A2,A63,FINSEQ_6:185;
A66: h/.n = g/.(n+(ilp+1)-'1) by A20,A11,A10,A17,A61,SPRECT_2:3
    .= g/.(n+ilp+1-'1)
    .= g/.(ilp+n) by NAT_D:34;
  then
A67: ilp+n <> len g by A2,A15,A18,XBOOLE_0:3;
  then reconsider m as S-Sequence_in_R2 by A4,A29,A62,A64,JORDAN3:6;
  ilp+n in dom g by A29,A62,A64,FINSEQ_3:25;
  then m/.1 in LeftComp f by A20,A15,A66,SPRECT_2:8;
  then L~f meets L~m by A65,Th33;
  then consider q being object such that
A68: q in L~f and
A69: q in L~m by XBOOLE_0:3;
  reconsider q as Point of TOP-REAL 2 by A69;
  consider i such that
A70: 1 <= i and
A71: i+1 <= len m and
A72: q in LSeg(m,i) by A69,SPPOL_2:13;
  set j = i+(ilp+n)-'1;
A73: j = i-'1+(ilp+n) by A70,NAT_D:38;
  then
A74: j >= ilp+n by NAT_1:11;
  len m = len g -' (ilp+n) + 1 by A4,A29,A62,A64,FINSEQ_6:118;
  then
A75: i < len g -'(ilp+n) +1 by A71,NAT_1:13;
  then i-'1 < len g-'(ilp+n) by A70,NAT_D:54;
  then i-'1+(ilp+n) < len g by NAT_D:53;
  then
A76: j + 1 <= len g by A73,NAT_1:13;
  ilp+n < len g by A29,A62,A67,XXREAL_0:1;
  then
A77: LSeg(m,i) = LSeg(g,i+(ilp+n)-'1) by A64,A70,A75,JORDAN4:19;
  ilp+1 < ilp+n by A24,XREAL_1:6;
  then
A78: j > ilp+1 by A74,XXREAL_0:2;
A79: now
    assume lp = q;
    then lp in LSeg(g,ilp) /\ LSeg(g,j) by A8,A72,A77,XBOOLE_0:def 4;
    then LSeg(g,ilp) meets LSeg(g,j);
    hence contradiction by A78,TOPREAL1:def 7;
  end;
  1 <= j by A64,A74,XXREAL_0:2;
  then ilp >= j by A3,A8,A10,A7,A68,A72,A77,A79,A76,JORDAN5C:28;
  then ilp >= ilp+1 by A78,XXREAL_0:2;
  hence contradiction by XREAL_1:29;
end;
