reserve n for Nat;

theorem Th20:
  for C be compact connected non vertical non horizontal Subset of
TOP-REAL 2 for i,j,k be Nat st 1 <= j & j <= k & k <= len Gauge(C,n)
& 1 <= i & i <= width Gauge(C,n) & Gauge(C,n)*(j,i) in L~Upper_Seq(C,n) & Gauge
  (C,n)*(k,i) in L~Lower_Seq(C,n) ex j1,k1 be Nat st j <= j1 & j1 <=
k1 & k1 <= k & LSeg(Gauge(C,n)*(j1,i),Gauge(C,n)*(k1,i)) /\ L~Upper_Seq(C,n) =
{Gauge(C,n)*(j1,i)} & LSeg(Gauge(C,n)*(j1,i),Gauge(C,n)*(k1,i)) /\ L~Lower_Seq(
  C,n) = {Gauge(C,n)*(k1,i)}
proof
  let C be compact connected non vertical non horizontal Subset of TOP-REAL 2;
  let i,j,k be Nat;
  assume that
A1: 1 <= j and
A2: j <= k and
A3: k <= len Gauge(C,n) and
A4: 1 <= i and
A5: i <= width Gauge(C,n) and
A6: Gauge(C,n)*(j,i) in L~Upper_Seq(C,n) and
A7: Gauge(C,n)*(k,i) in L~Lower_Seq(C,n);
  set G = Gauge(C,n);
A8: len G = width G by JORDAN8:def 1;
  then
A9: j <= width G by A2,A3,XXREAL_0:2;
  then
A10: [j,i] in Indices G by A1,A4,A5,A8,MATRIX_0:30;
  set s = G*(1,i)`2;
  set e = G*(k,i);
  set f = G*(j,i);
  set w1 = lower_bound(proj1.:(LSeg(f,e) /\ L~Lower_Seq(C,n)));
A11: G*(k,i) in LSeg(G*(j,i),G*(k,i)) by RLTOPSP1:68;
  then
A12: LSeg(G*(j,i),G*(k,i)) meets L~Lower_Seq(C,n) by A7,XBOOLE_0:3;
A13: k >= 1 by A1,A2,XXREAL_0:2;
  then [k,i] in Indices G by A3,A4,A5,MATRIX_0:30;
  then consider k1 be Nat such that
A14: j <= k1 and
A15: k1 <= k and
A16: G*(k1,i)`1 = w1 by A2,A12,A10,JORDAN1F:3,JORDAN1G:5;
A17: k1 <= width G by A3,A8,A15,XXREAL_0:2;
  set p = |[w1,s]|;
  set w2 = upper_bound(proj1.:(LSeg(f,p) /\ L~Upper_Seq(C,n)));
  set q = |[w2,s]|;
A18: G*(j,i) in LSeg(G*(j,i),G*(k1,i)) by RLTOPSP1:68;
  then
A19: LSeg(G*(j,i),G*(k1,i)) meets L~Upper_Seq(C,n) by A6,XBOOLE_0:3;
A20: 1 <= k1 by A1,A14,XXREAL_0:2;
  then
A21: G*(k1,i)`2 = s by A4,A5,A8,A17,GOBOARD5:1;
  then
A22: p = G*(k1,i) by A16,EUCLID:53;
  f`2 = s by A1,A4,A5,A8,A9,GOBOARD5:1
    .= e`2 by A3,A4,A5,A13,GOBOARD5:1;
  then
A23: LSeg(f,e) is horizontal by SPPOL_1:15;
  set X = LSeg(G*(j,i),G*(k1,i)) /\ L~Upper_Seq(C,n);
  reconsider X1=X as non empty compact Subset of TOP-REAL 2 by A6,A18,
XBOOLE_0:def 4;
  consider pp be object such that
A24: pp in E-most X1 by XBOOLE_0:def 1;
  [k1,i] in Indices G by A4,A5,A8,A20,A17,MATRIX_0:30;
  then consider j1 be Nat such that
A25: j <= j1 and
A26: j1 <= k1 and
A27: G*(j1,i)`1 = w2 by A10,A14,A22,A19,JORDAN1F:4,JORDAN1G:4;
A28: j1 <= width G by A17,A26,XXREAL_0:2;
  reconsider pp as Point of TOP-REAL 2 by A24;
A29: pp in X by A24,XBOOLE_0:def 4;
  then
A30: pp in L~Upper_Seq(C,n) by XBOOLE_0:def 4;
  take j1,k1;
  thus j <= j1 & j1 <= k1 & k1 <= k by A15,A25,A26;
A31: pp in LSeg(G*(j,i),G*(k1,i)) by A29,XBOOLE_0:def 4;
A32: 1 <= j1 by A1,A25,XXREAL_0:2;
  then
A33: G*(j1,i)`2 = s by A4,A5,A8,A28,GOBOARD5:1;
  then
A34: q = G*(j1,i) by A27,EUCLID:53;
  then
A35: q`1 <= p`1 by A4,A5,A8,A17,A22,A26,A32,SPRECT_3:13;
A36: q`1 = E-bound X by A22,A27,A34,SPRECT_1:46
    .= (E-min X)`1 by EUCLID:52
    .= pp`1 by A24,PSCOMP_1:47;
A37: f`2 = p`2 by A1,A4,A5,A8,A9,A21,A22,GOBOARD5:1;
  then LSeg(f,p) is horizontal by SPPOL_1:15;
  then pp`2 = q`2 by A21,A22,A33,A34,A31,SPPOL_1:40;
  then
A38: q in L~Upper_Seq(C,n) by A30,A36,TOPREAL3:6;
  for x be object holds x in LSeg(p,q) /\ L~Upper_Seq(C,n) iff x = q
  proof
    let x be object;
    thus x in LSeg(p,q) /\ L~Upper_Seq(C,n) implies x = q
    proof
      reconsider EE = LSeg(f,p) /\ L~Upper_Seq(C,n) as compact Subset of
      TOP-REAL 2;
      assume
A39:  x in LSeg(p,q) /\ L~Upper_Seq(C,n);
      then reconsider pp = x as Point of TOP-REAL 2;
A40:  pp in LSeg(p,q) by A39,XBOOLE_0:def 4;
      then
A41:  pp`1 >= q`1 by A35,TOPREAL1:3;
A42:  f`1 <= q`1 by A1,A4,A5,A8,A25,A28,A34,SPRECT_3:13;
      reconsider E0 = proj1.:EE as compact Subset of REAL by Th4;
A43:  p in LSeg(f,p) by RLTOPSP1:68;
      f`2 = q`2 by A1,A4,A5,A8,A9,A33,A34,GOBOARD5:1;
      then q in LSeg(p,f) by A21,A22,A33,A34,A35,A42,GOBOARD7:8;
      then
A44:  LSeg(p,q) c= LSeg(f,p) by A43,TOPREAL1:6;
      pp in L~Upper_Seq(C,n) by A39,XBOOLE_0:def 4;
      then pp in EE by A40,A44,XBOOLE_0:def 4;
      then proj1.pp in E0 by FUNCT_2:35;
      then
A45:  pp`1 in E0 by PSCOMP_1:def 5;
      E0 is real-bounded by RCOMP_1:10;
      then E0 is bounded_above by XXREAL_2:def 11;
      then q`1 >= pp`1 by A27,A34,A45,SEQ_4:def 1;
      then
A46:  pp`1 = q`1 by A41,XXREAL_0:1;
      pp`2 = q`2 by A21,A22,A33,A34,A40,GOBOARD7:6;
      hence thesis by A46,TOPREAL3:6;
    end;
    assume
A47: x = q;
    then x in LSeg(p,q) by RLTOPSP1:68;
    hence thesis by A38,A47,XBOOLE_0:def 4;
  end;
  hence
  LSeg(Gauge(C,n)*(j1,i),Gauge(C,n)*(k1,i)) /\ L~Upper_Seq(C,n) = {Gauge(
  C,n)*(j1,i)} by A22,A34,TARSKI:def 1;
  set X = LSeg(G*(j,i),G*(k,i)) /\ L~Lower_Seq(C,n);
  reconsider X1=X as non empty compact Subset of TOP-REAL 2 by A7,A11,
XBOOLE_0:def 4;
  consider pp be object such that
A48: pp in W-most X1 by XBOOLE_0:def 1;
  reconsider pp as Point of TOP-REAL 2 by A48;
A49: pp in X by A48,XBOOLE_0:def 4;
  then
A50: pp in L~Lower_Seq(C,n) by XBOOLE_0:def 4;
  pp in LSeg(G*(j,i),G*(k,i)) by A49,XBOOLE_0:def 4;
  then
A51: pp`2 = p`2 by A37,A23,SPPOL_1:40;
  p`1 = W-bound X by A16,A22,SPRECT_1:43
    .= (W-min X)`1 by EUCLID:52
    .= pp`1 by A48,PSCOMP_1:31;
  then
A52: p in L~Lower_Seq(C,n) by A50,A51,TOPREAL3:6;
  for x be object holds x in LSeg(p,q) /\ L~Lower_Seq(C,n) iff x = p
  proof
    let x be object;
    thus x in LSeg(p,q) /\ L~Lower_Seq(C,n) implies x = p
    proof
      j1 <= k by A15,A26,XXREAL_0:2;
      then
A53:  q`1 <= e`1 by A3,A4,A5,A32,A34,SPRECT_3:13;
A54:  e`2 = p`2 by A3,A4,A5,A13,A21,A22,GOBOARD5:1;
A55:  f`1 <= p`1 by A1,A4,A5,A8,A14,A17,A22,SPRECT_3:13;
A56:  f`1 <= q`1 by A1,A4,A5,A8,A25,A28,A34,SPRECT_3:13;
A57:  p`1 <= e`1 by A3,A4,A5,A15,A20,A22,SPRECT_3:13;
      f`2 = p`2 by A1,A4,A5,A8,A9,A21,A22,GOBOARD5:1;
      then
A58:  p in LSeg(f,e) by A54,A55,A57,GOBOARD7:8;
A59:  e`2 = q`2 by A3,A4,A5,A13,A33,A34,GOBOARD5:1;
      f`2 = q`2 by A1,A4,A5,A8,A9,A33,A34,GOBOARD5:1;
      then q in LSeg(f,e) by A59,A56,A53,GOBOARD7:8;
      then
A60:  LSeg(p,q) c= LSeg(f,e) by A58,TOPREAL1:6;
      reconsider EE = LSeg(f,e) /\ L~Lower_Seq(C,n) as compact Subset of
      TOP-REAL 2;
      reconsider E0 = proj1.:EE as compact Subset of REAL by Th4;
      assume
A61:  x in LSeg(p,q) /\ L~Lower_Seq(C,n);
      then reconsider pp = x as Point of TOP-REAL 2;
A62:  pp in LSeg(p,q) by A61,XBOOLE_0:def 4;
      then
A63:  pp`1 <= p`1 by A35,TOPREAL1:3;
      pp in L~Lower_Seq(C,n) by A61,XBOOLE_0:def 4;
      then pp in EE by A62,A60,XBOOLE_0:def 4;
      then proj1.pp in E0 by FUNCT_2:35;
      then
A64:  pp`1 in E0 by PSCOMP_1:def 5;
      E0 is real-bounded by RCOMP_1:10;
      then E0 is bounded_below by XXREAL_2:def 11;
      then p`1 <= pp`1 by A16,A22,A64,SEQ_4:def 2;
      then
A65:  pp`1 = p`1 by A63,XXREAL_0:1;
      pp`2 = p`2 by A21,A22,A33,A34,A62,GOBOARD7:6;
      hence thesis by A65,TOPREAL3:6;
    end;
    assume
A66: x = p;
    then x in LSeg(p,q) by RLTOPSP1:68;
    hence thesis by A52,A66,XBOOLE_0:def 4;
  end;
  hence thesis by A22,A34,TARSKI:def 1;
end;
