reserve a, b, r, s for Real;

theorem Th44:
  r <= s implies for X being open connected Subset of
Closed-Interval-TSpace(r,s) holds X is empty or X = [.r,s.] or (ex a being Real
 st r < a & a <= s & X = [.r,a.[) or (ex a being Real st r <= a &
a < s & X = ].a,s.]) or ex a, b being Real st r <= a & a < b & b <= s &
  X = ].a,b.[
proof
  set L = Closed-Interval-TSpace(r,s);
  assume
A1: r <= s;
  then
A2: the carrier of L = [.r,s.] by TOPMETR:18;
  let X be open connected Subset of L;
  X is bounded_above bounded_below Subset of REAL by A2,XBOOLE_1:1,XXREAL_2:43
,44;
  then reconsider Y = X as real-bounded interval Subset of REAL by Th43;
A3: the carrier of L = [#]L & L is connected by A1,TREAL_1:20;
A4: s in [.r,s.] by A1,XXREAL_1:1;
A5: r in [.r,s.] by A1,XXREAL_1:1;
  per cases by Th29;
  suppose
    Y is empty or Y = [#]REAL;
    hence thesis;
  end;
  suppose
    (ex a st Y = left_closed_halfline(a)) or (ex a st Y =
left_open_halfline(a)) or (ex a st Y = right_closed_halfline(a)) or ex a st Y =
    right_open_halfline(a);
    hence thesis;
  end;
  suppose
    ex a, b st a <= b & Y = [.a,b.];
    then consider a, b such that
A6: a <= b and
A7: Y = [.a,b.];
A8: X <> {}L by A6,A7,XXREAL_1:1;
A9: r <= a & b <= s by A2,A6,A7,XXREAL_1:50;
    then
A10: X is closed by A7,TOPREALA:23;
    now
      assume
A11:  r <> a or b <> s;
      per cases by A9,A11,XXREAL_0:1;
      suppose
        r < a;
        then not r in X by A7,XXREAL_1:1;
        hence contradiction by A2,A3,A5,A8,A10,CONNSP_1:13;
      end;
      suppose
        b < s;
        then not s in X by A7,XXREAL_1:1;
        hence contradiction by A2,A3,A4,A8,A10,CONNSP_1:13;
      end;
    end;
    hence thesis by A7;
  end;
  suppose
    ex a, b st a < b & Y = [.a,b.[;
    then consider a, b such that
A12: a < b and
A13: Y = [.a,b.[;
A14: b <= s by A2,A12,A13,XXREAL_1:52;
A15: r <= a by A2,A12,A13,XXREAL_1:52;
    now
      assume r <> a;
      then
A16:  r < a by A15,XXREAL_0:1;
      now
        Int X = ].a,b.[ by A1,A13,A14,A16,Th41;
        then
A17:    not a in Int X by XXREAL_1:4;
        assume Int X = X;
        hence contradiction by A12,A13,A17,XXREAL_1:3;
      end;
      hence contradiction by TOPS_1:23;
    end;
    hence thesis by A12,A13,A14;
  end;
  suppose
    ex a, b st a < b & Y = ].a,b.];
    then consider a, b such that
A18: a < b and
A19: Y = ].a,b.];
A20: r <= a by A2,A18,A19,XXREAL_1:53;
A21: b <= s by A2,A18,A19,XXREAL_1:53;
    now
      assume b <> s;
      then
A22:  b < s by A21,XXREAL_0:1;
      now
        Int X = ].a,b.[ by A1,A19,A20,A22,Th42;
        then
A23:    not b in Int X by XXREAL_1:4;
        assume Int X = X;
        hence contradiction by A18,A19,A23,XXREAL_1:2;
      end;
      hence contradiction by TOPS_1:23;
    end;
    hence thesis by A18,A19,A20;
  end;
  suppose
    ex a, b st a < b & Y = ].a,b.[;
    then consider a, b such that
A24: a < b & Y = ].a,b.[;
    r <= a & b <= s by A2,A24,XXREAL_1:51;
    hence thesis by A24;
  end;
end;
