reserve a, b for Real,
  r for Real,
  rr for Real,
  i, j, n for Nat,
  M for non empty MetrSpace,
  p, q, s for Point of TOP-REAL 2,
  e for Point of Euclid 2,
  w for Point of Euclid n,
  z for Point of M,
  A, B for Subset of TOP-REAL n,
  P for Subset of TOP-REAL 2,
  D for non empty Subset of TOP-REAL 2;
reserve a, b for Real;
reserve a, b for Real;

theorem Th16:
  for a, b being Real holds a < b implies lower_bound ].a,b.[ = a &
  upper_bound ].a,b.[ = b
proof
  let a, b be Real;
  assume
A1: a < b;
  set X = ].a,b.[;
  reconsider a, b as Real;
A2: (a+b)/2 < b by A1,XREAL_1:226;
A3: a < (a+b)/2 by A1,XREAL_1:226;
  then
A4: (a+b)/2 in { l where l is Real : a < l & l < b } by A2;
A5: for s being Real st 0 < s ex r being Real st r in X & r < a+s
  proof
    let s be Real such that
A6: 0 < s and
A7: for r being Real st r in X holds r >= a+s;
    reconsider s as Real;
    per cases;
    suppose
A8:   a + s >= b;
A9:   (a+b)/2 in X by A4,RCOMP_1:def 2;
      (a+b)/2 < a+s by A2,A8,XXREAL_0:2;
      hence thesis by A7,A9;
    end;
    suppose
A10:  a + s < b;
A11:  a < a + s by A6,XREAL_1:29;
      then (a+(a+s))/2 < a+s by XREAL_1:226;
      then
A12:  (a+(a+s))/2 < b by A10,XXREAL_0:2;
      a < (a+(a+s))/2 by A11,XREAL_1:226;
      then (a+(a+s))/2 in {r : a < r & r < b } by A12;
      then (a+(a+s))/2 in X by RCOMP_1:def 2;
      hence thesis by A7,A11,XREAL_1:226;
    end;
  end;
A13: for s being Real st 0 < s ex r being Real st r in X & b-s
  < r
  proof
    let s be Real such that
A14: 0 < s and
A15: for r being Real st r in X holds r <= b-s;
    reconsider s as Real;
    per cases;
    suppose
A16:  b - s <= a;
A17:  (a+b)/2 in X by A4,RCOMP_1:def 2;
      (a+b)/2 > b-s by A3,A16,XXREAL_0:2;
      hence thesis by A15,A17;
    end;
    suppose
A18:  b - s > a;
A19:  b - s < b - 0 by A14,XREAL_1:15;
      then b-s < (b+(b-s))/2 by XREAL_1:226;
      then
A20:  a < (b+(b-s))/2 by A18,XXREAL_0:2;
      (b+(b-s))/2 < b by A19,XREAL_1:226;
      then (b+(b-s))/2 in {r : a < r & r < b } by A20;
      then (b+(b-s))/2 in X by RCOMP_1:def 2;
      hence thesis by A15,A19,XREAL_1:226;
    end;
  end;
  a is LowerBound of X
  proof
    let r be ExtReal;
    assume r in X;
    then r in { l where l is Real: a < l & l < b } by RCOMP_1:def 2;
    then ex r1 being Real st r1 = r & a < r1 & r1 < b;
    hence thesis;
  end;
  then
A21: X is bounded_below;
A22: for r being Real st r in X holds a <= r
  proof
    let r be Real;
    assume r in X;
    then r in { l where l is Real: a < l & l < b } by RCOMP_1:def 2;
    then ex r1 being Real st r1 = r & a < r1 & r1 < b;
    hence thesis;
  end;
  b is UpperBound of X
  proof
    let r be ExtReal;
    assume r in X;
    then r in { l where l is Real: a < l & l < b } by RCOMP_1:def 2;
    then ex r1 being Real st r1 = r & a < r1 & r1 < b;
    hence thesis;
  end;
  then
A23: X is bounded_above;
A24: for r being Real st r in X holds b >= r
  proof
    let r be Real;
    assume r in X;
    then r in { l where l is Real: a < l & l < b } by RCOMP_1:def 2;
    then ex r1 being Real st r1 = r & a < r1 & r1 < b;
    hence thesis;
  end;
  (a+b)/2 in X by A4,RCOMP_1:def 2;
  hence thesis by A21,A23,A22,A5,A24,A13,SEQ_4:def 1,def 2;
end;
