reserve p,p1,p2,p3,q,q1,q2 for Point of TOP-REAL 2,
  i for Nat,
  lambda for Real;

theorem Th48:
  for a,b,c,d being Real, f1,f2 being FinSequence of TOP-REAL 2,
  p0,p1,p01,p10 being Point of TOP-REAL 2 st a < b & c < d &
  p0=|[a,c]| & p1=|[b,d]| & p01=|[a,d]| & p10=|[b,c]| & f1=<*p0,p01,p1*>
  & f2=<*p0,p10,p1*> holds f1 is being_S-Seq &
  L~f1 = LSeg(p0,p01) \/ LSeg(p01,p1) &
  f2 is being_S-Seq & L~f2 = LSeg(p0,p10) \/ LSeg(p10,p1) &
  rectangle(a,b,c,d) = L~f1 \/ L~f2 & L~f1 /\ L~f2 = {p0,p1} & f1/.1 = p0 &
  f1/.len f1=p1 & f2/.1 = p0 & f2/.len f2 = p1
proof
  let a,b,c,d be Real, f1,f2 be FinSequence of TOP-REAL 2,
  p0,p1,p01,p10 be Point of TOP-REAL 2;
  assume that
A1: a < b and
A2: c < d and
A3: p0=|[a,c]| and
A4: p1=|[b,d]| and
A5: p01=|[a,d]| and
A6: p10=|[b,c]| and
A7: f1=<*p0,p01,p1*> and
A8: f2=<*p0,p10,p1*>;
  set P = rectangle(a,b,c,d);
  set L1 = { p : p`1 = a & p`2 <= d & p`2 >= c};
  set L2 = { p : p`1 <= b & p`1 >= a & p`2 = d};
  set L3 = { p : p`1 <= b & p`1 >= a & p`2 = c};
  set L4 = { p : p`1 = b & p`2 <= d & p`2 >= c};
A9: p1`1 = b by A4,EUCLID:52;
A10: p1`2 = d by A4,EUCLID:52;
A11: p10`1 = b by A6,EUCLID:52;
A12: p10`2 = c by A6,EUCLID:52;
A13: p0`1 = a by A3,EUCLID:52;
A14: p0`2 = c by A3,EUCLID:52;
A15: len f1 = 1 + 2 by A7,FINSEQ_1:45;
A16: f1/.1 = p0 by A7,FINSEQ_4:18;
A17: f1/.2 = p01 by A7,FINSEQ_4:18;
A18: f1/.3 = p1 by A7,FINSEQ_4:18;
  thus f1 is being_S-Seq
  proof
A19: p0 <> p01 by A2,A5,A14,EUCLID:52;
    p01 <> p1 by A1,A5,A9,EUCLID:52;
    hence f1 is one-to-one by A1,A7,A9,A13,A19,FINSEQ_3:95;
    thus len f1 >= 2 by A15;
    thus f1 is unfolded
    proof
      let i be Nat;
      assume that
A20:  1 <= i and
A21:  i + 2 <= len f1;
      i <= 1 by A15,A21,XREAL_1:6;
      then
A22:  i = 1 by A20,XXREAL_0:1;
      reconsider n2=1+1 as Nat;
      n2 in Seg len f1 by A15,FINSEQ_1:1;
      then
A23:  LSeg(f1,1) = LSeg(p0,p01) by A15,A16,A17,TOPREAL1:def 3;
A24:  LSeg(f1,n2) = LSeg(p01,p1) by A15,A17,A18,TOPREAL1:def 3;
      for x being object holds x in LSeg(p0,p01) /\ LSeg(p01,p1) iff x = p01
      proof
        let x be object;
        thus x in LSeg(p0,p01) /\ LSeg(p01,p1) implies x = p01
        proof
          assume
A25:      x in LSeg(p0,p01) /\ LSeg(p01,p1);
          then
A26:      x in LSeg(p0,p01) by XBOOLE_0:def 4;
A27:      x in LSeg(p01,p1) by A25,XBOOLE_0:def 4;
A28:      x in {p : p`1 = a & p`2 <= d & p`2 >= c} by A2,A3,A5,A26,Th30;
A29:      x in {p2 : p2`1 <= b & p2`1 >= a & p2`2 = d} by A1,A4,A5,A27,Th30;
A30:      ex p st p = x & p`1 = a & p`2 <= d & p`2 >= c by A28;
          ex p2 st p2=x & p2`1<=b & p2`1>=a & p2`2=d by A29;
          hence thesis by A5,A30,EUCLID:53;
        end;
        assume
A31:    x = p01;
        then
A32:    x in LSeg(p0,p01) by RLTOPSP1:68;
        x in LSeg(p01,p1) by A31,RLTOPSP1:68;
        hence thesis by A32,XBOOLE_0:def 4;
      end;
      hence thesis by A17,A22,A23,A24,TARSKI:def 1;
    end;
    thus f1 is s.n.c.
    proof
      let i,j be Nat such that
A33:  i+1 < j;
      now per cases;
        suppose 1 <= i;
          then
A34:      1+1 <= i+1 by XREAL_1:6;
          now per cases;
            case 1 <= j & j+1 <= len f1;
              then j <= 2 by A15,XREAL_1:6;
              hence contradiction by A33,A34,XXREAL_0:2;
            end;
            case not (1 <= j & j+1 <= len f1);
              then LSeg(f1,j) = {} by TOPREAL1:def 3;
              hence LSeg(f1,i) /\ LSeg(f1,j) = {};
            end;
          end;
          hence LSeg(f1,i) /\ LSeg(f1,j) = {};
        end;
        suppose not (1 <= i & i+1 <= len f1);
          then LSeg(f1,i) = {} by TOPREAL1:def 3;
          hence LSeg(f1,i) /\ LSeg(f1,j) = {};
        end;
      end;
      hence LSeg(f1,i) /\ LSeg(f1,j) = {};
    end;
    let i be Nat;
    assume that
A35: 1 <= i and
A36: i + 1 <= len f1;
A37: i <= 1 + 1 by A15,A36,XREAL_1:6;
    now per cases by A35,A37,NAT_1:9;
      suppose
A38:    i = 1;
        then (f1/.i)`1 = p0`1 by A7,FINSEQ_4:18
          .= a by A3,EUCLID:52
          .= (f1/.(i+1))`1 by A5,A17,A38,EUCLID:52;
        hence thesis;
      end;
      suppose
A39:    i = 2;
        then (f1/.i)`2 = p01`2 by A7,FINSEQ_4:18
          .= d by A5,EUCLID:52
          .= (f1/.(i+1))`2 by A4,A18,A39,EUCLID:52;
        hence thesis;
      end;
    end;
    hence thesis;
  end;
A40: 1+1 in Seg len f1 by A15,FINSEQ_1:1;
A41: 1+1 <= len f1 by A15;
  LSeg(p0,p01) = LSeg(f1,1) by A15,A16,A17,A40,TOPREAL1:def 3;
  then
A42: LSeg(p0,p01) in {LSeg(f1,i): 1 <= i & i+1 <= len f1} by A41;
  LSeg(p01,p1) = LSeg(f1,2) by A15,A17,A18,TOPREAL1:def 3;
  then LSeg(p01,p1) in {LSeg(f1,i): 1 <= i & i+1 <= len f1} by A15;
  then
A43: {LSeg(p0,p01),LSeg(p01,p1)} c= {LSeg(f1,i):1<=i & i+1<=len f1}
  by A42,ZFMISC_1:32;
  {LSeg(f1,i): 1 <= i & i+1 <= len f1} c= {LSeg(p0,p01),LSeg(p01,p1)}
  proof
    let a be object;
    assume a in {LSeg(f1,i): 1 <= i & i+1 <= len f1};
    then consider i such that
A44: a = LSeg(f1,i) and
A45: 1<=i and
A46: i+1<=len f1;
    i+1 <= 2 + 1 by A7,A46,FINSEQ_1:45;
    then i <= 1 + 1 by XREAL_1:6;
    then i = 1 or i = 2 by A45,NAT_1:9;
    then a = LSeg(p0,p01) or a = LSeg(p01,p1) by A16,A17,A18,A44,A46,
TOPREAL1:def 3;
    hence thesis by TARSKI:def 2;
  end;
  then L~f1 = union {LSeg(p0,p01),LSeg(p01,p1)} by A43,XBOOLE_0:def 10;
  hence
A47: L~f1 = (LSeg(p0,p01) \/ LSeg(p01,p1)) by ZFMISC_1:75;
  then
A48: L~f1=L1 \/ LSeg(p01,p1) by A2,A3,A5,Th30
    .=L1 \/ L2 by A1,A4,A5,Th30;
A49: len f2 = 1 + 2 by A8,FINSEQ_1:45;
A50: f2/.1 = p0 by A8,FINSEQ_4:18;
A51: f2/.2 = p10 by A8,FINSEQ_4:18;
A52: f2/.3 = p1 by A8,FINSEQ_4:18;
  thus f2 is being_S-Seq
  proof
    thus f2 is one-to-one by A1,A2,A8,A9,A10,A11,A12,A13,FINSEQ_3:95;
    thus len f2 >= 2 by A49;
    thus f2 is unfolded
    proof
      let i be Nat;
      assume that
A53:  1 <= i and
A54:  i + 2 <= len f2;
      i <= 1 by A49,A54,XREAL_1:6;
      then
A55:  i = 1 by A53,XXREAL_0:1;
      1+1 in Seg len f2 by A49,FINSEQ_1:1;
      then
A56:  LSeg(f2,1) = LSeg(p0,p10) by A49,A50,A51,TOPREAL1:def 3;
A57:  LSeg(f2,1+1) = LSeg(p10,p1) by A49,A51,A52,TOPREAL1:def 3;
      for x being object holds x in LSeg(p0,p10) /\ LSeg(p10,p1) iff x = p10
      proof
        let x be object;
        thus x in LSeg(p0,p10) /\ LSeg(p10,p1) implies x = p10
        proof
          assume
A58:      x in LSeg(p0,p10) /\ LSeg(p10,p1);
          then
A59:      x in LSeg(p0,p10) by XBOOLE_0:def 4;
A60:      x in LSeg(p10,p1) by A58,XBOOLE_0:def 4;
A61:      x in { p : p`1 <= b & p`1 >= a & p`2 = c} by A1,A3,A6,A59,Th30;
A62:      x in { p2 : p2`1 = b & p2`2 <= d & p2`2 >= c} by A2,A4,A6,A60,Th30;
A63:      ex p st p = x & p`1 <= b & p`1 >= a & p`2 = c by A61;
          ex p2 st p2=x & p2`1=b & p2`2<=d & p2`2>=c by A62;
          hence thesis by A6,A63,EUCLID:53;
        end;
        assume
A64:    x = p10;
        then
A65:    x in LSeg(p0,p10) by RLTOPSP1:68;
        x in LSeg(p10,p1) by A64,RLTOPSP1:68;
        hence thesis by A65,XBOOLE_0:def 4;
      end;
      hence thesis by A51,A55,A56,A57,TARSKI:def 1;
    end;
    thus f2 is s.n.c.
    proof
      let i,j be Nat such that
A66:  i+1 < j;
      now per cases;
        suppose 1 <= i;
          then
A67:      1+1 <= i+1 by XREAL_1:6;
          now per cases;
            case 1 <= j & j+1 <= len f2;
              then j <= 2 by A49,XREAL_1:6;
              hence contradiction by A66,A67,XXREAL_0:2;
            end;
            case not (1 <= j & j+1 <= len f2);
              then LSeg(f2,j) = {} by TOPREAL1:def 3;
              hence LSeg(f2,i) /\ LSeg(f2,j) = {};
            end;
          end;
          hence LSeg(f2,i) /\ LSeg(f2,j) = {};
        end;
        suppose not (1 <= i & i+1 <= len f2);
          then LSeg(f2,i) = {} by TOPREAL1:def 3;
          hence LSeg(f2,i) /\ LSeg(f2,j) = {};
        end;
      end;
      hence LSeg(f2,i) /\ LSeg(f2,j) = {};
    end;
    let i be Nat;
    assume that
A68: 1 <= i and
A69: i + 1 <= len f2;
A70: i <= 1 + 1 by A49,A69,XREAL_1:6;
    per cases by A68,A70,NAT_1:9;
    suppose
A71:  i = 1;
      then (f2/.i)`2 = p0`2 by A8,FINSEQ_4:18
        .= c by A3,EUCLID:52
        .= (f2/.(i+1))`2 by A6,A51,A71,EUCLID:52;
      hence thesis;
    end;
    suppose
A72:  i = 2;
      then (f2/.i)`1 = p10`1 by A8,FINSEQ_4:18
        .= b by A6,EUCLID:52
        .= (f2/.(i+1))`1 by A4,A52,A72,EUCLID:52;
      hence thesis;
    end;
  end;
A73: 1+1 in Seg len f2 by A49,FINSEQ_1:1;
A74: 1+1 <= len f2 by A49;
  LSeg(p0,p10) = LSeg(f2,1) by A49,A50,A51,A73,TOPREAL1:def 3;
  then
A75: LSeg(p0,p10) in {LSeg(f2,i): 1 <= i & i+1 <= len f2} by A74;
  LSeg(p10,p1) = LSeg(f2,2) by A49,A51,A52,TOPREAL1:def 3;
  then LSeg(p10,p1) in {LSeg(f2,i): 1 <= i & i+1 <= len f2} by A49;
  then
A76: {LSeg(p0,p10),LSeg(p10,p1)} c= {LSeg(f2,i):1<=i & i+1<=len f2}
  by A75,ZFMISC_1:32;
  {LSeg(f2,i): 1 <= i & i+1 <= len f2} c= {LSeg(p0,p10),LSeg(p10,p1)}
  proof
    let ax be object;
    assume ax in {LSeg(f2,i): 1 <= i & i+1 <= len f2};
    then consider i such that
A77: ax = LSeg(f2,i) and
A78: 1<=i and
A79: i+1<=len f2;
    i+1 <= 2 + 1 by A8,A79,FINSEQ_1:45;
    then i <= 1 + 1 by XREAL_1:6;
    then i = 1 or i = 2 by A78,NAT_1:9;
    then ax = LSeg(p0,p10) or ax = LSeg(p10,p1) by A50,A51,A52,A77,A79,
TOPREAL1:def 3;
    hence thesis by TARSKI:def 2;
  end;
  then
A80: L~f2 = union {LSeg(p0,p10),LSeg(p10,p1)} by A76,XBOOLE_0:def 10;
  hence L~f2 = LSeg(p0,p10) \/ LSeg(p10,p1) by ZFMISC_1:75;
  L~f2 = (LSeg(p0,p10) \/ LSeg(p10,p1)) by A80,ZFMISC_1:75;
  then
A81: L~f2=L3 \/ LSeg(p10,p1) by A1,A3,A6,Th30
    .=L3 \/ L4 by A2,A4,A6,Th30;
  P = LSeg(p0,p01) \/ LSeg(p01,p1) \/ (LSeg(p0,p10) \/ LSeg(p10,p1))
  by A3,A4,A5,A6,SPPOL_2:def 3;
  hence P = L~f1 \/ L~f2 by A47,A80,ZFMISC_1:75;
  now
    assume L2 meets L3;
    then consider x being object such that
A82: x in L2 and
A83: x in L3 by XBOOLE_0:3;
A84: ex p st p = x & p`1 <= b & p`1 >= a & p`2 = d by A82;
    ex p2 st p2 = x & p2`1 <= b & p2`1 >= a & p2`2 = c by A83;
    hence contradiction by A2,A84;
  end;
  then
A85: L2 /\ L3 = {};
A86: LSeg(|[ a,c ]|, |[ a,d ]|) = { p3 : p3`1 = a & p3`2 <= d & p3`2 >= c}
  by A2,Th30;
A87: LSeg(|[ a,d ]|, |[ b,d ]|) = { p2 : p2`1 <= b & p2`1 >= a & p2`2 = d}
  by A1,Th30;
A88: LSeg(|[ a,c ]|, |[ b,c ]|) = { q1 : q1`1 <= b & q1`1 >= a & q1`2 = c}
  by A1,Th30;
A89: LSeg(|[ b,c ]|, |[ b,d ]|) = { q2 : q2`1 = b & q2`2 <= d & q2`2 >= c}
  by A2,Th30;
A90: LSeg(|[a,c]|,|[a,d]|) /\ LSeg(|[a,c]|,|[b,c]|) = {|[a,c]|} by A1,A2,Th31;
A91: LSeg(|[a,d]|,|[b,d]|) /\ LSeg(|[b,c]|,|[b,d]|) = {|[b,d]|} by A1,A2,Th33;
  now
    assume L1 meets L4;
    then consider x being object such that
A92: x in L1 and
A93: x in L4 by XBOOLE_0:3;
A94: ex p st p = x & p`1 = a & p`2 <= d & p`2 >= c by A92;
    ex p2 st p2 = x & p2`1 = b & p2`2 <= d & p2`2 >= c by A93;
    hence contradiction by A1,A94;
  end;
  then
A95: L1 /\ L4 = {};
  thus L~f1 /\ L~f2
  = (L1 \/ L2) /\ L3 \/ (L1 \/ L2) /\ L4 by A48,A81,XBOOLE_1:23
    .= L1 /\ L3 \/ L2 /\ L3 \/ (L1 \/ L2) /\ L4 by XBOOLE_1:23
    .= L1 /\ L3 \/ (L1 /\ L4 \/ L2 /\ L4) by A85,XBOOLE_1:23
    .= {p0, p1} by A3,A4,A86,A87,A88,A89,A90,A91,A95,ENUMSET1:1;
  thus thesis by A7,A8,A15,A49,FINSEQ_4:18;
end;
