reserve a, b, r, s for Real;

theorem Th5:
  r < s implies upper_bound [.r,s.[ = s
proof
  set X = [.r,s.[;
  assume
A1: r < s;
A2: for a st a in X holds a <= s by XXREAL_1:3;
A3: r < (r+s)/2 by A1,XREAL_1:226;
A4: (r+s)/2 < s by A1,XREAL_1:226;
A5: for b st 0 < b ex a st a in X & s-b < a
  proof
    let b such that
A6: 0 < b and
A7: for a st a in X holds a <= s-b;
    per cases;
    suppose
      s - b <= r;
      then
A8:   (r+s)/2 > s-b by A3,XXREAL_0:2;
      (r+s)/2 in X by A3,A4,XXREAL_1:3;
      hence thesis by A7,A8;
    end;
    suppose
A9:   s - b > r;
A10:  s - b < s - 0 by A6,XREAL_1:15;
      then s-b < (s+(s-b))/2 by XREAL_1:226;
      then
A11:  r < (s+(s-b))/2 by A9,XXREAL_0:2;
      (s+(s-b))/2 < s by A10,XREAL_1:226;
      then (s+(s-b))/2 in X by A11,XXREAL_1:3;
      hence thesis by A7,A10,XREAL_1:226;
    end;
  end;
  X is non empty by A1,XXREAL_1:3;
  hence thesis by A2,A5,SEQ_4:def 1;
end;
