let X be set ; :: thesis: for f being PartFunc of REAL ,REAL st X c= dom f & f | X is monotone & f .: X = REAL holds
f | X is continuous

let f be PartFunc of REAL ,REAL ; :: thesis: ( X c= dom f & f | X is monotone & f .: X = REAL implies f | X is continuous )
assume A1: ( X c= dom f & f | X is monotone & f .: X = REAL ) ; :: thesis: f | X is continuous
now
per cases ( f | X is non-decreasing or f | X is non-increasing ) by A1, RFUNCT_2:def 6;
suppose f | X is non-decreasing ; :: thesis: f | X is continuous
then A2: (f | X) | X is non-decreasing ;
for x0 being real number st x0 in dom (f | X) holds
f | X is_continuous_in x0
proof
let x0 be real number ; :: thesis: ( x0 in dom (f | X) implies f | X is_continuous_in x0 )
assume x0 in dom (f | X) ; :: thesis: f | X is_continuous_in x0
then A3: x0 in X by RELAT_1:86;
then x0 in (dom f) /\ X by A1, XBOOLE_0:def 4;
then A4: x0 in dom (f | X) by RELAT_1:90;
A5: (f | X) .: X = f .: X by RELAT_1:162;
now
let N1 be Neighbourhood of (f | X) . x0; :: thesis: ex N being Neighbourhood of x0 st
for x being real number st x in dom (f | X) & x in N holds
(f | X) . x in N1

consider r being real number such that
A6: ( r > 0 & N1 = ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ ) by RCOMP_1:def 7;
reconsider r = r as Real by XREAL_0:def 1;
set M1 = ((f | X) . x0) - (r / 2);
set M2 = ((f | X) . x0) + (r / 2);
A7: r / 2 > 0 by A6, XREAL_1:217;
then A8: ((f | X) . x0) - r < (((f | X) . x0) - r) + (r / 2) by XREAL_1:31;
A9: (f | X) . x0 < ((f | X) . x0) + (r / 2) by A7, XREAL_1:31;
then A10: ((f | X) . x0) - (r / 2) < (f | X) . x0 by XREAL_1:21;
A11: (f | X) . x0 < ((f | X) . x0) + r by A6, XREAL_1:31;
then ((f | X) . x0) - (r / 2) < ((f | X) . x0) + r by A10, XXREAL_0:2;
then A12: ((f | X) . x0) - (r / 2) in ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A8;
A13: ((f | X) . x0) + (r / 2) < (((f | X) . x0) + (r / 2)) + (r / 2) by A7, XREAL_1:31;
((f | X) . x0) - r < (((f | X) . x0) + r) - r by A11, XREAL_1:11;
then ((f | X) . x0) - r < ((f | X) . x0) + (r / 2) by A9, XXREAL_0:2;
then ((f | X) . x0) + (r / 2) in ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A13;
then A14: [.(((f | X) . x0) - (r / 2)),(((f | X) . x0) + (r / 2)).] c= ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A12, XXREAL_2:def 12;
consider r1 being Real such that
A15: ( r1 in dom (f | X) & r1 in X & ((f | X) . x0) - (r / 2) = (f | X) . r1 ) by A1, A5, PARTFUN2:78;
consider r2 being Real such that
A16: ( r2 in dom (f | X) & r2 in X & ((f | X) . x0) + (r / 2) = (f | X) . r2 ) by A1, A5, PARTFUN2:78;
set R = min (x0 - r1),(r2 - x0);
A17: (f | X) . x0 < ((f | X) . x0) + (r / 2) by A7, XREAL_1:31;
then A18: ((f | X) . x0) - (r / 2) < (f | X) . x0 by XREAL_1:21;
A19: r1 <> x0 by A15, A17, XREAL_1:21;
now end;
then r1 < x0 by A19, XXREAL_0:1;
then A22: x0 - r1 > 0 by XREAL_1:52;
A23: ((f | X) . x0) + (r / 2) > (f | X) . x0 by A7, XREAL_1:31;
A24: x0 <> r2 by A7, A16, XREAL_1:31;
now end;
then x0 < r2 by A24, XXREAL_0:1;
then r2 - x0 > 0 by XREAL_1:52;
then min (x0 - r1),(r2 - x0) > 0 by A22, XXREAL_0:15;
then reconsider N = ].(x0 - (min (x0 - r1),(r2 - x0))),(x0 + (min (x0 - r1),(r2 - x0))).[ as Neighbourhood of x0 by RCOMP_1:def 7;
take N = N; :: thesis: for x being real number st x in dom (f | X) & x in N holds
(f | X) . x in N1

let x be real number ; :: thesis: ( x in dom (f | X) & x in N implies (f | X) . x in N1 )
assume A27: ( x in dom (f | X) & x in N ) ; :: thesis: (f | X) . x in N1
then A28: ex s being Real st
( s = x & x0 - (min (x0 - r1),(r2 - x0)) < s & s < x0 + (min (x0 - r1),(r2 - x0)) ) ;
then x0 < (min (x0 - r1),(r2 - x0)) + x by XREAL_1:21;
then A29: x0 - x < ((min (x0 - r1),(r2 - x0)) + x) - x by XREAL_1:11;
min (x0 - r1),(r2 - x0) <= x0 - r1 by XXREAL_0:17;
then x0 - x < x0 - r1 by A29, XXREAL_0:2;
then - (x0 - x) > - (x0 - r1) by XREAL_1:26;
then A30: (x - x0) + x0 > (r1 - x0) + x0 by XREAL_1:8;
A31: x - x0 < min (x0 - r1),(r2 - x0) by A28, XREAL_1:21;
min (x0 - r1),(r2 - x0) <= r2 - x0 by XXREAL_0:17;
then x - x0 < r2 - x0 by A31, XXREAL_0:2;
then A32: (x - x0) + x0 < (r2 - x0) + x0 by XREAL_1:8;
A33: x in X /\ (dom (f | X)) by A27, RELAT_1:87, XBOOLE_1:28;
r2 in X /\ (dom (f | X)) by A16, XBOOLE_0:def 4;
then A34: (f | X) . x <= (f | X) . r2 by A2, A32, A33, RFUNCT_2:45;
r1 in X /\ (dom (f | X)) by A15, XBOOLE_0:def 4;
then (f | X) . r1 <= (f | X) . x by A2, A30, A33, RFUNCT_2:45;
then (f | X) . x in [.(((f | X) . x0) - (r / 2)),(((f | X) . x0) + (r / 2)).] by A15, A16, A34;
hence (f | X) . x in N1 by A6, A14; :: thesis: verum
end;
hence f | X is_continuous_in x0 by FCONT_1:4; :: thesis: verum
end;
hence f | X is continuous by FCONT_1:def 2; :: thesis: verum
end;
suppose f | X is non-increasing ; :: thesis: f | X is continuous
then A35: (f | X) | X is non-increasing by RELAT_1:101;
for x0 being real number st x0 in dom (f | X) holds
f | X is_continuous_in x0
proof
let x0 be real number ; :: thesis: ( x0 in dom (f | X) implies f | X is_continuous_in x0 )
assume x0 in dom (f | X) ; :: thesis: f | X is_continuous_in x0
then A36: x0 in X by RELAT_1:86;
then x0 in (dom f) /\ X by A1, XBOOLE_0:def 4;
then A37: x0 in dom (f | X) by RELAT_1:90;
A38: (f | X) .: X = f .: X by RELAT_1:162;
now
let N1 be Neighbourhood of (f | X) . x0; :: thesis: ex N being Neighbourhood of x0 st
for x being real number st x in dom (f | X) & x in N holds
(f | X) . x in N1

consider r being real number such that
A39: ( r > 0 & N1 = ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ ) by RCOMP_1:def 7;
reconsider r = r as Real by XREAL_0:def 1;
set M1 = ((f | X) . x0) - (r / 2);
set M2 = ((f | X) . x0) + (r / 2);
A40: r / 2 > 0 by A39, XREAL_1:217;
then A41: ((f | X) . x0) - r < (((f | X) . x0) - r) + (r / 2) by XREAL_1:31;
A42: (f | X) . x0 < ((f | X) . x0) + (r / 2) by A40, XREAL_1:31;
then A43: ((f | X) . x0) - (r / 2) < (f | X) . x0 by XREAL_1:21;
A44: (f | X) . x0 < ((f | X) . x0) + r by A39, XREAL_1:31;
then ((f | X) . x0) - (r / 2) < ((f | X) . x0) + r by A43, XXREAL_0:2;
then A45: ((f | X) . x0) - (r / 2) in ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A41;
A46: ((f | X) . x0) + (r / 2) < (((f | X) . x0) + (r / 2)) + (r / 2) by A40, XREAL_1:31;
((f | X) . x0) - r < (((f | X) . x0) + r) - r by A44, XREAL_1:11;
then ((f | X) . x0) - r < ((f | X) . x0) + (r / 2) by A42, XXREAL_0:2;
then ((f | X) . x0) + (r / 2) in ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A46;
then A47: [.(((f | X) . x0) - (r / 2)),(((f | X) . x0) + (r / 2)).] c= ].(((f | X) . x0) - r),(((f | X) . x0) + r).[ by A45, XXREAL_2:def 12;
consider r1 being Real such that
A48: ( r1 in dom (f | X) & r1 in X & ((f | X) . x0) - (r / 2) = (f | X) . r1 ) by A1, A38, PARTFUN2:78;
consider r2 being Real such that
A49: ( r2 in dom (f | X) & r2 in X & ((f | X) . x0) + (r / 2) = (f | X) . r2 ) by A1, A38, PARTFUN2:78;
set R = min (r1 - x0),(x0 - r2);
A50: (f | X) . x0 < ((f | X) . x0) + (r / 2) by A40, XREAL_1:31;
then A51: ((f | X) . x0) - (r / 2) < (f | X) . x0 by XREAL_1:21;
A52: r1 <> x0 by A48, A50, XREAL_1:21;
then r1 > x0 by A52, XXREAL_0:1;
then A55: r1 - x0 > 0 by XREAL_1:52;
A56: ((f | X) . x0) + (r / 2) > (f | X) . x0 by A40, XREAL_1:31;
A57: x0 <> r2 by A40, A49, XREAL_1:31;
then x0 > r2 by A57, XXREAL_0:1;
then x0 - r2 > 0 by XREAL_1:52;
then min (r1 - x0),(x0 - r2) > 0 by A55, XXREAL_0:15;
then reconsider N = ].(x0 - (min (r1 - x0),(x0 - r2))),(x0 + (min (r1 - x0),(x0 - r2))).[ as Neighbourhood of x0 by RCOMP_1:def 7;
take N = N; :: thesis: for x being real number st x in dom (f | X) & x in N holds
(f | X) . x in N1

let x be real number ; :: thesis: ( x in dom (f | X) & x in N implies (f | X) . x in N1 )
assume A60: ( x in dom (f | X) & x in N ) ; :: thesis: (f | X) . x in N1
then A61: ex s being Real st
( s = x & x0 - (min (r1 - x0),(x0 - r2)) < s & s < x0 + (min (r1 - x0),(x0 - r2)) ) ;
then x0 < (min (r1 - x0),(x0 - r2)) + x by XREAL_1:21;
then A62: x0 - x < ((min (r1 - x0),(x0 - r2)) + x) - x by XREAL_1:11;
min (r1 - x0),(x0 - r2) <= x0 - r2 by XXREAL_0:17;
then x0 - x < x0 - r2 by A62, XXREAL_0:2;
then - (x0 - x) > - (x0 - r2) by XREAL_1:26;
then A63: (x - x0) + x0 > (r2 - x0) + x0 by XREAL_1:8;
A64: x - x0 < min (r1 - x0),(x0 - r2) by A61, XREAL_1:21;
min (r1 - x0),(x0 - r2) <= r1 - x0 by XXREAL_0:17;
then x - x0 < r1 - x0 by A64, XXREAL_0:2;
then A65: (x - x0) + x0 < (r1 - x0) + x0 by XREAL_1:8;
A66: x in X /\ (dom (f | X)) by A60, RELAT_1:87, XBOOLE_1:28;
r2 in X /\ (dom (f | X)) by A49, XBOOLE_0:def 4;
then A67: (f | X) . x <= (f | X) . r2 by A35, A63, A66, RFUNCT_2:46;
r1 in X /\ (dom (f | X)) by A48, XBOOLE_0:def 4;
then (f | X) . r1 <= (f | X) . x by A35, A65, A66, RFUNCT_2:46;
then (f | X) . x in [.(((f | X) . x0) - (r / 2)),(((f | X) . x0) + (r / 2)).] by A48, A49, A67;
hence (f | X) . x in N1 by A39, A47; :: thesis: verum
end;
hence f | X is_continuous_in x0 by FCONT_1:4; :: thesis: verum
end;
hence f | X is continuous by FCONT_1:def 2; :: thesis: verum
end;
end;
end;
hence f | X is continuous ; :: thesis: verum