reserve n,n1,m,k for Nat;
reserve x,y for set;
reserve s,g,g1,g2,r,p,p2,q,t for Real;
reserve s1,s2,s3 for Real_Sequence;
reserve Nseq for increasing sequence of NAT;
reserve X for Subset of REAL;

theorem Th12:
  for X st X<>{} & X is closed & X is bounded_above holds upper_bound X in X
proof
  let X such that
A1: X<>{} and
A2: X is closed and
A3: X is bounded_above and
A4: not upper_bound X in X;
  set s1=upper_bound X;
  defpred P[Element of NAT,Element of REAL] means ex q st q=$2 & q in X & s1 -
  q < 1/($1+1);
A5: for n being Element of NAT ex p being Element of REAL st P[n,p]
  proof
    let n be Element of NAT;
    0<(n+1)";
    then 0<1/(n+1) by XCMPLX_1:215;
    then consider t such that
A6: t in X and
A7: s1 -1/(n+1) <t by A1,A3,SEQ_4:def 1;
    take t;
    s1 < t + 1/(n+1) by A7,XREAL_1:19;
    then s1 -t < 1/(n+1) by XREAL_1:19;
    hence thesis by A6;
  end;
  consider f being sequence of REAL such that
A8: for n being Element of NAT holds P[n,f.n] from FUNCT_2:sch 3(A5);
A9: now
    let n;
        n in NAT by ORDINAL1:def 12;
    then ex q st q = f.n & q in X & s1 -q < 1/(n+1) by A8;
    hence f.n in X & s1 - f.n<1/(n+1);
  end;
A10: rng f c= X
  proof
    let x be object;
    assume x in rng f;
    then consider y being object such that
A11: y in dom f and
A12: x = f.y by FUNCT_1:def 3;
    reconsider y as Element of NAT by A11,FUNCT_2:def 1;
    f.y in X by A9;
    hence thesis by A12;
  end;
A13: now
    let s;
    assume
A14: 0<s;
    consider n such that
A15: s"<n by SEQ_4:3;
    take k=n;
    let m;
    assume k<=m;
    then k+1<=m+1 by XREAL_1:6;
    then
A16: 1/(m+1)<=1/(k+1) by XREAL_1:118;
    f.m in X by A9;
    then f.m <= s1 by A3,SEQ_4:def 1;
    then
A17: 0 <= s1-f.m by XREAL_1:48;
    s"+0 <n+1 by A15,XREAL_1:8;
    then 1/(n+1)<1/s" by A14,XREAL_1:76;
    then 1/(n+1)<s by XCMPLX_1:216;
    then 1/(m+1)<s by A16,XXREAL_0:2;
    then s1 - f.m<s by A9,XXREAL_0:2;
    then |.-(f.m - s1).|<s by A17,ABSVALUE:def 1;
    hence |.f.m - s1.|<s by COMPLEX1:52;
  end;
  then
A18: f is convergent;
  then lim f=s1 by A13,SEQ_2:def 7;
  hence contradiction by A2,A4,A18,A10;
end;
