 reserve a,b,r for Real;
 reserve A for non empty set;
 reserve X,x for set;
 reserve f,g,F,G for PartFunc of REAL,REAL;
 reserve n for Element of NAT;

theorem Th2:
  for a,b be Real,
      Z be open Subset of REAL
   st a < b & [.a,b.] c= Z
  holds
    ex a1,b1 be Real
    st a1 < a & b < b1 & a1 < b1
      & [.a1,b1.] c= Z
      & [.a,b.] c= ].a1,b1.[
proof
  let a,b be Real,
      Z be open Subset of REAL;
  assume
  A1: a < b & [.a,b.] c= Z; then
  a in [.a,b.]; then
  consider d1 be Real such that
  A2: 0 < d1 & ].a-d1, a+d1.[ c= Z by A1,RCOMP_1:19;

  b in [.a,b.] by A1; then
  consider d2 be Real such that
  A3: 0 < d2 & ].b-d2, b+d2.[ c= Z by A1,RCOMP_1:19;

  reconsider d = min(d1,d2) as Real;
  A4: d <= d1 & d <= d2 by XXREAL_0:17;
  A5: 0 < d by A2,A3,XXREAL_0:15; then
  A6: 0 < d/2 < d by XREAL_1:216;

  set a1 = a - d/2;
  set b1 = b + d/2;
  take a1,b1;
  A7: a1 < a - 0 by A5,XREAL_1:15; then
  A8: a1 < b by A1,XXREAL_0:2;
  A9: b + 0 < b1 by A5,XREAL_1:8;
  hence a1 < a & b < b1 & a1 < b1 by A7,A8,XXREAL_0:2;
  thus [.a1,b1.] c= Z
  proof
    let t be object;
    assume
    A11: t in [.a1,b1.]; then
    reconsider s = t as Real;
    per cases by A11,XXREAL_1:1;
    suppose
      A13: a1 <= s < a;
      A14: a-d < a-d/2 by A6,XREAL_1:15;
      a-d1 <= a-d by A4,XREAL_1:13; then
      a-d1 < a1 by A14,XXREAL_0:2; then
      A15: a-d1 < s by A13,XXREAL_0:2;
      a+0 < a+d1 by A2,XREAL_1:8; then
      s < a+d1 by A13,XXREAL_0:2; then
      t in ].a-d1, a+d1.[ by A15;
      hence t in Z by A2;
    end;
    suppose
      a <= s <= b; then
      t in [.a,b.];
      hence t in Z by A1;
    end;
    suppose
      A16: b < s <= b1;
      A17: b+d/2 < b+d by A6,XREAL_1:8;
      b+d <= b+d2 by A4,XREAL_1:7; then
      b+d/2 < b+d2 by A17,XXREAL_0:2; then
      A18: s < b+d2 by A16,XXREAL_0:2;
      b-d2 < b-0 by A3,XREAL_1:15; then
      b-d2 < s by A16,XXREAL_0:2; then
      t in ].b-d2, b+d2.[ by A18;
      hence t in Z by A3;
    end;
  end;
  let t be object;
  assume
  A20: t in [.a,b.]; then
  reconsider s=t as Real;
  a <= s <= b by A20,XXREAL_1:1; then
  a1 < s < b1 by A7,A9,XXREAL_0:2;
  hence t in ].a1,b1.[;
end;
