reserve i,j,k,n for Nat;

theorem
  for C being compact connected non vertical non horizontal non empty
Subset of TOP-REAL 2 holds E-max C in right_cell(Rotate(Cage(C,n),E-max L~Cage(
  C,n)),1)
proof
  let C be compact connected non vertical non horizontal non empty Subset of
  TOP-REAL 2;
  set f = Cage(C,n);
  set G = Gauge(C,n);
  consider j being Nat such that
A1: 1 <= j and
A2: j <= width G and
A3: E-max L~f = G*(len G,j) by JORDAN1D:25;
A4: len G >= 4 by JORDAN8:10;
  then
A5: 1 <= len G by XXREAL_0:2;
  set k = (E-max L~f)..f;
A6: E-max L~f in rng f by SPRECT_2:46;
  then
A7: k in dom f & f.k = E-max L~f by FINSEQ_4:19,20;
  then
A8: f/.k = E-max L~f by PARTFUN1:def 6;
A9: now
A10: 1 < (E-max L~f)..f by Th2;
A11: 1 in dom f by A6,FINSEQ_3:31;
    assume k = len f;
    then f/.1 = E-max L~f by A8,FINSEQ_6:def 1;
    then f.1 = E-max L~f by A11,PARTFUN1:def 6;
    hence contradiction by A11,A10,FINSEQ_4:24;
  end;
  f/.k = G*(len G,j) by A3,A7,PARTFUN1:def 6;
  then
A12: f/.k = (GoB f)*(len G,j) by JORDAN1H:44;
  k <= len f by A6,FINSEQ_4:21;
  then k < len f by A9,XXREAL_0:1;
  then
A13: k+1 <= len f by NAT_1:13;
A14: 1 <= len G by A4,XXREAL_0:2;
  then
A15: [len G,j] in Indices G by A1,A2,MATRIX_0:30;
  1 <= (j-'1)+1 & (j-'1)+1 <= width G by A1,A2,XREAL_1:235;
  then
A16: [len G,(j-'1)+1] in Indices G by A14,MATRIX_0:30;
  set p = E-max C;
A17: f is_sequence_on G by JORDAN9:def 1;
A18: 1 <= k+1 by NAT_1:11;
  then
A19: k+1 in dom f by A13,FINSEQ_3:25;
A20: k+1 in dom f by A13,A18,FINSEQ_3:25;
  then consider ki,kj being Nat such that
A21: [ki,kj] in Indices G and
A22: f/.(k+1) = G*(ki,kj) by A17,GOBOARD1:def 9;
A23: [ki,kj] in Indices GoB f & f/.(k+1) = (GoB f)*(ki,kj) by A21,A22,
JORDAN1H:44;
A24: 1 <= k by Th2;
  then
A25: (f/.(k+1))`1 = E-bound L~Cage(C,n) by A8,A13,JORDAN1E:20;
  then G*(len G,j)`1 = G*(ki,kj)`1 by A3,A22,EUCLID:52;
  then
A26: ki = len G by A21,A15,JORDAN1G:7;
A27: kj <= width G & 1 <= ki by A21,MATRIX_0:32;
  [len G,j] in Indices GoB f by A15,JORDAN1H:44;
  then |.len G-ki.|+|.j-kj.| = 1 by A6,A19,A12,A23,FINSEQ_4:20,GOBOARD5:12;
  then
A28: 0+|.j-kj.| = 1 by A26,ABSVALUE:2;
  2 <= len f by GOBOARD7:34,XXREAL_0:2;
  then f/.(k+1) in E-most L~f by A25,A20,GOBOARD1:1,SPRECT_2:13;
  then G*(len G,j)`2 >= G*(ki,kj)`2 by A3,A22,PSCOMP_1:47;
  then j >= kj by A1,A26,A27,GOBOARD5:4;
  then j=kj+1 by A28,SEQM_3:41;
  then kj = j-1;
  then
A29: kj = j-'1 by A1,XREAL_1:233;
  then
A30: 1 <= j-'1 by A21,MATRIX_0:32;
A31: j-'1 <= width G by A21,A29,MATRIX_0:32;
  f/.k = G*(len G,(j-'1)+1) by A1,A3,A8,XREAL_1:235;
  then
A32: right_cell(f,k,G) = cell(G,len G-'1,j-'1) by A17,A24,A13,A21,A22,A26,A29
,A16,GOBRD13:28;
A33: now
    j-'1 <= len G by A31,JORDAN8:def 1;
    then
A34: G*(len G-'1,j-'1)`1 = E-bound C by A30,JORDAN8:12;
    j <= len G by A2,JORDAN8:def 1;
    then
A35: G*(len G-'1,j)`1 = E-bound C by A1,JORDAN8:12;
    assume
A36: not p in right_cell(f,k,G);
A37: 1 < len G by A4,XXREAL_0:2;
    then
A38: 1<=len G-'1 by NAT_D:49;
A39: len G-'1 <= len G by NAT_D:50;
    then
A40: G*(1,j)`2 = G*(len G-'1,j)`2 & G*(1,j-'1)`2 = G*(len G-'1,j-'1)`2 by A1,A2
,A30,A31,A38,GOBOARD5:1;
    j-'1<j by A30,NAT_D:51;
    then j-'1 < width G by A2,XXREAL_0:2;
    then LSeg(G*(len G-'1,j-'1),G*(len G-'1,j-'1+1)) c= cell(G,len G-'1,j-'1)
    by A30,A38,A39,GOBOARD5:19;
    then not p in LSeg(G*(len G-'1,j-'1),G*(len G-'1,j-'1+1)) by A32,A36;
    then
A41: not p in LSeg(G*(len G-'1,j-'1),G*(len G-'1,j)) by A1,XREAL_1:235;
    p`1 = E-bound C by EUCLID:52;
    then
A42: p`2 > G*(len G-'1,j)`2 or p`2 < G*(len G-'1,j-'1)`2 by A41,A34,A35,
GOBOARD7:7;
    per cases by A1,A2,A5,A30,A31,A42,A40,GOBOARD5:1;
    suppose
A43:  p`2 < G*(len G,j-'1)`2;
A44:  1 <= j-'1 & (j-'1)+1 <= width G by A1,A2,A21,A29,MATRIX_0:32,XREAL_1:235;
      cell(G,len G-'1,j-'1) meets C by A24,A13,A32,JORDAN9:31;
      then cell(G,len G-'1,j-'1) /\ C <> {} by XBOOLE_0:def 7;
      then consider c being object such that
A45:  c in cell(G,len G-'1,j-'1) /\ C by XBOOLE_0:def 1;
      reconsider c as Element of TOP-REAL 2 by A45;
A46:  1<=len G-'1 & (len G-'1)+1 <= len G by A37,NAT_D:49,XREAL_1:235;
A47:  c in cell(G,len G-'1,j-'1) by A45,XBOOLE_0:def 4;
      then
A48:  G*(len G-'1,j-'1)`1 <= c`1 by A46,A44,JORDAN9:17;
A49:  c in C by A45,XBOOLE_0:def 4;
      then c`1 <= E-bound C by PSCOMP_1:24;
      then c in E-most C by A34,A49,A48,SPRECT_2:13,XXREAL_0:1;
      then
A50:  c`2 <= p`2 by PSCOMP_1:47;
      G*(len G-'1,j-'1)`2 <= c`2 by A47,A46,A44,JORDAN9:17;
      then G*(1,j-'1)`2 <= c`2 by A30,A31,A38,A39,GOBOARD5:1;
      then G*(len G,j-'1)`2 <= c`2 by A5,A30,A31,GOBOARD5:1;
      hence contradiction by A43,A50,XXREAL_0:2;
    end;
    suppose
A51:  p`2 > G*(len G,j)`2;
      east_halfline p meets L~f by JORDAN1A:52,SPRECT_1:14;
      then consider r being object such that
A52:  r in east_halfline p and
A53:  r in L~f by XBOOLE_0:3;
      reconsider r as Element of TOP-REAL 2 by A52;
      r in east_halfline p /\ L~f by A52,A53,XBOOLE_0:def 4;
      then r`1 = E-bound L~f by JORDAN1A:83,PSCOMP_1:50;
      then r in E-most L~f by A53,SPRECT_2:13;
      then (E-max L~f)`2 >= r`2 by PSCOMP_1:47;
      hence contradiction by A3,A51,A52,TOPREAL1:def 11;
    end;
  end;
  GoB f = G by JORDAN1H:44;
  then p in right_cell(f,k) by A24,A13,A33,JORDAN1H:23;
  hence thesis by A6,Th5;
end;
