reserve r,s,t,x9,y9,z9,p,q for Element of RAT+;
reserve x,y,z for Element of REAL+;

theorem
  for X,Y being Subset of REAL+ st (ex x st x in Y) & for x,y st x in X
& y in Y holds x <=' y ex z st for x,y st x in X & y in Y holds x <=' z & z <='
  y
proof
  let X,Y be Subset of REAL+;
  given x1 being Element of REAL+ such that
A1: x1 in Y;
  set Z = {z9 : ex x,z st z = z9 & x in X & z < x};
  assume
A2: for x,y st x in X & y in Y holds x <=' y;
  per cases;
  suppose
    ex z9 st for x9 holds x9 in Z iff x9 < z9;
    then consider z9 such that
A3: for x9 holds x9 in Z iff x9 < z9;
    reconsider z = z9 as Element of REAL+ by Th1;
    take z;
    let x,y such that
A4: x in X and
A5: y in Y;
    thus x <=' z
    proof
      assume z < x;
      then consider x0 being Element of REAL+ such that
A6:   x0 in RAT+ and
A7:   x0 < x & z < x0 by Lm30;
      reconsider x9 = x0 as Element of RAT+ by A6;
      z9 < x9 & x9 in Z by A4,A7,Lm14;
      hence contradiction by A3;
    end;
    assume y < z;
    then consider y0 being Element of REAL+ such that
A8: y0 in RAT+ and
A9: y0 < z and
A10: y < y0 by Lm30;
    reconsider y9 = y0 as Element of RAT+ by A8;
    y9 < z9 by A9,Lm14;
    then y9 in Z by A3;
    then
    ex y99 being Element of RAT+ st y9 = y99 & ex x,z st z = y99 & x in X
    & z < x;
    then consider x1,y1 being Element of REAL+ such that
A11: y1 = y9 and
A12: x1 in X and
A13: y1 < x1;
    y < x1 by A10,A11,A13,Lm31;
    hence contradiction by A2,A5,A12;
  end;
  suppose
A14: not ex z9 st for x9 holds x9 in Z iff x9 < z9;
A15: now
      assume Z in RA;
      then consider t such that
A16:  Z = { s: s < t } and
      t <> {};
      for x9 holds x9 in Z iff x9 < t
      proof
        let x9;
        hereby
          assume x9 in Z;
          then ex s st s = x9 & s < t by A16;
          hence x9 < t;
        end;
        thus thesis by A16;
      end;
      hence contradiction by A14;
    end;
A17: Z c= RAT+
    proof
      let e be object;
      assume e in Z;
      then ex z9 st e = z9 & ex x,z st z = z9 & x in X & z < x;
      hence thesis;
    end;
    now
      assume Z = {};
      then
A18:  for x9 st x9 in Z holds x9 < {};
      for x9 st x9 < {} holds x9 in Z by ARYTM_3:64;
      hence contradiction by A14,A18;
    end;
    then reconsider Z as non empty Subset of RAT+ by A17;
A19: now
      assume
A20:  Z = RAT+;
      per cases;
      suppose
        x1 in RAT+;
        then reconsider x9 = x1 as Element of RAT+;
        x9 in Z by A20;
        then ex z9 st x9 = z9 & ex x,z st z = z9 & x in X & z < x;
        hence contradiction by A1,A2;
      end;
      suppose
A21:    not x1 in RAT+;
        x1 in REAL+;
        then x1 in IR by A21,Lm3,XBOOLE_0:def 3;
        then consider A being Subset of RAT+ such that
A22:    x1 = A and
        r in A implies (for s st s <=' r holds s in A) & ex s st s in A &
        r < s;
        x1 <> RAT+ by Lm28;
        then consider x9 being Element of RAT+ such that
A23:    not x9 in A by A22,SUBSET_1:28;
        reconsider x2 = x9 as Element of REAL+ by Th1;
        x2 in Z by A20;
        then ex z9 st x9 = z9 & ex x,z st z = z9 & x in X & z < x;
        then consider x such that
A24:    x in X and
A25:    x2 < x;
        x1 < x2 by A21,A22,A23,Def5;
        then x1 < x by A25,Lm31;
        hence contradiction by A1,A2,A24;
      end;
    end;
    t in Z implies (for s st s <=' t holds s in Z) & ex s st s in Z & t < s
    proof
      reconsider y0 = t as Element of REAL+ by Th1;
      assume t in Z;
      then ex z9 st z9 = t & ex x,z st z = z9 & x in X & z < x;
      then consider x0 being Element of REAL+ such that
A26:  x0 in X and
A27:  y0 < x0;
      thus for s st s <=' t holds s in Z
      proof
        let s;
        reconsider z = s as Element of REAL+ by Th1;
        assume s <=' t;
        then z <=' y0 by Lm14;
        then z < x0 by A27,Lm31;
        hence thesis by A26;
      end;
      consider z such that
A28:  z in RAT+ and
A29:  z < x0 and
A30:  y0 < z by A27,Lm30;
      reconsider z9 = z as Element of RAT+ by A28;
      take z9;
      thus z9 in Z by A26,A29;
      thus thesis by A30,Lm14;
    end;
    then Z in IR;
    then
A31: Z in IR \ {RAT+} by A19,ZFMISC_1:56;
    then Z in IR \ {RAT+} \ RA by A15,XBOOLE_0:def 5;
    then reconsider z = Z as Element of REAL+ by Lm4;
    take z;
    let x,y such that
A32: x in X and
A33: y in Y;
A34: now
      assume z in RAT+;
      then z in {{}} by A31,Lm9,XBOOLE_0:def 4;
      hence contradiction by TARSKI:def 1;
    end;
    hereby
      assume z < x;
      then consider x0 being Element of REAL+ such that
A35:  x0 in RAT+ and
A36:  x0 < x and
A37:  z < x0 by Lm30;
      reconsider x9 = x0 as Element of RAT+ by A35;
      x9 in z by A32,A36;
      hence contradiction by A34,A37,Def5;
    end;
    assume y < z;
    then consider y0 being Element of REAL+ such that
A38: y0 in RAT+ and
A39: y0 < z and
A40: y < y0 by Lm30;
    reconsider y9 = y0 as Element of RAT+ by A38;
    y9 in z by A34,A39,Def5;
    then ex z9 st y9 = z9 & ex x,z st z = z9 & x in X & z < x;
    then consider x0 being Element of REAL+ such that
A41: x0 in X and
A42: y0 < x0;
    y < x0 by A40,A42,Lm31;
    hence contradiction by A2,A33,A41;
  end;
end;
