reserve n,m for Nat;
reserve x,X,X1 for set;
reserve s,g,r,p for Real;
reserve S,T for RealNormSpace;
reserve f,f1,f2 for PartFunc of S,T;
reserve s1,s2 for sequence of S;
reserve x0,x1,x2 for Point of S;
reserve Y for Subset of S;

theorem
  for f be PartFunc of the carrier of S,REAL for Y st Y<>{} & Y c= dom f
  & Y is compact & f is_continuous_on Y ex x1,x2 st x1 in Y & x2 in Y & f/.x1 =
  upper_bound (f.:Y) & f/.x2 = lower_bound (f.:Y)
proof
  let f be PartFunc of the carrier of S,REAL;
  let Y such that
A1: Y <> {} and
A2: Y c= dom f and
A3: Y is compact and
A4: f is_continuous_on Y;
A5: dom (f|Y) = dom f /\ Y by RELAT_1:61
    .= Y by A2,XBOOLE_1:28;
  f|Y is_continuous_on Y
  proof
    thus Y c= dom (f|Y) by A5;
    let r be Point of S;
    assume r in Y;
    then f|Y is_continuous_in r by A4;
    hence thesis by RELAT_1:72;
  end;
  then consider x1,x2 such that
A6: x1 in dom (f|Y) & x2 in dom (f|Y) and
A7: (f|Y)/.x1 = upper_bound (rng (f|Y)) & (f|Y)/.x2 = lower_bound (rng
  (f|Y)) by A1,A3,A5,Th33;
  take x1,x2;
  thus x1 in Y & x2 in Y by A5,A6;
  (f|Y)/.x1 =f/.x1 & (f|Y)/.x2 =f/.x2 by A6,PARTFUN2:15;
  hence thesis by A7,RELAT_1:115;
end;
