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
  Last_Point(L~g,g/.1,g/.len g,L~f) <> SE-corner L~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~f meets L~g by A1,A2,Th33;
  assume
A4: Last_Point(L~g,g/.1,g/.len g,L~f) = SE-corner L~f;
  set se = SE-corner L~f, ise = Index(se,g);
A5: len g in dom g by FINSEQ_5:6;
  then
A6: g.len g = g/.len g by PARTFUN1:def 6;
A7: 1 <= ise+1 by NAT_1:11;
  L~g is_an_arc_of g/.1, g/.len g by TOPREAL1:25;
  then
A8: se in L~g /\ L~f by A3,A4,JORDAN5C:def 2;
  then
A9: se in L~g by XBOOLE_0:def 4;
  then
A10: 1 <= ise by JORDAN3:8;
A11: se in LSeg(g,ise) by A9,JORDAN3:9;
A12: ise < len g by A9,JORDAN3:8;
  then
A13: ise+1 <= len g by NAT_1:13;
  then
A14: ise+1 in dom g by A7,FINSEQ_3:25;
A15: L~f misses RightComp f by Th25;
A16: now
A17: len g >= 1 by A13,A7,XXREAL_0:2;
    assume se <> g.(ise+1);
    then
A18: se <> g/.(ise+1) by A14,PARTFUN1:def 6;
    per cases;
    suppose
A19:  g/.(ise+1) in L~f;
      then ise+1 <> len g by A2,A15,XBOOLE_0:3;
      then ise+1 < len g by A13,XXREAL_0:1;
      then
A20:  ise+1+1 <= len g by NAT_1:13;
      then g/.(ise+1) in LSeg(g,ise+1) by A7,TOPREAL1:21;
      then ise >= ise+1 by A3,A4,A10,A13,A11,A7,A18,A19,A20,JORDAN5C:28;
      hence contradiction by XREAL_1:29;
    end;
    suppose
A21:  not g/.(ise+1) in L~f;
A22:  now
        assume
A23:    g/.(ise+1) in RightComp f;
        RightComp f = {q : W-bound L~f < q`1 & q`1 < E-bound L~f &
        S-bound L~f < q`2 & q`2 < N-bound L~f} by Th37;
        then
A24:    ex q st g/.(ise+1) = q & W-bound L~f < q`1 & q`1 < E-bound L~f &
        S-bound L~f < q`2 & q`2 < N-bound L~f by A23;
A25:    LSeg(g,ise) is vertical or LSeg(g,ise) is horizontal by SPPOL_1:19;
        LSeg(g,ise) = LSeg(g/.ise,g/.(ise+1)) by A10,A13,TOPREAL1:def 3;
        then (g/.(ise+1))`1 = se`1 or (g/.(ise+1))`2 = se`2 by A11,A25,
SPPOL_1:40,41;
        hence contradiction by A24,EUCLID:52;
      end;
      then reconsider
      m = mid(g,ise+1,len g) as S-Sequence_in_R2 by A2,A13,A7,A17,JORDAN3:6;
A26:  ise+1<len g by A2,A13,A22,XXREAL_0:1;
      g/.(ise+1) in (L~f)` by A21,SUBSET_1:29;
      then g/.(ise+1) in LeftComp f \/ RightComp f by GOBRD12:10;
      then g/.(ise+1) in LeftComp f by A22,XBOOLE_0:def 3;
      then
A27:  m/.1 in LeftComp f by A5,A14,SPRECT_2:8;
      m/.len m in RightComp f by A2,A5,A14,SPRECT_2:9;
      then L~f meets L~m by A27,Th33;
      then consider q being object such that
A28:  q in L~f and
A29:  q in L~m by XBOOLE_0:3;
      reconsider q as Point of TOP-REAL 2 by A29;
      consider i such that
A30:  1 <= i and
A31:  i+1 <= len m and
A32:  q in LSeg(m,i) by A29,SPPOL_2:13;
      set j = i+(ise+1)-'1;
A33:  j = i+ise+1-'1 .= i+ise by NAT_D:34;
A34:  len m = len g-'(ise+1)+1 by A13,A7,FINSEQ_6:186;
      then len m = len g -' ise by A9,JORDAN3:8,NAT_2:7;
      then len m + ise = len g by A12,XREAL_1:235;
      then i+1 + ise <= len g by A31,XREAL_1:6;
      then
A35:  j + 1 <= len g by A33;
      i < len m by A31,NAT_1:13;
      then
A36:  LSeg(m,i)=LSeg(g,i+(ise+1)-'1) by A7,A26,A30,A34,JORDAN4:19;
A37:  j >= ise+1 by A30,A33,XREAL_1:6;
A38:  now
        assume se = q;
        then
A39:    se in LSeg(g,ise) /\ LSeg(g,j) by A11,A32,A36,XBOOLE_0:def 4;
        then
A40:    LSeg(g,ise) meets LSeg(g,j);
        per cases by A37,XXREAL_0:1;
        suppose
A41:      ise+1 = j;
          ise+1+1 <= len g by A26,NAT_1:13;
          then ise + (1+1) <= len g;
          then LSeg(g,ise) /\ LSeg(g,ise+1) = {g/.(ise+1)} by A10,
TOPREAL1:def 6;
          hence contradiction by A18,A39,A41,TARSKI:def 1;
        end;
        suppose
          ise+1 < j;
          hence contradiction by A40,TOPREAL1:def 7;
        end;
      end;
      0+1 <= j by A30,A33,XREAL_1:7;
      then ise >= j by A3,A4,A10,A13,A11,A28,A32,A36,A35,A38,JORDAN5C:28;
      then ise >= ise+1 by A37,XXREAL_0:2;
      hence contradiction by XREAL_1:29;
    end;
  end;
  se in L~f by A8,XBOOLE_0:def 4;
  then se <> g.len g by A2,A15,A6,XBOOLE_0:3;
  then
A42: ise+1 < len g by A13,A16,XXREAL_0:1;
  then
A43: ise+1+1 <= len g by NAT_1:13;
  then g/.(ise+1) in LSeg(g,ise+1) by A7,TOPREAL1:21;
  then
A44: se in LSeg(g,ise+1) by A14,A16,PARTFUN1:def 6;
A45: 1 <= ise+1+1 by NAT_1:11;
  then
A46: len g >= 1 by A43,XXREAL_0:2;
A47: ise+1+1 in dom g by A43,A45,FINSEQ_3:25;
  ise+1 < ise+1+1 by NAT_1:13;
  then
A48: se <> g.(ise+1+1) by A14,A16,A47,FUNCT_1:def 4;
  then
A49: se <> g/.(ise+1+1) by A47,PARTFUN1:def 6;
  per cases;
  suppose
A50: g/.(ise+1+1) in L~f;
A51: se <> g/.(ise+1+1) by A47,A48,PARTFUN1:def 6;
    ise+1+1 <> len g by A2,A15,A50,XBOOLE_0:3;
    then ise+1+1 < len g by A43,XXREAL_0:1;
    then
A52: ise+1+1+1 <= len g by NAT_1:13;
    then g/.(ise+1+1) in LSeg(g,ise+1+1) by A45,TOPREAL1:21;
    then ise+1 >= ise+1+1 by A3,A4,A7,A43,A45,A44,A50,A52,A51,JORDAN5C:28;
    hence contradiction by XREAL_1:29;
  end;
  suppose
A53: not g/.(ise+1+1) in L~f;
A54: now
      assume
A55:  g/.(ise+1+1) in RightComp f;
      RightComp f = {q : W-bound L~f < q`1 & q`1 < E-bound L~f & S-bound
      L~f < q`2 & q`2 < N-bound L~f} by Th37;
      then
A56:  ex q st g/.(ise+1+1) = q & W-bound L~f < q`1 & q`1 < E-bound L~f &
      S-bound L~f < q`2 & q`2 < N-bound L~f by A55;
A57:  LSeg(g,ise+1) is vertical or LSeg(g,ise+1) is horizontal by SPPOL_1:19;
      LSeg(g,ise+1) = LSeg(g/.(ise+1),g/.(ise+1+1)) by A7,A43,TOPREAL1:def 3;
      then (g/.(ise+1+1))`1 = se`1 or (g/.(ise+1+1))`2 = se`2 by A44,A57,
SPPOL_1:40,41;
      hence contradiction by A56,EUCLID:52;
    end;
    then reconsider
    m = mid(g,ise+1+1,len g) as S-Sequence_in_R2 by A2,A43,A45,A46,JORDAN3:6;
A58: ise+1+1<len g by A2,A43,A54,XXREAL_0:1;
    g/.(ise+1+1) in (L~f)` by A53,SUBSET_1:29;
    then g/.(ise+1+1) in LeftComp f \/ RightComp f by GOBRD12:10;
    then g/.(ise+1+1) in LeftComp f by A54,XBOOLE_0:def 3;
    then
A59: m/.1 in LeftComp f by A5,A47,SPRECT_2:8;
    m/.len m in RightComp f by A2,A5,A47,SPRECT_2:9;
    then L~f meets L~m by A59,Th33;
    then consider q being object such that
A60: q in L~f and
A61: q in L~m by XBOOLE_0:3;
    reconsider q as Point of TOP-REAL 2 by A61;
    consider i such that
A62: 1 <= i and
A63: i+1 <= len m and
A64: q in LSeg(m,i) by A61,SPPOL_2:13;
    set j = i+(ise+1+1)-'1;
A65: len m = len g-'(ise+1+1)+1 by A43,A45,FINSEQ_6:186;
    then len m = len g -' (ise+1) by A42,NAT_2:7;
    then len m + (ise+1) = len g by A13,XREAL_1:235;
    then i+ 1 + (ise +1) <= len g by A63,XREAL_1:6;
    then
A66: i+ 1 + ise +1 <= len g;
    i < len m by A63,NAT_1:13;
    then
A67: LSeg(m,i)=LSeg(g,i+(ise+1+1)-'1) by A45,A58,A62,A65,JORDAN4:19;
A68: j = i+ise+1+1-'1 .= i+ise+1 by NAT_D:34;
    then j = i+(ise+1);
    then
A69: j >= ise+1+1 by A62,XREAL_1:6;
A70: now
      assume se = q;
      then
A71:  se in LSeg(g,ise+1) /\ LSeg(g,j) by A44,A64,A67,XBOOLE_0:def 4;
      then
A72:  LSeg(g,ise+1) meets LSeg(g,j);
      per cases by A69,XXREAL_0:1;
      suppose
A73:    ise+1+1 = j;
        ise+1+1+1 <= len g by A58,NAT_1:13;
        then ise+1 + (1+1) <= len g;
        then LSeg(g,ise+1) /\ LSeg(g,ise+1+1) = {g/.(ise+1+1)} by A7,
TOPREAL1:def 6;
        hence contradiction by A49,A71,A73,TARSKI:def 1;
      end;
      suppose
        ise+1+1 < j;
        hence contradiction by A72,TOPREAL1:def 7;
      end;
    end;
    0+1 <= j by A68,NAT_1:11;
    then ise+1 >= j by A3,A4,A7,A43,A44,A60,A64,A67,A68,A66,A70,JORDAN5C:28;
    then ise+1 >= ise+1+1 by A69,XXREAL_0:2;
    hence contradiction by XREAL_1:29;
  end;
end;
