reserve r, s, t, g for Real,

          r3, r1, r2, q3, p3 for Real;
reserve T for TopStruct,
  f for RealMap of T;

theorem Th15:
  for T being non empty TopSpace holds (for f being RealMap of T
  st f is continuous holds f is bounded) iff for f being RealMap of T st f is
  continuous holds f is with_max
proof
  let T be non empty TopSpace;
  set cT = the carrier of T;
  hereby
    assume
A1: for f being RealMap of T st f is continuous holds f is bounded;
    let f be RealMap of T such that
A2: f is continuous;
    set fcT = f.:cT;
    f is bounded by A1,A2;
    then
A3: fcT is bounded_above by MEASURE6:def 11;
    set b = upper_bound fcT;
    set bf = b+-f;
    -f is continuous by A2,Th9;
    then
A4: bf is continuous by Th10;
    reconsider bf9 = bf as Function of cT, REAL;
    reconsider f9 = f as Function of cT, REAL;
    set g = Inv bf;
    set gcT = g.:cT;
    assume not f is with_max;
    then
A5: not fcT is with_max;
    then
A6: not upper_bound (fcT) in fcT by A3;
    now
      assume 0 in rng bf;
      then consider x being object such that
A7:   x in dom bf and
A8:   bf.x = 0 by FUNCT_1:def 3;
      reconsider x as Element of cT by A7;
      bf9.x = b+(-f9).x by VALUED_1:2
        .= b+-(f.x) by VALUED_1:8
        .= b-f.x;
      hence contradiction by A6,A8,FUNCT_2:35;
    end;
    then
A9: g is continuous by A4,Th11;
    now
      g is bounded by A1,A9;
      then gcT is bounded_above by MEASURE6:def 11;
      then consider p be Real such that
A10:  p is UpperBound of gcT;
A11:  for r be Real st r in gcT holds r <= p by A10,XXREAL_2:def 1;
      per cases;
      suppose
A12:    p <= 0;
        reconsider a19 = 1 as Real;
        take a19;
        thus a19 > 0;
        let r be Real;
        assume r in gcT;
        hence r <= a19 by A11,A12;
      end;
      suppose
A13:    p > 0;
        take p;
        thus p>0 by A13;
        thus for r be Real st r in gcT holds r <= p by A11;
      end;
    end;
    then consider p be Real such that
A14: p > 0 and
A15: for r be Real st r in gcT holds r <= p;
    consider r be Real such that
A16: r in fcT and
A17: b-1/p < r by A3,A14,SEQ_4:def 1;
    consider x being object such that
A18: x in the carrier of T and
    x in the carrier of T and
A19: r = f.x by A16,FUNCT_2:64;
    reconsider x as Element of T by A18;
A20: f.x <= b by A3,A16,A19,SEQ_4:def 1;
    f.x <> b by A3,A5,A16,A19;
    then f.x+0 < b by A20,XXREAL_0:1;
    then
A21: b-f.x > 0 by XREAL_1:20;
    g.x = (bf9.x)" by VALUED_1:10
      .= (b+(-f9).x)" by VALUED_1:2
      .= 1/(b+(-f9).x)
      .= 1/(b+-(f.x)) by VALUED_1:8
      .= 1/(b-f.x);
    then 1/(b-f.x) <= p by A15,FUNCT_2:35;
    then 1 <= p*(b-f.x) by A21,XREAL_1:81;
    then 1/p <= b-f.x by A14,XREAL_1:79;
    then f.x+1/p <= b by XREAL_1:19;
    hence contradiction by A17,A19,XREAL_1:19;
  end;
  assume
A22: for f being RealMap of T st f is continuous holds f is with_max;
  let f be RealMap of T;
  assume
A23: f is continuous;
  then f is with_max by A22;
  then f.:(the carrier of T) is with_max;
  then f.:(the carrier of T) is bounded_above;
  hence f is bounded_above;
  f is with_min by A22,A23,Th14;
  then f.:(the carrier of T) is with_min;
  then f.:(the carrier of T) is bounded_below;
  hence thesis;
end;
