reserve n,m,k,k1,k2 for Nat;
reserve r,r1,r2,s,t,p for Real;
reserve seq,seq1,seq2 for Real_Sequence;
reserve x,y for set;

theorem Th47:
  seq is bounded_above implies (superior_realsequence seq).n = max
  ((superior_realsequence seq).(n+1),seq.n)
proof
  reconsider Y2 = {seq.k : n+1 <= k} as Subset of REAL by Th29;
  reconsider Y1 = {seq.k : n <= k} as Subset of REAL by Th29;
  reconsider Y3 = {seq.n} as Subset of REAL;
A1: (superior_realsequence seq).(n+1) = upper_bound Y2 by Def5;
  assume
A2: seq is bounded_above;
  then
A3: Y2 <> {} & Y2 is bounded_above by Th31,SETLIM_1:1;
A4: Y3 is bounded_above
  proof
    consider t such that
A5: for m holds seq.m<t by A2,SEQ_2:def 3;
    t is UpperBound of Y3
    proof
      let r be ExtReal;
      assume r in Y3;
      then r = seq.n by TARSKI:def 1;
      hence r <=t by A5;
    end;
    hence thesis;
  end;
  (superior_realsequence seq).n = upper_bound Y1 by Def5;
  then (superior_realsequence seq).n = upper_bound (Y2 \/ Y3) by SETLIM_1:2
    .= max(upper_bound Y2,upper_bound Y3) by A3,A4,SEQ_4:143
    .= max((superior_realsequence seq).(n+1),seq.n) by A1,SEQ_4:9;
  hence thesis;
end;
